39 public: |
39 public: |
40 typedef QList<QRadioButton*>::Iterator Iterator; |
40 typedef QList<QRadioButton*>::Iterator Iterator; |
41 |
41 |
42 explicit RadioGroup() |
42 explicit RadioGroup() |
43 { |
43 { |
44 init (Qt::Vertical); |
44 init(Qt::Vertical); |
45 } |
45 } |
46 |
46 |
47 explicit RadioGroup (QWidget* parent = nullptr) : QGroupBox (parent) |
47 explicit RadioGroup(QWidget* parent = nullptr) : QGroupBox(parent) |
48 { |
48 { |
49 init (Qt::Vertical); |
49 init(Qt::Vertical); |
50 } |
50 } |
51 |
51 |
52 explicit RadioGroup (const QString& title, QWidget* parent = nullptr); |
52 explicit RadioGroup(const QString& title, QWidget* parent = nullptr); |
53 explicit RadioGroup (const QString& title, QList<char const*> entries, int const defaultId, |
53 explicit RadioGroup(const QString& title, QList<char const*> entries, int const defaultId, |
54 const Qt::Orientation orient = Qt::Vertical, QWidget* parent = nullptr); |
54 const Qt::Orientation orient = Qt::Vertical, QWidget* parent = nullptr); |
55 |
55 |
56 void addButton (QString entry); |
56 void addButton (QString entry); |
57 void addButton (QRadioButton* button); |
57 void addButton (QRadioButton* button); |
58 Iterator begin(); |
58 Iterator begin(); |
59 Iterator end(); |
59 Iterator end(); |
60 void init (Qt::Orientation orient); |
60 void init(Qt::Orientation orient); |
61 bool isChecked (int n) const; |
61 bool isChecked(int n) const; |
62 void rowBreak(); |
62 void rowBreak(); |
63 void setCurrentRow (int row); |
63 void setCurrentRow(int row); |
64 void setValue (int val); |
64 void setValue(int val); |
65 int value() const; |
65 int value() const; |
66 |
66 |
67 QRadioButton* operator[] (int n) const; |
67 QRadioButton* operator[](int n) const; |
68 RadioGroup& operator<< (QRadioButton* button); |
68 RadioGroup& operator<<(QRadioButton* button); |
69 RadioGroup& operator<< (const char* entry); |
69 RadioGroup& operator<<(const char* entry); |
70 |
70 |
71 signals: |
71 signals: |
72 void buttonPressed (int btn); |
72 void buttonPressed(int btn); |
73 void buttonReleased (int btn); |
73 void buttonReleased(int btn); |
74 void valueChanged (int val); |
74 void valueChanged(int val); |
75 |
75 |
76 private: |
76 private: |
77 QList<QRadioButton*> m_objects; |
77 QList<QRadioButton*> m_objects; |
78 QList<QBoxLayout*> m_layouts; |
78 QList<QBoxLayout*> m_layouts; |
79 QBoxLayout* m_coreLayout; |
79 QBoxLayout* m_coreLayout; |
80 QBoxLayout* m_currentLayout; |
80 QBoxLayout* m_currentLayout; |
81 bool m_vert; |
81 bool m_vert; |
82 int m_curId, m_defId, m_oldId; |
82 int m_curId, m_defId, m_oldId; |
83 QButtonGroup* m_buttonGroup; |
83 QButtonGroup* m_buttonGroup; |
84 |
84 |
85 Q_DISABLE_COPY (RadioGroup) |
85 Q_DISABLE_COPY(RadioGroup) |
86 |
86 |
87 private slots: |
87 private slots: |
88 void slot_buttonPressed (int btn); |
88 void slot_buttonPressed(int btn); |
89 void slot_buttonReleased (int btn); |
89 void slot_buttonReleased(int btn); |
90 }; |
90 }; |