Don't compare string with empty string

Summary: Instead compare string length with an integer

Test Plan: Compile && run

Reviewers: #plasma, iasensio

Reviewed By: iasensio

Subscribers: broulik, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D29772
This commit is contained in:
Carl Schwan 2020-05-15 11:00:09 +02:00
parent ab5d310119
commit 1dcf514e21
No known key found for this signature in database
GPG key ID: 06B35D38387B67BE
5 changed files with 7 additions and 7 deletions

View file

@ -36,7 +36,7 @@ Loader {
title: root.title
selectExisting: !root.isSaveDialog
folder: (root.lastFolder == "") ? shortcuts.home : root.lastFolder
folder: root.lastFolder || shortcuts.home
nameFilters: [ i18n("KWin Rules (*.kwinrule)") ]
defaultSuffix: "*.kwinrule"

View file

@ -91,7 +91,7 @@ QQC2.ComboBox {
QQC2.ToolTip {
text: model.tooltip
visible: hovered && (model.tooltip != "")
visible: hovered && (model.tooltip.length > 0)
}
Component.onCompleted: {

View file

@ -106,7 +106,7 @@ Kirigami.AbstractListItem {
QQC2.ToolTip {
text: model.description
visible: hovered && (text != "")
visible: hovered && (text.length > 0)
}
}
}

View file

@ -162,7 +162,7 @@ ScrollViewKCM {
Layout.alignment: Qt.AlignVCenter
QQC2.ToolTip {
text: model.description
visible: hovered && (model.description != "")
visible: hovered && (model.description.length > 0)
}
}
QQC2.Label {
@ -262,7 +262,7 @@ ScrollViewKCM {
if (!showItem) {
return false;
}
if (filterString != "") {
if (filterString.length > 0) {
return sourceModel.data(index, RulesModel.NameRole).toLowerCase().includes(filterString)
}
return true;

View file

@ -67,7 +67,7 @@ ScrollViewKCM {
}
Kirigami.PlaceholderMessage {
visible: ruleBookView.count == 0
visible: ruleBookView.count === 0
anchors.centerIn: parent
width: parent.width - (units.largeSpacing * 4)
text: i18n("No rules for specific windows are currently set");
@ -84,7 +84,7 @@ ScrollViewKCM {
iconName: "object-select-symbolic"
text: checked ? i18n("Unselect All") : i18n("Select All")
checkable: true
checked: selectedIndexes.length == ruleBookView.count
checked: selectedIndexes.length === ruleBookView.count
onToggled: {
if (checked) {
selectedIndexes = [...Array(ruleBookView.count).keys()]