16#ifndef QGSCOLORWIDGETS_H
17#define QGSCOLORWIDGETS_H
19#include <QWidgetAction>
71 Q_ENUM( ComponentUnit )
112 float componentValueF() const;
118 static QPixmap createDragIcon( const QColor &color );
123 static ComponentUnit componentUnit( ColorComponent component );
134 virtual
void setColor( const QColor &color,
bool emitSignals = false );
141 virtual
void setComponent(
QgsColorWidget::ColorComponent component );
153 Q_DECL_DEPRECATED virtual
void setComponentValue(
int value )
SIP_DEPRECATED;
165 virtual
void setComponentValueF(
float value );
173 void colorChanged( const QColor &color );
181 QColor mCurrentColor;
189 float mExplicitHue = 0;
195 int componentRange() const;
263 QColor::Spec colorSpec() const;
274 static const QPixmap &transparentBackground();
277 void dragEnterEvent( QDragEnterEvent *e ) override;
280 void dropEvent( QDropEvent *e ) override;
282 void mouseMoveEvent( QMouseEvent *e ) override;
283 void mousePressEvent( QMouseEvent *e ) override;
284 void mouseReleaseEvent( QMouseEvent *e ) override;
286 friend class TestQgsCompoundColorWidget;
341 QMenu *mMenu =
nullptr;
345 bool mSuppressRecurse;
347 bool mDismissOnColorSelection;
359 void setColor(
const QColor &color );
383 QSize sizeHint()
const override;
384 void paintEvent( QPaintEvent *event )
override;
388 void setColor(
const QColor &color,
bool emitSignals =
false )
override;
391 void resizeEvent( QResizeEvent *event )
override;
392 void mouseMoveEvent( QMouseEvent *event )
override;
393 void mousePressEvent( QMouseEvent *event )
override;
394 void mouseReleaseEvent( QMouseEvent *event )
override;
404 bool mIsDragging =
false;
410 int mWheelThickness = 18;
413 ControlPart mClickedPart = QgsColorWheel::None;
419 QImage mTriangleImage;
425 bool mWheelDirty =
true;
428 bool mTriangleDirty =
true;
437 void createImages( QSizeF size );
443 void createTriangle();
449 void setColorFromPos( QPointF pos );
477 QSize sizeHint()
const override;
478 void paintEvent( QPaintEvent *event )
override;
483 void setColor(
const QColor &color,
bool emitSignals =
false )
override;
486 void resizeEvent( QResizeEvent *event )
override;
487 void mouseMoveEvent( QMouseEvent *event )
override;
488 void mousePressEvent( QMouseEvent *event )
override;
489 void mouseReleaseEvent( QMouseEvent *event )
override;
492 bool mIsDragging =
false;
495 static constexpr float mMargin = 2.;
498 QImage *mBoxImage =
nullptr;
512 float valueRangeX()
const;
518 float valueRangeY()
const;
528 float yComponentValue()
const;
538 float xComponentValue()
const;
544 void setColorFromPoint( QPoint point );
577 QSize sizeHint()
const override;
578 void paintEvent( QPaintEvent *event )
override;
585 void setOrientation( Orientation orientation );
599 void setInteriorMargin(
int margin );
613 void setShowFrame(
bool showFrame );
626 void setMarkerSize(
int markerSize );
645 void mouseMoveEvent( QMouseEvent *event )
override;
646 void wheelEvent( QWheelEvent *event )
override;
647 void mousePressEvent( QMouseEvent *event )
override;
648 void mouseReleaseEvent( QMouseEvent *event )
override;
649 void keyPressEvent( QKeyEvent *event )
override;
652 bool mIsDragging =
false;
661 bool mShowFrame =
false;
664 QPolygonF mTopTriangle;
667 QPolygonF mBottomTriangle;
673 void setColorFromPoint( QPointF point );
675 friend class TestQgsCompoundColorWidget;
698 void setComponentValueF(
float value )
override;
699 void setColor(
const QColor &color,
bool emitSignals =
false )
override;
715 float convertRealToDisplay(
float realValue )
const;
723 float convertDisplayToReal(
float displayValue )
const;
730 void rampColorChanged(
const QColor &color );
735 void spinChanged(
double value );
740 void rampChanged(
float value );
742 friend class TestQgsCompoundColorWidget;
768 Q_ENUM( ColorTextFormat )
776 void setColor(
const QColor &color,
bool emitSignals =
false )
override;
783 void setAllowOpacity(
bool allowOpacity );
786 void resizeEvent( QResizeEvent *event )
override;
789 QLineEdit *mLineEdit =
nullptr;
792 QToolButton *mMenuButton =
nullptr;
797 bool mAllowAlpha =
true;
835 void paintEvent( QPaintEvent *event )
override;
836 QSize sizeHint()
const override;
845 QColor
color2()
const {
return mColor2; }
856 virtual void setColor2(
const QColor &color );
860 void mousePressEvent( QMouseEvent *e )
override;
863 void mouseReleaseEvent( QMouseEvent *e )
override;
866 void mouseMoveEvent( QMouseEvent *e )
override;
872 QPoint mDragStartPosition;
879 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.