upport mnemonic labels
This commit is contained in:
parent
e92ed94d9d
commit
9b6c2cddc7
@ -22,6 +22,7 @@ import QtQuick.Window 2.2
|
|||||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||||
import QtQuick.Controls 1.4 as QtQuickControls
|
import QtQuick.Controls 1.4 as QtQuickControls
|
||||||
import QtQuick.Controls.Private 1.0 as QtQuickControlsPrivate
|
import QtQuick.Controls.Private 1.0 as QtQuickControlsPrivate
|
||||||
|
import org.kde.kirigami 2.4
|
||||||
|
|
||||||
pragma Singleton
|
pragma Singleton
|
||||||
|
|
||||||
@ -54,12 +55,12 @@ QtObject {
|
|||||||
* * desktop
|
* * desktop
|
||||||
*/
|
*/
|
||||||
property QtObject iconSizes: QtObject {
|
property QtObject iconSizes: QtObject {
|
||||||
property int small: fontMetrics.roundedIconSize(16 * devicePixelRatio)
|
property int small: Math.floor(fontMetrics.roundedIconSize(16 * devicePixelRatio) * (Settings.isMobile ? 1.5 : 1))
|
||||||
property int smallMedium: fontMetrics.roundedIconSize(22 * devicePixelRatio)
|
property int smallMedium: Math.floor(fontMetrics.roundedIconSize(22 * devicePixelRatio) * (Settings.isMobile ? 1.5 : 1))
|
||||||
property int medium: fontMetrics.roundedIconSize(32 * devicePixelRatio)
|
property int medium: Math.floor(fontMetrics.roundedIconSize(32 * devicePixelRatio) * (Settings.isMobile ? 1.5 : 1))
|
||||||
property int large: fontMetrics.roundedIconSize(48 * devicePixelRatio)
|
property int large: Math.floor(fontMetrics.roundedIconSize(48 * devicePixelRatio) * (Settings.isMobile ? 1.5 : 1))
|
||||||
property int huge: fontMetrics.roundedIconSize(64 * devicePixelRatio)
|
property int huge: Math.floor(fontMetrics.roundedIconSize(64 * devicePixelRatio) * (Settings.isMobile ? 1.5 : 1))
|
||||||
property int enormous: 128 * devicePixelRatio
|
property int enormous: Math.floor(128 * devicePixelRatio * (Settings.isMobile ? 1.5 : 1))
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -21,7 +21,7 @@ pragma Singleton
|
|||||||
|
|
||||||
import QtQuick 2.4
|
import QtQuick 2.4
|
||||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||||
|
import org.kde.kirigami 2.4
|
||||||
|
|
||||||
QtObject {
|
QtObject {
|
||||||
/**
|
/**
|
||||||
@ -49,12 +49,12 @@ QtObject {
|
|||||||
* * desktop
|
* * desktop
|
||||||
*/
|
*/
|
||||||
property QtObject iconSizes: QtObject {
|
property QtObject iconSizes: QtObject {
|
||||||
property int small: units.iconSizes.small
|
property int small: Math.floor(fontMetrics.roundedIconSize(16 * devicePixelRatio) * (Settings.isMobile ? 1.5 : 1))
|
||||||
property int smallMedium: units.iconSizes.smallMedium
|
property int smallMedium: Math.floor(fontMetrics.roundedIconSize(22 * devicePixelRatio) * (Settings.isMobile ? 1.5 : 1))
|
||||||
property int medium: units.iconSizes.medium
|
property int medium: Math.floor(fontMetrics.roundedIconSize(32 * devicePixelRatio) * (Settings.isMobile ? 1.5 : 1))
|
||||||
property int large: units.iconSizes.large
|
property int large: Math.floor(fontMetrics.roundedIconSize(48 * devicePixelRatio) * (Settings.isMobile ? 1.5 : 1))
|
||||||
property int huge: units.iconSizes.huge
|
property int huge: Math.floor(fontMetrics.roundedIconSize(64 * devicePixelRatio) * (Settings.isMobile ? 1.5 : 1))
|
||||||
property int enormous: units.iconSizes.enormous
|
property int enormous: Math.floor(128 * devicePixelRatio * (Settings.isMobile ? 1.5 : 1))
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -63,7 +63,7 @@ QtObject {
|
|||||||
* the default font as rendered on the screen, so it takes user-configured font size and DPI
|
* the default font as rendered on the screen, so it takes user-configured font size and DPI
|
||||||
* into account.
|
* into account.
|
||||||
*/
|
*/
|
||||||
property int smallSpacing: units.smallSpacing
|
property int smallSpacing: Math.floor(gridUnit/4)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* units.largeSpacing is the amount of spacing that should be used inside bigger UI elements,
|
* units.largeSpacing is the amount of spacing that should be used inside bigger UI elements,
|
||||||
@ -106,5 +106,20 @@ QtObject {
|
|||||||
*/
|
*/
|
||||||
property variant fontMetrics: TextMetrics {
|
property variant fontMetrics: TextMetrics {
|
||||||
text: "M"
|
text: "M"
|
||||||
|
function roundedIconSize(size) {
|
||||||
|
if (size < 16) {
|
||||||
|
return size;
|
||||||
|
} else if (size < 22) {
|
||||||
|
return 16;
|
||||||
|
} else if (size < 32) {
|
||||||
|
return 22;
|
||||||
|
} else if (size < 48) {
|
||||||
|
return 32;
|
||||||
|
} else if (size < 64) {
|
||||||
|
return 48;
|
||||||
|
} else {
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,6 +38,10 @@ T.Button {
|
|||||||
|
|
||||||
hoverEnabled: !Kirigami.Settings.tabletMode
|
hoverEnabled: !Kirigami.Settings.tabletMode
|
||||||
|
|
||||||
|
Kirigami.MnemonicData.enabled: control.enabled && control.visible
|
||||||
|
Kirigami.MnemonicData.controlType: Kirigami.MnemonicData.SecondaryControl
|
||||||
|
Kirigami.MnemonicData.label: control.text
|
||||||
|
|
||||||
contentItem: RowLayout {
|
contentItem: RowLayout {
|
||||||
PlasmaCore.IconItem {
|
PlasmaCore.IconItem {
|
||||||
id: icon
|
id: icon
|
||||||
@ -50,7 +54,7 @@ T.Button {
|
|||||||
Label {
|
Label {
|
||||||
Layout.fillWidth: !icon.visible
|
Layout.fillWidth: !icon.visible
|
||||||
visible: text.length > 0
|
visible: text.length > 0
|
||||||
text: control.text
|
text: control.Kirigami.MnemonicData.richTextLabel
|
||||||
font: control.font
|
font: control.font
|
||||||
opacity: enabled || control.highlighted || control.checked ? 1 : 0.4
|
opacity: enabled || control.highlighted || control.checked ? 1 : 0.4
|
||||||
color: theme.buttonTextColor
|
color: theme.buttonTextColor
|
||||||
|
@ -37,7 +37,6 @@ T.Label {
|
|||||||
//TODO: from theme singleton?
|
//TODO: from theme singleton?
|
||||||
color: PlasmaCore.ColorScope.textColor
|
color: PlasmaCore.ColorScope.textColor
|
||||||
linkColor: theme.linkColor
|
linkColor: theme.linkColor
|
||||||
textFormat: Text.PlainText
|
|
||||||
|
|
||||||
opacity: enabled? 1 : 0.6
|
opacity: enabled? 1 : 0.6
|
||||||
|
|
||||||
|
@ -38,6 +38,10 @@ T.ToolButton {
|
|||||||
|
|
||||||
hoverEnabled: !Kirigami.Settings.tabletMode
|
hoverEnabled: !Kirigami.Settings.tabletMode
|
||||||
|
|
||||||
|
Kirigami.MnemonicData.enabled: control.enabled && control.visible
|
||||||
|
Kirigami.MnemonicData.controlType: Kirigami.MnemonicData.SecondaryControl
|
||||||
|
Kirigami.MnemonicData.label: control.text
|
||||||
|
|
||||||
flat: true
|
flat: true
|
||||||
|
|
||||||
contentItem: RowLayout {
|
contentItem: RowLayout {
|
||||||
@ -50,7 +54,7 @@ T.ToolButton {
|
|||||||
}
|
}
|
||||||
Label {
|
Label {
|
||||||
visible: text.length > 0
|
visible: text.length > 0
|
||||||
text: control.text
|
text: control.Kirigami.MnemonicData.richTextLabel
|
||||||
font: control.font
|
font: control.font
|
||||||
opacity: enabled || control.highlighted || control.checked ? 1 : 0.4
|
opacity: enabled || control.highlighted || control.checked ? 1 : 0.4
|
||||||
color: theme.buttonTextColor
|
color: theme.buttonTextColor
|
||||||
|
Loading…
x
Reference in New Issue
Block a user