Fri, 23 Aug 2013 13:01:36 +0300
rename RadioBox to RadioGroup
src/addObjectDialog.cpp | file | annotate | diff | comparison | revisions | |
src/addObjectDialog.h | file | annotate | diff | comparison | revisions | |
src/dialogs.h | file | annotate | diff | comparison | revisions | |
src/gldraw.h | file | annotate | diff | comparison | revisions | |
src/widgets.cpp | file | annotate | diff | comparison | revisions | |
src/widgets.h | file | annotate | diff | comparison | revisions |
--- a/src/addObjectDialog.cpp Fri Aug 23 01:20:09 2013 +0300 +++ b/src/addObjectDialog.cpp Fri Aug 23 13:01:36 2013 +0300 @@ -82,7 +82,7 @@ break; case LDObject::BFC: - rb_bfcType = new RadioBox ("Statement", {}, 0, Qt::Vertical); + rb_bfcType = new RadioGroup ("Statement", {}, 0, Qt::Vertical); for (int i = 0; i < LDBFC::NumStatements; ++i) { // Separate these in two columns
--- a/src/addObjectDialog.h Fri Aug 23 01:20:09 2013 +0300 +++ b/src/addObjectDialog.h Fri Aug 23 13:01:36 2013 +0300 @@ -24,7 +24,7 @@ class QTreeWidgetItem; class QLineEdit; -class RadioBox; +class RadioGroup; class QCheckBox; class QSpinBox; class QLabel; @@ -50,7 +50,7 @@ QPushButton* pb_color; // BFC-related widgets - RadioBox* rb_bfcType; + RadioGroup* rb_bfcType; // Subfile stuff QTreeWidget* tw_subfileList;
--- a/src/dialogs.h Fri Aug 23 01:20:09 2013 +0300 +++ b/src/dialogs.h Fri Aug 23 13:01:36 2013 +0300 @@ -33,7 +33,7 @@ class QPushButton; class QLineEdit; class QSpinBox; -class RadioBox; +class RadioGroup; class QLabel; class QAbstractButton; class Ui_OverlayUI;
--- a/src/gldraw.h Fri Aug 23 01:20:09 2013 +0300 +++ b/src/gldraw.h Fri Aug 23 13:01:36 2013 +0300 @@ -25,7 +25,7 @@ class MessageManager; class QDialogButtonBox; -class RadioBox; +class RadioGroup; class QDoubleSpinBox; class QSpinBox; class QLineEdit;
--- a/src/widgets.cpp Fri Aug 23 01:20:09 2013 +0300 +++ b/src/widgets.cpp Fri Aug 23 13:01:36 2013 +0300 @@ -16,12 +16,9 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -// I still find the radio box useful... find a way to use this in Designer. +// I still find the radio group useful... find a way to use this in Designer. // I probably need to look into how to make Designer plugins. -// -// The name is quite confusing too considering there's the check box and radio -// button around. This widget is a group of radio buttons. -// TODO: rename to RadioGroup, make this usable in Designer +// TODO: try make this usable in Designer #include <QBoxLayout> #include <QRadioButton> @@ -33,7 +30,7 @@ // ============================================================================= // ----------------------------------------------------------------------------- -RadioBox::RadioBox (const QString& title, QWidget* parent) : QGroupBox (title, parent) { +RadioGroup::RadioGroup (const QString& title, QWidget* parent) : QGroupBox (title, parent) { init (Qt::Vertical); } @@ -45,13 +42,13 @@ // ============================================================================= // ----------------------------------------------------------------------------- -bool RadioBox::isChecked (int n) const { +bool RadioGroup::isChecked (int n) const { return m_buttonGroup->checkedId() == n; } // ============================================================================= // ----------------------------------------------------------------------------- -void RadioBox::init (Qt::Orientation orient) { +void RadioGroup::init (Qt::Orientation orient) { m_vert = orient == Qt::Vertical; m_buttonGroup = new QButtonGroup; @@ -70,7 +67,7 @@ // ============================================================================= // ----------------------------------------------------------------------------- -RadioBox::RadioBox (const QString& title, initlist<char const*> entries, int const defaultId, +RadioGroup::RadioGroup (const QString& title, initlist<char const*> entries, int const defaultId, const Qt::Orientation orient, QWidget* parent) : QGroupBox (title, parent), m_defId (defaultId) { init (orient); @@ -82,7 +79,7 @@ // ============================================================================= // ----------------------------------------------------------------------------- -void RadioBox::rowBreak() { +void RadioGroup::rowBreak() { QBoxLayout* newLayout = new QBoxLayout (m_vert ? QBoxLayout::TopToBottom : QBoxLayout::LeftToRight); m_currentLayout = newLayout; m_layouts << newLayout; @@ -92,14 +89,14 @@ // ============================================================================= // ----------------------------------------------------------------------------- -void RadioBox::addButton (const char* entry) { +void RadioGroup::addButton (const char* entry) { QRadioButton* button = new QRadioButton (entry); addButton (button); } // ============================================================================= // ----------------------------------------------------------------------------- -void RadioBox::addButton (QRadioButton* button) { +void RadioGroup::addButton (QRadioButton* button) { bool const selectThis = (m_curId == m_defId); m_objects << button; @@ -112,45 +109,45 @@ // ============================================================================= // ----------------------------------------------------------------------------- -RadioBox& RadioBox::operator<< (QRadioButton* button) { +RadioGroup& RadioGroup::operator<< (QRadioButton* button) { addButton (button); return *this; } // ============================================================================= // ----------------------------------------------------------------------------- -RadioBox& RadioBox::operator<< (const char* entry) { +RadioGroup& RadioGroup::operator<< (const char* entry) { addButton (entry); return *this; } // ============================================================================= // ----------------------------------------------------------------------------- -void RadioBox::setCurrentRow (uint row) { +void RadioGroup::setCurrentRow (uint row) { m_currentLayout = m_layouts[row]; } // ============================================================================= // ----------------------------------------------------------------------------- -int RadioBox::value() const { +int RadioGroup::value() const { return m_buttonGroup->checkedId(); } // ============================================================================= // ----------------------------------------------------------------------------- -void RadioBox::setValue (int val) { +void RadioGroup::setValue (int val) { m_buttonGroup->button (val)->setChecked (true); } // ============================================================================= // ----------------------------------------------------------------------------- -QRadioButton* RadioBox::operator[] (uint n) const { +QRadioButton* RadioGroup::operator[] (uint n) const { return m_objects[n]; } // ============================================================================= // ----------------------------------------------------------------------------- -void RadioBox::slot_buttonPressed (int btn) { +void RadioGroup::slot_buttonPressed (int btn) { emit buttonPressed (btn); m_oldId = m_buttonGroup->checkedId(); @@ -158,7 +155,7 @@ // ============================================================================= // ----------------------------------------------------------------------------- -void RadioBox::slot_buttonReleased (int btn) { +void RadioGroup::slot_buttonReleased (int btn) { emit buttonReleased (btn); int newid = m_buttonGroup->checkedId(); @@ -168,12 +165,12 @@ // ============================================================================= // ----------------------------------------------------------------------------- -RadioBox::it RadioBox::begin() { +RadioGroup::it RadioGroup::begin() { return m_objects.begin(); } // ============================================================================= // ----------------------------------------------------------------------------- -RadioBox::it RadioBox::end() { +RadioGroup::it RadioGroup::end() { return m_objects.end(); } \ No newline at end of file
--- a/src/widgets.h Fri Aug 23 01:20:09 2013 +0300 +++ b/src/widgets.h Fri Aug 23 13:01:36 2013 +0300 @@ -25,26 +25,27 @@ #include "common.h" #include "types.h" +class QIcon; class QCheckBox; class QButtonGroup; class QBoxLayout; class QRadioButton; // ============================================================================= -// RadioBox +// RadioGroup // // Convenience widget - is a groupbox of radio buttons. // ============================================================================= -class RadioBox : public QGroupBox { +class RadioGroup : public QGroupBox { Q_OBJECT public: typedef List<QRadioButton*>::it it; - explicit RadioBox() { init (Qt::Vertical); } - explicit RadioBox (QWidget* parent = null) : QGroupBox (parent) { init (Qt::Vertical); } - explicit RadioBox (const QString& title, QWidget* parent = null); - explicit RadioBox (const QString& title, initlist<char const*> entries, int const defaultId, + explicit RadioGroup() { init (Qt::Vertical); } + explicit RadioGroup (QWidget* parent = null) : QGroupBox (parent) { init (Qt::Vertical); } + explicit RadioGroup (const QString& title, QWidget* parent = null); + explicit RadioGroup (const QString& title, initlist<char const*> entries, int const defaultId, const Qt::Orientation orient = Qt::Vertical, QWidget* parent = null); void addButton (const char* entry); @@ -59,8 +60,8 @@ int value () const; QRadioButton* operator[] (uint n) const; - RadioBox& operator<< (QRadioButton* button); - RadioBox& operator<< (const char* entry); + RadioGroup& operator<< (QRadioButton* button); + RadioGroup& operator<< (const char* entry); signals: void buttonPressed (int btn); @@ -76,7 +77,7 @@ int m_curId, m_defId, m_oldId; QButtonGroup* m_buttonGroup; - Q_DISABLE_COPY (RadioBox) + Q_DISABLE_COPY (RadioGroup) private slots: void slot_buttonPressed (int btn);