From 7167ce41b61d2ba2cdb526777a4233eb84a3b66a Mon Sep 17 00:00:00 2001 From: Unit 193 Date: Sat, 6 Dec 2014 17:33:25 -0500 Subject: Imported Upstream version 2.99.6 --- .../guiSQLiteStudio/common/configradiobutton.h | 46 ++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 SQLiteStudio3/guiSQLiteStudio/common/configradiobutton.h (limited to 'SQLiteStudio3/guiSQLiteStudio/common/configradiobutton.h') diff --git a/SQLiteStudio3/guiSQLiteStudio/common/configradiobutton.h b/SQLiteStudio3/guiSQLiteStudio/common/configradiobutton.h new file mode 100644 index 0000000..b972c26 --- /dev/null +++ b/SQLiteStudio3/guiSQLiteStudio/common/configradiobutton.h @@ -0,0 +1,46 @@ +#ifndef CONFIGRADIOBUTTON_H +#define CONFIGRADIOBUTTON_H + +#include "guiSQLiteStudio_global.h" +#include +#include + +/** + * @brief Config-oriented radio button. + * + * It's just like a usual QRadioButton, except it has a value assigned to it + * and when the radio is toggled on, the signal is emitted to inform about it. + * To inform about the button being toggled off a different signal is emitted. + * It also has a slot to be called when the associated property in the application + * has changed and needs to be reflected in the button - the button checks + * if the value of the property reflects the button's assigned value + * and toggles on or off approprietly. In that case the signals are not emitted. + */ +class GUI_API_EXPORT ConfigRadioButton : public QRadioButton +{ + Q_OBJECT + + Q_PROPERTY(QVariant assignedValue READ getAssignedValue WRITE setAssignedValue) + + public: + explicit ConfigRadioButton(QWidget *parent = 0); + + QVariant getAssignedValue() const; + void setAssignedValue(const QVariant& value); + + private: + QVariant assignedValue; + bool handlingSlot = false; + + signals: + void toggledOn(const QVariant& assignedBalue); + void toggledOff(const QVariant& assignedBalue); + + private slots: + void handleToggled(bool checked); + + public slots: + void alignToValue(const QVariant& value); +}; + +#endif // CONFIGRADIOBUTTON_H -- cgit v1.2.3