From ed66ccc0f02290c7478c8c38096231960e6bbc94 Mon Sep 17 00:00:00 2001 From: laserpants Date: Mon, 13 Jun 2016 11:32:27 +0300 Subject: [PATCH] make Radio Button inherit from QAbstractButton instead of QRadioButton --- components/radiobutton.cpp | 7 +++++-- components/radiobutton.h | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/components/radiobutton.cpp b/components/radiobutton.cpp index 5649a32..28d6816 100644 --- a/components/radiobutton.cpp +++ b/components/radiobutton.cpp @@ -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) diff --git a/components/radiobutton.h b/components/radiobutton.h index 24bf010..92f2c7a 100644 --- a/components/radiobutton.h +++ b/components/radiobutton.h @@ -1,11 +1,11 @@ #ifndef RADIOBUTTON_H #define RADIOBUTTON_H -#include +#include class RadioButtonPrivate; -class RadioButton : public QRadioButton +class RadioButton : public QAbstractButton { Q_OBJECT