PDA

View Full Version : modal that excludes parent's siblings



mortoray
16th October 2010, 10:42
Is there any way to get a Modal window that doesn't block input to it's parent siblings? I'm trying to get multiple top-level windows working correctly but hitting several problems:

1. All windows that are children of the same top-level window, when they use a modal window it blocks access to all the siblings. I don't want that. I know I could put an intermediate window in between, but that becomes cumbersome.

2. If I make them all without a parent, I can't find a way to get a list of all those windows.

3. I can't just stick them in a list, since I need to have them automatically removed when they are closed.

4. QWidget doesn't support a plain QObject as parent. This is quite unfortunate -- it crashes.


If any of the above problems can be solved I have a solution to my problem.

mortoray
16th October 2010, 10:50
I found QApplication::topLevelWidgets(). This will work. Too bad about not having a better selection of modality models though.

wysota
16th October 2010, 13:05
Modality in Qt is based on parent-child relationship. If you want multiple top-level windows, they should be parentless anyway. So it's not Qt's fault but rather the result of the way you use it.

Zlatomir
16th October 2010, 13:33
I'm not sure that i correctly understand the problem, but i think you want Qt::WindowModal not Qt::ApplicationModal which is the default way when you use exec().
Check the documentation about window modality (http://doc.trolltech.com/4.7/qt.html#WindowModality-enum)