Results 1 to 4 of 4

Thread: a QDialogButtonBox question

  1. #1
    Join Date
    Jan 2008
    Posts
    155
    Thanks
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default a QDialogButtonBox question

    This is a mixed Qt programming and Designer question.

    I have a problem with QDialogButtonBox.

    I have Ok, Camcel and Apply buttons in a QDialogButtonBox.
    Ok emits signal accepted() and Cancel emits signal rejected(), but how should I connect Apply to a method? I cannot find any signal related to it.

    BN
    MacOSX user dabbling with Linux and Windows.

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: a QDialogButtonBox question

    Qt Code:
    1. QPushButton* applyButton = buttonBox->button(QDialogButtonBox::ApplyRole);
    2. connect(applyButton, SIGNAL(clicked()), this, SLOT(apply()));
    To copy to clipboard, switch view to plain text mode 
    J-P Nurmi

  3. #3
    Join Date
    Jan 2008
    Posts
    155
    Thanks
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: a QDialogButtonBox question

    Thanks, but it's not working.

    My header file:
    Qt Code:
    1. private slots:
    2. void HandleOk();
    3. void HandleApply();
    4. void HandleCancel();
    To copy to clipboard, switch view to plain text mode 
    My source file:
    Qt Code:
    1. QPushButton* OkButton = buttonBox->button(QDialogButtonBox::Ok);
    2. connect(OkButton, SIGNAL(clicked()), this, SLOT(HandleOK()));
    3. QPushButton* CancelButton = buttonBox->button(QDialogButtonBox::Cancel);
    4. connect(CancelButton, SIGNAL(clicked()), this, SLOT(HandleCancel()));
    5. QPushButton* applyButton = buttonBox->button(QDialogButtonBox::Apply);
    6. connect(applyButton, SIGNAL(clicked()), this, SLOT(HandleApply()));
    To copy to clipboard, switch view to plain text mode 
    Qt Code:
    1. void PAMS_Settings::HandleOk()
    2. {
    3. QApplication::beep();
    4. }
    5. void PAMS_Settings::HandleCancel()
    6. {
    7. QApplication::beep();
    8. }
    9. void PAMS_Settings::HandleApply( )
    10. {
    11. QApplication::beep();
    12. }
    To copy to clipboard, switch view to plain text mode 

    but nothing happens when I push these buttons.

    I feel I must have made a pretty fundamental mistake somewhere, but I am stuck.

    BN
    MacOSX user dabbling with Linux and Windows.

  4. #4
    Join Date
    Jan 2008
    Posts
    155
    Thanks
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: a QDialogButtonBox question

    Working now.
    I managed to do "setupUi(this)" twice which made it f-k up.
    Thanks for the advice.
    MacOSX user dabbling with Linux and Windows.

Similar Threads

  1. SQL Question
    By ^NyAw^ in forum Qt Programming
    Replies: 5
    Last Post: 8th April 2008, 19:36
  2. Exceptions / setjmp/longjmp question
    By Aceman2000 in forum Qt Programming
    Replies: 3
    Last Post: 13th March 2008, 17:14
  3. Access to QSqlTableModel::isDirty Question.
    By patrik08 in forum Qt Programming
    Replies: 3
    Last Post: 12th April 2007, 17:49
  4. Question regarding how to paint after zoom.
    By JonathanForQT4 in forum Qt Programming
    Replies: 2
    Last Post: 26th January 2007, 15:34

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.