From 59170ef2f2bd58038bdefaaad26ce8f9e8ee1dfe Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Tue, 30 Jul 2013 15:02:36 +0200 Subject: [PATCH] QtQuick.Dialogs.ColorDialog: set current color in the QColorDialog It was a missing feature to set the current color programmatically, either before or after showing the dialog. Task-number: QTBUG-32621 Change-Id: I62a811f7c36eaab5356c5924bf3447deca55ada3 Reviewed-by: Liang Qi --- src/imports/dialogs/qquickabstractcolordialog.cpp | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/src/imports/dialogs/qquickabstractcolordialog.cpp b/src/imports/dialogs/qquickabstractcolordialog.cpp index 7cfd7ea..d565352 100644 --- a/src/imports/dialogs/qquickabstractcolordialog.cpp +++ b/src/imports/dialogs/qquickabstractcolordialog.cpp @@ -66,6 +66,8 @@ void QQuickAbstractColorDialog::setVisible(bool v) { if (helper() && v) { m_dlgHelper->setOptions(m_options); + // Due to the fact that QColorDialogOptions doesn't have currentColor... + m_dlgHelper->setCurrentColor(m_color); } QQuickAbstractDialog::setVisible(v); } @@ -100,6 +102,9 @@ void QQuickAbstractColorDialog::setTitle(const QString &t) void QQuickAbstractColorDialog::setColor(QColor arg) { + if (m_dlgHelper) + m_dlgHelper->setCurrentColor(arg); + // m_options->setCustomColor or setStandardColor don't make sense here if (m_color != arg) { m_color = arg; emit colorChanged(); -- 1.7.2.5