Cockpit COM component align widget heights

This commit is contained in:
Klaus Basan
2019-03-31 00:22:48 +01:00
committed by Mat Sutcliffe
parent 8c5ee52128
commit 9f1090d430
5 changed files with 39 additions and 0 deletions

View File

@@ -100,6 +100,11 @@ namespace BlackGui
ui->cb_SelcalPairs2->setCurrentIndex(0);
}
int CSelcalCodeSelector::getComboBoxHeight() const
{
return ui->cb_SelcalPairs1->height();
}
void CSelcalCodeSelector::selcalIndexChanged(int index)
{
Q_UNUSED(index);

View File

@@ -59,6 +59,9 @@ namespace BlackGui
//! Clear
void clear();
//! The height of the combobox
int getComboBoxHeight() const;
signals:
//! Value has been changed
void valueChanged();

View File

@@ -2,6 +2,14 @@
<ui version="4.0">
<class>CSelcalCodeSelector</class>
<widget class="QFrame" name="CSelcalCodeSelector">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>132</width>
<height>22</height>
</rect>
</property>
<property name="windowTitle">
<string>SELCAL selector</string>
</property>

View File

@@ -31,6 +31,7 @@ namespace BlackGui
ui(new Ui::CCockpitComForm)
{
ui->setupUi(this);
this->alignUiElementsHeight();
// SELCAL pairs in cockpit
ui->frp_ComPanelSelcalSelector->clear();
@@ -249,6 +250,7 @@ namespace BlackGui
ui->ds_ComPanelCom2Standby->setValue(f);
}
this->alignUiElementsHeight();
const CSimulatedAircraft aircraft = this->cockpitValuesToAircraftObject();
emit this->changedCockpitValues(aircraft);
}
@@ -259,6 +261,24 @@ namespace BlackGui
emit this->changedSelcal(selcal);
}
void CCockpitComForm::alignUiElementsHeight()
{
const int selcalH = ui->frp_ComPanelSelcalSelector->getComboBoxHeight();
if (selcalH > ui->ds_ComPanelCom1Standby->height())
{
ui->ds_ComPanelCom1Standby->setMinimumHeight(selcalH);
ui->ds_ComPanelCom2Standby->setMinimumHeight(selcalH);
}
const int xpdrH = ui->cbp_ComPanelTransponderMode->height();
if (xpdrH > ui->ds_ComPanelCom1Active->height())
{
ui->ds_ComPanelCom1Active->setMinimumHeight(xpdrH);
ui->ds_ComPanelCom2Active->setMinimumHeight(xpdrH);
ui->sbp_ComPanelTransponder->setMinimumHeight(xpdrH);
}
}
bool CCockpitComForm::isFrequenceEqual(double f1, double f2)
{
return CMathUtils::epsilonEqual(f1, f2);

View File

@@ -103,6 +103,9 @@ namespace BlackGui
//! SELCAL value changed (in selector)
void onSelcalChanged();
//! Align the heights
void alignUiElementsHeight();
//! Compare 2 frequencies (consider epsilon)
static bool isFrequenceEqual(double f1, double f2);