diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/plugins/Ui/qsui/colorwidget.cpp | 15 | ||||
| -rw-r--r-- | src/plugins/Ui/qsui/colorwidget.h | 11 |
2 files changed, 20 insertions, 6 deletions
diff --git a/src/plugins/Ui/qsui/colorwidget.cpp b/src/plugins/Ui/qsui/colorwidget.cpp index b02e3a46b..d774dbfdc 100644 --- a/src/plugins/Ui/qsui/colorwidget.cpp +++ b/src/plugins/Ui/qsui/colorwidget.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2014 by Ilya Kotov * + * Copyright (C) 2005-2020 by Ilya Kotov * * forkotov02@ya.ru * * * * This program is free software; you can redistribute it and/or modify * @@ -18,7 +18,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ -#include <QColorDialog> #include <QPalette> #include "colorwidget.h" @@ -31,10 +30,20 @@ ColorWidget::ColorWidget(QWidget *parent) : QFrame(parent) ColorWidget::~ColorWidget() {} +QColorDialog::ColorDialogOptions ColorWidget::options() const +{ + return m_options; +} + +void ColorWidget::setOptions(QColorDialog::ColorDialogOptions options) +{ + m_options = options; +} + void ColorWidget::mousePressEvent(QMouseEvent *) { QColor color = QColorDialog::getColor(palette().color(backgroundRole()), parentWidget(), - tr("Select Color")); + tr("Select Color"), m_options); if (color.isValid()) { setColor(color.name()); diff --git a/src/plugins/Ui/qsui/colorwidget.h b/src/plugins/Ui/qsui/colorwidget.h index 95e0b4f25..f141f8902 100644 --- a/src/plugins/Ui/qsui/colorwidget.h +++ b/src/plugins/Ui/qsui/colorwidget.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2014 by Ilya Kotov * + * Copyright (C) 2005-2020 by Ilya Kotov * * forkotov02@ya.ru * * * * This program is free software; you can redistribute it and/or modify * @@ -22,6 +22,7 @@ #include <QFrame> #include <QPaintEvent> +#include <QColorDialog> /** @author Ilya Kotov @@ -29,19 +30,23 @@ class ColorWidget : public QFrame { Q_OBJECT + Q_PROPERTY(QColorDialog::ColorDialogOptions options READ options WRITE setOptions) public: ColorWidget(QWidget *parent = nullptr); - ~ColorWidget(); + QColorDialog::ColorDialogOptions options() const; + void setOptions(QColorDialog::ColorDialogOptions options); + const QString colorName() const; public slots: - void setColor (QString); + void setColor(QString); private: void mousePressEvent(QMouseEvent *) override; QString m_colorName; + QColorDialog::ColorDialogOptions m_options = QColorDialog::ColorDialogOptions(); }; |
