- Timestamp:
- Aug 31, 2018 11:19:49 AM (6 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItem.cpp
r73927 r74002 296 296 } 297 297 298 int UIChooserItem::level() const 299 { 300 int iLevel = 0; 301 UIChooserItem *pParentItem = parentItem(); 302 while (pParentItem && !pParentItem->isRoot()) 303 { 304 pParentItem = pParentItem->parentItem(); 305 ++iLevel; 306 } 307 return iLevel; 308 } 309 298 310 void UIChooserItem::show() 299 311 { -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItem.h
r73948 r74002 122 122 /** Returns action-pool reference. */ 123 123 UIActionPool *actionPool() const; 124 125 /** Returns a level of item. */ 126 int level() const; 124 127 125 128 /** Shows item. */ -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemGroup.cpp
r74001 r74002 749 749 { 750 750 /* Prepare variables: */ 751 int iHorizontalMargin = data(GroupItemData_HorizonalMargin).toInt(); 752 int iVerticalMargin = data(GroupItemData_VerticalMargin).toInt(); 753 int iFullHeaderHeight = m_minimumHeaderSize.height(); 751 const int iHorizontalMargin = data(GroupItemData_HorizonalMargin).toInt(); 752 const int iVerticalMargin = data(GroupItemData_VerticalMargin).toInt(); 753 const int iParentIndent = data(GroupItemData_ParentIndent).toInt(); 754 const int iFullHeaderHeight = m_minimumHeaderSize.height(); 754 755 int iPreviousVerticalIndent = 0; 755 756 … … 797 798 int iToggleButtonHeight = m_toggleButtonSize.height(); 798 799 /* Layout toggle-button: */ 799 int iToggleButtonX = iHorizontalMargin ;800 int iToggleButtonX = iHorizontalMargin + iParentIndent * level(); 800 801 int iToggleButtonY = iToggleButtonHeight == iFullHeaderHeight ? iVerticalMargin : 801 802 iVerticalMargin + (iFullHeaderHeight - iToggleButtonHeight) / 2; … … 1289 1290 case GroupItemData_VerticalMargin: return QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) / 2; 1290 1291 case GroupItemData_Spacing: return QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) / 2; 1292 case GroupItemData_ParentIndent: return QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) / 3; 1291 1293 1292 1294 /* Default: */ … … 1419 1421 { 1420 1422 /* Prepare variables: */ 1421 int iHorizontalMargin = data(GroupItemData_HorizonalMargin).toInt(); 1423 const int iHorizontalMargin = data(GroupItemData_HorizonalMargin).toInt(); 1424 const int iParentIndent = data(GroupItemData_ParentIndent).toInt(); 1422 1425 1423 1426 /* Basically we have to take header width into account: */ … … 1435 1438 1436 1439 /* And 2 margins at last - left and right: */ 1437 iProposedWidth += 2 * iHorizontalMargin ;1440 iProposedWidth += 2 * iHorizontalMargin + iParentIndent * level(); 1438 1441 } 1439 1442 … … 1744 1747 1745 1748 /* Prepare variables: */ 1746 int iHorizontalMargin = data(GroupItemData_HorizonalMargin).toInt(); 1747 int iVerticalMargin = data(GroupItemData_VerticalMargin).toInt(); 1748 int iSpacing = data(GroupItemData_Spacing).toInt(); 1749 int iFullHeaderHeight = m_minimumHeaderSize.height(); 1749 const int iHorizontalMargin = data(GroupItemData_HorizonalMargin).toInt(); 1750 const int iVerticalMargin = data(GroupItemData_VerticalMargin).toInt(); 1751 const int iSpacing = data(GroupItemData_Spacing).toInt(); 1752 const int iParentIndent = data(GroupItemData_ParentIndent).toInt(); 1753 const int iFullHeaderHeight = m_minimumHeaderSize.height(); 1750 1754 1751 1755 /* Configure painter color: */ … … 1763 1767 1764 1768 /* Paint name: */ 1765 int iNameX = iHorizontalMargin ;1769 int iNameX = iHorizontalMargin + iParentIndent * level(); 1766 1770 if (isRoot()) 1767 1771 iNameX += m_exitButtonSize.width(); -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemGroup.h
r74000 r74002 243 243 GroupItemData_VerticalMargin, 244 244 GroupItemData_Spacing, 245 GroupItemData_ParentIndent, 245 246 }; 246 247 -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemMachine.cpp
r73997 r74002 399 399 { 400 400 /* Prepare variables: */ 401 int iMargin = data(MachineItemData_Margin).toInt(); 402 int iMajorSpacing = data(MachineItemData_MajorSpacing).toInt(); 403 int iMinorSpacing = data(MachineItemData_MinorSpacing).toInt(); 401 const int iMargin = data(MachineItemData_Margin).toInt(); 402 const int iMajorSpacing = data(MachineItemData_MajorSpacing).toInt(); 403 const int iMinorSpacing = data(MachineItemData_MinorSpacing).toInt(); 404 const int iParentIndent = data(MachineItemData_ParentIndent).toInt(); 404 405 405 406 /* Calculating proposed width: */ … … 407 408 408 409 /* Two margins: */ 409 iProposedWidth += 2 * iMargin ;410 iProposedWidth += 2 * iMargin + iParentIndent * level(); 410 411 /* And machine-item content to take into account: */ 411 412 int iTopLineWidth = m_iMinimumNameWidth; … … 622 623 case MachineItemData_MinorSpacing: return QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) / 4; 623 624 case MachineItemData_TextSpacing: return 0; 625 case MachineItemData_ParentIndent: return QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) / 3; 624 626 625 627 /* Pixmaps: */ … … 993 995 /* Prepare variables: */ 994 996 QRect fullRect = pOption->rect; 995 int iFullHeight = fullRect.height(); 996 int iMargin = data(MachineItemData_Margin).toInt(); 997 int iMajorSpacing = data(MachineItemData_MajorSpacing).toInt(); 998 int iMinorSpacing = data(MachineItemData_MinorSpacing).toInt(); 999 int iMachineItemTextSpacing = data(MachineItemData_TextSpacing).toInt(); 997 const int iFullHeight = fullRect.height(); 998 const int iMargin = data(MachineItemData_Margin).toInt(); 999 const int iMajorSpacing = data(MachineItemData_MajorSpacing).toInt(); 1000 const int iMinorSpacing = data(MachineItemData_MinorSpacing).toInt(); 1001 const int iMachineItemTextSpacing = data(MachineItemData_TextSpacing).toInt(); 1002 const int iParentIndent = data(MachineItemData_ParentIndent).toInt(); 1000 1003 1001 1004 /* Selected item foreground: */ … … 1019 1022 1020 1023 /* Calculate indents: */ 1021 int iLeftColumnIndent = iMargin ;1024 int iLeftColumnIndent = iMargin + iParentIndent * level(); 1022 1025 1023 1026 /* Paint left column: */ -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemMachine.h
r73989 r74002 195 195 MachineItemData_MinorSpacing, 196 196 MachineItemData_TextSpacing, 197 MachineItemData_ParentIndent, 197 198 /* Pixmaps: */ 198 199 MachineItemData_SettingsButtonPixmap,
Note:
See TracChangeset
for help on using the changeset viewer.