summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/dialogs/qmessagebox.cpp4
-rw-r--r--src/widgets/doc/snippets/code/src_gui_dialogs_qmessagebox.cpp6
-rw-r--r--src/widgets/styles/qstylesheetstyle.cpp6
3 files changed, 12 insertions, 4 deletions
diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp
index f9d58e4d906..acb63c4aa9b 100644
--- a/src/widgets/dialogs/qmessagebox.cpp
+++ b/src/widgets/dialogs/qmessagebox.cpp
@@ -562,6 +562,10 @@ void QMessageBoxPrivate::helperClicked(QPlatformDialogHelper::StandardButton hel
and \l{QMessageBox::standardButtons} {standard buttons} for
accepting a user response.
+ While the parent parameter is optional, specifying it gives a hint
+ to the window manager, which can then take care of positioning, and
+ maintain a proper stacking order of the dialog window.
+
Two APIs for using QMessageBox are provided, the property-based
API, and the static functions. Calling one of the static functions
is the simpler approach, but it is less flexible than using the
diff --git a/src/widgets/doc/snippets/code/src_gui_dialogs_qmessagebox.cpp b/src/widgets/doc/snippets/code/src_gui_dialogs_qmessagebox.cpp
index ebc07025ec0..062e2e5142a 100644
--- a/src/widgets/doc/snippets/code/src_gui_dialogs_qmessagebox.cpp
+++ b/src/widgets/doc/snippets/code/src_gui_dialogs_qmessagebox.cpp
@@ -12,7 +12,7 @@ int ret = QMessageBox::warning(this, tr("My Application"),
//! [2]
-QMessageBox msgBox;
+QMessageBox msgBox(this);
QPushButton *connectButton = msgBox.addButton(tr("Connect"), QMessageBox::ActionRole);
QPushButton *abortButton = msgBox.addButton(QMessageBox::Abort);
@@ -53,13 +53,13 @@ int main(int argc, char *argv[])
//! [4]
//! [5]
-QMessageBox msgBox;
+QMessageBox msgBox(this);
msgBox.setText("The document has been modified.");
msgBox.exec();
//! [5]
//! [6]
-QMessageBox msgBox;
+QMessageBox msgBox(this);
msgBox.setText("The document has been modified.");
msgBox.setInformativeText("Do you want to save your changes?");
msgBox.setStandardButtons(QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp
index 08178e7b685..f4b21d3b70d 100644
--- a/src/widgets/styles/qstylesheetstyle.cpp
+++ b/src/widgets/styles/qstylesheetstyle.cpp
@@ -5269,7 +5269,11 @@ QSize QStyleSheetStyle::sizeFromContents(ContentsType ct, const QStyleOption *op
if (const QStyleOptionSpinBox *spinbox = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) {
if (rule.baseStyleCanDraw()) {
sz = baseStyle()->sizeFromContents(ct, opt, sz, w);
- } else if (spinbox->buttonSymbols != QAbstractSpinBox::NoButtons) {
+ if (rule.hasBox() || !rule.hasNativeBorder())
+ sz = rule.boxSize(sz);
+ return sz;
+ }
+ if (spinbox->buttonSymbols != QAbstractSpinBox::NoButtons) {
// Add some space for the up/down buttons
QRenderRule subRule = renderRule(w, opt, PseudoElement_SpinBoxUpButton);
if (subRule.hasDrawable()) {