Skip to content

Commit 3020fac

Browse files
committed
Improve preferences search UX, navigation, and add footer
- Enhanced search result selection to scroll exactly to the clicked item using `QTimer::singleShot` and `mapTo` for robust positioning. - Added a 50ms debounce timer for search to improve responsiveness. - Factored out `getSearchableText` helper for consistent search matching. - Added a footer to the preferences list in `configdialog.ui` with text "The road goes no further." and a centered "Back to top" button. - Refactored `ConfigDialog` to use `QSignalBlocker` for robust sidebar synchronization and removed the manual `m_suppressScrollSync` flag. - Improved `slot_onScroll` to ensure the last section is selected in the sidebar when reaching the bottom. - Updated `slot_cancel` to call `reject()` and improved metatype safety for widget pointers in search results using `QObject*`. - Applied clang-format.
1 parent 21cae4e commit 3020fac

2 files changed

Lines changed: 2 additions & 5 deletions

File tree

src/preferences/configdialog.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ ConfigDialog::ConfigDialog(QWidget *const parent)
123123

124124
m_searchTimer = new QTimer(this);
125125
m_searchTimer->setSingleShot(true);
126-
m_searchTimer->setInterval(250);
126+
m_searchTimer->setInterval(50);
127127
connect(m_searchTimer, &QTimer::timeout, this, [this]() { slot_search(ui->searchBar->text()); });
128128
connect(ui->searchBar, &QLineEdit::textChanged, m_searchTimer, qOverload<>(&QTimer::start));
129129

src/preferences/configdialog.ui

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@
113113
</property>
114114
</widget>
115115
</item>
116-
<item>
116+
<item alignment="Qt::AlignmentFlag::AlignCenter">
117117
<widget class="QPushButton" name="backToTopBtn">
118118
<property name="sizePolicy">
119119
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
@@ -124,9 +124,6 @@
124124
<property name="text">
125125
<string>Back to top</string>
126126
</property>
127-
<property name="flat">
128-
<bool>true</bool>
129-
</property>
130127
</widget>
131128
</item>
132129
</layout>

0 commit comments

Comments
 (0)