Solved Window is not in focus when opened
-
@gabor53
Hi you must show the code for how you open
additem and review_Window
as there is no reason for review_window to close additem so I assume
its something with your code. Like using exec instead of show or
using a local variable for additem so it runs out of scope and be deleted. -
@mrjj
Here is the code opening additem:Additem mAddItem; mAddItem.setModal (true); mAddItem.exec ();
and this opens review_Window:
review_Window->isModal (); review_Window->show (); review_Window->setFocus ();
Thank you for your help.
-
@gabor53 said:
Hi
Additem mAddItem;
is local variable it seems but you are using exec() should should not run out of scope.
Please put a break point on next line after
mAddItem.exec ();and see if it for some reason falls out of exec() when u open review_Window.
Do you use a slot/button to call the code that opens review_Window?
-
@mrjj
Hi,Additem mAddItem; mAddItem.setModal (true); mAddItem.exec (); break;
generated an error message: break statement is not within a loop or switch.
Yes, the review_Window is opened in a function triggered by a slot/button.
Thank you.
-
@gabor53
hi
i imagined something like
mdditem mAddItem;
mAddItem.setModal (true);
mAddItem.exec ();
int a=100; <<< break point here. -
@mrjj
Hi
I tried.Additem mAddItem; mAddItem.setModal (true); mAddItem.exec (); int a = 100;
Nothing really happened except I got a message saying unused variable.
-
@gabor53
hi
did it stop at break point when review_window open?
meaning it went from
mAddItem.exec (); << should stay here
int a = 100; << should not go to this line when review_windowalso
review_Window->show ();this is how u open review_Window still ?
Else Im afraid I cant guess what you are doing wrong.
Normally its not an isses to have 2 dialogs so must be some small details.
So u are almost there:) -
@mrjj
Hi
It did not stop at breakpoint.
I open review_Window like this:review_Window->setFocus (); review_Window->show ();
New development:
I haven't changed anything. Now all 3 windows (mainwindow, additem, review_Window) stay open. They are stacked from top to bottom like this: additem, review_Window, mainwindow. The minimize button doesn't work when all 3 windows open. If I close one of them everything works. No idea why. Thank you for your help. -
Hi
When you call exec on a dialog, it become modal.
This means that other windows are blocked. also including minimize button.
http://www.informit.com/articles/article.aspx?p=1405225&seqNum=5That might be the reason.
-
@mrjj
Thank you. I redid the code and it works now. -
@gabor53
good work!