Skip to content

Commit a71040f

Browse files
#1077 supplemental Ctrl-F support
1 parent 55d60cb commit a71040f

2 files changed

Lines changed: 34 additions & 0 deletions

File tree

qtgui/exe/src/DmsActions.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ void createDmsActions() {
7676
main_window->connect(main_window->m_find_treeitem_action.get(), &QAction::triggered, main_window, &MainWindow::findTreeItem);
7777
main_window->m_edit_menu->addAction(main_window->m_find_treeitem_action.get());
7878
main_window->m_find_treeitem_action->setShortcut(QKeySequence(QObject::tr("Ctrl+F")));
79+
main_window->m_find_treeitem_action->setShortcutContext(Qt::ApplicationShortcut);
7980

8081
// update treeitem
8182
main_window->m_update_treeitem_action = std::make_unique<QAction>(QObject::tr("&Update TreeItem"));

qtgui/exe/src/DmsMainWindow.cpp

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
#include "DmsErrorWindow.h"
4949
#include "DmsAddressBar.h"
5050
#include "StatisticsBrowser.h"
51+
#include "UpdatableBrowser.h"
5152

5253
#include "StateChangeNotification.h"
5354
#include "stg/AbstrStorageManager.h"
@@ -1855,6 +1856,38 @@ void MainWindow::expandRecursiveFromCurrentItem() {
18551856
}
18561857

18571858
void MainWindow::findTreeItem() {
1859+
// Check if focus is on a widget that has its own find functionality
1860+
auto focusWidget = QApplication::focusWidget();
1861+
1862+
// Don't open tree item search if detail pages, statistics, or value info has focus
1863+
// (they have their own Ctrl+F handlers)
1864+
if (focusWidget)
1865+
{
1866+
// Check if the focus widget is or is a child of a widget with its own find handler
1867+
auto parent = focusWidget;
1868+
while (parent)
1869+
{
1870+
auto helperWindowType = parent->property("DmsHelperWindowType").value<QVariant>().toInt();
1871+
if (helperWindowType == DmsHelperWindowType::HW_DETAILPAGES
1872+
|| helperWindowType == DmsHelperWindowType::HW_STATISTICS
1873+
|| helperWindowType == DmsHelperWindowType::HW_VALUEINFO)
1874+
{
1875+
// Let the widget handle Ctrl+F itself
1876+
return;
1877+
}
1878+
1879+
// Check if it's a DataView (table view, map view, etc.)
1880+
if (dynamic_cast<QDmsViewArea*>(parent))
1881+
{
1882+
// DataView might have its own find functionality
1883+
return;
1884+
}
1885+
1886+
parent = parent->parentWidget();
1887+
}
1888+
}
1889+
1890+
// Focus is on treeview, address bar, or main window - open tree item search
18581891
if (!m_treeview->find_window)
18591892
{
18601893
m_treeview->find_window = new FindTextWindow(m_treeview);

0 commit comments

Comments
 (0)