Do not clear default button in QMessageBox::setDetailedText().
Store the value of QMessageBoxPrivate::autoAddOkButton temporarily when automatically adding the "Show Details..." button. Task-number: QTBUG-39334 Change-Id: I173c83893548ee83b3d8ea2743f87686c32657e7 Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
This commit is contained in:
parent
91b0b2e1a7
commit
a149d2f73e
@ -2565,8 +2565,10 @@ void QMessageBox::setDetailedText(const QString &text)
|
||||
d->detailsText->hide();
|
||||
}
|
||||
if (!d->detailsButton) {
|
||||
const bool autoAddOkButton = d->autoAddOkButton; // QTBUG-39334, addButton() clears the flag.
|
||||
d->detailsButton = new DetailButton(this);
|
||||
addButton(d->detailsButton, QMessageBox::ActionRole);
|
||||
d->autoAddOkButton = autoAddOkButton;
|
||||
}
|
||||
d->detailsText->setText(text);
|
||||
}
|
||||
|
@ -593,6 +593,11 @@ void tst_QMessageBox::detailsText()
|
||||
QString text("This is the details text.");
|
||||
box.setDetailedText(text);
|
||||
QCOMPARE(box.detailedText(), text);
|
||||
box.show();
|
||||
QTest::qWaitForWindowExposed(&box);
|
||||
// QTBUG-39334, the box should now have the default "Ok" button as well as
|
||||
// the "Show Details.." button.
|
||||
QCOMPARE(box.findChildren<QAbstractButton *>().size(), 2);
|
||||
}
|
||||
|
||||
void tst_QMessageBox::detailsButtonText()
|
||||
|
Loading…
Reference in New Issue
Block a user