Changeset 74599 in vbox for trunk/src/VBox
- Timestamp:
- Oct 3, 2018 2:48:14 PM (6 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/manager/tools
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/manager/tools/UIToolsItem.cpp
r74503 r74599 194 194 , m_iHoveredValue(90) 195 195 , m_iAnimatedValue(m_iDefaultValue) 196 , m_iDefaultLightnessMin(0) 197 , m_iDefaultLightnessMax(0) 196 198 , m_iHoverLightnessMin(0) 197 199 , m_iHoverLightnessMax(0) … … 433 435 m_iHighlightLightnessMin = 105; 434 436 m_iHighlightLightnessMax = 115; 435 m_iHoverLightnessMin = 110; 436 m_iHoverLightnessMax = 120; 437 m_iHoverLightnessMin = 115; 438 m_iHoverLightnessMax = 125; 439 m_iDefaultLightnessMin = 145; 440 m_iDefaultLightnessMax = 155; 437 441 #else /* VBOX_WS_MAC */ 438 442 m_iHighlightLightnessMin = 130; … … 440 444 m_iHoverLightnessMin = 160; 441 445 m_iHoverLightnessMax = 190; 446 m_iDefaultLightnessMin = 160; 447 m_iDefaultLightnessMax = 190; 442 448 #endif /* !VBOX_WS_MAC */ 443 449 … … 730 736 /* Draw gradient: */ 731 737 QLinearGradient bgGrad(rectangle.topLeft(), rectangle.bottomLeft()); 732 bgGrad.setColorAt(0, backgroundColor.lighter(m_i HoverLightnessMax));733 bgGrad.setColorAt(1, backgroundColor.lighter(m_i HoverLightnessMin));738 bgGrad.setColorAt(0, backgroundColor.lighter(m_iDefaultLightnessMax)); 739 bgGrad.setColorAt(1, backgroundColor.lighter(m_iDefaultLightnessMin)); 734 740 pPainter->fillRect(rectangle, bgGrad); 735 741 } … … 756 762 /* Default frame: */ 757 763 else 758 strokeColor = pal.color(QPalette::Active, QPalette::Mid).lighter(m_i HoverLightnessMin);764 strokeColor = pal.color(QPalette::Active, QPalette::Mid).lighter(m_iDefaultLightnessMin); 759 765 760 766 /* Create/assign pen: */ -
trunk/src/VBox/Frontends/VirtualBox/src/manager/tools/UIToolsItem.h
r74249 r74599 279 279 int m_iAnimatedValue; 280 280 281 /** Holds minimum default lightness tone. */ 282 int m_iDefaultLightnessMin; 283 /** Holds maximum default lightness tone. */ 284 int m_iDefaultLightnessMax; 281 285 /** Holds minimum hover lightness tone. */ 282 286 int m_iHoverLightnessMin; -
trunk/src/VBox/Frontends/VirtualBox/src/manager/tools/UIToolsModel.cpp
r74561 r74599 290 290 void UIToolsModel::updateLayout() 291 291 { 292 /* Initialize variables: */ 292 /* Prepare variables: */ 293 const int iMargin = data(ToolsModelData_Margin).toInt(); 294 const int iSpacing = data(ToolsModelData_Spacing).toInt(); 293 295 const QSize viewportSize = scene()->views()[0]->viewport()->size(); 294 296 const int iViewportWidth = viewportSize.width(); 295 int iVerticalIndent = 0;297 int iVerticalIndent = iMargin; 296 298 297 299 /* Layout the children: */ … … 306 308 307 309 /* Set item position: */ 308 pItem->setPos( 0, iVerticalIndent);310 pItem->setPos(iMargin, iVerticalIndent); 309 311 /* Set root-item size: */ 310 312 pItem->resize(iViewportWidth, pItem->minimumHeightHint()); … … 312 314 pItem->show(); 313 315 /* Advance vertical indent: */ 314 iVerticalIndent += pItem->minimumHeightHint();316 iVerticalIndent += (pItem->minimumHeightHint() + iSpacing); 315 317 } 316 318 } … … 324 326 void UIToolsModel::sltItemMinimumWidthHintChanged() 325 327 { 328 /* Prepare variables: */ 329 const int iMargin = data(ToolsModelData_Margin).toInt(); 330 326 331 /* Calculate maximum horizontal width: */ 327 332 int iMinimumWidthHint = 0; 333 iMinimumWidthHint += 2 * iMargin; 328 334 foreach (UIToolsItem *pItem, items()) 329 335 iMinimumWidthHint = qMax(iMinimumWidthHint, pItem->minimumWidthHint()); 336 337 /* Notify listeners: */ 330 338 emit sigItemMinimumWidthHintChanged(iMinimumWidthHint); 331 339 } … … 333 341 void UIToolsModel::sltItemMinimumHeightHintChanged() 334 342 { 343 /* Prepare variables: */ 344 const int iMargin = data(ToolsModelData_Margin).toInt(); 345 const int iSpacing = data(ToolsModelData_Spacing).toInt(); 346 335 347 /* Calculate summary vertical height: */ 336 348 int iMinimumHeightHint = 0; 349 iMinimumHeightHint += 2 * iMargin; 337 350 foreach (UIToolsItem *pItem, items()) 338 351 if (pItem->isVisible()) 339 iMinimumHeightHint += pItem->minimumHeightHint(); 352 iMinimumHeightHint += (pItem->minimumHeightHint() + iSpacing); 353 iMinimumHeightHint -= iSpacing; 354 355 /* Notify listeners: */ 340 356 emit sigItemMinimumHeightHintChanged(iMinimumHeightHint); 341 357 } … … 535 551 /* Cleanup scene: */ 536 552 cleanupScene(); 553 } 554 555 QVariant UIToolsModel::data(int iKey) const 556 { 557 /* Provide other members with required data: */ 558 switch (iKey) 559 { 560 /* Layout hints: */ 561 case ToolsModelData_Margin: return 0; 562 case ToolsModelData_Spacing: return 1; 563 564 /* Default: */ 565 default: break; 566 } 567 return QVariant(); 537 568 } 538 569 -
trunk/src/VBox/Frontends/VirtualBox/src/manager/tools/UIToolsModel.h
r74319 r74599 181 181 182 182 private: 183 184 /** Data field types. */ 185 enum ToolsModelData 186 { 187 /* Layout hints: */ 188 ToolsModelData_Margin, 189 ToolsModelData_Spacing, 190 }; 183 191 184 192 /** @name Prepare/Cleanup cascade. … … 211 219 /** @name General stuff. 212 220 * @{ */ 221 /** Returns abstractly stored data value for certain @a iKey. */ 222 QVariant data(int iKey) const; 223 213 224 /** Returns @a enmType string representation. 214 225 * @todo move to UIConverter one day .. */
Note:
See TracChangeset
for help on using the changeset viewer.