! toggles the menu for the filter/search options */
| 652 | toggles the menu for the filter/search options |
| 653 | */ |
| 654 | void ProjectExplorer::toggleFilterOptionsMenu(bool checked) { |
| 655 | if (!checked) |
| 656 | return; |
| 657 | |
| 658 | if (!caseSensitiveAction) { |
| 659 | caseSensitiveAction = new QAction(i18n("Case Sensitive"), this); |
| 660 | caseSensitiveAction->setCheckable(true); |
| 661 | caseSensitiveAction->setChecked(false); |
| 662 | connect(caseSensitiveAction, &QAction::triggered, this, [=]() { |
| 663 | if (!m_leFilter->text().isEmpty()) |
| 664 | filterTextChanged(m_leFilter->text()); |
| 665 | }); |
| 666 | |
| 667 | matchCompleteWordAction = new QAction(i18n("Match Complete Word"), this); |
| 668 | matchCompleteWordAction->setCheckable(true); |
| 669 | matchCompleteWordAction->setChecked(false); |
| 670 | connect(matchCompleteWordAction, &QAction::triggered, this, [=]() { |
| 671 | if (!m_leFilter->text().isEmpty()) |
| 672 | filterTextChanged(m_leFilter->text()); |
| 673 | }); |
| 674 | |
| 675 | #if HAS_FUZZY_MATCHER |
| 676 | fuzzyMatchingAction = new QAction(i18n("Fuzzy Matching"), this); |
| 677 | fuzzyMatchingAction->setCheckable(true); |
| 678 | fuzzyMatchingAction->setChecked(true); |
| 679 | connect(fuzzyMatchingAction, &QAction::triggered, this, [=]() { |
| 680 | bool enabled = !fuzzyMatchingAction->isChecked(); |
| 681 | caseSensitiveAction->setEnabled(enabled); |
| 682 | matchCompleteWordAction->setEnabled(enabled); |
| 683 | if (!m_leFilter->text().isEmpty()) |
| 684 | filterTextChanged(m_leFilter->text()); |
| 685 | }); |
| 686 | caseSensitiveAction->setEnabled(false); |
| 687 | matchCompleteWordAction->setEnabled(false); |
| 688 | #endif |
| 689 | } |
| 690 | |
| 691 | QMenu menu; |
| 692 | #if HAS_FUZZY_MATCHER |
| 693 | menu.addAction(fuzzyMatchingAction); |
| 694 | menu.addSeparator(); |
| 695 | #endif |
| 696 | menu.addAction(caseSensitiveAction); |
| 697 | menu.addAction(matchCompleteWordAction); |
| 698 | connect(&menu, &QMenu::aboutToHide, bFilterOptions, &QPushButton::toggle); |
| 699 | menu.exec(bFilterOptions->mapToGlobal(QPoint(0, bFilterOptions->height()))); |
| 700 | } |
| 701 | |
| 702 | void ProjectExplorer::resizeHeader() { |
| 703 | m_treeView->header()->resizeSections(QHeaderView::ResizeToContents); |
nothing calls this directly
no test coverage detected