Results 1 to 4 of 4

Thread: Passing information from QDialog to QMainWindow?

  1. #1
    Join Date
    Aug 2009
    Location
    Brisbane, Australia
    Posts
    75
    Thanks
    18
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question Passing information from QDialog to QMainWindow?

    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

  2. #2
    Join Date
    Jun 2007
    Location
    India
    Posts
    1,042
    Thanks
    8
    Thanked 133 Times in 128 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Passing information from QDialog to QMainWindow?

    for passing info, check the qtcentre wiki article. See WindowModality for working with mainwindow while dialog is visible.

  3. #3
    Join Date
    Sep 2011
    Location
    Buenos Aires
    Posts
    9
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Passing information from QDialog to QMainWindow?

    Quote Originally Posted by grantbj74 View Post
    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).

  4. #4
    Join Date
    Aug 2009
    Location
    Brisbane, Australia
    Posts
    75
    Thanks
    18
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Passing information from QDialog to QMainWindow?

    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.

Similar Threads

  1. How to Call a QDialog in QMainWindow
    By mcht_z in forum Newbie
    Replies: 2
    Last Post: 13th April 2011, 06:43
  2. Replies: 6
    Last Post: 10th February 2011, 11:10
  3. Passing a child from a QThread to a QMainWindow
    By sgtbash in forum Qt Programming
    Replies: 3
    Last Post: 4th May 2009, 08:30
  4. QMainWindow child of a QDialog
    By brevleq in forum Qt Programming
    Replies: 2
    Last Post: 16th January 2008, 07:16
  5. QDialog and QMainWindow Data Transfer
    By Ahmad in forum Qt Programming
    Replies: 12
    Last Post: 6th May 2007, 07:02

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.