Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-37062

QQuickWidget doesn't properly hide() and show()

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P1: Critical
    • 5.3.0 Beta1
    • 5.3.0
    • Quick: Other
    • None
    • Debian 7, X11
    • 6ef802ff6ed1cd234848b65fdad56dc3b0579cff (qtdeclarative), 5cd7390ba91702efb2a978a438896d713f5a3abc (qtbase)

    Description

      This is a subtask of QTBUG-36935

      Replace the C++ part of the qquickwidget example by this:

      #include <QQuickWidget>
      #include <QtWidgets>
      
      class HideShow : public QObject {
          Q_OBJECT
      public:
      
          QWidget *subject;
          HideShow(QWidget *subject, int interval) : QObject(subject), subject(subject)
          {
              startTimer(interval);
          }
      
          void timerEvent(QTimerEvent *)
          {
              if (subject->isVisible()) {
                  qDebug() << "hide" << subject->width() << subject->height();
                  subject->hide();
              } else {
                  qDebug() << "show" << subject->width() << subject->height();
                  subject->show();
              }
          }
      };
      
      int main(int argc, char **argv)
      {
          QApplication app(argc, argv);
          QMainWindow *toplevel = new QMainWindow;
      
          QUrl source("qrc:quickwidget/rotatingsquare.qml");
          QQuickWidget *w = new QQuickWidget;
          w->resize(300,300);
          w->setResizeMode(QQuickWidget::SizeRootObjectToView);
          w->setSource(source);
      
          new HideShow(w, 3000);
          toplevel->setCentralWidget(w);
          toplevel->show();
          return app.exec();
      }
      
      #include "main.moc"
      

      The QQuickWidget's contents will still be visible after hide(), but the rectangle won't be spinning anymore. Furthermore it won't restart the spinning after show() and it creates visual clutter when resizing the window.

      Attachments

        Issue Links

          Activity

            People

              tvete Paul Olav Tvete
              ulherman Ulf Hermann
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: