Fix live color updating slot parameter by using SLOT macro

This commit is contained in:
Larry Shaffer 2013-03-22 10:23:29 -06:00
parent 1cecf8ee08
commit 70ef5a78b0
5 changed files with 8 additions and 10 deletions

View File

@ -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.

View File

@ -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

View File

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

View File

@ -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.

View File

@ -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