mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-04-11 00:02:28 -04:00
popout: use mapToItem instead of mapToGlobal for popout positioning
fixes #1152
This commit is contained in:
@@ -264,14 +264,14 @@ BasePill {
|
||||
size: Theme.barIconSize(root.barThickness, -4)
|
||||
color: Theme.widgetIconColor
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.top: parent
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: 2
|
||||
}
|
||||
|
||||
StyledText {
|
||||
id: audioPercentV
|
||||
visible: root.showAudioPercent
|
||||
text: Math.round(AudioService.sink.audio.volume * 100) + "%"
|
||||
text: Math.round((AudioService.sink?.audio?.volume ?? 0) * 100) + "%"
|
||||
font.pixelSize: Theme.barTextSize(root.barThickness, root.barConfig?.fontScale)
|
||||
color: Theme.widgetTextColor
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
@@ -305,14 +305,14 @@ BasePill {
|
||||
size: Theme.barIconSize(root.barThickness, -4)
|
||||
color: root.getMicIconColor()
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.top: parent
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: 2
|
||||
}
|
||||
|
||||
StyledText {
|
||||
id: micPercentV
|
||||
visible: root.showMicPercent
|
||||
text: Math.round(AudioService.source.audio.volume * 100) + "%"
|
||||
text: Math.round((AudioService.source?.audio?.volume ?? 0) * 100) + "%"
|
||||
font.pixelSize: Theme.barTextSize(root.barThickness, root.barConfig?.fontScale)
|
||||
color: Theme.widgetTextColor
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
@@ -346,7 +346,7 @@ BasePill {
|
||||
size: Theme.barIconSize(root.barThickness, -4)
|
||||
color: Theme.widgetIconColor
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.top: parent
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: 2
|
||||
}
|
||||
|
||||
@@ -442,14 +442,14 @@ BasePill {
|
||||
size: Theme.barIconSize(root.barThickness, -4)
|
||||
color: Theme.widgetIconColor
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.left: parent
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 2
|
||||
}
|
||||
|
||||
StyledText {
|
||||
id: audioPercent
|
||||
visible: root.showAudioPercent
|
||||
text: Math.round(AudioService.sink.audio.volume * 100) + "%"
|
||||
text: Math.round((AudioService.sink?.audio?.volume ?? 0) * 100) + "%"
|
||||
font.pixelSize: Theme.barTextSize(root.barThickness, root.barConfig?.fontScale)
|
||||
color: Theme.widgetTextColor
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
@@ -484,14 +484,14 @@ BasePill {
|
||||
size: Theme.barIconSize(root.barThickness, -4)
|
||||
color: root.getMicIconColor()
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.left: parent
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 2
|
||||
}
|
||||
|
||||
StyledText {
|
||||
id: micPercent
|
||||
visible: root.showMicPercent
|
||||
text: Math.round(AudioService.source.audio.volume * 100) + "%"
|
||||
text: Math.round((AudioService.source?.audio?.volume ?? 0) * 100) + "%"
|
||||
font.pixelSize: Theme.barTextSize(root.barThickness, root.barConfig?.fontScale)
|
||||
color: Theme.widgetTextColor
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
@@ -526,7 +526,7 @@ BasePill {
|
||||
size: Theme.barIconSize(root.barThickness, -4)
|
||||
color: Theme.widgetIconColor
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.left: parent
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 2
|
||||
}
|
||||
|
||||
|
||||
@@ -139,7 +139,7 @@ BasePill {
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: {
|
||||
if (root.popoutTarget && root.popoutTarget.setTriggerPosition) {
|
||||
const globalPos = parent.mapToGlobal(0, 0);
|
||||
const globalPos = parent.mapToItem(null, 0, 0);
|
||||
const currentScreen = root.parentScreen || Screen;
|
||||
const pos = SettingsData.getPopupTriggerPosition(globalPos, currentScreen, root.barThickness, parent.width);
|
||||
root.popoutTarget.setTriggerPosition(pos.x, pos.y, pos.width, root.section, currentScreen);
|
||||
@@ -294,7 +294,7 @@ BasePill {
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onPressed: {
|
||||
if (root.popoutTarget && root.popoutTarget.setTriggerPosition) {
|
||||
const globalPos = mapToGlobal(0, 0);
|
||||
const globalPos = mapToItem(null, 0, 0);
|
||||
const currentScreen = root.parentScreen || Screen;
|
||||
const pos = SettingsData.getPopupTriggerPosition(globalPos, currentScreen, root.barThickness, root.width);
|
||||
root.popoutTarget.setTriggerPosition(pos.x, pos.y, pos.width, root.section, currentScreen);
|
||||
|
||||
@@ -12,7 +12,7 @@ BasePill {
|
||||
readonly property bool isChecking: SystemUpdateService.isChecking
|
||||
|
||||
readonly property real horizontalPadding: (barConfig?.noBackground ?? false) ? 2 : Theme.spacingS
|
||||
width : (SettingsData.updaterHideWidget && !hasUpdates) ? 0 : (18 + horizontalPadding * 2)
|
||||
width: (SettingsData.updaterHideWidget && !hasUpdates) ? 0 : (18 + horizontalPadding * 2)
|
||||
|
||||
Ref {
|
||||
service: SystemUpdateService
|
||||
@@ -28,16 +28,21 @@ BasePill {
|
||||
anchors.centerIn: parent
|
||||
visible: root.isVerticalOrientation
|
||||
name: {
|
||||
if (root.isChecking) return "refresh"
|
||||
if (SystemUpdateService.hasError) return "error"
|
||||
if (root.hasUpdates) return "system_update_alt"
|
||||
return "check_circle"
|
||||
if (root.isChecking)
|
||||
return "refresh";
|
||||
if (SystemUpdateService.hasError)
|
||||
return "error";
|
||||
if (root.hasUpdates)
|
||||
return "system_update_alt";
|
||||
return "check_circle";
|
||||
}
|
||||
size: Theme.barIconSize(root.barThickness, -4)
|
||||
color: {
|
||||
if (SystemUpdateService.hasError) return Theme.error
|
||||
if (root.hasUpdates) return Theme.primary
|
||||
return root.isActive ? Theme.primary : Theme.surfaceText
|
||||
if (SystemUpdateService.hasError)
|
||||
return Theme.error;
|
||||
if (root.hasUpdates)
|
||||
return Theme.primary;
|
||||
return root.isActive ? Theme.primary : Theme.surfaceText;
|
||||
}
|
||||
|
||||
RotationAnimation {
|
||||
@@ -52,7 +57,7 @@ BasePill {
|
||||
|
||||
onRunningChanged: {
|
||||
if (!running) {
|
||||
statusIcon.rotation = 0
|
||||
statusIcon.rotation = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -80,16 +85,21 @@ BasePill {
|
||||
id: statusIconHorizontal
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
name: {
|
||||
if (root.isChecking) return "refresh"
|
||||
if (SystemUpdateService.hasError) return "error"
|
||||
if (root.hasUpdates) return "system_update_alt"
|
||||
return "check_circle"
|
||||
if (root.isChecking)
|
||||
return "refresh";
|
||||
if (SystemUpdateService.hasError)
|
||||
return "error";
|
||||
if (root.hasUpdates)
|
||||
return "system_update_alt";
|
||||
return "check_circle";
|
||||
}
|
||||
size: Theme.barIconSize(root.barThickness, -4)
|
||||
color: {
|
||||
if (SystemUpdateService.hasError) return Theme.error
|
||||
if (root.hasUpdates) return Theme.primary
|
||||
return root.isActive ? Theme.primary : Theme.surfaceText
|
||||
if (SystemUpdateService.hasError)
|
||||
return Theme.error;
|
||||
if (root.hasUpdates)
|
||||
return Theme.primary;
|
||||
return root.isActive ? Theme.primary : Theme.surfaceText;
|
||||
}
|
||||
|
||||
RotationAnimation {
|
||||
@@ -104,7 +114,7 @@ BasePill {
|
||||
|
||||
onRunningChanged: {
|
||||
if (!running) {
|
||||
statusIconHorizontal.rotation = 0
|
||||
statusIconHorizontal.rotation = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -128,12 +138,12 @@ BasePill {
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onPressed: {
|
||||
if (popoutTarget && popoutTarget.setTriggerPosition) {
|
||||
const globalPos = root.visualContent.mapToGlobal(0, 0)
|
||||
const currentScreen = parentScreen || Screen
|
||||
const pos = SettingsData.getPopupTriggerPosition(globalPos, currentScreen, barThickness, root.visualWidth)
|
||||
popoutTarget.setTriggerPosition(pos.x, pos.y, pos.width, section, currentScreen)
|
||||
const globalPos = root.visualContent.mapToItem(null, 0, 0);
|
||||
const currentScreen = parentScreen || Screen;
|
||||
const pos = SettingsData.getPopupTriggerPosition(globalPos, currentScreen, barThickness, root.visualWidth);
|
||||
popoutTarget.setTriggerPosition(pos.x, pos.y, pos.width, section, currentScreen);
|
||||
}
|
||||
root.clicked()
|
||||
root.clicked();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user