diff --git a/src/app/tape/dialogs/configpages/tapeconfigurationpage.cpp b/src/app/tape/dialogs/configpages/tapeconfigurationpage.cpp index 0d8a958fe..a48d31ddc 100644 --- a/src/app/tape/dialogs/configpages/tapeconfigurationpage.cpp +++ b/src/app/tape/dialogs/configpages/tapeconfigurationpage.cpp @@ -108,10 +108,18 @@ void TapeConfigurationPage::LangChanged() void TapeConfigurationPage::SystemChanged() { systemChanged = true; +#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0) + QString text = qApp->TrVars()->PMSystemAuthor(systemCombo->itemData(systemCombo->currentIndex()).toString()); +#else QString text = qApp->TrVars()->PMSystemAuthor(systemCombo->currentData().toString()); +#endif systemAuthorValueLabel->setText(text); systemAuthorValueLabel->setToolTip(text); +#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0) + text = qApp->TrVars()->PMSystemBook(systemCombo->itemData(systemCombo->currentIndex()).toString()); +#else text = qApp->TrVars()->PMSystemBook(systemCombo->currentData().toString()); +#endif systemBookValueLabel->setText(text); systemBookValueLabel->setToolTip(text); } @@ -263,10 +271,18 @@ void TapeConfigurationPage::RetranslateUi() systemAuthorLabel->setText(tr("Author:")); systemBookLabel->setText(tr("Book:")); +#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0) + QString text = qApp->TrVars()->PMSystemAuthor(systemCombo->itemData(systemCombo->currentIndex()).toString()); +#else QString text = qApp->TrVars()->PMSystemAuthor(systemCombo->currentData().toString()); +#endif systemAuthorValueLabel->setText(text); systemAuthorValueLabel->setToolTip(text); +#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0) + text = qApp->TrVars()->PMSystemBook(systemCombo->itemData(systemCombo->currentIndex()).toString()); +#else text = qApp->TrVars()->PMSystemBook(systemCombo->currentData().toString()); +#endif systemBookValueLabel->setText(text); systemBookValueLabel->setToolTip(text); diff --git a/src/app/tape/dialogs/dialognewmeasurements.cpp b/src/app/tape/dialogs/dialognewmeasurements.cpp index 72d7dc098..7505f77b0 100644 --- a/src/app/tape/dialogs/dialognewmeasurements.cpp +++ b/src/app/tape/dialogs/dialognewmeasurements.cpp @@ -62,13 +62,21 @@ DialogNewMeasurements::~DialogNewMeasurements() //--------------------------------------------------------------------------------------------------------------------- MeasurementsType DialogNewMeasurements::Type() const { +#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0) + return static_cast(ui->comboBoxMType->itemData(ui->comboBoxMType->currentIndex()).toInt()); +#else return static_cast(ui->comboBoxMType->currentData().toInt()); +#endif } //--------------------------------------------------------------------------------------------------------------------- Unit DialogNewMeasurements::MUnit() const { +#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0) + return static_cast(ui->comboBoxUnit->itemData(ui->comboBoxUnit->currentIndex()).toInt()); +#else return static_cast(ui->comboBoxUnit->currentData().toInt()); +#endif } //--------------------------------------------------------------------------------------------------------------------- @@ -91,7 +99,13 @@ void DialogNewMeasurements::changeEvent(QEvent *event) // retranslate designer form (single inheritance approach) ui->retranslateUi(this); InitMTypes(); + + #if QT_VERSION < QT_VERSION_CHECK(5, 2, 0) + const MeasurementsType type = + static_cast(ui->comboBoxMType->itemData(ui->comboBoxMType->currentIndex()).toInt()); + #else const MeasurementsType type = static_cast(ui->comboBoxMType->currentData().toInt()); + #endif InitUnits(type); } @@ -151,7 +165,11 @@ void DialogNewMeasurements::InitMTypes() int val = static_cast(MeasurementsType::Unknown); if (ui->comboBoxMType->currentIndex() != -1) { + #if QT_VERSION < QT_VERSION_CHECK(5, 2, 0) + val = ui->comboBoxMType->itemData(ui->comboBoxMType->currentIndex()).toInt(); + #else val = ui->comboBoxMType->currentData().toInt(); + #endif } ui->comboBoxMType->blockSignals(true); @@ -189,7 +207,11 @@ void DialogNewMeasurements::InitUnits(const MeasurementsType &type) int val = static_cast(Unit::Cm); if (ui->comboBoxUnit->currentIndex() != -1) { + #if QT_VERSION < QT_VERSION_CHECK(5, 2, 0) + val = ui->comboBoxUnit->itemData(ui->comboBoxUnit->currentIndex()).toInt(); + #else val = ui->comboBoxUnit->currentData().toInt(); + #endif } ui->comboBoxUnit->blockSignals(true);