{
QWebView * webView (dynamic_cast<QWebView*>(parent));
if (webView && !id_.isEmpty())
- webView->page()->mainFrame()->addToJavaScriptWindowObject(id_,this);
+ webView->page()->mainFrame()->addToJavaScriptWindowObject(id_, this);
}
prefix_ pykit::PDFWidget::PDFWidget(QString const & id, QString const & document,
document_.reset(Poppler::Document::load(document));
QWebView * webView (dynamic_cast<QWebView*>(parent));
if (webView && !id_.isEmpty())
- webView->page()->mainFrame()->addToJavaScriptWindowObject(id_,this);
+ webView->page()->mainFrame()->addToJavaScriptWindowObject(id_, this);
documentSetup();
}
document_->setRenderHint(Poppler::Document::TextAntialiasing, true);
document_->setRenderHint(Poppler::Document::TextHinting, false);
resizeEvent(0);
+ Poppler::Page::SearchDirection dir (Poppler::Page::FromTop);
+ highlightAreas_.clear();
+ BOOST_FOREACH(QString const & str, highlightStrings_) {
+ QRectF highlightArea;
+ while (document_->page(currentPage_)->search(str, highlightArea, dir,
+ Poppler::Page::CaseInsensitive)) {
+ highlightAreas_.push_back(highlightArea);
+ dir = Poppler::Page::NextResult;
+ }
+ }
showPage();
}
prefix_ void pykit::PDFWidget::highlightString(QString const & str)
{
- QRectF highlightArea;
- Poppler::Page::SearchDirection dir (Poppler::Page::FromTop);
- while (document_->page(currentPage_)->search(str, highlightArea, dir,
- Poppler::Page::CaseInsensitive)) {
- highlightAreas_.push_back(highlightArea);
- dir = Poppler::Page::NextResult;
- }
+ highlightStrings_.append(str);
+ documentSetup();
}
prefix_ void pykit::PDFWidget::showPage()