diff --git a/share/qtcreator/qmldesigner/designsystem/Main.qml b/share/qtcreator/qmldesigner/designsystem/Main.qml index 08434a46b97..33f15dff998 100644 --- a/share/qtcreator/qmldesigner/designsystem/Main.qml +++ b/share/qtcreator/qmldesigner/designsystem/Main.qml @@ -130,7 +130,7 @@ Rectangle { overlayInvalid.show() } - function showHeaderData(section: int, orientation: var) { + function showHeaderData(section: int, orientation: var, message: string) { if (orientation === Qt.Horizontal) { overlayInvalid.parent = horizontalHeaderView.contentItem overlayInvalid.cellItem = horizontalHeaderView.itemAtCell(Qt.point(overlay.section, 0)) @@ -139,7 +139,7 @@ Rectangle { overlayInvalid.cellItem = verticalHeaderView.itemAtCell(Qt.point(0, overlay.section)) } - notification.message = qsTr("This name is already in use, please use a different name.") + notification.message = message overlayInvalid.show() } @@ -1098,8 +1098,14 @@ Rectangle { // Revoke active focus from text field by forcing active focus on another item tableView.forceActiveFocus() - if (!result && overlayTextField.previousText !== overlayTextField.text) - overlayInvalid.showHeaderData(overlay.section, overlay.orientation) + if (overlayTextField.text === "") + overlayInvalid.showHeaderData(overlay.section, + overlay.orientation, + qsTr("No name found, please enter a valid name.")) + else if (!result && overlayTextField.previousText !== overlayTextField.text) + overlayInvalid.showHeaderData(overlay.section, + overlay.orientation, + qsTr("This name is already in use, please use a different name.")) } Text {