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();
|
return index.internalId();
|
||||||
|
|
||||||
case HasWhenCondition:
|
case HasWhenCondition:
|
||||||
return stateNode.isValid() && stateNode.hasProperty("when");
|
return stateNode.hasProperty("when");
|
||||||
|
|
||||||
case WhenConditionString: {
|
case WhenConditionString:
|
||||||
if (stateNode.isValid() && stateNode.hasBindingProperty("when"))
|
return stateNode.bindingProperty("when").expression();
|
||||||
return stateNode.bindingProperty("when").expression();
|
|
||||||
else
|
|
||||||
return QString();
|
|
||||||
}
|
|
||||||
|
|
||||||
case IsDefault: {
|
case IsDefault: {
|
||||||
QmlModelState modelState(stateNode);
|
return QmlModelState(stateNode).isDefault();
|
||||||
if (modelState.isValid())
|
|
||||||
return modelState.isDefault();
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
case ModelHasDefaultState:
|
case ModelHasDefaultState:
|
||||||
|
@@ -346,9 +346,7 @@ void StatesEditorView::resetWhenCondition(int internalNodeId)
|
|||||||
if (hasModelNodeForInternalId(internalNodeId)) {
|
if (hasModelNodeForInternalId(internalNodeId)) {
|
||||||
QmlModelState state(modelNodeForInternalId(internalNodeId));
|
QmlModelState state(modelNodeForInternalId(internalNodeId));
|
||||||
try {
|
try {
|
||||||
if (state.isValid() && state.modelNode().hasProperty("when"))
|
state.modelNode().removeProperty("when");
|
||||||
state.modelNode().removeProperty("when");
|
|
||||||
|
|
||||||
} catch (const RewritingException &e) {
|
} catch (const RewritingException &e) {
|
||||||
e.showException();
|
e.showException();
|
||||||
}
|
}
|
||||||
@@ -409,9 +407,7 @@ void StatesEditorView::setAnnotation(int internalNodeId)
|
|||||||
QmlModelState state(modelNodeForInternalId(internalNodeId));
|
QmlModelState state(modelNodeForInternalId(internalNodeId));
|
||||||
try {
|
try {
|
||||||
if (state.isValid()) {
|
if (state.isValid()) {
|
||||||
ModelNode modelNode = state.modelNode();
|
if (ModelNode modelNode = state.modelNode()) {
|
||||||
|
|
||||||
if (modelNode.isValid()) {
|
|
||||||
if (!m_editor)
|
if (!m_editor)
|
||||||
m_editor = new AnnotationEditor(this);
|
m_editor = new AnnotationEditor(this);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user