|
@@ -102,12 +102,12 @@ class QGraphicsEmbedScene(QGraphicsScene): |
|
|
# Render the scene into the fbo, scaling the QPainter's view |
|
|
# Render the scene into the fbo, scaling the QPainter's view |
|
|
# transform up to the power-of-two fbo size. |
|
|
# transform up to the power-of-two fbo size. |
|
|
painter = QPainter(self.fbo) |
|
|
painter = QPainter(self.fbo) |
|
|
painter.setWindow(0, 0, size.width(), size.height()); |
|
|
|
|
|
painter.setViewport(0, 0, fboSize.width(), fboSize.height()); |
|
|
|
|
|
|
|
|
painter.setWindow(0, 0, size.width(), size.height()) |
|
|
|
|
|
painter.setViewport(0, 0, fboSize.width(), fboSize.height()) |
|
|
self.render(painter) |
|
|
self.render(painter) |
|
|
painter.end() |
|
|
painter.end() |
|
|
self.dirty = False |
|
|
self.dirty = False |
|
|
return self.fbo.texture(); |
|
|
|
|
|
|
|
|
return self.fbo.texture() |
|
|
|
|
|
|
|
|
def deliverEvent(self, event, texCoord): |
|
|
def deliverEvent(self, event, texCoord): |
|
|
# Map the texture co-ordinate into "screen" co-ordinates. |
|
|
# Map the texture co-ordinate into "screen" co-ordinates. |
|
@@ -140,78 +140,78 @@ class QGraphicsEmbedScene(QGraphicsScene): |
|
|
QEvent.GraphicsSceneMouseDoubleClick): |
|
|
QEvent.GraphicsSceneMouseDoubleClick): |
|
|
pass |
|
|
pass |
|
|
#QGraphicsSceneMouseEvent *ev = |
|
|
#QGraphicsSceneMouseEvent *ev = |
|
|
#static_cast<QGraphicsSceneMouseEvent *>(event); |
|
|
|
|
|
#QGraphicsSceneMouseEvent e(ev->type()); |
|
|
|
|
|
#e.setPos(QPointF(screenX, screenY)); |
|
|
|
|
|
#e.setScenePos(QPointF(screenX + bounds.x(), screenY + bounds.y())); |
|
|
|
|
|
#e.setScreenPos(QPoint(screenX, screenY)); |
|
|
|
|
|
#e.setButtonDownScreenPos(ev->button(), d->pressedPos); |
|
|
|
|
|
|
|
|
#static_cast<QGraphicsSceneMouseEvent *>(event) |
|
|
|
|
|
#QGraphicsSceneMouseEvent e(ev->type()) |
|
|
|
|
|
#e.setPos(QPointF(screenX, screenY)) |
|
|
|
|
|
#e.setScenePos(QPointF(screenX + bounds.x(), screenY + bounds.y())) |
|
|
|
|
|
#e.setScreenPos(QPoint(screenX, screenY)) |
|
|
|
|
|
#e.setButtonDownScreenPos(ev->button(), d->pressedPos) |
|
|
#e.setButtonDownScenePos |
|
|
#e.setButtonDownScenePos |
|
|
#(ev->button(), QPointF(d->pressedPos.x() + bounds.x(), |
|
|
#(ev->button(), QPointF(d->pressedPos.x() + bounds.x(), |
|
|
#d->pressedPos.y() + bounds.y())); |
|
|
|
|
|
#e.setButtons(ev->buttons()); |
|
|
|
|
|
#e.setButton(ev->button()); |
|
|
|
|
|
#e.setModifiers(ev->modifiers()); |
|
|
|
|
|
#e.setAccepted(false); |
|
|
|
|
|
#QApplication::sendEvent(this, &e); |
|
|
|
|
|
|
|
|
#d->pressedPos.y() + bounds.y())) |
|
|
|
|
|
#e.setButtons(ev->buttons()) |
|
|
|
|
|
#e.setButton(ev->button()) |
|
|
|
|
|
#e.setModifiers(ev->modifiers()) |
|
|
|
|
|
#e.setAccepted(false) |
|
|
|
|
|
#QApplication::sendEvent(this, &e) |
|
|
|
|
|
|
|
|
elif eventType == QEvent.GraphicsSceneWheel: |
|
|
elif eventType == QEvent.GraphicsSceneWheel: |
|
|
pass |
|
|
pass |
|
|
#QGraphicsSceneWheelEvent *ev = |
|
|
#QGraphicsSceneWheelEvent *ev = |
|
|
#static_cast<QGraphicsSceneWheelEvent *>(event); |
|
|
|
|
|
#QGraphicsSceneWheelEvent e(QEvent::GraphicsSceneWheel); |
|
|
|
|
|
#e.setPos(QPointF(screenX, screenY)); |
|
|
|
|
|
#e.setScenePos(QPointF(screenX + bounds.x(), screenY + bounds.y())); |
|
|
|
|
|
#e.setScreenPos(QPoint(screenX, screenY)); |
|
|
|
|
|
#e.setButtons(ev->buttons()); |
|
|
|
|
|
#e.setModifiers(ev->modifiers()); |
|
|
|
|
|
#e.setDelta(ev->delta()); |
|
|
|
|
|
#e.setOrientation(ev->orientation()); |
|
|
|
|
|
#e.setAccepted(false); |
|
|
|
|
|
#QApplication::sendEvent(this, &e); |
|
|
|
|
|
|
|
|
#static_cast<QGraphicsSceneWheelEvent *>(event) |
|
|
|
|
|
#QGraphicsSceneWheelEvent e(QEvent::GraphicsSceneWheel) |
|
|
|
|
|
#e.setPos(QPointF(screenX, screenY)) |
|
|
|
|
|
#e.setScenePos(QPointF(screenX + bounds.x(), screenY + bounds.y())) |
|
|
|
|
|
#e.setScreenPos(QPoint(screenX, screenY)) |
|
|
|
|
|
#e.setButtons(ev->buttons()) |
|
|
|
|
|
#e.setModifiers(ev->modifiers()) |
|
|
|
|
|
#e.setDelta(ev->delta()) |
|
|
|
|
|
#e.setOrientation(ev->orientation()) |
|
|
|
|
|
#e.setAccepted(false) |
|
|
|
|
|
#QApplication::sendEvent(this, &e) |
|
|
|
|
|
|
|
|
elif eventType in (QEvent.MouseButtonPress, |
|
|
elif eventType in (QEvent.MouseButtonPress, |
|
|
QEvent.MouseButtonRelease, |
|
|
QEvent.MouseButtonRelease, |
|
|
QEvent.MouseButtonDblClick, |
|
|
QEvent.MouseButtonDblClick, |
|
|
QEvent.MouseMove): |
|
|
QEvent.MouseMove): |
|
|
pass |
|
|
pass |
|
|
#QMouseEvent *ev = static_cast<QMouseEvent *>(event); |
|
|
|
|
|
#QEvent::Type type; |
|
|
|
|
|
|
|
|
#QMouseEvent *ev = static_cast<QMouseEvent *>(event) |
|
|
|
|
|
#QEvent::Type type |
|
|
#if (ev->type() == QEvent::MouseButtonPress) |
|
|
#if (ev->type() == QEvent::MouseButtonPress) |
|
|
#type = QEvent::GraphicsSceneMousePress; |
|
|
|
|
|
|
|
|
#type = QEvent::GraphicsSceneMousePress |
|
|
#else if (ev->type() == QEvent::MouseButtonRelease) |
|
|
#else if (ev->type() == QEvent::MouseButtonRelease) |
|
|
#type = QEvent::GraphicsSceneMouseRelease; |
|
|
|
|
|
|
|
|
#type = QEvent::GraphicsSceneMouseRelease |
|
|
#else if (ev->type() == QEvent::MouseButtonDblClick) |
|
|
#else if (ev->type() == QEvent::MouseButtonDblClick) |
|
|
#type = QEvent::GraphicsSceneMouseDoubleClick; |
|
|
|
|
|
|
|
|
#type = QEvent::GraphicsSceneMouseDoubleClick |
|
|
#else |
|
|
#else |
|
|
#type = QEvent::GraphicsSceneMouseMove; |
|
|
|
|
|
#QGraphicsSceneMouseEvent e(type); |
|
|
|
|
|
#e.setPos(QPointF(screenX, screenY)); |
|
|
|
|
|
#e.setScenePos(QPointF(screenX + bounds.x(), screenY + bounds.y())); |
|
|
|
|
|
#e.setScreenPos(QPoint(screenX, screenY)); |
|
|
|
|
|
#e.setButtonDownScreenPos(ev->button(), d->pressedPos); |
|
|
|
|
|
|
|
|
#type = QEvent::GraphicsSceneMouseMove |
|
|
|
|
|
#QGraphicsSceneMouseEvent e(type) |
|
|
|
|
|
#e.setPos(QPointF(screenX, screenY)) |
|
|
|
|
|
#e.setScenePos(QPointF(screenX + bounds.x(), screenY + bounds.y())) |
|
|
|
|
|
#e.setScreenPos(QPoint(screenX, screenY)) |
|
|
|
|
|
#e.setButtonDownScreenPos(ev->button(), d->pressedPos) |
|
|
#e.setButtonDownScenePos |
|
|
#e.setButtonDownScenePos |
|
|
#(ev->button(), QPointF(d->pressedPos.x() + bounds.x(), |
|
|
#(ev->button(), QPointF(d->pressedPos.x() + bounds.x(), |
|
|
#d->pressedPos.y() + bounds.y())); |
|
|
|
|
|
#e.setButtons(ev->buttons()); |
|
|
|
|
|
#e.setButton(ev->button()); |
|
|
|
|
|
#e.setModifiers(ev->modifiers()); |
|
|
|
|
|
#e.setAccepted(false); |
|
|
|
|
|
#QApplication::sendEvent(this, &e); |
|
|
|
|
|
|
|
|
#d->pressedPos.y() + bounds.y())) |
|
|
|
|
|
#e.setButtons(ev->buttons()) |
|
|
|
|
|
#e.setButton(ev->button()) |
|
|
|
|
|
#e.setModifiers(ev->modifiers()) |
|
|
|
|
|
#e.setAccepted(false) |
|
|
|
|
|
#QApplication::sendEvent(this, &e) |
|
|
|
|
|
|
|
|
elif eventType == QEvent.Wheel: |
|
|
elif eventType == QEvent.Wheel: |
|
|
pass |
|
|
pass |
|
|
#QWheelEvent *ev = static_cast<QWheelEvent *>(event); |
|
|
|
|
|
#QGraphicsSceneWheelEvent e(QEvent::GraphicsSceneWheel); |
|
|
|
|
|
#e.setPos(QPointF(screenX, screenY)); |
|
|
|
|
|
#e.setScenePos(QPointF(screenX + bounds.x(), screenY + bounds.y())); |
|
|
|
|
|
#e.setScreenPos(QPoint(screenX, screenY)); |
|
|
|
|
|
#e.setButtons(ev->buttons()); |
|
|
|
|
|
#e.setModifiers(ev->modifiers()); |
|
|
|
|
|
#e.setDelta(ev->delta()); |
|
|
|
|
|
#e.setOrientation(ev->orientation()); |
|
|
|
|
|
#e.setAccepted(false); |
|
|
|
|
|
#QApplication::sendEvent(this, &e); |
|
|
|
|
|
|
|
|
#QWheelEvent *ev = static_cast<QWheelEvent *>(event) |
|
|
|
|
|
#QGraphicsSceneWheelEvent e(QEvent::GraphicsSceneWheel) |
|
|
|
|
|
#e.setPos(QPointF(screenX, screenY)) |
|
|
|
|
|
#e.setScenePos(QPointF(screenX + bounds.x(), screenY + bounds.y())) |
|
|
|
|
|
#e.setScreenPos(QPoint(screenX, screenY)) |
|
|
|
|
|
#e.setButtons(ev->buttons()) |
|
|
|
|
|
#e.setModifiers(ev->modifiers()) |
|
|
|
|
|
#e.setDelta(ev->delta()) |
|
|
|
|
|
#e.setOrientation(ev->orientation()) |
|
|
|
|
|
#e.setAccepted(false) |
|
|
|
|
|
#QApplication::sendEvent(this, &e) |
|
|
|
|
|
|
|
|
#else: |
|
|
#else: |
|
|
# Send the event directly without any conversion. |
|
|
# Send the event directly without any conversion. |
|
|