Details
-
Bug
-
Resolution: Out of scope
-
P3: Somewhat important
-
4.5.1
-
None
Description
If you have set the cursor for some QGraphicsItems you can no longer change the cursor for the view in for example a mouseReleaseEvent.
In the example code belove the cursor for the view is originaly set to the PointingHandCursor but it does not change on the mouseReleaseEvent. If you remove the cursor setting for the items it will change on every mouseReleaseEvent.
Example Code: #include <QtGui> class QTCursorTest : public QGraphicsView { public: QTCursorTest::QTCursorTest(QWidget *parent = 0) : QGraphicsView(parent) { setScene(new QGraphicsScene); scene()->addRect(0, 0, 100, 100)->setCursor(Qt::CrossCursor); // remove these calls to setCursor scene()->addRect(120, 120, 50, 50)->setCursor(Qt::WaitCursor); // and setCursor for the view works again. setCursor(Qt::PointingHandCursor); } void QTCursorTest::mouseReleaseEvent(QMouseEvent *event) { setCursor(Qt::CursorShape(rand() % 18)); qDebug() << "Now I should change the cursor"; QGraphicsView::mouseReleaseEvent(event); } }; int main(int argc, char *argv[]) { QApplication app(argc, argv); QTCursorTest widget; widget.show(); return app.exec(); }