-
Notifications
You must be signed in to change notification settings - Fork 57
/
Copy pathurllineedit.h
100 lines (76 loc) · 2.05 KB
/
urllineedit.h
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#ifndef URLLINEEDIT_H
#define URLLINEEDIT_H
#include <QtCore/QUrl>
#include <QtGui/QWidget>
#include <QtGui/QStyleOptionFrame>
#include <QWebView>
#include <QWebFrame>
#include <QMenu>
#include <QAbstractButton>
QT_BEGIN_NAMESPACE
class QLineEdit;
QT_END_NAMESPACE
/*
Clear button on the right hand side of the search widget.
Hidden by default
"A circle with an X in it"
*/
class ClearButton : public QAbstractButton
{
Q_OBJECT
public:
ClearButton(QWidget *parent = 0);
void paintEvent(QPaintEvent *event);
public slots:
void textChanged(const QString &text);
};
class ClearButton;
class ExLineEdit : public QWidget
{
Q_OBJECT
public:
ExLineEdit(QWidget *parent = 0);
inline QLineEdit *lineEdit() const { return m_lineEdit; }
void setLeftWidget(QWidget *widget);
QWidget *leftWidget() const;
QSize sizeHint() const;
QVariant inputMethodQuery(Qt::InputMethodQuery property) const;
protected:
void focusInEvent(QFocusEvent *event);
void focusOutEvent(QFocusEvent *event);
void keyPressEvent(QKeyEvent *event);
void paintEvent(QPaintEvent *event);
void resizeEvent(QResizeEvent *event);
void inputMethodEvent(QInputMethodEvent *e);
bool event(QEvent *event);
protected:
void updateGeometries();
void initStyleOption(QStyleOptionFrameV2 *option) const;
QWidget *m_leftWidget;
QLineEdit *m_lineEdit;
ClearButton *m_clearButton;
};
class UrlIconLabel;
class UrlLineEdit : public ExLineEdit
{
Q_OBJECT
public:
UrlLineEdit(QWidget *parent = 0);
void setWebView(QWebView *webView);
protected:
void paintEvent(QPaintEvent *event);
void focusOutEvent(QFocusEvent *event);
private slots:
void webViewUrlChanged(const QUrl &url);
void webViewIconChanged();
void progressChanged(int value);
void returnPressed();
private:
QLinearGradient generateGradient(const QColor &color) const;
QWebView *m_webView;
UrlIconLabel *m_iconLabel;
QColor m_defaultBaseColor;
int progress;
};
#include "searchlineedit.h"
#endif // URLLINEEDIT_H