mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-30 00:12:50 -05:00
top bar improvements
This commit is contained in:
@@ -92,31 +92,6 @@ DankPopout {
|
|||||||
border.width: 1
|
border.width: 1
|
||||||
antialiasing: true
|
antialiasing: true
|
||||||
smooth: true
|
smooth: true
|
||||||
focus: true
|
|
||||||
|
|
||||||
Component.onCompleted: {
|
|
||||||
if (root.shouldBeVisible)
|
|
||||||
forceActiveFocus()
|
|
||||||
}
|
|
||||||
|
|
||||||
Keys.onPressed: function (event) {
|
|
||||||
if (event.key === Qt.Key_Escape) {
|
|
||||||
root.close()
|
|
||||||
event.accepted = true
|
|
||||||
} else {
|
|
||||||
event.accepted = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Connections {
|
|
||||||
function onShouldBeVisibleChanged() {
|
|
||||||
if (root.shouldBeVisible)
|
|
||||||
Qt.callLater(function () {
|
|
||||||
controlContent.forceActiveFocus()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
target: root
|
|
||||||
}
|
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
id: mainColumn
|
id: mainColumn
|
||||||
|
|||||||
@@ -19,12 +19,15 @@ PanelWindow {
|
|||||||
|
|
||||||
property var modelData
|
property var modelData
|
||||||
property string screenName: modelData.name
|
property string screenName: modelData.name
|
||||||
property real backgroundTransparency: SettingsData.topBarTransparency
|
|
||||||
readonly property int notificationCount: NotificationService.notifications.length
|
readonly property int notificationCount: NotificationService.notifications.length
|
||||||
property bool autoHide: SettingsData.topBarAutoHide
|
readonly property real effectiveBarHeight: Math.max(
|
||||||
property bool reveal: SettingsData.topBarVisible && (!autoHide || topBarMouseArea.containsMouse)
|
root.widgetHeight
|
||||||
readonly property real effectiveBarHeight: Math.max(root.widgetHeight + SettingsData.topBarInnerPadding + 4, Theme.barHeight - 4 - (8 - SettingsData.topBarInnerPadding))
|
+ SettingsData.topBarInnerPadding + 4,
|
||||||
readonly property real widgetHeight: Math.max(20, 26 + SettingsData.topBarInnerPadding * 0.6)
|
Theme.barHeight - 4
|
||||||
|
- (8 - SettingsData.topBarInnerPadding))
|
||||||
|
readonly property real widgetHeight: Math.max(
|
||||||
|
20,
|
||||||
|
26 + SettingsData.topBarInnerPadding * 0.6)
|
||||||
|
|
||||||
screen: modelData
|
screen: modelData
|
||||||
implicitHeight: effectiveBarHeight + SettingsData.topBarSpacing
|
implicitHeight: effectiveBarHeight + SettingsData.topBarSpacing
|
||||||
@@ -102,10 +105,6 @@ PanelWindow {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
function onTopBarTransparencyChanged() {
|
|
||||||
root.backgroundTransparency = SettingsData.topBarTransparency
|
|
||||||
}
|
|
||||||
|
|
||||||
function onTopBarLeftWidgetsChanged() {
|
function onTopBarLeftWidgetsChanged() {
|
||||||
root.updateGpuTempConfig()
|
root.updateGpuTempConfig()
|
||||||
}
|
}
|
||||||
@@ -155,15 +154,56 @@ PanelWindow {
|
|||||||
right: true
|
right: true
|
||||||
}
|
}
|
||||||
|
|
||||||
exclusiveZone: !SettingsData.topBarVisible || autoHide ? -1 : root.effectiveBarHeight + SettingsData.topBarSpacing - 2 + SettingsData.topBarBottomGap
|
exclusiveZone: topBarCore.autoHide ? -1 : root.effectiveBarHeight + SettingsData.topBarSpacing
|
||||||
|
- 2 + SettingsData.topBarBottomGap
|
||||||
|
|
||||||
mask: Region {
|
mask: Region {
|
||||||
item: topBarMouseArea
|
item: topBarMouseArea
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: topBarCore
|
||||||
|
anchors.fill: parent
|
||||||
|
|
||||||
|
property real backgroundTransparency: SettingsData.topBarTransparency
|
||||||
|
property bool autoHide: SettingsData.topBarAutoHide
|
||||||
|
property bool reveal: SettingsData.topBarVisible
|
||||||
|
&& (!autoHide || topBarMouseArea.containsMouse || hasActivePopout)
|
||||||
|
|
||||||
|
readonly property bool hasActivePopout: {
|
||||||
|
var result = false
|
||||||
|
if (typeof appDrawerLoader !== "undefined" && appDrawerLoader.item)
|
||||||
|
result = result || appDrawerLoader.item.shouldBeVisible
|
||||||
|
if (typeof centcomPopoutLoader !== "undefined" && centcomPopoutLoader.item)
|
||||||
|
result = result || centcomPopoutLoader.item.shouldBeVisible
|
||||||
|
if (typeof processListPopoutLoader !== "undefined" && processListPopoutLoader.item)
|
||||||
|
result = result || processListPopoutLoader.item.shouldBeVisible
|
||||||
|
if (typeof notificationCenterLoader !== "undefined" && notificationCenterLoader.item)
|
||||||
|
result = result || notificationCenterLoader.item.shouldBeVisible
|
||||||
|
if (typeof batteryPopoutLoader !== "undefined" && batteryPopoutLoader.item)
|
||||||
|
result = result || batteryPopoutLoader.item.shouldBeVisible
|
||||||
|
if (typeof vpnPopoutLoader !== "undefined" && vpnPopoutLoader.item)
|
||||||
|
result = result || vpnPopoutLoader.item.shouldBeVisible
|
||||||
|
if (typeof controlCenterLoader !== "undefined" && controlCenterLoader.item)
|
||||||
|
result = result || controlCenterLoader.item.shouldBeVisible
|
||||||
|
if (typeof notepadModalLoader !== "undefined" && notepadModalLoader.item)
|
||||||
|
result = result || notepadModalLoader.item.visible
|
||||||
|
if (typeof clipboardHistoryModalPopup !== "undefined" && clipboardHistoryModalPopup.item)
|
||||||
|
result = result || clipboardHistoryModalPopup.item.visible
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
function onTopBarTransparencyChanged() {
|
||||||
|
topBarCore.backgroundTransparency = SettingsData.topBarTransparency
|
||||||
|
}
|
||||||
|
|
||||||
|
target: SettingsData
|
||||||
|
}
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
id: topBarMouseArea
|
id: topBarMouseArea
|
||||||
height: root.reveal ? effectiveBarHeight + SettingsData.topBarSpacing : 4
|
height: parent.reveal ? root.effectiveBarHeight + SettingsData.topBarSpacing : 4
|
||||||
anchors {
|
anchors {
|
||||||
top: parent.top
|
top: parent.top
|
||||||
left: parent.left
|
left: parent.left
|
||||||
@@ -184,7 +224,7 @@ PanelWindow {
|
|||||||
|
|
||||||
transform: Translate {
|
transform: Translate {
|
||||||
id: topBarSlide
|
id: topBarSlide
|
||||||
y: root.reveal ? 0 : -(effectiveBarHeight - 4)
|
y: topBarCore.reveal ? 0 : -(root.effectiveBarHeight - 4)
|
||||||
|
|
||||||
Behavior on y {
|
Behavior on y {
|
||||||
NumberAnimation {
|
NumberAnimation {
|
||||||
@@ -207,7 +247,7 @@ PanelWindow {
|
|||||||
color: Qt.rgba(Theme.surfaceContainer.r,
|
color: Qt.rgba(Theme.surfaceContainer.r,
|
||||||
Theme.surfaceContainer.g,
|
Theme.surfaceContainer.g,
|
||||||
Theme.surfaceContainer.b,
|
Theme.surfaceContainer.b,
|
||||||
root.backgroundTransparency)
|
topBarCore.backgroundTransparency)
|
||||||
layer.enabled: true
|
layer.enabled: true
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
@@ -273,15 +313,16 @@ PanelWindow {
|
|||||||
readonly property int leftSectionRightEdge: estimatedLeftSectionWidth
|
readonly property int leftSectionRightEdge: estimatedLeftSectionWidth
|
||||||
readonly property int mediaLeftEdge: clockLeftEdge - mediaMaxWidth
|
readonly property int mediaLeftEdge: clockLeftEdge - mediaMaxWidth
|
||||||
- Theme.spacingS
|
- Theme.spacingS
|
||||||
readonly property int rightSectionLeftEdge: availableWidth - rightSectionWidth
|
readonly property int rightSectionLeftEdge: availableWidth
|
||||||
|
- rightSectionWidth
|
||||||
readonly property int leftToClockGap: Math.max(
|
readonly property int leftToClockGap: Math.max(
|
||||||
0,
|
0,
|
||||||
clockLeftEdge - leftSectionRightEdge)
|
clockLeftEdge
|
||||||
|
- leftSectionRightEdge)
|
||||||
readonly property int leftToMediaGap: mediaMaxWidth > 0 ? Math.max(0, mediaLeftEdge - leftSectionRightEdge) : leftToClockGap
|
readonly property int leftToMediaGap: mediaMaxWidth > 0 ? Math.max(0, mediaLeftEdge - leftSectionRightEdge) : leftToClockGap
|
||||||
readonly property int mediaToClockGap: mediaMaxWidth > 0 ? Theme.spacingS : 0
|
readonly property int mediaToClockGap: mediaMaxWidth
|
||||||
readonly property int clockToRightGap: validLayout ? Math.max(
|
> 0 ? Theme.spacingS : 0
|
||||||
0,
|
readonly property int clockToRightGap: validLayout ? Math.max(0, rightSectionLeftEdge - clockRightEdge) : 1000
|
||||||
rightSectionLeftEdge - clockRightEdge) : 1000
|
|
||||||
readonly property bool spacingTight: validLayout
|
readonly property bool spacingTight: validLayout
|
||||||
&& (leftToMediaGap < 150
|
&& (leftToMediaGap < 150
|
||||||
|| clockToRightGap < 100)
|
|| clockToRightGap < 100)
|
||||||
@@ -404,8 +445,12 @@ PanelWindow {
|
|||||||
}
|
}
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.leftMargin: Math.max(Theme.spacingXS, SettingsData.topBarInnerPadding * 0.8)
|
anchors.leftMargin: Math.max(
|
||||||
anchors.rightMargin: Math.max(Theme.spacingXS, SettingsData.topBarInnerPadding * 0.8)
|
Theme.spacingXS,
|
||||||
|
SettingsData.topBarInnerPadding * 0.8)
|
||||||
|
anchors.rightMargin: Math.max(
|
||||||
|
Theme.spacingXS,
|
||||||
|
SettingsData.topBarInnerPadding * 0.8)
|
||||||
anchors.topMargin: SettingsData.topBarInnerPadding / 2
|
anchors.topMargin: SettingsData.topBarInnerPadding / 2
|
||||||
anchors.bottomMargin: SettingsData.topBarInnerPadding / 2
|
anchors.bottomMargin: SettingsData.topBarInnerPadding / 2
|
||||||
clip: true
|
clip: true
|
||||||
@@ -434,7 +479,6 @@ PanelWindow {
|
|||||||
opacity: topBarContent.getWidgetEnabled(
|
opacity: topBarContent.getWidgetEnabled(
|
||||||
model.enabled) ? 1 : 0
|
model.enabled) ? 1 : 0
|
||||||
asynchronous: false
|
asynchronous: false
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -477,7 +521,8 @@ PanelWindow {
|
|||||||
|
|
||||||
let parentCenterX = width / 2
|
let parentCenterX = width / 2
|
||||||
if (totalWidgets % 2 === 1) {
|
if (totalWidgets % 2 === 1) {
|
||||||
let middleIndex = Math.floor(totalWidgets / 2)
|
let middleIndex = Math.floor(
|
||||||
|
totalWidgets / 2)
|
||||||
let currentX = parentCenterX
|
let currentX = parentCenterX
|
||||||
- (centerWidgets[middleIndex].width / 2)
|
- (centerWidgets[middleIndex].width / 2)
|
||||||
centerWidgets[middleIndex].x = currentX
|
centerWidgets[middleIndex].x = currentX
|
||||||
@@ -501,11 +546,13 @@ PanelWindow {
|
|||||||
let rightMiddleIndex = totalWidgets / 2
|
let rightMiddleIndex = totalWidgets / 2
|
||||||
let gapCenter = parentCenterX
|
let gapCenter = parentCenterX
|
||||||
let halfSpacing = spacing / 2
|
let halfSpacing = spacing / 2
|
||||||
centerWidgets[leftMiddleIndex].x = gapCenter - halfSpacing
|
centerWidgets[leftMiddleIndex].x = gapCenter
|
||||||
- centerWidgets[leftMiddleIndex].width
|
- halfSpacing - centerWidgets[leftMiddleIndex].width
|
||||||
centerWidgets[leftMiddleIndex].anchors.horizontalCenter = undefined
|
centerWidgets[leftMiddleIndex].anchors.horizontalCenter
|
||||||
|
= undefined
|
||||||
centerWidgets[rightMiddleIndex].x = gapCenter + halfSpacing
|
centerWidgets[rightMiddleIndex].x = gapCenter + halfSpacing
|
||||||
centerWidgets[rightMiddleIndex].anchors.horizontalCenter = undefined
|
centerWidgets[rightMiddleIndex].anchors.horizontalCenter
|
||||||
|
= undefined
|
||||||
let currentX = centerWidgets[leftMiddleIndex].x
|
let currentX = centerWidgets[leftMiddleIndex].x
|
||||||
for (var i = leftMiddleIndex - 1; i >= 0; i--) {
|
for (var i = leftMiddleIndex - 1; i >= 0; i--) {
|
||||||
currentX -= (spacing + centerWidgets[i].width)
|
currentX -= (spacing + centerWidgets[i].width)
|
||||||
@@ -568,7 +615,8 @@ PanelWindow {
|
|||||||
item.onWidthChanged.connect(
|
item.onWidthChanged.connect(
|
||||||
centerSection.updateLayout)
|
centerSection.updateLayout)
|
||||||
if (model.widgetId === "spacer")
|
if (model.widgetId === "spacer")
|
||||||
item.spacerSize = Qt.binding(() => {
|
item.spacerSize = Qt.binding(
|
||||||
|
() => {
|
||||||
return model.size
|
return model.size
|
||||||
|| 20
|
|| 20
|
||||||
})
|
})
|
||||||
@@ -614,7 +662,6 @@ PanelWindow {
|
|||||||
opacity: topBarContent.getWidgetEnabled(
|
opacity: topBarContent.getWidgetEnabled(
|
||||||
model.enabled) ? 1 : 0
|
model.enabled) ? 1 : 0
|
||||||
asynchronous: false
|
asynchronous: false
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -628,7 +675,8 @@ PanelWindow {
|
|||||||
height: root.widgetHeight
|
height: root.widgetHeight
|
||||||
radius: SettingsData.topBarNoBackground ? 0 : Theme.cornerRadius
|
radius: SettingsData.topBarNoBackground ? 0 : Theme.cornerRadius
|
||||||
color: {
|
color: {
|
||||||
if (SettingsData.topBarNoBackground) return "transparent"
|
if (SettingsData.topBarNoBackground)
|
||||||
|
return "transparent"
|
||||||
const baseColor = clipboardArea.containsMouse ? Theme.primaryHover : Theme.secondaryHover
|
const baseColor = clipboardArea.containsMouse ? Theme.primaryHover : Theme.secondaryHover
|
||||||
return Qt.rgba(
|
return Qt.rgba(
|
||||||
baseColor.r, baseColor.g,
|
baseColor.r, baseColor.g,
|
||||||
@@ -718,9 +766,11 @@ PanelWindow {
|
|||||||
section: {
|
section: {
|
||||||
if (parent && parent.parent === leftSection)
|
if (parent && parent.parent === leftSection)
|
||||||
return "left"
|
return "left"
|
||||||
if (parent && parent.parent === rightSection)
|
if (parent
|
||||||
|
&& parent.parent === rightSection)
|
||||||
return "right"
|
return "right"
|
||||||
if (parent && parent.parent === centerSection)
|
if (parent
|
||||||
|
&& parent.parent === centerSection)
|
||||||
return "center"
|
return "center"
|
||||||
return "left"
|
return "left"
|
||||||
}
|
}
|
||||||
@@ -739,9 +789,11 @@ PanelWindow {
|
|||||||
section: {
|
section: {
|
||||||
if (parent && parent.parent === leftSection)
|
if (parent && parent.parent === leftSection)
|
||||||
return "left"
|
return "left"
|
||||||
if (parent && parent.parent === rightSection)
|
if (parent
|
||||||
|
&& parent.parent === rightSection)
|
||||||
return "right"
|
return "right"
|
||||||
if (parent && parent.parent === centerSection)
|
if (parent
|
||||||
|
&& parent.parent === centerSection)
|
||||||
return "center"
|
return "center"
|
||||||
return "center"
|
return "center"
|
||||||
}
|
}
|
||||||
@@ -771,9 +823,11 @@ PanelWindow {
|
|||||||
section: {
|
section: {
|
||||||
if (parent && parent.parent === leftSection)
|
if (parent && parent.parent === leftSection)
|
||||||
return "left"
|
return "left"
|
||||||
if (parent && parent.parent === rightSection)
|
if (parent
|
||||||
|
&& parent.parent === rightSection)
|
||||||
return "right"
|
return "right"
|
||||||
if (parent && parent.parent === centerSection)
|
if (parent
|
||||||
|
&& parent.parent === centerSection)
|
||||||
return "center"
|
return "center"
|
||||||
return "center"
|
return "center"
|
||||||
}
|
}
|
||||||
@@ -801,9 +855,11 @@ PanelWindow {
|
|||||||
section: {
|
section: {
|
||||||
if (parent && parent.parent === leftSection)
|
if (parent && parent.parent === leftSection)
|
||||||
return "left"
|
return "left"
|
||||||
if (parent && parent.parent === rightSection)
|
if (parent
|
||||||
|
&& parent.parent === rightSection)
|
||||||
return "right"
|
return "right"
|
||||||
if (parent && parent.parent === centerSection)
|
if (parent
|
||||||
|
&& parent.parent === centerSection)
|
||||||
return "center"
|
return "center"
|
||||||
return "center"
|
return "center"
|
||||||
}
|
}
|
||||||
@@ -840,9 +896,11 @@ PanelWindow {
|
|||||||
section: {
|
section: {
|
||||||
if (parent && parent.parent === leftSection)
|
if (parent && parent.parent === leftSection)
|
||||||
return "left"
|
return "left"
|
||||||
if (parent && parent.parent === rightSection)
|
if (parent
|
||||||
|
&& parent.parent === rightSection)
|
||||||
return "right"
|
return "right"
|
||||||
if (parent && parent.parent === centerSection)
|
if (parent
|
||||||
|
&& parent.parent === centerSection)
|
||||||
return "center"
|
return "center"
|
||||||
return "right"
|
return "right"
|
||||||
}
|
}
|
||||||
@@ -859,9 +917,11 @@ PanelWindow {
|
|||||||
section: {
|
section: {
|
||||||
if (parent && parent.parent === leftSection)
|
if (parent && parent.parent === leftSection)
|
||||||
return "left"
|
return "left"
|
||||||
if (parent && parent.parent === rightSection)
|
if (parent
|
||||||
|
&& parent.parent === rightSection)
|
||||||
return "right"
|
return "right"
|
||||||
if (parent && parent.parent === centerSection)
|
if (parent
|
||||||
|
&& parent.parent === centerSection)
|
||||||
return "center"
|
return "center"
|
||||||
return "right"
|
return "right"
|
||||||
}
|
}
|
||||||
@@ -887,9 +947,11 @@ PanelWindow {
|
|||||||
section: {
|
section: {
|
||||||
if (parent && parent.parent === leftSection)
|
if (parent && parent.parent === leftSection)
|
||||||
return "left"
|
return "left"
|
||||||
if (parent && parent.parent === rightSection)
|
if (parent
|
||||||
|
&& parent.parent === rightSection)
|
||||||
return "right"
|
return "right"
|
||||||
if (parent && parent.parent === centerSection)
|
if (parent
|
||||||
|
&& parent.parent === centerSection)
|
||||||
return "center"
|
return "center"
|
||||||
return "right"
|
return "right"
|
||||||
}
|
}
|
||||||
@@ -915,9 +977,11 @@ PanelWindow {
|
|||||||
section: {
|
section: {
|
||||||
if (parent && parent.parent === leftSection)
|
if (parent && parent.parent === leftSection)
|
||||||
return "left"
|
return "left"
|
||||||
if (parent && parent.parent === rightSection)
|
if (parent
|
||||||
|
&& parent.parent === rightSection)
|
||||||
return "right"
|
return "right"
|
||||||
if (parent && parent.parent === centerSection)
|
if (parent
|
||||||
|
&& parent.parent === centerSection)
|
||||||
return "center"
|
return "center"
|
||||||
return "right"
|
return "right"
|
||||||
}
|
}
|
||||||
@@ -943,9 +1007,11 @@ PanelWindow {
|
|||||||
section: {
|
section: {
|
||||||
if (parent && parent.parent === leftSection)
|
if (parent && parent.parent === leftSection)
|
||||||
return "left"
|
return "left"
|
||||||
if (parent && parent.parent === rightSection)
|
if (parent
|
||||||
|
&& parent.parent === rightSection)
|
||||||
return "right"
|
return "right"
|
||||||
if (parent && parent.parent === centerSection)
|
if (parent
|
||||||
|
&& parent.parent === centerSection)
|
||||||
return "center"
|
return "center"
|
||||||
return "right"
|
return "right"
|
||||||
}
|
}
|
||||||
@@ -980,9 +1046,11 @@ PanelWindow {
|
|||||||
section: {
|
section: {
|
||||||
if (parent && parent.parent === leftSection)
|
if (parent && parent.parent === leftSection)
|
||||||
return "left"
|
return "left"
|
||||||
if (parent && parent.parent === rightSection)
|
if (parent
|
||||||
|
&& parent.parent === rightSection)
|
||||||
return "right"
|
return "right"
|
||||||
if (parent && parent.parent === centerSection)
|
if (parent
|
||||||
|
&& parent.parent === centerSection)
|
||||||
return "center"
|
return "center"
|
||||||
return "right"
|
return "right"
|
||||||
}
|
}
|
||||||
@@ -1010,9 +1078,11 @@ PanelWindow {
|
|||||||
section: {
|
section: {
|
||||||
if (parent && parent.parent === leftSection)
|
if (parent && parent.parent === leftSection)
|
||||||
return "left"
|
return "left"
|
||||||
if (parent && parent.parent === rightSection)
|
if (parent
|
||||||
|
&& parent.parent === rightSection)
|
||||||
return "right"
|
return "right"
|
||||||
if (parent && parent.parent === centerSection)
|
if (parent
|
||||||
|
&& parent.parent === centerSection)
|
||||||
return "center"
|
return "center"
|
||||||
return "right"
|
return "right"
|
||||||
}
|
}
|
||||||
@@ -1039,9 +1109,11 @@ PanelWindow {
|
|||||||
section: {
|
section: {
|
||||||
if (parent && parent.parent === leftSection)
|
if (parent && parent.parent === leftSection)
|
||||||
return "left"
|
return "left"
|
||||||
if (parent && parent.parent === rightSection)
|
if (parent
|
||||||
|
&& parent.parent === rightSection)
|
||||||
return "right"
|
return "right"
|
||||||
if (parent && parent.parent === centerSection)
|
if (parent
|
||||||
|
&& parent.parent === centerSection)
|
||||||
return "center"
|
return "center"
|
||||||
return "right"
|
return "right"
|
||||||
}
|
}
|
||||||
@@ -1069,9 +1141,11 @@ PanelWindow {
|
|||||||
section: {
|
section: {
|
||||||
if (parent && parent.parent === leftSection)
|
if (parent && parent.parent === leftSection)
|
||||||
return "left"
|
return "left"
|
||||||
if (parent && parent.parent === rightSection)
|
if (parent
|
||||||
|
&& parent.parent === rightSection)
|
||||||
return "right"
|
return "right"
|
||||||
if (parent && parent.parent === centerSection)
|
if (parent
|
||||||
|
&& parent.parent === centerSection)
|
||||||
return "center"
|
return "center"
|
||||||
return "right"
|
return "right"
|
||||||
}
|
}
|
||||||
@@ -1103,9 +1177,11 @@ PanelWindow {
|
|||||||
section: {
|
section: {
|
||||||
if (parent && parent.parent === leftSection)
|
if (parent && parent.parent === leftSection)
|
||||||
return "left"
|
return "left"
|
||||||
if (parent && parent.parent === rightSection)
|
if (parent
|
||||||
|
&& parent.parent === rightSection)
|
||||||
return "right"
|
return "right"
|
||||||
if (parent && parent.parent === centerSection)
|
if (parent
|
||||||
|
&& parent.parent === centerSection)
|
||||||
return "center"
|
return "center"
|
||||||
return "right"
|
return "right"
|
||||||
}
|
}
|
||||||
@@ -1167,9 +1243,11 @@ PanelWindow {
|
|||||||
section: {
|
section: {
|
||||||
if (parent && parent.parent === leftSection)
|
if (parent && parent.parent === leftSection)
|
||||||
return "left"
|
return "left"
|
||||||
if (parent && parent.parent === rightSection)
|
if (parent
|
||||||
|
&& parent.parent === rightSection)
|
||||||
return "right"
|
return "right"
|
||||||
if (parent && parent.parent === centerSection)
|
if (parent
|
||||||
|
&& parent.parent === centerSection)
|
||||||
return "center"
|
return "center"
|
||||||
return "right"
|
return "right"
|
||||||
}
|
}
|
||||||
@@ -1191,3 +1269,4 @@ PanelWindow {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -137,32 +137,28 @@ PanelWindow {
|
|||||||
active: root.visible
|
active: root.visible
|
||||||
asynchronous: false
|
asynchronous: false
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
FocusScope {
|
Item {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
visible: shouldBeVisible
|
focus: true
|
||||||
focus: shouldBeVisible
|
|
||||||
|
|
||||||
Keys.onPressed: event => {
|
Keys.onPressed: event => {
|
||||||
if (event.key === Qt.Key_Escape) {
|
if (event.key === Qt.Key_Escape) {
|
||||||
close()
|
close()
|
||||||
event.accepted = true
|
event.accepted = true
|
||||||
} else {
|
} else {
|
||||||
// Forward all non-escape keys to content
|
|
||||||
event.accepted = false
|
event.accepted = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onVisibleChanged: {
|
Component.onCompleted: {
|
||||||
if (visible) {
|
forceActiveFocus()
|
||||||
Qt.callLater(function () {
|
}
|
||||||
if (contentLoader.item) {
|
|
||||||
contentLoader.item.forceActiveFocus()
|
onVisibleChanged: {
|
||||||
} else {
|
if (visible) {
|
||||||
forceActiveFocus()
|
forceActiveFocus()
|
||||||
}
|
}
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user