VirtualBox

Changeset 102697 in vbox


Ignore:
Timestamp:
Dec 25, 2023 9:51:58 AM (11 months ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10513: UIAdvancedSettingsDialog: Adjust minimum UIFilterEditor width according to placeholder text.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/UIAdvancedSettingsDialog.cpp

    r102696 r102697  
    390390{
    391391    if (m_pLineEdit)
     392    {
    392393        m_pLineEdit->setPlaceholderText(strText);
     394        adjustEditorGeometry();
     395    }
    393396}
    394397
     
    549552    const int iWidth = width();
    550553
     554    /* Acquire filter editor placeholder width: */
     555    QFontMetrics fm(m_pLineEdit->font());
     556    const int iPlaceholderWidth = fm.horizontalAdvance(m_pLineEdit->placeholderText())
     557                                + 2 * 2 /* left/right panel/frame width, no pixelMetric */
     558                                + 10 /* left margin, assigned via setStyleSheet */;
    551559    /* Acquire filter editor size-hint: */
    552560    const QSize esh = m_pLineEdit->minimumSizeHint();
    553     const int iMinimumEditorWidth = esh.width();
     561    const int iMinimumEditorWidth = qMax(esh.width(), iPlaceholderWidth);
    554562    const int iMinimumEditorHeight = esh.height();
    555563    /* Acquire filter button size-hint: */
     
    566574
    567575    /* Update minimum/maximum filter editor width: */
    568     m_iUnfocusedEditorWidth = qMax(iWidth / 2 - iMinimumButtonWidth, iMinimumEditorWidth);
     576    m_iUnfocusedEditorWidth = qMin(iWidth / 2 - iMinimumButtonWidth, iMinimumEditorWidth);
    569577    m_iFocusedEditorWidth = qMax(iWidth - iMinimumButtonWidth, iMinimumEditorWidth);
    570578    m_pAnimation->update();
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette