last 7 months of qs changes
This commit is contained in:
parent
2c64563ade
commit
4b90113a54
103 changed files with 3467 additions and 1415 deletions
|
|
@ -1,12 +1,12 @@
|
|||
import QtQuick
|
||||
import Quickshell
|
||||
import "root:/"
|
||||
|
||||
Item {
|
||||
id: root
|
||||
required property var tooltip;
|
||||
required property Item owner;
|
||||
property bool isMenu: false;
|
||||
property list<QtObject> grabWindows;
|
||||
property bool hoverable: isMenu;
|
||||
property bool animateSize: true;
|
||||
property bool show: false;
|
||||
|
|
@ -17,47 +17,35 @@ Item {
|
|||
|
||||
signal close();
|
||||
|
||||
readonly property alias contentItem: contentItem;
|
||||
default property alias data: contentItem.data;
|
||||
|
||||
property Component backgroundComponent: BarWidgetInner {
|
||||
color: ShellGlobals.colors.bar
|
||||
anchors.fill: parent
|
||||
}
|
||||
property Component backgroundComponent: null
|
||||
|
||||
onShowChanged: {
|
||||
if (show) {
|
||||
hangTimer.stop();
|
||||
tooltip.setItem(this);
|
||||
} else if (hangTime == 0) {
|
||||
tooltip.removeItem(this);
|
||||
} else hangTimer.start();
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: hangTimer
|
||||
interval: hangTime
|
||||
onTriggered: tooltip.removeItem(root);
|
||||
if (show) tooltip.setItem(this);
|
||||
else tooltip.removeItem(this);
|
||||
}
|
||||
|
||||
property bool targetVisible: false
|
||||
property real targetOpacity: 0
|
||||
opacity: targetOpacity / 1000
|
||||
opacity: root.targetOpacity * (tooltip.scaleMul == 0 ? 0 : (1.0 / tooltip.scaleMul))
|
||||
|
||||
Behavior on targetOpacity {
|
||||
id: opacityAnimation
|
||||
SmoothedAnimation { velocity: 5000 }
|
||||
SmoothedAnimation { velocity: 5 }
|
||||
}
|
||||
|
||||
function snapOpacity(opacity: real) {
|
||||
opacityAnimation.enabled = false;
|
||||
targetOpacity = opacity * 1000
|
||||
targetOpacity = opacity;
|
||||
opacityAnimation.enabled = true;
|
||||
}
|
||||
|
||||
onTargetVisibleChanged: {
|
||||
if (targetVisible) {
|
||||
visible = true;
|
||||
targetOpacity = 1000;
|
||||
targetOpacity = 1;
|
||||
} else {
|
||||
close()
|
||||
targetOpacity = 0;
|
||||
|
|
@ -68,20 +56,21 @@ Item {
|
|||
if (!targetVisible && targetOpacity == 0) {
|
||||
visible = false;
|
||||
this.parent = null;
|
||||
if (tooltip) tooltip.onHidden(this);
|
||||
}
|
||||
}
|
||||
|
||||
anchors.fill: parent
|
||||
visible: false
|
||||
clip: true
|
||||
implicitHeight: contentItem.implicitHeight + 10
|
||||
implicitWidth: contentItem.implicitWidth + 10
|
||||
//clip: true
|
||||
implicitHeight: contentItem.implicitHeight + contentItem.anchors.leftMargin + contentItem.anchors.rightMargin
|
||||
implicitWidth: contentItem.implicitWidth + contentItem.anchors.leftMargin + contentItem.anchors.rightMargin
|
||||
|
||||
readonly property Item item: contentItem;
|
||||
|
||||
Loader {
|
||||
anchors.fill: parent
|
||||
active: root.visible || root.preloadBackground
|
||||
active: root.backgroundComponent && (root.visible || root.preloadBackground)
|
||||
asynchronous: !root.visible && root.preloadBackground
|
||||
sourceComponent: backgroundComponent
|
||||
}
|
||||
|
|
@ -91,7 +80,7 @@ Item {
|
|||
anchors.fill: parent
|
||||
anchors.margins: 5
|
||||
|
||||
implicitHeight: childrenRect.height
|
||||
implicitWidth: childrenRect.width
|
||||
implicitHeight: children[0].implicitHeight
|
||||
implicitWidth: children[0].implicitWidth
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue