Changeset 76909 in vbox
- Timestamp:
- Jan 21, 2019 8:51:44 AM (6 years ago)
- svn:sync-xref-src-repo-rev:
- 128278
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/medium
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumSelector.cpp
r76907 r76909 369 369 connect(m_pTreeWidget, &QITreeWidget::itemSelectionChanged, this, &UIMediumSelector::sltHandleItemSelectionChanged); 370 370 connect(m_pTreeWidget, &QITreeWidget::itemDoubleClicked, this, &UIMediumSelector::sltHandleTreeWidgetDoubleClick); 371 connect(m_pTreeWidget, &QITreeWidget::customContextMenuRequested, this, &UIMediumSelector::sltHandleTreeContextMenuRequest); 371 372 } 372 373 … … 384 385 this, &UIMediumSelector::sltHandleShowNextMatchingItem); 385 386 connect(m_pSearchWidget, &UIMediumSearchWidget::sigShowPreviousMatchingItem, 386 this, &UIMediumSelector::sltHandle howPreviousMatchingItem);387 this, &UIMediumSelector::sltHandleShowPreviousMatchingItem); 387 388 } 388 389 } … … 513 514 m_pTreeWidget->setSortingEnabled(true); 514 515 m_pTreeWidget->sortItems(0, Qt::AscendingOrder); 516 m_pTreeWidget->setContextMenuPolicy(Qt::CustomContextMenu); 515 517 } 516 518 … … 611 613 } 612 614 613 void UIMediumSelector::sltHandle howPreviousMatchingItem()615 void UIMediumSelector::sltHandleShowPreviousMatchingItem() 614 616 { 615 617 if (m_mathingItemList.isEmpty()) … … 618 620 m_iCurrentShownIndex = m_mathingItemList.size() -1; 619 621 scrollToItem(m_mathingItemList[m_iCurrentShownIndex]); 622 } 623 624 void UIMediumSelector::sltHandleTreeContextMenuRequest(const QPoint &point) 625 { 626 QWidget *pSender = qobject_cast<QWidget*>(sender()); 627 if (!pSender) 628 return; 629 630 QMenu menu; 631 QAction *pExpandAll = menu.addAction(tr("Expand All")); 632 QAction *pCollapseAll = menu.addAction(tr("Collapse All")); 633 634 connect(pExpandAll, &QAction::triggered, this, &UIMediumSelector::sltHandleTreeExpandAllSignal); 635 connect(pCollapseAll, &QAction::triggered, this, &UIMediumSelector::sltHandleTreeCollapseAllSignal); 636 637 menu.exec(pSender->mapToGlobal(point)); 638 } 639 640 void UIMediumSelector::sltHandleTreeExpandAllSignal() 641 { 642 if (m_pTreeWidget) 643 m_pTreeWidget->expandAll(); 644 } 645 646 void UIMediumSelector::sltHandleTreeCollapseAllSignal() 647 { 648 if (m_pTreeWidget) 649 m_pTreeWidget->collapseAll(); 650 651 if (m_pAttachedSubTreeRoot) 652 m_pTreeWidget->setExpanded(m_pTreeWidget->itemIndex(m_pAttachedSubTreeRoot), true); 653 if (m_pNotAttachedSubTreeRoot) 654 m_pTreeWidget->setExpanded(m_pTreeWidget->itemIndex(m_pNotAttachedSubTreeRoot), true); 620 655 } 621 656 -
trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumSelector.h
r76907 r76909 71 71 void sltHandlePerformSearch(); 72 72 void sltHandleShowNextMatchingItem(); 73 void sltHandlehowPreviousMatchingItem(); 73 void sltHandleShowPreviousMatchingItem(); 74 void sltHandleTreeContextMenuRequest(const QPoint &point); 75 void sltHandleTreeExpandAllSignal(); 76 void sltHandleTreeCollapseAllSignal(); 74 77 75 78 private:
Note:
See TracChangeset
for help on using the changeset viewer.