From 70ef5a78b0ed9d632c32adfeacac642bfdc8565c Mon Sep 17 00:00:00 2001 From: Larry Shaffer Date: Fri, 22 Mar 2013 10:23:29 -0600 Subject: [PATCH] Fix live color updating slot parameter by using SLOT macro --- python/gui/qgscolordialog.sip | 2 +- src/gui/qgscolorbutton.cpp | 2 +- src/gui/qgscolordialog.cpp | 8 ++------ src/gui/qgscolordialog.h | 2 +- .../symbology-ng/qgsvectorgradientcolorrampv2dialog.cpp | 4 +++- 5 files changed, 8 insertions(+), 10 deletions(-) diff --git a/python/gui/qgscolordialog.sip b/python/gui/qgscolordialog.sip index 7e5c324ed4e..880b30f5447 100644 --- a/python/gui/qgscolordialog.sip +++ b/python/gui/qgscolordialog.sip @@ -16,7 +16,7 @@ class QgsColorDialog : QObject /** Return a color selection from a QColorDialog, with live updating of interim selections. * @param initialColor The initial color of the selection dialog. * @param updateObject The receiver object of the live updating. - * @param updateSlot The receiver object's slot for live updating (e.g. "setColor( const QColor& )" ). + * @param updateSlot The receiver object's slot for live updating (e.g. SLOT( setValidColor( const QColor& ) ) ). * @param parent Parent widget. Usually 0 is best for native system color dialogs. * @param title The title of the QColorDialog. * @param options ColorDialogOptions passed to QColorDialog. diff --git a/src/gui/qgscolorbutton.cpp b/src/gui/qgscolorbutton.cpp index 646b1662954..684bec82c80 100644 --- a/src/gui/qgscolorbutton.cpp +++ b/src/gui/qgscolorbutton.cpp @@ -73,7 +73,7 @@ void QgsColorButton::onButtonClicked() if ( mAcceptLiveUpdates && settings.value( "/qgis/live_color_dialogs", false ).toBool() ) { newColor = QgsColorDialog::getLiveColor( - color(), this, "setValidColor( const QColor& )", + color(), this, SLOT( setValidColor( const QColor& ) ), this->parentWidget(), mColorDialogTitle, mColorDialogOptions ); } else diff --git a/src/gui/qgscolordialog.cpp b/src/gui/qgscolordialog.cpp index 055e9a3937e..c0d4fb727b4 100644 --- a/src/gui/qgscolordialog.cpp +++ b/src/gui/qgscolordialog.cpp @@ -16,7 +16,6 @@ #include "qgscolordialog.h" -#include QgsColorDialog::QgsColorDialog() { @@ -35,12 +34,9 @@ QColor QgsColorDialog::getLiveColor( const QColor& initialColor, QObject* update QColorDialog* liveDialog = new QColorDialog( initialColor, parent ); liveDialog->setWindowTitle( title.isEmpty() ? tr( "Select Color" ) : title ); liveDialog->setOptions( options ); -#ifdef Q_WS_MAC - // always use native color dialog on Mac - liveDialog->setOption( QColorDialog::DontUseNativeDialog, false ); -#endif + connect( liveDialog, SIGNAL( currentColorChanged( const QColor& ) ), - updateObject, QString( "1%1" ).arg( QString( QMetaObject::normalizedSignature( updateSlot ) ) ).toAscii() ); + updateObject, updateSlot ); if ( liveDialog->exec() ) { diff --git a/src/gui/qgscolordialog.h b/src/gui/qgscolordialog.h index f49c1430848..6ac680315a0 100644 --- a/src/gui/qgscolordialog.h +++ b/src/gui/qgscolordialog.h @@ -38,7 +38,7 @@ class GUI_EXPORT QgsColorDialog : public QObject /** Return a color selection from a QColorDialog, with live updating of interim selections. * @param initialColor The initial color of the selection dialog. * @param updateObject The receiver object of the live updating. - * @param updateSlot The receiver object's slot for live updating (e.g. "setColor( const QColor& )" ). + * @param updateSlot The receiver object's slot for live updating (e.g. SLOT( setValidColor( const QColor& ) ) ). * @param parent Parent widget. Usually 0 is best for native system color dialogs. * @param title The title of the QColorDialog. * @param options ColorDialogOptions passed to QColorDialog. diff --git a/src/gui/symbology-ng/qgsvectorgradientcolorrampv2dialog.cpp b/src/gui/symbology-ng/qgsvectorgradientcolorrampv2dialog.cpp index 96a725ddac2..e6eb346778d 100644 --- a/src/gui/symbology-ng/qgsvectorgradientcolorrampv2dialog.cpp +++ b/src/gui/symbology-ng/qgsvectorgradientcolorrampv2dialog.cpp @@ -264,7 +264,9 @@ void QgsVectorGradientColorRampV2Dialog::stopDoubleClicked( QTreeWidgetItem* ite if ( settings.value( "/qgis/live_color_dialogs", false ).toBool() ) { mCurrentItem = item; - color = QgsColorDialog::getLiveColor( item->data( 0, StopColorRole ).value(), this, "setItemStopColor( const QColor& )", this ); + color = QgsColorDialog::getLiveColor( + item->data( 0, StopColorRole ).value(), + this, SLOT( setItemStopColor( const QColor& ) ), this ); mCurrentItem = 0; } else