- Timestamp:
- May 24, 2021 4:55:43 PM (4 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/manager/details
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/manager/details/UIDetailsElement.cpp
r89102 r89250 88 88 , m_pSet(pParent) 89 89 , m_enmType(enmType) 90 #ifdef VBOX_WS_MAC 91 , m_iDefaultToneStart(145) 92 , m_iDefaultToneFinal(155) 93 , m_iHoverToneStart(115) 94 , m_iHoverToneFinal(125) 95 #else 96 , m_iDefaultToneStart(160) 97 , m_iDefaultToneFinal(190) 98 , m_iHoverToneStart(160) 99 , m_iHoverToneFinal(190) 100 #endif 90 , m_iDefaultDarknessStart(100) 91 , m_iDefaultDarknessFinal(105) 101 92 , m_fHovered(false) 102 93 , m_fNameHovered(false) … … 106 97 , m_iAnimationDuration(300) 107 98 , m_iDefaultValue(0) 108 , m_iHoveredValue( 255)99 , m_iHoveredValue(100) 109 100 , m_iAnimatedValue(m_iDefaultValue) 110 101 , m_pButton(0) … … 1465 1456 : optionRect; 1466 1457 1467 /* Acquire palette: */1468 const QPalette pal = QApplication::palette();1458 /* Acquire background color: */ 1459 QColor backgroundColor = QApplication::palette().color(QPalette::Active, QPalette::Window); 1469 1460 1470 1461 /* Paint default background: */ 1471 const QColor defaultColor = pal.color(QPalette::Active, QPalette::Mid); 1472 const QColor dcTone1 = defaultColor.lighter(m_iDefaultToneFinal); 1473 const QColor dcTone2 = defaultColor.lighter(m_iDefaultToneStart); 1474 QLinearGradient gradientDefault(fullRect.topLeft(), fullRect.bottomLeft()); 1475 gradientDefault.setColorAt(0, dcTone1); 1476 gradientDefault.setColorAt(1, dcTone2); 1462 QLinearGradient gradientDefault(fullRect.topLeft(), fullRect.bottomRight()); 1463 gradientDefault.setColorAt(0, backgroundColor.darker(m_iDefaultDarknessStart)); 1464 gradientDefault.setColorAt(1, backgroundColor.darker(m_iDefaultDarknessFinal)); 1477 1465 pPainter->fillRect(fullRect, gradientDefault); 1478 1466 1479 1467 /* If element is hovered: */ 1480 if (m_fHovered) 1481 { 1468 if (animatedValue()) 1469 { 1470 /* Acquire header color: */ 1471 QColor headColor = backgroundColor.lighter(130); 1472 1482 1473 /* Paint hovered background: */ 1483 const QColor hoveredColor = pal.color(QPalette::Active, QPalette::Highlight); 1484 QColor hcTone1 = hoveredColor.lighter(m_iHoverToneFinal); 1485 QColor hcTone2 = hoveredColor.lighter(m_iHoverToneStart); 1486 hcTone1.setAlpha(m_iAnimatedValue); 1487 hcTone2.setAlpha(m_iAnimatedValue); 1474 QColor hcTone1 = headColor; 1475 QColor hcTone2 = headColor; 1476 hcTone1.setAlpha(255 * animatedValue() / 100); 1477 hcTone2.setAlpha(0); 1488 1478 QLinearGradient gradientHovered(headRect.topLeft(), headRect.bottomLeft()); 1489 1479 gradientHovered.setColorAt(0, hcTone1); -
trunk/src/VBox/Frontends/VirtualBox/src/manager/details/UIDetailsElement.h
r89101 r89250 351 351 QFont m_textFont; 352 352 353 /** Holds the start default tone. */ 354 int m_iDefaultToneStart; 355 /** Holds the final default tone. */ 356 int m_iDefaultToneFinal; 357 /** Holds the start hover tone. */ 358 int m_iHoverToneStart; 359 /** Holds the final hover tone. */ 360 int m_iHoverToneFinal; 353 /** Holds the start default darkness. */ 354 int m_iDefaultDarknessStart; 355 /** Holds the final default darkness. */ 356 int m_iDefaultDarknessFinal; 361 357 362 358 /** Holds whether element is hovered. */
Note:
See TracChangeset
for help on using the changeset viewer.