我创建了一个覆盖对话框,如下面的QT / C ++
所示
这是相关的代码:
DialogOverwrite::DialogOverwrite(QWidget *parent) :
QDialog(parent),
ui(new Ui::DialogOverwrite)
{
ui->setupUi(this);
QPushButton *YesToAllButton = ui->buttonBox->button(QDialogButtonBox::YesToAll);
QPushButton *YesButton = ui->buttonBox->button(QDialogButtonBox::Yes);
QPushButton *NoToAllButton = ui->buttonBox->button(QDialogButtonBox::NoToAll);
QPushButton *NoButton = ui->buttonBox->button(QDialogButtonBox::No);
QPushButton *CancelButton = ui->buttonBox->button(QDialogButtonBox::Cancel);
connect(ui->buttonBox, SIGNAL(clicked(QAbstractButton*)),this,
SLOT(dialogButton(QAbstractButton*)));
}
DialogOverwrite::~DialogOverwrite()
{
delete ui;
}
void DialogOverwrite::dialogButton(QAbstractButton* aButton) {
QDialogButtonBox::StandardButton button = ui->buttonBox->standardButton(aButton);
switch (button) {
case QDialogButtonBox::YesToAll:
OverwriteAction = YES_TO_ALL;
break;
...
我已声明QPushButton * YesToAllButton ...以便连接到ui中的按钮盒设计并触发点击的信号。
触发工作正常但是当我试图抓住我点击的按钮时,我会收到一个“NoButton”而不是YesToAll或任何其他按钮。
我错过了什么
由于