16#ifndef QGSCOLORWIDGETS_H
17#define QGSCOLORWIDGETS_H
23#include <QWidgetAction>
76 Q_ENUM( ComponentUnit )
117 float componentValueF() const;
123 static QPixmap createDragIcon( const QColor &color );
128 static ComponentUnit componentUnit( ColorComponent component );
139 virtual
void setColor( const QColor &color,
bool emitSignals = false );
146 virtual
void setComponent(
QgsColorWidget::ColorComponent component );
158 Q_DECL_DEPRECATED virtual
void setComponentValue(
int value )
SIP_DEPRECATED;
170 virtual
void setComponentValueF(
float value );
285 void dropEvent( QDropEvent *e ) override;
346 QMenu *mMenu =
nullptr;
350 bool mSuppressRecurse =
false;
352 bool mDismissOnColorSelection =
true;
364 void setColor(
const QColor &color );
391 void paintEvent( QPaintEvent *event )
override;
395 void setColor(
const QColor &
color,
bool emitSignals =
false )
override;
411 bool mIsDragging =
false;
417 int mWheelThickness = 18;
420 ControlPart mClickedPart = QgsColorWheel::None;
426 QImage mTriangleImage;
432 bool mWheelDirty =
true;
435 bool mTriangleDirty =
true;
444 void createImages( QSizeF size );
450 void createTriangle();
456 void setColorFromPos( QPointF pos );
487 void paintEvent( QPaintEvent *event )
override;
492 void setColor(
const QColor &
color,
bool emitSignals =
false )
override;
501 bool mIsDragging =
false;
504 static constexpr float mMargin = 2.;
507 QImage *mBoxImage =
nullptr;
521 float valueRangeX()
const;
527 float valueRangeY()
const;
537 float yComponentValue()
const;
547 float xComponentValue()
const;
553 void setColorFromPoint( QPoint point );
588 QSize sizeHint()
const override;
589 void paintEvent( QPaintEvent *event )
override;
596 void setOrientation( Orientation orientation );
610 void setInteriorMargin(
int margin );
624 void setShowFrame(
bool showFrame );
637 void setMarkerSize(
int markerSize );
657 void wheelEvent( QWheelEvent *event )
override;
663 bool mIsDragging =
false;
672 bool mShowFrame =
false;
675 QPolygonF mTopTriangle;
678 QPolygonF mBottomTriangle;
684 void setColorFromPoint( QPointF point );
710 void setColor(
const QColor &
color,
bool emitSignals =
false )
override;
726 float convertRealToDisplay(
float realValue )
const;
734 float convertDisplayToReal(
float displayValue )
const;
741 void rampColorChanged(
const QColor &
color );
746 void spinChanged(
double value );
751 void rampChanged(
float value );
779 Q_ENUM( ColorTextFormat )
787 void setColor(
const QColor &color,
bool emitSignals =
false )
override;
794 void setAllowOpacity(
bool allowOpacity );
797 void resizeEvent( QResizeEvent *event )
override;
800 QLineEdit *mLineEdit =
nullptr;
803 QToolButton *mMenuButton =
nullptr;
808 bool mAllowAlpha =
true;
846 void paintEvent( QPaintEvent *event )
override;
856 QColor
color2()
const {
return mColor2; }
867 virtual void setColor2(
const QColor &color );
871 void mousePressEvent( QMouseEvent *e )
override;
874 void mouseReleaseEvent( QMouseEvent *e )
override;
877 void mouseMoveEvent( QMouseEvent *e )
override;
883 QPoint mDragStartPosition;
890 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.