示例#1
0
void LocationBar::textEditted()
{
    if (!text().isEmpty()) {
        m_completer->complete(text());
    }
    else {
        m_completer->closePopup();
    }

    setGoIconVisible(true);
}
示例#2
0
void LocationBar::focusInEvent(QFocusEvent* event)
{
    if (m_webView) {
        const QString stringUrl = convertUrlToText(m_webView->url());

        // Text has been edited, let's show go button
        if (stringUrl != text()) {
            setGoIconVisible(true);
        }
    }

    clearTextFormat();
    LineEdit::focusInEvent(event);
}
示例#3
0
void LocationBar::textEdited(const QString &text)
{
    m_oldTextLength = m_currentTextLength;
    m_currentTextLength = text.length();

    if (!text.isEmpty()) {
        m_completer->complete(text);
    }
    else {
        m_completer->closePopup();
    }

    setGoIconVisible(true);
}
示例#4
0
void LocationBar::textEdited(const QString &text)
{
    m_oldTextLength = m_currentTextLength;
    m_currentTextLength = text.length();

    if (!text.isEmpty()) {
        m_completer->complete(text);
        m_siteIcon->setIcon(QIcon::fromTheme(QSL("edit-find"), QIcon(QSL(":icons/menu/search-icon.svg"))));
    }
    else {
        m_completer->closePopup();
    }

    setGoIconVisible(true);
}
示例#5
0
void LocationBar::focusOutEvent(QFocusEvent* event)
{
    // Context menu or completer popup were opened
    // Let's block focusOutEvent to trick QLineEdit and paint cursor properly
    if (event->reason() == Qt::PopupFocusReason) {
        return;
    }

    LineEdit::focusOutEvent(event);

    setGoIconVisible(false);

    if (text().trimmed().isEmpty()) {
        clear();
    }

    refreshTextFormat();
}
示例#6
0
void LocationBar::focusInEvent(QFocusEvent* event)
{
    if (m_webView) {
        const QString stringUrl = convertUrlToText(m_webView->url());

        // Text has been edited, let's show go button
        if (stringUrl != text()) {
            setGoIconVisible(true);
        }
    }

    clearTextFormat();
    LineEdit::focusInEvent(event);

    if (Settings().value("Browser-View-Settings/instantBookmarksToolbar").toBool()) {
        m_window->bookmarksToolbar()->show();
    }
}
示例#7
0
void LocationBar::focusOutEvent(QFocusEvent* event)
{
    // Context menu or completer popup were opened
    // Let's block focusOutEvent to trick QLineEdit and paint cursor properly
    if (event->reason() == Qt::PopupFocusReason) {
        return;
    }

    LineEdit::focusOutEvent(event);

    setGoIconVisible(false);

    if (text().trimmed().isEmpty()) {
        clear();
    }

    refreshTextFormat();

    if (Settings().value("Browser-View-Settings/instantBookmarksToolbar").toBool()) {
        m_window->bookmarksToolbar()->hide();
    }
}