feat(StatusFontSettings): Add StatusFontSettings component to change StatusMenuItems font attributes (#749)

Required by #6090
This commit is contained in:
Michał Iskierko 2022-07-12 11:05:12 +02:00 committed by GitHub
parent 9a2e28f2a7
commit 05250a6eab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 42 additions and 3 deletions

View File

@ -12,6 +12,7 @@
\list
\li \l{StatusAppNavBarFilterModel}
\li \l{StatusBaseText}
\li \l{StatusFontSettings}
\li \l{StatusIcon}
\li \l{StatusIconBackgroundSettings}
\li \l{StatusIconSettings}

View File

@ -28,6 +28,11 @@ GridLayout {
onClicked: customMenu.popup()
}
StatusButton {
text: "Menu with custom font settings"
onClicked: differentFontMenu.popup()
}
StatusPopupMenu {
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
}
}
}

View File

@ -0,0 +1,10 @@
import QtQuick 2.13
QtObject {
id: statusFontSettings
property bool bold: false
property bool italic: false
property int pixelSize: 13
}

View File

@ -1,6 +1,7 @@
module StatusQ.Core
StatusBaseText 0.1 StatusBaseText.qml
StatusFontSettings 0.1 StatusFontSettings.qml
StatusIcon 0.1 StatusIcon.qml
StatusIconSettings 0.1 StatusIconSettings.qml
StatusIconBackgroundSettings 0.1 StatusIconBackgroundSettings.qml

View File

@ -22,4 +22,6 @@ Action {
background: StatusIconBackgroundSettings {}
color: "transparent"
}
property StatusFontSettings fontSettings: StatusFontSettings {}
}

View File

@ -60,7 +60,6 @@ MenuItem {
switch (statusPopupMenuItem.action.type) {
case StatusMenuItem.Type.Danger:
return Theme.palette.dangerColor1
break;
default:
return Theme.palette.primaryColor1
}
@ -158,7 +157,9 @@ MenuItem {
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
visible: statusPopupMenuItem.action.enabled
}

View File

@ -102,6 +102,7 @@
<file>src/StatusQ/Core/StatusBaseText.qml</file>
<file>src/StatusQ/Core/StatusIcon.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/StatusIdenticonRingSettings.qml</file>
<file>src/StatusQ/Core/StatusImageSettings.qml</file>