NButton: fix issue when no icon defined
This commit is contained in:
parent
fe139c208a
commit
a6ccc8b0da
3 changed files with 23 additions and 21 deletions
|
|
@ -80,10 +80,9 @@ Rectangle {
|
|||
spacing: Style.marginXS * scaling
|
||||
|
||||
// Icon (optional)
|
||||
Loader {
|
||||
active: root.icon !== ""
|
||||
sourceComponent: NIcon {
|
||||
NIcon {
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
visible: root.icon !== ""
|
||||
|
||||
icon: root.icon
|
||||
font.pointSize: root.iconSize
|
||||
|
|
@ -105,7 +104,6 @@ Rectangle {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Text
|
||||
NText {
|
||||
|
|
|
|||
|
|
@ -7,8 +7,12 @@ Text {
|
|||
readonly property string defaultIcon: "balloon"
|
||||
property string icon: defaultIcon
|
||||
|
||||
visible: (icon !== undefined) && (icon !== "")
|
||||
text: {
|
||||
if (icon === undefined || Bootstrap.icons[icon] === undefined) {
|
||||
if ((icon === undefined) || (icon === "")) {
|
||||
return ""
|
||||
}
|
||||
if (Bootstrap.icons[icon] === undefined) {
|
||||
Logger.warn("Icon", `"${icon}"`, "doesn't exist in the bootstrap font")
|
||||
Logger.callStack()
|
||||
return Bootstrap.icons[defaultIcon]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue