Accepting request 260194 from KDE:Qt5

Added 0001-Correct-sizing-of-combobox-items.patch from upstream

OBS-URL: https://build.opensuse.org/request/show/260194
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/libqt5-qtquickcontrols?expand=0&rev=15
This commit is contained in:
Dominique Leuenberger 2014-11-10 16:28:29 +00:00 committed by Git OBS Bridge
parent 4d57714b48
commit edecdde4a5
3 changed files with 65 additions and 0 deletions

View File

@ -0,0 +1,57 @@
From 4d9753fd68fb91b4a839e546553b751a455a9818 Mon Sep 17 00:00:00 2001
From: Marco Martin <mart@kde.org>
Date: Mon, 27 Oct 2014 17:24:11 +0100
Subject: [PATCH 1/1] Correct sizing of combobox items
The qstyle can set as preferred size for itemview items a different
size than the text height depending from the result of
sizeFromContents( CT_ItemViewItem, ..
Examples of styles that do this, are Oxygen and Breeze,
in order to have a bit more spacing.
This makes the combobox render incorrectly.
This patch makes use of the size hint of the qstyle instead of the
text height. Since the height can be more than the font height,
the text (and optional icon) are now drawn vertically centered
in the delegate.
Change-Id: I898d85c994d5760979750c2f3a5dafd83f1e3cbd
Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
(cherry picked from commit 04ec29f8b3abea2297a1f5c033bef49ba0405c34)
---
src/controls/Private/qquickstyleitem.cpp | 2 ++
src/controls/Styles/Desktop/ComboBoxStyle.qml | 4 ++--
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/controls/Private/qquickstyleitem.cpp b/src/controls/Private/qquickstyleitem.cpp
index 4da6773afa94bf9725162566ee3aeb89d0b251e7..e810e473245f37e7b950c808294b39e8e55f2e12 100644
--- a/src/controls/Private/qquickstyleitem.cpp
+++ b/src/controls/Private/qquickstyleitem.cpp
@@ -334,6 +334,8 @@ void QQuickStyleItem::initStyleOption()
opt->features = QStyleOptionViewItem::HasDisplay;
opt->text = text();
opt->textElideMode = Qt::ElideRight;
+ opt->displayAlignment = Qt::AlignLeft | Qt::AlignVCenter;
+ opt->decorationAlignment = Qt::AlignCenter;
resolvePalette();
needsResolvePalette = false;
QPalette pal = m_styleoption->palette;
diff --git a/src/controls/Styles/Desktop/ComboBoxStyle.qml b/src/controls/Styles/Desktop/ComboBoxStyle.qml
index 9c8bf608a7f14e529ef1395aca0278bb0f481ee8..a13d80533c64c66c425608ec0ca13d212c1f10aa 100644
--- a/src/controls/Styles/Desktop/ComboBoxStyle.qml
+++ b/src/controls/Styles/Desktop/ComboBoxStyle.qml
@@ -105,8 +105,8 @@ Style {
elementType: "itemrow"
selected: styleData.selected
- implicitWidth: textItem.contentWidth
- implicitHeight: textItem.contentHeight
+ implicitWidth: textItem.implicitWidth
+ implicitHeight: textItem.implicitHeight
StyleItem {
id: textItem
--
2.1.2

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Tue Nov 4 18:42:04 UTC 2014 - hrvoje.senjan@gmail.com
- Added 0001-Correct-sizing-of-combobox-items.patch from upstream
-------------------------------------------------------------------
Tue Sep 16 11:27:53 UTC 2014 - hrvoje.senjan@gmail.com

View File

@ -30,6 +30,8 @@ Url: http://qt.digia.com
%define so_version 5.3.2
%define tar_version qtquickcontrols-opensource-src-%{real_version}
Source: %{tar_version}.tar.xz
# PATCH-FIX-UPSTREAM 0001-Correct-sizing-of-combobox-items.patch
Patch0: 0001-Correct-sizing-of-combobox-items.patch
BuildRequires: fdupes
BuildRequires: libQt5Core-private-headers-devel >= %{version}
BuildRequires: libQt5Gui-private-headers-devel >= %{version}
@ -57,6 +59,7 @@ Examples for libqt5-qtquickcontrols module.
%prep
%setup -q -n qtquickcontrols-opensource-src-%{real_version}
%patch0 -p1
%build
%if %qt5_snapshot