Changeset 77405 in vbox
- Timestamp:
- Feb 20, 2019 8:39:07 PM (6 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/medium/viso
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoBrowserBase.cpp
r77330 r77405 265 265 } 266 266 267 void UIVisoBrowserBase::sltFileTableViewContextMenu(const QPoint &point) 268 { 269 QWidget *pSender = qobject_cast<QWidget*>(sender()); 270 if (!pSender) 271 return; 272 emit sigCreateFileTableViewContextMenu(pSender, point); 273 } 267 274 268 275 void UIVisoBrowserBase::sltHandleTableViewItemDoubleClick(const QModelIndex &index) -
trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoBrowserBase.h
r77330 r77405 46 46 47 47 void sigTreeViewVisibilityChanged(bool fVisible); 48 void sigCreateFileTableViewContextMenu(QWidget *pMenuRequester, const QPoint &point); 48 49 49 50 public: … … 78 79 QGridLayout *m_pMainLayout; 79 80 81 protected slots: 82 83 void sltFileTableViewContextMenu(const QPoint &point); 84 80 85 private slots: 81 86 -
trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoContentBrowser.cpp
r77330 r77405 393 393 { 394 394 m_pMainLayout->addWidget(m_pTableView, 1, 0, 6, 4); 395 m_pTableView->setContextMenuPolicy(Qt::CustomContextMenu); 395 396 m_pTableView->setSelectionMode(QAbstractItemView::ContiguousSelection); 396 397 m_pTableView->setShowGrid(false); … … 440 441 connect(m_pTableView, &UIVisoContentTableView::sigNewItemsDropped, 441 442 this, &UIVisoContentBrowser::sltHandleDroppedItems); 443 connect(m_pTableView, &QTableView::customContextMenuRequested, 444 this, &UIVisoContentBrowser::sltFileTableViewContextMenu); 442 445 } 443 446 … … 448 451 connect(m_pModel, &UICustomFileSystemModel::sigItemRenamed, 449 452 this, &UIVisoContentBrowser::sltHandleItemRenameAttempt); 450 451 453 } 452 454 -
trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoCreator.cpp
r77396 r77405 225 225 } 226 226 227 void UIVisoCreator::sltHandleShowContextMenu(const QWidget *pContextMenuRequester, const QPoint &point) 228 { 229 if (!pContextMenuRequester) 230 return; 231 232 QMenu menu; 233 234 if (sender() == m_pHostBrowser) 235 { 236 menu.addAction(m_pAddAction); 237 } 238 else if (sender() == m_pVisoBrowser) 239 { 240 menu.addAction(m_pRemoveAction); 241 menu.addAction(m_pNewDirectoryAction); 242 menu.addAction(m_pResetAction); 243 } 244 245 menu.exec(pContextMenuRequester->mapToGlobal(point)); 246 } 247 227 248 void UIVisoCreator::prepareWidgets() 228 249 { … … 325 346 connect(m_pHostBrowser, &UIVisoHostBrowser::sigTableSelectionChanged, 326 347 this, &UIVisoCreator::sltHandleHostBrowserTableSelectionChanged); 348 connect(m_pHostBrowser, &UIVisoHostBrowser::sigCreateFileTableViewContextMenu, 349 this, &UIVisoCreator::sltHandleShowContextMenu); 327 350 } 328 351 329 352 if (m_pVisoBrowser) 353 { 330 354 connect(m_pVisoBrowser, &UIVisoContentBrowser::sigTableSelectionChanged, 331 355 this, &UIVisoCreator::sltHandleContentBrowserTableSelectionChanged); 356 connect(m_pVisoBrowser, &UIVisoContentBrowser::sigCreateFileTableViewContextMenu, 357 this, &UIVisoCreator::sltHandleShowContextMenu); 358 } 332 359 333 360 if (m_pButtonBox) -
trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoCreator.h
r77376 r77405 83 83 void sltHandleHostBrowserTableSelectionChanged(bool fIsSelectionEmpty); 84 84 void sltHandleContentBrowserTableSelectionChanged(bool fIsSelectionEmpty); 85 void sltHandleShowContextMenu(const QWidget *pContextMenuRequester, const QPoint &point); 85 86 86 87 private: -
trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoHostBrowser.cpp
r77330 r77405 153 153 if (m_pTableView) 154 154 { 155 m_pTableView->setContextMenuPolicy(Qt::CustomContextMenu); 155 156 m_pMainLayout->addWidget(m_pTableView, 1, 0, 8, 4); 156 157 m_pTableView->setSelectionMode(QAbstractItemView::ContiguousSelection); … … 189 190 UIVisoBrowserBase::prepareConnections(); 190 191 if (m_pTableView) 192 { 191 193 connect(m_pTableView, &QTableView::doubleClicked, 192 194 this, &UIVisoBrowserBase::sltHandleTableViewItemDoubleClick); 195 connect(m_pTableView, &QTableView::customContextMenuRequested, 196 this, &UIVisoHostBrowser::sltFileTableViewContextMenu); 197 } 193 198 194 199 if (m_pTableView->selectionModel()) … … 216 221 setTreeCurrentIndex(index); 217 222 m_pTreeView->blockSignals(false); 223 224 /* Check if we still have something selected after table root index change: */ 225 if (m_pTableView && m_pTableView->selectionModel()) 226 emit sigTableSelectionChanged(m_pTableView->selectionModel()->hasSelection()); 218 227 } 219 228
Note:
See TracChangeset
for help on using the changeset viewer.