Change PosBar to use the new PixmapSlider class

This commit is contained in:
Thomas Frauendorfer 2008-03-21 22:43:21 +01:00
parent 6e7e2c2184
commit 220c124447
7 changed files with 58 additions and 204 deletions

View file

@ -25,6 +25,7 @@
PixmapSlider::PixmapSlider (QWidget *parent) : QAbstractSlider (parent)
{
setSliderDown (false);
m_slider_offset = 0;
}
void
@ -144,10 +145,10 @@ PixmapSlider::paintEvent (QPaintEvent *event)
QRect rect (slider->rect ());
if (orientation () == Qt::Vertical) {
rect.moveTop (sliderPositionFromValue ());
rect.moveLeft (1);
rect.moveLeft (m_slider_offset);
} else {
rect.moveLeft (sliderPositionFromValue ());
rect.moveTop (1);
rect.moveTop (m_slider_offset);
}
p.drawPixmap (rect , *slider, slider->rect ());
p.end ();

View file

@ -58,12 +58,17 @@ class PixmapSlider : public QAbstractSlider
int sliderValueFromPosition (int pos);
int backgroundIndex ();
// horizontal offset in vertical sliders or
// vertical offset in horizontal sliders
void setSliderOffset (int offset) { m_slider_offset = offset; };
private:
QPixmapList m_backgrounds;
QPixmap m_normal;
QPixmap m_pressed;
int m_background_index;
int m_slider_offset;
};
#endif