@@ -382,9 +382,12 @@ void Parameter::setValueWidget(QString value, bool defaultValue, QString fromUni
382382 */
383383 fm = QFontMetrics (mpValueComboBox->lineEdit ()->font ());
384384#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0))
385- mpValueComboBox->setMinimumWidth (qMax (fm.horizontalAdvance (value), mpValueComboBox->minimumSizeHint ().width ()) + 50 );
385+ // Allow to take 70% of screen width
386+ int screenWidth = QApplication::primaryScreen ()->availableGeometry ().width () * 0.7 ;
387+ mpValueComboBox->setMinimumWidth (qMin (qMax (fm.horizontalAdvance (value), mpValueComboBox->minimumSizeHint ().width ()), screenWidth) + 50 );
386388#else // QT_VERSION_CHECK
387- mpValueComboBox->setMinimumWidth (qMax (fm.width (value), mpValueComboBox->minimumSizeHint ().width ()) + 50 );
389+ int screenWidth = QApplication::desktop ()->availableGeometry ().width () * 0.7 ;
390+ mpValueComboBox->setMinimumWidth (qMin (qMax (fm.width (value), mpValueComboBox->minimumSizeHint ().width ()), screenWidth) + 50 );
388391#endif // QT_VERSION_CHECK
389392 }
390393 break ;
@@ -406,9 +409,12 @@ void Parameter::setValueWidget(QString value, bool defaultValue, QString fromUni
406409 /* Set the minimum width so that the value text will be readable */
407410 fm = QFontMetrics (mpValueTextBox->font ());
408411#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0))
409- mpValueTextBox->setMinimumWidth (fm.horizontalAdvance (value) + 50 );
412+ // Allow to take 70% of screen width
413+ int screenWidth = QApplication::primaryScreen ()->availableGeometry ().width () * 0.7 ;
414+ mpValueTextBox->setMinimumWidth (qMin (fm.horizontalAdvance (value), screenWidth) + 50 );
410415#else // QT_VERSION_CHECK
411- mpValueTextBox->setMinimumWidth (fm.width (value) + 50 );
416+ int screenWidth = QApplication::desktop ()->availableGeometry ().width () * 0.7 ;
417+ mpValueTextBox->setMinimumWidth (qMin (fm.width (value), screenWidth) + 50 );
412418#endif // QT_VERSION_CHECK
413419 }
414420 mpValueTextBox->setCursorPosition (0 ); /* move the cursor to start so that parameter value will show up from start instead of end. */
0 commit comments