View Full Version : a QDialogButtonBox question
bnilsson
16th July 2008, 20:42
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
QPushButton* applyButton = buttonBox->button(QDialogButtonBox::ApplyRole);
connect(applyButton, SIGNAL(clicked()), this, SLOT(apply()));
bnilsson
16th July 2008, 22:05
Thanks, but it's not working.
My header file:
private slots:
void HandleOk();
void HandleApply();
void HandleCancel();
My source file:
QPushButton* OkButton = buttonBox->button(QDialogButtonBox::Ok);
connect(OkButton, SIGNAL(clicked()), this, SLOT(HandleOK()));
QPushButton* CancelButton = buttonBox->button(QDialogButtonBox::Cancel);
connect(CancelButton, SIGNAL(clicked()), this, SLOT(HandleCancel()));
QPushButton* applyButton = buttonBox->button(QDialogButtonBox::Apply);
connect(applyButton, SIGNAL(clicked()), this, SLOT(HandleApply()));
void PAMS_Settings::HandleOk()
{
QApplication::beep();
}
void PAMS_Settings::HandleCancel()
{
QApplication::beep();
}
void PAMS_Settings::HandleApply( )
{
QApplication::beep();
}
but nothing happens when I push these buttons.
I feel I must have made a pretty fundamental mistake somewhere, but I am stuck.
BN
bnilsson
16th July 2008, 22:42
Working now.
I managed to do "setupUi(this)" twice which made it f-k up.
Thanks for the advice.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.