Changeset 77826 in vbox for trunk/src/VBox
- Timestamp:
- Mar 21, 2019 2:27:05 PM (6 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemGroup.cpp
r77805 r77826 200 200 /* Prepare variables: */ 201 201 const QPoint pos = pEvent->pos().toPoint(); 202 const int iMargin = data(GroupItemData_VerticalMargin).toInt();202 const int iMarginV = data(GroupItemData_MarginV).toInt(); 203 203 const int iHeaderHeight = m_minimumHeaderSize.height(); 204 const int iFullHeaderHeight = 2 * iMargin + iHeaderHeight;204 const int iFullHeaderHeight = 2 * iMarginV + iHeaderHeight; 205 205 /* Skip if hovered part out of the header: */ 206 206 if (pos.y() >= iFullHeaderHeight) … … 266 266 267 267 /* Layout name-editor: */ 268 const int iMargin = data(GroupItemData_VerticalMargin).toInt();269 const int iHeaderHeight = 2 * iMargin + m_minimumHeaderSize.height();268 const int iMarginV = data(GroupItemData_MarginV).toInt(); 269 const int iHeaderHeight = 2 * iMarginV + m_minimumHeaderSize.height(); 270 270 const QSize headerSize = QSize(geometry().width(), iHeaderHeight); 271 271 const QGraphicsView *pView = model()->scene()->views().first(); … … 573 573 { 574 574 /* Prepare variables: */ 575 const int iHorizontalMargin = data(GroupItemData_HorizonalMargin).toInt(); 576 const int iVerticalMargin = data(GroupItemData_VerticalMargin).toInt(); 575 const int iMarginHL = data(GroupItemData_MarginHL).toInt(); 576 const int iMarginHR = data(GroupItemData_MarginHR).toInt(); 577 const int iMarginV = data(GroupItemData_MarginV).toInt(); 577 578 const int iParentIndent = data(GroupItemData_ParentIndent).toInt(); 578 579 const int iFullHeaderHeight = m_minimumHeaderSize.height(); … … 602 603 /* Layout exit-button: */ 603 604 int iExitButtonX = iHorizontalMargin; 604 int iExitButtonY = iExitButtonHeight == iFullHeaderHeight ? i VerticalMargin:605 i VerticalMargin+ (iFullHeaderHeight - iExitButtonHeight) / 2;605 int iExitButtonY = iExitButtonHeight == iFullHeaderHeight ? iMarginV : 606 iMarginV + (iFullHeaderHeight - iExitButtonHeight) / 2; 606 607 m_pExitButton->setPos(iExitButtonX, iExitButtonY); 607 608 /* Show exit-button: */ … … 610 611 611 612 /* Prepare body indent: */ 612 iPreviousVerticalIndent = i VerticalMargin + iFullHeaderHeight + iVerticalMargin;613 iPreviousVerticalIndent = iMarginV + iFullHeaderHeight + iMarginV; 613 614 } 614 615 #endif … … 638 639 int iToggleButtonHeight = m_toggleButtonSize.height(); 639 640 /* Layout toggle-button: */ 640 int iToggleButtonX = i HorizontalMargin + iParentIndent * level();641 int iToggleButtonY = iToggleButtonHeight == iFullHeaderHeight ? i VerticalMargin:642 i VerticalMargin+ (iFullHeaderHeight - iToggleButtonHeight) / 2;641 int iToggleButtonX = iMarginHL + iParentIndent * level();; 642 int iToggleButtonY = iToggleButtonHeight == iFullHeaderHeight ? iMarginV : 643 iMarginV + (iFullHeaderHeight - iToggleButtonHeight) / 2; 643 644 m_pToggleButton->setPos(iToggleButtonX, iToggleButtonY); 644 645 /* Show toggle-button: */ … … 654 655 int iEnterButtonHeight = m_enterButtonSize.height(); 655 656 /* Layout enter-button: */ 656 int iEnterButtonX = iFullWidth - i HorizontalMargin- iEnterButtonWidth;657 int iEnterButtonY = iEnterButtonHeight == iFullHeaderHeight ? i VerticalMargin:658 i VerticalMargin+ (iFullHeaderHeight - iEnterButtonHeight) / 2;657 int iEnterButtonX = iFullWidth - iMarginHR - iEnterButtonWidth; 658 int iEnterButtonY = iEnterButtonHeight == iFullHeaderHeight ? iMarginV : 659 iMarginV + (iFullHeaderHeight - iEnterButtonHeight) / 2; 659 660 m_pEnterButton->setPos(iEnterButtonX, iEnterButtonY); 660 661 } 661 662 662 663 /* Prepare body indent: */ 663 iPreviousVerticalIndent = 2 * i VerticalMargin+ iFullHeaderHeight;664 iPreviousVerticalIndent = 2 * iMarginV + iFullHeaderHeight; 664 665 665 666 /* Adjust scroll-view geometry: */ … … 1230 1231 { 1231 1232 /* Layout hints: */ 1232 case GroupItemData_HorizonalMargin: return QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) / 4; 1233 case GroupItemData_VerticalMargin: return QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) / 2; 1233 case GroupItemData_MarginHL: return QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) / 2; 1234 case GroupItemData_MarginHR: return QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) / 4 * 5; 1235 case GroupItemData_MarginV: return QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) / 2; 1234 1236 case GroupItemData_HeaderSpacing: return QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) / 2; 1235 1237 case GroupItemData_ChildrenSpacing: return 1; … … 1373 1375 { 1374 1376 /* Prepare variables: */ 1375 const int iHorizontalMargin = data(GroupItemData_HorizonalMargin).toInt(); 1377 const int iMarginHL = data(GroupItemData_MarginHL).toInt(); 1378 const int iMarginHR = data(GroupItemData_MarginHR).toInt(); 1376 1379 const int iParentIndent = data(GroupItemData_ParentIndent).toInt(); 1377 1380 … … 1388 1391 1389 1392 /* And 2 margins at last - left and right: */ 1390 iProposedWidth += 2 * iHorizontalMargin+ iParentIndent * level();1393 iProposedWidth += iMarginHL + iMarginHR + iParentIndent * level(); 1391 1394 } 1392 1395 … … 1415 1418 { 1416 1419 /* Prepare variables: */ 1417 const int i VerticalMargin = data(GroupItemData_VerticalMargin).toInt();1420 const int iMarginV = data(GroupItemData_MarginV).toInt(); 1418 1421 1419 1422 /* Group-item header have 2 margins - top and bottom: */ 1420 iProposedHeight += 2 * i VerticalMargin;1423 iProposedHeight += 2 * iMarginV; 1421 1424 /* And header content height to take into account: */ 1422 1425 iProposedHeight += m_minimumHeaderSize.height(); … … 1451 1454 1452 1455 /* Prepare variables: */ 1453 int iHorizontalMargin = data(GroupItemData_HorizonalMargin).toInt(); 1456 int iMarginHL = data(GroupItemData_MarginHL).toInt(); 1457 int iMarginHR = data(GroupItemData_MarginHR).toInt(); 1454 1458 int iHeaderSpacing = data(GroupItemData_HeaderSpacing).toInt(); 1455 1459 int iToggleButtonWidth = m_toggleButtonSize.width(); … … 1463 1467 1464 1468 /* Left margin: */ 1465 iMaximumWidth -= i HorizontalMargin;1469 iMaximumWidth -= iMarginHL; 1466 1470 /* Button width: */ 1467 1471 if (isRoot()) … … 1486 1490 } 1487 1491 /* Right margin: */ 1488 iMaximumWidth -= i HorizontalMargin;1492 iMaximumWidth -= iMarginHR; 1489 1493 /* Calculate new visible name and name-size: */ 1490 1494 QPaintDevice *pPaintDevice = model()->paintDevice(); … … 1614 1618 { 1615 1619 /* Prepare variables: */ 1616 const int iMargin = data(GroupItemData_VerticalMargin).toInt();1617 const int iFullHeaderHeight = 2 * iMargin + m_minimumHeaderSize.height();1620 const int iMarginV = data(GroupItemData_MarginV).toInt(); 1621 const int iFullHeaderHeight = 2 * iMarginV + m_minimumHeaderSize.height(); 1618 1622 QRect headerRect = QRect(0, 0, rect.width(), iFullHeaderHeight); 1619 1623 … … 1630 1634 { 1631 1635 /* Prepare variables: */ 1632 const int iMargin = data(GroupItemData_VerticalMargin).toInt();1633 const int iFullHeaderHeight = 2 * iMargin + m_minimumHeaderSize.height();1636 const int iMarginV = data(GroupItemData_MarginV).toInt(); 1637 const int iFullHeaderHeight = 2 * iMarginV + m_minimumHeaderSize.height(); 1634 1638 1635 1639 /* Calculate top rectangle: */ … … 1683 1687 1684 1688 /* Prepare variables: */ 1685 const int iMargin = data(GroupItemData_VerticalMargin).toInt();1686 const int iFullHeaderHeight = 2 * iMargin + m_minimumHeaderSize.height();1689 const int iMarginV = data(GroupItemData_MarginV).toInt(); 1690 const int iFullHeaderHeight = 2 * iMarginV + m_minimumHeaderSize.height(); 1687 1691 1688 1692 /* Prepare color: */ … … 1717 1721 1718 1722 /* Prepare variables: */ 1719 const int iHorizontalMargin = data(GroupItemData_HorizonalMargin).toInt(); 1720 const int iVerticalMargin = data(GroupItemData_VerticalMargin).toInt(); 1723 const int iMarginHL = data(GroupItemData_MarginHL).toInt(); 1724 const int iMarginHR = data(GroupItemData_MarginHR).toInt(); 1725 const int iMarginV = data(GroupItemData_MarginV).toInt(); 1721 1726 const int iHeaderSpacing = data(GroupItemData_HeaderSpacing).toInt(); 1722 1727 const int iParentIndent = data(GroupItemData_ParentIndent).toInt(); … … 1729 1734 1730 1735 /* Paint name: */ 1731 int iNameX = i HorizontalMargin+ iParentIndent * level();1736 int iNameX = iMarginHL + iParentIndent * level(); 1732 1737 if (isRoot()) 1733 1738 iNameX += m_exitButtonSize.width(); … … 1735 1740 iNameX += m_toggleButtonSize.width(); 1736 1741 iNameX += iHeaderSpacing; 1737 int iNameY = m_visibleNameSize.height() == iFullHeaderHeight ? i VerticalMargin:1738 i VerticalMargin+ (iFullHeaderHeight - m_visibleNameSize.height()) / 2;1742 int iNameY = m_visibleNameSize.height() == iFullHeaderHeight ? iMarginV : 1743 iMarginV + (iFullHeaderHeight - m_visibleNameSize.height()) / 2; 1739 1744 paintText(/* Painter: */ 1740 1745 pPainter, … … 1755 1760 1756 1761 /* Indent: */ 1757 int iHorizontalIndent = rect.right() - i HorizontalMargin;1762 int iHorizontalIndent = rect.right() - iMarginHR; 1758 1763 if (!isRoot()) 1759 1764 iHorizontalIndent -= iEnterButtonWidth; … … 1765 1770 int iMachineCountTextX = iHorizontalIndent; 1766 1771 int iMachineCountTextY = m_infoSizeMachines.height() == iFullHeaderHeight ? 1767 i VerticalMargin : iVerticalMargin+ (iFullHeaderHeight - m_infoSizeMachines.height()) / 2;1772 iMarginV : iMarginV + (iFullHeaderHeight - m_infoSizeMachines.height()) / 2; 1768 1773 paintText(/* Painter: */ 1769 1774 pPainter, … … 1780 1785 int iMachinePixmapX = iHorizontalIndent; 1781 1786 int iMachinePixmapY = m_pixmapSizeMachines.height() == iFullHeaderHeight ? 1782 i VerticalMargin : iVerticalMargin+ (iFullHeaderHeight - m_pixmapSizeMachines.height()) / 2;1787 iMarginV : iMarginV + (iFullHeaderHeight - m_pixmapSizeMachines.height()) / 2; 1783 1788 paintPixmap(/* Painter: */ 1784 1789 pPainter, … … 1795 1800 int iGroupCountTextX = iHorizontalIndent; 1796 1801 int iGroupCountTextY = m_infoSizeGroups.height() == iFullHeaderHeight ? 1797 i VerticalMargin : iVerticalMargin+ (iFullHeaderHeight - m_infoSizeGroups.height()) / 2;1802 iMarginV : iMarginV + (iFullHeaderHeight - m_infoSizeGroups.height()) / 2; 1798 1803 paintText(/* Painter: */ 1799 1804 pPainter, … … 1810 1815 int iGroupPixmapX = iHorizontalIndent; 1811 1816 int iGroupPixmapY = m_pixmapSizeGroups.height() == iFullHeaderHeight ? 1812 i VerticalMargin : iVerticalMargin+ (iFullHeaderHeight - m_pixmapSizeGroups.height()) / 2;1817 iMarginV : iMarginV + (iFullHeaderHeight - m_pixmapSizeGroups.height()) / 2; 1813 1818 paintPixmap(/* Painter: */ 1814 1819 pPainter, -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemGroup.h
r77723 r77826 216 216 { 217 217 /* Layout hints: */ 218 GroupItemData_HorizonalMargin, 219 GroupItemData_VerticalMargin, 218 GroupItemData_MarginHL, 219 GroupItemData_MarginHR, 220 GroupItemData_MarginV, 220 221 GroupItemData_HeaderSpacing, 221 222 GroupItemData_ChildrenSpacing, -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemMachine.cpp
r77805 r77826 567 567 { 568 568 /* Layout hints: */ 569 case MachineItemData_MarginHL: 570 case MachineItemData_MarginHR: 571 case MachineItemData_MarginV: 569 case MachineItemData_MarginHL: return QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize); 570 case MachineItemData_MarginHR: return QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) / 4 * 5; 571 case MachineItemData_MarginV: return QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) / 4 * 3; 572 572 case MachineItemData_MajorSpacing: return QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) / 2; 573 573 case MachineItemData_MinorSpacing: return QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) / 4; … … 578 578 /* Pixmaps: */ 579 579 case MachineItemData_SettingsButtonPixmap: return UIIconPool::iconSet(":/vm_settings_16px.png"); 580 case MachineItemData_StartButtonPixmap: return UIIconPool::iconSet(":/vm_start_16px.png");581 case MachineItemData_PauseButtonPixmap: return UIIconPool::iconSet(":/vm_pause_16px.png");582 case MachineItemData_CloseButtonPixmap: return UIIconPool::iconSet(":/exit_16px.png");580 case MachineItemData_StartButtonPixmap: return UIIconPool::iconSet(":/vm_start_16px.png"); 581 case MachineItemData_PauseButtonPixmap: return UIIconPool::iconSet(":/vm_pause_16px.png"); 582 case MachineItemData_CloseButtonPixmap: return UIIconPool::iconSet(":/exit_16px.png"); 583 583 584 584 /* Default: */
Note:
See TracChangeset
for help on using the changeset viewer.