make Radio Button inherit from QAbstractButton instead of QRadioButton

This commit is contained in:
laserpants 2016-06-13 11:32:27 +03:00
parent 26ca77281c
commit ed66ccc0f0
2 changed files with 7 additions and 4 deletions

View File

@ -23,6 +23,9 @@ void RadioButtonPrivate::init()
{
Q_Q(RadioButton);
q->setCheckable(true);
q->setAutoExclusive(true);
checkedIcon->setParent(q);
uncheckedIcon->setParent(q);
@ -99,7 +102,7 @@ void RadioButtonPrivate::updatePalette()
}
RadioButton::RadioButton(QWidget *parent)
: QRadioButton(parent),
: QAbstractButton(parent),
d_ptr(new RadioButtonPrivate(this))
{
d_func()->init();
@ -303,7 +306,7 @@ bool RadioButton::event(QEvent *event)
default:
break;
}
return QRadioButton::event(event);
return QAbstractButton::event(event);
}
void RadioButton::mousePressEvent(QMouseEvent *event)

View File

@ -1,11 +1,11 @@
#ifndef RADIOBUTTON_H
#define RADIOBUTTON_H
#include <QRadioButton>
#include <QAbstractButton>
class RadioButtonPrivate;
class RadioButton : public QRadioButton
class RadioButton : public QAbstractButton
{
Q_OBJECT