Details
-
Bug
-
Resolution: Out of scope
-
P3: Somewhat important
-
4.6.2
-
None
Description
It can make things quite unusable if the context menu has actions to operate on the selection.
The following example demonstrates the problem:
#include <QtGui> int main( int argc, char** argv ){ QApplication app( argc, argv ); //give a seed for the pseudo-random generator qsrand(QTime::currentTime().msecsTo(QTime(0,0,0))); QGraphicsView view; QGraphicsScene *scene = new QGraphicsScene(0, 0, 320, 240); QAbstractGraphicsShapeItem *gi; for (int i = 0; i< 12; ++i ) { QColor color = QColor::fromHsv(((qrand()%12)*30), 255, 255); QRectF itemRect(qrand()%270, qrand()%190, (10 * (qrand() % 4 + 1)), (10*(qrand() % 4 + 1))); if (!(i%3)) gi = new QGraphicsEllipseItem(itemRect); else gi = new QGraphicsRectItem(itemRect); gi->setBrush(color); gi->setFlags(QGraphicsItem::ItemIsSelectable); scene->addItem(gi); } view.setRenderHints(QPainter::Antialiasing); view.setDragMode(QGraphicsView::RubberBandDrag); view.setContextMenuPolicy(Qt::ActionsContextMenu); view.addAction(new QAction("dummy 1",&view)); view.addAction(new QAction("dummy 2", &view)); view.setMouseTracking(true); view.setScene(scene); view.scale(2,2); view.resize(680,500); view.show(); return app.exec(); }
Attachments
Issue Links
- replaces
-
QTBUG-2305 QGraphicsView: When right clicking on a view to get the context menu it causes the selection to be deselected
-
- Closed
-