8#include <QStringBuilder>
11#include "ui_aircraftcombinedtypeselector.h"
17using namespace swift::misc::aviation;
26 &CAircraftCombinedTypeSelector::combinedTypeEntered);
28 &CAircraftCombinedTypeSelector::combinedTypeEntered);
31 &CAircraftCombinedTypeSelector::changedComboBox);
33 &CAircraftCombinedTypeSelector::changedComboBox);
43 QString engineCount, engineType, aircraftType;
53 aircraftType = cc.
at(0);
57 engineCount = cc.
mid(1, 1);
61 engineType = cc.
mid(2, 1);
64 if (this->getCombinedTypeFromComboBoxes() != cc)
71 if (ui->le_CombinedType->text() != cc)
73 ui->le_CombinedType->setText(cc);
86 ui->le_CombinedType->clear();
91 ui->le_CombinedType->setReadOnly(readOnly);
92 ui->cb_EngineCount->setEnabled(!readOnly);
93 ui->cb_EngineType->setEnabled(!readOnly);
94 ui->cb_Type->setEnabled(!readOnly);
99 QString ct(ui->le_CombinedType->text().trimmed().toUpper());
109 QString ct2(getCombinedTypeFromComboBoxes());
113 void CAircraftCombinedTypeSelector::combinedTypeEntered()
115 const QString cc(ui->le_CombinedType->text().trimmed().toUpper() % u
"---");
119 void CAircraftCombinedTypeSelector::changedComboBox(
const QString &text)
122 const QString ct(this->getCombinedTypeFromComboBoxes());
123 if (ui->le_CombinedType->text() == ct)
127 ui->le_CombinedType->setText(ct);
131 QString CAircraftCombinedTypeSelector::getCombinedTypeFromComboBoxes()
const
134 QString ec = ui->cb_EngineCount->currentText().left(1);
135 QString t = ui->cb_Type->currentText().left(1);
136 QString et = ui->cb_EngineType->currentText().left(1);
139 return ct2.replace(
'U',
'-');
static bool setComboBoxValueByStartingString(QComboBox *box, const QString &candidate, const QString &unspecified=QString())
Find best match in comboBox.
void setReadOnly(bool readOnly)
Read only.
void setCombinedType(const QString &combinedCode)
Set comined code, e.g. L1P.
void changedCombinedType(const QString &cominedType)
Combined type has beend changed.
QString getCombinedType() const
Get the combined type, e.g. "L2P".
~CAircraftCombinedTypeSelector()
Destructor.
CAircraftCombinedTypeSelector(QWidget *parent=nullptr)
Constructor.
Value object for ICAO classification.
static bool isValidCombinedType(const QString &combinedType)
Valid combined type.
const QString & getCombinedType() const
Get type, e.g. "L2J".
High level reusable GUI components.
void currentTextChanged(const QString &text)
QFrame(QWidget *parent, Qt::WindowFlags f)
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
QObject * parent() const const
const QChar at(qsizetype position) const const
bool isEmpty() const const
QString left(qsizetype n) &&
qsizetype length() const const
QString mid(qsizetype position, qsizetype n) &&
QString toUpper() const const
QString trimmed() const const