diff options
author | Egor Nemtsev <enemtsev@luxoft.com> | 2020-01-31 20:02:13 +0300 |
---|---|---|
committer | Egor Nemtsev <enemtsev@luxoft.com> | 2020-02-19 10:39:40 +0000 |
commit | 5a5d1c12a2f123c0c6c5782d42a1d079fe1adb75 (patch) | |
tree | 7b286ce9d53fc1edddbec0851074a16e3afafa3c /sysui | |
parent | 4ea370f96765562e8eba888be081270c1c8941dd (diff) |
[sysui] Fix NeptuneIconLabel to scale correctly on Desktop
- IconLabel doesn't report pixel size of image. On Mac dpi switching is not
handled well. To handle issue with wrong icon scaling we:
1. Connect to status change signal to call layout() and update composite item
2. Apply scaling via inner image item scale for non-Pad fill mode
Above applies to situation when we just render scaled image, then size of
rendered image is equal to
image_pixel_width * scale X image_pixel_height * scale. For situation
when we want to have icon of particular size, iconRectWidth, iconRectHeight
and iconFillMode properties are introduced.
Some images are expanded by 1 pixel to handle scaling more nicely
Task-number: AUTOSUITE-1304
Change-Id: Ia08c073944eb8ec55309c4aabaf54e7d3961a56f
Reviewed-by: Grigorii Zimin <gzimin@luxoft.com>
Diffstat (limited to 'sysui')
-rw-r--r-- | sysui/centerconsole/CenterConsole.qml | 22 | ||||
-rw-r--r-- | sysui/home/+lucee/ApplicationWidget.qml | 6 | ||||
-rw-r--r-- | sysui/home/ApplicationWidget.qml | 28 | ||||
-rw-r--r-- | sysui/launcher/+lucee/AppIcon.qml | 3 | ||||
-rw-r--r-- | sysui/launcher/+lucee/HomeButton.qml | 40 | ||||
-rw-r--r-- | sysui/launcher/HomeButton.qml | 52 | ||||
-rw-r--r-- | sysui/launcher/Launcher.qml | 16 | ||||
-rw-r--r-- | sysui/statusbar/+lucee/StatusBar.qml | 3 |
8 files changed, 27 insertions, 143 deletions
diff --git a/sysui/centerconsole/CenterConsole.qml b/sysui/centerconsole/CenterConsole.qml index cfafa336..26cdb915 100644 --- a/sysui/centerconsole/CenterConsole.qml +++ b/sysui/centerconsole/CenterConsole.qml @@ -64,17 +64,6 @@ AbstractCenterConsole { onClicked: volumePopup.open() enabled: mainContentArea.item && !mainContentArea.item.launcherOpen opacity: enabled ? 1.0 : 0.6 - - // content item of ToolButton is not scaled correctly in some screen resolutions - // need to revert this changes once: QTBUG-72569 is fixed. - contentItem: null - NeptuneIconLabel { - anchors.centerIn: parent - width: Sizes.dp(50) - height: Sizes.dp(50) - icon: leftIcon.icon - color: leftIcon.icon.color - } } ToolButton { @@ -88,17 +77,6 @@ AbstractCenterConsole { onClicked: about.open() enabled: mainContentArea.item && !mainContentArea.item.launcherOpen opacity: enabled ? 1.0 : 0.6 - - // content item of ToolButton is not scaled correctly in some screen resolutions - // need to revert this changes once: QTBUG-72569 is fixed. - contentItem: null - NeptuneIconLabel { - anchors.centerIn: parent - width: Sizes.dp(50) - height: Sizes.dp(50) - icon: rightIcon.icon - color: rightIcon.icon.color - } } PopupItemLoader { diff --git a/sysui/home/+lucee/ApplicationWidget.qml b/sysui/home/+lucee/ApplicationWidget.qml index d6ec3ef6..3705168e 100644 --- a/sysui/home/+lucee/ApplicationWidget.qml +++ b/sysui/home/+lucee/ApplicationWidget.qml @@ -83,8 +83,10 @@ AbstractApplicationWidget { // Application icon NeptuneIconLabel { - width: Sizes.dp(35) - height: Sizes.dp(35) + display: NeptuneIconLabel.IconOnly + iconFillMode: Image.PreserveAspectFit + iconRectHeight: Sizes.dp(35) + iconRectWidth: iconRectHeight anchors.centerIn: widgetStripe icon.source: root.appInfo ? root.appInfo.icon : null icon.color: "white" diff --git a/sysui/home/ApplicationWidget.qml b/sysui/home/ApplicationWidget.qml index 90fbeb43..7d70ce7f 100644 --- a/sysui/home/ApplicationWidget.qml +++ b/sysui/home/ApplicationWidget.qml @@ -72,11 +72,13 @@ AbstractApplicationWidget { // Application icon NeptuneIconLabel { - width: Sizes.dp(25) - height: Sizes.dp(25) + display: NeptuneIconLabel.IconOnly + iconFillMode: Image.PreserveAspectFit + iconRectHeight: Sizes.dp(25) + iconRectWidth: iconRectHeight anchors.horizontalCenter: widgetStripe.horizontalCenter anchors.top: widgetStripe.top - anchors.topMargin: widgetStripe.border.top * 0.8 + anchors.topMargin: iconRectHeight * 0.8 icon.source: root.appInfo ? root.appInfo.icon : null icon.color: "white" opacity: root.active ? 0 : 1 @@ -107,24 +109,24 @@ AbstractApplicationWidget { ToolButton { anchors.horizontalCenter: widgetStripe.horizontalCenter anchors.bottom: parent.bottom + anchors.bottomMargin: implicitWidth objectName: "appWidgetClose_" + (root.appInfo ? (root.appInfo.id ? root.appInfo.id : "none") : "nothing" ) - implicitWidth: widgetStripe.width + Sizes.dp(18) - implicitHeight: width + implicitWidth: Sizes.dp(25) + implicitHeight: implicitWidth visible: root.buttonsVisible onClicked: root.closeClicked() - - contentItem: NeptuneIconLabel { - anchors.centerIn: parent - width: Sizes.dp(25) - height: Sizes.dp(25) - icon.color: "white" - icon.source: Style.image("ic-widget-close") - } + iconFillMode: Image.PreserveAspectFit + display: NeptuneIconLabel.IconOnly + iconRectHeight: implicitWidth + iconRectWidth: implicitWidth + icon.color: "white" + icon.source: Style.image("ic-widget-close") + padding: 0 } // Maximize button diff --git a/sysui/launcher/+lucee/AppIcon.qml b/sysui/launcher/+lucee/AppIcon.qml index 4f3aedd6..c3225faf 100644 --- a/sysui/launcher/+lucee/AppIcon.qml +++ b/sysui/launcher/+lucee/AppIcon.qml @@ -37,6 +37,9 @@ import shared.Style 1.0 NeptuneIconLabel { property bool checked: false property string source + iconFillMode: Image.PreserveAspectFit + iconRectHeight: height + iconRectWidth: width icon.color: checked ? Style.accentColor : "white" icon.source: source } diff --git a/sysui/launcher/+lucee/HomeButton.qml b/sysui/launcher/+lucee/HomeButton.qml deleted file mode 100644 index a73e97b3..00000000 --- a/sysui/launcher/+lucee/HomeButton.qml +++ /dev/null @@ -1,40 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2019 Luxoft Sweden AB -** Copyright (C) 2018 Pelagicore AG -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Neptune 3 UI. -** -** $QT_BEGIN_LICENSE:GPL-QTAS$ -** Commercial License Usage -** Licensees holding valid commercial Qt Automotive Suite licenses may use -** this file in accordance with the commercial license agreement provided -** with the Software or, alternatively, in accordance with the terms -** contained in a written agreement between you and The Qt Company. For -** licensing terms and conditions see https://www.qt.io/terms-conditions. -** For further information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -** SPDX-License-Identifier: GPL-3.0 -** -****************************************************************************/ - -import QtQuick 2.6 -import QtQuick.Controls 2.2 -import shared.Style 1.0 - -ToolButton { - checkable: false - icon.color: (checked || highlighted) ? Style.accentColor : "white" -} diff --git a/sysui/launcher/HomeButton.qml b/sysui/launcher/HomeButton.qml deleted file mode 100644 index 2132f7e0..00000000 --- a/sysui/launcher/HomeButton.qml +++ /dev/null @@ -1,52 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2019 Luxoft Sweden AB -** Copyright (C) 2018 Pelagicore AG -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Neptune 3 UI. -** -** $QT_BEGIN_LICENSE:GPL-QTAS$ -** Commercial License Usage -** Licensees holding valid commercial Qt Automotive Suite licenses may use -** this file in accordance with the commercial license agreement provided -** with the Software or, alternatively, in accordance with the terms -** contained in a written agreement between you and The Qt Company. For -** licensing terms and conditions see https://www.qt.io/terms-conditions. -** For further information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -** SPDX-License-Identifier: GPL-3.0 -** -****************************************************************************/ - -import QtQuick 2.6 -import QtQuick.Controls 2.2 -import shared.controls 1.0 -import shared.Sizes 1.0 - -ToolButton { - id: root - icon.color: "white" - contentItem: null - checkable: false - // content item of ToolButton is not scaled correctly in some screen resolutions - // need to revert this changes once: QTBUG-72569 is fixed. - NeptuneIconLabel { - anchors.centerIn: parent - width: Sizes.dp(35) - height: Sizes.dp(35) - icon: root.icon - color: root.icon.color - } -} diff --git a/sysui/launcher/Launcher.qml b/sysui/launcher/Launcher.qml index 6a1a8cf9..8bddacce 100644 --- a/sysui/launcher/Launcher.qml +++ b/sysui/launcher/Launcher.qml @@ -67,7 +67,7 @@ Item { id: buttonGroup } - HomeButton { + ToolButton { id: homeButton anchors.top: parent.top @@ -75,8 +75,9 @@ Item { anchors.leftMargin: Sizes.dp(134) - width/2 width: Sizes.dp(90) height: Sizes.dp(90) - + icon.color: Style.contrastColor icon.name: "ic-menu-home" + display: NeptuneIconLabel.IconOnly ButtonGroup.group: buttonGroup checkable: true checked: !_isThereActiveApp @@ -111,17 +112,6 @@ Item { icon.name: useCloseIcon ? "ic-close" : "ic-menu-allapps" icon.color: "white" checkable: true - - // content item of ToolButton is not scaled correctly in some screen resolutions - // need to revert this changes once: QTBUG-72569 is fixed. - contentItem: null - NeptuneIconLabel { - anchors.centerIn: parent - width: Sizes.dp(35) - height: Sizes.dp(35) - icon: gridButton.icon - color: gridButton.icon.color - } onClicked: gridButton.gridOpen = !gridButton.gridOpen } diff --git a/sysui/statusbar/+lucee/StatusBar.qml b/sysui/statusbar/+lucee/StatusBar.qml index b52fd2b9..bab1efbf 100644 --- a/sysui/statusbar/+lucee/StatusBar.qml +++ b/sysui/statusbar/+lucee/StatusBar.qml @@ -72,7 +72,8 @@ Item { spacing: Sizes.dp(5) ToolButton { - Layout.preferredWidth: Sizes.dp(60) + padding: 0 + Layout.preferredWidth: Sizes.dp(64) Layout.fillHeight: true id: volumeIcon objectName: "volumePopupButton" |