QmlDesigner: Properly handle empty source

Change-Id: I46550e4210b966db26e719f6eec10d0eb3243d91
Reviewed-by: Henning Gründl <henning.gruendl@qt.io>
This commit is contained in:
Thomas Hartmann
2023-09-11 12:58:03 +02:00
parent 803bb23bdb
commit 6ec68ca98a

View File

@@ -737,6 +737,8 @@ int ConnectionModelBackendDelegate::currentRow() const
QString removeOnFromSignalName(const QString &signal)
{
if (signal.isEmpty())
return {};
QString ret = signal;
ret.remove(0, 2);
ret[0] = ret.at(0).toLower();
@@ -903,9 +905,14 @@ void ConnectionModelBackendDelegate::setupHandlerAndStatements()
QTC_ASSERT(model, return );
SignalHandlerProperty signalHandlerProperty = model->signalHandlerPropertyForRow(currentRow());
if (signalHandlerProperty.source().isEmpty()) {
m_actionType = ConnectionModelStatementDelegate::Custom;
m_handler = ConnectionEditorStatements::EmptyBlock();
} else {
m_handler = ConnectionEditorEvaluator::parseStatement(signalHandlerProperty.source());
const QString statementType = QmlDesigner::ConnectionEditorStatements::toDisplayName(m_handler);
const QString statementType = QmlDesigner::ConnectionEditorStatements::toDisplayName(
m_handler);
if (statementType == ConnectionEditorStatements::EMPTY_DISPLAY_NAME) {
m_actionType = ConnectionModelStatementDelegate::Custom;
@@ -927,6 +934,7 @@ void ConnectionModelBackendDelegate::setupHandlerAndStatements()
} else {
m_actionType = ConnectionModelStatementDelegate::Custom;
}
}
ConnectionEditorStatements::MatchedStatement &okStatement
= ConnectionEditorStatements::okStatement(m_handler);