]> git.sur5r.net Git - minitube/blob - src/urllineedit.h
Merge tag 'upstream/2.3'
[minitube] / src / urllineedit.h
1 /* $BEGIN_LICENSE
2
3 This file is part of Minitube.
4 Copyright 2009, Flavio Tordini <flavio.tordini@gmail.com>
5
6 Minitube is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 Minitube is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with Minitube.  If not, see <http://www.gnu.org/licenses/>.
18
19 $END_LICENSE */
20
21 /****************************************************************************
22 **
23 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
24 ** Contact: Nokia Corporation (qt-info@nokia.com)
25 **
26 ** This file is part of the demonstration applications of the Qt Toolkit.
27 **
28 ** $QT_BEGIN_LICENSE:LGPL$
29 ** Commercial Usage
30 ** Licensees holding valid Qt Commercial licenses may use this file in
31 ** accordance with the Qt Commercial License Agreement provided with the
32 ** Software or, alternatively, in accordance with the terms contained in
33 ** a written agreement between you and Nokia.
34 **
35 ** GNU Lesser General Public License Usage
36 ** Alternatively, this file may be used under the terms of the GNU Lesser
37 ** General Public License version 2.1 as published by the Free Software
38 ** Foundation and appearing in the file LICENSE.LGPL included in the
39 ** packaging of this file.  Please review the following information to
40 ** ensure the GNU Lesser General Public License version 2.1 requirements
41 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
42 **
43 ** In addition, as a special exception, Nokia gives you certain
44 ** additional rights. These rights are described in the Nokia Qt LGPL
45 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
46 ** package.
47 **
48 ** GNU General Public License Usage
49 ** Alternatively, this file may be used under the terms of the GNU
50 ** General Public License version 3.0 as published by the Free Software
51 ** Foundation and appearing in the file LICENSE.GPL included in the
52 ** packaging of this file.  Please review the following information to
53 ** ensure the GNU General Public License version 3.0 requirements will be
54 ** met: http://www.gnu.org/copyleft/gpl.html.
55 **
56 ** If you are unsure which license is appropriate for your use, please
57 ** contact the sales department at http://www.qtsoftware.com/contact.
58 ** $QT_END_LICENSE$
59 **
60 ****************************************************************************/
61
62 #ifndef URLLINEEDIT_H
63 #define URLLINEEDIT_H
64
65 #include <QUrl>
66 #include <QWidget>
67 #include <QLineEdit>
68 #include <QStyleOptionFrame>
69
70 QT_BEGIN_NAMESPACE
71 class QLineEdit;
72 QT_END_NAMESPACE
73
74 class ClearButton;
75 class ExLineEdit : public QWidget
76 {
77     Q_OBJECT
78
79 public:
80     ExLineEdit(QWidget *parent = 0);
81
82     inline QLineEdit *lineEdit() const { return m_lineEdit; }
83
84     void setLeftWidget(QWidget *widget);
85     QWidget *leftWidget() const;
86     void clear() {
87         m_lineEdit->clear();
88     }
89     QString text() {
90         return m_lineEdit->text();
91     }
92     QSize sizeHint() const;
93     void updateGeometries();
94     void setFont(const QFont &);
95
96 protected:
97     void focusInEvent(QFocusEvent *event);
98     void focusOutEvent(QFocusEvent *event);
99     void keyPressEvent(QKeyEvent *event);
100     void paintEvent(QPaintEvent *event);
101     void resizeEvent(QResizeEvent *event);
102     bool event(QEvent *event);
103     void initStyleOption(QStyleOptionFrameV2 *option) const;
104
105     QWidget *m_leftWidget;
106     QLineEdit *m_lineEdit;
107     ClearButton *m_clearButton;
108 };
109
110 #endif // URLLINEEDIT_H
111