Exemple #1
0
void LocationBar::setText(const QString &text)
{
    m_oldTextLength = text.length();
    m_currentTextLength = m_oldTextLength;

    LineEdit::setText(text);

    refreshTextFormat();
}
Exemple #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();
}
Exemple #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();
    }
}
Exemple #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);
}
Exemple #5
0
void LocationBar::showEvent(QShowEvent* event)
{
    LineEdit::showEvent(event);

    refreshTextFormat();
}
Exemple #6
0
void LocationBar::setText(const QString &text)
{
    LineEdit::setText(text);

    refreshTextFormat();
}