forked from qt-creator/qt-creator
QmlDesigner: Use new validation approach in states editor
Many validation tests can now be skipped. Task-number: QDS-7454 Change-Id: I43ef981379cf495506b6cf8e8b3cedf50b061281 Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
@@ -100,20 +100,13 @@ QVariant StatesEditorModel::data(const QModelIndex &index, int role) const
|
||||
return index.internalId();
|
||||
|
||||
case HasWhenCondition:
|
||||
return stateNode.isValid() && stateNode.hasProperty("when");
|
||||
return stateNode.hasProperty("when");
|
||||
|
||||
case WhenConditionString: {
|
||||
if (stateNode.isValid() && stateNode.hasBindingProperty("when"))
|
||||
return stateNode.bindingProperty("when").expression();
|
||||
else
|
||||
return QString();
|
||||
}
|
||||
case WhenConditionString:
|
||||
return stateNode.bindingProperty("when").expression();
|
||||
|
||||
case IsDefault: {
|
||||
QmlModelState modelState(stateNode);
|
||||
if (modelState.isValid())
|
||||
return modelState.isDefault();
|
||||
return false;
|
||||
return QmlModelState(stateNode).isDefault();
|
||||
}
|
||||
|
||||
case ModelHasDefaultState:
|
||||
|
@@ -346,9 +346,7 @@ void StatesEditorView::resetWhenCondition(int internalNodeId)
|
||||
if (hasModelNodeForInternalId(internalNodeId)) {
|
||||
QmlModelState state(modelNodeForInternalId(internalNodeId));
|
||||
try {
|
||||
if (state.isValid() && state.modelNode().hasProperty("when"))
|
||||
state.modelNode().removeProperty("when");
|
||||
|
||||
state.modelNode().removeProperty("when");
|
||||
} catch (const RewritingException &e) {
|
||||
e.showException();
|
||||
}
|
||||
@@ -409,9 +407,7 @@ void StatesEditorView::setAnnotation(int internalNodeId)
|
||||
QmlModelState state(modelNodeForInternalId(internalNodeId));
|
||||
try {
|
||||
if (state.isValid()) {
|
||||
ModelNode modelNode = state.modelNode();
|
||||
|
||||
if (modelNode.isValid()) {
|
||||
if (ModelNode modelNode = state.modelNode()) {
|
||||
if (!m_editor)
|
||||
m_editor = new AnnotationEditor(this);
|
||||
|
||||
|
Reference in New Issue
Block a user