Skip to content

Commit

Permalink
Remove QApplication::desktop()
Browse files Browse the repository at this point in the history
  • Loading branch information
adeas31 committed Jun 10, 2024
1 parent 3e0d514 commit 2ce3eb4
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions OMEdit/OMEditLIB/Element/ElementProperties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,8 @@ void Parameter::setValueWidget(QString value, bool defaultValue, QString fromUni
mDefaultValue = value;
}
QFontMetrics fm = QFontMetrics(QFont());
// Allow to take 70% of screen width
int screenWidth = QApplication::primaryScreen()->availableGeometry().width() * 0.7;
bool signalsState;
switch (mValueType) {
case Parameter::Boolean:
Expand Down Expand Up @@ -487,11 +489,8 @@ void Parameter::setValueWidget(QString value, bool defaultValue, QString fromUni
*/
fm = QFontMetrics(mpValueComboBox->lineEdit()->font());
#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0))
// Allow to take 70% of screen width
int screenWidth = QApplication::primaryScreen()->availableGeometry().width() * 0.7;
mpValueComboBox->setMinimumWidth(qMin(qMax(fm.horizontalAdvance(value), mpValueComboBox->minimumSizeHint().width()), screenWidth) + 50);
#else // QT_VERSION_CHECK
int screenWidth = QApplication::desktop()->availableGeometry().width() * 0.7;
mpValueComboBox->setMinimumWidth(qMin(qMax(fm.width(value), mpValueComboBox->minimumSizeHint().width()), screenWidth) + 50);
#endif // QT_VERSION_CHECK
}
Expand All @@ -515,11 +514,8 @@ void Parameter::setValueWidget(QString value, bool defaultValue, QString fromUni
/* Set the minimum width so that the value text will be readable */
fm = QFontMetrics(mpValueTextBox->font());
#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0))
// Allow to take 70% of screen width
int screenWidth = QApplication::primaryScreen()->availableGeometry().width() * 0.7;
mpValueTextBox->setMinimumWidth(qMin(fm.horizontalAdvance(value), screenWidth) + 50);
#else // QT_VERSION_CHECK
int screenWidth = QApplication::desktop()->availableGeometry().width() * 0.7;
mpValueTextBox->setMinimumWidth(qMin(fm.width(value), screenWidth) + 50);
#endif // QT_VERSION_CHECK
}
Expand Down

0 comments on commit 2ce3eb4

Please sign in to comment.