opencor / opencor

OpenCOR is a cross-platform modelling environment, which can be used to organise, edit, simulate and analyse CellML files.
https://opencor.ws/
GNU General Public License v3.0
33 stars 26 forks source link

macOS: undocked windows are on top even when they aren't active #1334

Open dbrnz opened 7 years ago

dbrnz commented 7 years ago

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...

screen shot 2017-06-19 at 9 21 33 pm

agarny commented 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:

dbrnz commented 7 years ago

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...

agarny commented 7 years ago

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... :(

dbrnz commented 7 years ago

All is well under Windows so this looks to be a macOS quirk... I'll confirm using a pure C++ example.

agarny commented 7 years ago

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...

dbrnz commented 7 years ago

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...

agarny commented 7 years ago

Excellent! :)

dbrnz commented 7 years ago

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.

agarny commented 7 years ago

Argh, that would have been too easy. :(