[Qt-interest] Dual-head QMainWindow

Thomas Sondergaard ts_news1 at sondergaard.cc
Tue Mar 2 10:47:48 CET 2010


Hi,

I'm working on a multi-screen medical image viewing application. On 
systems with a single monitor it uses a single QMainWindow, on systems 
with two screens it uses a QMainWindow on each screen. It works, but 
there are some problems.

1) QToolBars belong to only one QMainWindow and one created for 
QMainWindow-1 can't be docked on QMainWindow-2 and vice versa

2) Window stacking - dialogs and toolbars that have QMainWindow-1 as 
parent doesn't automatically stay on top of QMainWindow-2 and vice versa 
, meaning toolbars and dialogs can get lost under the other main window

3) Window modality - windows are not automatically modal to both windows

4) Shortcut handling - there seems to be no elegant way to make 
shortcuts work in both windows without using Qt::ApplicationShortcut 
context, which would not be correct, as many shortcuts should not be 
available when modal dialogs are being displayed.


I've considered using a single QMainWindow and display it across two 
screens, but I think I'll just be trading one set of problems for 
another. The problems I am aware of are:

1) Preventing menus and toolbar buttons from being displayed right where 
the screens meet.

2) metacity doesn't like it and will actively constrain a newly mapped 
window to one screen.

3) Dialogs that are normally opened centered on parent, will attempt 
that and metacity will constrain it to being displayed on one screen, 
which means it will move it to fit within the left screen. It looks 
better centered on the left screen than flush against the right edge of 
the left screen (My QMainWindows are always displayed maximized on each 
screen).


Using modified versions of Qt and metacity *is* an option with our product.

Suggestions?

Regards,

Thomas



More information about the Qt-interest-old mailing list