Changeset 77827 in vbox for trunk/src/VBox
- Timestamp:
- Mar 21, 2019 2:37:07 PM (6 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItem.cpp
r77756 r77827 222 222 , m_pParent(pParent) 223 223 , m_pNode(pNode) 224 , m_iLevel(-1)225 224 , m_fHovered(false) 226 225 , m_pHoveringMachine(0) … … 394 393 { 395 394 return node()->position(); 396 }397 398 int UIChooserItem::level() const399 {400 /* Check whether it is specified manually: */401 if (m_iLevel != -1)402 return m_iLevel;403 404 /* Otherwise calculate ourself: */405 int iLevel = 0;406 UIChooserItem *pParentItem = parentItem();407 while (pParentItem && !pParentItem->isRoot())408 {409 pParentItem = pParentItem->parentItem();410 ++iLevel;411 }412 return iLevel;413 }414 415 void UIChooserItem::setLevel(int iLevel)416 {417 m_iLevel = iLevel;418 395 } 419 396 -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItem.h
r77756 r77827 136 136 /** Returns item position. */ 137 137 int position() const; 138 139 /** Returns a level of item. */140 int level() const;141 /** Defines a @a iLevel of item. */142 void setLevel(int iLevel);143 138 144 139 /** Returns whether item is hovered. */ … … 321 316 /** Holds the node this item is built for. */ 322 317 UIChooserNode *m_pNode; 323 324 /** Holds the item level according to root. */325 int m_iLevel;326 318 327 319 /** Holds whether item is hovered. */ -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemGroup.cpp
r77826 r77827 639 639 int iToggleButtonHeight = m_toggleButtonSize.height(); 640 640 /* Layout toggle-button: */ 641 int iToggleButtonX = iMarginHL + iParentIndent * level();;641 int iToggleButtonX = iMarginHL; 642 642 int iToggleButtonY = iToggleButtonHeight == iFullHeaderHeight ? iMarginV : 643 643 iMarginV + (iFullHeaderHeight - iToggleButtonHeight) / 2; … … 668 668 itemSize.setHeight(itemSize.height() - iPreviousVerticalIndent); 669 669 /* Adjust favorite children container: */ 670 m_pContainerFavorite->resize(itemSize.width() , m_pContainerFavorite->minimumSizeHint().height());671 m_pContainerFavorite->setPos( 0, iPreviousVerticalIndent);670 m_pContainerFavorite->resize(itemSize.width() - iParentIndent, m_pContainerFavorite->minimumSizeHint().height()); 671 m_pContainerFavorite->setPos(iParentIndent, iPreviousVerticalIndent); 672 672 iPreviousVerticalIndent += m_pContainerFavorite->minimumSizeHint().height(); 673 673 /* Adjust other children scroll-area: */ 674 m_pScrollArea->resize(itemSize.width() , itemSize.height() - m_pContainerFavorite->minimumSizeHint().height());675 m_pScrollArea->setPos( 0, iPreviousVerticalIndent);674 m_pScrollArea->resize(itemSize.width() - iParentIndent, itemSize.height() - m_pContainerFavorite->minimumSizeHint().height()); 675 m_pScrollArea->setPos(iParentIndent, iPreviousVerticalIndent); 676 676 } 677 677 … … 1236 1236 case GroupItemData_HeaderSpacing: return QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) / 2; 1237 1237 case GroupItemData_ChildrenSpacing: return 1; 1238 case GroupItemData_ParentIndent: return QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) ;1238 case GroupItemData_ParentIndent: return QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) / 2; 1239 1239 1240 1240 /* Default: */ … … 1377 1377 const int iMarginHL = data(GroupItemData_MarginHL).toInt(); 1378 1378 const int iMarginHR = data(GroupItemData_MarginHR).toInt(); 1379 const int iParentIndent = data(GroupItemData_ParentIndent).toInt();1380 1379 1381 1380 /* Basically we have to take header width into account: */ … … 1391 1390 1392 1391 /* And 2 margins at last - left and right: */ 1393 iProposedWidth += iMarginHL + iMarginHR + iParentIndent * level();1392 iProposedWidth += iMarginHL + iMarginHR; 1394 1393 } 1395 1394 … … 1650 1649 pPainter->fillRect(tRect, tGradient); 1651 1650 1651 /* Calculate bottom rectangle: */ 1652 if (node()->toGroupNode()->isOpened()) 1653 { 1654 QRect bRect = rect; 1655 bRect.setTop(bRect.top() + iFullHeaderHeight); 1656 1657 /* Fill top rectangle: */ 1658 pPainter->fillRect(bRect, headerColor.darker(headerDarkness())); 1659 } 1660 1652 1661 /* Paint drag token UP? */ 1653 1662 if (dragTokenPlace() != UIChooserItemDragToken_Off) … … 1688 1697 /* Prepare variables: */ 1689 1698 const int iMarginV = data(GroupItemData_MarginV).toInt(); 1699 const int iParentIndent = data(GroupItemData_ParentIndent).toInt(); 1690 1700 const int iFullHeaderHeight = 2 * iMarginV + m_minimumHeaderSize.height(); 1691 1701 … … 1707 1717 1708 1718 /* Draw borders: */ 1709 pPainter->drawLine(topRect.bottomLeft(), topRect.bottomRight() + QPoint(1, 0)); 1710 pPainter->drawLine(topRect.topLeft(), topRect.bottomLeft()); 1719 if (node()->hasNodes() && node()->toGroupNode()->isOpened()) 1720 pPainter->drawLine(topRect.bottomLeft() + QPoint(iParentIndent, 0), topRect.bottomRight() + QPoint(1, 0)); 1721 else 1722 pPainter->drawLine(topRect.bottomLeft(), topRect.bottomRight() + QPoint(1, 0)); 1723 pPainter->drawLine(rectangle.topLeft(), rectangle.bottomLeft()); 1711 1724 1712 1725 /* Restore painter: */ … … 1725 1738 const int iMarginV = data(GroupItemData_MarginV).toInt(); 1726 1739 const int iHeaderSpacing = data(GroupItemData_HeaderSpacing).toInt(); 1727 const int iParentIndent = data(GroupItemData_ParentIndent).toInt();1728 1740 const int iFullHeaderHeight = m_minimumHeaderSize.height(); 1729 1741 … … 1734 1746 1735 1747 /* Paint name: */ 1736 int iNameX = iMarginHL + iParentIndent * level();1748 int iNameX = iMarginHL; 1737 1749 if (isRoot()) 1738 1750 iNameX += m_exitButtonSize.width(); -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemMachine.cpp
r77826 r77827 285 285 const int iMajorSpacing = data(MachineItemData_MajorSpacing).toInt(); 286 286 const int iMinorSpacing = data(MachineItemData_MinorSpacing).toInt(); 287 const int iParentIndent = data(MachineItemData_ParentIndent).toInt();288 287 const int iButtonMargin = data(MachineItemData_ButtonMargin).toInt(); 289 288 … … 292 291 293 292 /* Two margins: */ 294 iProposedWidth += iMarginHL + iMarginHR + iParentIndent * level();293 iProposedWidth += iMarginHL + iMarginHR; 295 294 /* And machine-item content to take into account: */ 296 295 int iTopLineWidth = m_iMinimumNameWidth; … … 573 572 case MachineItemData_MinorSpacing: return QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) / 4; 574 573 case MachineItemData_TextSpacing: return 0; 575 case MachineItemData_ParentIndent: return QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize);576 574 case MachineItemData_ButtonMargin: return QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) / 4; 577 575 … … 667 665 const int iMarginHR = data(MachineItemData_MarginHR).toInt(); 668 666 const int iMajorSpacing = data(MachineItemData_MajorSpacing).toInt(); 669 const int iParentIndent = data(MachineItemData_ParentIndent).toInt();670 667 const int iButtonMargin = data(MachineItemData_ButtonMargin).toInt(); 671 668 672 669 /* Calculate new maximum width for the first row: */ 673 670 int iFirstRowMaximumWidth = (int)geometry().width(); 674 iFirstRowMaximumWidth -= iParentIndent * level();675 671 iFirstRowMaximumWidth -= iMarginHL; /* left margin */ 676 672 iFirstRowMaximumWidth -= m_pixmapSize.width(); /* left pixmap width */ … … 1031 1027 const int iMinorSpacing = data(MachineItemData_MinorSpacing).toInt(); 1032 1028 const int iMachineItemTextSpacing = data(MachineItemData_TextSpacing).toInt(); 1033 const int iParentIndent = data(MachineItemData_ParentIndent).toInt();1034 1029 const int iButtonMargin = data(MachineItemData_ButtonMargin).toInt(); 1035 1030 … … 1048 1043 1049 1044 /* Calculate indents: */ 1050 int iLeftColumnIndent = iMarginHL + iParentIndent * level();1045 int iLeftColumnIndent = iMarginHL; 1051 1046 1052 1047 /* Paint left column: */ -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemMachine.h
r77805 r77827 185 185 MachineItemData_MinorSpacing, 186 186 MachineItemData_TextSpacing, 187 MachineItemData_ParentIndent,188 187 MachineItemData_ButtonMargin, 189 188 /* Pixmaps: */
Note:
See TracChangeset
for help on using the changeset viewer.