From 377bac67beb788e7158781a5d79708c795946951 Mon Sep 17 00:00:00 2001 From: pokamest Date: Thu, 21 Oct 2021 18:10:28 +0300 Subject: [PATCH] QML ui fixes --- client/ui/qml/Pages/PageServerList.qml | 45 +++++++++++++++++++------- client/ui/qml/main.qml | 22 +------------ 2 files changed, 34 insertions(+), 33 deletions(-) diff --git a/client/ui/qml/Pages/PageServerList.qml b/client/ui/qml/Pages/PageServerList.qml index 9ebce873e..f4ba9bd2e 100644 --- a/client/ui/qml/Pages/PageServerList.qml +++ b/client/ui/qml/Pages/PageServerList.qml @@ -17,12 +17,12 @@ PageBase { Caption { id: caption text: qsTr("Servers list") + width: undefined } ImageButtonType { - x: 240 - y: 39 - anchors.left: caption.right + anchors.bottom: caption.bottom anchors.leftMargin: 10 + anchors.left: caption.right width: 24 height: 24 icon.source: "qrc:/images/plus.png" @@ -33,14 +33,17 @@ PageBase { ListView { id: listWidget_servers x: 20 - y: 90 - width: 340 - height: 501 + anchors.top: caption.bottom + anchors.topMargin: 15 + width: parent.width + anchors.bottom: parent.bottom + anchors.bottomMargin: 20 model: ServerListLogic.serverListModel spacing: 5 + clip: true delegate: Item { height: 60 - width: 341 + width: root.width - 40 MouseArea { id: ms anchors.fill: parent @@ -113,7 +116,7 @@ PageBase { visible: false } ImageButtonType { - x: 300 + x: parent.width - 30 y: 25 width: 24 height: 24 @@ -128,14 +131,13 @@ PageBase { } ImageButtonType { id: pushButtonSetting - x: 260 + x: parent.width - 60 y: 25 width: 24 height: 24 icon.source: "qrc:/images/settings.png" - onClicked: { - ServerListLogic.onServerListPushbuttonSettingsClicked(index) - } + opacity: 0 + OpacityAnimator { id: mouseEnterAni target: pushButtonSetting; @@ -154,6 +156,25 @@ PageBase { running: false easing.type: Easing.InOutQuad } + MouseArea { + cursorShape: Qt.PointingHandCursor + anchors.fill: parent + hoverEnabled: true + propagateComposedEvents: true + + onEntered: { + mouseExitAni.stop() + mouseEnterAni.start() + } + onExited: { + mouseEnterAni.stop() + mouseExitAni.start() + } + + onClicked: { + ServerListLogic.onServerListPushbuttonSettingsClicked(index) + } + } } } } diff --git a/client/ui/qml/main.qml b/client/ui/qml/main.qml index 3792c8881..1576b640f 100644 --- a/client/ui/qml/main.qml +++ b/client/ui/qml/main.qml @@ -152,35 +152,15 @@ Window { anchors.fill: parent focus: true -// initialItem: page_servers onCurrentItemChanged: { console.debug("QML onCurrentItemChanged " + pageLoader.currentItem) UiLogic.currentPageValue = currentItem.page } -// Keys.onReleased: { -// if (event.key === Qt.Key_Back || event.key === Qt.Key_Escape) { -// console.debug("Back button captured") -// if (UiLogic.currentPageValue !== PageEnum.VPN && -// UiLogic.currentPageValue !== PageEnum.ServerConfiguring && -// !(UiLogic.currentPageValue === PageEnum.Start && pageLoader.depth < 2)) { -// close_page(); -// } - - -// // TODO: fix -// //if (ui->stackedWidget_main->currentWidget()->isEnabled()) { -// // closePage(); -// //} - -// event.accepted = true -// } -// } - Keys.onPressed: { UiLogic.keyPressEvent(event.key) + event.accepted = true } - } FolderListModel {