feat(StatusFontSettings): Add StatusFontSettings component to change StatusMenuItems font attributes (#749)
Required by #6090
This commit is contained in:
parent
9a2e28f2a7
commit
05250a6eab
|
@ -12,6 +12,7 @@
|
||||||
\list
|
\list
|
||||||
\li \l{StatusAppNavBarFilterModel}
|
\li \l{StatusAppNavBarFilterModel}
|
||||||
\li \l{StatusBaseText}
|
\li \l{StatusBaseText}
|
||||||
|
\li \l{StatusFontSettings}
|
||||||
\li \l{StatusIcon}
|
\li \l{StatusIcon}
|
||||||
\li \l{StatusIconBackgroundSettings}
|
\li \l{StatusIconBackgroundSettings}
|
||||||
\li \l{StatusIconSettings}
|
\li \l{StatusIconSettings}
|
||||||
|
|
|
@ -28,6 +28,11 @@ GridLayout {
|
||||||
onClicked: customMenu.popup()
|
onClicked: customMenu.popup()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StatusButton {
|
||||||
|
text: "Menu with custom font settings"
|
||||||
|
onClicked: differentFontMenu.popup()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
StatusPopupMenu {
|
StatusPopupMenu {
|
||||||
id: simpleMenu
|
id: simpleMenu
|
||||||
|
@ -147,4 +152,22 @@ CExPynn1gWf9bx498P7/nzPcxEzGExhBdJGYihtAYQlO+tUZvqrPbqeudo5iJGEJjCE15a3VtodH3q2I
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StatusPopupMenu {
|
||||||
|
id: differentFontMenu
|
||||||
|
StatusMenuItem {
|
||||||
|
text: "Bold"
|
||||||
|
fontSettings.bold: true
|
||||||
|
}
|
||||||
|
|
||||||
|
StatusMenuItem {
|
||||||
|
text: "Italic"
|
||||||
|
fontSettings.italic: true
|
||||||
|
}
|
||||||
|
|
||||||
|
StatusMenuItem {
|
||||||
|
text: "16px"
|
||||||
|
fontSettings.pixelSize: 16
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
import QtQuick 2.13
|
||||||
|
|
||||||
|
QtObject {
|
||||||
|
id: statusFontSettings
|
||||||
|
|
||||||
|
property bool bold: false
|
||||||
|
property bool italic: false
|
||||||
|
property int pixelSize: 13
|
||||||
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
module StatusQ.Core
|
module StatusQ.Core
|
||||||
|
|
||||||
StatusBaseText 0.1 StatusBaseText.qml
|
StatusBaseText 0.1 StatusBaseText.qml
|
||||||
|
StatusFontSettings 0.1 StatusFontSettings.qml
|
||||||
StatusIcon 0.1 StatusIcon.qml
|
StatusIcon 0.1 StatusIcon.qml
|
||||||
StatusIconSettings 0.1 StatusIconSettings.qml
|
StatusIconSettings 0.1 StatusIconSettings.qml
|
||||||
StatusIconBackgroundSettings 0.1 StatusIconBackgroundSettings.qml
|
StatusIconBackgroundSettings 0.1 StatusIconBackgroundSettings.qml
|
||||||
|
|
|
@ -22,4 +22,6 @@ Action {
|
||||||
background: StatusIconBackgroundSettings {}
|
background: StatusIconBackgroundSettings {}
|
||||||
color: "transparent"
|
color: "transparent"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
property StatusFontSettings fontSettings: StatusFontSettings {}
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,14 +53,13 @@ MenuItem {
|
||||||
color: {
|
color: {
|
||||||
let c = !!statusPopupMenuItem.action.iconSettings && statusPopupMenuItem.action.iconSettings.color ||
|
let c = !!statusPopupMenuItem.action.iconSettings && statusPopupMenuItem.action.iconSettings.color ||
|
||||||
!!statusPopupMenuItem.action && statusPopupMenuItem.action.icon.color
|
!!statusPopupMenuItem.action && statusPopupMenuItem.action.icon.color
|
||||||
|
|
||||||
if (!Qt.colorEqual(c, "transparent")) {
|
if (!Qt.colorEqual(c, "transparent")) {
|
||||||
return c
|
return c
|
||||||
}
|
}
|
||||||
switch (statusPopupMenuItem.action.type) {
|
switch (statusPopupMenuItem.action.type) {
|
||||||
case StatusMenuItem.Type.Danger:
|
case StatusMenuItem.Type.Danger:
|
||||||
return Theme.palette.dangerColor1
|
return Theme.palette.dangerColor1
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
return Theme.palette.primaryColor1
|
return Theme.palette.primaryColor1
|
||||||
}
|
}
|
||||||
|
@ -158,7 +157,9 @@ MenuItem {
|
||||||
return Theme.palette.directColor1
|
return Theme.palette.directColor1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
font.pixelSize: 13
|
font.pixelSize: !!statusPopupMenuItem.action.fontSettings ? statusPopupMenuItem.action.fontSettings.pixelSize : 13
|
||||||
|
font.bold: !!statusPopupMenuItem.action.fontSettings ? statusPopupMenuItem.action.fontSettings.bold : false
|
||||||
|
font.italic: !!statusPopupMenuItem.action.fontSettings ? statusPopupMenuItem.action.fontSettings.italic : false
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
visible: statusPopupMenuItem.action.enabled
|
visible: statusPopupMenuItem.action.enabled
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,6 +102,7 @@
|
||||||
<file>src/StatusQ/Core/StatusBaseText.qml</file>
|
<file>src/StatusQ/Core/StatusBaseText.qml</file>
|
||||||
<file>src/StatusQ/Core/StatusIcon.qml</file>
|
<file>src/StatusQ/Core/StatusIcon.qml</file>
|
||||||
<file>src/StatusQ/Core/StatusIconBackgroundSettings.qml</file>
|
<file>src/StatusQ/Core/StatusIconBackgroundSettings.qml</file>
|
||||||
|
<file>src/StatusQ/Core/StatusFontSettings.qml</file>
|
||||||
<file>src/StatusQ/Core/StatusIconSettings.qml</file>
|
<file>src/StatusQ/Core/StatusIconSettings.qml</file>
|
||||||
<file>src/StatusQ/Core/StatusIdenticonRingSettings.qml</file>
|
<file>src/StatusQ/Core/StatusIdenticonRingSettings.qml</file>
|
||||||
<file>src/StatusQ/Core/StatusImageSettings.qml</file>
|
<file>src/StatusQ/Core/StatusImageSettings.qml</file>
|
||||||
|
|
Loading…
Reference in New Issue