Results 1 to 2 of 2

Thread: QT5 + Qt::WindowStaysOnTopHint + QComboBox strange problem

  1. #1
    Join Date
    Oct 2017
    Posts
    1
    Qt products
    Qt5
    Platforms
    Windows

    Default QT5 + Qt::WindowStaysOnTopHint + QComboBox strange problem

    Hi,
    I have 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:
    1-OK.jpg,

    but when I switch to another window(s) and back, and again unfold combobox list, then is look like this:
    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:
    Qt Code:
    1. #include "mainwindowdialog.h"
    2. #include "ui_mainwindowdialog.h"
    3.  
    4. MainWindowDialog::MainWindowDialog(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindowDialog)
    5. {
    6. ui->setupUi(this);
    7. ui->comboBox->clear();
    8. ui->comboBox->insertItems(0, QStringList()
    9. << QApplication::translate("MainWindowDialog", "New Item 1", Q_NULLPTR)
    10. << QApplication::translate("MainWindowDialog", "New Item 2", Q_NULLPTR)
    11. << QApplication::translate("MainWindowDialog", "New Item 3", Q_NULLPTR)
    12. << QApplication::translate("MainWindowDialog", "New Item 4", Q_NULLPTR)
    13. << QApplication::translate("MainWindowDialog", "New Item 5", Q_NULLPTR)
    14. << QApplication::translate("MainWindowDialog", "New Item 6", Q_NULLPTR)
    15. << QApplication::translate("MainWindowDialog", "New Item 7", Q_NULLPTR)
    16. << QApplication::translate("MainWindowDialog", "New Item 8", Q_NULLPTR)
    17. << QApplication::translate("MainWindowDialog", "New Item 9", Q_NULLPTR)
    18. << QApplication::translate("MainWindowDialog", "New Item 10", Q_NULLPTR)
    19. << QApplication::translate("MainWindowDialog", "New Item 11", Q_NULLPTR)
    20. << QApplication::translate("MainWindowDialog", "New Item 12", Q_NULLPTR)
    21. << QApplication::translate("MainWindowDialog", "New Item 13", Q_NULLPTR)
    22. << QApplication::translate("MainWindowDialog", "New Item 14", Q_NULLPTR));
    23. this->setWindowFlags(this->windowFlags() | Qt::WindowStaysOnTopHint);
    24. }
    25.  
    26. MainWindowDialog::~MainWindowDialog()
    27. {
    28. delete ui;
    29. }
    To copy to clipboard, switch view to plain text mode 
    Header:
    Qt Code:
    1. #ifndef MAINWINDOWDIALOG_H
    2. #define MAINWINDOWDIALOG_H
    3.  
    4. #include <QMainWindow>
    5. #include "QComboBox.h"
    6.  
    7. namespace Ui {
    8. class MainWindowDialog;
    9. }
    10.  
    11. class MainWindowDialog : public QMainWindow
    12. {
    13. Q_OBJECT
    14.  
    15. public:
    16. explicit MainWindowDialog(QWidget *parent = 0);
    17. ~MainWindowDialog();
    18.  
    19. private:
    20. Ui::MainWindowDialog *ui;
    21. };
    22.  
    23. #endif // MAINWINDOWDIALOG_H
    To copy to clipboard, switch view to plain text mode 

    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.

    What is the reason or is any available solution please to this strange behavior - it does the same in quite complex application, where listboxes of comboboxes are completely hidden.
    Many thanks for any helpful idea...

    Regards,


    dwarfik.
    Last edited by dwarfik; 13th October 2017 at 16:37.

  2. #2
    Join Date
    Jan 2018
    Posts
    1
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QT5 + Qt::WindowStaysOnTopHint + QComboBox strange problem

    There is bug reported about that, which has been fixed in version 5.9.2.

    https://bugreports.qt.io/browse/QTBUG-63787

    Hope it helps!

Similar Threads

  1. QCompler in QComboBox strange behaviour
    By typedef in forum Qt Programming
    Replies: 2
    Last Post: 4th April 2013, 15:29
  2. QComboBox strange behavior
    By Antebios in forum Newbie
    Replies: 2
    Last Post: 1st April 2009, 00:50
  3. WindowStaysOnTopHint
    By roxton in forum Qt Programming
    Replies: 6
    Last Post: 28th August 2008, 06:22
  4. QComboBox -> setModel -> Strange behaviour
    By oscar in forum Qt Programming
    Replies: 2
    Last Post: 13th August 2008, 22:27
  5. QComboBox +SUSE10.0 +qt4.1 strange behavior
    By antonio.r.tome in forum Qt Programming
    Replies: 6
    Last Post: 20th March 2006, 18:49

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.