PDA

View Full Version : Window not responding



markcole
18th April 2007, 20:07
I have a app that starts a window (QMainWindow). Pressing a button creates a new window(QMainWindow). The first window cannot be changed, or closed, etc., the second window does fine. When I close the second window, the focus returns to the first window, but it still doesn't respond to anything.

Without posting any code, is there something obvious I can look for, or is there a better way?

The main goal is to have a initial window, that can spawn one of three different windows. In turn each of these windows will spawn one or more windows for data display.

I am pretty new at gui programming, so thanks for any help...

-mark

marcel
18th April 2007, 20:11
How do you display the second window? do you use show()?

markcole
18th April 2007, 20:16
How do you display the second window? do you use show()?
Yes.

in the .h file


private:
ObjectName * newWindow;


in the .cpp



newWindow = new ObjectName(this);
newWindow->show();

marcel
18th April 2007, 20:36
Do you intercept any kind of events for the first window?
What do you do in the first place to make the first window not respond, while the second is visible?

markcole
18th April 2007, 20:38
Do you intercept any kind of events for the first window?
What do you do in the first place to make the first window not respond, while the second is visible?

No first window is just a main screen to start one of 3 modes.

I made the second window (window modal).

marcel
18th April 2007, 20:41
Qt::WindowModal


The window is modal to a single window hierarchy and blocks input to its parent window, all grandparent windows, and all siblings of its parent and grandparent windows.


After you close this modal window( I assume you actually hide it ), do you also delete it? This would solve your problem.
If you can't delete it and you just hide it, at least change it's modality to non modal, to stop blocking its parent.

markcole
18th April 2007, 20:50
So, when I close it using the close() function or the x icon on the title bar, it is just hiding it, not deleting it?

Edit: I guess reading the API would help. Does the x icon issue a close()?

marcel
18th April 2007, 20:56
No, I just assumed that when you close it you hide it for later use... :)
In this case...No idea at all why you get this problem...

Do you have to set it WindowModal?

markcole
18th April 2007, 20:59
No, I just assumed that when you close it you hide it for later use... :)
In this case...No idea at all why you get this problem...

Do you have to set it WindowModal?

Well, I set it to windowModal in designer. I don't change it in the code I write.

jpn
18th April 2007, 21:06
Maybe setting attribute Qt::WA_DeleteOnClose would help.

markcole
18th April 2007, 21:53
Thanks....I will give it a try.