16#ifndef QGSCOLORWIDGETS_H
17#define QGSCOLORWIDGETS_H
23#include <QWidgetAction>
77 Q_ENUM( ComponentUnit )
118 float componentValueF() const;
124 static QPixmap createDragIcon( const QColor &color );
129 static ComponentUnit componentUnit( ColorComponent component );
140 virtual
void setColor( const QColor &color,
bool emitSignals = false );
147 virtual
void setComponent(
QgsColorWidget::ColorComponent component );
159 Q_DECL_DEPRECATED virtual
void setComponentValue(
int value )
SIP_DEPRECATED;
171 virtual
void setComponentValueF(
float value );
286 void dropEvent( QDropEvent *e ) override;
347 QMenu *mMenu =
nullptr;
351 bool mSuppressRecurse =
false;
353 bool mDismissOnColorSelection =
true;
365 void setColor(
const QColor &color );
392 void paintEvent( QPaintEvent *event )
override;
396 void setColor(
const QColor &
color,
bool emitSignals =
false )
override;
406 void invalidateImages();
416 bool mIsDragging =
false;
422 int mWheelThickness = 18;
425 ControlPart mClickedPart = QgsColorWheel::None;
431 QImage mTriangleImage;
437 bool mWheelDirty =
true;
440 bool mTriangleDirty =
true;
449 void createImages( QSizeF size );
455 void createTriangle();
461 void setColorFromPos( QPointF pos );
492 void paintEvent( QPaintEvent *event )
override;
497 void setColor(
const QColor &
color,
bool emitSignals =
false )
override;
506 bool mIsDragging =
false;
509 static constexpr float mMargin = 2.;
512 std::unique_ptr<QImage> mBoxImage;
526 float valueRangeX()
const;
532 float valueRangeY()
const;
542 float yComponentValue()
const;
552 float xComponentValue()
const;
558 void setColorFromPoint( QPoint point );
593 QSize sizeHint()
const override;
594 void paintEvent( QPaintEvent *event )
override;
601 void setOrientation( Orientation orientation );
615 void setInteriorMargin(
int margin );
629 void setShowFrame(
bool showFrame );
642 void setMarkerSize(
int markerSize );
662 void wheelEvent( QWheelEvent *event )
override;
668 bool mIsDragging =
false;
677 bool mShowFrame =
false;
680 QPolygonF mTopTriangle;
683 QPolygonF mBottomTriangle;
689 void setColorFromPoint( QPointF point );
715 void setColor(
const QColor &
color,
bool emitSignals =
false )
override;
731 float convertRealToDisplay(
float realValue )
const;
739 float convertDisplayToReal(
float displayValue )
const;
746 void rampColorChanged(
const QColor &
color );
751 void spinChanged(
double value );
756 void rampChanged(
float value );
784 Q_ENUM( ColorTextFormat )
794 void setColor( const QColor &
color,
bool emitSignals = false ) override;
807 QLineEdit *mLineEdit =
nullptr;
810 QToolButton *mMenuButton =
nullptr;
815 bool mAllowAlpha = true;
853 void paintEvent( QPaintEvent *event )
override;
863 QColor
color2()
const {
return mColor2; }
874 virtual void setColor2(
const QColor &color );
878 void mousePressEvent( QMouseEvent *e )
override;
881 void mouseReleaseEvent( QMouseEvent *e )
override;
884 void mouseMoveEvent( QMouseEvent *e )
override;
890 QPoint mDragStartPosition;
897 void drawColor(
const QColor &color, QRect rect, QPainter &painter );
QSize sizeHint() const override
void resizeEvent(QResizeEvent *event) override
void mouseReleaseEvent(QMouseEvent *event) override
void mousePressEvent(QMouseEvent *event) override
void setComponent(ColorComponent component) override
Sets the color component which the widget controls.
void setColor(const QColor &color, bool emitSignals=false) override
void mouseMoveEvent(QMouseEvent *event) override
void paintEvent(QPaintEvent *event) override
QgsColorBox(QWidget *parent=nullptr, ColorComponent component=Value)
Construct a new color box widget.
QgsColorTextWidget(QWidget *parent=nullptr)
Construct a new color line edit widget.
ColorTextFormat
Specifies the display format for a color.
@ Rgba
Rgba( r, g, b, a ) format, with alpha.
@ Rgb
Rgb( r, g, b ) format.
@ HexRgbA
#RRGGBBAA in hexadecimal, with alpha
@ HexRgb
#RRGGBB in hexadecimal
void setColor(const QColor &color, bool emitSignals=false) override
Sets the color for the widget.
void setAllowOpacity(bool allowOpacity)
Sets whether opacity modification (transparency) is permitted.
static const QgsSettingsEntryEnumFlag< ColorTextFormat > * settingsTextFormat
void resizeEvent(QResizeEvent *event) override
void paintEvent(QPaintEvent *event) override
QgsColorWheel(QWidget *parent=nullptr)
Constructs a new color wheel widget.
void mousePressEvent(QMouseEvent *event) override
QSize sizeHint() const override
void mouseReleaseEvent(QMouseEvent *event) override
void mouseMoveEvent(QMouseEvent *event) override
void resizeEvent(QResizeEvent *event) override
void setColor(const QColor &color, bool emitSignals=false) override
~QgsColorWheel() override
The QgsSpinBox is a spin box with a clear button that will set the value to the defined clear value.
A template class for enum and flag settings entry.