* forward the valueChanged signal
* simplify the ctor to be more in line with the other widgets * add setOrientation combined, this elminates the need pretty much everywhere its used for nativeWidget() to be accessed. woo! svn path=/trunk/KDE/kdelibs/; revision=897341
This commit is contained in:
parent
fab0de787f
commit
adaed62351
@ -31,17 +31,18 @@ public:
|
||||
Plasma::Style *style;
|
||||
};
|
||||
|
||||
ScrollBar::ScrollBar(Qt::Orientation orientation, QGraphicsWidget *parent)
|
||||
ScrollBar::ScrollBar(QGraphicsWidget *parent)
|
||||
: QGraphicsProxyWidget(parent),
|
||||
d(new ScrollBarPrivate)
|
||||
{
|
||||
QScrollBar *scrollbar = new QScrollBar(orientation);
|
||||
QScrollBar *scrollbar = new QScrollBar();
|
||||
scrollbar->setAttribute(Qt::WA_NoSystemBackground);
|
||||
setWidget(scrollbar);
|
||||
d->style = new Plasma::Style();
|
||||
scrollbar->setStyle(d->style);
|
||||
|
||||
scrollbar->resize(scrollbar->sizeHint());
|
||||
connect(scrollbar, SIGNAL(valueChanged(int)), this, SIGNAL(valueChanged(int)));
|
||||
}
|
||||
|
||||
ScrollBar::~ScrollBar()
|
||||
@ -111,6 +112,11 @@ QScrollBar *ScrollBar::nativeWidget() const
|
||||
return static_cast<QScrollBar*>(widget());
|
||||
}
|
||||
|
||||
void ScrollBar::setOrientation(Qt::Orientation orientation)
|
||||
{
|
||||
static_cast<QScrollBar*>(widget())->setOrientation(orientation);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#include <scrollbar.moc>
|
||||
|
@ -49,7 +49,11 @@ class PLASMA_EXPORT ScrollBar : public QGraphicsProxyWidget
|
||||
Q_PROPERTY(QScrollBar *nativeWidget READ nativeWidget)
|
||||
|
||||
public:
|
||||
explicit ScrollBar(Qt::Orientation orientation, QGraphicsWidget *parent);
|
||||
/**
|
||||
* Creates a scrollbar; the default orientation is vertical
|
||||
*/
|
||||
explicit ScrollBar(QGraphicsWidget *parent);
|
||||
|
||||
~ScrollBar();
|
||||
|
||||
/**
|
||||
@ -82,12 +86,6 @@ public:
|
||||
*/
|
||||
int pageStep();
|
||||
|
||||
/**
|
||||
* Sets the current value for the ScrollBar
|
||||
* @arg value must be minimum() <= value <= maximum()
|
||||
*/
|
||||
void setValue(int val);
|
||||
|
||||
/**
|
||||
* @return the current scrollbar value
|
||||
*/
|
||||
@ -120,6 +118,24 @@ public:
|
||||
*/
|
||||
QScrollBar *nativeWidget() const;
|
||||
|
||||
public Q_SLOTS:
|
||||
/**
|
||||
* Sets the current value for the ScrollBar
|
||||
* @arg value must be minimum() <= value <= maximum()
|
||||
*/
|
||||
void setValue(int val);
|
||||
|
||||
/**
|
||||
* Sets the orientation of the ScrollBar.
|
||||
*/
|
||||
void setOrientation(Qt::Orientation orientation);
|
||||
|
||||
Q_SIGNALS:
|
||||
/**
|
||||
* Emitted when the value of the slider changes
|
||||
*/
|
||||
void valueChanged(int value);
|
||||
|
||||
private:
|
||||
ScrollBarPrivate * const d;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user