PDA

View Full Version : Passing information from QDialog to QMainWindow?



grantbj74
21st September 2011, 07:03
Hi,

I'm using a QDialog as a comms console.

I would like to pass information back to the MainWindow.

I need to be able to still use the MainWindow while the comms console is visible.

Thanks
Brendan

nish
21st September 2011, 07:26
for passing info, check the qtcentre wiki article. See WindowModality for working with mainwindow while dialog is visible.

slqh
21st September 2011, 11:02
Hi,

I'm using a QDialog as a comms console.

I would like to pass information back to the MainWindow.

I need to be able to still use the MainWindow while the comms console is visible.

Thanks
Brendan

I'm trying to accomplish a similar task.
I wanted to have some kind of debug console to show information about what the program was doing and to inform other Qdialogs of problems.
I created all the child Qdialogs as non modal, creating the with dialog.show(); and then passing the data with signals and slots.
if you create your Qdialog with dialog.exec(); then your parent window, in this case your MainWindow is blocked until your child is closed.

I hope that i understood your problem correctly and, please as I'm a noob in Qt maybe the response above could be completely wrong, but that works for me(TM).

grantbj74
22nd September 2011, 05:47
Thanks, I found the help in Qt Assistant on Signals and Slots very useful.

Basically what I did was the Dialog emits custom signals. These signals are setup to be caught by the MainWindow. The MainWindow then does the task.

Yeah you need to stay away from dialog.exec() for this.