Changeset 74138 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Sep 7, 2018 11:16:21 AM (6 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/manager
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManagerWidget.cpp
r74108 r74138 550 550 { 551 551 /* Tool-bar connections: */ 552 connect(m_pToolBar, &UIToolBar::sigResized, 553 m_pPaneChooser, &UIChooser::sltHandleToolbarResize); 552 554 connect(m_pToolBar, &UIToolBar::customContextMenuRequested, 553 555 this, &UIVirtualBoxManagerWidget::sltHandleContextMenuRequest); -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooser.cpp
r74085 r74138 112 112 } 113 113 114 void UIChooser::sltHandleToolbarResize(const QSize &newSize) 115 { 116 /* Pass height to a model: */ 117 model()->setGlobalItemHeightHint(newSize.height()); 118 } 119 114 120 void UIChooser::preparePalette() 115 121 { -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooser.h
r73631 r74138 82 82 bool isGroupSavingInProgress() const; 83 83 84 public slots: 85 86 /** Handles toolbar resize to @a newSize. */ 87 void sltHandleToolbarResize(const QSize &newSize); 88 84 89 private: 85 90 -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemGlobal.cpp
r73954 r74138 43 43 , m_iMinimumNameWidth(0) 44 44 , m_iMaximumNameWidth(0) 45 , m_iHeightHint(0) 45 46 { 46 47 /* Prepare: */ … … 118 119 } 119 120 121 void UIChooserItemGlobal::setHeightHint(int iHint) 122 { 123 /* Remember a new hint: */ 124 m_iHeightHint = iHint; 125 126 /* Update geometry and the model layout: */ 127 updateGeometry(); 128 model()->updateLayout(); 129 } 130 120 131 void UIChooserItemGlobal::retranslateUi() 121 132 { … … 290 301 { 291 302 /* Prepare variables: */ 292 int iMargin = data(GlobalItemData_Margin).toInt();293 int iSpacing = data(GlobalItemData_Spacing).toInt();303 const int iMargin = data(GlobalItemData_Margin).toInt(); 304 const int iSpacing = data(GlobalItemData_Spacing).toInt(); 294 305 295 306 /* Calculating proposed width: */ … … 298 309 /* Two margins: */ 299 310 iProposedWidth += 2 * iMargin; 300 /* And global-item content to take into account: */311 /* And global-item content width: */ 301 312 iProposedWidth += (m_pixmapSize.width() + 302 313 iSpacing + … … 310 321 { 311 322 /* Prepare variables: */ 312 int iMargin = data(GlobalItemData_Margin).toInt();323 const int iMargin = data(GlobalItemData_Margin).toInt(); 313 324 314 325 /* Calculating proposed height: */ 315 326 int iProposedHeight = 0; 316 327 317 /* Two margins: */ 318 iProposedHeight += 2 * iMargin; 319 /* And global-item content to take into account: */ 320 iProposedHeight += qMax(m_pixmapSize.height(), m_visibleNameSize.height()); 328 /* Global-item content height: */ 329 const int iContentHeight = qMax(m_pixmapSize.height(), m_visibleNameSize.height()); 330 331 /* If we have height hint: */ 332 if (m_iHeightHint) 333 { 334 /* Take the largest value between height hint and content height: */ 335 iProposedHeight += qMax(m_iHeightHint, iContentHeight); 336 } 337 /* Otherwise: */ 338 else 339 { 340 /* Two margins: */ 341 iProposedHeight += 2 * iMargin; 342 /* And content height: */ 343 iProposedHeight += iContentHeight; 344 } 321 345 322 346 /* Return result: */ … … 391 415 { 392 416 /* Layout hints: */ 393 case GlobalItemData_Margin: return QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) / 4;417 case GlobalItemData_Margin: return QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) / 3 * 2; 394 418 case GlobalItemData_Spacing: return QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) / 2; 395 419 -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemGlobal.h
r73954 r74138 46 46 virtual ~UIChooserItemGlobal() /* override */; 47 47 48 /** @name Layout stuff. 49 * @{ */ 50 /** Defines height @a iHint. */ 51 void setHeightHint(int iHint); 52 /** @} */ 53 48 54 protected: 49 55 … … 243 249 /** Holds maximum name width. */ 244 250 int m_iMaximumNameWidth; 251 252 /** Holds the height hint. */ 253 int m_iHeightHint; 245 254 /** @} */ 246 255 }; -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserModel.cpp
r73927 r74138 189 189 /* Make sure root-item is shown: */ 190 190 root()->show(); 191 } 192 193 void UIChooserModel::setGlobalItemHeightHint(int iHint) 194 { 195 /* Walk thrugh all the items of navigation list: */ 196 foreach (UIChooserItem *pItem, navigationList()) 197 { 198 /* And for each global item: */ 199 if (pItem->type() == UIChooserItemType_Global) 200 { 201 /* Apply the height hint we have: */ 202 UIChooserItemGlobal *pGlobalItem = pItem->toGlobalItem(); 203 if (pGlobalItem) 204 pGlobalItem->setHeightHint(iHint); 205 } 206 } 191 207 } 192 208 -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserModel.h
r73631 r74138 103 103 /* API: Layout stuff: */ 104 104 void updateLayout(); 105 /** Defines global item height @a iHint. */ 106 void setGlobalItemHeightHint(int iHint); 105 107 106 108 /* API: Navigation stuff: */
Note:
See TracChangeset
for help on using the changeset viewer.