Open dbrnz opened 7 years ago
Indeed, I would also expect your matplotlib
window to cover OpenCOR's main window and floating windows. In fact, this is the behaviour I get when switching from OpenCOR to another application (in fact, floating windows get hidden when OpenCOR is not the active application).
Just out of curiosity:
matplotlib
window, does it get 'raised' or does it remain behind OpenCOR's floating windows?matplotlib
windows is a QMainWindow object, you should be able to programmatically raise it (see here). This would, however, require access to the QMainWindow object, not to mention that I imagine this window to be created through your Python script, so we really shouldn't have to resort to this kind of (dirty) hack...Just out of curiosity:
- If you click on your
matplotlib
window, does it get 'raised' or does it remain behind OpenCOR's floating windows?
It remains behind the floating windows.
- Did you get a chance or have you been able to confirm this behaviour on Windows and/or Linux?
Am about to test under Linux...
Hmm, all is as expected, so this is looking like it could be an OS/X special -- will try Windows tomorrow.
- Could it be that your window is actually a child of OpenCOR's main window, which might explain why it doesn't cover your floating windows?
The matplotlib window has no parent. Using Python it's possible to interactively interrogate and change properties of the window, including lowering (it goes behind OpenCOR's main window) and raising (it appears in front of OpenCOR's main window but behind the floating dockable windows).
I am in the middle of various QtWebKit compilations, so I can't really test it myself, but it might be worth tweaking OpenCOR to create a QMainWindow object (as a child of OpenCOR's main window) and see how it behaves with regards to floating windows?
I'll try setting up a test case in C++.
- Because your
matplotlib
windows is a QMainWindow object, you should be able to programmatically raise it (see here). This would, however, require access to the QMainWindow object, not to mention that I imagine this window to be created through your Python script, so we really shouldn't have to resort to this kind of (dirty) hack...
In fact this is what I've been doing in Python to test things...
Ok, let's see what your Windows test tells us, but the fact that it's working as expected on Linux does indeed suggest that there might be an issue with Qt (orPythonQt?) on macOS... :(
All is well under Windows so this looks to be a macOS quirk... I'll confirm using a pure C++ example.
Argh, this is rather annoying. :( Looking forward to your pure C++ example, but I wouldn't be surprised if it was to be a Qt-related (or PythonQt-related) issue. Will see...
Trying a hint given for QTBUG-35957, namely to set window modality, brings the matplotlib window to the front. :-) Next is to listen to focus events so the window is only on top when it has focus, as it now always on top...
Excellent! :)
Unfortunately a workaround isn't as simple as setting window modality as this means nothing else can be done in OpenCOR until the matplotlib window is closed. I've recreated the issue in a short test program and raised QTBUG-61544.
Argh, that would have been too easy. :(
This may well be a 'feature' of Qt but I'm wondering @agarny if you have any suggestions. The matplotlib output is in a QMainWindow; when it is active I expect it to cover OpenCOR's main window and all undocked windows...