mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-08-04 02:34:45 +00:00
move title and arrow in default compactrepresentation
This commit is contained in:
parent
0a00527788
commit
adba281d59
3 changed files with 42 additions and 51 deletions
|
|
@ -57,7 +57,7 @@ PlasmaCore.ColorScope {
|
||||||
//applet.anchors.fill = container;
|
//applet.anchors.fill = container;
|
||||||
applet.anchors.left = container.left;
|
applet.anchors.left = container.left;
|
||||||
applet.anchors.right = container.right;
|
applet.anchors.right = container.right;
|
||||||
applet.height = units.iconSizes.medium
|
applet.height = units.iconSizes.medium;
|
||||||
applet.visible = true;
|
applet.visible = true;
|
||||||
container.visible = true;
|
container.visible = true;
|
||||||
|
|
||||||
|
|
@ -119,6 +119,7 @@ PlasmaCore.ColorScope {
|
||||||
Component {
|
Component {
|
||||||
id: appletContainerComponent
|
id: appletContainerComponent
|
||||||
Item {
|
Item {
|
||||||
|
id: containerItem
|
||||||
property Item applet
|
property Item applet
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
clip: true
|
clip: true
|
||||||
|
|
@ -133,9 +134,13 @@ PlasmaCore.ColorScope {
|
||||||
easing.type: Easing.InOutQuad
|
easing.type: Easing.InOutQuad
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Rectangle {
|
||||||
|
id: bah
|
||||||
|
}
|
||||||
Connections {
|
Connections {
|
||||||
target: applet
|
target: applet
|
||||||
onExpandedChanged: {
|
onExpandedChanged: {
|
||||||
|
|
||||||
if (!applet.expanded && root.expandedApplet == applet) {
|
if (!applet.expanded && root.expandedApplet == applet) {
|
||||||
root.expandedApplet = null;
|
root.expandedApplet = null;
|
||||||
return;
|
return;
|
||||||
|
|
@ -146,6 +151,16 @@ PlasmaCore.ColorScope {
|
||||||
root.expandedApplet = applet;
|
root.expandedApplet = applet;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
id: mouseArea
|
||||||
|
|
||||||
|
property bool wasExpanded: false
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
onPressed: wasExpanded = applet.expanded
|
||||||
|
onClicked: applet.expanded = !wasExpanded
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,16 +23,11 @@ import org.kde.plasma.core 2.0 as PlasmaCore
|
||||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||||
import org.kde.kquickcontrolsaddons 2.0
|
import org.kde.kquickcontrolsaddons 2.0
|
||||||
|
|
||||||
PlasmaCore.ToolTipArea {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
objectName: "org.kde.desktop-CompactApplet"
|
objectName: "org.kde.desktop-CompactApplet"
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
icon: plasmoid.icon
|
|
||||||
mainText: plasmoid.toolTipMainText
|
|
||||||
subText: plasmoid.toolTipSubText
|
|
||||||
location: plasmoid.location
|
|
||||||
active: !plasmoid.expanded
|
|
||||||
property Item fullRepresentation
|
property Item fullRepresentation
|
||||||
property Item compactRepresentation
|
property Item compactRepresentation
|
||||||
property Item expandedFeedback: expandedItem
|
property Item expandedFeedback: expandedItem
|
||||||
|
|
@ -40,7 +35,10 @@ PlasmaCore.ToolTipArea {
|
||||||
onCompactRepresentationChanged: {
|
onCompactRepresentationChanged: {
|
||||||
if (compactRepresentation) {
|
if (compactRepresentation) {
|
||||||
compactRepresentation.parent = root;
|
compactRepresentation.parent = root;
|
||||||
compactRepresentation.anchors.fill = root;
|
compactRepresentation.anchors.left = root.left;
|
||||||
|
compactRepresentation.anchors.top = root.top;
|
||||||
|
compactRepresentation.width = units.iconSizes.medium;
|
||||||
|
compactRepresentation.height = compactRepresentation.width;
|
||||||
compactRepresentation.visible = true;
|
compactRepresentation.visible = true;
|
||||||
}
|
}
|
||||||
root.visible = true;
|
root.visible = true;
|
||||||
|
|
@ -51,31 +49,31 @@ PlasmaCore.ToolTipArea {
|
||||||
if (!fullRepresentation) {
|
if (!fullRepresentation) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* //if the fullRepresentation size was restored to a stored size, or if is dragged from the desktop, restore popup size
|
|
||||||
if (fullRepresentation.width > 0) {
|
|
||||||
appletParent.width = fullRepresentation.width;
|
|
||||||
} else if (fullRepresentation.Layout && fullRepresentation.Layout.preferredWidth > 0) {
|
|
||||||
appletParent.width = fullRepresentation.Layout.preferredWidth
|
|
||||||
} else if (fullRepresentation.implicitWidth > 0) {
|
|
||||||
appletParent.width = fullRepresentation.implicitWidth
|
|
||||||
} else {
|
|
||||||
appletParent.width = theme.mSize(theme.defaultFont).width * 35
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fullRepresentation.height > 0) {
|
|
||||||
appletParent.height = fullRepresentation.height;
|
|
||||||
} else if (fullRepresentation.Layout && fullRepresentation.Layout.preferredHeight > 0) {
|
|
||||||
appletParent.height = fullRepresentation.Layout.preferredHeight
|
|
||||||
} else if (fullRepresentation.implicitHeight > 0) {
|
|
||||||
appletParent.height = fullRepresentation.implicitHeight
|
|
||||||
} else {
|
|
||||||
appletParent.height = theme.mSize(theme.defaultFont).height * 25
|
|
||||||
}*/
|
|
||||||
|
|
||||||
fullRepresentation.parent = appletParent;
|
fullRepresentation.parent = appletParent;
|
||||||
fullRepresentation.anchors.fill = fullRepresentation.parent;
|
fullRepresentation.anchors.fill = fullRepresentation.parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
height: units.iconSizes.medium
|
||||||
|
anchors.left: compactRepresentation ? compactRepresentation.right : undefined
|
||||||
|
PlasmaCore.SvgItem {
|
||||||
|
svg: PlasmaCore.Svg {
|
||||||
|
id: arrowSvg
|
||||||
|
imagePath: "widgets/arrows"
|
||||||
|
colorGroup: PlasmaCore.Theme.ComplementaryColorGroup
|
||||||
|
}
|
||||||
|
width: units.iconSizes.smallMedium
|
||||||
|
height: width
|
||||||
|
elementId: plasmoid.expanded ? "up-arrow" : "down-arrow"
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
}
|
||||||
|
PlasmaComponents.Label {
|
||||||
|
text: plasmoid.title
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: expandedItem
|
id: expandedItem
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
@ -89,12 +87,6 @@ PlasmaCore.ToolTipArea {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Timer {
|
|
||||||
id: expandedSync
|
|
||||||
interval: 100
|
|
||||||
onTriggered: plasmoid.expanded = popupWindow.visible;
|
|
||||||
}
|
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: appletParent
|
id: appletParent
|
||||||
opacity: plasmoid.expanded ? 1 : 0
|
opacity: plasmoid.expanded ? 1 : 0
|
||||||
|
|
|
||||||
|
|
@ -21,9 +21,8 @@ import QtQuick.Layouts 1.1
|
||||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||||
|
|
||||||
Row {
|
Item {
|
||||||
id: main
|
id: main
|
||||||
spacing: units.largeSpacing
|
|
||||||
|
|
||||||
Layout.minimumWidth: {
|
Layout.minimumWidth: {
|
||||||
switch (plasmoid.formFactor) {
|
switch (plasmoid.formFactor) {
|
||||||
|
|
@ -54,21 +53,6 @@ Row {
|
||||||
colorGroup: PlasmaCore.Theme.ComplementaryColorGroup
|
colorGroup: PlasmaCore.Theme.ComplementaryColorGroup
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
}
|
}
|
||||||
PlasmaCore.SvgItem {
|
|
||||||
svg: PlasmaCore.Svg {
|
|
||||||
id: arrowSvg
|
|
||||||
imagePath: "widgets/arrows"
|
|
||||||
colorGroup: PlasmaCore.Theme.ComplementaryColorGroup
|
|
||||||
}
|
|
||||||
width: units.iconSizes.smallMedium
|
|
||||||
height: width
|
|
||||||
elementId: plasmoid.expanded ? "up-arrow" : "down-arrow"
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
}
|
|
||||||
PlasmaComponents.Label {
|
|
||||||
text: plasmoid.title
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
}
|
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
id: mouseArea
|
id: mouseArea
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue