فهرست منبع

new custom Date Edit in NewFlight Dialog

fiffty-50 4 سال پیش
والد
کامیت
c32a7e9fb2

+ 17 - 1
src/database/entry.cpp

@@ -95,8 +95,24 @@ Entry::Entry(QString table, QMap<QString, QString> newData)
     data = newData;
 }
 
-void Entry::setData(const QMap<QString, QString> &value)
+void Entry::setData(QMap<QString, QString> &value)
 {
+    //retreive database layout
+    const auto dbContent = DbInfo();
+    columns = dbContent.format.value(position.first);
+
+    //Check validity of newData
+    QVector<QString> badkeys;
+    QMap<QString, QString>::iterator i;
+    for (i = value.begin(); i != value.end(); ++i) {
+        if (!columns.contains(i.key())) {
+            DEB(i.key() << "Not in column list for table " << position.first << ". Discarding.");
+            badkeys << i.key();
+        }
+    }
+    for (const auto &var : badkeys) {
+        value.remove(var);
+    }
     data = value;
 }
 

+ 1 - 1
src/database/entry.h

@@ -38,7 +38,7 @@ public:
     QMap    <QString, QString>   data     = QMap<QString, QString>(); // Tha data to fill that table, <column,value>
     QString                      error    = QString();                // holds sql errors (if they ocurred)
 
-    void setData(const QMap<QString, QString> &value);
+    void setData(QMap<QString, QString> &value);
 
     bool commit();
     bool remove();

+ 151 - 19
src/gui/dialogues/newflight.cpp

@@ -33,6 +33,21 @@ void NewFlight::on_verifyButton_clicked()//debug button
     collectAdditionalData();
 }
 
+bool NewFlight::eventFilter(QObject* object, QEvent* event)
+{
+    if(object == ui->doftLineEdit && event->type() == QEvent::MouseButtonPress) {
+        on_doftLineEditEntered();
+        return false; // lets the event continue to the edit
+    } else if (object == ui->calendarWidget && event->type() == QEvent::Leave) {
+        ui->doftLineEdit->blockSignals(false);
+        ui->calendarWidget->hide();
+        ui->placeLabel1->resize(ui->placeLabel2->size());
+        ui->doftLineEdit->setFocus();
+        return false;
+    }
+    return false;
+}
+
 
 static const auto IATA_RX = QLatin1String("[a-zA-Z0-9]{3}");
 static const auto ICAO_RX = QLatin1String("[a-zA-Z0-9]{4}");
@@ -47,13 +62,15 @@ static const auto AIRCRAFT_VALID_RGX   = QRegularExpression("[A-Z0-9]+\\-?[A-Z0-
 static const auto PILOT_NAME_VALID_RGX = QRegularExpression(SELF_RX + QLatin1Char('|')
                                                      + NAME_RX + ADD_NAME_RX + ADD_NAME_RX + ADD_NAME_RX + ",?\\s?" // up to 4 first names
                                                      + NAME_RX + ADD_NAME_RX + ADD_NAME_RX + ADD_NAME_RX );// up to 4 last names
+static const auto DATE_VALID_RGX       = QRegularExpression("^([1-9][0-9]{3}).?(1[0-2]|0[1-9]).?(3[01]|0[1-9]|[12][0-9])?$");// . allows all seperators, still allows for 2020-02-31, additional verification via QDate::isValid()
 
 /// Invalid characters (validators keep text even if it returns Invalid, see `onInputRejected` below)
 static const auto TIME_INVALID_RGX       = QRegularExpression("[^0-9:]");
 static const auto LOC_INVALID_RGX        = QRegularExpression("[^A-Z0-9]");
 static const auto AIRCRAFT_INVALID_RGX   = QRegularExpression("[^a-zA-Z0-9\\-]");
 static const auto PILOT_NAME_INVALID_RGX = QRegularExpression("[^\\p{L}|\\s|,]");
-static const auto INVALID_CHARS_RGX      = QRegularExpression("[^\\p{L}|\\s|,|\\-|'|0-9|:]");
+static const auto DATE_INVALID_RGX       = QRegularExpression("[^0-9|:|\\.|/|-]");
+static const auto INVALID_CHARS_RGX      = QRegularExpression("[^\\p{L}|\\s|,|\\-|'|0-9|:|\\.]");
 
 /// Sql columns
 static const auto LOC_SQL_COL        = SqlColumnNum(1);  // TODO: locations are iata/icao so 1,2 merge columns in sql?
@@ -74,9 +91,11 @@ NewFlight::NewFlight(QWidget *parent, Db::editRole edRole) :
     role = edRole;
     doUpdate = true;
     setup();
-    //set date for new object
+    //set date
     auto date = QDate::currentDate();
-    ui->doftDateEdit->setDate(date);
+    ui->doftLineEdit->setText(date.toString(Qt::ISODate));
+    emit ui->doftLineEdit->editingFinished();
+
 
     // Visually mark mandatory fields
     ui->deptLocLineEdit->setStyleSheet("border: 1px solid orange");
@@ -117,6 +136,8 @@ void NewFlight::setup(){
          LineEditSettings(PILOT_NAME_VALID_RGX, PILOT_NAME_INVALID_RGX, PILOT_NAME_SQL_COL);
     const auto time_settings = \
          LineEditSettings(TIME_VALID_RGX, TIME_INVALID_RGX, SqlColumnNum());
+    const auto doft_settings = \
+         LineEditSettings(DATE_VALID_RGX, DATE_INVALID_RGX, SqlColumnNum());
 
 //     Set up Line Edits with QValidators, QCompleters
     auto line_edits = ui->flightDataTab->findChildren<QLineEdit*>();
@@ -128,6 +149,7 @@ void NewFlight::setup(){
     }
     this->allOkBits.resize(line_edits.size());
     this->mandatoryLineEdits = {
+        ui->doftLineEdit,
         ui->deptLocLineEdit,
         ui->destLocLineEdit,
         ui->tofbTimeLineEdit,
@@ -142,18 +164,18 @@ void NewFlight::setup(){
         if(QRegularExpression("Loc").match(le_name).hasMatch()){
             setupLineEdit(line_edit, location_settings);
         }
-        else if (QRegularExpression("Time").match(le_name).hasMatch())
-        {
+        else if (QRegularExpression("Time").match(le_name).hasMatch()) {
             setupLineEdit(line_edit, time_settings);
         }
-        else if (QRegularExpression("acft").match(le_name).hasMatch())
-        {
+        else if (QRegularExpression("acft").match(le_name).hasMatch()) {
             setupLineEdit(line_edit, aircraft_settings);
         }
-        else if (QRegularExpression("Name").match(le_name).hasMatch())
-        {
+        else if (QRegularExpression("Name").match(le_name).hasMatch()) {
             setupLineEdit(line_edit, pilot_name_settings);
         }
+        else if(QRegularExpression("doft").match(le_name).hasMatch()) {
+            setupLineEdit(line_edit, doft_settings);
+        }
     }
     //fill Lists
     pilots = CompletionList(CompleterTarget::pilots).list;
@@ -175,7 +197,14 @@ void NewFlight::setup(){
     PilotTaskGroup->addButton(ui->PilotMonitoringCheckBox);
 
     ui->flightDataTabWidget->setCurrentIndex(0);
+    ui->flightDataTabWidget->removeTab(2); // hide calendar widget
+    ui->calendarWidget->installEventFilter(this);
+    ui->placeLabel1->installEventFilter(this);
+    ui->doftLineEdit->installEventFilter(this);
     ui->deptLocLineEdit->setFocus();
+
+    connect(ui->calendarWidget, SIGNAL(clicked(const QDate &)), this, SLOT(date_clicked(const QDate &)));
+    connect(ui->calendarWidget, SIGNAL(activated(const QDate &)), this, SLOT(date_selected(const QDate &)));
 }
 
 void NewFlight::formFiller(Flight oldFlight)
@@ -183,7 +212,7 @@ void NewFlight::formFiller(Flight oldFlight)
     DEBUG("Filling Line Edits...");
     DEBUG("With Data: " << oldFlight.data);
     // Date
-    ui->doftDateEdit->setDate(QDate::fromString(oldFlight.data.value("doft"), Qt::ISODate));
+    //ui->doftLineEdit->setDate(QDate::fromString(oldFlight.data.value("doft"), Qt::ISODate));
     QStringList filled;
 
     // Line Edits
@@ -498,9 +527,11 @@ void NewFlight::collectBasicData()
     newData.clear();
     DEBUG("Collecting Basic Input...");
     // Date of Flight
-    auto date = ui->doftDateEdit->date();
-    auto doft = date.toString(Qt::ISODate);
-    newData.insert("doft",doft);
+    if(QDate::fromString(ui->doftLineEdit->text(),Qt::ISODate).isValid()) {
+        auto doft = ui->doftLineEdit->text();
+        newData.insert("doft",doft);
+    }
+
     // Departure Loc
     newData.insert("dept",ui->deptLocLineEdit->text());
     // Time Off Blocks
@@ -635,7 +666,7 @@ void NewFlight::collectAdditionalData()
         newData.insert("tIFR","");
     }
     // Night
-    QString deptDate = ui->doftDateEdit->date().toString(Qt::ISODate) + 'T' + tofb.toString("hh:mm");
+    QString deptDate = ui->doftLineEdit->text() + 'T' + tofb.toString("hh:mm");
     QDateTime deptDateTime = QDateTime::fromString(deptDate,"yyyy-MM-ddThh:mm");
     int tblk = blockMinutes.toInt();
     const int nightAngle = Settings::read("flightlogging/nightangle").toInt();
@@ -714,7 +745,7 @@ void NewFlight::collectAdditionalData()
             newData.insert("ldgDay", "0");
             newData.insert("ldgNight", QString::number(ui->LandingSpinBox->value()));
         } else { //check
-            QString destDate = ui->doftDateEdit->date().toString(Qt::ISODate) + 'T' + tonb.toString("hh:mm");
+            QString destDate = ui->doftLineEdit->text() + 'T' + tonb.toString("hh:mm");
             QDateTime destDateTime = QDateTime::fromString(destDate,"yyyy-MM-ddThh:mm");
             if(Calc::isNight(ui->destLocLineEdit->text(), destDateTime,  nightAngle)){
                 newData.insert("ldgDay", "0");
@@ -785,7 +816,7 @@ void NewFlight::fillExtras()
         ui->tIFRLabel->setText(blockTime);
     }
     // Night
-    QString deptDate = ui->doftDateEdit->date().toString(Qt::ISODate) + 'T' + tofb.toString("hh:mm");
+    QString deptDate = ui->doftLineEdit->text() + 'T' + tofb.toString("hh:mm");
     QDateTime deptDateTime = QDateTime::fromString(deptDate,"yyyy-MM-ddThh:mm");
     int tblk = blockMinutes.toInt();
     const int nightAngle = Settings::read("flightlogging/nightangle").toInt();
@@ -845,7 +876,6 @@ bool NewFlight::verifyInput()
         {
             lineEditText.push_back(line_edit->text());
         }
-        this->result = lineEditText;
         emit mandatoryFieldsValid(this);
         return true;
     }
@@ -906,7 +936,7 @@ void NewFlight::on_buttonBox_rejected()
  * valid characters are kept on the line edit.
  */
 void NewFlight::onInputRejected(QLineEdit* line_edit, QRegularExpression rgx){
-    //DEBUG("Input rejected" << line_edit->text());
+    DEBUG("Input rejected" << line_edit->text());
     line_edit->setStyleSheet("border: 1px solid red");
     this->allOkBits.setBit(this->lineEditBitMap[line_edit], false);
     auto text = line_edit->text();
@@ -915,6 +945,7 @@ void NewFlight::onInputRejected(QLineEdit* line_edit, QRegularExpression rgx){
         line_edit->setText(text);
     }
     if(INVALID_CHARS_RGX.match(text).hasMatch()){//remove globaly inacceptable chars
+        DEBUG("Removing invalid char: " << text[text.length()-1]);
         text.chop(1);
         line_edit->setText(text);
     }
@@ -930,7 +961,108 @@ void NewFlight::onEditingFinishedCleanup(QLineEdit* line_edit)
     this->allOkBits.setBit(this->lineEditBitMap[line_edit], true);
 }
 
-QStringList* NewFlight::getResult() { return &this->result; }
+/// Date
+
+void NewFlight::on_doftLineEditEntered()
+{
+    const auto& cw = ui->calendarWidget;
+    const auto& le = ui->doftLineEdit;
+    const auto& label = ui->placeLabel1;
+
+    if(cw->isVisible()){
+        le->blockSignals(false);
+        DEBUG("Enabling line edit signals for: " << le->objectName());
+        cw->hide();
+        label->resize(ui->placeLabel2->size());
+        le->setFocus();
+    } else {
+        le->blockSignals(true);
+        DEBUG("Disabling line edit signals for: " << le->objectName());
+        // Determine size based on layout coordinates
+        int c1 = label->pos().rx();
+        int c2 = le->pos().rx();
+        int z  = le->size().rwidth();
+        int x = (c2 - c1) + z;
+        c1 = label->pos().ry();
+        c2 = ui->acftLineEdit->pos().ry();
+        z  = ui->acftLineEdit->size().height();
+        int y = (c2 - c1) + z;
+        //Re-size calendar and parent label accordingly
+        label->resize(x, y);
+        cw->setParent(ui->placeLabel1);
+        cw->setGeometry(QRect(0, 0, x, y));
+        cw->show();
+        cw->setFocus();
+    }
+}
+
+void NewFlight::date_clicked(const QDate &date)
+{
+    DEBUG("Date clicked: " << date);
+
+    const auto& le = ui->doftLineEdit;
+    le->blockSignals(false);
+    ui->calendarWidget->hide();
+    ui->placeLabel1->resize(ui->placeLabel2->size());
+    le->setText(date.toString(Qt::ISODate));
+    le->setFocus();
+
+    //const auto& le = ui->doftLineEdit;
+    //le->setText(date.toString(Qt::ISODate));
+    //le->setFocus();
+}
+
+void NewFlight::date_selected(const QDate &date)
+{
+    ui->calendarWidget->hide();
+    ui->placeLabel1->resize(ui->placeLabel2->size());
+    ui->doftDisplayLabel->setText(date.toString(Qt::TextDate));
+    DEBUG("Date selected: " << date);
+    const auto& le = ui->doftLineEdit;
+    le->setText(date.toString(Qt::ISODate));
+    le->setFocus();
+    le->blockSignals(false);
+    DEBUG("Enabling line edit signals for: " << le->objectName());
+}
+
+void NewFlight::on_doftLineEdit_inputRejected()
+{
+    onInputRejected(ui->doftLineEdit, DATE_INVALID_RGX);
+    ui->placeLabel1->resize(ui->placeLabel2->size());
+    ui->calendarWidget->hide();
+}
+
+void NewFlight::on_doftLineEdit_editingFinished()
+{
+    DEBUG(sender()->objectName() << "EDITING FINISHED.");
+    auto line_edit = ui->doftLineEdit;
+    auto text = ui->doftLineEdit->text();
+
+    {//try to correct input if only numbers are entered
+        const QSignalBlocker blocker(line_edit);
+        if(text.length() == 8) {
+            text.insert(4,'-');
+            text.insert(7,'-');
+            DEBUG("editet text: " << text);
+            auto date = QDate::fromString(text, Qt::ISODate);
+            if(date.isValid()) {
+                line_edit->setText(date.toString(Qt::ISODate));
+                ui->doftDisplayLabel->setText(date.toString(Qt::TextDate));
+            }
+        }
+    }
+
+    auto date = QDate::fromString(text, Qt::ISODate);
+    // check input
+    if(date.isValid()){
+        onEditingFinishedCleanup(line_edit);
+        const QSignalBlocker blocker(line_edit);
+        ui->doftDisplayLabel->setText(date.toString(Qt::TextDate));
+    } else {
+        ui->doftDisplayLabel->setText("Invalid Date");
+        emit line_edit->inputRejected();
+    }
+}
 
 void NewFlight::on_deptTZ_currentTextChanged(const QString &arg1)
 {

+ 18 - 2
src/gui/dialogues/newflight.h

@@ -30,6 +30,8 @@
 #include <QButtonGroup>
 #include <QBitArray>
 #include <QLineEdit>
+#include <QCalendarWidget>
+#include <QTabWidget>
 
 
 #include "src/database/db.h"
@@ -84,10 +86,12 @@ public:
     explicit NewFlight(QWidget *parent, Flight oldFlight, Db::editRole edRole);
     ~NewFlight();
 
-    QStringList* getResult();
+    //QStringList* getResult();
 
 private:
 
+    bool eventFilter(QObject* object, QEvent* event);
+
     void setup();
 
     void formFiller(Flight oldFlight);
@@ -194,6 +198,18 @@ private slots:
 
     void on_AutolandCheckBox_stateChanged(int arg1);
 
+    //void on_doftToolButton_clicked();
+
+    void date_clicked(const QDate &date);
+
+    void date_selected(const QDate &date);
+
+    void on_doftLineEdit_inputRejected();
+
+    void on_doftLineEdit_editingFinished();
+
+    void on_doftLineEditEntered();
+
 signals:
     void mandatoryFieldsValid(NewFlight* nf);
 
@@ -206,7 +222,7 @@ private:
     QVector<QLineEdit*> mandatoryLineEdits;
     QBitArray allOkBits;
     QMessageBox messageBox;
-    QStringList result;
+    QDate clickedDate;
     // For Flight Object
     QMap<QString, QString> airportMap;
     QStringList airports;

+ 358 - 308
src/gui/dialogues/newflight.ui

@@ -24,36 +24,49 @@
        <string>Flight Data</string>
       </attribute>
       <layout class="QGridLayout" name="gridLayout">
-       <item row="1" column="4">
-        <widget class="QLabel" name="tofbLabel">
-         <property name="text">
-          <string>Time</string>
+       <item row="9" column="0" colspan="6">
+        <widget class="Line" name="line">
+         <property name="orientation">
+          <enum>Qt::Horizontal</enum>
          </property>
         </widget>
        </item>
-       <item row="7" column="0">
-        <widget class="QLabel" name="secondPilotLabel">
+       <item row="8" column="5">
+        <widget class="QLineEdit" name="RemarksLineEdit">
+         <property name="minimumSize">
+          <size>
+           <width>200</width>
+           <height>20</height>
+          </size>
+         </property>
+         <property name="placeholderText">
+          <string>optional</string>
+         </property>
+        </widget>
+       </item>
+       <item row="12" column="3">
+        <widget class="QLabel" name="autoPicusLabel">
          <property name="text">
-          <string>Second Pilot</string>
+          <string>PICus</string>
          </property>
         </widget>
        </item>
-       <item row="1" column="0">
-        <widget class="QLabel" name="deptLabel">
+       <item row="3" column="4">
+        <widget class="QLabel" name="tonbLabel">
          <property name="text">
-          <string>Departure</string>
+          <string>Time</string>
          </property>
         </widget>
        </item>
-       <item row="14" column="3">
-        <widget class="QLabel" name="autoDualLabel">
+       <item row="15" column="3">
+        <widget class="QLabel" name="autoFILabel">
          <property name="text">
-          <string>Dual</string>
+          <string>Instructor</string>
          </property>
         </widget>
        </item>
-       <item row="14" column="4" colspan="2">
-        <widget class="QLabel" name="tDualLabel">
+       <item row="12" column="2">
+        <widget class="QLabel" name="tSPMELabel">
          <property name="minimumSize">
           <size>
            <width>80</width>
@@ -83,27 +96,36 @@
          </property>
         </widget>
        </item>
-       <item row="6" column="2">
-        <widget class="QLabel" name="acftTypeLabel">
-         <property name="sizePolicy">
-          <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
-           <horstretch>0</horstretch>
-           <verstretch>0</verstretch>
-          </sizepolicy>
+       <item row="12" column="0">
+        <widget class="QLabel" name="autoSPMELabel">
+         <property name="text">
+          <string>SP / ME</string>
          </property>
-         <property name="minimumSize">
-          <size>
-           <width>200</width>
-           <height>20</height>
-          </size>
+        </widget>
+       </item>
+       <item row="10" column="0">
+        <widget class="QLabel" name="autoTotalLabel">
+         <property name="text">
+          <string>Total Time</string>
          </property>
+        </widget>
+       </item>
+       <item row="3" column="1">
+        <widget class="QLabel" name="placeLabel2">
          <property name="text">
-          <string/>
+          <string>Place</string>
          </property>
         </widget>
        </item>
-       <item row="11" column="4" colspan="2">
-        <widget class="QLabel" name="tPICLabel">
+       <item row="8" column="0">
+        <widget class="QLabel" name="FlightNumberLabel">
+         <property name="text">
+          <string>Flight number</string>
+         </property>
+        </widget>
+       </item>
+       <item row="15" column="4" colspan="2">
+        <widget class="QLabel" name="tFILabel">
          <property name="minimumSize">
           <size>
            <width>80</width>
@@ -133,36 +155,78 @@
          </property>
         </widget>
        </item>
-       <item row="11" column="3">
-        <widget class="QLabel" name="autoPICLabel">
+       <item row="5" column="3">
+        <widget class="QLabel" name="picLabel">
          <property name="text">
-          <string>PIC</string>
+          <string>Name PIC</string>
          </property>
         </widget>
        </item>
-       <item row="3" column="4">
-        <widget class="QLabel" name="tonbLabel">
+       <item row="5" column="0">
+        <widget class="QLabel" name="acftLabel">
          <property name="text">
-          <string>Time</string>
+          <string>Aircraft</string>
          </property>
         </widget>
        </item>
-       <item row="1" column="1">
-        <widget class="QLabel" name="placeLabel1">
+       <item row="0" column="0">
+        <widget class="QLabel" name="doftLabel">
          <property name="text">
-          <string>Place</string>
+          <string>Date of Flight</string>
          </property>
         </widget>
        </item>
-       <item row="12" column="3">
-        <widget class="QLabel" name="autoPicusLabel">
+       <item row="1" column="3">
+        <widget class="QComboBox" name="deptTZ">
+         <property name="focusPolicy">
+          <enum>Qt::NoFocus</enum>
+         </property>
+         <property name="toolTip">
+          <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;UTC - Universal Time Coordinated&lt;/p&gt;&lt;p&gt;LOCAL - Local time at Airfield&lt;/p&gt;&lt;p&gt;BASE - Local time at Home Base&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+         </property>
+         <item>
+          <property name="text">
+           <string>UTC</string>
+          </property>
+         </item>
+         <item>
+          <property name="text">
+           <string>Local</string>
+          </property>
+         </item>
+        </widget>
+       </item>
+       <item row="1" column="5">
+        <widget class="QLineEdit" name="tofbTimeLineEdit">
+         <property name="minimumSize">
+          <size>
+           <width>200</width>
+           <height>20</height>
+          </size>
+         </property>
+         <property name="toolTip">
+          <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; color:#a8abb0;&quot;&gt;Enter a valid time.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; color:#a8abb0;&quot;&gt;e.g.: 845 0845 8:45 08:45&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+         </property>
+         <property name="whatsThis">
+          <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+         </property>
+         <property name="maxLength">
+          <number>5</number>
+         </property>
+         <property name="placeholderText">
+          <string>00:00</string>
+         </property>
+        </widget>
+       </item>
+       <item row="13" column="0">
+        <widget class="QLabel" name="autoMPLabel">
          <property name="text">
-          <string>PICus</string>
+          <string>Multi Pilot</string>
          </property>
         </widget>
        </item>
-       <item row="13" column="4" colspan="2">
-        <widget class="QLabel" name="tSICLabel">
+       <item row="14" column="2">
+        <widget class="QLabel" name="tIFRLabel">
          <property name="minimumSize">
           <size>
            <width>80</width>
@@ -192,31 +256,21 @@
          </property>
         </widget>
        </item>
-       <item row="0" column="2">
-        <widget class="QDateEdit" name="doftDateEdit">
-         <property name="dateTime">
-          <datetime>
-           <hour>23</hour>
-           <minute>0</minute>
-           <second>0</second>
-           <year>2019</year>
-           <month>12</month>
-           <day>2</day>
-          </datetime>
-         </property>
-         <property name="displayFormat">
-          <string>yyyy/MM/dd</string>
-         </property>
-         <property name="calendarPopup">
-          <bool>true</bool>
+       <item row="5" column="2">
+        <widget class="QLineEdit" name="acftLineEdit">
+         <property name="minimumSize">
+          <size>
+           <width>200</width>
+           <height>20</height>
+          </size>
          </property>
-         <property name="timeSpec">
-          <enum>Qt::UTC</enum>
+         <property name="placeholderText">
+          <string>D-LMAO</string>
          </property>
         </widget>
        </item>
-       <item row="14" column="2">
-        <widget class="QLabel" name="tIFRLabel">
+       <item row="14" column="4" colspan="2">
+        <widget class="QLabel" name="tDualLabel">
          <property name="minimumSize">
           <size>
            <width>80</width>
@@ -246,37 +300,18 @@
          </property>
         </widget>
        </item>
-       <item row="5" column="2">
-        <widget class="QLineEdit" name="acftLineEdit">
-         <property name="minimumSize">
-          <size>
-           <width>200</width>
-           <height>20</height>
-          </size>
-         </property>
-         <property name="placeholderText">
-          <string>D-LMAO</string>
+       <item row="1" column="1">
+        <widget class="QLabel" name="placeLabel1">
+         <property name="text">
+          <string>Place</string>
          </property>
         </widget>
        </item>
-       <item row="1" column="3">
-        <widget class="QComboBox" name="deptTZ">
-         <property name="focusPolicy">
-          <enum>Qt::NoFocus</enum>
-         </property>
-         <property name="toolTip">
-          <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;UTC - Universal Time Coordinated&lt;/p&gt;&lt;p&gt;LOCAL - Local time at Airfield&lt;/p&gt;&lt;p&gt;BASE - Local time at Home Base&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+       <item row="3" column="0">
+        <widget class="QLabel" name="destLabel">
+         <property name="text">
+          <string>Destination</string>
          </property>
-         <item>
-          <property name="text">
-           <string>UTC</string>
-          </property>
-         </item>
-         <item>
-          <property name="text">
-           <string>Local</string>
-          </property>
-         </item>
         </widget>
        </item>
        <item row="3" column="2">
@@ -304,84 +339,107 @@
          </property>
         </widget>
        </item>
-       <item row="11" column="2">
-        <widget class="QLabel" name="tSPSELabel">
+       <item row="1" column="2">
+        <widget class="QLineEdit" name="deptLocLineEdit">
          <property name="minimumSize">
           <size>
-           <width>80</width>
-           <height>20</height>
-          </size>
-         </property>
-         <property name="maximumSize">
-          <size>
-           <width>80</width>
+           <width>200</width>
            <height>20</height>
           </size>
          </property>
          <property name="toolTip">
-          <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Once all the required items are filled out, the total time of flight will be displayed here.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+          <string>Enter the ICAO 4-letter Identifier of the Airport</string>
          </property>
-         <property name="styleSheet">
-          <string notr="true"/>
+         <property name="inputMethodHints">
+          <set>Qt::ImhNone</set>
          </property>
-         <property name="frameShape">
-          <enum>QFrame::NoFrame</enum>
+         <property name="inputMask">
+          <string/>
          </property>
-         <property name="frameShadow">
-          <enum>QFrame::Plain</enum>
+         <property name="maxLength">
+          <number>4</number>
          </property>
-         <property name="text">
-          <string> 00:00</string>
+         <property name="placeholderText">
+          <string>KJFK</string>
          </property>
         </widget>
        </item>
-       <item row="8" column="5">
-        <widget class="QLineEdit" name="RemarksLineEdit">
-         <property name="minimumSize">
-          <size>
-           <width>200</width>
-           <height>20</height>
-          </size>
-         </property>
-         <property name="placeholderText">
-          <string>optional</string>
+       <item row="7" column="0">
+        <widget class="QLabel" name="secondPilotLabel">
+         <property name="text">
+          <string>Second Pilot</string>
          </property>
         </widget>
        </item>
-       <item row="5" column="3">
-        <widget class="QLabel" name="picLabel">
+       <item row="11" column="0">
+        <widget class="QLabel" name="autoSPSELabel">
          <property name="text">
-          <string>Name PIC</string>
+          <string>SP / SE</string>
          </property>
         </widget>
        </item>
-       <item row="1" column="2">
-        <widget class="QLineEdit" name="deptLocLineEdit">
+       <item row="3" column="3">
+        <widget class="QComboBox" name="destTZ">
+         <property name="focusPolicy">
+          <enum>Qt::NoFocus</enum>
+         </property>
+         <property name="toolTip">
+          <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;UTC - Universal Time Coordinated&lt;/p&gt;&lt;p&gt;LOCAL - Local time at Airfield&lt;/p&gt;&lt;p&gt;BASE - Local time at Home Base&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+         </property>
+         <item>
+          <property name="text">
+           <string>UTC</string>
+          </property>
+         </item>
+         <item>
+          <property name="text">
+           <string>Local</string>
+          </property>
+         </item>
+        </widget>
+       </item>
+       <item row="6" column="2">
+        <widget class="QLabel" name="acftTypeLabel">
+         <property name="sizePolicy">
+          <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+           <horstretch>0</horstretch>
+           <verstretch>0</verstretch>
+          </sizepolicy>
+         </property>
          <property name="minimumSize">
           <size>
            <width>200</width>
            <height>20</height>
           </size>
          </property>
-         <property name="toolTip">
-          <string>Enter the ICAO 4-letter Identifier of the Airport</string>
-         </property>
-         <property name="inputMethodHints">
-          <set>Qt::ImhNone</set>
-         </property>
-         <property name="inputMask">
+         <property name="text">
           <string/>
          </property>
-         <property name="maxLength">
-          <number>4</number>
+        </widget>
+       </item>
+       <item row="11" column="3">
+        <widget class="QLabel" name="autoPICLabel">
+         <property name="text">
+          <string>PIC</string>
          </property>
-         <property name="placeholderText">
-          <string>KJFK</string>
+        </widget>
+       </item>
+       <item row="1" column="0">
+        <widget class="QLabel" name="deptLabel">
+         <property name="text">
+          <string>Departure</string>
          </property>
         </widget>
        </item>
-       <item row="12" column="2">
-        <widget class="QLabel" name="tSPMELabel">
+       <item row="14" column="3">
+        <widget class="QLabel" name="autoDualLabel">
+         <property name="text">
+          <string>Dual</string>
+         </property>
+        </widget>
+       </item>
+       <item row="11" column="4" colspan="2">
+        <widget class="QLabel" name="tPICLabel">
          <property name="minimumSize">
           <size>
            <width>80</width>
@@ -411,37 +469,27 @@
          </property>
         </widget>
        </item>
-       <item row="12" column="0">
-        <widget class="QLabel" name="autoSPMELabel">
-         <property name="text">
-          <string>SP / ME</string>
-         </property>
-        </widget>
-       </item>
-       <item row="1" column="5">
-        <widget class="QLineEdit" name="tofbTimeLineEdit">
+       <item row="2" column="2">
+        <widget class="QLabel" name="deptNameLabel">
+         <property name="sizePolicy">
+          <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+           <horstretch>0</horstretch>
+           <verstretch>0</verstretch>
+          </sizepolicy>
+         </property>
          <property name="minimumSize">
           <size>
            <width>200</width>
            <height>20</height>
           </size>
          </property>
-         <property name="toolTip">
-          <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; color:#a8abb0;&quot;&gt;Enter a valid time.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; color:#a8abb0;&quot;&gt;e.g.: 845 0845 8:45 08:45&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
-         </property>
-         <property name="whatsThis">
-          <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
-         </property>
-         <property name="maxLength">
-          <number>5</number>
-         </property>
-         <property name="placeholderText">
-          <string>00:00</string>
+         <property name="text">
+          <string/>
          </property>
         </widget>
        </item>
-       <item row="15" column="2">
-        <widget class="QLabel" name="tNIGHTLabel">
+       <item row="13" column="2">
+        <widget class="QLabel" name="tMPLabel">
          <property name="minimumSize">
           <size>
            <width>80</width>
@@ -471,15 +519,8 @@
          </property>
         </widget>
        </item>
-       <item row="0" column="0">
-        <widget class="QLabel" name="doftLabel">
-         <property name="text">
-          <string>Date of Flight</string>
-         </property>
-        </widget>
-       </item>
-       <item row="13" column="2">
-        <widget class="QLabel" name="tMPLabel">
+       <item row="15" column="2">
+        <widget class="QLabel" name="tNIGHTLabel">
          <property name="minimumSize">
           <size>
            <width>80</width>
@@ -509,14 +550,8 @@
          </property>
         </widget>
        </item>
-       <item row="4" column="2">
-        <widget class="QLabel" name="destNameLabel">
-         <property name="sizePolicy">
-          <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
-           <horstretch>0</horstretch>
-           <verstretch>0</verstretch>
-          </sizepolicy>
-         </property>
+       <item row="7" column="2">
+        <widget class="QLineEdit" name="secondPilotNameLineEdit">
          <property name="minimumSize">
           <size>
            <width>200</width>
@@ -526,10 +561,26 @@
          <property name="text">
           <string/>
          </property>
+         <property name="placeholderText">
+          <string>optional</string>
+         </property>
         </widget>
        </item>
-       <item row="10" column="2">
-        <widget class="QLabel" name="tblkLabel">
+       <item row="8" column="2">
+        <widget class="QLineEdit" name="FlightNumberLineEdit">
+         <property name="minimumSize">
+          <size>
+           <width>200</width>
+           <height>20</height>
+          </size>
+         </property>
+         <property name="placeholderText">
+          <string>optional</string>
+         </property>
+        </widget>
+       </item>
+       <item row="13" column="4" colspan="2">
+        <widget class="QLabel" name="tSICLabel">
          <property name="minimumSize">
           <size>
            <width>80</width>
@@ -546,7 +597,7 @@
           <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Once all the required items are filled out, the total time of flight will be displayed here.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
          </property>
          <property name="styleSheet">
-          <string notr="true">color: yellow;</string>
+          <string notr="true"/>
          </property>
          <property name="frameShape">
           <enum>QFrame::NoFrame</enum>
@@ -559,76 +610,65 @@
          </property>
         </widget>
        </item>
-       <item row="11" column="0">
-        <widget class="QLabel" name="autoSPSELabel">
+       <item row="7" column="3">
+        <widget class="QLabel" name="thirdPilotLabel">
          <property name="text">
-          <string>SP / SE</string>
+          <string>Third Pilot</string>
          </property>
         </widget>
        </item>
-       <item row="2" column="2">
-        <widget class="QLabel" name="deptNameLabel">
-         <property name="sizePolicy">
-          <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
-           <horstretch>0</horstretch>
-           <verstretch>0</verstretch>
-          </sizepolicy>
-         </property>
+       <item row="12" column="4" colspan="2">
+        <widget class="QLabel" name="tPICUSLabel">
          <property name="minimumSize">
           <size>
-           <width>200</width>
+           <width>80</width>
            <height>20</height>
           </size>
          </property>
-         <property name="text">
-          <string/>
-         </property>
-        </widget>
-       </item>
-       <item row="3" column="5">
-        <widget class="QLineEdit" name="tonbTimeLineEdit">
-         <property name="minimumSize">
+         <property name="maximumSize">
           <size>
-           <width>200</width>
+           <width>80</width>
            <height>20</height>
           </size>
          </property>
          <property name="toolTip">
-          <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; color:#a8abb0;&quot;&gt;Enter a valid time.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; color:#a8abb0;&quot;&gt;e.g.: 845 0845 8:45 08:45&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+          <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Once all the required items are filled out, the total time of flight will be displayed here.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
          </property>
-         <property name="whatsThis">
-          <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+         <property name="styleSheet">
+          <string notr="true"/>
          </property>
-         <property name="placeholderText">
-          <string>00:00</string>
+         <property name="frameShape">
+          <enum>QFrame::NoFrame</enum>
+         </property>
+         <property name="frameShadow">
+          <enum>QFrame::Plain</enum>
          </property>
-        </widget>
-       </item>
-       <item row="7" column="3">
-        <widget class="QLabel" name="thirdPilotLabel">
          <property name="text">
-          <string>Third Pilot</string>
+          <string> 00:00</string>
          </property>
         </widget>
        </item>
-       <item row="7" column="2">
-        <widget class="QLineEdit" name="secondPilotNameLineEdit">
+       <item row="3" column="5">
+        <widget class="QLineEdit" name="tonbTimeLineEdit">
          <property name="minimumSize">
           <size>
            <width>200</width>
            <height>20</height>
           </size>
          </property>
-         <property name="text">
-          <string/>
+         <property name="toolTip">
+          <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; color:#a8abb0;&quot;&gt;Enter a valid time.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; color:#a8abb0;&quot;&gt;e.g.: 845 0845 8:45 08:45&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+         </property>
+         <property name="whatsThis">
+          <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
          </property>
          <property name="placeholderText">
-          <string>optional</string>
+          <string>00:00</string>
          </property>
         </widget>
        </item>
-       <item row="7" column="5">
-        <widget class="QLineEdit" name="thirdPilotNameLineEdit">
+       <item row="5" column="5">
+        <widget class="QLineEdit" name="picNameLineEdit">
          <property name="minimumSize">
           <size>
            <width>200</width>
@@ -636,33 +676,19 @@
           </size>
          </property>
          <property name="placeholderText">
-          <string>optional</string>
-         </property>
-        </widget>
-       </item>
-       <item row="13" column="0">
-        <widget class="QLabel" name="autoMPLabel">
-         <property name="text">
-          <string>Multi Pilot</string>
-         </property>
-        </widget>
-       </item>
-       <item row="5" column="0">
-        <widget class="QLabel" name="acftLabel">
-         <property name="text">
-          <string>Aircraft</string>
+          <string>self</string>
          </property>
         </widget>
        </item>
-       <item row="3" column="1">
-        <widget class="QLabel" name="placeLabel2">
+       <item row="1" column="4">
+        <widget class="QLabel" name="tofbLabel">
          <property name="text">
-          <string>Place</string>
+          <string>Time</string>
          </property>
         </widget>
        </item>
-       <item row="5" column="5">
-        <widget class="QLineEdit" name="picNameLineEdit">
+       <item row="7" column="5">
+        <widget class="QLineEdit" name="thirdPilotNameLineEdit">
          <property name="minimumSize">
           <size>
            <width>200</width>
@@ -670,39 +696,26 @@
           </size>
          </property>
          <property name="placeholderText">
-          <string>self</string>
+          <string>optional</string>
          </property>
         </widget>
        </item>
-       <item row="3" column="3">
-        <widget class="QComboBox" name="destTZ">
-         <property name="focusPolicy">
-          <enum>Qt::NoFocus</enum>
-         </property>
-         <property name="toolTip">
-          <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;UTC - Universal Time Coordinated&lt;/p&gt;&lt;p&gt;LOCAL - Local time at Airfield&lt;/p&gt;&lt;p&gt;BASE - Local time at Home Base&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+       <item row="15" column="0">
+        <widget class="QLabel" name="autoNightLabel">
+         <property name="text">
+          <string>Night</string>
          </property>
-         <item>
-          <property name="text">
-           <string>UTC</string>
-          </property>
-         </item>
-         <item>
-          <property name="text">
-           <string>Local</string>
-          </property>
-         </item>
         </widget>
        </item>
-       <item row="8" column="3">
-        <widget class="QLabel" name="RemarksLabel">
+       <item row="14" column="0">
+        <widget class="QLabel" name="autoIFRLabel">
          <property name="text">
-          <string>Remarks</string>
+          <string>IFR</string>
          </property>
         </widget>
        </item>
-       <item row="12" column="4" colspan="2">
-        <widget class="QLabel" name="tPICUSLabel">
+       <item row="11" column="2">
+        <widget class="QLabel" name="tSPSELabel">
          <property name="minimumSize">
           <size>
            <width>80</width>
@@ -732,63 +745,37 @@
          </property>
         </widget>
        </item>
-       <item row="15" column="0">
-        <widget class="QLabel" name="autoNightLabel">
+       <item row="0" column="2">
+        <widget class="QLineEdit" name="doftLineEdit"/>
+       </item>
+       <item row="8" column="3">
+        <widget class="QLabel" name="RemarksLabel">
          <property name="text">
-          <string>Night</string>
+          <string>Remarks</string>
          </property>
         </widget>
        </item>
-       <item row="8" column="2">
-        <widget class="QLineEdit" name="FlightNumberLineEdit">
+       <item row="4" column="2">
+        <widget class="QLabel" name="destNameLabel">
+         <property name="sizePolicy">
+          <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+           <horstretch>0</horstretch>
+           <verstretch>0</verstretch>
+          </sizepolicy>
+         </property>
          <property name="minimumSize">
           <size>
            <width>200</width>
            <height>20</height>
           </size>
          </property>
-         <property name="placeholderText">
-          <string>optional</string>
-         </property>
-        </widget>
-       </item>
-       <item row="14" column="0">
-        <widget class="QLabel" name="autoIFRLabel">
-         <property name="text">
-          <string>IFR</string>
-         </property>
-        </widget>
-       </item>
-       <item row="9" column="0" colspan="6">
-        <widget class="Line" name="line">
-         <property name="orientation">
-          <enum>Qt::Horizontal</enum>
-         </property>
-        </widget>
-       </item>
-       <item row="3" column="0">
-        <widget class="QLabel" name="destLabel">
-         <property name="text">
-          <string>Destination</string>
-         </property>
-        </widget>
-       </item>
-       <item row="10" column="0">
-        <widget class="QLabel" name="autoTotalLabel">
-         <property name="text">
-          <string>Total Time</string>
-         </property>
-        </widget>
-       </item>
-       <item row="15" column="3">
-        <widget class="QLabel" name="autoFILabel">
          <property name="text">
-          <string>Instructor</string>
+          <string/>
          </property>
         </widget>
        </item>
-       <item row="15" column="4" colspan="2">
-        <widget class="QLabel" name="tFILabel">
+       <item row="10" column="2">
+        <widget class="QLabel" name="tblkLabel">
          <property name="minimumSize">
           <size>
            <width>80</width>
@@ -805,7 +792,7 @@
           <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Once all the required items are filled out, the total time of flight will be displayed here.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
          </property>
          <property name="styleSheet">
-          <string notr="true"/>
+          <string notr="true">color: yellow;</string>
          </property>
          <property name="frameShape">
           <enum>QFrame::NoFrame</enum>
@@ -825,14 +812,67 @@
          </property>
         </widget>
        </item>
-       <item row="8" column="0">
-        <widget class="QLabel" name="FlightNumberLabel">
+       <item row="0" column="5">
+        <widget class="QLabel" name="doftDisplayLabel">
          <property name="text">
-          <string>Flight number</string>
+          <string/>
          </property>
         </widget>
        </item>
       </layout>
+      <zorder>placeLabel2</zorder>
+      <zorder>deptLocLineEdit</zorder>
+      <zorder>deptNameLabel</zorder>
+      <zorder>acftLineEdit</zorder>
+      <zorder>destLocLineEdit</zorder>
+      <zorder>acftTypeLabel</zorder>
+      <zorder>destNameLabel</zorder>
+      <zorder>doftLineEdit</zorder>
+      <zorder>tofbLabel</zorder>
+      <zorder>secondPilotLabel</zorder>
+      <zorder>deptLabel</zorder>
+      <zorder>autoDualLabel</zorder>
+      <zorder>tDualLabel</zorder>
+      <zorder>tPICLabel</zorder>
+      <zorder>autoPICLabel</zorder>
+      <zorder>tonbLabel</zorder>
+      <zorder>placeLabel1</zorder>
+      <zorder>autoPicusLabel</zorder>
+      <zorder>tSICLabel</zorder>
+      <zorder>tIFRLabel</zorder>
+      <zorder>deptTZ</zorder>
+      <zorder>tSPSELabel</zorder>
+      <zorder>RemarksLineEdit</zorder>
+      <zorder>picLabel</zorder>
+      <zorder>tSPMELabel</zorder>
+      <zorder>autoSPMELabel</zorder>
+      <zorder>tofbTimeLineEdit</zorder>
+      <zorder>tNIGHTLabel</zorder>
+      <zorder>doftLabel</zorder>
+      <zorder>tMPLabel</zorder>
+      <zorder>tblkLabel</zorder>
+      <zorder>autoSPSELabel</zorder>
+      <zorder>tonbTimeLineEdit</zorder>
+      <zorder>thirdPilotLabel</zorder>
+      <zorder>secondPilotNameLineEdit</zorder>
+      <zorder>thirdPilotNameLineEdit</zorder>
+      <zorder>autoMPLabel</zorder>
+      <zorder>acftLabel</zorder>
+      <zorder>picNameLineEdit</zorder>
+      <zorder>destTZ</zorder>
+      <zorder>RemarksLabel</zorder>
+      <zorder>tPICUSLabel</zorder>
+      <zorder>autoNightLabel</zorder>
+      <zorder>FlightNumberLineEdit</zorder>
+      <zorder>autoIFRLabel</zorder>
+      <zorder>line</zorder>
+      <zorder>destLabel</zorder>
+      <zorder>autoTotalLabel</zorder>
+      <zorder>autoFILabel</zorder>
+      <zorder>tFILabel</zorder>
+      <zorder>autoSICLabel</zorder>
+      <zorder>FlightNumberLabel</zorder>
+      <zorder>doftDisplayLabel</zorder>
      </widget>
      <widget class="QWidget" name="autoLoggingTab">
       <attribute name="title">
@@ -1350,6 +1390,16 @@
        </item>
       </layout>
      </widget>
+     <widget class="QWidget" name="calendarTab">
+      <attribute name="title">
+       <string>Calendar</string>
+      </attribute>
+      <layout class="QGridLayout" name="gridLayout_4">
+       <item row="0" column="0">
+        <widget class="QCalendarWidget" name="calendarWidget"/>
+       </item>
+      </layout>
+     </widget>
     </widget>
    </item>
    <item row="1" column="0">

+ 2 - 1
src/gui/widgets/aircraftwidget.cpp

@@ -42,7 +42,8 @@ AircraftWidget::~AircraftWidget()
 
 void AircraftWidget::refreshModelAndView()
 {
-    ui->stackedWidget->setCurrentIndex(0);
+    ui->stackedWidget->addWidget(parent()->findChild<QWidget*>("welcomePage"));
+    ui->stackedWidget->setCurrentWidget(parent()->findChild<QWidget*>("welcomePage"));
 
     model->setTable("viewTails");
     model->select();

+ 1 - 0
src/gui/widgets/pilotswidget.cpp

@@ -117,6 +117,7 @@ void PilotsWidget::pilot_editing_finished()
 
 void PilotsWidget::refreshModelAndView()
 {
+    ui->stackedWidget->addWidget(parent()->findChild<QWidget*>("welcomePage"));
     ui->stackedWidget->setCurrentWidget(parent()->findChild<QWidget*>("welcomePage"));
 
     model->setTable("viewPilots");

+ 3 - 0
src/gui/widgets/pilotswidget.ui

@@ -34,6 +34,9 @@
      </item>
      <item>
       <widget class="QStackedWidget" name="stackedWidget">
+       <property name="currentIndex">
+        <number>0</number>
+       </property>
        <widget class="QWidget" name="welcomePage">
         <layout class="QGridLayout" name="gridLayout_3">
          <item row="0" column="0">