PDA

View Full Version : How to "lock" a new qdialog in another qdialog



donglebob
27th January 2009, 21:08
Hi,

my main window (qdialog) has a tab-widget. Each Tab has its own dialog.

Each dialog in my tab-widget represents an individual Object in nature.
When the object in nature makes problems, my program gets this information and forwards this information to its dialog in the tab-widget.

I want to be able to show a MessageBox or a Dialog in the "natural-objects dialog".
When the user goes through the tabs he will see on TAB X that "natural object X" had a problem. But he should not see this information somewhere else...just in "TAB X".

I tried it with QMessageBox but I failed..
I made it non-modal but it was always outside the "tab-dialog". I want to lock it to that window, so the user can visit the other dialogs in the tab without beeing disturbed.


What can I do?

donglebob
29th January 2009, 22:56
any ideas? or sth not understandable?

seneca
29th January 2009, 23:05
How about adding for example a normaly empty QLabel (for example with red foreground color) at the top of bottom of each form, and in case of error write a message ito it?

Another solution would be Dialogs for every tab which you hide/show when tabs change, for example using the signal QTabWidget::currentChanged(int)

wysota
30th January 2009, 00:01
By the term "dialog" do you mean a QDialog (top-level window, short-lived, possibly modal to its parent) or a "widget"? A screenshot might clear things out...

donglebob
30th January 2009, 09:27
Hi,


with dialog i really mean QDialog.

The pages of my Tabs are self-made derived classes (of QDialog).

And what I want to show is a QMessageBox or a QDialog.
It doesnt matter....The main goal is that the user sees an alert in the middle of the screen of each QDialog(in the tab).

http://img217.imageshack.us/img217/7936/screen1cm8.png

http://img217.imageshack.us/my.php?image=screen1cm8.png

aamer4yu
30th January 2009, 09:50
You can emit a signal from one of your tab widget, and connect it to main window.
Main Window can then display the error message .

wysota
30th January 2009, 10:20
Based on the screenshot I see you mean a widget after all :) The fact that you are using QDialog there only means you shouldn't be doing that. And I would advise against using QMessageBox or similar in the same fashion. Do it properly and create a plain QWidget (like QLabel or sth) just don't put it in the layout with other widgets of the tab. Instead use setGeometry to set its geometry to the centre of the tab's widget.

donglebob
4th February 2009, 08:37
Thanks for you hints..

You mean I should create a QLabel for my error message (while runtime).
Use the setgeometry of it to place it in the tab I want,..right?

I will try this....thanks