diff --git a/OMEdit/OMEditLIB/Element/ElementProperties.cpp b/OMEdit/OMEditLIB/Element/ElementProperties.cpp index 233153d550..40757950ac 100644 --- a/OMEdit/OMEditLIB/Element/ElementProperties.cpp +++ b/OMEdit/OMEditLIB/Element/ElementProperties.cpp @@ -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: @@ -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 } @@ -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 }