forked from qt-creator/qt-creator
QmlDesigner: Properly handle empty source
Change-Id: I46550e4210b966db26e719f6eec10d0eb3243d91 Reviewed-by: Henning Gründl <henning.gruendl@qt.io>
This commit is contained in:
@@ -737,6 +737,8 @@ int ConnectionModelBackendDelegate::currentRow() const
|
|||||||
|
|
||||||
QString removeOnFromSignalName(const QString &signal)
|
QString removeOnFromSignalName(const QString &signal)
|
||||||
{
|
{
|
||||||
|
if (signal.isEmpty())
|
||||||
|
return {};
|
||||||
QString ret = signal;
|
QString ret = signal;
|
||||||
ret.remove(0, 2);
|
ret.remove(0, 2);
|
||||||
ret[0] = ret.at(0).toLower();
|
ret[0] = ret.at(0).toLower();
|
||||||
@@ -903,29 +905,35 @@ void ConnectionModelBackendDelegate::setupHandlerAndStatements()
|
|||||||
QTC_ASSERT(model, return );
|
QTC_ASSERT(model, return );
|
||||||
SignalHandlerProperty signalHandlerProperty = model->signalHandlerPropertyForRow(currentRow());
|
SignalHandlerProperty signalHandlerProperty = model->signalHandlerPropertyForRow(currentRow());
|
||||||
|
|
||||||
m_handler = ConnectionEditorEvaluator::parseStatement(signalHandlerProperty.source());
|
if (signalHandlerProperty.source().isEmpty()) {
|
||||||
|
|
||||||
const QString statementType = QmlDesigner::ConnectionEditorStatements::toDisplayName(m_handler);
|
|
||||||
|
|
||||||
if (statementType == ConnectionEditorStatements::EMPTY_DISPLAY_NAME) {
|
|
||||||
m_actionType = ConnectionModelStatementDelegate::Custom;
|
m_actionType = ConnectionModelStatementDelegate::Custom;
|
||||||
} else if (statementType == ConnectionEditorStatements::ASSIGNMENT_DISPLAY_NAME) {
|
m_handler = ConnectionEditorStatements::EmptyBlock();
|
||||||
m_actionType = ConnectionModelStatementDelegate::Assign;
|
|
||||||
//setupAssignment();
|
|
||||||
} else if (statementType == ConnectionEditorStatements::SETPROPERTY_DISPLAY_NAME) {
|
|
||||||
m_actionType = ConnectionModelStatementDelegate::SetProperty;
|
|
||||||
//setupSetProperty();
|
|
||||||
} else if (statementType == ConnectionEditorStatements::FUNCTION_DISPLAY_NAME) {
|
|
||||||
m_actionType = ConnectionModelStatementDelegate::CallFunction;
|
|
||||||
//setupCallFunction();
|
|
||||||
} else if (statementType == ConnectionEditorStatements::SETSTATE_DISPLAY_NAME) {
|
|
||||||
m_actionType = ConnectionModelStatementDelegate::ChangeState;
|
|
||||||
//setupChangeState();
|
|
||||||
} else if (statementType == ConnectionEditorStatements::LOG_DISPLAY_NAME) {
|
|
||||||
m_actionType = ConnectionModelStatementDelegate::PrintMessage;
|
|
||||||
//setupPrintMessage();
|
|
||||||
} else {
|
} else {
|
||||||
m_actionType = ConnectionModelStatementDelegate::Custom;
|
m_handler = ConnectionEditorEvaluator::parseStatement(signalHandlerProperty.source());
|
||||||
|
|
||||||
|
const QString statementType = QmlDesigner::ConnectionEditorStatements::toDisplayName(
|
||||||
|
m_handler);
|
||||||
|
|
||||||
|
if (statementType == ConnectionEditorStatements::EMPTY_DISPLAY_NAME) {
|
||||||
|
m_actionType = ConnectionModelStatementDelegate::Custom;
|
||||||
|
} else if (statementType == ConnectionEditorStatements::ASSIGNMENT_DISPLAY_NAME) {
|
||||||
|
m_actionType = ConnectionModelStatementDelegate::Assign;
|
||||||
|
//setupAssignment();
|
||||||
|
} else if (statementType == ConnectionEditorStatements::SETPROPERTY_DISPLAY_NAME) {
|
||||||
|
m_actionType = ConnectionModelStatementDelegate::SetProperty;
|
||||||
|
//setupSetProperty();
|
||||||
|
} else if (statementType == ConnectionEditorStatements::FUNCTION_DISPLAY_NAME) {
|
||||||
|
m_actionType = ConnectionModelStatementDelegate::CallFunction;
|
||||||
|
//setupCallFunction();
|
||||||
|
} else if (statementType == ConnectionEditorStatements::SETSTATE_DISPLAY_NAME) {
|
||||||
|
m_actionType = ConnectionModelStatementDelegate::ChangeState;
|
||||||
|
//setupChangeState();
|
||||||
|
} else if (statementType == ConnectionEditorStatements::LOG_DISPLAY_NAME) {
|
||||||
|
m_actionType = ConnectionModelStatementDelegate::PrintMessage;
|
||||||
|
//setupPrintMessage();
|
||||||
|
} else {
|
||||||
|
m_actionType = ConnectionModelStatementDelegate::Custom;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ConnectionEditorStatements::MatchedStatement &okStatement
|
ConnectionEditorStatements::MatchedStatement &okStatement
|
||||||
|
Reference in New Issue
Block a user