Bugfixing

This commit is contained in:
Jakub Melka
2020-01-05 18:13:43 +01:00
parent 4cfd05995e
commit 7f55d11916
4 changed files with 56 additions and 6 deletions

View File

@ -39,6 +39,7 @@ PDFAdvancedFindWidget::PDFAdvancedFindWidget(pdf::PDFDrawWidgetProxy* proxy, QWi
connect(ui->regularExpressionsCheckbox, &QCheckBox::clicked, this, &PDFAdvancedFindWidget::updateUI);
connect(m_proxy, &pdf::PDFDrawWidgetProxy::textLayoutChanged, this, &PDFAdvancedFindWidget::performSearch);
connect(ui->resultsTableWidget, &QTableWidget::cellDoubleClicked, this, &PDFAdvancedFindWidget::onResultItemDoubleClicked);
updateUI();
}
@ -52,7 +53,9 @@ void PDFAdvancedFindWidget::setDocument(const pdf::PDFDocument* document)
if (m_document != document)
{
m_document = document;
m_findResults.clear();
updateUI();
updateResultsUI();
}
}
@ -102,6 +105,18 @@ void PDFAdvancedFindWidget::on_searchButton_clicked()
}
}
void PDFAdvancedFindWidget::onResultItemDoubleClicked(int row, int column)
{
Q_UNUSED(column);
if (row >= 0 && row < m_findResults.size())
{
const pdf::PDFFindResult& findResult = m_findResults[row];
const pdf::PDFInteger pageIndex = findResult.textSelectionItems.front().first.pageIndex;
m_proxy->goToPage(pageIndex);
}
}
void PDFAdvancedFindWidget::updateUI()
{
const bool enableUI = m_document && m_document->getCatalog()->getPageCount() > 0;