ICF 3.0.5.47
Technical documentation of ICF Libraries
CExtLineEdit.h
Go to the documentation of this file.
1/********************************************************************************
2** This file is part of the ICF Framework. Copyright (C) Witold Gantzke & Kirill Lepskiy
3** ICF Framework may be used under the terms of the LGPL License v. 2.1 by the Free Software Foundation.
4********************************************************************************/
5
6#ifndef iwidgets_CExtLineEdit_included
7#define iwidgets_CExtLineEdit_included
8
9
10// Qt includes
11#include <QtCore/QList>
12#include <QtGui/QIcon>
13#include <QtWidgets/QLineEdit>
14#include <QtWidgets/QLabel>
15
16// ICF includes
17#include <iwidgets/iwidgets.h>
18
19
20namespace iwidgets
21{
22
23
29class CExtLineEdit: public QLineEdit
30{
31 Q_OBJECT
32
33public:
34 typedef QLineEdit BaseClass;
35
36 explicit CExtLineEdit(QWidget* parent = nullptr);
37
42 const QString& startupText,
43 int margins,
44 QWidget* parent = nullptr);
45
49 virtual void SetStartupText(const QString& startupText);
50
54 virtual QString GetStartupText() const;
55
59 virtual QString GetText() const;
60
64 void SetIcon(const QIcon& icon);
65
71 void AddWidget(QWidget* widgetPtr, int alignmentFlags);
72
73protected:
74 // reimplemented (QWidget)
75 virtual void resizeEvent(QResizeEvent* resizeEvent);
76 virtual void focusInEvent(QFocusEvent* focusEvent);
77
78private Q_SLOTS:
79 void OnEditingFinished();
80 void OnTextChanged(const QString& text);
81
82private:
83 void UpdateLayout();
84 void UpdateStartupText();
85 void InitWidget();
86
87private:
88 QString m_startupText;
89 int m_margins;
90
91 struct SubWidgetInfo
92 {
93 QWidget* widget;
94 int alignmentFlags;
95 int margin;
96 };
97
98 typedef QList<SubWidgetInfo> SubWidgetsList;
99
100 QLabel* m_iconPtr;
101 SubWidgetsList m_subWidgets;
102};
103
104
105} // namespace iwidgets
106
107
108#endif // !iwidgets_CExtLineEdit_included
109
110
Input editor with extended functionality.
virtual void resizeEvent(QResizeEvent *resizeEvent)
void SetIcon(const QIcon &icon)
Set the icon, that will appeared on the left side of the line edit.
CExtLineEdit(QWidget *parent=nullptr)
CExtLineEdit(const QString &startupText, int margins, QWidget *parent=nullptr)
Construct a line edit with the given properties.
virtual void focusInEvent(QFocusEvent *focusEvent)
virtual void SetStartupText(const QString &startupText)
Set the text, that will be shown at the first time the editor becomes visible.
virtual QString GetStartupText() const
Get the startup text.
virtual QString GetText() const
Get editor text.
void AddWidget(QWidget *widgetPtr, int alignmentFlags)
Add a widget to the line edit area according to alginmentFlags.
Namespace contains implementation of Qt widget extensions.

© Witold Gantzke and Kirill Lepskiy