Add note to QMessageBox::button() about modifying returned button

We don't have a good way to detect whether the button is modified or
not, to bail out of using the native dialog helpers.

Document that this API shouldn't be used to modify the standard
buttons (they are standard after all), and recommend the explicit
APIs for adding custom buttons instead.

Pick-to: 6.6
Fixes: QTBUG-112525
Change-Id: I38c8ef5e1717a85f0db59c9e705d0775982ffb57
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
Tor Arne Vestbø 2023-09-01 14:35:54 +02:00
parent a7bfe58989
commit e9a1c53214

View File

@ -1007,6 +1007,12 @@ QMessageBox::StandardButton QMessageBox::standardButton(QAbstractButton *button)
Returns a pointer corresponding to the standard button \a which,
or \nullptr if the standard button doesn't exist in this message box.
\note Modifying the properties of the returned button may not be reflected
in native implementations of the message dialog. To customize dialog
buttons add a \l{addButton(QAbstractButton *button, QMessageBox::ButtonRole role)}
{custom button} or \l{addButton(const QString &text, QMessageBox::ButtonRole role)}
{button title} instead, or set the \l Option::DontUseNativeDialog option.
\sa standardButtons, standardButton()
*/
QAbstractButton *QMessageBox::button(StandardButton which) const