Skip to content

Commit

Permalink
Fix naming collision
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Mar 13, 2019
1 parent 32fbf0a commit 46e3304
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 24 deletions.
8 changes: 4 additions & 4 deletions python/gui/auto_generated/qgsscalecombobox.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Returns true if the combo box is currently set to a "null" value.

.. seealso:: :py:func:`setAllowNull`

.. seealso:: :py:func:`clear`
.. seealso:: :py:func:`setNull`

.. versionadded:: 3.8
%End
Expand Down Expand Up @@ -94,7 +94,7 @@ Sets whether the scale combobox can be set to a NULL value.

.. seealso:: :py:func:`isNull`

.. seealso:: :py:func:`clear`
.. seealso:: :py:func:`setNull`

.. versionadded:: 3.8
%End
Expand All @@ -107,7 +107,7 @@ Returns ``True`` if the combobox can be set to a NULL value.

.. seealso:: :py:func:`isNull`

.. seealso:: :py:func:`clear`
.. seealso:: :py:func:`setNull`

.. versionadded:: 3.8
%End
Expand Down Expand Up @@ -144,7 +144,7 @@ Any scale lower than the minimum scale will automatically be converted to the mi
Except for 0 which is always allowed.
%End

void clear();
void setNull();
%Docstring
Sets the combo box to the null value.

Expand Down
8 changes: 4 additions & 4 deletions python/gui/auto_generated/qgsscalewidget.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ Returns true if the widget is currently set to a "null" value.

.. seealso:: :py:func:`setAllowNull`

.. seealso:: :py:func:`clear`
.. seealso:: :py:func:`setNull`

.. versionadded:: 3.8
%End
Expand Down Expand Up @@ -122,7 +122,7 @@ Sets whether the scale widget can be set to a NULL value.

.. seealso:: :py:func:`isNull`

.. seealso:: :py:func:`clear`
.. seealso:: :py:func:`setNull`

.. versionadded:: 3.8
%End
Expand All @@ -135,7 +135,7 @@ Returns ``True`` if the widget can be set to a NULL value.

.. seealso:: :py:func:`isNull`

.. seealso:: :py:func:`clear`
.. seealso:: :py:func:`setNull`

.. versionadded:: 3.8
%End
Expand Down Expand Up @@ -171,7 +171,7 @@ Any scale lower than the minimum scale will automatically be converted to the mi
Except for 0 which is always allowed.
%End

void clear();
void setNull();
%Docstring
Sets the widget to the null value.

Expand Down
2 changes: 1 addition & 1 deletion src/gui/processing/qgsprocessingwidgetwrapperimpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -966,7 +966,7 @@ void QgsProcessingScaleWidgetWrapper::setWidgetValue( const QVariant &value, Qgs
if ( mScaleWidget )
{
if ( mScaleWidget->allowNull() && !value.isValid() )
mScaleWidget->clear();
mScaleWidget->setNull();
else
{
const double v = QgsProcessingParameters::parameterAsDouble( parameterDefinition(), value, context );
Expand Down
2 changes: 1 addition & 1 deletion src/gui/qgsscalecombobox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ void QgsScaleComboBox::setMinScale( double scale )
}
}

void QgsScaleComboBox::clear()
void QgsScaleComboBox::setNull()
{
if ( allowNull() )
setScale( std::numeric_limits< double >::quiet_NaN() );
Expand Down
8 changes: 4 additions & 4 deletions src/gui/qgsscalecombobox.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class GUI_EXPORT QgsScaleComboBox : public QComboBox
* Returns true if the combo box is currently set to a "null" value.
*
* \see setAllowNull()
* \see clear()
* \see setNull()
* \since QGIS 3.8
*/
bool isNull() const;
Expand Down Expand Up @@ -97,7 +97,7 @@ class GUI_EXPORT QgsScaleComboBox : public QComboBox
* Sets whether the scale combobox can be set to a NULL value.
* \see allowNull()
* \see isNull()
* \see clear()
* \see setNull()
* \since QGIS 3.8
*/
void setAllowNull( bool allowNull );
Expand All @@ -106,7 +106,7 @@ class GUI_EXPORT QgsScaleComboBox : public QComboBox
* Returns TRUE if the combobox can be set to a NULL value.
* \see setAllowNull()
* \see isNull()
* \see clear()
* \see setNull()
* \since QGIS 3.8
*/
bool allowNull() const;
Expand Down Expand Up @@ -151,7 +151,7 @@ class GUI_EXPORT QgsScaleComboBox : public QComboBox
* \see isNull()
* \since QGIS 3.8
*/
void clear();
void setNull();

protected:
void showPopup() override;
Expand Down
4 changes: 2 additions & 2 deletions src/gui/qgsscalewidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ void QgsScaleWidget::setScaleFromCanvas()
setScale( mCanvas->scale() );
}

void QgsScaleWidget::clear()
void QgsScaleWidget::setNull()
{
mScaleComboBox->clear();
mScaleComboBox->setNull();
}

void QgsScaleWidget::setScale( double scale )
Expand Down
8 changes: 4 additions & 4 deletions src/gui/qgsscalewidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class GUI_EXPORT QgsScaleWidget : public QWidget
* Returns true if the widget is currently set to a "null" value.
*
* \see setAllowNull()
* \see clear()
* \see setNull()
* \since QGIS 3.8
*/
bool isNull() const;
Expand Down Expand Up @@ -122,7 +122,7 @@ class GUI_EXPORT QgsScaleWidget : public QWidget
* Sets whether the scale widget can be set to a NULL value.
* \see allowNull()
* \see isNull()
* \see clear()
* \see setNull()
* \since QGIS 3.8
*/
void setAllowNull( bool allowNull );
Expand All @@ -131,7 +131,7 @@ class GUI_EXPORT QgsScaleWidget : public QWidget
* Returns TRUE if the widget can be set to a NULL value.
* \see setAllowNull()
* \see isNull()
* \see clear()
* \see setNull()
* \since QGIS 3.8
*/
bool allowNull() const;
Expand Down Expand Up @@ -174,7 +174,7 @@ class GUI_EXPORT QgsScaleWidget : public QWidget
* \see isNull()
* \since QGIS 3.8
*/
void clear();
void setNull();

signals:

Expand Down
4 changes: 2 additions & 2 deletions tests/src/gui/testqgsscalecombobox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ void TestQgsScaleComboBox::allowNull()
{
s->setScale( 50 );
QVERIFY( !s->allowNull() );
s->clear(); // no effect
s->setNull(); // no effect
QCOMPARE( s->scale(), 50.0 );
QVERIFY( !s->isNull() );

Expand Down Expand Up @@ -227,7 +227,7 @@ void TestQgsScaleComboBox::allowNull()
enterScale( 0.02 );
QCOMPARE( s->scale(), 50.0 );
QCOMPARE( spyScaleChanged.count(), 4 );
s->clear();
s->setNull();
QVERIFY( std::isnan( s->scale() ) );
QCOMPARE( spyScaleChanged.count(), 5 );
QVERIFY( s->lineEdit()->text().isEmpty() );
Expand Down
4 changes: 2 additions & 2 deletions tests/src/python/test_qgsscalewidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def testNull(self):

w.setScale(50)
self.assertFalse(w.allowNull())
w.clear() # no effect
w.setNull() # no effect
self.assertEqual(w.scale(), 50.0)
self.assertFalse(w.isNull())

Expand Down Expand Up @@ -85,7 +85,7 @@ def testNull(self):
self.assertEqual(len(spy), 4)
self.assertEqual(spy[-1][0], 50.0)
self.assertFalse(w.isNull())
w.clear()
w.setNull()
self.assertTrue(math.isnan(w.scale()))
self.assertEqual(len(spy), 5)
self.assertTrue(math.isnan(spy[-1][0]))
Expand Down

0 comments on commit 46e3304

Please sign in to comment.