Exemplo n.º 1
0
void LocationBar::setText(const QString &text)
{
    m_oldTextLength = text.length();
    m_currentTextLength = m_oldTextLength;

    LineEdit::setText(text);

    refreshTextFormat();
}
Exemplo n.º 2
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();
}
Exemplo n.º 3
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();
    }
}
Exemplo n.º 4
0
void LocationBar::showUrl(const QUrl &url)
{
    if (hasFocus() || url.isEmpty()) {
        return;
    }

    const QString stringUrl = convertUrlToText(url);

    if (text() == stringUrl) {
        home(false);
        refreshTextFormat();
        return;
    }

    // Set converted url as text
    setText(stringUrl);

    // Move cursor to the start
    home(false);

    m_bookmarkIcon->checkBookmark(url);
}
Exemplo n.º 5
0
void LocationBar::showEvent(QShowEvent* event)
{
    LineEdit::showEvent(event);

    refreshTextFormat();
}
Exemplo n.º 6
0
void LocationBar::setText(const QString &text)
{
    LineEdit::setText(text);

    refreshTextFormat();
}