Qt-interest Archive, July 2007
Auto-connect signals and slots of a QDialog
Message 1 in thread
Hello,
I have a problem with the auto-connecting of signals and slots of a QDialog
object.
I created in Designer a dialog with a QDialogButtonBox on it.
The accepted, destroyed and finished slots aren't executed when I push any
of the buttons or close the dialog.
Can you use the "on_objectName_signal" method for connecting signals and
slots in QDialogs ?
Kind regards,
Gerry
//-- untitled.h -----------------------------------------------------------
#include <QDialog>
#include "ui_untitled.h"
class Dialog : public QDialog, public Ui::Dialog
{
Q_OBJECT
private:
public:
Dialog(QWidget* p=0, Qt::WindowFlags f=0);
~Dialog();
private slots:
void on_Dialog_accepted();
void on_Dialog_destroyed();
void on_Dialog_finished();
};
//-- untitled.cc ----------------------------------------------------------
#include "untitled.h"
#include <QMessageBox>
Dialog::Dialog(QWidget* p, Qt::WindowFlags flags)
{
setAttribute(Qt::WA_DeleteOnClose);
flags = Qt::Dialog;
setWindowFlags(flags);
setupUi(this);
}
Dialog::~Dialog()
{
QMessageBox::critical(this, __FUNCTION__, objectName());
}
void Dialog::on_Dialog_accepted()
{
QMessageBox::critical(this, __FUNCTION__, objectName());
}
void Dialog::on_Dialog_finished()
{
QMessageBox::critical(this, __FUNCTION__, objectName());
}
void Dialog::on_Dialog_destroyed()
{
QMessageBox::critical(this, __FUNCTION__, objectName());
}
//-----------------------------------------------------------------------
--
[ signature omitted ]