changeset 1197:ff77b7707c95 levelpanwidget

Take advantage of the fact that a group layout is now always used, to simplify code
author Chris Cannam
date Fri, 16 Dec 2016 13:10:21 +0000
parents b1e3ee5f1be6
children 69ff93e0c624
files widgets/PropertyBox.cpp
diffstat 1 files changed, 14 insertions(+), 40 deletions(-) [+]
line wrap: on
line diff
--- a/widgets/PropertyBox.cpp	Fri Dec 16 13:08:33 2016 +0000
+++ b/widgets/PropertyBox.cpp	Fri Dec 16 13:10:21 2016 +0000
@@ -255,18 +255,15 @@
 	      << groupName << "\"" << endl;
 #endif
 
-    bool inGroup = (groupName != QString());
-
     if (!have) {
 
         QLabel *labelWidget = 0;
 
-	if (inGroup) {
+	if (groupName != QString()) {
 	    if (m_groupLayouts.find(groupName) == m_groupLayouts.end()) {
                 labelWidget = new QLabel(groupName, m_mainWidget);
             }
         } else {
-            inGroup = true;
             groupName = "ungrouped: " + propertyLabel;
 	    if (m_groupLayouts.find(groupName) == m_groupLayouts.end()) {
                 labelWidget = new QLabel(propertyLabel, m_mainWidget);
@@ -322,13 +319,9 @@
                     this, SLOT(mouseEnteredWidget()));
             connect(button, SIGNAL(mouseLeft()),
                     this, SLOT(mouseLeftWidget()));
-	    if (inGroup) {
-		button->setToolTip(propertyLabel);
-		m_groupLayouts[groupName]->addWidget
-                    (button, 0, m_groupLayouts[groupName]->columnCount());
-	    } else {
-		m_layout->addWidget(button, row, 1, 1, 2);
-	    }
+            button->setToolTip(propertyLabel);
+            m_groupLayouts[groupName]->addWidget
+                (button, 0, m_groupLayouts[groupName]->columnCount());
 	    m_propertyControllers[name] = button;
 	}
 
@@ -377,21 +370,10 @@
             connect(dial, SIGNAL(mouseLeft()),
                     this, SLOT(mouseLeftWidget()));
 
-	    if (inGroup) {
-		dial->setFixedWidth(WidgetScale::scalePixelSize(24));
-		dial->setFixedHeight(WidgetScale::scalePixelSize(24));
-		m_groupLayouts[groupName]->addWidget
-                    (dial, 0, m_groupLayouts[groupName]->columnCount());
-	    } else {
-		dial->setFixedWidth(WidgetScale::scalePixelSize(32));
-		dial->setFixedHeight(WidgetScale::scalePixelSize(32));
-		m_layout->addWidget(dial, row, 1);
-		QLabel *label = new QLabel(m_mainWidget);
-		connect(dial, SIGNAL(valueChanged(int)),
-			label, SLOT(setNum(int)));
-		label->setNum(value);
-		m_layout->addWidget(label, row, 2);
-	    }
+            dial->setFixedWidth(WidgetScale::scalePixelSize(24));
+            dial->setFixedHeight(WidgetScale::scalePixelSize(24));
+            m_groupLayouts[groupName]->addWidget
+                (dial, 0, m_groupLayouts[groupName]->columnCount());
 
 	    m_propertyControllers[name] = dial;
 	}
@@ -425,13 +407,9 @@
             connect(cb, SIGNAL(mouseLeft()),
                     this, SLOT(mouseLeftWidget()));
 
-	    if (inGroup) {
-		cb->setToolTip(propertyLabel);
-		m_groupLayouts[groupName]->addWidget
-                    (cb, 0, m_groupLayouts[groupName]->columnCount());
-	    } else {
-		m_layout->addWidget(cb, row, 1, 1, 2);
-	    }
+            cb->setToolTip(propertyLabel);
+            m_groupLayouts[groupName]->addWidget
+                (cb, 0, m_groupLayouts[groupName]->columnCount());
 	    m_propertyControllers[name] = cb;
 	}
 
@@ -509,13 +487,9 @@
             connect(cb, SIGNAL(mouseLeft()),
                     this, SLOT(mouseLeftWidget()));
 
-	    if (inGroup) {
-		cb->setToolTip(propertyLabel);
-		m_groupLayouts[groupName]->addWidget
-                    (cb, 0, m_groupLayouts[groupName]->columnCount());
-	    } else {
-		m_layout->addWidget(cb, row, 1, 1, 2);
-	    }
+            cb->setToolTip(propertyLabel);
+            m_groupLayouts[groupName]->addWidget
+                (cb, 0, m_groupLayouts[groupName]->columnCount());
 	    m_propertyControllers[name] = cb;
 	}