mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-06 00:07:29 -04:00
Allow setting expression format help string for QgsExpressionLineEdit
This commit is contained in:
parent
06d37fced4
commit
7b85fd9961
@ -37,22 +37,19 @@ The builder widget that is used by the dialog
|
||||
|
||||
QString expectedOutputFormat();
|
||||
%Docstring
|
||||
The set expected format string. This is pure text format and no expression validation
|
||||
Returns the expected format string, which is shown in the dialog.
|
||||
This is purely a text format and no expression validation
|
||||
is done against it.
|
||||
|
||||
:return: The expected value format.
|
||||
.. seealso:: :py:func:`setExpectedOutputFormat`
|
||||
%End
|
||||
|
||||
void setExpectedOutputFormat( const QString &expected );
|
||||
%Docstring
|
||||
The set expected format string. This is pure text format and no expression validation
|
||||
is done against it.
|
||||
Set the ``expected`` format string, which is shown in the dialog.
|
||||
This is purely a text format and no expression validation is done against it.
|
||||
|
||||
:param expected: The expected value format for the expression.
|
||||
|
||||
.. note::
|
||||
|
||||
Only a UI hint and not used for expression validation.
|
||||
.. seealso:: :py:func:`expectedOutputFormat`
|
||||
%End
|
||||
|
||||
QgsExpressionContext expressionContext() const;
|
||||
|
@ -63,6 +63,27 @@ Sets whether the widget should show a multiline text editor.
|
||||
to show single line editor (the default).
|
||||
%End
|
||||
|
||||
QString expectedOutputFormat() const;
|
||||
%Docstring
|
||||
Returns the expected format string, which is shown in the expression builder dialog for the widget.
|
||||
This is purely a text format and no expression validation
|
||||
is done against it.
|
||||
|
||||
.. seealso:: :py:func:`setExpectedOutputFormat`
|
||||
|
||||
.. versionadded:: 3.4
|
||||
%End
|
||||
|
||||
void setExpectedOutputFormat( const QString &expected );
|
||||
%Docstring
|
||||
Set the ``expected`` format string, which is shown in the expression builder dialog for the widget.
|
||||
This is purely a text format and no expression validation is done against it.
|
||||
|
||||
.. seealso:: :py:func:`expectedOutputFormat`
|
||||
|
||||
.. versionadded:: 3.4
|
||||
%End
|
||||
|
||||
void setGeomCalculator( const QgsDistanceArea &distanceArea );
|
||||
%Docstring
|
||||
Set the geometry calculator used in the expression dialog.
|
||||
|
@ -48,17 +48,17 @@ class GUI_EXPORT QgsExpressionBuilderDialog : public QDialog, private Ui::QgsExp
|
||||
QString expressionText();
|
||||
|
||||
/**
|
||||
* The set expected format string. This is pure text format and no expression validation
|
||||
* Returns the expected format string, which is shown in the dialog.
|
||||
* This is purely a text format and no expression validation
|
||||
* is done against it.
|
||||
* \returns The expected value format.
|
||||
* \see setExpectedOutputFormat()
|
||||
*/
|
||||
QString expectedOutputFormat();
|
||||
|
||||
/**
|
||||
* The set expected format string. This is pure text format and no expression validation
|
||||
* is done against it.
|
||||
* \param expected The expected value format for the expression.
|
||||
* \note Only a UI hint and not used for expression validation.
|
||||
* Set the \a expected format string, which is shown in the dialog.
|
||||
* This is purely a text format and no expression validation is done against it.
|
||||
* \see expectedOutputFormat()
|
||||
*/
|
||||
void setExpectedOutputFormat( const QString &expected );
|
||||
|
||||
|
@ -103,6 +103,16 @@ void QgsExpressionLineEdit::setMultiLine( bool multiLine )
|
||||
}
|
||||
}
|
||||
|
||||
QString QgsExpressionLineEdit::expectedOutputFormat() const
|
||||
{
|
||||
return mExpectedOutputFormat;
|
||||
}
|
||||
|
||||
void QgsExpressionLineEdit::setExpectedOutputFormat( const QString &expected )
|
||||
{
|
||||
mExpectedOutputFormat = expected;
|
||||
}
|
||||
|
||||
void QgsExpressionLineEdit::setGeomCalculator( const QgsDistanceArea &da )
|
||||
{
|
||||
mDa.reset( new QgsDistanceArea( da ) );
|
||||
@ -151,6 +161,7 @@ void QgsExpressionLineEdit::editExpression()
|
||||
QgsExpressionContext context = mExpressionContextGenerator ? mExpressionContextGenerator->createExpressionContext() : mExpressionContext;
|
||||
|
||||
QgsExpressionBuilderDialog dlg( mLayer, currentExpression, this, QStringLiteral( "generic" ), context );
|
||||
dlg.setExpectedOutputFormat( mExpectedOutputFormat );
|
||||
if ( mDa )
|
||||
{
|
||||
dlg.setGeomCalculator( *mDa );
|
||||
|
@ -78,6 +78,23 @@ class GUI_EXPORT QgsExpressionLineEdit : public QWidget
|
||||
*/
|
||||
void setMultiLine( bool multiLine );
|
||||
|
||||
/**
|
||||
* Returns the expected format string, which is shown in the expression builder dialog for the widget.
|
||||
* This is purely a text format and no expression validation
|
||||
* is done against it.
|
||||
* \see setExpectedOutputFormat()
|
||||
* \since QGIS 3.4
|
||||
*/
|
||||
QString expectedOutputFormat() const;
|
||||
|
||||
/**
|
||||
* Set the \a expected format string, which is shown in the expression builder dialog for the widget.
|
||||
* This is purely a text format and no expression validation is done against it.
|
||||
* \see expectedOutputFormat()
|
||||
* \since QGIS 3.4
|
||||
*/
|
||||
void setExpectedOutputFormat( const QString &expected );
|
||||
|
||||
/**
|
||||
* Set the geometry calculator used in the expression dialog.
|
||||
* \param distanceArea calculator
|
||||
@ -160,6 +177,7 @@ class GUI_EXPORT QgsExpressionLineEdit : public QWidget
|
||||
QgsExpressionContext mExpressionContext;
|
||||
const QgsExpressionContextGenerator *mExpressionContextGenerator = nullptr;
|
||||
QgsVectorLayer *mLayer = nullptr;
|
||||
QString mExpectedOutputFormat;
|
||||
|
||||
bool isExpressionValid( const QString &expressionStr );
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user