Results 1 to 3 of 3

Thread: dialog connection

  1. #1
    Join Date
    Sep 2008
    Posts
    17
    Qt products
    Qt4
    Platforms
    Unix/X11
    Thanks
    4
    Thanked 5 Times in 1 Post

    Default dialog connection

    Hi

    I'm trying to connect two dialogs by clicking a button on the first dialog.
    For both dialogs I created slots in mainwindow.cpp. I would like to do something like:

    Qt Code:
    1. void MainWindow::userDialogExec()
    2. {
    3. if (userDialog_p->exec()) {
    4. mainInputWidget_p->updateForm();
    5. }
    6. }
    7.  
    8. void MainWindow::profileDialogExec()
    9. {
    10. if (profileDialog_p->exec()) {
    11. connect (profileDialog_p->addButton, SIGNAL(clicked()), this, SLOT(userDialogExec()));
    12. }
    13. }
    To copy to clipboard, switch view to plain text mode 
    but profileDialog_p has no member named addButton. I made this form with designer so I should do probably something like profileDialog_p->ui.addButton, but that doesn't work since ui is private and I want to keep it private.

    Any ideas?

    thanks in andvance,

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    28
    Thanked 976 Times in 912 Posts

    Default Re: dialog connection

    Quote Originally Posted by maartenS View Post
    profileDialog_p has no member named addButton. I made this form with designer so I should do probably something like profileDialog_p->ui.addButton, but that doesn't work since ui is private and I want to keep it private.
    Make profileDialog emit a signal.


    Quote Originally Posted by maartenS View Post
    if (profileDialog_p->exec()) {
    connect (profileDialog_p->addButton, SIGNAL(clicked()), this, SLOT(userDialogExec()));
    }
    QDialog::exec() opens a modal dialog and returns after the dialog was closed, so your connection will be created after user accepts the dialog. Are you sure that's what you want?

  3. The following user says thank you to jacek for this useful post:

    maartenS (9th September 2008)

  4. #3
    Join Date
    Sep 2008
    Posts
    17
    Qt products
    Qt4
    Platforms
    Unix/X11
    Thanks
    4
    Thanked 5 Times in 1 Post

    Default Re: dialog connection

    Quote Originally Posted by jacek View Post
    Make profileDialog emit a signal.

    QDialog::exec() opens a modal dialog and returns after the dialog was closed, so your connection will be created after user accepts the dialog. Are you sure that's what you want?
    Hi, thanks for your reply. It didn't work because of my misunderstanding of modal en modeless dialogs. Now I did a profileDialog_p->show and now i can receive signals from the buttons in the dialog.

    Thanks for your help!

Similar Threads

  1. Replies: 9
    Last Post: 13th August 2008, 19:07
  2. Shrinking connection dialog
    By NoRulez in forum Qt Programming
    Replies: 1
    Last Post: 23rd April 2008, 20:59
  3. Client/Server Error: BadIDChoice
    By 3nc31 in forum Qt Programming
    Replies: 5
    Last Post: 27th November 2007, 11:22
  4. Resizing the dialog boxes
    By anju123 in forum Qt Programming
    Replies: 4
    Last Post: 14th September 2007, 11:41
  5. QGraphicsView: Dialog Position Doubt
    By arjunasd in forum Qt Programming
    Replies: 1
    Last Post: 6th August 2007, 18:48

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
  •  
Qt is a trademark of The Qt Company.