VirtualBox

Changeset 74085 in vbox for trunk


Ignore:
Timestamp:
Sep 5, 2018 1:30:48 PM (6 years ago)
Author:
vboxsync
Message:

FE/Qt: VirtualBox Manager UI: Chooser pane re-styling: Apply background instead of painting it manually each time.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooser.cpp

    r73631 r74085  
    117117    setAutoFillBackground(true);
    118118    QPalette pal = palette();
    119     pal.setColor(QPalette::Window, pal.color(QPalette::Active, QPalette::Base));
     119    QColor bodyColor = pal.color(QPalette::Active, QPalette::Midlight).darker(110);
     120    pal.setColor(QPalette::Window, bodyColor);
    120121    setPalette(pal);
    121122}
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemGroup.cpp

    r74079 r74085  
    16301630
    16311631    /* Prepare color: */
    1632     QPalette pal = palette();
    1633     QColor headerColor = pal.color(QPalette::Active,
    1634                                    model()->currentItems().contains(this) ?
    1635                                    QPalette::Highlight : QPalette::Midlight);
    1636     QColor bodyColor = pal.color(QPalette::Active, QPalette::Midlight).darker(headerDarkness());
     1632    const QPalette pal = palette();
     1633    const QColor headerColor = pal.color(QPalette::Active,
     1634                                         model()->currentItems().contains(this) ?
     1635                                         QPalette::Highlight : QPalette::Midlight);
    16371636
    16381637    /* Root-item: */
    16391638    if (isRoot())
    16401639    {
    1641         /* Main root-item: */
    1642         if (isMainRoot())
    1643         {
    1644             /* Simple and clear: */
    1645             pPainter->fillRect(rect, bodyColor);
    1646         }
    16471640        /* Non-main root-item: */
    1648         else
     1641        if (!isMainRoot())
    16491642        {
    16501643            /* Prepare variables: */
    1651             int iMargin = data(GroupItemData_VerticalMargin).toInt();
    1652             int iFullHeaderHeight = 2 * iMargin + m_minimumHeaderSize.height();
    1653             int iFullBodyHeight = rect.height() - iFullHeaderHeight;
     1644            const int iMargin = data(GroupItemData_VerticalMargin).toInt();
     1645            const int iFullHeaderHeight = 2 * iMargin + m_minimumHeaderSize.height();
    16541646            QRect headerRect = QRect(0, 0, rect.width(), iFullHeaderHeight);
    1655             QRect bodyRect = QRect(0, iFullHeaderHeight, rect.width(), iFullBodyHeight);
    16561647
    16571648            /* Fill background: */
     
    16601651            headerGradient.setColorAt(0, headerColor.darker(animatedValue()));
    16611652            pPainter->fillRect(headerRect, headerGradient);
    1662             pPainter->fillRect(bodyRect, bodyColor);
    16631653        }
    16641654    }
     
    16671657    {
    16681658        /* Prepare variables: */
    1669         int iMargin = data(GroupItemData_VerticalMargin).toInt();
    1670         int iFullHeaderHeight = 2 * iMargin + m_minimumHeaderSize.height();
     1659        const int iMargin = data(GroupItemData_VerticalMargin).toInt();
     1660        const int iFullHeaderHeight = 2 * iMargin + m_minimumHeaderSize.height();
    16711661
    16721662        /* Calculate top rectangle: */
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserView.cpp

    r73424 r74085  
    106106    QAccessible::installFactory(UIAccessibilityInterfaceForUIChooserView::pFactory);
    107107
     108    /* Prepare palette: */
     109    preparePalette();
     110
    108111    /* Setup frame: */
    109112    setFrameShape(QFrame::NoFrame);
     
    168171}
    169172
     173void UIChooserView::preparePalette()
     174{
     175    /* Setup palette: */
     176    QPalette pal = qApp->palette();
     177    const QColor bodyColor = pal.color(QPalette::Active, QPalette::Midlight).darker(110);
     178    pal.setColor(QPalette::Base, bodyColor);
     179    setPalette(pal);
     180}
     181
    170182void UIChooserView::resizeEvent(QResizeEvent *pEvent)
    171183{
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserView.h

    r73424 r74085  
    6060    virtual void retranslateUi() /* override */;
    6161
     62    /* Helper: Prepare stuff: */
     63    void preparePalette();
     64
    6265    /* Handler: Resize-event stuff: */
    6366    void resizeEvent(QResizeEvent *pEvent);
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