forked from qt-creator/qt-creator
QmlDesigner: Add warning for empty name cell
Change-Id: I028362e9fc329247f5b068eee5f84ede28e65e9c Reviewed-by: Pranta Ghosh Dastider <pranta.dastider@qt.io> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
committed by
Henning Gründl
parent
4465b3a183
commit
ff5ca5f5b4
@@ -127,7 +127,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))
|
||||
@@ -136,7 +136,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()
|
||||
}
|
||||
@@ -1095,8 +1095,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 {
|
||||
|
Reference in New Issue
Block a user