Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Steve Lhomme
VLC
Commits
1beb0074
Commit
1beb0074
authored
Jul 15, 2013
by
Ludovic Fauvet
Browse files
Qt: QProxyStyle is the new way to extend styles in Qt5
parent
1c9516cf
Changes
2
Hide whitespace changes
Inline
Side-by-side
modules/gui/qt4/styles/seekstyle.cpp
View file @
1beb0074
...
@@ -24,7 +24,8 @@
...
@@ -24,7 +24,8 @@
#include
"util/input_slider.hpp"
#include
"util/input_slider.hpp"
#include
"adapters/seekpoints.hpp"
#include
"adapters/seekpoints.hpp"
#include
<QWindowsStyle>
#include
<QProxyStyle>
#include
<QStyleFactory>
#include
<QStyleOptionSlider>
#include
<QStyleOptionSlider>
#include
<QPainter>
#include
<QPainter>
#include
<QDebug>
#include
<QDebug>
...
@@ -32,6 +33,11 @@
...
@@ -32,6 +33,11 @@
#define RADIUS 3
#define RADIUS 3
#define CHAPTERSSPOTSIZE 3
#define CHAPTERSSPOTSIZE 3
SeekStyle
::
SeekStyle
()
:
QProxyStyle
(
QStyleFactory
::
create
(
QLatin1String
(
"Windows"
)
)
)
{
}
int
SeekStyle
::
pixelMetric
(
PixelMetric
metric
,
const
QStyleOption
*
option
,
const
QWidget
*
widget
)
const
int
SeekStyle
::
pixelMetric
(
PixelMetric
metric
,
const
QStyleOption
*
option
,
const
QWidget
*
widget
)
const
{
{
const
QStyleOptionSlider
*
slider
;
const
QStyleOptionSlider
*
slider
;
...
@@ -39,7 +45,7 @@ int SeekStyle::pixelMetric( PixelMetric metric, const QStyleOption *option, cons
...
@@ -39,7 +45,7 @@ int SeekStyle::pixelMetric( PixelMetric metric, const QStyleOption *option, cons
if
(
metric
==
PM_SliderLength
&&
(
slider
=
qstyleoption_cast
<
const
QStyleOptionSlider
*>
(
option
)
)
)
if
(
metric
==
PM_SliderLength
&&
(
slider
=
qstyleoption_cast
<
const
QStyleOptionSlider
*>
(
option
)
)
)
return
slider
->
rect
.
height
();
return
slider
->
rect
.
height
();
else
else
return
Q
Windows
Style
::
pixelMetric
(
metric
,
option
,
widget
);
return
Q
Proxy
Style
::
pixelMetric
(
metric
,
option
,
widget
);
}
}
void
SeekStyle
::
drawComplexControl
(
ComplexControl
cc
,
const
QStyleOptionComplex
*
option
,
QPainter
*
painter
,
const
QWidget
*
widget
)
const
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
...
@@ -121,7 +127,7 @@ void SeekStyle::drawComplexControl( ComplexControl cc, const QStyleOptionComplex
if
(
slider
->
subControls
&
SC_SliderTickmarks
)
{
if
(
slider
->
subControls
&
SC_SliderTickmarks
)
{
QStyleOptionSlider
tmpSlider
=
*
slider
;
QStyleOptionSlider
tmpSlider
=
*
slider
;
tmpSlider
.
subControls
=
SC_SliderTickmarks
;
tmpSlider
.
subControls
=
SC_SliderTickmarks
;
Q
Windows
Style
::
drawComplexControl
(
cc
,
&
tmpSlider
,
painter
,
widget
);
Q
Proxy
Style
::
drawComplexControl
(
cc
,
&
tmpSlider
,
painter
,
widget
);
}
}
if
(
slider
->
subControls
&
SC_SliderHandle
&&
handle
.
isValid
()
)
if
(
slider
->
subControls
&
SC_SliderHandle
&&
handle
.
isValid
()
)
...
@@ -202,6 +208,6 @@ void SeekStyle::drawComplexControl( ComplexControl cc, const QStyleOptionComplex
...
@@ -202,6 +208,6 @@ void SeekStyle::drawComplexControl( ComplexControl cc, const QStyleOptionComplex
else
else
{
{
qWarning
()
<<
"SeekStyle: Drawing an unmanaged control"
;
qWarning
()
<<
"SeekStyle: Drawing an unmanaged control"
;
Q
Windows
Style
::
drawComplexControl
(
cc
,
option
,
painter
,
widget
);
Q
Proxy
Style
::
drawComplexControl
(
cc
,
option
,
painter
,
widget
);
}
}
}
}
modules/gui/qt4/styles/seekstyle.hpp
View file @
1beb0074
...
@@ -23,14 +23,14 @@
...
@@ -23,14 +23,14 @@
#ifndef SEEKSTYLE_HPP
#ifndef SEEKSTYLE_HPP
#define SEEKSTYLE_HPP
#define SEEKSTYLE_HPP
#include
<Q
Windows
Style>
#include
<Q
Proxy
Style>
class
SeekStyle
:
public
Q
Windows
Style
class
SeekStyle
:
public
Q
Proxy
Style
{
{
Q_OBJECT
Q_OBJECT
public:
public:
SeekStyle
()
{
}
SeekStyle
()
;
virtual
int
pixelMetric
(
PixelMetric
metric
,
const
QStyleOption
*
option
=
0
,
const
QWidget
*
widget
=
0
)
const
;
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
;
virtual
void
drawComplexControl
(
ComplexControl
cc
,
const
QStyleOptionComplex
*
opt
,
QPainter
*
p
,
const
QWidget
*
widget
)
const
;
};
};
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment