Skip to content
Permalink
Browse files

Fix live color updating slot parameter by using SLOT macro

  • Loading branch information
dakcarto committed Mar 22, 2013
1 parent 1cecf8e commit 70ef5a78b0ed9d632c32adfeacac642bfdc8565c
@@ -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.
@@ -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
@@ -16,7 +16,6 @@

#include "qgscolordialog.h"

#include <QMetaObject>

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() )
{
@@ -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.
@@ -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

0 comments on commit 70ef5a7

Please sign in to comment.
You can’t perform that action at this time.