Updated log window layout, button placement, and tab ordering

This commit is contained in:
Jordan Sherer 2019-06-07 10:00:14 -04:00
parent 7ab8e9a8d6
commit 6cd22b48a9
2 changed files with 55 additions and 65 deletions

View File

@ -88,9 +88,7 @@ void LogQSO::createAdditionalField(QString key, QString value){
c->setCurrentText(key);
auto layout = static_cast<QFormLayout*>(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<QString, QVariant> LogQSO::collectAdditionalFields(){
@ -118,12 +117,8 @@ QMap<QString, QVariant> LogQSO::collectAdditionalFields(){
}
void LogQSO::resetAdditionalFields(){
if(m_additionalFieldsControls.isEmpty()){
return;
}
if(!m_additionalFieldsControls.isEmpty()){
auto layout = static_cast<QFormLayout*>(ui->additionalFields->layout());
layout->removeItem(ui->field_button_layout);
#if QT_VERSION >= 0x050800
for(int i = 0, count = layout->rowCount(); i < count; i++){
@ -136,10 +131,13 @@ void LogQSO::resetAdditionalFields(){
}
#endif
layout->addItem(ui->field_button_layout);
m_additionalFieldsControls.clear();
}
setTabOrder(ui->cbComments, ui->add_new_field_button);
ui->additionalFields->setVisible(false);
}
void LogQSO::loadSettings ()
{
m_settings->beginGroup ("LogQSO");

View File

@ -41,9 +41,9 @@
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<y>-53</y>
<width>568</width>
<height>473</height>
<height>485</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
@ -308,6 +308,19 @@
</property>
</layout>
</item>
<item row="7" column="1">
<widget class="QLineEdit" name="sent">
<property name="maximumSize">
<size>
<width>75</width>
<height>16777215</height>
</size>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="lab7">
<property name="font">
@ -439,20 +452,28 @@
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="QLineEdit" name="sent">
<property name="maximumSize">
<size>
<width>75</width>
<height>16777215</height>
</size>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</layout>
</item>
<item>
<widget class="QGroupBox" name="additionalFields">
<property name="title">
<string>Additional Fields</string>
</property>
<layout class="QFormLayout" name="formLayout_2"/>
</widget>
</item>
</layout>
<item>
<widget class="QPushButton" name="add_new_field_button">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Add New Field</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
@ -468,43 +489,14 @@
</spacer>
</item>
<item>
<widget class="QGroupBox" name="additionalFields">
<property name="title">
<string>Additional Fields</string>
</property>
<layout class="QFormLayout" name="formLayout_2">
<item row="0" column="1">
<layout class="QHBoxLayout" name="field_button_layout">
<layout class="QHBoxLayout" name="field_button_layout" stretch="">
<property name="topMargin">
<number>0</number>
</property>
<item>
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="add_new_field_button">
<property name="text">
<string>Add New Field</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item>