Changeset 74000 in vbox for trunk/src/VBox
- Timestamp:
- Aug 31, 2018 10:59:47 AM (6 years ago)
- 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 359 359 paintBackground(pPainter, pOptions->rect); 360 360 361 /* Paint frame: */ 362 paintFrameRectangle(pPainter, pOptions->rect); 363 361 364 /* Paint header: */ 362 365 paintHeader(pPainter, pOptions->rect); … … 1284 1287 /* Layout hints: */ 1285 1288 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; 1287 1290 case GroupItemData_Spacing: return QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) / 2; 1288 1291 … … 1641 1644 QColor headerColor = pal.color(QPalette::Active, 1642 1645 model()->currentItems().contains(this) ? 1643 QPalette::Highlight : QPalette::Button); 1644 QColor strokeColor = pal.color(QPalette::Active, QPalette::Mid); 1646 QPalette::Highlight : QPalette::Midlight); 1645 1647 QColor bodyColor = pal.color(QPalette::Active, QPalette::Base); 1646 1647 /* Invent pixel metric: */1648 const int iMetric = QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) / 2;1649 1648 1650 1649 /* Root-item: */ … … 1666 1665 QRect backgroundRect = QRect(0, 0, rect.width(), iFullHeaderHeight); 1667 1666 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 1679 1667 /* Fill background: */ 1680 1668 QLinearGradient headerGradient(backgroundRect.bottomLeft(), backgroundRect.topLeft()); … … 1682 1670 headerGradient.setColorAt(0, headerColor.darker(animationDarkness())); 1683 1671 pPainter->fillRect(backgroundRect, headerGradient); 1684 1685 /* Stroke path: */1686 pPainter->setClipping(false);1687 pPainter->strokePath(path, strokeColor);1688 1672 } 1689 1673 } … … 1695 1679 int iHeaderHeight = m_minimumHeaderSize.height(); 1696 1680 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);1711 1681 1712 1682 /* Calculate top rectangle: */ … … 1719 1689 /* Fill top rectangle: */ 1720 1690 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);1734 1691 1735 1692 /* Paint drag token UP? */ … … 1757 1714 1758 1715 /* Restore painter: */ 1716 pPainter->restore(); 1717 } 1718 1719 void 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)); 1759 1735 pPainter->restore(); 1760 1736 } -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemGroup.h
r73993 r74000 308 308 /** Paints background using specified @a pPainter and certain @a rect. */ 309 309 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); 310 312 /** Paints header using specified @a pPainter and certain @a rect. */ 311 313 void paintHeader(QPainter *pPainter, const QRect &rect);
Note:
See TracChangeset
for help on using the changeset viewer.