add some api widgets are using and which seems semi-common

svn path=/trunk/KDE/kdelibs/; revision=977687
This commit is contained in:
Aaron J. Seigo 2009-06-05 01:29:19 +00:00
parent b81f27be13
commit 64d02688f9
2 changed files with 39 additions and 0 deletions

View File

@ -145,6 +145,7 @@ PushButton::PushButton(QGraphicsWidget *parent)
{
KPushButton *native = new KPushButton;
connect(native, SIGNAL(clicked()), this, SIGNAL(clicked()));
connect(native, SIGNAL(toggled(bool)), this, SIGNAL(toggled(bool)));
setWidget(native);
native->setAttribute(Qt::WA_NoSystemBackground);
@ -237,6 +238,21 @@ QIcon PushButton::icon() const
return nativeWidget()->icon();
}
void PushButton::setCheckable(bool checkable)
{
nativeWidget()->setCheckable(checkable);
}
void PushButton::setChecked(bool checked)
{
nativeWidget()->setChecked(checked);
}
bool PushButton::isChecked() const
{
return nativeWidget()->isChecked();
}
KPushButton *PushButton::nativeWidget() const
{
return static_cast<KPushButton*>(widget());

View File

@ -119,6 +119,28 @@ public:
*/
QIcon icon() const;
/**
* Sets whether or not this button can be toggled on/off
*
* @since 4.3
*/
void setCheckable(bool checkable);
/**
* Sets whether or not this button is checked. Implies setIsCheckable(true).
*
* @since 4.3
*/
void setChecked(bool checked);
/**
* @return true if the button is checked; requires setIsCheckable(true) to
* be called
*
* @since 4.3
*/
bool isChecked() const;
/**
* @return the native widget wrapped by this PushButton
*/
@ -126,6 +148,7 @@ public:
Q_SIGNALS:
void clicked();
void toggled(bool);
protected:
void paint(QPainter *painter,