0

Right now I have a small tool app that runs in the icon tray. When I click on the icon, the app goes into "windowstayontophint" mode. I added a Combo Box on this window. But when I click elsewhere on desktop, and then click the combo box, the drop down window goes to the back of the window. This seems to be a known bug as reported here:

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

Is there a workaround for this? I am using Qt 5.9.1.

EDIT: Add some code:

This in MainWindow constructor:

Qt::WindowFlags flags = this->windowFlags();
this->setWindowFlags(flags|Qt::WindowStaysOnTopHint);

Then I put a QComboBox in the mainwindow with preloaded items. First time click, the dropdown appears on top as normal. Then I click onn desktop and then back on the mainwindow and combobox. And drop down becomes at the back of mainwindow. CLick on the link above to see what I mean. The bug report also provide screenshot of what is happening.

GeneCode
  • 7,545
  • 8
  • 50
  • 85
  • 1
    I just tried the bug test code in Linux with Qt 5.10.1 I did not observe that problem. – eyllanesc Apr 20 '18 at 01:32
  • Very well, I will update to latest Qt and try again. Ty for your response.. – GeneCode Apr 20 '18 at 01:51
  • 2
    Override `event()` function for the window and when `e->type() == QEvent::WindowActivate` call `raise()` function on the combo box – Super-intelligent Shade Apr 20 '18 at 02:12
  • Must be windows only thing. I am not observing this on Linux and Qt 5.9.1 – Super-intelligent Shade Apr 20 '18 at 02:39
  • Some code would also be nice to illustrate what you are trying to do. – Super-intelligent Shade Apr 20 '18 at 02:40
  • Tried the raise() function. Does't seem to work. I update the question with "code". But really there isnt any code to produce this bug. – GeneCode Apr 20 '18 at 04:27
  • 2
    Qt 5.10.1 Windows 10 Mingw32 works well. – JustWe Apr 20 '18 at 06:35
  • Just following the duplicate links of the bugtracker to https://bugreports.qt.io/browse/QTBUG-62004 shows that it only affects windows and that it was fixed in Qt 5.9.2 – Felix Apr 20 '18 at 09:20
  • Hm... ok I updated my Qt 5.9.1 using Maintenance Tool. Seeing Qt Creator About box it shows Qt Creator 4.6.0, Based on Qt 5.10.1 (MVSC 2015, 32bit), but when i run the app, the same problem still occur. Idk what else to do now. – GeneCode Apr 23 '18 at 01:06
  • Did you actually build your app with the new Qt version? Looking at the Qt Creator's about box only shows you how that was build, not your own app. Look at the build options and Kits when compiling your app. – xander Apr 23 '18 at 06:44
  • @xander Yes I did. After the Qt update is completed, I restarted my laptop, and select Build->Build All. Then run it. But as I see in Kits, it seems to be pointing to the 5.9.1 folder. And there is no 5.10.1 folder. Guess I have to uninstall everything and reinstall 5.10.1.Seems Maintenance Tool is not working well. – GeneCode Apr 23 '18 at 07:17
  • 1
    If you don't have a kit for 5.10 then you can install it with the maintenance tool, by default it only updates some stuff but there should be optional versions avilable. – xander Apr 23 '18 at 07:19
  • @xander, i am trying maintenance tool again and choosing "Add/Remove" option. There is option to select Qt 5.10.1 but if i check all, it ends up very big 38.2GB. What are the essential option in Qt5.10.1? – GeneCode Apr 23 '18 at 07:26
  • I am selecting, MSVC2017 64bit,MinGW 5.3.0 32 bit and Sources, should be enough ya? – GeneCode Apr 23 '18 at 07:28
  • 1
    It depends what you need, I think sources are optional and you only need one compiler setup usually (either MSVC or MInGW). – xander Apr 23 '18 at 07:37
  • @xander..... thank you for your comments. if you add an answer i will accept it. it works ok now. thanksss!!!!! – GeneCode Apr 23 '18 at 08:30

1 Answers1

2

Nobody want to put an answer, so I answer this myself.

ANSWER: Update to latest Qt.

It did not work for me because I was having trouble updating (noob here). What basically happened was that Selecting "Update" option on Maintenance Tool does not update SDK from 5.9.1 to 5.10.1. It only update certain things like Qt Creator.

I needed to choose "Add or remove Components" and then adding Qt 5.10.1, but only check the MinGW 32bit only. (Uncheck all others otherwise you need them (like android or other)).

Even after that, you also need to manually download CMake (get it from cmake.com) and set it in "Manage Kits" in Qt Creator.

GeneCode
  • 7,545
  • 8
  • 50
  • 85