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

[REG Qt 4] Resizing the main widget in showEvent() before it's visible moves it to upper left corner

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: P2: Important P2: Important
    • 5.9.2
    • 5.6.1
    • None
    • Windows 10 x64, Visual Studio 2013, Linux XCB, macOS
    • b65e30c861af308d142c36b5f96f1a4cfedde1f3

      On Windows 10, calling resize(), before the widget is actually shown (in constructor or showEvent() ), moves it to upper left corner of the screen, with title bar hidden over the top.

      for example:

       void myWidget::showEvent(QShowEvent * event)
      {
       if (event->type()==QEvent::Show) {
        resize (200,200);
       }
      }
      

      ... will exhibit the problem on Windows 10, while

       void myWidget::showEvent(QShowEvent * event)
      {
       if (event->type()==QEvent::Show) {
        QTimer* timer = new QTimer(this);
        timer->setSingleShot(true);
        QObject::connect(timer, &QTimer::timeout, [timer]() {
         resize(200,200)
         delete timer;
         });
       timer->start(0);
       }
      }
      

      will work as usual.

        1. qtbug56277_diag.diff
          3 kB
        2. qtbug56277_log.txt
          0.8 kB
        3. qtbug56277.zip
          1 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            dedietri Gabriel de Dietrich (drgvond)
            buldozer Toni Rutar Lokar
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes