From kde-commits Mon Jul 31 20:22:26 2017 From: Emmanuel Lepage Vallee Date: Mon, 31 Jul 2017 20:22:26 +0000 To: kde-commits Subject: [ring-kde/next] src/timeline/qml: peerstimeline: Better support HiDPI when searching Message-Id: X-MARC-Message: https://marc.info/?l=kde-commits&m=150153256119660 Git commit 80c34b8f72a5a06f8bbb811f84d2ff64fd1cb7bb by Emmanuel Lepage Vall= ee. Committed on 31/07/2017 at 17:41. Pushed by lepagevalleeemmanuel into branch 'next'. peerstimeline: Better support HiDPI when searching M +5 -0 src/timeline/qml/findpeers.qml M +19 -8 src/timeline/qml/searchdelegate.qml https://commits.kde.org/ring-kde/80c34b8f72a5a06f8bbb811f84d2ff64fd1cb7bb diff --git a/src/timeline/qml/findpeers.qml b/src/timeline/qml/findpeers.qml index e489f2b6..30e60896 100644 --- a/src/timeline/qml/findpeers.qml +++ b/src/timeline/qml/findpeers.qml @@ -18,11 +18,16 @@ import QtQuick 2.7 = ListView { + FontMetrics { + id: fontMetrics + } = Component { id: searchDelegate SearchDelegate { width: parent.width + buttonHeight: fontMetrics.height + 12 + labelHeight: fontMetrics.height } } = diff --git a/src/timeline/qml/searchdelegate.qml b/src/timeline/qml/searchd= elegate.qml index 7a1198ca..757671b0 100644 --- a/src/timeline/qml/searchdelegate.qml +++ b/src/timeline/qml/searchdelegate.qml @@ -24,9 +24,20 @@ import RingQmlWidgets 1.0 Item { id: componentItem width: parent.width - height: 70 + (temporary ? 30 : 0) + height: getHeight() + + function getHeight() { + return 4*labelHeight + 16 + (temporary ? buttonHeight : 0) + } = property QtObject contactMethod: object + property double buttonHeight: 30 + property double labelHeight: 30 + + TextMetrics { + id: accTextMetrics + text: accountAlias + } = RowLayout { anchors.margins: 3 @@ -36,8 +47,8 @@ Item { anchors.left: parent.left anchors.topMargin: 2 anchors.leftMargin: 2 - height: 46 - width: 46 + height: Math.min(46, 4*componentItem.labelHeight + 12) + width: Math.min(46, 4*componentItem.labelHeight + 12) = Rectangle { radius: 5 @@ -104,12 +115,12 @@ Item { Rectangle { color: activePalette.highlight radius: 99 - height: 16 + height: componentItem.labelHeight + 4 visible: accountAlias !=3D "" - width: 100 //TODO use font metric + width: accTextMetrics.width + 32 Text { id: accountAliasText - anchors.fill:parent + anchors.centerIn: parent anchors.leftMargin: 16 anchors.rightMargin: 16 text: accountAlias @@ -119,8 +130,8 @@ Item { } RowLayout { visible: temporary - height: 30 - Layout.preferredHeight: 30 + height: componentItem.buttonHeight + Layout.preferredHeight: componentItem.buttonHeight Layout.fillWidth: true Rectangle { id: contactRequestButton