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