[Widgets] register transparency property of Gui::ColorButton

- at the moment it is not possible to set the property "allowTransparency" in Qt Designer
This commit is contained in:
Uwe
2023-02-25 18:51:36 +01:00
committed by wwmayer
parent cabb88019f
commit 4074578044
2 changed files with 18 additions and 1 deletions

View File

@@ -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;

View File

@@ -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;
};