Changeset 43822 in vbox
- Timestamp:
- Nov 7, 2012 8:46:33 AM (12 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserItemGroup.cpp
r43821 r43822 1054 1054 } 1055 1055 1056 int UIGChooserItemGroup::minimumWidthHint(bool f ClosedGroup) const1056 int UIGChooserItemGroup::minimumWidthHint(bool fOpenedGroup) const 1057 1057 { 1058 1058 /* Prepare variables: */ 1059 1059 int iHorizontalMargin = data(GroupItemData_HorizonalMargin).toInt(); 1060 QSize fullHeaderSize = data(GroupItemData_FullHeaderSize).toSize();1060 int iFullHeaderWidth = data(GroupItemData_FullHeaderSize).toSize().width(); 1061 1061 1062 1062 /* Calculating proposed width: */ … … 1066 1066 iProposedWidth += 2 * iHorizontalMargin; 1067 1067 /* And full header width to take into account: */ 1068 iProposedWidth += fullHeaderSize.width();1068 iProposedWidth += iFullHeaderWidth; 1069 1069 /* But if group is opened: */ 1070 if ( !fClosedGroup)1070 if (fOpenedGroup) 1071 1071 { 1072 1072 /* Prepare variables: */ … … 1084 1084 } 1085 1085 1086 int UIGChooserItemGroup::minimumHeightHint(bool f ClosedGroup) const1086 int UIGChooserItemGroup::minimumHeightHint(bool fOpenedGroup) const 1087 1087 { 1088 1088 /* Prepare variables: */ … … 1090 1090 int iVerticalMargin = data(GroupItemData_VerticalMargin).toInt(); 1091 1091 int iMinorSpacing = data(GroupItemData_MinorSpacing).toInt(); 1092 QSize fullHeaderSize = data(GroupItemData_FullHeaderSize).toSize();1092 int iFullHeaderHeight = data(GroupItemData_FullHeaderSize).toSize().height(); 1093 1093 1094 1094 /* Calculating proposed height: */ … … 1098 1098 iProposedHeight += 2 * iVerticalMargin; 1099 1099 /* And full header height to take into account: */ 1100 iProposedHeight += fullHeaderSize.height();1100 iProposedHeight += iFullHeaderHeight; 1101 1101 /* But if group is opened: */ 1102 if ( !fClosedGroup)1102 if (fOpenedGroup) 1103 1103 { 1104 1104 /* We should take into account vertical indent: */ … … 1117 1117 } 1118 1118 /* Finally, additional height during animation: */ 1119 if ( fClosedGroup && m_pToggleButton && m_pToggleButton->isAnimationRunning())1119 if (!fOpenedGroup && m_pToggleButton && m_pToggleButton->isAnimationRunning()) 1120 1120 iProposedHeight += m_iAdditionalHeight; 1121 1121 … … 1126 1126 int UIGChooserItemGroup::minimumWidthHint() const 1127 1127 { 1128 return minimumWidthHint(is Closed());1128 return minimumWidthHint(isOpened()); 1129 1129 } 1130 1130 1131 1131 int UIGChooserItemGroup::minimumHeightHint() const 1132 1132 { 1133 return minimumHeightHint(is Closed());1134 } 1135 1136 QSizeF UIGChooserItemGroup::minimumSizeHint(bool f ClosedGroup) const1137 { 1138 return QSizeF(minimumWidthHint(f ClosedGroup), minimumHeightHint(fClosedGroup));1133 return minimumHeightHint(isOpened()); 1134 } 1135 1136 QSizeF UIGChooserItemGroup::minimumSizeHint(bool fOpenedGroup) const 1137 { 1138 return QSizeF(minimumWidthHint(fOpenedGroup), minimumHeightHint(fOpenedGroup)); 1139 1139 } 1140 1140 … … 1143 1143 /* If Qt::MinimumSize requested: */ 1144 1144 if (which == Qt::MinimumSize) 1145 return minimumSizeHint(is Closed());1145 return minimumSizeHint(isOpened()); 1146 1146 /* Else call to base-class: */ 1147 1147 return UIGChooserItem::sizeHint(which, constraint); … … 1160 1160 QPixmap UIGChooserItemGroup::toPixmap() 1161 1161 { 1162 QSize minimumSize = minimumSizeHint( true).toSize();1162 QSize minimumSize = minimumSizeHint(false).toSize(); 1163 1163 QPixmap pixmap(minimumSize); 1164 1164 pixmap.fill(Qt::transparent); … … 1167 1167 QStyleOptionGraphicsItem options; 1168 1168 options.rect = QRect(QPoint(0, 0), minimumSize); 1169 paint(&painter, &options , true);1169 paint(&painter, &options); 1170 1170 return pixmap; 1171 1171 } … … 1401 1401 void UIGChooserItemGroup::paint(QPainter *pPainter, const QStyleOptionGraphicsItem *pOption, QWidget* /* pWidget = 0 */) 1402 1402 { 1403 paint(pPainter, pOption, isClosed());1404 }1405 1406 void UIGChooserItemGroup::paint(QPainter *pPainter, const QStyleOptionGraphicsItem *pOption, bool fClosedGroup)1407 {1408 1403 /* Setup: */ 1409 1404 pPainter->setRenderHint(QPainter::Antialiasing); 1410 1405 1411 /* Paint decorations: */1412 paintDecorations(pPainter, pOption);1413 1414 /* Non for main root: */1415 if (!isMainRoot())1416 {1417 /* Paint group info: */1418 paintGroupInfo(pPainter, pOption, fClosedGroup);1419 }1420 }1421 1422 void UIGChooserItemGroup::paintDecorations(QPainter *pPainter, const QStyleOptionGraphicsItem *pOption)1423 {1424 1406 /* Paint background: */ 1425 1407 paintBackground(pPainter, pOption->rect); 1408 1409 /* Paint header: */ 1410 paintHeader(pPainter, pOption->rect); 1426 1411 } 1427 1412 … … 1548 1533 } 1549 1534 1550 void UIGChooserItemGroup::paintGroupInfo(QPainter *pPainter, const QStyleOptionGraphicsItem *pOption, bool) 1551 { 1535 void UIGChooserItemGroup::paintHeader(QPainter *pPainter, const QRect &rect) 1536 { 1537 /* Non for main root: */ 1538 if (isMainRoot()) 1539 return; 1540 1552 1541 /* Prepare variables: */ 1553 1542 int iHorizontalMargin = data(GroupItemData_HorizonalMargin).toInt(); … … 1601 1590 1602 1591 /* Prepare variables: */ 1603 QRect fullRect = pOption->rect;1604 1592 int iMinorSpacing = data(GroupItemData_MinorSpacing).toInt(); 1605 1593 int iEnterButtonWidth = data(GroupItemData_EnterButtonSize).toSize().width(); … … 1612 1600 1613 1601 /* Indent: */ 1614 int iHorizontalIndent = fullRect.right() - iHorizontalMargin;1602 int iHorizontalIndent = rect.right() - iHorizontalMargin; 1615 1603 if (!isRoot()) 1616 1604 iHorizontalIndent -= (iEnterButtonWidth + iMinorSpacing); … … 1691 1679 1692 1680 /* Recalculate animation parameters: */ 1693 QSizeF openedSize = minimumSizeHint( false);1694 QSizeF closedSize = minimumSizeHint( true);1681 QSizeF openedSize = minimumSizeHint(true); 1682 QSizeF closedSize = minimumSizeHint(false); 1695 1683 int iAdditionalHeight = openedSize.height() - closedSize.height(); 1696 1684 m_pToggleButton->setAnimationRange(0, iAdditionalHeight); -
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserItemGroup.h
r43821 r43822 161 161 /* Helpers: Layout stuff: */ 162 162 void updateLayout(); 163 int minimumWidthHint(bool f ClosedGroup) const;164 int minimumHeightHint(bool f ClosedGroup) const;163 int minimumWidthHint(bool fOpenedGroup) const; 164 int minimumHeightHint(bool fOpenedGroup) const; 165 165 int minimumWidthHint() const; 166 166 int minimumHeightHint() const; 167 QSizeF minimumSizeHint(bool f ClosedGroup) const;167 QSizeF minimumSizeHint(bool fOpenedGroup) const; 168 168 QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const; 169 169 … … 184 184 /* Helpers: Paint stuff: */ 185 185 void paint(QPainter *pPainter, const QStyleOptionGraphicsItem *pOption, QWidget *pWidget = 0); 186 void paint(QPainter *pPainter, const QStyleOptionGraphicsItem *pOption, bool fClosedGroup);187 void paintDecorations(QPainter *pPainter, const QStyleOptionGraphicsItem *pOption);188 186 void paintBackground(QPainter *pPainter, const QRect &rect); 189 void paint GroupInfo(QPainter *pPainter, const QStyleOptionGraphicsItem *pOption, bool fClosedGroup);187 void paintHeader(QPainter *pPainter, const QRect &rect); 190 188 191 189 /* Helpers: Animation stuff: */
Note:
See TracChangeset
for help on using the changeset viewer.