From 4b42c91821b913aec32ab82d2d5e29ffa2f2a8ad Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 18 Feb 2013 11:27:24 +0100 Subject: [PATCH] QColorDialog/QFontDialog: Fix setOption(). Call setOptions() such that the option takes effect. Task-number: QTBUG-28817 Change-Id: Ibef834efc988d3ba49e88ea88ef475b1fd7fd98f Reviewed-by: J-P Nurmi Reviewed-by: Oliver Wolff --- src/widgets/dialogs/qcolordialog.cpp | 5 +++-- src/widgets/dialogs/qfontdialog.cpp | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/widgets/dialogs/qcolordialog.cpp b/src/widgets/dialogs/qcolordialog.cpp index 5adb4ba6da..af43ecc8df 100644 --- a/src/widgets/dialogs/qcolordialog.cpp +++ b/src/widgets/dialogs/qcolordialog.cpp @@ -1735,8 +1735,9 @@ QColor QColorDialog::selectedColor() const */ void QColorDialog::setOption(ColorDialogOption option, bool on) { - Q_D(QColorDialog); - d->options->setOption(static_cast(option), on); + const QColorDialog::ColorDialogOptions previousOptions = options(); + if (!(previousOptions & option) != !on) + setOptions(previousOptions ^ option); } /*! diff --git a/src/widgets/dialogs/qfontdialog.cpp b/src/widgets/dialogs/qfontdialog.cpp index 79aab3280f..4036dc80ab 100644 --- a/src/widgets/dialogs/qfontdialog.cpp +++ b/src/widgets/dialogs/qfontdialog.cpp @@ -853,8 +853,9 @@ QFont QFontDialog::selectedFont() const */ void QFontDialog::setOption(FontDialogOption option, bool on) { - Q_D(QFontDialog); - d->options->setOption(static_cast(option), on); + const QFontDialog::FontDialogOptions previousOptions = options(); + if (!(previousOptions & option) != !on) + setOptions(previousOptions ^ option); } /*!