1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-11-29 07:24:13 +01:00

Add Qt < 5.6 compatibility again

This commit is contained in:
James Duley 2016-05-07 08:59:54 +01:00
parent 19b474341c
commit f4955741bf
2 changed files with 19 additions and 0 deletions

View File

@ -607,11 +607,27 @@ QtKeyboardMap OSGViewport::Hidden::keyMap = QtKeyboardMap();
OSGViewport::OSGViewport(QQuickItem *parent) : Inherited(parent), h(new Hidden(this))
{
// setClearBeforeRendering(false);
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
setMirrorVertically(true);
#endif
setAcceptHoverEvents(true);
setAcceptedMouseButtons(Qt::AllButtons);
}
#if QT_VERSION < QT_VERSION_CHECK(5, 6, 0)
QSGNode *OSGViewport::updatePaintNode(QSGNode *node, QQuickItem::UpdatePaintNodeData *nodeData)
{
if (!node) {
node = QQuickFramebufferObject::updatePaintNode(node, nodeData);
QSGSimpleTextureNode *n = static_cast<QSGSimpleTextureNode *>(node);
if (n)
n->setTextureCoordinatesTransform(QSGSimpleTextureNode::MirrorVertically);
return node;
}
return QQuickFramebufferObject::updatePaintNode(node, nodeData);
}
#endif
OSGViewport::~OSGViewport()
{
delete h;

View File

@ -93,6 +93,9 @@ signals:
void busyChanged(bool busy);
protected:
#if QT_VERSION < QT_VERSION_CHECK(5, 6, 0)
QSGNode *updatePaintNode(QSGNode *node, QQuickItem::UpdatePaintNodeData *nodeData) override;
#endif
// QQuickItem
void mousePressEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);