From 8ac9c0c3dfcec06f4d39b8616c2bf2b8048f694c Mon Sep 17 00:00:00 2001 From: Mitch Curtis <mitch.curtis@digia.com> Date: Thu, 17 Jul 2014 15:38:29 +0200 Subject: [PATCH] Improve implicit size of Calendar on high DPI devices. Task-number: QTBUG-39473 Change-Id: Ibfb1c040efd9744ba6c8bc56affcdf90a807b046 Reviewed-by: J-P Nurmi <jpnurmi@digia.com> --- examples/quick/controls/calendar/qml/main.qml | 7 ++++++- src/controls/Styles/Base/CalendarStyle.qml | 12 ++++++------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/examples/quick/controls/calendar/qml/main.qml b/examples/quick/controls/calendar/qml/main.qml index feb21852f..579937eaa 100644 --- a/examples/quick/controls/calendar/qml/main.qml +++ b/examples/quick/controls/calendar/qml/main.qml @@ -40,6 +40,7 @@ import QtQuick 2.2 import QtQuick.Controls 1.2 +import QtQuick.Controls.Private 1.0 import QtQuick.Controls.Styles 1.1 import org.qtproject.examples.calendar 1.0 @@ -53,6 +54,10 @@ ApplicationWindow { title: "Calendar Example" + SystemPalette { + id: systemPalette + } + SqlEventModel { id: eventModel } @@ -163,7 +168,7 @@ ApplicationWindow { style: CalendarStyle { dayDelegate: Item { readonly property color sameMonthDateTextColor: "#444" - readonly property color selectedDateColor: Qt.platform.os === "osx" ? "#3778d0" : __syspal.highlight + readonly property color selectedDateColor: Qt.platform.os === "osx" ? "#3778d0" : systemPalette.highlight readonly property color selectedDateTextColor: "white" readonly property color differentMonthDateTextColor: "#bbb" readonly property color invalidDatecolor: "#dddddd" diff --git a/src/controls/Styles/Base/CalendarStyle.qml b/src/controls/Styles/Base/CalendarStyle.qml index 56978ded5..15a80d9b4 100644 --- a/src/controls/Styles/Base/CalendarStyle.qml +++ b/src/controls/Styles/Base/CalendarStyle.qml @@ -166,8 +166,8 @@ Style { */ property Component background: Rectangle { color: "#fff" - implicitWidth: 250 - implicitHeight: 250 + implicitWidth: Math.max(250, Math.round(TextSingleton.implicitHeight * 14)) + implicitHeight: Math.max(250, Math.round(TextSingleton.implicitHeight * 14)) } /*! @@ -183,7 +183,7 @@ Style { \endtable */ property Component navigationBar: Rectangle { - height: 41 + height: Math.round(TextSingleton.implicitHeight * 2.73) color: "#f9f9f9" Rectangle { @@ -212,7 +212,7 @@ Style { text: styleData.title elide: Text.ElideRight horizontalAlignment: Text.AlignHCenter - font.pointSize: 14 + font.pixelSize: TextSingleton.implicitHeight * 1.25 anchors.verticalCenter: parent.verticalCenter anchors.left: previousMonth.right anchors.leftMargin: 2 @@ -313,7 +313,7 @@ Style { */ property Component dayOfWeekDelegate: Rectangle { color: gridVisible ? "#fcfcfc" : "transparent" - implicitHeight: 40 + implicitHeight: Math.round(TextSingleton.implicitHeight * 2.25) Label { text: control.__locale.dayName(styleData.dayOfWeek, control.dayOfWeekFormat) anchors.centerIn: parent @@ -334,7 +334,7 @@ Style { \endtable */ property Component weekNumberDelegate: Rectangle { - implicitWidth: 30 + implicitWidth: Math.round(TextSingleton.implicitHeight * 2) Label { text: styleData.weekNumber anchors.centerIn: parent -- GitLab