Support right position display
This commit is contained in:
parent
b859b34a67
commit
05fe254121
5 changed files with 42 additions and 15 deletions
|
@ -8,8 +8,11 @@ Item {
|
||||||
id: control
|
id: control
|
||||||
|
|
||||||
property bool isLeft: Settings.direction === DockSettings.Left
|
property bool isLeft: Settings.direction === DockSettings.Left
|
||||||
|
property bool isRight: Settings.direction === DockSettings.Right
|
||||||
|
property bool isBottom: Settings.direction === DockSettings.Bottom
|
||||||
|
|
||||||
property var iconSize: (isLeft ? control.height : control.width) * iconSizeRatio
|
property var iconSize: root.isHorizontal ? control.height * iconSizeRatio
|
||||||
|
: control.width * iconSizeRatio
|
||||||
|
|
||||||
property bool draggable: false
|
property bool draggable: false
|
||||||
property int dragItemIndex
|
property int dragItemIndex
|
||||||
|
@ -121,6 +124,9 @@ Item {
|
||||||
if (Settings.direction === DockSettings.Left)
|
if (Settings.direction === DockSettings.Left)
|
||||||
popupTips.position = Qt.point(root.width + Meui.Units.largeSpacing,
|
popupTips.position = Qt.point(root.width + Meui.Units.largeSpacing,
|
||||||
control.mapToGlobal(0, 0).y + (control.height / 2 - popupTips.height / 2))
|
control.mapToGlobal(0, 0).y + (control.height / 2 - popupTips.height / 2))
|
||||||
|
else if (Settings.direction === DockSettings.Right)
|
||||||
|
popupTips.position = Qt.point(control.mapToGlobal(0, 0).x - popupTips.width - Meui.Units.smallSpacing / 2,
|
||||||
|
control.mapToGlobal(0, 0).y + (control.height / 2 - popupTips.height / 2))
|
||||||
else
|
else
|
||||||
popupTips.position = Qt.point(control.mapToGlobal(0, 0).x + (control.width / 2 - popupTips.width / 2),
|
popupTips.position = Qt.point(control.mapToGlobal(0, 0).x + (control.width / 2 - popupTips.width / 2),
|
||||||
control.mapToGlobal(0, 0).y - popupTips.height - Meui.Units.smallSpacing / 2)
|
control.mapToGlobal(0, 0).y - popupTips.height - Meui.Units.smallSpacing / 2)
|
||||||
|
@ -134,13 +140,25 @@ Item {
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: activeLine
|
id: activeLine
|
||||||
width: isLeft ? parent.width * 0.06 : (isActive ? parent.height * 0.4 : parent.height * 0.06)
|
width: !isBottom ? parent.width * 0.06 : (isActive ? parent.height * 0.4 : parent.height * 0.06)
|
||||||
height: isLeft ? (isActive ? parent.height * 0.4 : parent.height * 0.06) : parent.height * 0.06
|
height: !isBottom ? (isActive ? parent.height * 0.4 : parent.height * 0.06) : parent.height * 0.06
|
||||||
color: Meui.Theme.textColor
|
color: Meui.Theme.textColor
|
||||||
radius: isLeft ? width / 2 : height / 2
|
radius: !isBottom ? width / 2 : height / 2
|
||||||
visible: enableActivateDot && !dragStarted
|
visible: enableActivateDot && !dragStarted
|
||||||
opacity: isActive ? 1 : 0.6
|
opacity: isActive ? 1 : 0.6
|
||||||
|
|
||||||
|
property var leftX: 3
|
||||||
|
property var leftY: (parent.height - height) / 2
|
||||||
|
|
||||||
|
property var bottomX: (parent.width - width) / 2
|
||||||
|
property var bottomY: icon.y + icon.height + activeLine.height / 2 - 2
|
||||||
|
|
||||||
|
property var rightX: icon.x + icon.width + activeLine.width / 2 - 2
|
||||||
|
property var rightY: (parent.height - height) / 2
|
||||||
|
|
||||||
|
x: isLeft ? leftX : isBottom ? bottomX : rightX
|
||||||
|
y: isLeft ? leftY : isBottom ? bottomY : rightY
|
||||||
|
|
||||||
Behavior on opacity {
|
Behavior on opacity {
|
||||||
NumberAnimation {
|
NumberAnimation {
|
||||||
duration: 125
|
duration: 125
|
||||||
|
@ -150,20 +168,16 @@ Item {
|
||||||
|
|
||||||
Behavior on width {
|
Behavior on width {
|
||||||
NumberAnimation {
|
NumberAnimation {
|
||||||
duration: !isLeft ? 125 : 0
|
duration: isBottom ? 125 : 0
|
||||||
easing.type: Easing.InOutCubic
|
easing.type: Easing.InOutCubic
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Behavior on height {
|
Behavior on height {
|
||||||
NumberAnimation {
|
NumberAnimation {
|
||||||
duration: isLeft ? 125 : 0
|
duration: !isBottom ? 125 : 0
|
||||||
easing.type: Easing.InOutCubic
|
easing.type: Easing.InOutCubic
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
x: isLeft ? 3 : (parent.width - width) / 2
|
|
||||||
y: isLeft ? (parent.height - height) / 2 : icon.y + icon.height + activeLine.height / 2 - 2
|
|
||||||
// 1 is the window border
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,9 +11,8 @@ Item {
|
||||||
visible: true
|
visible: true
|
||||||
|
|
||||||
property color borderColor: Meui.Theme.darkMode ? Qt.rgba(255, 255, 255, 0.1) : Qt.rgba(0, 0, 0, 0.05)
|
property color borderColor: Meui.Theme.darkMode ? Qt.rgba(255, 255, 255, 0.1) : Qt.rgba(0, 0, 0, 0.05)
|
||||||
property real windowRadius: Settings.roundedWindowEnabled ? (Settings.direction === DockSettings.Left) ? root.width * 0.25 : root.height * 0.25
|
property bool isHorizontal: Settings.direction === DockSettings.Bottom
|
||||||
: 0
|
property real windowRadius: isHorizontal ? root.height * 0.25 : root.width * 0.25
|
||||||
property bool isHorizontal: Settings.direction !== DockSettings.Left
|
|
||||||
|
|
||||||
DropArea {
|
DropArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
|
@ -35,7 +35,8 @@ class DockSettings : public QObject
|
||||||
public:
|
public:
|
||||||
enum Direction {
|
enum Direction {
|
||||||
Left = 0,
|
Left = 0,
|
||||||
Bottom
|
Bottom,
|
||||||
|
Right
|
||||||
};
|
};
|
||||||
Q_ENUMS(Direction)
|
Q_ENUMS(Direction)
|
||||||
|
|
||||||
|
|
|
@ -103,7 +103,6 @@ QRect MainWindow::windowRect() const
|
||||||
case DockSettings::Left:
|
case DockSettings::Left:
|
||||||
newSize = QSize(iconSize, length);
|
newSize = QSize(iconSize, length);
|
||||||
position.setX(screenGeometry.x() + DockSettings::self()->edgeMargins() / 2);
|
position.setX(screenGeometry.x() + DockSettings::self()->edgeMargins() / 2);
|
||||||
|
|
||||||
// Handle the top statusbar.
|
// Handle the top statusbar.
|
||||||
position.setY(availableGeometry.y() + (availableGeometry.height() - newSize.height()) / 2);
|
position.setY(availableGeometry.y() + (availableGeometry.height() - newSize.height()) / 2);
|
||||||
break;
|
break;
|
||||||
|
@ -112,6 +111,11 @@ QRect MainWindow::windowRect() const
|
||||||
position.setX(screenGeometry.x() + (screenGeometry.width() - newSize.width()) / 2);
|
position.setX(screenGeometry.x() + (screenGeometry.width() - newSize.width()) / 2);
|
||||||
position.setY(screenGeometry.y() + screenGeometry.height() - newSize.height() - DockSettings::self()->edgeMargins() / 2);
|
position.setY(screenGeometry.y() + screenGeometry.height() - newSize.height() - DockSettings::self()->edgeMargins() / 2);
|
||||||
break;
|
break;
|
||||||
|
case DockSettings::Right:
|
||||||
|
newSize = QSize(iconSize, length);
|
||||||
|
position.setX(screenGeometry.x() + screenGeometry.width() - newSize.width() - DockSettings::self()->edgeMargins() / 2);
|
||||||
|
position.setY(availableGeometry.y() + (availableGeometry.height() - newSize.height()) / 2);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -133,6 +137,8 @@ void MainWindow::initSlideWindow()
|
||||||
|
|
||||||
if (m_settings->direction() == DockSettings::Left)
|
if (m_settings->direction() == DockSettings::Left)
|
||||||
location = KWindowEffects::LeftEdge;
|
location = KWindowEffects::LeftEdge;
|
||||||
|
else if (m_settings->direction() == DockSettings::Right)
|
||||||
|
location = KWindowEffects::RightEdge;
|
||||||
else if (m_settings->direction() == DockSettings::Bottom)
|
else if (m_settings->direction() == DockSettings::Bottom)
|
||||||
location = KWindowEffects::BottomEdge;
|
location = KWindowEffects::BottomEdge;
|
||||||
|
|
||||||
|
|
|
@ -167,6 +167,13 @@ void XWindowInterface::setViewStruts(QWindow *view, DockSettings::Direction dire
|
||||||
strut.bottom_end = rect.x() + rect.width();
|
strut.bottom_end = rect.x() + rect.width();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case DockSettings::Right: {
|
||||||
|
const int rightOffset = {wholeScreen.right() - currentScreen.right()};
|
||||||
|
strut.right_width = rect.width() + rightOffset + DockSettings::self()->edgeMargins();
|
||||||
|
strut.right_start = rect.y();
|
||||||
|
strut.right_end = rect.y() + rect.height() - 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue