VirtualBox

Changeset 74000 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Aug 31, 2018 10:59:47 AM (6 years ago)
Author:
vboxsync
Message:

FE/Qt: VirtualBox Manager UI: Chooser pane re-styling: Group item: Flat frame style.

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

Legend:

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

    r73999 r74000  
    359359    paintBackground(pPainter, pOptions->rect);
    360360
     361    /* Paint frame: */
     362    paintFrameRectangle(pPainter, pOptions->rect);
     363
    361364    /* Paint header: */
    362365    paintHeader(pPainter, pOptions->rect);
     
    12841287        /* Layout hints: */
    12851288        case GroupItemData_HorizonalMargin: return QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) / 4;
    1286         case GroupItemData_VerticalMargin:  return QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) / 4;
     1289        case GroupItemData_VerticalMargin:  return QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) / 2;
    12871290        case GroupItemData_Spacing:         return QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) / 2;
    12881291
     
    16411644    QColor headerColor = pal.color(QPalette::Active,
    16421645                                   model()->currentItems().contains(this) ?
    1643                                    QPalette::Highlight : QPalette::Button);
    1644     QColor strokeColor = pal.color(QPalette::Active, QPalette::Mid);
     1646                                   QPalette::Highlight : QPalette::Midlight);
    16451647    QColor bodyColor = pal.color(QPalette::Active, QPalette::Base);
    1646 
    1647     /* Invent pixel metric: */
    1648     const int iMetric = QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) / 2;
    16491648
    16501649    /* Root-item: */
     
    16661665            QRect backgroundRect = QRect(0, 0, rect.width(), iFullHeaderHeight);
    16671666
    1668             /* Add clipping: */
    1669             QPainterPath path;
    1670             path.moveTo(0, 0);
    1671             path.lineTo(path.currentPosition().x(), iFullHeaderHeight - iMetric);
    1672             path.arcTo(QRectF(path.currentPosition(), QSizeF(2 * iMetric, 2 * iMetric)).translated(0, -iMetric), 180, 90);
    1673             path.lineTo(rect.width() - iMetric, path.currentPosition().y());
    1674             path.arcTo(QRectF(path.currentPosition(), QSizeF(2 * iMetric, 2 * iMetric)).translated(-iMetric, -2 * iMetric), 270, 90);
    1675             path.lineTo(path.currentPosition().x(), 0);
    1676             path.closeSubpath();
    1677             pPainter->setClipPath(path);
    1678 
    16791667            /* Fill background: */
    16801668            QLinearGradient headerGradient(backgroundRect.bottomLeft(), backgroundRect.topLeft());
     
    16821670            headerGradient.setColorAt(0, headerColor.darker(animationDarkness()));
    16831671            pPainter->fillRect(backgroundRect, headerGradient);
    1684 
    1685             /* Stroke path: */
    1686             pPainter->setClipping(false);
    1687             pPainter->strokePath(path, strokeColor);
    16881672        }
    16891673    }
     
    16951679        int iHeaderHeight = m_minimumHeaderSize.height();
    16961680        int iFullHeaderHeight = 2 * iMargin + iHeaderHeight;
    1697         int iFullHeight = rect.height();
    1698 
    1699         /* Add clipping: */
    1700         QPainterPath path;
    1701         path.moveTo(iMetric, 0);
    1702         path.arcTo(QRectF(path.currentPosition(), QSizeF(2 * iMetric, 2 * iMetric)).translated(-iMetric, 0), 90, 90);
    1703         path.lineTo(path.currentPosition().x(), iFullHeight - iMetric);
    1704         path.arcTo(QRectF(path.currentPosition(), QSizeF(2 * iMetric, 2 * iMetric)).translated(0, -iMetric), 180, 90);
    1705         path.lineTo(rect.width() - iMetric, path.currentPosition().y());
    1706         path.arcTo(QRectF(path.currentPosition(), QSizeF(2 * iMetric, 2 * iMetric)).translated(-iMetric, -2 * iMetric), 270, 90);
    1707         path.lineTo(path.currentPosition().x(), iMetric);
    1708         path.arcTo(QRectF(path.currentPosition(), QSizeF(2 * iMetric, 2 * iMetric)).translated(-2 * iMetric, -iMetric), 0, 90);
    1709         path.closeSubpath();
    1710         pPainter->setClipPath(path);
    17111681
    17121682        /* Calculate top rectangle: */
     
    17191689        /* Fill top rectangle: */
    17201690        pPainter->fillRect(tRect, tGradient);
    1721 
    1722         if (rect.height() > tRect.height())
    1723         {
    1724             /* Calculate middle rectangle: */
    1725             QRect midRect = QRect(tRect.bottomLeft(), rect.bottomRight());
    1726             /* Paint all the stuff: */
    1727             pPainter->fillRect(midRect, bodyColor);
    1728         }
    1729 
    1730          /* Stroke path: */
    1731         pPainter->setClipping(false);
    1732         pPainter->strokePath(path, strokeColor);
    1733         pPainter->setClipPath(path);
    17341691
    17351692        /* Paint drag token UP? */
     
    17571714
    17581715    /* Restore painter: */
     1716    pPainter->restore();
     1717}
     1718
     1719void UIChooserItemGroup::paintFrameRectangle(QPainter *pPainter, const QRect &rect)
     1720{
     1721    /* Not for roots: */
     1722    if (isRoot())
     1723        return;
     1724
     1725    /* Simple frame: */
     1726    pPainter->save();
     1727    QPalette pal = palette();
     1728    QColor strokeColor;
     1729
     1730    strokeColor = pal.color(QPalette::Active, QPalette::Mid).lighter(155);
     1731
     1732    pPainter->setPen(strokeColor);
     1733    pPainter->drawLine(rect.topLeft(), rect.topRight() + QPoint(1, 0));
     1734    pPainter->drawLine(rect.bottomLeft() + QPoint(0, 1), rect.bottomRight() + QPoint(1, 1));
    17591735    pPainter->restore();
    17601736}
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemGroup.h

    r73993 r74000  
    308308        /** Paints background using specified @a pPainter and certain @a rect. */
    309309        void paintBackground(QPainter *pPainter, const QRect &rect);
     310        /** Paints frame rectangle using specified @a pPainter and certain @a rect. */
     311        void paintFrameRectangle(QPainter *pPainter, const QRect &rect);
    310312        /** Paints header using specified @a pPainter and certain @a rect. */
    311313        void paintHeader(QPainter *pPainter, const QRect &rect);
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