diff options
-rw-r--r-- | src-qt5/desktop-utils/lumina-pdf/mainUI.cpp | 15 | ||||
-rw-r--r-- | src-qt5/desktop-utils/lumina-pdf/mainUI.ui | 82 |
2 files changed, 53 insertions, 44 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" } diff --git a/src-qt5/desktop-utils/lumina-pdf/mainUI.ui b/src-qt5/desktop-utils/lumina-pdf/mainUI.ui index 87922995..b8518cf5 100644 --- a/src-qt5/desktop-utils/lumina-pdf/mainUI.ui +++ b/src-qt5/desktop-utils/lumina-pdf/mainUI.ui @@ -30,6 +30,22 @@ <property name="spacing"> <number>4</number> </property> + <item row="0" column="1"> + <widget class="QLabel" name="label_replaceme"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Expanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string notr="true">GraphicsArea (replaced)</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> <item row="0" column="0"> <widget class="QFrame" name="bookmarksFrame"> <property name="frameShape"> @@ -74,22 +90,6 @@ </layout> </widget> </item> - <item row="0" column="1"> - <widget class="QLabel" name="label_replaceme"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Expanding"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string notr="true">GraphicsArea (replaced)</string> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> - </property> - </widget> - </item> <item row="1" column="0" colspan="2"> <widget class="QFrame" name="findGroup"> <property name="sizePolicy"> @@ -104,23 +104,32 @@ <property name="frameShadow"> <enum>QFrame::Raised</enum> </property> - <layout class="QGridLayout" name="gridLayout"> - <property name="leftMargin"> - <number>4</number> - </property> - <property name="topMargin"> - <number>4</number> - </property> - <property name="rightMargin"> - <number>4</number> - </property> - <property name="bottomMargin"> - <number>4</number> - </property> - <property name="spacing"> - <number>4</number> - </property> - <item row="1" column="0"> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_2"> + <item> + <widget class="QLabel" name="label"> + <property name="text"> + <string>Find...</string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="resultsLabel"> + <property name="layoutDirection"> + <enum>Qt::LeftToRight</enum> + </property> + <property name="text"> + <string/> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + </layout> + </item> + <item> <layout class="QHBoxLayout" name="horizontalLayout"> <item> <widget class="QPushButton" name="closeFind"> @@ -158,13 +167,6 @@ </item> </layout> </item> - <item row="0" column="0"> - <widget class="QLabel" name="label"> - <property name="text"> - <string>Find...</string> - </property> - </widget> - </item> </layout> </widget> </item> |