Minor: Enable XRef Offset Spinbox only when Snap to Bottom is selected

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4551 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
dfochi
2016-06-10 16:46:15 +00:00
parent e2e0aad9bc
commit 90c954d2e1
2 changed files with 21 additions and 2 deletions

View File

@@ -34,6 +34,7 @@ XRefPropertiesWidget::XRefPropertiesWidget(QHash <QString, XRefProperties> prope
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 @@ XRefPropertiesWidget::~XRefPropertiesWidget()
{
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 @@ void XRefPropertiesWidget::updateDisplay() {
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 @@ void XRefPropertiesWidget::typeChanged() {
//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);
}

View File

@@ -49,6 +49,7 @@ class XRefPropertiesWidget : public QWidget
private slots:
void updateDisplay();
void typeChanged();
void enableOffsetSB(int i);
private: