--- a/src/radioGroup.cpp Thu Jan 04 19:40:52 2018 +0200 +++ b/src/radioGroup.cpp Thu Jan 04 19:44:26 2018 +0200 @@ -30,28 +30,28 @@ // ============================================================================= // -RadioGroup::RadioGroup (const QString& title, QWidget* parent) : QGroupBox (title, parent) +RadioGroup::RadioGroup(const QString& title, QWidget* parent) : QGroupBox(title, parent) { - init (Qt::Vertical); + init(Qt::Vertical); } // ============================================================================= // -QBoxLayout::Direction makeDirection (Qt::Orientation orient, bool invert = false) +QBoxLayout::Direction makeDirection(Qt::Orientation orient, bool invert = false) { return (orient == (invert ? Qt::Vertical : Qt::Horizontal)) ? QBoxLayout::LeftToRight : QBoxLayout::TopToBottom; } // ============================================================================= // -bool RadioGroup::isChecked (int n) const +bool RadioGroup::isChecked(int n) const { return m_buttonGroup->checkedId() == n; } // ============================================================================= // -void RadioGroup::init (Qt::Orientation orient) +void RadioGroup::init(Qt::Orientation orient) { m_vert = orient == Qt::Vertical; @@ -59,81 +59,81 @@ m_oldId = m_curId = 0; m_coreLayout = nullptr; - m_coreLayout = new QBoxLayout ( (orient == Qt::Vertical) ? QBoxLayout::LeftToRight : QBoxLayout::TopToBottom); - setLayout (m_coreLayout); + m_coreLayout = new QBoxLayout((orient == Qt::Vertical) ? QBoxLayout::LeftToRight : QBoxLayout::TopToBottom); + setLayout(m_coreLayout); // Init the first row with a break rowBreak(); - connect (m_buttonGroup, SIGNAL (buttonPressed (int)), this, SLOT (slot_buttonPressed (int))); - connect (m_buttonGroup, SIGNAL (buttonReleased (int)), this, SLOT (slot_buttonReleased (int))); + connect(m_buttonGroup, SIGNAL(buttonPressed(int)), this, SLOT(slot_buttonPressed(int))); + connect(m_buttonGroup, SIGNAL(buttonReleased(int)), this, SLOT(slot_buttonReleased(int))); } // ============================================================================= // -RadioGroup::RadioGroup (const QString& title, QList<char const*> entries, int const defaultId, const Qt::Orientation orient, QWidget* parent) : - QGroupBox (title, parent), - m_defId (defaultId) +RadioGroup::RadioGroup(const QString& title, QList<char const*> entries, int const defaultId, const Qt::Orientation orient, QWidget* parent) : + QGroupBox(title, parent), + m_defId(defaultId) { - init (orient); + init(orient); m_oldId = m_defId; for (const char* entry : entries) - addButton (entry); + addButton(entry); } // ============================================================================= // void RadioGroup::rowBreak() { - QBoxLayout* newLayout = new QBoxLayout (m_vert ? QBoxLayout::TopToBottom : QBoxLayout::LeftToRight); + QBoxLayout* newLayout = new QBoxLayout(m_vert ? QBoxLayout::TopToBottom : QBoxLayout::LeftToRight); m_currentLayout = newLayout; m_layouts << newLayout; - m_coreLayout->addLayout (newLayout); + m_coreLayout->addLayout(newLayout); } // ============================================================================= // -void RadioGroup::addButton (QString entry) +void RadioGroup::addButton(QString entry) { - QRadioButton* button = new QRadioButton (entry); - addButton (button); + QRadioButton* button = new QRadioButton(entry); + addButton(button); } // ============================================================================= // -void RadioGroup::addButton (QRadioButton* button) +void RadioGroup::addButton(QRadioButton* button) { bool const selectThis = (m_curId == m_defId); m_objects << button; - m_buttonGroup->addButton (button, m_curId++); - m_currentLayout->addWidget (button); + m_buttonGroup->addButton(button, m_curId++); + m_currentLayout->addWidget(button); if (selectThis) - button->setChecked (true); + button->setChecked(true); } // ============================================================================= // -RadioGroup& RadioGroup::operator<< (QRadioButton* button) +RadioGroup& RadioGroup::operator<<(QRadioButton* button) { - addButton (button); + addButton(button); return *this; } // ============================================================================= // -RadioGroup& RadioGroup::operator<< (const char* entry) +RadioGroup& RadioGroup::operator<<(const char* entry) { - addButton (entry); + addButton(entry); return *this; } // ============================================================================= // -void RadioGroup::setCurrentRow (int row) +void RadioGroup::setCurrentRow(int row) { m_currentLayout = m_layouts[row]; } @@ -147,36 +147,36 @@ // ============================================================================= // -void RadioGroup::setValue (int val) +void RadioGroup::setValue(int val) { - m_buttonGroup->button (val)->setChecked (true); + m_buttonGroup->button(val)->setChecked(true); } // ============================================================================= // -QRadioButton* RadioGroup::operator[] (int n) const +QRadioButton* RadioGroup::operator[](int n) const { return m_objects[n]; } // ============================================================================= // -void RadioGroup::slot_buttonPressed (int btn) +void RadioGroup::slot_buttonPressed(int btn) { - emit buttonPressed (btn); + emit buttonPressed(btn); m_oldId = m_buttonGroup->checkedId(); } // ============================================================================= // -void RadioGroup::slot_buttonReleased (int btn) +void RadioGroup::slot_buttonReleased(int btn) { - emit buttonReleased (btn); + emit buttonReleased(btn); int newid = m_buttonGroup->checkedId(); if (m_oldId != newid) - emit valueChanged (newid); + emit valueChanged(newid); } // =============================================================================