Details
-
Bug
-
Resolution: Cannot Reproduce
-
P2: Important
-
None
-
5.3.1
-
Windows 7 64-bit
Description
I know that QQuickWidget carries a minor performance hit, but I wonder if what I'm seeing is beyond the scope of that disclaimer:
#include <QtWidgets> #include <QtQuickWidgets> class View : public QWidget { Q_OBJECT public: View(QWidget *parent) : QWidget(parent), mView(new QGraphicsView(this)), mQuickWidget(new QQuickWidget(this)) { setLayout(new QHBoxLayout); mView->setScene(new QGraphicsScene); mView->scene()->addEllipse(0, 0, 100, 100); layout()->addWidget(mView); mQuickWidget->resize(150, 150); mQuickWidget->setResizeMode(QQuickWidget::SizeRootObjectToView); connect(mQuickWidget, SIGNAL(statusChanged(QQuickWidget::Status)), this, SLOT(onStatusChanged(QQuickWidget::Status))); mQuickWidget->setSource(QUrl::fromLocalFile("main.qml")); layout()->addWidget(mQuickWidget); } private slots: void onStatusChanged(QQuickWidget::Status status) { if (status == QQuickWidget::Error) { qDebug() << mQuickWidget->errors(); } } private: QGraphicsView *mView; QQuickWidget *mQuickWidget; }; int main(int argc, char** argv) { QApplication app(argc, argv); QMainWindow window; View *view = new View(&window); window.setCentralWidget(view); window.resize(400, 400); window.show(); return app.exec(); } #include "main.moc"
It seems to handle increasing the size of the window better than decreasing it.
Also note that the QQuickWidget doesn't get redrawn while increasing its size - not sure if that's unavoidable or not...