VirtualBox

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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: */
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