src/widgets.cpp

changeset 493
16766ac1bbd9
parent 491
7d1b5ecd76c0
child 494
bd005c78a089
--- a/src/widgets.cpp	Thu Oct 03 18:07:06 2013 +0300
+++ b/src/widgets.cpp	Thu Oct 03 20:56:20 2013 +0300
@@ -27,151 +27,151 @@
 #include <map>
 
 #include "widgets.h"
+#include "moc_widgets.cpp"
 
 // =============================================================================
 // -----------------------------------------------------------------------------
-RadioGroup::RadioGroup (const QString& title, QWidget* parent) : QGroupBox (title, parent) {
-	init (Qt::Vertical);
+RadioGroup::RadioGroup (const QString& title, QWidget* parent) : QGroupBox (title, parent)
+{	init (Qt::Vertical);
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
-QBoxLayout::Direction makeDirection (Qt::Orientation orient, bool invert = false) {
-	return (orient == (invert ? Qt::Vertical : Qt::Horizontal)) ? QBoxLayout::LeftToRight : QBoxLayout::TopToBottom;
+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 {
-	return m_buttonGroup->checkedId() == n;
+bool RadioGroup::isChecked (int n) const
+{	return m_buttonGroup->checkedId() == n;
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
-void RadioGroup::init (Qt::Orientation orient) {
-	m_vert = orient == Qt::Vertical;
-	
+void RadioGroup::init (Qt::Orientation orient)
+{	m_vert = orient == Qt::Vertical;
+
 	m_buttonGroup = new QButtonGroup;
 	m_oldId = m_curId = 0;
 	m_coreLayout = null;
-	
-	m_coreLayout = new QBoxLayout ((orient == Qt::Vertical) ? QBoxLayout::LeftToRight : QBoxLayout::TopToBottom);
+
+	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)));
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
-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);
+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);
 	m_oldId = m_defId;
-	
-	for (char const* entry : entries)
+
+	for (const char* entry : entries)
 		addButton (entry);
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
-void RadioGroup::rowBreak() {
-	QBoxLayout* newLayout = new QBoxLayout (m_vert ? QBoxLayout::TopToBottom : QBoxLayout::LeftToRight);
+void RadioGroup::rowBreak()
+{	QBoxLayout* newLayout = new QBoxLayout (m_vert ? QBoxLayout::TopToBottom : QBoxLayout::LeftToRight);
 	m_currentLayout = newLayout;
 	m_layouts << newLayout;
-	
+
 	m_coreLayout->addLayout (newLayout);
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
-void RadioGroup::addButton (const char* entry) {
-	QRadioButton* button = new QRadioButton (entry);
+void RadioGroup::addButton (const char* entry)
+{	QRadioButton* button = new QRadioButton (entry);
 	addButton (button);
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
-void RadioGroup::addButton (QRadioButton* button) {
-	bool const selectThis = (m_curId == m_defId);
-	
+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);
-	
+
 	if (selectThis)
 		button->setChecked (true);
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
-RadioGroup& RadioGroup::operator<< (QRadioButton* button) {
-	addButton (button);
+RadioGroup& RadioGroup::operator<< (QRadioButton* button)
+{	addButton (button);
 	return *this;
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
-RadioGroup& RadioGroup::operator<< (const char* entry) {
-	addButton (entry);
+RadioGroup& RadioGroup::operator<< (const char* entry)
+{	addButton (entry);
 	return *this;
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
-void RadioGroup::setCurrentRow (uint row) {
-	m_currentLayout = m_layouts[row];
+void RadioGroup::setCurrentRow (uint row)
+{	m_currentLayout = m_layouts[row];
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
-int RadioGroup::value() const {
-	return m_buttonGroup->checkedId();
+int RadioGroup::value() const
+{	return m_buttonGroup->checkedId();
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
-void RadioGroup::setValue (int val) {
-	m_buttonGroup->button (val)->setChecked (true);
+void RadioGroup::setValue (int val)
+{	m_buttonGroup->button (val)->setChecked (true);
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
-QRadioButton* RadioGroup::operator[] (uint n) const {
-	return m_objects[n];
+QRadioButton* RadioGroup::operator[] (uint n) const
+{	return m_objects[n];
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
-void RadioGroup::slot_buttonPressed (int btn) {
-	emit buttonPressed (btn);
-	
+void RadioGroup::slot_buttonPressed (int btn)
+{	emit buttonPressed (btn);
+
 	m_oldId = m_buttonGroup->checkedId();
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
-void RadioGroup::slot_buttonReleased (int btn) {
-	emit buttonReleased (btn);
+void RadioGroup::slot_buttonReleased (int btn)
+{	emit buttonReleased (btn);
 	int newid = m_buttonGroup->checkedId();
-	
+
 	if (m_oldId != newid)
 		emit valueChanged (newid);
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
-RadioGroup::it RadioGroup::begin() {
-	 return m_objects.begin();
+RadioGroup::it RadioGroup::begin()
+{	return m_objects.begin();
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
-RadioGroup::it RadioGroup::end() {
-	return m_objects.end();
+RadioGroup::it RadioGroup::end()
+{	return m_objects.end();
 }
-#include "moc_widgets.cpp"

mercurial