make Radio Button inherit from QAbstractButton instead of QRadioButton
This commit is contained in:
parent
26ca77281c
commit
ed66ccc0f0
|
@ -23,6 +23,9 @@ void RadioButtonPrivate::init()
|
||||||
{
|
{
|
||||||
Q_Q(RadioButton);
|
Q_Q(RadioButton);
|
||||||
|
|
||||||
|
q->setCheckable(true);
|
||||||
|
q->setAutoExclusive(true);
|
||||||
|
|
||||||
checkedIcon->setParent(q);
|
checkedIcon->setParent(q);
|
||||||
uncheckedIcon->setParent(q);
|
uncheckedIcon->setParent(q);
|
||||||
|
|
||||||
|
@ -99,7 +102,7 @@ void RadioButtonPrivate::updatePalette()
|
||||||
}
|
}
|
||||||
|
|
||||||
RadioButton::RadioButton(QWidget *parent)
|
RadioButton::RadioButton(QWidget *parent)
|
||||||
: QRadioButton(parent),
|
: QAbstractButton(parent),
|
||||||
d_ptr(new RadioButtonPrivate(this))
|
d_ptr(new RadioButtonPrivate(this))
|
||||||
{
|
{
|
||||||
d_func()->init();
|
d_func()->init();
|
||||||
|
@ -303,7 +306,7 @@ bool RadioButton::event(QEvent *event)
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return QRadioButton::event(event);
|
return QAbstractButton::event(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RadioButton::mousePressEvent(QMouseEvent *event)
|
void RadioButton::mousePressEvent(QMouseEvent *event)
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
#ifndef RADIOBUTTON_H
|
#ifndef RADIOBUTTON_H
|
||||||
#define RADIOBUTTON_H
|
#define RADIOBUTTON_H
|
||||||
|
|
||||||
#include <QRadioButton>
|
#include <QAbstractButton>
|
||||||
|
|
||||||
class RadioButtonPrivate;
|
class RadioButtonPrivate;
|
||||||
|
|
||||||
class RadioButton : public QRadioButton
|
class RadioButton : public QAbstractButton
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue