VirtualBox

Changeset 102633 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Dec 18, 2023 2:22:41 PM (14 months ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10513: UIAdvancedSettingsDialog: Adjust UIFilterEditor internal geometry and layout; Make sure line-edit and tool-button located separately and frame is painted around their cumulative region.

File:
1 edited

Legend:

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

    r102619 r102633  
    457457
    458458    /* Prepare base/frame painter path: */
    459     const QRect widgetRect = m_pLineEdit->geometry();
     459    const QRegion totalRegion = QRegion(m_pLineEdit->geometry()) + QRegion(m_pToolButton->geometry());
     460    const QRect widgetRect = totalRegion.boundingRect();
    460461    const QSizeF arcSize(2 * m_iRadius, 2 * m_iRadius);
    461462    QPainterPath path;
     
    500501                                    background-color: rgba(255, 255, 255, 0%);\
    501502                                    border: 0px none black;\
    502                                     margin: 3px 10px 3px 10px;\
     503                                    margin: 3px 0px 3px 10px;\
    503504                                    }");
    504505        m_pLineEdit->installEventFilter(this);
     
    511512    if (m_pToolButton)
    512513    {
    513 #ifdef VBOX_WS_MAC
    514         setStyleSheet("QToolButton { border: 0px none black; margin: 0px 0px 0px 0px; } QToolButton::menu-indicator {image: none;}");
    515 #endif
     514        m_pToolButton->setStyleSheet("QToolButton {\
     515                                      border: 0px none black;\
     516                                      margin: 0px 5px 0px 5px;\
     517                                      }\
     518                                      QToolButton::menu-indicator {\
     519                                      image: none;\
     520                                      }");
    516521        m_pToolButton->hide();
    517522        m_pToolButton->setIconSize(QSize(10, 10));
     
    543548    const int iWidth = width();
    544549
    545     /* Update filter editor geometry: */
     550    /* Acquire filter editor size-hint: */
    546551    const QSize esh = m_pLineEdit->minimumSizeHint();
    547552    const int iMinimumEditorWidth = esh.width();
    548553    const int iMinimumEditorHeight = esh.height();
    549     /* Update minimum/maximum filter editor width: */
    550     m_iUnfocusedEditorWidth = qMax(iWidth / 2, iMinimumEditorWidth);
    551     m_iFocusedEditorWidth = qMax(iWidth, iMinimumEditorWidth);
    552     m_pAnimation->update();
    553     setEditorWidth(m_fFocused ? m_iFocusedEditorWidth : m_iUnfocusedEditorWidth);
    554 
    555     /* Update filter button geometry: */
     554    /* Acquire filter button size-hint: */
    556555    const QSize bsh = m_pToolButton->minimumSizeHint();
    557556    const int iMinimumButtonWidth = bsh.width();
    558557    const int iMinimumButtonHeight = bsh.height();
     558
     559    /* Update filter button geo: */
     560    const int iButtonX = iWidth - iMinimumButtonWidth;
    559561    const int iButtonY = iMinimumEditorHeight > iMinimumButtonHeight
    560562                       ? (iMinimumEditorHeight - iMinimumButtonHeight) / 2 + 1
    561563                       : 0;
    562     m_pToolButton->setGeometry(iWidth - iMinimumButtonWidth - 1, iButtonY, iMinimumButtonWidth, iMinimumButtonHeight);
    563 }
    564 
    565 void UIFilterEditor::setEditorWidth(int iWidth)
     564    m_pToolButton->setGeometry(iButtonX, iButtonY, iMinimumButtonWidth, iMinimumButtonHeight);
     565
     566    /* Update minimum/maximum filter editor width: */
     567    m_iUnfocusedEditorWidth = qMax(iWidth / 2 - iMinimumButtonWidth, iMinimumEditorWidth);
     568    m_iFocusedEditorWidth = qMax(iWidth - iMinimumButtonWidth, iMinimumEditorWidth);
     569    m_pAnimation->update();
     570    setEditorWidth(m_fFocused ? m_iFocusedEditorWidth : m_iUnfocusedEditorWidth);
     571}
     572
     573void UIFilterEditor::setEditorWidth(int iEditorWidth)
    566574{
    567575    /* Align filter editor right: */
    568     const int iX = width() - iWidth;
     576    const int iX = m_pToolButton->x() - iEditorWidth;
    569577    const int iY = 0;
    570     const int iHeight = m_pLineEdit->minimumSizeHint().height();
     578    const int iEditorHeight = m_pLineEdit->minimumSizeHint().height();
    571579    const QRect oldGeo = m_pLineEdit->geometry();
    572     m_pLineEdit->setGeometry(iX, iY, iWidth, iHeight);
     580    m_pLineEdit->setGeometry(iX, iY, iEditorWidth, iEditorHeight);
    573581    const QRect newGeo = m_pLineEdit->geometry();
    574582
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