- Timestamp:
- Sep 26, 2018 4:27:10 PM (6 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/manager
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManagerWidget.cpp
r74464 r74483 308 308 /* Then handle current item change (again!): */ 309 309 sltHandleChooserPaneIndexChangeDefault(); 310 } 311 312 void UIVirtualBoxManagerWidget::sltHandleToolMenuRequested(UIToolsClass enmClass, const QPoint &position) 313 { 314 m_pPaneTools->setToolsClass(enmClass); 315 if (m_pPaneTools->minimumSize().isValid()) 316 m_pPaneTools->resize(m_pPaneTools->minimumSize()); 317 m_pPaneTools->move(m_pPaneChooser->mapToGlobal(position)); 318 m_pPaneTools->show(); 310 319 } 311 320 … … 507 516 else 508 517 m_pPaneTools->setToolsClass(UIToolsClass_Machine); 509 510 /* Add into layout: */511 pLayoutMain->addWidget(m_pPaneTools);512 518 } 513 519 } … … 536 542 connect(m_pPaneChooser, &UIChooser::sigGroupSavingStateChanged, 537 543 this, &UIVirtualBoxManagerWidget::sigGroupSavingStateChanged); 544 connect(m_pPaneChooser, &UIChooser::sigToolMenuRequested, 545 this, &UIVirtualBoxManagerWidget::sltHandleToolMenuRequested); 538 546 539 547 /* Details-pane connections: */ -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManagerWidget.h
r74260 r74483 138 138 /** @name Tools stuff. 139 139 * @{ */ 140 /** Handles tool menu request. */ 141 void sltHandleToolMenuRequested(UIToolsClass enmClass, const QPoint &position); 142 140 143 /** Handles signal abour Tools-pane index change. */ 141 144 void sltHandleToolsPaneIndexChange(); -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooser.cpp
r74246 r74483 171 171 connect(m_pChooserModel, &UIChooserModel::sigFocusChanged, 172 172 m_pChooserView, &UIChooserView::sltFocusChanged); 173 connect(m_pChooserModel, &UIChooserModel::sigToolMenuRequested, 174 this, &UIChooser::sigToolMenuRequested); 173 175 174 176 /* Setup chooser-view connections: */ -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooser.h
r74246 r74483 21 21 /* Qt includes: */ 22 22 #include <QWidget> 23 24 /* GUI includes: */ 25 #include "UIExtraDataDefs.h" 23 26 24 27 /* Forward declarations: */ … … 49 52 /** Notifies listeners about toggling finished. */ 50 53 void sigToggleFinished(); 54 55 /** Notifies listeners about tool popup-menu request for certain tool @a enmClass and in specified @a position. */ 56 void sigToolMenuRequested(UIToolsClass enmClass, const QPoint &position); 51 57 /** @} */ 52 58 -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserHandlerMouse.cpp
r73600 r74483 76 76 /* Or a global one? */ 77 77 else if (UIChooserItemGlobal *pGlobalItem = qgraphicsitem_cast<UIChooserItemGlobal*>(pItemUnderMouse)) 78 pClickedItem = pGlobalItem; 78 { 79 const QPoint itemCursorPos = pGlobalItem->mapFromScene(scenePos).toPoint(); 80 if (model()->currentItem() == pGlobalItem && pGlobalItem->isToolsButtonArea(itemCursorPos)) 81 model()->handleToolButtonClick(pGlobalItem); 82 else 83 pClickedItem = pGlobalItem; 84 } 79 85 /* Or a machine one? */ 80 86 else if (UIChooserItemMachine *pMachineItem = qgraphicsitem_cast<UIChooserItemMachine*>(pItemUnderMouse)) 81 pClickedItem = pMachineItem; 87 { 88 const QPoint itemCursorPos = pMachineItem->mapFromScene(scenePos).toPoint(); 89 if (model()->currentItem() == pMachineItem && pMachineItem->isToolsButtonArea(itemCursorPos)) 90 model()->handleToolButtonClick(pMachineItem); 91 else 92 pClickedItem = pMachineItem; 93 } 82 94 /* If we had clicked one of required item types: */ 83 95 if (pClickedItem && !pClickedItem->isRoot()) -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserModel.cpp
r74272 r74483 150 150 { 151 151 return scene()->itemAt(position, deviceTransform); 152 } 153 154 void UIChooserModel::handleToolButtonClick(UIChooserItem *pItem) 155 { 156 switch (pItem->type()) 157 { 158 case UIChooserItemType_Global: 159 emit sigToolMenuRequested(UIToolsClass_Global, pItem->geometry().topRight().toPoint()); 160 break; 161 case UIChooserItemType_Group: 162 case UIChooserItemType_Machine: 163 emit sigToolMenuRequested(UIToolsClass_Machine, pItem->geometry().topRight().toPoint()); 164 break; 165 default: 166 break; 167 } 152 168 } 153 169 -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserModel.h
r74246 r74483 28 28 /* GUI includes: */ 29 29 #include "UIChooserItem.h" 30 #include "UIExtraDataDefs.h" 30 31 31 32 /* COM includes: */ … … 63 64 signals: 64 65 66 /** @name General stuff. 67 * @{ */ 68 /** Notify listeners about tool menu popup request for certain @a enmClass and @a position. */ 69 void sigToolMenuRequested(UIToolsClass enmClass, const QPoint &position); 70 /** @} */ 71 65 72 /** @name Selection stuff. 66 73 * @{ */ … … 120 127 /** Returns item at @a position, taking into account possible @a deviceTransform. */ 121 128 QGraphicsItem *itemAt(const QPointF &position, const QTransform &deviceTransform = QTransform()) const; 129 130 /** Handles tool button click for certain @a pItem. */ 131 void handleToolButtonClick(UIChooserItem *pItem); 122 132 /** @} */ 123 133 -
trunk/src/VBox/Frontends/VirtualBox/src/manager/tools/UITools.cpp
r74319 r74483 34 34 35 35 UITools::UITools(UIVirtualBoxManagerWidget *pParent) 36 : QWidget(pParent )36 : QWidget(pParent, Qt::Popup) 37 37 , m_pManagerWidget(pParent) 38 38 , m_pMainLayout(0) … … 122 122 { 123 123 /* Configure main-layout: */ 124 m_pMainLayout->setContentsMargins(1, 0, 0, 0);124 m_pMainLayout->setContentsMargins(1, 1, 1, 1); 125 125 m_pMainLayout->setSpacing(0); 126 126 } -
trunk/src/VBox/Frontends/VirtualBox/src/manager/tools/UIToolsItem.cpp
r74467 r74483 764 764 765 765 /* Draw frame: */ 766 pPainter->drawLine(rectangle.topLeft(), rectangle.topRight() + QPoint(1, 0)); 767 pPainter->drawLine(rectangle.bottomLeft() + QPoint(0, 1), rectangle.bottomRight() + QPoint(1, 1)); 766 pPainter->drawRect(rectangle); 768 767 769 768 /* Restore painter: */ -
trunk/src/VBox/Frontends/VirtualBox/src/manager/tools/UIToolsView.cpp
r74369 r74483 147 147 m_iMinimumHeightHint = iHint; 148 148 149 /* Set minimum view height according passed height-hint: */ 150 setMinimumHeight(2 * frameWidth() + m_iMinimumHeightHint); 151 149 152 /* Update scene-rect: */ 150 153 updateSceneRect();
Note:
See TracChangeset
for help on using the changeset viewer.