Skip to content
Permalink
Browse files

Cleanup misleading QgsEditorWidgetWrapper::valueChanged signals

  • Loading branch information
m-kuhn committed Jan 5, 2018
1 parent d5074df commit 46177aa151acad18981f5b563d4174ca1676d960
@@ -258,59 +258,7 @@ to reflect the new value.
:param value: The new value of the attribute
%End

void valueChanged( const QString &value );
%Docstring
If you emit to this slot in your implementation, an appropriate change notification
will be broadcasted. Helper for string type widgets.

:param value: The value
%End

void valueChanged( int value ) /PyName=valueChangedInt/;
%Docstring
If you emit to this slot in your implementation, an appropriate change notification
will be broadcasted. Helper for int type widgets.

:param value: The value

.. note::

Python name valueChangedInt
%End

void valueChanged( double value ) /PyName=valueChangedDouble/;
%Docstring
If you emit to this slot in your implementation, an appropriate change notification
will be broadcasted. Helper for double type widgets.

:param value: The value

.. note::

Python name valueChangedDouble
%End

void valueChanged( bool value ) /PyName=valueChangedBool/;
%Docstring
If you emit to this slot in your implementation, an appropriate change notification
will be broadcasted. Helper for bool type widgets.

:param value: The value

.. note::

Python name valueChangedBool
%End

void valueChanged( qlonglong value );
%Docstring
If you emit to this slot in your implementation, an appropriate change notification
will be broadcasted. Helper for longlong type widgets.

:param value: The value
%End

void valueChanged();
void emitValueChanged();
%Docstring
Will call the value() method to determine the emitted value
%End
@@ -72,32 +72,7 @@ void QgsEditorWidgetWrapper::setFeature( const QgsFeature &feature )
setValue( feature.attribute( mFieldIdx ) );
}

void QgsEditorWidgetWrapper::valueChanged( const QString &value )
{
emit valueChanged( QVariant( value ) );
}

void QgsEditorWidgetWrapper::valueChanged( int value )
{
emit valueChanged( QVariant( value ) );
}

void QgsEditorWidgetWrapper::valueChanged( double value )
{
emit valueChanged( QVariant( value ) );
}

void QgsEditorWidgetWrapper::valueChanged( bool value )
{
emit valueChanged( QVariant( value ) );
}

void QgsEditorWidgetWrapper::valueChanged( qlonglong value )
{
emit valueChanged( QVariant( value ) );
}

void QgsEditorWidgetWrapper::valueChanged()
void QgsEditorWidgetWrapper::emitValueChanged()
{
emit valueChanged( value() );
}
@@ -256,65 +256,10 @@ class GUI_EXPORT QgsEditorWidgetWrapper : public QgsWidgetWrapper
*/
virtual void setValue( const QVariant &value ) = 0;

/**
* If you emit to this slot in your implementation, an appropriate change notification
* will be broadcasted. Helper for string type widgets.
*
* \param value The value
*/
void valueChanged( const QString &value );

/**
* If you emit to this slot in your implementation, an appropriate change notification
* will be broadcasted. Helper for int type widgets.
*
* \param value The value
* \note Python name valueChangedInt
*/
#ifndef SIP_RUN
void valueChanged( int value );
#else
void valueChanged( int value ) SIP_PYNAME( valueChangedInt );
#endif

/**
* If you emit to this slot in your implementation, an appropriate change notification
* will be broadcasted. Helper for double type widgets.
*
* \param value The value
* \note Python name valueChangedDouble
*/
#ifndef SIP_RUN
void valueChanged( double value );
#else
void valueChanged( double value ) SIP_PYNAME( valueChangedDouble );
#endif

/**
* If you emit to this slot in your implementation, an appropriate change notification
* will be broadcasted. Helper for bool type widgets.
*
* \param value The value
* \note Python name valueChangedBool
*/
#ifndef SIP_RUN
void valueChanged( bool value );
#else
void valueChanged( bool value ) SIP_PYNAME( valueChangedBool );
#endif

/**
* If you emit to this slot in your implementation, an appropriate change notification
* will be broadcasted. Helper for longlong type widgets.
*
* \param value The value
*/
void valueChanged( qlonglong value );

/**
* Will call the value() method to determine the emitted value
*/
void valueChanged();
void emitValueChanged();

protected:

@@ -64,9 +64,9 @@ void QgsCheckboxWidgetWrapper::initWidget( QWidget *editor )
mGroupBox = qobject_cast<QGroupBox *>( editor );

if ( mCheckBox )
connect( mCheckBox, &QAbstractButton::toggled, this, static_cast<void ( QgsEditorWidgetWrapper::* )( bool )>( &QgsEditorWidgetWrapper::valueChanged ) );
connect( mCheckBox, &QAbstractButton::toggled, this, [ = ]( bool state ) { emit valueChanged( state ); } );
if ( mGroupBox )
connect( mGroupBox, &QGroupBox::toggled, this, static_cast<void ( QgsEditorWidgetWrapper::* )( bool )>( &QgsEditorWidgetWrapper::valueChanged ) );
connect( mGroupBox, &QGroupBox::toggled, this, [ = ]( bool state ) { emit valueChanged( state ); } );
}

bool QgsCheckboxWidgetWrapper::valid() const
@@ -61,7 +61,7 @@ void QgsClassificationWidgetWrapper::initWidget( QWidget *editor )
}

connect( mComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ),
this, static_cast<void ( QgsEditorWidgetWrapper::* )()>( &QgsEditorWidgetWrapper::valueChanged ) );
this, static_cast<void ( QgsEditorWidgetWrapper::* )()>( &QgsEditorWidgetWrapper::emitValueChanged ) );
}
}

@@ -66,7 +66,7 @@ void QgsColorWidgetWrapper::initWidget( QWidget *editor )
}

mColorButton->setShowNull( true );
connect( mColorButton, &QgsColorButton::colorChanged, this, static_cast<void ( QgsEditorWidgetWrapper::* )()>( &QgsEditorWidgetWrapper::valueChanged ) );
connect( mColorButton, &QgsColorButton::colorChanged, this, static_cast<void ( QgsEditorWidgetWrapper::* )()>( &QgsEditorWidgetWrapper::emitValueChanged ) );
}

bool QgsColorWidgetWrapper::valid() const
@@ -62,7 +62,7 @@ void QgsEnumerationWidgetWrapper::initWidget( QWidget *editor )
mComboBox->addItem( s, s );
}
connect( mComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ),
this, static_cast<void ( QgsEditorWidgetWrapper::* )()>( &QgsEditorWidgetWrapper::valueChanged ) );
this, static_cast<void ( QgsEditorWidgetWrapper::* )()>( &QgsEditorWidgetWrapper::emitValueChanged ) );
}
}

@@ -186,7 +186,7 @@ void QgsExternalResourceWidgetWrapper::initWidget( QWidget *editor )
}

if ( mLineEdit )
connect( mLineEdit, &QLineEdit::textChanged, this, static_cast<void ( QgsEditorWidgetWrapper::* )( const QString & )>( &QgsEditorWidgetWrapper::valueChanged ) );
connect( mLineEdit, &QLineEdit::textChanged, this, [ = ]( const QString & value ) { emit valueChanged( value ); } );

}

@@ -120,7 +120,7 @@ void QgsRangeWidgetWrapper::initWidget( QWidget *editor )
mDoubleSpinBox->setSuffix( config( QStringLiteral( "Suffix" ) ).toString() );

connect( mDoubleSpinBox, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ),
this, static_cast < void ( QgsEditorWidgetWrapper::* )( double ) > ( &QgsEditorWidgetWrapper::valueChanged ) );
this, [ = ]( double value ) { emit valueChanged( value ); } );
}
else if ( mIntSpinBox )
{
@@ -105,10 +105,10 @@ void QgsTextEditWrapper::initWidget( QWidget *editor )
mLineEdit = qobject_cast<QLineEdit *>( editor );

if ( mTextEdit )
connect( mTextEdit, &QTextEdit::textChanged, this, static_cast<void ( QgsEditorWidgetWrapper::* )()>( &QgsEditorWidgetWrapper::valueChanged ) );
connect( mTextEdit, &QTextEdit::textChanged, this, &QgsEditorWidgetWrapper::emitValueChanged );

if ( mPlainTextEdit )
connect( mPlainTextEdit, &QPlainTextEdit::textChanged, this, static_cast<void ( QgsEditorWidgetWrapper::* )()>( &QgsEditorWidgetWrapper::valueChanged ) );
connect( mPlainTextEdit, &QPlainTextEdit::textChanged, this, &QgsEditorWidgetWrapper::emitValueChanged );

if ( mLineEdit )
{
@@ -131,7 +131,7 @@ void QgsTextEditWrapper::initWidget( QWidget *editor )
fle->setNullValue( defVal.toString() );
}

connect( mLineEdit, &QLineEdit::textChanged, this, static_cast<void ( QgsEditorWidgetWrapper::* )( const QString & )>( &QgsEditorWidgetWrapper::valueChanged ) );
connect( mLineEdit, &QLineEdit::textChanged, this, [ = ]( const QString & value ) { emit valueChanged( value ); } );
connect( mLineEdit, &QLineEdit::textChanged, this, &QgsTextEditWrapper::textChanged );

mWritablePalette = mLineEdit->palette();
@@ -88,14 +88,13 @@ void QgsUniqueValuesWidgetWrapper::initWidget( QWidget *editor )
c->setCompletionMode( QCompleter::PopupCompletion );
mLineEdit->setCompleter( c );

connect( mLineEdit, &QLineEdit::textChanged, this,
static_cast<void ( QgsEditorWidgetWrapper::* )( const QString & )>( &QgsEditorWidgetWrapper::valueChanged ) );
connect( mLineEdit, &QLineEdit::textChanged, this, [ = ]( const QString & value ) { emit valueChanged( value ); } );
}

if ( mComboBox )
{
connect( mComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ),
this, static_cast<void ( QgsEditorWidgetWrapper::* )()>( &QgsEditorWidgetWrapper::valueChanged ) );
this, static_cast<void ( QgsEditorWidgetWrapper::* )()>( &QgsEditorWidgetWrapper::emitValueChanged ) );
}
}

@@ -62,7 +62,7 @@ void QgsUuidWidgetWrapper::setValue( const QVariant &value )
if ( mLabel )
mLabel->setText( QUuid::createUuid().toString() );

valueChanged();
emitValueChanged();
}
else
{
@@ -67,7 +67,7 @@ void QgsValueMapWidgetWrapper::initWidget( QWidget *editor )
++it;
}
connect( mComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ),
this, static_cast<void ( QgsEditorWidgetWrapper::* )()>( &QgsEditorWidgetWrapper::valueChanged ) );
this, static_cast<void ( QgsEditorWidgetWrapper::* )()>( &QgsEditorWidgetWrapper::emitValueChanged ) );
}
}

@@ -110,7 +110,7 @@ void QgsValueRelationWidgetWrapper::initWidget( QWidget *editor )
}

connect( mComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ),
this, static_cast<void ( QgsEditorWidgetWrapper::* )()>( &QgsEditorWidgetWrapper::valueChanged ) );
this, static_cast<void ( QgsEditorWidgetWrapper::* )()>( &QgsEditorWidgetWrapper::emitValueChanged ) );
}
else if ( mListWidget )
{
@@ -122,7 +122,7 @@ void QgsValueRelationWidgetWrapper::initWidget( QWidget *editor )

mListWidget->addItem( item );
}
connect( mListWidget, &QListWidget::itemChanged, this, static_cast<void ( QgsEditorWidgetWrapper::* )()>( &QgsEditorWidgetWrapper::valueChanged ) );
connect( mListWidget, &QListWidget::itemChanged, this, static_cast<void ( QgsEditorWidgetWrapper::* )()>( &QgsEditorWidgetWrapper::emitValueChanged ) );
}
else if ( mLineEdit )
{
@@ -138,7 +138,7 @@ void QgsValueRelationWidgetWrapper::initWidget( QWidget *editor )
completer->setCaseSensitivity( Qt::CaseInsensitive );
mLineEdit->setCompleter( completer );

connect( mLineEdit, &QLineEdit::textChanged, this, static_cast<void ( QgsEditorWidgetWrapper::* )()>( &QgsEditorWidgetWrapper::valueChanged ) );
connect( mLineEdit, &QLineEdit::textChanged, this, [ = ]( const QString & value ) { emit valueChanged( value ); } );
}
}

0 comments on commit 46177aa

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