Ok, my fault, i looked at a wrong class. I have now overloaded QDialog::reject() inside my dialogtest.cpp
I have no idea how to modify the
void DialogTest::reject()
void DialogTest::reject()
To copy to clipboard, switch view to plain text mode
that it only call done(Rejected) if the button "Abort" was pressed. Hope you could
give me hint, still a Qt and C++ beginner since 3 month 
Thx
#include "dialogtest.h"
#include "ui_dialogtest.h"
DialogTest
::DialogTest(QWidget *parent
) : ui(new Ui::DialogTest)
{
ui->setupUi(this);
this->setModal( true );
}
DialogTest::~DialogTest()
{
delete ui;
}
{
QDialogButtonBox::StandardButton stdButton
= ui
->buttonBox
->standardButton
(button
);
switch (stdButton)
{
qDebug() << Q_FUNC_INFO << "OK";
break;
qDebug() << Q_FUNC_INFO << "Discard";
break;
qDebug() << Q_FUNC_INFO << "Abort";
break;
qDebug() << Q_FUNC_INFO << "Cancel";
break;
qDebug() << Q_FUNC_INFO << "Apply";
break;
default:
qDebug() << Q_FUNC_INFO << "button not handled";
break;
}
}
void DialogTest::reject()
{
qDebug() << Q_FUNC_INFO << "QDialog::reject()";
done(Rejected);
}
void DialogTest::accept()
{
qDebug() << Q_FUNC_INFO << "QDialog::reject()";
done(Accepted);
}
#include "dialogtest.h"
#include "ui_dialogtest.h"
DialogTest::DialogTest(QWidget *parent) :
QDialog(parent),
ui(new Ui::DialogTest)
{
ui->setupUi(this);
this->setModal( true );
connect( ui->buttonBox, SIGNAL(clicked(QAbstractButton*)),
this, SLOT(buttonClicked(QAbstractButton*)));
}
DialogTest::~DialogTest()
{
delete ui;
}
void DialogTest::buttonClicked( QAbstractButton *button )
{
QDialogButtonBox::StandardButton stdButton = ui->buttonBox->standardButton(button);
switch (stdButton)
{
case QDialogButtonBox::Ok:
qDebug() << Q_FUNC_INFO << "OK";
break;
case QDialogButtonBox::Discard:
qDebug() << Q_FUNC_INFO << "Discard";
break;
case QDialogButtonBox::Abort:
qDebug() << Q_FUNC_INFO << "Abort";
break;
case QDialogButtonBox::Cancel:
qDebug() << Q_FUNC_INFO << "Cancel";
break;
case QDialogButtonBox::Apply:
qDebug() << Q_FUNC_INFO << "Apply";
break;
default:
qDebug() << Q_FUNC_INFO << "button not handled";
break;
}
}
void DialogTest::reject()
{
qDebug() << Q_FUNC_INFO << "QDialog::reject()";
done(Rejected);
}
void DialogTest::accept()
{
qDebug() << Q_FUNC_INFO << "QDialog::reject()";
done(Accepted);
}
To copy to clipboard, switch view to plain text mode
Bookmarks