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); c->setCurrentText(key);
auto layout = static_cast<QFormLayout*>(ui->additionalFields->layout()); auto layout = static_cast<QFormLayout*>(ui->additionalFields->layout());
layout->removeItem(ui->field_button_layout);
layout->addRow(c, l); layout->addRow(c, l);
layout->addItem(ui->field_button_layout);
// set tab ordering // set tab ordering
if(m_additionalFieldsControls.isEmpty()){ if(m_additionalFieldsControls.isEmpty()){
@ -103,6 +101,7 @@ void LogQSO::createAdditionalField(QString key, QString value){
c->setFocus(); c->setFocus();
m_additionalFieldsControls.append(l); m_additionalFieldsControls.append(l);
ui->additionalFields->setVisible(true);
} }
QMap<QString, QVariant> LogQSO::collectAdditionalFields(){ QMap<QString, QVariant> LogQSO::collectAdditionalFields(){
@ -118,26 +117,25 @@ QMap<QString, QVariant> LogQSO::collectAdditionalFields(){
} }
void LogQSO::resetAdditionalFields(){ void LogQSO::resetAdditionalFields(){
if(m_additionalFieldsControls.isEmpty()){ if(!m_additionalFieldsControls.isEmpty()){
return; auto layout = static_cast<QFormLayout*>(ui->additionalFields->layout());
}
auto layout = static_cast<QFormLayout*>(ui->additionalFields->layout());
layout->removeItem(ui->field_button_layout);
#if QT_VERSION >= 0x050800 #if QT_VERSION >= 0x050800
for(int i = 0, count = layout->rowCount(); i < count; i++){ for(int i = 0, count = layout->rowCount(); i < count; i++){
layout->removeRow(0); layout->removeRow(0);
} }
#else #else
QLayoutItem *child; QLayoutItem *child;
while((child = layout->takeAt(0)) != 0){ while((child = layout->takeAt(0)) != 0){
delete child; delete child;
} }
#endif #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 () void LogQSO::loadSettings ()

View File

@ -41,9 +41,9 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>-53</y>
<width>568</width> <width>568</width>
<height>473</height> <height>485</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
@ -308,6 +308,19 @@
</property> </property>
</layout> </layout>
</item> </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"> <item row="8" column="0">
<widget class="QLabel" name="lab7"> <widget class="QLabel" name="lab7">
<property name="font"> <property name="font">
@ -439,21 +452,29 @@
</property> </property>
</widget> </widget>
</item> </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>
</layout> </layout>
</item> </item>
<item>
<widget class="QGroupBox" name="additionalFields">
<property name="title">
<string>Additional Fields</string>
</property>
<layout class="QFormLayout" name="formLayout_2"/>
</widget>
</item>
<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> <item>
<spacer name="verticalSpacer"> <spacer name="verticalSpacer">
<property name="orientation"> <property name="orientation">
@ -468,40 +489,11 @@
</spacer> </spacer>
</item> </item>
<item> <item>
<widget class="QGroupBox" name="additionalFields"> <layout class="QHBoxLayout" name="field_button_layout" stretch="">
<property name="title"> <property name="topMargin">
<string>Additional Fields</string> <number>0</number>
</property> </property>
<layout class="QFormLayout" name="formLayout_2"> </layout>
<item row="0" column="1">
<layout class="QHBoxLayout" name="field_button_layout">
<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> </item>
</layout> </layout>
</widget> </widget>