Changeset 108099 in vbox
- Timestamp:
- Feb 6, 2025 3:06:48 PM (3 months ago)
- svn:sync-xref-src-repo-rev:
- 167397
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/manager/tools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/manager/tools/UIToolsView.cpp
r108098 r108099 211 211 QPalette pal = qApp->palette(); 212 212 213 #if defined(VBOX_WS_MAC) 214 213 215 /* We are just taking the [in]active Window colors and 214 216 * making them a bit darker/lighter according to theme: */ … … 226 228 pal.setColor(QPalette::Active, QPalette::Base, backgroundColorActive); 227 229 pal.setColor(QPalette::Inactive, QPalette::Base, backgroundColorInactive); 230 231 #else /* !VBOX_WS_MAC */ 232 233 if (tools()->isPopup()) 234 { 235 /* Same as on macOS for now, will go away soon: */ 236 QColor backgroundColorActive = pal.color(QPalette::Active, QPalette::Window); 237 QColor backgroundColorInactive = pal.color(QPalette::Inactive, QPalette::Window); 238 if (!tools()->isPopup()) 239 { 240 backgroundColorActive = uiCommon().isInDarkMode() 241 ? backgroundColorActive.lighter(120) 242 : backgroundColorActive.darker(108); 243 backgroundColorInactive = uiCommon().isInDarkMode() 244 ? backgroundColorInactive.lighter(120) 245 : backgroundColorInactive.darker(108); 246 } 247 pal.setColor(QPalette::Active, QPalette::Base, backgroundColorActive); 248 pal.setColor(QPalette::Inactive, QPalette::Base, backgroundColorInactive); 249 } 250 else 251 { 252 /* Blending Window color to 10% of Accent color: */ 253 const QColor backgroundColor = pal.color(QPalette::Active, QPalette::Window); 254 const QColor accentColor = pal.color(QPalette::Active, QPalette::Accent); 255 const int iRed = iShift10(backgroundColor.red(), accentColor.red()); 256 const int iGreen = iShift10(backgroundColor.green(), accentColor.green()); 257 const int iBlue = iShift10(backgroundColor.blue(), accentColor.blue()); 258 const QColor blendColor = QColor(qRgb(iRed, iGreen, iBlue)); 259 pal.setColor(QPalette::Active, QPalette::Base, blendColor); 260 pal.setColor(QPalette::Inactive, QPalette::Base, blendColor); 261 } 262 263 #endif /* !VBOX_WS_MAC */ 228 264 229 265 /* Assing changed palette: */ … … 249 285 setSceneRect(0, 0, m_iMinimumWidthHint, m_iMinimumHeightHint); 250 286 } 287 288 #ifndef VBOX_WS_MAC 289 /* static */ 290 int UIToolsView::iShift10(int i1, int i2) 291 { 292 const int iMin = qMin(i1, i2); 293 const int iMax = qMax(i1, i2); 294 const int iDiff = iMax - iMin; 295 const int iDiff10 = iDiff * 0.1; 296 297 int iResult = 0; 298 if (i1 > i2) 299 iResult = i1 - iDiff10; 300 else 301 iResult = i1 + iDiff10; 302 303 return qMin(255, iResult); 304 } 305 #endif /* VBOX_WS_WIN */ -
trunk/src/VBox/Frontends/VirtualBox/src/manager/tools/UIToolsView.h
r107945 r108099 106 106 /** Updates scene rectangle. */ 107 107 void updateSceneRect(); 108 109 #ifndef VBOX_WS_MAC 110 /** Returns a number shifter per 10% from @a i1 to @a i2. */ 111 static int iShift10(int i1, int i2); 112 #endif 108 113 /** @} */ 109 114
Note:
See TracChangeset
for help on using the changeset viewer.