1 | // Copyright (C) 2016 The Qt Company Ltd. |
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
3 | |
4 | #ifndef QITEMEDITORFACTORY_P_H |
5 | #define QITEMEDITORFACTORY_P_H |
6 | |
7 | // |
8 | // W A R N I N G |
9 | // ------------- |
10 | // |
11 | // This file is not part of the Qt API. It exists purely as an |
12 | // implementation detail. This header file may change from version to |
13 | // version without notice, or even be removed. |
14 | // |
15 | // We mean it. |
16 | // |
17 | |
18 | |
19 | #include <QtWidgets/private/qtwidgetsglobal_p.h> |
20 | |
21 | #if QT_CONFIG(lineedit) |
22 | #include <qlineedit.h> |
23 | |
24 | QT_REQUIRE_CONFIG(itemviews); |
25 | |
26 | QT_BEGIN_NAMESPACE |
27 | |
28 | class QExpandingLineEdit : public QLineEdit |
29 | { |
30 | Q_OBJECT |
31 | |
32 | public: |
33 | QExpandingLineEdit(QWidget *parent); |
34 | |
35 | void setWidgetOwnsGeometry(bool value) |
36 | { |
37 | widgetOwnsGeometry = value; |
38 | } |
39 | |
40 | protected: |
41 | void changeEvent(QEvent *e) override; |
42 | |
43 | public Q_SLOTS: |
44 | void resizeToContents(); |
45 | |
46 | private: |
47 | void updateMinimumWidth(); |
48 | |
49 | int originalWidth; |
50 | bool widgetOwnsGeometry; |
51 | }; |
52 | |
53 | |
54 | QT_END_NAMESPACE |
55 | |
56 | #endif // QT_CONFIG(lineedit) |
57 | |
58 | #endif //QITEMEDITORFACTORY_P_H |
59 | |