15 #ifndef QGSCOLORRAMPBUTTON_H 16 #define QGSCOLORRAMPBUTTON_H 23 #include <QToolButton> 40 Q_PROPERTY( QString colorRampDialogTitle READ colorRampDialogTitle WRITE setColorRampDialogTitle )
41 Q_PROPERTY(
bool acceptLiveUpdates READ acceptLiveUpdates WRITE setAcceptLiveUpdates )
42 Q_PROPERTY(
bool showMenu READ showMenu WRITE setShowMenu )
43 Q_PROPERTY(
QgsColorRamp *defaultColorRamp READ defaultColorRamp WRITE setDefaultColorRamp )
44 Q_PROPERTY( QString context READ context WRITE setContext )
57 QSize sizeHint() const override;
70 void setColorRampDialogTitle( const QString &title );
77 QString colorRampDialogTitle() const;
84 bool acceptLiveUpdates()
const {
return mAcceptLiveUpdates; }
100 void setShowMenu(
const bool showMenu );
107 bool showMenu()
const {
return menu() ? true :
false; }
145 bool isRandomColorRamp()
const;
153 void setShowNull(
bool showNull );
160 bool showNull()
const;
176 void setContext(
const QString &context ) { mContext = context; }
228 void setRandomColorRamp();
236 void setColorRampFromName(
const QString &name = QString() );
243 void setButtonBackground(
QgsColorRamp *colorramp =
nullptr );
251 void setToDefaultColorRamp();
265 void colorRampChanged();
269 void rampWidgetUpdated();
273 bool event( QEvent *e )
override;
274 void changeEvent( QEvent *e )
override;
275 void showEvent( QShowEvent *e )
override;
276 void resizeEvent( QResizeEvent *event )
override;
281 void mousePressEvent( QMouseEvent *e )
override;
285 QString mColorRampDialogTitle;
286 bool mShowGradientOnly =
false;
288 QString mColorRampName;
293 bool mAcceptLiveUpdates =
true;
294 bool mColorRampSet =
false;
295 bool mShowRandomColorRamp =
false;
296 bool mShowNull =
false;
298 QMenu *mMenu =
nullptr;
299 QMenu *mAllRampsMenu =
nullptr;
311 void buttonClicked();
316 void showColorRampDialog();
321 void createColorRamp();
326 void saveColorRamp();
331 void invertColorRamp();
336 void loadColorRamp();
Abstract base class for color ramps.