move initialization code to private class
This commit is contained in:
parent
4ef57f8d3a
commit
61c2364fbb
|
@ -13,16 +13,6 @@ Slider::Slider(QWidget *parent)
|
||||||
d_ptr(new SliderPrivate(this))
|
d_ptr(new SliderPrivate(this))
|
||||||
{
|
{
|
||||||
d_func()->init(this);
|
d_func()->init(this);
|
||||||
|
|
||||||
setFocusPolicy(Qt::StrongFocus);
|
|
||||||
|
|
||||||
QSizePolicy sp(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
|
||||||
if (orientation() == Qt::Vertical)
|
|
||||||
sp.transpose();
|
|
||||||
setSizePolicy(sp);
|
|
||||||
setAttribute(Qt::WA_WState_OwnSizePolicy, false);
|
|
||||||
|
|
||||||
QCoreApplication::processEvents();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Slider::~Slider()
|
Slider::~Slider()
|
||||||
|
@ -41,7 +31,7 @@ int Slider::thumbOffset() const
|
||||||
maximum(),
|
maximum(),
|
||||||
sliderPosition(),
|
sliderPosition(),
|
||||||
Qt::Horizontal == orientation()
|
Qt::Horizontal == orientation()
|
||||||
? rect().width() -SLIDER_MARGIN*2
|
? rect().width() - SLIDER_MARGIN*2
|
||||||
: rect().height() - SLIDER_MARGIN*2,
|
: rect().height() - SLIDER_MARGIN*2,
|
||||||
invertedAppearance());
|
invertedAppearance());
|
||||||
}
|
}
|
||||||
|
|
|
@ -202,6 +202,16 @@ void SliderPrivate::init(Slider *slider)
|
||||||
normalState->addTransition(transition);
|
normalState->addTransition(transition);
|
||||||
|
|
||||||
machine.start();
|
machine.start();
|
||||||
|
|
||||||
|
slider->setFocusPolicy(Qt::StrongFocus);
|
||||||
|
|
||||||
|
QSizePolicy sp(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
||||||
|
if (slider->orientation() == Qt::Vertical)
|
||||||
|
sp.transpose();
|
||||||
|
slider->setSizePolicy(sp);
|
||||||
|
slider->setAttribute(Qt::WA_WState_OwnSizePolicy, false);
|
||||||
|
|
||||||
|
QCoreApplication::processEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
QRectF SliderPrivate::trackGeometry() const
|
QRectF SliderPrivate::trackGeometry() const
|
||||||
|
|
Loading…
Reference in New Issue