View Issue Details

IDProjectCategoryView StatusLast Update
0011472ScribusOS-MacOSXpublic2013-06-22 05:56
Reporterchhitz Assigned Tocbradney  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version1.5.0svn 
Fixed in Version1.5.0svn 
Summary0011472: [PATCH] compile against Qt5 on Mac OS X
DescriptionIn Qt5 the class QMacStyle is not available anymore. According to https://codereview.qt-project.org/#change,39716 it should be replaced with QProxyStyle.
TagsNo tags attached.
Patch

Activities

christoph_s

2013-03-26 20:46

administrator   ~0030012

I think you forgot to upload the patch ;)

chhitz

2013-03-26 22:02

reporter  

0001-replace-QMacStyle-with-QProxyStyle-for-Qt5.patch (2,646 bytes)   
From 2b919b223d98f5c6d1066b171f07ebc2ec643e92 Mon Sep 17 00:00:00 2001
From: Christian Hitz <christian@klarinett.li>
Date: Tue, 26 Mar 2013 19:31:07 +0100
Subject: [PATCH] replace QMacStyle with QProxyStyle for Qt5

---
 Scribus/scribus/ui/colorcombo.h   | 16 ++++++++++++++--
 Scribus/scribus/ui/sccombobox.cpp | 14 +++++++++++++-
 2 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/Scribus/scribus/ui/colorcombo.h b/Scribus/scribus/ui/colorcombo.h
index 05f98f7..6285ca9 100644
--- a/Scribus/scribus/ui/colorcombo.h
+++ b/Scribus/scribus/ui/colorcombo.h
@@ -19,8 +19,12 @@ for which a new license (GPL+exception) is in place.
 #include <QComboBox>
 
 #ifdef Q_OS_MAC
+#ifdef USE_QT5
+#include <QProxyStyle>
+#else
 #include <QMacStyle>
 #endif
+#endif
 
 #include "scribusapi.h"
 #include "colorlistbox.h"
@@ -37,14 +41,22 @@ private:
 
 #ifdef Q_OS_MAC
 	/// use listbox instead of popupmenu for combo boxes
-	class ScMacStyle : public QMacStyle 
+#ifdef USE_QT5
+	class ScMacStyle : public QProxyStyle
+#else
+	class ScMacStyle : public QMacStyle
+#endif
 	{
 		virtual int styleHint(StyleHint sh, 
 	                                  const QStyleOption * so, 
 					  const QWidget * w, 
 	                                  QStyleHintReturn * r) const
 		{
-        	return sh != QStyle::SH_ComboBox_Popup && QMacStyle::styleHint(sh, so, w, r); 
+#ifdef USE_QT5
+        	return sh != QStyle::SH_ComboBox_Popup && QProxyStyle::styleHint(sh, so, w, r);
+#else
+        	return sh != QStyle::SH_ComboBox_Popup && QMacStyle::styleHint(sh, so, w, r);
+#endif
 		}
 	};
 #endif
diff --git a/Scribus/scribus/ui/sccombobox.cpp b/Scribus/scribus/ui/sccombobox.cpp
index bca61ab..ee27ec7 100644
--- a/Scribus/scribus/ui/sccombobox.cpp
+++ b/Scribus/scribus/ui/sccombobox.cpp
@@ -17,16 +17,28 @@ for which a new license (GPL+exception) is in place.
 
 #ifdef Q_OS_MAC
 
+#ifdef USE_QT5
+#include <QProxyStyle>
+#else
 #include <QMacStyle>
+#endif
 
 /// use listbox instead of popupmenu for combo boxes
+#ifdef USE_QT5
+class ScMacStyle : public QProxyStyle {
+#else
 class ScMacStyle : public QMacStyle {
+#endif
 	virtual int styleHint(StyleHint sh, 
 	                                  const QStyleOption * so, 
 					  const QWidget * w, 
 	                                  QStyleHintReturn * r) const
 	{
-        	return sh != QStyle::SH_ComboBox_Popup && QMacStyle::styleHint(sh, so, w, r); 
+#ifdef USE_QT5
+        	return sh != QStyle::SH_ComboBox_Popup && QProxyStyle::styleHint(sh, so, w, r);
+#else
+        	return sh != QStyle::SH_ComboBox_Popup && QMacStyle::styleHint(sh, so, w, r);
+#endif
 	}
 };
 #endif
-- 
1.8.1.2

jghali

2013-03-26 23:00

administrator   ~0030013

In fact QProxyStyle exists since Qt 4.6. So we may be able to use same code for Qt 4 and Qt 5... Anyone wants to test?

cbradney

2013-03-27 20:56

administrator   ~0030014

We dont even need this code anymore from what I tested. I've just commented it all out.

Issue History

Date Modified Username Field Change
2013-03-26 18:38 chhitz New Issue
2013-03-26 20:46 christoph_s Note Added: 0030012
2013-03-26 22:02 chhitz File Added: 0001-replace-QMacStyle-with-QProxyStyle-for-Qt5.patch
2013-03-26 23:00 jghali Note Added: 0030013
2013-03-27 20:56 cbradney Note Added: 0030014
2013-04-14 13:34 cbradney Status new => resolved
2013-04-14 13:34 cbradney Fixed in Version => 1.5.0svn
2013-04-14 13:34 cbradney Resolution open => fixed
2013-04-14 13:34 cbradney Assigned To => cbradney
2013-06-22 05:56 christoph_s Status resolved => closed
2014-10-08 18:37 Kunda Category Mac OS => OS-MacOSX