qgsdecorationtitledialog.cpp (QGIS-final-3_10_11) | : | qgsdecorationtitledialog.cpp (QGIS-final-3_10_12) | ||
---|---|---|---|---|
skipping to change at line 113 | skipping to change at line 113 | |||
} | } | |||
void QgsDecorationTitleDialog::mInsertExpressionButton_clicked() | void QgsDecorationTitleDialog::mInsertExpressionButton_clicked() | |||
{ | { | |||
QString selText = txtTitleText->textCursor().selectedText(); | QString selText = txtTitleText->textCursor().selectedText(); | |||
// edit the selected expression if there's one | // edit the selected expression if there's one | |||
if ( selText.startsWith( QLatin1String( "[%" ) ) && selText.endsWith( QLatin1S tring( "%]" ) ) ) | if ( selText.startsWith( QLatin1String( "[%" ) ) && selText.endsWith( QLatin1S tring( "%]" ) ) ) | |||
selText = selText.mid( 2, selText.size() - 4 ); | selText = selText.mid( 2, selText.size() - 4 ); | |||
selText = selText.replace( QChar( 0x2029 ), QChar( '\n' ) ); | ||||
QgsExpressionBuilderDialog exprDlg( nullptr, selText, this, QStringLiteral( "g eneric" ), QgisApp::instance()->mapCanvas()->mapSettings().expressionContext() ) ; | QgsExpressionBuilderDialog exprDlg( nullptr, selText, this, QStringLiteral( "g eneric" ), QgisApp::instance()->mapCanvas()->mapSettings().expressionContext() ) ; | |||
exprDlg.setWindowTitle( QObject::tr( "Insert Expression" ) ); | exprDlg.setWindowTitle( QObject::tr( "Insert Expression" ) ); | |||
if ( exprDlg.exec() == QDialog::Accepted ) | if ( exprDlg.exec() == QDialog::Accepted ) | |||
{ | { | |||
QString expression = exprDlg.expressionText(); | QString expression = exprDlg.expressionText(); | |||
if ( !expression.isEmpty() ) | if ( !expression.isEmpty() ) | |||
{ | { | |||
txtTitleText->insertPlainText( "[%" + expression + "%]" ); | txtTitleText->insertPlainText( "[%" + expression + "%]" ); | |||
} | } | |||
End of changes. 1 change blocks. | ||||
0 lines changed or deleted | 2 lines changed or added |