示例#1
0
void SearchToolBar::searchText(const QString &text)
{
    WebView* view = p_QupZilla->weView();
    bool found = view->findText(text, m_findFlags);
    if (text.isEmpty()) {
        found = true;
    }

    if (ui->highligh->isChecked()) {
        m_findFlags = QWebPage::HighlightAllOccurrences;
        updateFindFlags();
        view->findText(text, m_findFlags);
    }
    else {
        view->findText("", QWebPage::HighlightAllOccurrences);
    }

    if (!found) {
        ui->results->setText(tr("No results found."));
    }
    else {
        ui->results->clear();
    }


    ui->lineEdit->setProperty("notfound", !found);

    ui->lineEdit->style()->unpolish(ui->lineEdit);
    ui->lineEdit->style()->polish(ui->lineEdit);
}
示例#2
0
void SearchToolBar::highlightChanged()
{
    WebView* view = p_QupZilla->weView();

    if (ui->highligh->isChecked()) {
        view->findText(ui->lineEdit->text(), m_findFlags | QWebPage::HighlightAllOccurrences);
    }
    else {
        view->findText("", QWebPage::HighlightAllOccurrences);
    }
}