Exemplo n.º 1
0
int SearchEdit::queryStart() const
{
    Zeal::SearchQuery currentQuery = Zeal::SearchQuery::fromString(text());
    // Keep the filter for the first esc press
    if (currentQuery.keywordPrefixSize() > 0 && currentQuery.query().size() > 0)
        return currentQuery.keywordPrefixSize() + 1;
    else
        return 0;
}
Exemplo n.º 2
0
void SearchEdit::focusInEvent(QFocusEvent *event)
{
    // Focus on the widget.
    QLineEdit::focusInEvent(event);

    // Override the default selection.
    Zeal::SearchQuery currentQuery = Zeal::SearchQuery::fromString(text());
    int selectionOffset = currentQuery.keywordPrefixSize();
    if (selectionOffset > 0)
        selectionOffset++; // add the delimeter
    setSelection(selectionOffset, text().size() - selectionOffset);
    m_focusing = true;
}
Exemplo n.º 3
0
void MainWindow::bringToFront(const Zeal::SearchQuery &query)
{
    show();
    setWindowState((windowState() & ~Qt::WindowMinimized) | Qt::WindowActive);
    raise();
    activateWindow();
    ui->lineEdit->setFocus();

    if (!query.isEmpty()) {
        ui->lineEdit->setText(query.toString());
        ui->treeView->setFocus();
        ui->treeView->activated(ui->treeView->currentIndex());
    }
}
Exemplo n.º 4
0
int SearchEdit::queryStart() const
{
    const Zeal::SearchQuery currentQuery = Zeal::SearchQuery::fromString(text());
    // Keep the filter for the first Escape press
    return currentQuery.query().isEmpty() ? 0 : currentQuery.keywordPrefixSize();
}