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
|
||||
|
||||
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 int dragItemIndex
|
||||
|
@ -121,6 +124,9 @@ Item {
|
|||
if (Settings.direction === DockSettings.Left)
|
||||
popupTips.position = Qt.point(root.width + Meui.Units.largeSpacing,
|
||||
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
|
||||
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)
|
||||
|
@ -134,13 +140,25 @@ Item {
|
|||
|
||||
Rectangle {
|
||||
id: activeLine
|
||||
width: isLeft ? 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
|
||||
width: !isBottom ? parent.width * 0.06 : (isActive ? parent.height * 0.4 : parent.height * 0.06)
|
||||
height: !isBottom ? (isActive ? parent.height * 0.4 : parent.height * 0.06) : parent.height * 0.06
|
||||
color: Meui.Theme.textColor
|
||||
radius: isLeft ? width / 2 : height / 2
|
||||
radius: !isBottom ? width / 2 : height / 2
|
||||
visible: enableActivateDot && !dragStarted
|
||||
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 {
|
||||
NumberAnimation {
|
||||
duration: 125
|
||||
|
@ -150,20 +168,16 @@ Item {
|
|||
|
||||
Behavior on width {
|
||||
NumberAnimation {
|
||||
duration: !isLeft ? 125 : 0
|
||||
duration: isBottom ? 125 : 0
|
||||
easing.type: Easing.InOutCubic
|
||||
}
|
||||
}
|
||||
|
||||
Behavior on height {
|
||||
NumberAnimation {
|
||||
duration: isLeft ? 125 : 0
|
||||
duration: !isBottom ? 125 : 0
|
||||
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
|
||||
|
||||
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
|
||||
: 0
|
||||
property bool isHorizontal: Settings.direction !== DockSettings.Left
|
||||
property bool isHorizontal: Settings.direction === DockSettings.Bottom
|
||||
property real windowRadius: isHorizontal ? root.height * 0.25 : root.width * 0.25
|
||||
|
||||
DropArea {
|
||||
anchors.fill: parent
|
||||
|
|
|
@ -35,7 +35,8 @@ class DockSettings : public QObject
|
|||
public:
|
||||
enum Direction {
|
||||
Left = 0,
|
||||
Bottom
|
||||
Bottom,
|
||||
Right
|
||||
};
|
||||
Q_ENUMS(Direction)
|
||||
|
||||
|
|
|
@ -103,7 +103,6 @@ QRect MainWindow::windowRect() const
|
|||
case DockSettings::Left:
|
||||
newSize = QSize(iconSize, length);
|
||||
position.setX(screenGeometry.x() + DockSettings::self()->edgeMargins() / 2);
|
||||
|
||||
// Handle the top statusbar.
|
||||
position.setY(availableGeometry.y() + (availableGeometry.height() - newSize.height()) / 2);
|
||||
break;
|
||||
|
@ -112,6 +111,11 @@ QRect MainWindow::windowRect() const
|
|||
position.setX(screenGeometry.x() + (screenGeometry.width() - newSize.width()) / 2);
|
||||
position.setY(screenGeometry.y() + screenGeometry.height() - newSize.height() - DockSettings::self()->edgeMargins() / 2);
|
||||
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:
|
||||
break;
|
||||
}
|
||||
|
@ -133,6 +137,8 @@ void MainWindow::initSlideWindow()
|
|||
|
||||
if (m_settings->direction() == DockSettings::Left)
|
||||
location = KWindowEffects::LeftEdge;
|
||||
else if (m_settings->direction() == DockSettings::Right)
|
||||
location = KWindowEffects::RightEdge;
|
||||
else if (m_settings->direction() == DockSettings::Bottom)
|
||||
location = KWindowEffects::BottomEdge;
|
||||
|
||||
|
|
|
@ -167,6 +167,13 @@ void XWindowInterface::setViewStruts(QWindow *view, DockSettings::Direction dire
|
|||
strut.bottom_end = rect.x() + rect.width();
|
||||
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:
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue