summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--dist/changes-5.0.04
-rw-r--r--src/widgets/dialogs/qcolordialog.cpp29
-rw-r--r--src/widgets/dialogs/qcolordialog.h9
3 files changed, 27 insertions, 15 deletions
diff --git a/dist/changes-5.0.0 b/dist/changes-5.0.0
index 5ffeb1996c..f8a553a0bc 100644
--- a/dist/changes-5.0.0
+++ b/dist/changes-5.0.0
@@ -255,6 +255,10 @@ information about a particular change.
- qMacVersion() has been removed. Use QSysInfo::macVersion() or
QSysInfo::MacintoshVersion instead.
+- QColorDialog::customColor() now returns a QColor value instead of QRgb.
+ QColorDialog::setCustomColor() and QColorDialog::setStandardColor() now
+ take a QColor value for their second parameter instead of QRgb.
+
****************************************************************************
* General *
****************************************************************************
diff --git a/src/widgets/dialogs/qcolordialog.cpp b/src/widgets/dialogs/qcolordialog.cpp
index 569a10653f..606b9b00f7 100644
--- a/src/widgets/dialogs/qcolordialog.cpp
+++ b/src/widgets/dialogs/qcolordialog.cpp
@@ -433,36 +433,45 @@ int QColorDialog::customCount()
/*!
\since 4.5
- Returns the custom color at the given \a index as a QRgb value.
+ Returns the custom color at the given \a index as a QColor value.
*/
-QRgb QColorDialog::customColor(int index)
+QColor QColorDialog::customColor(int index)
{
- return QColorDialogOptions::customColor(index);
+ return QColor(QColorDialogOptions::customColor(index));
}
/*!
- Sets the custom color at \a index to the QRgb \a color value.
+ Sets the custom color at \a index to the QColor \a color value.
\note This function does not apply to the Native Color Dialog on the Mac
OS X platform. If you still require this function, use the
QColorDialog::DontUseNativeDialog option.
*/
-void QColorDialog::setCustomColor(int index, QRgb color)
+void QColorDialog::setCustomColor(int index, QColor color)
{
- QColorDialogOptions::setCustomColor(index, color);
+ QColorDialogOptions::setCustomColor(index, color.rgba());
}
/*!
- Sets the standard color at \a index to the QRgb \a color value.
+ \since 5.0
+
+ Returns the standard color at the given \a index as a QColor value.
+*/
+QColor QColorDialog::standardColor(int index)
+{
+ return QColor(QColorDialogOptions::standardColor(index));
+}
+
+/*!
+ Sets the standard color at \a index to the QColor \a color value.
\note This function does not apply to the Native Color Dialog on the Mac
OS X platform. If you still require this function, use the
QColorDialog::DontUseNativeDialog option.
*/
-
-void QColorDialog::setStandardColor(int index, QRgb color)
+void QColorDialog::setStandardColor(int index, QColor color)
{
- QColorDialogOptions::setStandardColor(index, color);
+ QColorDialogOptions::setStandardColor(index, color.rgba());
}
static inline void rgb2hsv(QRgb rgb, int &h, int &s, int &v)
diff --git a/src/widgets/dialogs/qcolordialog.h b/src/widgets/dialogs/qcolordialog.h
index cfb54a7eb9..1daead3879 100644
--- a/src/widgets/dialogs/qcolordialog.h
+++ b/src/widgets/dialogs/qcolordialog.h
@@ -102,12 +102,11 @@ public:
// obsolete
static QRgb getRgba(QRgb rgba = 0xffffffff, bool *ok = 0, QWidget *parent = 0);
- // ### Qt 5: use QColor in signatures
static int customCount();
- static QRgb customColor(int index);
- static void setCustomColor(int index, QRgb color);
- static void setStandardColor(int index, QRgb color);
-
+ static QColor customColor(int index);
+ static void setCustomColor(int index, QColor color);
+ static QColor standardColor(int index);
+ static void setStandardColor(int index, QColor color);
Q_SIGNALS:
void currentColorChanged(const QColor &color);