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

QT5 + Qt::WindowStaysOnTopHint + QComboBox problem

    XMLWordPrintable

    Details

      Description

       There is one quite strange problem with AlwaysOnTop window, system - Qt5.9.1, Win10 x64, MSVC2017 x64 app.

      Let's imagine simple aplication with QMainWindow that contains only one QComboBox. When I set to windows flags Qt::WindowStaysOnTopHint after ui->setupUi(this) in constructor then application window after start and unfold combobox list is like:

      Attachement 1-OK.jpg
       

      but when I switch to another window(s) and back, and again unfold combobox list, then is look like this:

       Attachement 2-ERR.jpg

        Simply - listbox is hidden behind main form partially or whole depends on its size.
      It is not tied on one special machine , I reproduced it on two independent Win10 x64 Pro computers.
      If form is not always-on-top, then everything works OK.

      Code in main dialog window:

      #include "mainwindowdialog.h"
      #include "ui_mainwindowdialog.h"
      
      MainWindowDialog::MainWindowDialog(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindowDialog)
      {
       ui->setupUi(this);
      	ui->comboBox->clear();
      	ui->comboBox->insertItems(0, QStringList()
      	<< QApplication::translate("MainWindowDialog", "New Item 1", Q_NULLPTR)
      	<< QApplication::translate("MainWindowDialog", "New Item 2", Q_NULLPTR)
      	<< QApplication::translate("MainWindowDialog", "New Item 3", Q_NULLPTR)
      	<< QApplication::translate("MainWindowDialog", "New Item 4", Q_NULLPTR)
      	<< QApplication::translate("MainWindowDialog", "New Item 5", Q_NULLPTR)
      	<< QApplication::translate("MainWindowDialog", "New Item 6", Q_NULLPTR)
      	<< QApplication::translate("MainWindowDialog", "New Item 7", Q_NULLPTR)
      	<< QApplication::translate("MainWindowDialog", "New Item 8", Q_NULLPTR)
      	<< QApplication::translate("MainWindowDialog", "New Item 9", Q_NULLPTR)
      	<< QApplication::translate("MainWindowDialog", "New Item 10", Q_NULLPTR)
      	<< QApplication::translate("MainWindowDialog", "New Item 11", Q_NULLPTR)
      	<< QApplication::translate("MainWindowDialog", "New Item 12", Q_NULLPTR)
      	<< QApplication::translate("MainWindowDialog", "New Item 13", Q_NULLPTR)
      	<< QApplication::translate("MainWindowDialog", "New Item 14", Q_NULLPTR)); 
      	this->setWindowFlags(this->windowFlags() | Qt::WindowStaysOnTopHint);
      }
      
      MainWindowDialog::~MainWindowDialog()
      {
      delete ui;
      }
      

      Header:

      #ifndef MAINWINDOWDIALOG_H
      #define MAINWINDOWDIALOG_H
      
      #include <QMainWindow>
      #include "QComboBox.h"
      
      namespace Ui {
      class MainWindowDialog;
      }
      
      class MainWindowDialog : public QMainWindow
      {
      Q_OBJECT
      
      public:
      explicit MainWindowDialog(QWidget *parent = 0);
       ~MainWindowDialog();
      
      private:
       Ui::MainWindowDialog *ui;
      };
      #endif // MAINWINDOWDIALOG_H
      

       

       

      When I unfold listbox of combobox first time it look like:
      1. appears listbox
      2. part of main form is redrawn over listbox
      3. listbox is redrawn again over form,

      but after switching to another window and back the third step is omitted. so it stays in state like the second picture.

        Attachments

        1. 1-OK.jpg
          1-OK.jpg
          13 kB
        2. 2-ERR.jpg
          2-ERR.jpg
          16 kB
        3. TST.zip
          16 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            • Assignee:
              manordheim Mårten Nordheim
              Reporter:
              dwarf Ricgard Repcik
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Gerrit Reviews

                There are no open Gerrit changes