[vlc-commits] Qt: QProxyStyle is the new way to extend styles in Qt5
Ludovic Fauvet
git at videolan.org
Mon Jul 15 16:56:47 CEST 2013
vlc | branch: master | Ludovic Fauvet <etix at videolan.org> | Mon Jul 15 10:40:13 2013 +0200| [1beb0074c58bf9b0172b53332f7d200267c01064] | committer: Ludovic Fauvet
Qt: QProxyStyle is the new way to extend styles in Qt5
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=1beb0074c58bf9b0172b53332f7d200267c01064
---
modules/gui/qt4/styles/seekstyle.cpp | 14 ++++++++++----
modules/gui/qt4/styles/seekstyle.hpp | 6 +++---
2 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/modules/gui/qt4/styles/seekstyle.cpp b/modules/gui/qt4/styles/seekstyle.cpp
index 4154f06..1bd2b59 100644
--- a/modules/gui/qt4/styles/seekstyle.cpp
+++ b/modules/gui/qt4/styles/seekstyle.cpp
@@ -24,7 +24,8 @@
#include "util/input_slider.hpp"
#include "adapters/seekpoints.hpp"
-#include <QWindowsStyle>
+#include <QProxyStyle>
+#include <QStyleFactory>
#include <QStyleOptionSlider>
#include <QPainter>
#include <QDebug>
@@ -32,6 +33,11 @@
#define RADIUS 3
#define CHAPTERSSPOTSIZE 3
+SeekStyle::SeekStyle() : QProxyStyle( QStyleFactory::create( QLatin1String("Windows") ) )
+{
+
+}
+
int SeekStyle::pixelMetric( PixelMetric metric, const QStyleOption *option, const QWidget *widget ) const
{
const QStyleOptionSlider *slider;
@@ -39,7 +45,7 @@ int SeekStyle::pixelMetric( PixelMetric metric, const QStyleOption *option, cons
if ( metric == PM_SliderLength && ( slider = qstyleoption_cast<const QStyleOptionSlider *>( option ) ) )
return slider->rect.height();
else
- return QWindowsStyle::pixelMetric( metric, option, widget );
+ return QProxyStyle::pixelMetric( metric, option, widget );
}
void SeekStyle::drawComplexControl( ComplexControl cc, const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget ) const
@@ -121,7 +127,7 @@ void SeekStyle::drawComplexControl( ComplexControl cc, const QStyleOptionComplex
if ( slider->subControls & SC_SliderTickmarks ) {
QStyleOptionSlider tmpSlider = *slider;
tmpSlider.subControls = SC_SliderTickmarks;
- QWindowsStyle::drawComplexControl(cc, &tmpSlider, painter, widget);
+ QProxyStyle::drawComplexControl(cc, &tmpSlider, painter, widget);
}
if ( slider->subControls & SC_SliderHandle && handle.isValid() )
@@ -202,6 +208,6 @@ void SeekStyle::drawComplexControl( ComplexControl cc, const QStyleOptionComplex
else
{
qWarning() << "SeekStyle: Drawing an unmanaged control";
- QWindowsStyle::drawComplexControl( cc, option, painter, widget );
+ QProxyStyle::drawComplexControl( cc, option, painter, widget );
}
}
diff --git a/modules/gui/qt4/styles/seekstyle.hpp b/modules/gui/qt4/styles/seekstyle.hpp
index fc0b6c1..e452fa5 100644
--- a/modules/gui/qt4/styles/seekstyle.hpp
+++ b/modules/gui/qt4/styles/seekstyle.hpp
@@ -23,14 +23,14 @@
#ifndef SEEKSTYLE_HPP
#define SEEKSTYLE_HPP
-#include <QWindowsStyle>
+#include <QProxyStyle>
-class SeekStyle : public QWindowsStyle
+class SeekStyle : public QProxyStyle
{
Q_OBJECT
public:
- SeekStyle() { }
+ SeekStyle();
virtual int pixelMetric(PixelMetric metric, const QStyleOption * option = 0, const QWidget * widget = 0) const;
virtual void drawComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, QPainter *p, const QWidget *widget) const;
};
More information about the vlc-commits
mailing list