[5.72] Strange behavior with QT subsystem on modal win

Post bugreports for the Linux version here
User avatar
Kukulkan
Addict
Addict
Posts: 1261
Joined: Mon Jun 06, 2005 2:35 pm
Location: germany
Contact:

[5.72] Strange behavior with QT subsystem on modal win

Post by Kukulkan »

Hi,

I have several dialogs (XMLDialog) that are childs of others (proxy dialog and smtp assistant dialog called from another config dialog). So I have at least a child which is opening other childs. I really need them to be modal. I do it like I did in the last years for Windows, Mac and Linux (GTK), but with QT subsystem I observe strange things.

Sometimes the child dialogue simply does not open up. Sometimes it takes a few seconds. It is not always the same. Sometimes, a new start of the app changes everything. In some cases it works as expected.

It seems better if I dont use DisableWindow() to disable the parent window. Without, it seems much more stable. But then the parent is editable, which is not good at all.

Sadly, I was not able to create a reproducing piece of code. As long as it I test with small things, it seem to work fine. But in a bigger project it starts to become weird.

At one situation, it seem to no longer work if I enable DisableWindow() in another part of the code which is not even affected at all. But as soon as I remove the comment, it starts to behave strange again (most times window does not appear etc).

The same code is working fine on Windows, Mac and Linux without QT.

Anyone else having such strange behavior with trying to make modal things?

I found some similar posts, but that seems to be fixed with 5.72. My weird thing is not easy to reproduce and happens more random :-(

UPDATE:
If I replace DisableWindow() with

Code: Select all

QtScript("window(" + Str(window) + ").setDisabled(true);")
I have the strange effects, too. It seems that sometimes the wrong window is disabled (the current one instead of the one given). Maybe the window-id returned by OpenWindow() is sometimes wrong or this is a QT bug????
Fred
Administrator
Administrator
Posts: 14288
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: [5.72] Strange behavior with QT subsystem on modal win

Post by Fred »

We use the same function, and searching on the web tells it should work. That said, QT support another way to disable all inputs on window except the one you want:

https://doc.qt.io/qt-5/qt.html#WindowModality-enum

useing setModality() on the window with Qt::ApplicationModal should do the trick. If it works for you, we could may be add a flag to SetWindowState() for example to declare a window modal.
Post Reply