QSkinny 0.8.0
C++/Qt UI toolkit
Loading...
Searching...
No Matches
QskProgressBar.cpp
1/******************************************************************************
2 * QSkinny - Copyright (C) The authors
3 * SPDX-License-Identifier: BSD-3-Clause
4 *****************************************************************************/
5
6#include "QskProgressBar.h"
7
8#include "QskIntervalF.h"
9
10QSK_SUBCONTROL( QskProgressBar, Groove )
11QSK_SUBCONTROL( QskProgressBar, Fill )
12
13class QskProgressBar::PrivateData
14{
15 public:
16 Qt::Orientation orientation;
17};
18
19QskProgressBar::QskProgressBar( Qt::Orientation orientation,
20 qreal min, qreal max, QQuickItem* parent )
21 : Inherited( min, max, parent )
22 , m_data( new PrivateData )
23{
24 m_data->orientation = orientation;
25
26 if ( orientation == Qt::Horizontal )
27 initSizePolicy( QskSizePolicy::MinimumExpanding, QskSizePolicy::Fixed );
28 else
29 initSizePolicy( QskSizePolicy::Fixed, QskSizePolicy::MinimumExpanding );
30
31 setSubcontrolProxy( Inherited::Groove, Groove );
32 setSubcontrolProxy( Inherited::Fill, Fill );
33}
34
35QskProgressBar::QskProgressBar( Qt::Orientation orientation, QQuickItem* parent )
36 : QskProgressBar( orientation, 0.0, 100.0, parent )
37{
38}
39
40QskProgressBar::QskProgressBar( const QskIntervalF& boundaries, QQuickItem* parent )
41 : QskProgressBar( boundaries.lowerBound(), boundaries.upperBound(), parent )
42{
43}
44
45QskProgressBar::QskProgressBar( qreal min, qreal max, QQuickItem* parent )
46 : QskProgressBar( Qt::Horizontal, min, max, parent )
47{
48}
49
50QskProgressBar::QskProgressBar( QQuickItem* parent )
51 : QskProgressBar( Qt::Horizontal, parent )
52{
53}
54
55QskProgressBar::~QskProgressBar()
56{
57}
58
60{
61 // so you can define different hints depending on the orientation
62 return static_cast< QskAspect::Variation >( m_data->orientation );
63}
64
65Qt::Orientation QskProgressBar::orientation() const
66{
67 return m_data->orientation;
68}
69
70void QskProgressBar::setOrientation( Qt::Orientation orientation )
71{
72 if ( orientation != m_data->orientation )
73 {
74 m_data->orientation = orientation;
75 setSizePolicy( sizePolicy( Qt::Vertical ), sizePolicy( Qt::Horizontal ) );
76
78 update();
79
80 Q_EMIT orientationChanged( m_data->orientation );
81 }
82}
83
84#include "moc_QskProgressBar.cpp"
Variation
Some sort of variation.
Definition QskAspect.h:82
void setSizePolicy(QskSizePolicy)
QskSizePolicy sizePolicy
Definition QskControl.h:43
void resetImplicitSize()
Definition QskItem.cpp:721
QskAspect::Variation effectiveVariation() const override