Hi Wysota,
thank you. Yes I tried to pass null but I got a crash.
I paste come source code here.
The header file of dialog:
#ifndef PREFERENCESDIALOG_H
#define PREFERENCESDIALOG_H
#include "ui_PreferencesDialog.h"
class PreferencesDialog
: public QDialog,
private Ui
::PreferencesDialog{
Q_OBJECT
public:
int exec();
public:
explicit PreferencesDialog
(QWidget* parent
= 0);
private slots:
void restoreState();
void saveState();
};
#endif // PREFERENCESDIALOG_H
#ifndef PREFERENCESDIALOG_H
#define PREFERENCESDIALOG_H
#include "ui_PreferencesDialog.h"
class PreferencesDialog : public QDialog, private Ui::PreferencesDialog
{
Q_OBJECT
public:
int exec();
public:
explicit PreferencesDialog(QWidget* parent = 0);
private slots:
void restoreState();
void saveState();
};
#endif // PREFERENCESDIALOG_H
To copy to clipboard, switch view to plain text mode
The ctor of the dialog
PreferencesDialog
::PreferencesDialog(QWidget* parent
) : QDialog(parent
){
setupUi(this);
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
connect(resetButton, SIGNAL(clicked()), SLOT(restoreState()));
databasePortEdit
->setValidator
(new QIntValidator(1024,
65536,
this));
QSize sizeHint
= this
->sizeHint
();
sizeHint.setWidth(350);
setMinimumSize(sizeHint);
setMaximumSize(sizeHint);
}
PreferencesDialog::PreferencesDialog(QWidget* parent) : QDialog(parent)
{
setupUi(this);
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
QPushButton* resetButton = buttonBox->button(QDialogButtonBox::Reset);
connect(resetButton, SIGNAL(clicked()), SLOT(restoreState()));
databasePortEdit->setValidator(new QIntValidator(1024, 65536, this));
QSize sizeHint = this->sizeHint();
sizeHint.setWidth(350);
setMinimumSize(sizeHint);
setMaximumSize(sizeHint);
}
To copy to clipboard, switch view to plain text mode
Here I construct the dialog:
{
...code..
// Initialize dialogs
m_preferencesDialog = new PreferencesDialog(0);
...more code..
}
EyeIdServer::EyeIdServer(QObject* parent) : QObject(parent)
{
...code..
// Initialize dialogs
m_preferencesDialog = new PreferencesDialog(0);
...more code..
}
To copy to clipboard, switch view to plain text mode
and from this routine I execute it
void EyeIdServer::showPreferencesDialog()
{
m_preferencesDialog->exec();
}
void EyeIdServer::showPreferencesDialog()
{
m_preferencesDialog->exec();
}
To copy to clipboard, switch view to plain text mode
Do you have any idea on why I get the crash?
I think is because I use the "this" pointer inside the dialog
Regards
Bookmarks