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;
348 QMenu *mMenu =
nullptr;
352 bool mSuppressRecurse;
354 bool mDismissOnColorSelection;
366 void setColor(
const QColor &color );
394 void paintEvent( QPaintEvent *event )
override;
398 void setColor(
const QColor &
color,
bool emitSignals =
false )
override;
414 bool mIsDragging =
false;
420 int mWheelThickness = 18;
423 ControlPart mClickedPart = QgsColorWheel::None;
429 QImage mTriangleImage;
435 bool mWheelDirty =
true;
438 bool mTriangleDirty =
true;
447 void createImages( QSizeF size );
453 void createTriangle();
459 void setColorFromPos( QPointF pos );
491 void paintEvent( QPaintEvent *event )
override;
496 void setColor(
const QColor &
color,
bool emitSignals =
false )
override;
505 bool mIsDragging =
false;
508 static constexpr float mMargin = 2.;
511 QImage *mBoxImage =
nullptr;
525 float valueRangeX()
const;
531 float valueRangeY()
const;
541 float yComponentValue()
const;
551 float xComponentValue()
const;
557 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 );
716 void setColor(
const QColor &
color,
bool emitSignals =
false )
override;
732 float convertRealToDisplay(
float realValue )
const;
740 float convertDisplayToReal(
float displayValue )
const;
747 void rampColorChanged(
const QColor &
color );
752 void spinChanged(
double value );
757 void rampChanged(
float value );
786 Q_ENUM( ColorTextFormat )
794 void setColor(
const QColor &color,
bool emitSignals =
false )
override;
801 void setAllowOpacity(
bool allowOpacity );
804 void resizeEvent( QResizeEvent *event )
override;
807 QLineEdit *mLineEdit =
nullptr;
810 QToolButton *mMenuButton =
nullptr;
815 bool mAllowAlpha =
true;
854 void paintEvent( QPaintEvent *event )
override;
864 QColor
color2()
const {
return mColor2; }
875 virtual void setColor2(
const QColor &color );
879 void mousePressEvent( QMouseEvent *e )
override;
882 void mouseReleaseEvent( QMouseEvent *e )
override;
885 void mouseMoveEvent( QMouseEvent *e )
override;
891 QPoint mDragStartPosition;
898 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.
A line edit widget which displays colors as text and accepts string representations of colors.
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 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.