Changeset 89138 in vbox
- Timestamp:
- May 18, 2021 12:48:07 PM (4 years ago)
- svn:sync-xref-src-repo-rev:
- 144479
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemGroup.cpp
r88862 r89138 1656 1656 return; 1657 1657 1658 /* Only selected item should have a frame: */ 1659 if (!model()->selectedItems().contains(this)) 1660 return; 1661 1658 1662 /* Save painter: */ 1659 1663 pPainter->save(); … … 1680 1684 1681 1685 /* Draw borders: */ 1686 pPainter->drawLine(rectangle.topLeft(), rectangle.topRight()); 1682 1687 if (node()->hasNodes() && nodeToGroupType()->isOpened()) 1683 1688 pPainter->drawLine(topRect.bottomLeft() + QPoint(iParentIndent, 0), topRect.bottomRight() + QPoint(1, 0)); … … 1703 1708 const int iFullHeaderHeight = m_minimumHeaderSize.height(); 1704 1709 1705 /* Configure painter color: */ 1706 pPainter->setPen(QApplication::palette().color(QPalette::Active, 1707 model()->selectedItems().contains(this) ? 1708 QPalette::HighlightedText : QPalette::ButtonText)); 1710 /* Selected item foreground: */ 1711 if (model()->selectedItems().contains(this)) 1712 { 1713 /* Prepare palette: */ 1714 const QPalette pal = QApplication::palette(); 1715 1716 /* Get background color: */ 1717 const QColor background = pal.color(QPalette::Active, QPalette::Highlight).darker(headerDarkness()); 1718 1719 /* Get foreground color: */ 1720 const QColor simpleText = pal.color(QPalette::Active, QPalette::Text); 1721 const QColor highlightText = pal.color(QPalette::Active, QPalette::HighlightedText); 1722 const QColor lightText = simpleText.black() < highlightText.black() ? simpleText : highlightText; 1723 const QColor darkText = simpleText.black() > highlightText.black() ? simpleText : highlightText; 1724 1725 /* Gather foreground color for background one: */ 1726 double dLuminance = (0.299 * background.red() + 0.587 * background.green() + 0.114 * background.blue()) / 255; 1727 //printf("luminance = %f\n", dLuminance); 1728 if (dLuminance > 0.5) 1729 pPainter->setPen(darkText); 1730 else 1731 pPainter->setPen(lightText); 1732 } 1709 1733 1710 1734 /* Paint name: */
Note:
See TracChangeset
for help on using the changeset viewer.