16#ifndef QGSCOLORWIDGETS_H
17#define QGSCOLORWIDGETS_H
19#include <QWidgetAction>
72 Q_ENUM( ComponentUnit )
113 float componentValueF() const;
119 static QPixmap createDragIcon( const QColor &color );
124 static ComponentUnit componentUnit( ColorComponent component );
135 virtual
void setColor( const QColor &color,
bool emitSignals = false );
142 virtual
void setComponent(
QgsColorWidget::ColorComponent component );
154 Q_DECL_DEPRECATED virtual
void setComponentValue(
int value )
SIP_DEPRECATED;
166 virtual
void setComponentValueF(
float value );
174 void colorChanged( const QColor &color );
183 QColor mCurrentColor;
191 float mExplicitHue = 0;
197 int componentRange() const;
265 QColor::Spec colorSpec() const;
276 static const QPixmap &transparentBackground();
279 void dragEnterEvent( QDragEnterEvent *e ) override;
282 void dropEvent( QDropEvent *e ) override;
284 void mouseMoveEvent( QMouseEvent *e ) override;
285 void mousePressEvent( QMouseEvent *e ) override;
286 void mouseReleaseEvent( QMouseEvent *e ) override;
288 friend class TestQgsCompoundColorWidget;
344 QMenu *mMenu =
nullptr;
348 bool mSuppressRecurse;
350 bool mDismissOnColorSelection;
362 void setColor(
const QColor &color );
388 QSize sizeHint()
const override;
389 void paintEvent( QPaintEvent *event )
override;
393 void setColor(
const QColor &color,
bool emitSignals =
false )
override;
397 void resizeEvent( QResizeEvent *event )
override;
398 void mouseMoveEvent( QMouseEvent *event )
override;
399 void mousePressEvent( QMouseEvent *event )
override;
400 void mouseReleaseEvent( QMouseEvent *event )
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 );
486 QSize sizeHint()
const override;
487 void paintEvent( QPaintEvent *event )
override;
492 void setColor(
const QColor &color,
bool emitSignals =
false )
override;
496 void resizeEvent( QResizeEvent *event )
override;
497 void mouseMoveEvent( QMouseEvent *event )
override;
498 void mousePressEvent( QMouseEvent *event )
override;
499 void mouseReleaseEvent( QMouseEvent *event )
override;
503 bool mIsDragging =
false;
506 static constexpr float mMargin = 2.;
509 QImage *mBoxImage =
nullptr;
523 float valueRangeX()
const;
529 float valueRangeY()
const;
539 float yComponentValue()
const;
549 float xComponentValue()
const;
555 void setColorFromPoint( QPoint point );
592 QSize sizeHint()
const override;
593 void paintEvent( QPaintEvent *event )
override;
600 void setOrientation( Orientation orientation );
614 void setInteriorMargin(
int margin );
628 void setShowFrame(
bool showFrame );
641 void setMarkerSize(
int markerSize );
661 void mouseMoveEvent( QMouseEvent *event )
override;
662 void wheelEvent( QWheelEvent *event )
override;
663 void mousePressEvent( QMouseEvent *event )
override;
664 void mouseReleaseEvent( QMouseEvent *event )
override;
665 void keyPressEvent( QKeyEvent *event )
override;
669 bool mIsDragging =
false;
678 bool mShowFrame =
false;
681 QPolygonF mTopTriangle;
684 QPolygonF mBottomTriangle;
690 void setColorFromPoint( QPointF point );
692 friend class TestQgsCompoundColorWidget;
716 void setComponentValueF(
float value )
override;
717 void setColor(
const QColor &color,
bool emitSignals =
false )
override;
734 float convertRealToDisplay(
float realValue )
const;
742 float convertDisplayToReal(
float displayValue )
const;
749 void rampColorChanged(
const QColor &color );
754 void spinChanged(
double value );
759 void rampChanged(
float value );
761 friend class TestQgsCompoundColorWidget;
788 Q_ENUM( ColorTextFormat )
796 void setColor(
const QColor &color,
bool emitSignals =
false )
override;
803 void setAllowOpacity(
bool allowOpacity );
806 void resizeEvent( QResizeEvent *event )
override;
810 QLineEdit *mLineEdit =
nullptr;
813 QToolButton *mMenuButton =
nullptr;
818 bool mAllowAlpha =
true;
857 void paintEvent( QPaintEvent *event )
override;
858 QSize sizeHint()
const override;
867 QColor
color2()
const {
return mColor2; }
878 virtual void setColor2(
const QColor &color );
883 void mousePressEvent( QMouseEvent *e )
override;
886 void mouseReleaseEvent( QMouseEvent *e )
override;
889 void mouseMoveEvent( QMouseEvent *e )
override;
896 QPoint mDragStartPosition;
903 void drawColor(
const QColor &color, QRect rect, QPainter &painter );
A line edit widget which displays colors as text and accepts string representations of colors.
ColorTextFormat
Specifies the display format for a color.
@ Rgb
Rgb( r, g, b ) format.
@ HexRgbA
#RRGGBBAA in hexadecimal, with alpha
@ HexRgb
#RRGGBB in hexadecimal
~QgsColorWheel() override
The QgsSpinBox is a spin box with a clear button that will set the value to the defined clear value.