aboutsummaryrefslogtreecommitdiff
path: root/src/widgets/urllineedit.h
blob: 546ca41a417c3dfa5eb51d12005476b57a572d5b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#ifndef URLLINEEDIT_H
#define URLLINEEDIT_H

#include <QLineEdit>
#include <QTextLayout>

class UrlLineEdit : public QLineEdit
{
    Q_OBJECT
public:
    explicit UrlLineEdit(QWidget *parent = 0);

signals:

public slots:
    void setUrl(const QUrl &url);
    QUrl url();

protected:
    void focusInEvent(QFocusEvent *event);
    void focusOutEvent(QFocusEvent *event);

private:
    void setTextFormat(const QTextLayout::FormatRange &format);
    void clearTextFormat();

    QTextLayout::FormatRange m_hostFormat;
};

#endif // URLLINEEDIT_H