Skip to content

Commit 8c20d99

Browse files
authoredApr 17, 2017
sipify qgscolorbutton and qgscolorrampbutton (#4365)
* get rid of params to get rid of warnings
1 parent 316d9c3 commit 8c20d99

File tree

7 files changed

+542
-412
lines changed

7 files changed

+542
-412
lines changed
 

‎python/auto_sip.blacklist

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -337,8 +337,6 @@ gui/qgscodeeditorhtml.sip
337337
gui/qgscodeeditorcss.sip
338338
gui/qgscharacterselectdialog.sip
339339
gui/qgscolorbrewercolorrampdialog.sip
340-
gui/qgscolorbutton.sip
341-
gui/qgscolorrampbutton.sip
342340
gui/qgscolordialog.sip
343341
gui/qgscolorschemelist.sip
344342
gui/qgscolorswatchgrid.sip

‎python/gui/qgscolorbutton.sip

Lines changed: 308 additions & 234 deletions
Large diffs are not rendered by default.

‎python/gui/qgscolorrampbutton.sip

Lines changed: 215 additions & 157 deletions
Large diffs are not rendered by default.

‎src/gui/qgscolorbutton.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
#include <QGridLayout>
3939
#include <QPushButton>
4040

41-
QgsColorButton::QgsColorButton( QWidget *parent, const QString &cdt, QgsColorSchemeRegistry *registry )
41+
QgsColorButton::QgsColorButton( QWidget *parent SIP_TRANSFERTHIS, const QString &cdt, QgsColorSchemeRegistry *registry )
4242
: QToolButton( parent )
4343
, mBehavior( QgsColorButton::ShowDialog )
4444
, mColorDialogTitle( cdt.isEmpty() ? tr( "Select Color" ) : cdt )

‎src/gui/qgscolorbutton.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <QToolButton>
2020
#include <QTemporaryFile>
2121
#include "qgis_gui.h"
22+
#include "qgis.h"
2223

2324
class QMimeData;
2425
class QgsColorSchemeRegistry;
@@ -31,7 +32,6 @@ class QgsPanelWidget;
3132
* and pasting colors, picking colors from the screen, and selecting colors from color swatch grids.
3233
* \since QGIS 2.5
3334
*/
34-
3535
class GUI_EXPORT QgsColorButton : public QToolButton
3636
{
3737
Q_OBJECT
@@ -57,13 +57,13 @@ class GUI_EXPORT QgsColorButton : public QToolButton
5757
SignalOnly //!< Emit colorClicked signal only, no dialog
5858
};
5959

60-
/** Construct a new color button.
61-
* \param parent The parent QWidget for the dialog
62-
* \param cdt The title to show in the color chooser dialog
63-
* \param registry a color scheme registry for color swatch grids to show in the drop down menu. If not
64-
* specified, the button will use the global color scheme registry
60+
/** Construct a new color ramp button.
61+
* Use \a parent to attach a parent QWidget to the dialog.
62+
* Use \a cdt string to define the title to show in the color ramp dialog
63+
* Use a color scheme \a registry for color swatch grids to show in the drop down menu. If not specified,
64+
* the button will use the global color scheme registry instead
6565
*/
66-
QgsColorButton( QWidget *parent = nullptr, const QString &cdt = "", QgsColorSchemeRegistry *registry = nullptr );
66+
QgsColorButton( QWidget *parent SIP_TRANSFERTHIS = nullptr, const QString &cdt = "", QgsColorSchemeRegistry *registry = nullptr );
6767

6868
virtual QSize sizeHint() const override;
6969

‎src/gui/qgscolorrampbutton.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
#include <QPushButton>
3737
#include <QWidget>
3838

39-
QgsColorRampButton::QgsColorRampButton( QWidget *parent, const QString &dialogTitle )
39+
QgsColorRampButton::QgsColorRampButton( QWidget *parent SIP_TRANSFERTHIS, const QString &dialogTitle )
4040
: QToolButton( parent )
4141
, mColorRampDialogTitle( dialogTitle.isEmpty() ? tr( "Select Color Ramp" ) : dialogTitle )
4242
, mShowGradientOnly( false )

‎src/gui/qgscolorrampbutton.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
#include <QToolButton>
2424
#include "qgis_gui.h"
25+
#include "qgis.h"
2526

2627
class QgsPanelWidget;
2728

@@ -32,7 +33,6 @@ class QgsPanelWidget;
3233
* saved color ramps, as well as option to invert the current color ramp and create new ramps.
3334
* \since QGIS 3.0
3435
*/
35-
3636
class GUI_EXPORT QgsColorRampButton : public QToolButton
3737
{
3838
Q_OBJECT
@@ -45,10 +45,10 @@ class GUI_EXPORT QgsColorRampButton : public QToolButton
4545
public:
4646

4747
/** Construct a new color ramp button.
48-
* \param parent The parent QWidget for the dialog
49-
* \param dialogTitle The title to show in the color ramp dialog
48+
* Use \a parent to attach a parent QWidget to the dialog.
49+
* Use \a dialogTitle string to define the title to show in the color ramp dialog
5050
*/
51-
QgsColorRampButton( QWidget *parent = nullptr, const QString &dialogTitle = QString() );
51+
QgsColorRampButton( QWidget *parent SIP_TRANSFERTHIS = nullptr, const QString &dialogTitle = QString() );
5252

5353
virtual ~QgsColorRampButton();
5454

@@ -57,7 +57,7 @@ class GUI_EXPORT QgsColorRampButton : public QToolButton
5757
/** Return a copy of the current color ramp.
5858
* \see setColorRamp()
5959
*/
60-
QgsColorRamp *colorRamp() const;
60+
QgsColorRamp *colorRamp() const SIP_FACTORY;
6161

6262
/** Set the title for the color ramp dialog window.
6363
* \param title Title for the color ramp dialog
@@ -111,7 +111,7 @@ class GUI_EXPORT QgsColorRampButton : public QToolButton
111111
* option is disabled.
112112
* \see setDefaultColorRamp
113113
*/
114-
QgsColorRamp *defaultColorRamp() const { return mDefaultColorRamp ? mDefaultColorRamp->clone() : nullptr ; }
114+
QgsColorRamp *defaultColorRamp() const SIP_FACTORY { return mDefaultColorRamp ? mDefaultColorRamp->clone() : nullptr ; }
115115

116116
/** Sets whether a random colors option is shown in the button's drop down menu.
117117
* \param showRandom set to true to show a random colors option
@@ -227,17 +227,17 @@ class GUI_EXPORT QgsColorRampButton : public QToolButton
227227
*/
228228
void setToNull();
229229

230-
private slots:
231-
232-
void rampWidgetUpdated();
233-
234230
signals:
235231

236232
/** Emitted whenever a new color ramp is set for the button. The color ramp is always valid.
237233
* In case the new color ramp is the same, no signal is emitted to avoid infinite loops.
238234
*/
239235
void colorRampChanged();
240236

237+
private slots:
238+
239+
void rampWidgetUpdated();
240+
241241
protected:
242242

243243
bool event( QEvent *e ) override;

0 commit comments

Comments
 (0)
Please sign in to comment.