Skip to content

Commit

Permalink
Fix live color updating slot parameter by using SLOT macro
Browse files Browse the repository at this point in the history
  • Loading branch information
dakcarto committed Mar 22, 2013
1 parent 1cecf8e commit 70ef5a7
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion python/gui/qgscolordialog.sip
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/gui/qgscolorbutton.cpp
Expand Up @@ -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
Expand Down
8 changes: 2 additions & 6 deletions src/gui/qgscolordialog.cpp
Expand Up @@ -16,7 +16,6 @@

#include "qgscolordialog.h"

#include <QMetaObject>

QgsColorDialog::QgsColorDialog()
{
Expand All @@ -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() )
{
Expand Down
2 changes: 1 addition & 1 deletion src/gui/qgscolordialog.h
Expand Up @@ -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.
Expand Down
4 changes: 3 additions & 1 deletion src/gui/symbology-ng/qgsvectorgradientcolorrampv2dialog.cpp
Expand Up @@ -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<QColor>(), this, "setItemStopColor( const QColor& )", this );
color = QgsColorDialog::getLiveColor(
item->data( 0, StopColorRole ).value<QColor>(),
this, SLOT( setItemStopColor( const QColor& ) ), this );
mCurrentItem = 0;
}
else
Expand Down

0 comments on commit 70ef5a7

Please sign in to comment.