aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/desktop-utils/lumina-pdf/mainUI.cpp
diff options
context:
space:
mode:
authorZackaryWelch <welch.zackary@gmail.com>2018-01-30 17:10:06 -0500
committerZackaryWelch <welch.zackary@gmail.com>2018-01-30 17:10:06 -0500
commit23be8d308de63543461fd4e69e97fe57ee211e89 (patch)
tree4203ce1c64bf17d190818d24af9d2d10d6b3f8f6 /src-qt5/desktop-utils/lumina-pdf/mainUI.cpp
parentMerge branch 'master' of https://github.com/trueos/lumina (diff)
downloadlumina-23be8d308de63543461fd4e69e97fe57ee211e89.tar.gz
lumina-23be8d308de63543461fd4e69e97fe57ee211e89.tar.bz2
lumina-23be8d308de63543461fd4e69e97fe57ee211e89.zip
Added results text for find widget in lumina-pdf
Diffstat (limited to 'src-qt5/desktop-utils/lumina-pdf/mainUI.cpp')
-rw-r--r--src-qt5/desktop-utils/lumina-pdf/mainUI.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/src-qt5/desktop-utils/lumina-pdf/mainUI.cpp b/src-qt5/desktop-utils/lumina-pdf/mainUI.cpp
index 5f63a9e6..53a126fb 100644
--- a/src-qt5/desktop-utils/lumina-pdf/mainUI.cpp
+++ b/src-qt5/desktop-utils/lumina-pdf/mainUI.cpp
@@ -612,6 +612,7 @@ void MainUI::find(QString text, bool forward) {
results.clear();
if(research or newText) {
+ ui->resultsLabel->setText("");
for(int i = 0; i < numPages; i++) {
QList<Poppler::TextBox*> textList = DOC->page(i)->textList();
for(int j = 0; j < textList.size(); j++) {
@@ -628,7 +629,9 @@ void MainUI::find(QString text, bool forward) {
if(!results.empty()) {
//Jump to the location of the next or previous textbox and highlight
if(forward) {
- currentHighlight = (currentHighlight + 1) % results.size();
+ currentHighlight++;
+ if(currentHighlight >= results.size())
+ currentHighlight %= results.size();
}else{
currentHighlight--;
//Ensure currentHighlight will be between 0 and results.size() - 1
@@ -636,13 +639,17 @@ void MainUI::find(QString text, bool forward) {
currentHighlight = results.size() - 1;
}
- qDebug() << "Jump to location: " << currentHighlight;
+
+ ui->resultsLabel->setText(QString::number(currentHighlight+1) + " of " + QString::number(results.size()) + " results");
Poppler::TextBox *currentText = results.keys()[currentHighlight];
- WIDGET->setCurrentPage(results.value(currentText));
+ WIDGET->setCurrentPage(results.value(currentText)+1);
+
+ qDebug() << "Jump to location: " << results.value(currentText);
+
WIDGET->highlightText(currentHighlight, currentText->boundingBox());
- QTimer::singleShot(10, WIDGET, SLOT(updatePreview()));
+ //QTimer::singleShot(10, WIDGET, SLOT(updatePreview()));
}else{
//Print "No results found"
}
bgstack15