Changeset 42564 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Aug 3, 2012 2:27:38 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserItemMachine.cpp
r42563 r42564 53 53 , m_iCornerRadius(6) 54 54 { 55 /* Prepare: */56 prepare();55 // /* Prepare: */ 56 // prepare(); 57 57 58 58 /* Add item to the parent: */ … … 74 74 , m_iCornerRadius(6) 75 75 { 76 /* Prepare: */77 prepare();76 // /* Prepare: */ 77 // prepare(); 78 78 79 79 /* Add item to the parent: */ … … 204 204 int iPixmapWidth = data(MachineItemData_PixmapSize).toSize().width(); 205 205 int iMachineItemMajorSpacing = data(MachineItemData_MajorSpacing).toInt(); 206 int iMachineItemMinorSpacing = data(MachineItemData_MinorSpacing).toInt(); 206 207 int iToolBarWidth = data(MachineItemData_ToolBarSize).toSize().width(); 207 208 int iMaximumWidth = (int)geometry().width() - iMargin - 208 iPixmapWidth - iMachineItemMajorSpacing - 209 iToolBarWidth - iMachineItemMajorSpacing; 209 iPixmapWidth - 210 iMachineItemMajorSpacing - 211 iMachineItemMinorSpacing - 212 iMachineItemMajorSpacing - 213 iMargin; 214 if (m_pToolBar) 215 iMaximumWidth -= iToolBarWidth; 210 216 return iMaximumWidth; 211 217 } … … 215 221 return QSize(fm.width(data(MachineItemData_StateText).toString()), fm.height()); 216 222 } 217 case MachineItemData_ToolBarSize: return m_pToolBar->minimumSizeHint().toSize(); 223 case MachineItemData_ToolBarSize: 224 { 225 return m_pToolBar ? m_pToolBar->minimumSizeHint().toSize() : QSize(0, 0); 226 } 218 227 /* Default: */ 219 228 default: break; … … 266 275 void UIGChooserItemMachine::updateLayout() 267 276 { 268 /* Prepare variables: */ 269 QSize size = geometry().size().toSize(); 270 271 /* Prepare variables: */ 272 int iMachineItemWidth = size.width(); 273 int iMachineItemHeight = size.height(); 274 int iToolBarHeight = data(MachineItemData_ToolBarSize).toSize().height(); 275 276 /* Configure tool-bar: */ 277 QSize toolBarSize = m_pToolBar->minimumSizeHint().toSize(); 278 int iToolBarX = iMachineItemWidth - 1 - toolBarSize.width(); 279 int iToolBarY = (iMachineItemHeight - iToolBarHeight) / 2; 280 m_pToolBar->setPos(iToolBarX, iToolBarY); 281 m_pToolBar->resize(toolBarSize); 282 m_pToolBar->updateLayout(); 283 284 /* Configure buttons: */ 285 m_pStartButton->updateAnimation(); 286 m_pSettingsButton->updateAnimation(); 287 m_pCloseButton->updateAnimation(); 288 m_pPauseButton->updateAnimation(); 277 if (m_pToolBar) 278 { 279 /* Prepare variables: */ 280 QSize size = geometry().size().toSize(); 281 282 /* Prepare variables: */ 283 int iMachineItemWidth = size.width(); 284 int iMachineItemHeight = size.height(); 285 int iToolBarHeight = data(MachineItemData_ToolBarSize).toSize().height(); 286 287 /* Configure tool-bar: */ 288 QSize toolBarSize = m_pToolBar->minimumSizeHint().toSize(); 289 int iToolBarX = iMachineItemWidth - 1 - toolBarSize.width(); 290 int iToolBarY = (iMachineItemHeight - iToolBarHeight) / 2; 291 m_pToolBar->setPos(iToolBarX, iToolBarY); 292 m_pToolBar->resize(toolBarSize); 293 m_pToolBar->updateLayout(); 294 295 /* Configure buttons: */ 296 m_pStartButton->updateAnimation(); 297 m_pSettingsButton->updateAnimation(); 298 m_pCloseButton->updateAnimation(); 299 m_pPauseButton->updateAnimation(); 300 } 289 301 } 290 302 … … 671 683 } 672 684 673 /* Show/hide start-button: */ 674 if (isHovered()) 675 { 676 if (!m_pToolBar->isVisible()) 677 m_pToolBar->show(); 678 } 679 else 680 { 681 if (m_pToolBar->isVisible()) 682 m_pToolBar->hide(); 685 if (m_pToolBar) 686 { 687 /* Show/hide tool-bar: */ 688 if (isHovered()) 689 { 690 if (!m_pToolBar->isVisible()) 691 m_pToolBar->show(); 692 } 693 else 694 { 695 if (m_pToolBar->isVisible()) 696 m_pToolBar->hide(); 697 } 683 698 } 684 699 }
Note:
See TracChangeset
for help on using the changeset viewer.