IMPROVEMENT: add a clicked() slot (which just backends on to animateClick()), and make setChecked a slot like it is in the native widget

svn path=/trunk/KDE/kdelibs/; revision=1175311
This commit is contained in:
Aaron J. Seigo 2010-09-14 17:34:31 +00:00
parent e4c6d2e92b
commit 1fc68e3ef9
2 changed files with 19 additions and 7 deletions

View File

@ -308,6 +308,11 @@ void PushButton::setChecked(bool checked)
nativeWidget()->setChecked(checked);
}
void PushButton::click()
{
nativeWidget()->animateClick();
}
bool PushButton::isChecked() const
{
return nativeWidget()->isChecked();

View File

@ -158,13 +158,6 @@ public:
*/
bool isCheckable() const;
/**
* 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
@ -209,6 +202,20 @@ Q_SIGNALS:
*/
void toggled(bool);
public Q_SLOTS:
/**
* Performs a visual click and emits the associated signals
* @since 4.6
*/
void click();
/**
* Sets whether or not this button is checked. Implies setIsCheckable(true).
*
* @since 4.3
*/
void setChecked(bool checked);
protected:
void paint(QPainter *painter,
const QStyleOptionGraphicsItem *option,