Changeset 108106 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Feb 6, 2025 5:20:30 PM (3 months ago)
- svn:sync-xref-src-repo-rev:
- 167404
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/manager/tools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/manager/tools/UIToolsItem.cpp
r108102 r108106 748 748 pPainter->setRenderHint(QPainter::Antialiasing, true); 749 749 /* Acquire background color: */ 750 const QColor backgroundColor = pal.color(QPalette::Window); 750 #ifdef VBOX_WS_MAC 751 const QColor backgroundColor = pal.color(QPalette::Active, QPalette::Window); 752 #else /* !VBOX_WS_MAC */ 753 const QColor windowColor = pal.color(QPalette::Active, QPalette::Window); 754 const QColor accentColor = pal.color(QPalette::Active, QPalette::Accent); 755 const int iRed = iShift30(windowColor.red(), accentColor.red()); 756 const int iGreen = iShift30(windowColor.green(), accentColor.green()); 757 const int iBlue = iShift30(windowColor.blue(), accentColor.blue()); 758 const QColor backgroundColor = QColor(qRgb(iRed, iGreen, iBlue)); 759 #endif /* !VBOX_WS_MAC */ 751 760 752 761 /* Prepare icon sub-rect: */ … … 759 768 QPainterPath painterPath; 760 769 painterPath.addRoundedRect(subRect, iPadding, iPadding); 770 #ifdef VBOX_WS_MAC 761 771 const QColor backgroundColor1 = uiCommon().isInDarkMode() 762 772 ? backgroundColor.lighter(220) 763 773 : backgroundColor.darker(140); 774 #else /* !VBOX_WS_MAC */ 775 const QColor backgroundColor1 = uiCommon().isInDarkMode() 776 ? backgroundColor.lighter(140) 777 : backgroundColor.darker(120); 778 #endif /* !VBOX_WS_MAC */ 764 779 pPainter->setPen(QPen(backgroundColor1, 2, Qt::SolidLine, Qt::RoundCap)); 765 780 pPainter->drawPath(QPainterPathStroker().createStroke(painterPath)); … … 767 782 /* Fill icon body: */ 768 783 pPainter->setClipPath(painterPath); 784 #ifdef VBOX_WS_MAC 769 785 const QColor backgroundColor2 = uiCommon().isInDarkMode() 770 786 ? backgroundColor.lighter(160) 771 787 : backgroundColor.darker(120); 788 #else /* !VBOX_WS_MAC */ 789 const QColor backgroundColor2 = uiCommon().isInDarkMode() 790 ? backgroundColor.lighter(105) 791 : backgroundColor.darker(105); 792 #endif /* !VBOX_WS_MAC */ 772 793 pPainter->fillRect(subRect, backgroundColor2); 773 794 } … … 896 917 /* Acquire background color: */ 897 918 const QPalette pal = QApplication::palette(); 898 QColor backgroundColor = pal.color(QPalette::Window); 919 #ifdef VBOX_WS_MAC 920 const QColor backgroundColor = pal.color(QPalette::Active, QPalette::Window); 921 #else /* !VBOX_WS_MAC */ 922 const QColor windowColor = pal.color(QPalette::Active, QPalette::Window); 923 const QColor accentColor = pal.color(QPalette::Active, QPalette::Accent); 924 const int iRed = iShift30(windowColor.red(), accentColor.red()); 925 const int iGreen = iShift30(windowColor.green(), accentColor.green()); 926 const int iBlue = iShift30(windowColor.blue(), accentColor.blue()); 927 const QColor backgroundColor = QColor(qRgb(iRed, iGreen, iBlue)); 928 #endif /* !VBOX_WS_MAC */ 899 929 900 930 /* Prepare button sub-rect: */ … … 907 937 QPainterPath painterPath; 908 938 painterPath.addRoundedRect(m_extraButtonRect, iPadding, iPadding); 909 QColor backgroundColor1 = uiCommon().isInDarkMode() 910 ? backgroundColor.lighter(220) 911 : backgroundColor.darker(140); 939 #ifdef VBOX_WS_MAC 940 const QColor backgroundColor1 = uiCommon().isInDarkMode() 941 ? backgroundColor.lighter(220) 942 : backgroundColor.darker(140); 943 #else /* !VBOX_WS_MAC */ 944 const QColor backgroundColor1 = uiCommon().isInDarkMode() 945 ? backgroundColor.lighter(140) 946 : backgroundColor.darker(120); 947 #endif /* !VBOX_WS_MAC */ 912 948 pPainter->setPen(QPen(backgroundColor1, 2, Qt::SolidLine, Qt::RoundCap)); 913 949 pPainter->drawPath(QPainterPathStroker().createStroke(painterPath)); … … 915 951 /* Fill button body: */ 916 952 pPainter->setClipPath(painterPath); 917 QColor backgroundColor2 = uiCommon().isInDarkMode() 918 ? backgroundColor.lighter(160) 919 : backgroundColor.darker(120); 953 #ifdef VBOX_WS_MAC 954 const QColor backgroundColor2 = uiCommon().isInDarkMode() 955 ? backgroundColor.lighter(160) 956 : backgroundColor.darker(120); 957 #else /* !VBOX_WS_MAC */ 958 const QColor backgroundColor2 = uiCommon().isInDarkMode() 959 ? backgroundColor.lighter(105) 960 : backgroundColor.darker(105); 961 #endif /* !VBOX_WS_MAC */ 920 962 pPainter->fillRect(m_extraButtonRect, backgroundColor2); 921 963 … … 969 1011 pPainter->restore(); 970 1012 } 1013 1014 #ifndef VBOX_WS_MAC 1015 /* static */ 1016 int UIToolsItem::iShift30(int i1, int i2) 1017 { 1018 const int iMin = qMin(i1, i2); 1019 const int iMax = qMax(i1, i2); 1020 const int iDiff = iMax - iMin; 1021 const int iDiff10 = iDiff * 0.3; 1022 1023 int iResult = 0; 1024 if (i1 > i2) 1025 iResult = i1 - iDiff10; 1026 else 1027 iResult = i1 + iDiff10; 1028 1029 return qMin(255, iResult); 1030 } 1031 #endif /* !VBOX_WS_MAC */ -
trunk/src/VBox/Frontends/VirtualBox/src/manager/tools/UIToolsItem.h
r108061 r108106 248 248 const QFont &font, QPaintDevice *pPaintDevice, 249 249 const QString &strText); 250 251 #ifndef VBOX_WS_MAC 252 /** Returns a number shifter per 10% from @a i1 to @a i2. */ 253 static int iShift30(int i1, int i2); 254 #endif 250 255 /** @} */ 251 256
Note:
See TracChangeset
for help on using the changeset viewer.