aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/texteditor/basefilefind.cpp
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@qt.io>2019-03-29 15:05:31 +0100
committerEike Ziller <eike.ziller@qt.io>2019-04-04 13:12:08 +0000
commit1f46098349bb62088ace6226b54b6bbae145b51c (patch)
tree9534c8218309d6d586b7ac8ee0e530ee1cdb1b70 /src/plugins/texteditor/basefilefind.cpp
parenteb53b183bacedfacbb8830dadd80cbd35e2ec3a4 (diff)
Use new progress subtitle API for search result count
Change-Id: Ie40f44a3bdb7621c48560cb560ccc2622d59ba4a Reviewed-by: David Schulz <david.schulz@qt.io>
Diffstat (limited to 'src/plugins/texteditor/basefilefind.cpp')
-rw-r--r--src/plugins/texteditor/basefilefind.cpp33
1 files changed, 7 insertions, 26 deletions
diff --git a/src/plugins/texteditor/basefilefind.cpp b/src/plugins/texteditor/basefilefind.cpp
index eb449251c1..bdcc9ca5a5 100644
--- a/src/plugins/texteditor/basefilefind.cpp
+++ b/src/plugins/texteditor/basefilefind.cpp
@@ -293,10 +293,6 @@ void BaseFileFind::runNewSearch(const QString &txt, FindFlags findFlags,
void BaseFileFind::runSearch(SearchResult *search)
{
const FileFindParameters parameters = search->userData().value<FileFindParameters>();
- auto label = new CountingLabel;
- connect(search, &SearchResult::countChanged, label, &CountingLabel::updateCount);
- auto statusLabel = new CountingLabel;
- connect(search, &SearchResult::countChanged, statusLabel, &CountingLabel::updateCount);
SearchResultWindow::instance()->popup(IOutputPane::Flags(IOutputPane::ModeSwitch|IOutputPane::WithFocus));
auto watcher = new QFutureWatcher<FileSearchResultList>();
watcher->setPendingResultsLimit(1);
@@ -316,10 +312,13 @@ void BaseFileFind::runSearch(SearchResult *search)
search->finishSearch(watcher->isCanceled());
});
watcher->setFuture(executeSearch(parameters));
- FutureProgress *progress =
- ProgressManager::addTask(watcher->future(), tr("Searching"), Constants::TASK_SEARCH);
- progress->setWidget(label);
- progress->setStatusBarWidget(statusLabel);
+ FutureProgress *progress = ProgressManager::addTask(watcher->future(),
+ tr("Searching"),
+ Constants::TASK_SEARCH);
+ connect(search, &SearchResult::countChanged, progress, [progress](int c) {
+ progress->setSubtitle(BaseFileFind::tr("%n found.", nullptr, c));
+ });
+ progress->setSubtitleVisibleInStatusBar(true);
connect(progress, &FutureProgress::clicked, search, &SearchResult::popup);
}
@@ -566,23 +565,5 @@ QFuture<FileSearchResultList> BaseFileFind::executeSearch(const FileFindParamete
namespace Internal {
-CountingLabel::CountingLabel()
-{
- setAlignment(Qt::AlignCenter);
- // ### TODO this setup should be done by style
- QFont f = font();
- f.setBold(true);
- f.setPointSizeF(StyleHelper::sidebarFontSize());
- setFont(f);
- setPalette(StyleHelper::sidebarFontPalette(palette()));
- setProperty("_q_custom_style_disabled", QVariant(true));
- updateCount(0);
-}
-
-void CountingLabel::updateCount(int count)
-{
- setText(BaseFileFind::tr("%n found.", nullptr, count));
-}
-
} // namespace Internal
} // namespace TextEditor