aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/qmldesigner/components/propertyeditor/simplecolorpalettemodel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/qmldesigner/components/propertyeditor/simplecolorpalettemodel.cpp')
-rw-r--r--src/plugins/qmldesigner/components/propertyeditor/simplecolorpalettemodel.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/plugins/qmldesigner/components/propertyeditor/simplecolorpalettemodel.cpp b/src/plugins/qmldesigner/components/propertyeditor/simplecolorpalettemodel.cpp
index b3207f0006..71d4c1b6d4 100644
--- a/src/plugins/qmldesigner/components/propertyeditor/simplecolorpalettemodel.cpp
+++ b/src/plugins/qmldesigner/components/propertyeditor/simplecolorpalettemodel.cpp
@@ -29,6 +29,9 @@
#include "designersettings.h"
+#include <coreplugin/icore.h>
+
+#include <QColorDialog>
#include <QHash>
#include <QByteArray>
#include <QDebug>
@@ -143,4 +146,16 @@ void SimpleColorPaletteModel::write()
SimpleColorPaletteSingleton::getInstance().writePalette();
}
+void SimpleColorPaletteModel::showDialog(QColor color)
+{
+ auto colorDialog = new QColorDialog(Core::ICore::dialogParent());
+ colorDialog->setCurrentColor(color);
+ colorDialog->setAttribute(Qt::WA_DeleteOnClose);
+
+ connect(colorDialog, &QDialog::rejected, this, &SimpleColorPaletteModel::colorDialogRejected);
+ connect(colorDialog, &QColorDialog::currentColorChanged, this, &SimpleColorPaletteModel::currentColorChanged);
+
+ QTimer::singleShot(0, [colorDialog](){ colorDialog->exec(); });
+}
+
} // namespace QmlDesigner