mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-16 00:03:12 -04:00
Small cleanups for QgsColorRampButton
This commit is contained in:
parent
c9058eddf7
commit
968c82a30b
@ -25,11 +25,10 @@ class QgsColorRampButton : QToolButton
|
|||||||
|
|
||||||
virtual QSize sizeHint() const;
|
virtual QSize sizeHint() const;
|
||||||
|
|
||||||
/** Return the current color ramp.
|
/** Return a copy of the current color ramp.
|
||||||
* @returns currently selected color
|
* @see setColorRamp()
|
||||||
* @see setColor
|
|
||||||
*/
|
*/
|
||||||
QgsColorRamp* colorRamp() const;
|
QgsColorRamp* colorRamp() const /Factory/;
|
||||||
|
|
||||||
/** Set the title for the color ramp dialog window.
|
/** Set the title for the color ramp dialog window.
|
||||||
* @param title Title for the color ramp dialog
|
* @param title Title for the color ramp dialog
|
||||||
@ -72,18 +71,18 @@ class QgsColorRampButton : QToolButton
|
|||||||
/** Sets the default color ramp for the button, which is shown in the button's drop down menu for the
|
/** Sets the default color ramp for the button, which is shown in the button's drop down menu for the
|
||||||
* "default color ramp" option.
|
* "default color ramp" option.
|
||||||
* @param colorramp default color ramp for the button. Set to a null pointer to disable the default color
|
* @param colorramp default color ramp for the button. Set to a null pointer to disable the default color
|
||||||
* ramp option.
|
* ramp option. The ramp will be cloned and ownership is not transferred.
|
||||||
* @see defaultColorRamp
|
* @see defaultColorRamp
|
||||||
*/
|
*/
|
||||||
void setDefaultColorRamp( QgsColorRamp* colorramp );
|
void setDefaultColorRamp( QgsColorRamp* colorramp );
|
||||||
|
|
||||||
/** Returns the default color ramp for the button, which is shown in the button's drop down menu for the
|
/** Returns a copy of the default color ramp for the button, which is shown in the button's drop down menu for the
|
||||||
* "default color ramp" option.
|
* "default color ramp" option.
|
||||||
* @returns default color ramp for the button. Returns a null pointer if the default color ramp
|
* @returns default color ramp for the button. Returns a null pointer if the default color ramp
|
||||||
* option is disabled.
|
* option is disabled.
|
||||||
* @see setDefaultColorRamp
|
* @see setDefaultColorRamp
|
||||||
*/
|
*/
|
||||||
QgsColorRamp* defaultColorRamp() const;
|
QgsColorRamp* defaultColorRamp() const /Factory/;
|
||||||
|
|
||||||
/** Sets whether a random colors option is shown in the button's drop down menu.
|
/** Sets whether a random colors option is shown in the button's drop down menu.
|
||||||
* @param showNull set to true to show a null option
|
* @param showNull set to true to show a null option
|
||||||
@ -152,7 +151,7 @@ class QgsColorRampButton : QToolButton
|
|||||||
|
|
||||||
/** Sets the current color ramp for the button. Will emit a colorRampChanged() signal if the color ramp is different
|
/** Sets the current color ramp for the button. Will emit a colorRampChanged() signal if the color ramp is different
|
||||||
* to the previous color ramp.
|
* to the previous color ramp.
|
||||||
* @param colorramp New color ramp for the button
|
* @param colorramp New color ramp for the button. The ramp will be cloned and ownership is not transferred.
|
||||||
* @see setRandomColorRamp, setColorRampFromName, colorRamp
|
* @see setRandomColorRamp, setColorRampFromName, colorRamp
|
||||||
*/
|
*/
|
||||||
void setColorRamp( QgsColorRamp* colorramp );
|
void setColorRamp( QgsColorRamp* colorramp );
|
||||||
@ -168,7 +167,7 @@ class QgsColorRampButton : QToolButton
|
|||||||
* @param name Name of saved color ramp
|
* @param name Name of saved color ramp
|
||||||
* @see setColorRamp, setRandomColorRamp, colorRamp
|
* @see setColorRamp, setRandomColorRamp, colorRamp
|
||||||
*/
|
*/
|
||||||
void setColorRampFromName( QString name = QString() );
|
void setColorRampFromName( const QString& name = QString() );
|
||||||
|
|
||||||
/** Sets the background pixmap for the button based upon current color ramp.
|
/** Sets the background pixmap for the button based upon current color ramp.
|
||||||
* @param colorramp Color ramp for button background. If no color ramp is specified, the button's current
|
* @param colorramp Color ramp for button background. If no color ramp is specified, the button's current
|
||||||
|
@ -412,7 +412,7 @@ void QgsColorRampButton::setColorRamp( QgsColorRamp* colorramp )
|
|||||||
mColorRampSet = true;
|
mColorRampSet = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QgsColorRampButton::setColorRampFromName( QString name )
|
void QgsColorRampButton::setColorRampFromName( const QString& name )
|
||||||
{
|
{
|
||||||
if ( !name.isEmpty() )
|
if ( !name.isEmpty() )
|
||||||
{
|
{
|
||||||
|
@ -53,9 +53,8 @@ class GUI_EXPORT QgsColorRampButton : public QToolButton
|
|||||||
|
|
||||||
virtual QSize sizeHint() const override;
|
virtual QSize sizeHint() const override;
|
||||||
|
|
||||||
/** Return the current color ramp.
|
/** Return a copy of the current color ramp.
|
||||||
* @returns currently selected color
|
* @see setColorRamp()
|
||||||
* @see setColor
|
|
||||||
*/
|
*/
|
||||||
QgsColorRamp* colorRamp() const;
|
QgsColorRamp* colorRamp() const;
|
||||||
|
|
||||||
@ -100,18 +99,18 @@ class GUI_EXPORT QgsColorRampButton : public QToolButton
|
|||||||
/** Sets the default color ramp for the button, which is shown in the button's drop down menu for the
|
/** Sets the default color ramp for the button, which is shown in the button's drop down menu for the
|
||||||
* "default color ramp" option.
|
* "default color ramp" option.
|
||||||
* @param colorramp default color ramp for the button. Set to a null pointer to disable the default color
|
* @param colorramp default color ramp for the button. Set to a null pointer to disable the default color
|
||||||
* ramp option.
|
* ramp option. The ramp will be cloned and ownership is not transferred.
|
||||||
* @see defaultColorRamp
|
* @see defaultColorRamp
|
||||||
*/
|
*/
|
||||||
void setDefaultColorRamp( QgsColorRamp* colorramp );
|
void setDefaultColorRamp( QgsColorRamp* colorramp );
|
||||||
|
|
||||||
/** Returns the default color ramp for the button, which is shown in the button's drop down menu for the
|
/** Returns a copy of the default color ramp for the button, which is shown in the button's drop down menu for the
|
||||||
* "default color ramp" option.
|
* "default color ramp" option.
|
||||||
* @returns default color ramp for the button. Returns a null pointer if the default color ramp
|
* @returns default color ramp for the button. Returns a null pointer if the default color ramp
|
||||||
* option is disabled.
|
* option is disabled.
|
||||||
* @see setDefaultColorRamp
|
* @see setDefaultColorRamp
|
||||||
*/
|
*/
|
||||||
QgsColorRamp* defaultColorRamp() const { return mDefaultColorRamp; }
|
QgsColorRamp* defaultColorRamp() const { return mDefaultColorRamp ? mDefaultColorRamp->clone() : nullptr ; }
|
||||||
|
|
||||||
/** Sets whether a random colors option is shown in the button's drop down menu.
|
/** Sets whether a random colors option is shown in the button's drop down menu.
|
||||||
* @param showRandom set to true to show a random colors option
|
* @param showRandom set to true to show a random colors option
|
||||||
@ -180,7 +179,7 @@ class GUI_EXPORT QgsColorRampButton : public QToolButton
|
|||||||
|
|
||||||
/** Sets the current color ramp for the button. Will emit a colorRampChanged() signal if the color ramp is different
|
/** Sets the current color ramp for the button. Will emit a colorRampChanged() signal if the color ramp is different
|
||||||
* to the previous color ramp.
|
* to the previous color ramp.
|
||||||
* @param colorramp New color ramp for the button
|
* @param colorramp New color ramp for the button. The ramp will be cloned and ownership is not transferred.
|
||||||
* @see setRandomColorRamp, setColorRampFromName, colorRamp
|
* @see setRandomColorRamp, setColorRampFromName, colorRamp
|
||||||
*/
|
*/
|
||||||
void setColorRamp( QgsColorRamp* colorramp );
|
void setColorRamp( QgsColorRamp* colorramp );
|
||||||
@ -196,7 +195,7 @@ class GUI_EXPORT QgsColorRampButton : public QToolButton
|
|||||||
* @param name Name of saved color ramp
|
* @param name Name of saved color ramp
|
||||||
* @see setColorRamp, setRandomColorRamp, colorRamp
|
* @see setColorRamp, setRandomColorRamp, colorRamp
|
||||||
*/
|
*/
|
||||||
void setColorRampFromName( QString name = QString() );
|
void setColorRampFromName( const QString& name = QString() );
|
||||||
|
|
||||||
/** Sets the background pixmap for the button based upon current color ramp.
|
/** Sets the background pixmap for the button based upon current color ramp.
|
||||||
* @param colorramp Color ramp for button background. If no color ramp is specified, the button's current
|
* @param colorramp Color ramp for button background. If no color ramp is specified, the button's current
|
||||||
|
Loading…
x
Reference in New Issue
Block a user