Details
-
Bug
-
Resolution: Out of scope
-
P3: Somewhat important
-
3.x, 4.2.0, 4.2.1, 4.2.2, 4.2.3, 4.3.0, 4.3.1, 4.3.2, 4.3.3, 4.3.4, 4.3.5, 4.4.0, 4.4.1, 4.4.2, 4.4.3, 4.5.0, 4.5.1, 4.5.2, 4.5.3, 4.6.0, 4.7.0, 4.7.1, 5.0.0, Some future release
-
None
Description
It seems QGraphicsView::translate() has no effect. You would expect it to shift the scene around, but it has no visual impact at all.
This (broken) behavior has been stable since 4.2. Rotating and scaling works as expected.
See the following example:
#include <QtGui> class Widget : public QWidget { Q_OBJECT public: Widget() { scene.addRect(0, 0, 100, 100); scene.addRect(25, 25, 50, 50); QVBoxLayout *layout = new QVBoxLayout; view = new QGraphicsView(&scene); layout->addWidget(view); QPushButton *button = new QPushButton; layout->addWidget(button); setLayout(layout); connect(button, SIGNAL(clicked()), this, SLOT(translate())); // the two lines below have no effect on the translation view->setTransformationAnchor(QGraphicsView::NoAnchor); view->setResizeAnchor(QGraphicsView::NoAnchor); } private slots: void translate() { view->translate(25, 0); } private: QGraphicsScene scene; QGraphicsView *view; }; int main(int argc, char *argv[]) { QApplication app(argc, argv); Widget widget; widget.show(); return app.exec(); } #include "main.moc"