From 40745780446c27457095d5f9324e388d065e58f7 Mon Sep 17 00:00:00 2001 From: Uwe Date: Sat, 25 Feb 2023 18:51:36 +0100 Subject: [PATCH] [Widgets] register transparency property of Gui::ColorButton - at the moment it is not possible to set the property "allowTransparency" in Qt Designer --- src/Tools/plugins/widget/customwidgets.cpp | 15 ++++++++++++++- src/Tools/plugins/widget/customwidgets.h | 4 ++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/Tools/plugins/widget/customwidgets.cpp b/src/Tools/plugins/widget/customwidgets.cpp index fd3952d5aa..9db65e4516 100644 --- a/src/Tools/plugins/widget/customwidgets.cpp +++ b/src/Tools/plugins/widget/customwidgets.cpp @@ -1762,7 +1762,10 @@ void PrefDoubleSpinBox::setParamGrpPath ( const QByteArray& name ) // ------------------------------------------------------------- ColorButton::ColorButton(QWidget* parent) - : QPushButton( parent ), _allowChange(true), _drawFrame(true) + : QPushButton(parent), + _allowChange(true), + _drawFrame(true), + _allowTransparency(false) { _col = palette().color(QPalette::Active,QPalette::Midlight); connect( this, SIGNAL( clicked() ), SLOT( onChooseColor() )); @@ -1793,6 +1796,16 @@ bool ColorButton::allowChangeColor() const return _allowChange; } +void ColorButton::setAllowTransparency(bool ok) +{ + _allowTransparency = ok; +} + +bool ColorButton::allowTransparency() const +{ + return _allowTransparency; +} + void ColorButton::setDrawFrame(bool ok) { _drawFrame = ok; diff --git a/src/Tools/plugins/widget/customwidgets.h b/src/Tools/plugins/widget/customwidgets.h index 19fdb365d4..c5f9d51091 100644 --- a/src/Tools/plugins/widget/customwidgets.h +++ b/src/Tools/plugins/widget/customwidgets.h @@ -653,6 +653,7 @@ class ColorButton : public QPushButton Q_PROPERTY( QColor color READ color WRITE setColor ) Q_PROPERTY( bool allowChangeColor READ allowChangeColor WRITE setAllowChangeColor ) Q_PROPERTY( bool drawFrame READ drawFrame WRITE setDrawFrame ) + Q_PROPERTY( bool allowTransparency READ allowTransparency WRITE setAllowTransparency ) public: ColorButton( QWidget* parent = 0 ); @@ -663,6 +664,8 @@ public: void setAllowChangeColor(bool); bool allowChangeColor() const; + void setAllowTransparency(bool); + bool allowTransparency() const; void setDrawFrame(bool); bool drawFrame() const; @@ -679,6 +682,7 @@ protected: private: QColor _col; bool _allowChange; + bool _allowTransparency; bool _drawFrame; };