Skip to content
Permalink
Browse files

Fix naming collision

  • Loading branch information
nyalldawson committed Mar 13, 2019
1 parent 32fbf0a commit 46e3304d2cba6a5d3f75d0b7e3accd5fe848fd10
@@ -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
@@ -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
@@ -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
@@ -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.

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

@@ -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 );
@@ -281,7 +281,7 @@ void QgsScaleComboBox::setMinScale( double scale )
}
}

void QgsScaleComboBox::clear()
void QgsScaleComboBox::setNull()
{
if ( allowNull() )
setScale( std::numeric_limits< double >::quiet_NaN() );
@@ -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;
@@ -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 );
@@ -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;
@@ -151,7 +151,7 @@ class GUI_EXPORT QgsScaleComboBox : public QComboBox
* \see isNull()
* \since QGIS 3.8
*/
void clear();
void setNull();

protected:
void showPopup() override;
@@ -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 )
@@ -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;
@@ -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 );
@@ -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;
@@ -174,7 +174,7 @@ class GUI_EXPORT QgsScaleWidget : public QWidget
* \see isNull()
* \since QGIS 3.8
*/
void clear();
void setNull();

signals:

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

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

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

0 comments on commit 46e3304

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