From d766d0084a412f45dba87136da72411bae668a0f Mon Sep 17 00:00:00 2001 From: Nodir Temirkhodjaev Date: Mon, 22 Apr 2019 13:36:52 +0500 Subject: [PATCH] UI: Tweak selected items highlighting. --- src/ui/fort_qml.qrc | 1 + src/ui/qml/controls/ListViewControl.qml | 12 ++++++------ src/ui/qml/controls/TabBarControl.qml | 14 ++++++++++++++ src/ui/qml/pages/AddressesPage.qml | 2 +- src/ui/qml/pages/ApplicationsPage.qml | 2 +- src/ui/qml/pages/MainPage.qml | 2 +- src/ui/qml/pages/StatisticsPage.qml | 2 +- src/ui/qml/pages/log/AppListView.qml | 9 ++++++--- 8 files changed, 31 insertions(+), 13 deletions(-) create mode 100644 src/ui/qml/controls/TabBarControl.qml diff --git a/src/ui/fort_qml.qrc b/src/ui/fort_qml.qrc index b9fd7b6f..615a0286 100644 --- a/src/ui/fort_qml.qrc +++ b/src/ui/fort_qml.qrc @@ -16,6 +16,7 @@ qml/controls/SpinDouble.qml qml/controls/SpinDoubleRow.qml qml/controls/SwipeViewControl.qml + qml/controls/TabBarControl.qml qml/controls/TextAreaFrame.qml qml/controls/TextContextMenu.qml qml/controls/TextFieldFrame.qml diff --git a/src/ui/qml/controls/ListViewControl.qml b/src/ui/qml/controls/ListViewControl.qml index 36d0f389..4fd8064b 100644 --- a/src/ui/qml/controls/ListViewControl.qml +++ b/src/ui/qml/controls/ListViewControl.qml @@ -19,12 +19,12 @@ ListView { highlight: Item { Rectangle { - anchors.fill: parent - anchors.margins: 1 - listView.spacing / 2 - border.width - radius: 2 - border.width: 3 - border.color: palette.highlight - color: "transparent" + anchors.top: parent.top + anchors.bottom: parent.bottom + anchors.left: parent.left + anchors.margins: -8 + width: 3 + color: palette.highlight } } diff --git a/src/ui/qml/controls/TabBarControl.qml b/src/ui/qml/controls/TabBarControl.qml new file mode 100644 index 00000000..3ead25c9 --- /dev/null +++ b/src/ui/qml/controls/TabBarControl.qml @@ -0,0 +1,14 @@ +import QtQuick 2.12 +import QtQuick.Controls 2.12 + +TabBar { + id: tabBar + + Rectangle { + parent: tabBar.currentItem + anchors.left: parent.left + anchors.right: parent.right + height: 3 + color: palette.highlight + } +} diff --git a/src/ui/qml/pages/AddressesPage.qml b/src/ui/qml/pages/AddressesPage.qml index fd7fb98b..b25eb384 100644 --- a/src/ui/qml/pages/AddressesPage.qml +++ b/src/ui/qml/pages/AddressesPage.qml @@ -10,7 +10,7 @@ BasePage { ColumnLayout { anchors.fill: parent - TabBar { + TabBarControl { id: barGroups Layout.fillWidth: true diff --git a/src/ui/qml/pages/ApplicationsPage.qml b/src/ui/qml/pages/ApplicationsPage.qml index 240951ef..7f474ba5 100644 --- a/src/ui/qml/pages/ApplicationsPage.qml +++ b/src/ui/qml/pages/ApplicationsPage.qml @@ -109,7 +109,7 @@ BasePage { } } - TabBar { + TabBarControl { id: barGroups Layout.fillWidth: true clip: true diff --git a/src/ui/qml/pages/MainPage.qml b/src/ui/qml/pages/MainPage.qml index 9876a9eb..9f27aebe 100644 --- a/src/ui/qml/pages/MainPage.qml +++ b/src/ui/qml/pages/MainPage.qml @@ -71,7 +71,7 @@ Page { tabBar.currentItem.forceActiveFocus(); } - header: TabBar { + header: TabBarControl { id: tabBar currentIndex: swipeView.currentIndex diff --git a/src/ui/qml/pages/StatisticsPage.qml b/src/ui/qml/pages/StatisticsPage.qml index c61592af..11145a9c 100644 --- a/src/ui/qml/pages/StatisticsPage.qml +++ b/src/ui/qml/pages/StatisticsPage.qml @@ -188,7 +188,7 @@ BasePage { Layout.fillHeight: true spacing: 10 - TabBar { + TabBarControl { id: tabBar Layout.fillWidth: true diff --git a/src/ui/qml/pages/log/AppListView.qml b/src/ui/qml/pages/log/AppListView.qml index 62f39395..7797edb4 100644 --- a/src/ui/qml/pages/log/AppListView.qml +++ b/src/ui/qml/pages/log/AppListView.qml @@ -19,21 +19,24 @@ ListViewControl { width: appListView.width spacing: 6 - readonly property string appPath: display + readonly property bool isCurrent: ListView.isCurrentItem + readonly property int iconWidth: isCurrent ? 32 : 22 + readonly property string appPath: display readonly property var appInfo: appInfoCache.infoTrigger && appInfoCache.appInfo(appPath) Image { Layout.topMargin: 1 - Layout.preferredWidth: 22 - Layout.preferredHeight: 22 + Layout.preferredWidth: appItem.iconWidth + Layout.preferredHeight: appItem.iconWidth source: (!appItem.appPath && emptyIcon) || appInfo.iconPath || "qrc:/images/application.png" } Label { Layout.fillWidth: true + color: appItem.isCurrent ? palette.highlight : palette.windowText font.pixelSize: 18 elide: Text.ElideRight text: (!appItem.appPath && emptyText)