summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gui/kernel/qplatformdialoghelper.h3
-rw-r--r--src/widgets/dialogs/qcolordialog.cpp23
-rw-r--r--src/widgets/dialogs/qcolordialog.h3
3 files changed, 17 insertions, 12 deletions
diff --git a/src/gui/kernel/qplatformdialoghelper.h b/src/gui/kernel/qplatformdialoghelper.h
index fabc4985a3..150a2333c1 100644
--- a/src/gui/kernel/qplatformdialoghelper.h
+++ b/src/gui/kernel/qplatformdialoghelper.h
@@ -157,7 +157,8 @@ public:
enum ColorDialogOption {
ShowAlphaChannel = 0x00000001,
NoButtons = 0x00000002,
- DontUseNativeDialog = 0x00000004
+ DontUseNativeDialog = 0x00000004,
+ NoEyeDropperButton = 0x00000008
};
Q_DECLARE_FLAGS(ColorDialogOptions, ColorDialogOption)
diff --git a/src/widgets/dialogs/qcolordialog.cpp b/src/widgets/dialogs/qcolordialog.cpp
index 1bb65e6c24..a3b6fe935d 100644
--- a/src/widgets/dialogs/qcolordialog.cpp
+++ b/src/widgets/dialogs/qcolordialog.cpp
@@ -135,7 +135,7 @@ public:
QPushButton *ok;
QPushButton *cancel;
QPushButton *addCusBt;
- QPushButton *screenColorPickerButton;
+ QPushButton *eyeDropperButton = nullptr;
QColor selectedQColor;
int nextCust;
bool smallDisplay;
@@ -1642,8 +1642,8 @@ void QColorDialogPrivate::_q_pickScreenColor()
addCusBt->setDisabled(true);
buttons->setDisabled(true);
- if (screenColorPickerButton) {
- screenColorPickerButton->setDisabled(true);
+ if (eyeDropperButton) {
+ eyeDropperButton->setDisabled(true);
const QPoint globalPos = QCursor::pos();
q->setCurrentColor(grabScreenColor(globalPos));
updateColorLabelText(globalPos);
@@ -1673,7 +1673,7 @@ void QColorDialogPrivate::releaseColorPicking()
lblScreenColorInfo->setText("\n"_L1);
addCusBt->setDisabled(false);
buttons->setDisabled(false);
- screenColorPickerButton->setDisabled(false);
+ eyeDropperButton->setDisabled(false);
}
void QColorDialogPrivate::init(const QColor &initial)
@@ -1736,13 +1736,13 @@ void QColorDialogPrivate::initWidgets()
#if !defined(QT_SMALL_COLORDIALOG)
if (supportsColorPicking()) {
- screenColorPickerButton = new QPushButton();
- leftLay->addWidget(screenColorPickerButton);
+ eyeDropperButton = new QPushButton();
+ leftLay->addWidget(eyeDropperButton);
lblScreenColorInfo = new QLabel("\n"_L1);
leftLay->addWidget(lblScreenColorInfo);
- q->connect(screenColorPickerButton, SIGNAL(clicked()), SLOT(_q_pickScreenColor()));
+ q->connect(eyeDropperButton, SIGNAL(clicked()), SLOT(_q_pickScreenColor()));
} else {
- screenColorPickerButton = nullptr;
+ eyeDropperButton = nullptr;
lblScreenColorInfo = nullptr;
}
#endif
@@ -1882,8 +1882,8 @@ void QColorDialogPrivate::retranslateStrings()
lblCustomColors->setText(QColorDialog::tr("&Custom colors"));
addCusBt->setText(QColorDialog::tr("&Add to Custom Colors"));
#if !defined(QT_SMALL_COLORDIALOG)
- if (screenColorPickerButton)
- screenColorPickerButton->setText(QColorDialog::tr("&Pick Screen Color"));
+ if (eyeDropperButton)
+ eyeDropperButton->setText(QColorDialog::tr("&Pick Screen Color"));
#endif
}
@@ -2079,6 +2079,8 @@ void QColorDialog::setOptions(ColorDialogOptions options)
if (!d->nativeDialogInUse) {
d->buttons->setVisible(!(options & NoButtons));
d->showAlpha(options & ShowAlphaChannel);
+ if (d->eyeDropperButton)
+ d->eyeDropperButton->setVisible(!(options & NoEyeDropperButton));
}
}
@@ -2098,6 +2100,7 @@ QColorDialog::ColorDialogOptions QColorDialog::options() const
\value ShowAlphaChannel Allow the user to select the alpha component of a color.
\value NoButtons Don't display \uicontrol{OK} and \uicontrol{Cancel} buttons. (Useful for "live dialogs".)
+ \value NoEyeDropperButton Hide the \uicontrol{Eye Dropper} button. This value was added in Qt 6.6.
\value DontUseNativeDialog Use Qt's standard color dialog instead of the operating system
native color dialog.
diff --git a/src/widgets/dialogs/qcolordialog.h b/src/widgets/dialogs/qcolordialog.h
index 2031c413a9..0484c412a8 100644
--- a/src/widgets/dialogs/qcolordialog.h
+++ b/src/widgets/dialogs/qcolordialog.h
@@ -26,7 +26,8 @@ public:
enum ColorDialogOption {
ShowAlphaChannel = 0x00000001,
NoButtons = 0x00000002,
- DontUseNativeDialog = 0x00000004
+ DontUseNativeDialog = 0x00000004,
+ NoEyeDropperButton = 0x00000008
};
Q_ENUM(ColorDialogOption)