diff --git a/logqso.cpp b/logqso.cpp index 073a3d3..be2d9e5 100644 --- a/logqso.cpp +++ b/logqso.cpp @@ -88,9 +88,7 @@ void LogQSO::createAdditionalField(QString key, QString value){ c->setCurrentText(key); auto layout = static_cast(ui->additionalFields->layout()); - layout->removeItem(ui->field_button_layout); layout->addRow(c, l); - layout->addItem(ui->field_button_layout); // set tab ordering if(m_additionalFieldsControls.isEmpty()){ @@ -103,6 +101,7 @@ void LogQSO::createAdditionalField(QString key, QString value){ c->setFocus(); m_additionalFieldsControls.append(l); + ui->additionalFields->setVisible(true); } QMap LogQSO::collectAdditionalFields(){ @@ -118,26 +117,25 @@ QMap LogQSO::collectAdditionalFields(){ } void LogQSO::resetAdditionalFields(){ - if(m_additionalFieldsControls.isEmpty()){ - return; - } - - auto layout = static_cast(ui->additionalFields->layout()); - layout->removeItem(ui->field_button_layout); + if(!m_additionalFieldsControls.isEmpty()){ + auto layout = static_cast(ui->additionalFields->layout()); #if QT_VERSION >= 0x050800 - for(int i = 0, count = layout->rowCount(); i < count; i++){ - layout->removeRow(0); - } + for(int i = 0, count = layout->rowCount(); i < count; i++){ + layout->removeRow(0); + } #else - QLayoutItem *child; - while((child = layout->takeAt(0)) != 0){ - delete child; - } + QLayoutItem *child; + while((child = layout->takeAt(0)) != 0){ + delete child; + } #endif - layout->addItem(ui->field_button_layout); - m_additionalFieldsControls.clear(); + m_additionalFieldsControls.clear(); + } + + setTabOrder(ui->cbComments, ui->add_new_field_button); + ui->additionalFields->setVisible(false); } void LogQSO::loadSettings () diff --git a/logqso.ui b/logqso.ui index 4d07ba4..2b3468d 100644 --- a/logqso.ui +++ b/logqso.ui @@ -41,9 +41,9 @@ 0 - 0 + -53 568 - 473 + 485 @@ -308,6 +308,19 @@ + + + + + 75 + 16777215 + + + + Qt::AlignCenter + + + @@ -439,21 +452,29 @@ - - - - - 75 - 16777215 - - - - Qt::AlignCenter - - - + + + + Additional Fields + + + + + + + + + 0 + 0 + + + + Add New Field + + + @@ -468,40 +489,11 @@ - - - Additional Fields + + + 0 - - - - - 0 - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Add New Field - - - - - - - +