15 #ifndef QGSCOLORRAMPBUTTON_H
16 #define QGSCOLORRAMPBUTTON_H
21 #include <QToolButton>
39 Q_PROPERTY( QString colorRampDialogTitle READ colorRampDialogTitle WRITE setColorRampDialogTitle )
40 Q_PROPERTY(
bool acceptLiveUpdates READ acceptLiveUpdates WRITE setAcceptLiveUpdates )
41 Q_PROPERTY(
bool showMenu READ showMenu WRITE setShowMenu )
42 Q_PROPERTY(
QgsColorRamp *defaultColorRamp READ defaultColorRamp WRITE setDefaultColorRamp )
43 Q_PROPERTY( QString context READ context WRITE setContext )
56 QSize sizeHint()
const override;
69 void setColorRampDialogTitle( const QString &title );
76 QString colorRampDialogTitle() const;
83 bool acceptLiveUpdates()
const {
return mAcceptLiveUpdates; }
99 void setShowMenu(
bool showMenu );
106 bool showMenu()
const;
131 void setShowRandomColorRamp(
bool showRandom ) { mShowRandomColorRamp = showRandom; }
144 bool isRandomColorRamp()
const;
152 void setShowNull(
bool showNull );
159 bool showNull()
const;
175 void setContext(
const QString &context ) { mContext = context; }
227 void setRandomColorRamp();
235 void setColorRampFromName(
const QString &name = QString() );
242 void setButtonBackground(
QgsColorRamp *colorramp =
nullptr );
250 void setToDefaultColorRamp();
268 void rampWidgetUpdated();
272 bool event( QEvent *e )
override;
273 void changeEvent( QEvent *e )
override;
274 void showEvent( QShowEvent *e )
override;
275 void resizeEvent( QResizeEvent *event )
override;
280 void mousePressEvent( QMouseEvent *e )
override;
284 QString mColorRampDialogTitle;
285 bool mShowGradientOnly =
false;
286 std::unique_ptr< QgsColorRamp > mColorRamp;
287 QString mColorRampName;
290 std::unique_ptr< QgsColorRamp > mDefaultColorRamp;
292 bool mAcceptLiveUpdates =
true;
293 bool mShowRandomColorRamp =
false;
294 bool mShowNull =
false;
296 QMenu *mMenu =
nullptr;
297 QMenu *mAllRampsMenu =
nullptr;
309 void buttonClicked();
314 void showColorRampDialog();
319 void createColorRamp();
324 void saveColorRamp();
329 void invertColorRamp();
334 void loadColorRamp();
Abstract base class for color ramps.