[qet] [4551] Minor: Enable XRef Offset Spinbox only when Snap to Bottom is selected

[ Thread Index | Date Index | More lists.tuxfamily.org/qet Archives ]


Revision: 4551
Author:   dfochi
Date:     2016-06-10 18:46:15 +0200 (Fri, 10 Jun 2016)
Log Message:
-----------
Minor: Enable XRef Offset Spinbox only when Snap to Bottom is selected

Modified Paths:
--------------
    trunk/sources/ui/xrefpropertieswidget.cpp
    trunk/sources/ui/xrefpropertieswidget.h

Modified: trunk/sources/ui/xrefpropertieswidget.cpp
===================================================================
--- trunk/sources/ui/xrefpropertieswidget.cpp	2016-06-10 16:20:01 UTC (rev 4550)
+++ trunk/sources/ui/xrefpropertieswidget.cpp	2016-06-10 16:46:15 UTC (rev 4551)
@@ -34,6 +34,7 @@
 	buildUi();
 	connect(ui->m_display_has_cross_rb, SIGNAL(toggled(bool)),            ui->m_cross_properties_gb, SLOT(setEnabled(bool)));
 	connect(ui->m_type_cb,              SIGNAL(currentIndexChanged(int)), this,                      SLOT(typeChanged()));
+	connect(ui->m_snap_to_cb, SIGNAL(currentIndexChanged(int)), this, SLOT(enableOffsetSB(int)));
 	updateDisplay();
 }
 
@@ -45,6 +46,7 @@
 {
 	disconnect(ui->m_display_has_cross_rb, SIGNAL(toggled(bool)),            ui->m_cross_properties_gb, SLOT(setEnabled(bool)));
 	disconnect(ui->m_type_cb,              SIGNAL(currentIndexChanged(int)), this,                      SLOT(typeChanged()));
+	disconnect(ui->m_snap_to_cb,           SIGNAL(currentIndexChanged(int)), this,                      SLOT(enableOffsetSB(int)));
 	delete ui;
 }
 
@@ -149,9 +151,14 @@
 	int offset = xrp.offset();
 	ui->m_offset_sb->setValue(offset);
 
-	if (xrp.snapTo() == XRefProperties::Bottom)
+	if (xrp.snapTo() == XRefProperties::Bottom){
 		 ui->m_snap_to_cb->setCurrentIndex(ui->m_snap_to_cb->findData("bottom"));
-	else ui->m_snap_to_cb->setCurrentIndex(ui->m_snap_to_cb->findData("label"));
+		 ui->m_offset_sb->setEnabled(true);
+	}
+	else {
+		ui->m_snap_to_cb->setCurrentIndex(ui->m_snap_to_cb->findData("label"));
+		ui->m_offset_sb->setEnabled(false);
+	}
 	ui->m_show_power_cb->setChecked(xrp.showPowerContact());
 	ui->m_power_prefix_le-> setText(xrp.prefix("power"));
 	ui->m_delay_prefix_le-> setText(xrp.prefix("delay"));
@@ -173,3 +180,14 @@
 	//previous index is now the current index
 	m_previous_type_index = ui->m_type_cb->currentIndex();
 }
+
+/**
+ * @brief XRefPropertiesWidget::enableOffsetSB
+ * Enable Offset SB only if Snap to Footer is selected
+ */
+void XRefPropertiesWidget::enableOffsetSB(int i){
+	if (i)
+		ui->m_offset_sb->setEnabled(false);
+	else
+		ui->m_offset_sb->setEnabled(true);
+}

Modified: trunk/sources/ui/xrefpropertieswidget.h
===================================================================
--- trunk/sources/ui/xrefpropertieswidget.h	2016-06-10 16:20:01 UTC (rev 4550)
+++ trunk/sources/ui/xrefpropertieswidget.h	2016-06-10 16:46:15 UTC (rev 4551)
@@ -49,6 +49,7 @@
 	private slots:
 	void updateDisplay();
 	void typeChanged();
+	void enableOffsetSB(int i);
 
 
 	private:


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/