CExtLineEdit.h
Go to the documentation of this file.
1 #ifndef iwidgets_CExtLineEdit_included
2 #define iwidgets_CExtLineEdit_included
3 
4 
5 // Qt includes
6 #include <QtCore/QList>
7 #include <QtGui/QIcon>
8 #if QT_VERSION >= 0x050000
9 #include <QtWidgets/QLineEdit>
10 #include <QtWidgets/QLabel>
11 #else
12 #include <QtGui/QLineEdit>
13 #include <QtGui/QLabel>
14 #endif
15 
16 // ACF includes
17 #include <istd/TDelPtr.h>
18 
19 #include <iwidgets/iwidgets.h>
20 
21 
22 namespace iwidgets
23 {
24 
25 
31 class CExtLineEdit: public QLineEdit
32 {
33  Q_OBJECT
34 
35 public:
36  typedef QLineEdit BaseClass;
37 
38  explicit CExtLineEdit(QWidget* parent = NULL);
39 
44  const QString& startupText,
45  int margins,
46  QWidget* parent = NULL);
47 
51  virtual void SetStartupText(const QString& startupText);
52 
56  virtual QString GetStartupText() const;
57 
61  virtual QString GetText() const;
62 
66  void SetIcon(const QIcon& icon);
67 
73  void AddWidget(QWidget* widgetPtr, int alignmentFlags);
74 
75 protected:
76  // reimplemented (QWidget)
77  virtual void resizeEvent(QResizeEvent* resizeEvent);
78  virtual void focusInEvent(QFocusEvent* focusEvent);
79 
80 private Q_SLOTS:
81  void OnEditingFinished();
82  void OnTextChanged(const QString& text);
83 
84 private:
85  void UpdateLayout();
86  void UpdateStartupText();
87  void InitWidget();
88 
89 private:
90  QString m_startupText;
91  int m_margins;
92 
93  struct SubWidgetInfo
94  {
95  QWidget* widget;
96  int alignmentFlags;
97  int margin;
98  };
99 
100  typedef QList<SubWidgetInfo> SubWidgetsList;
101 
102  QLabel* m_iconPtr;
103  SubWidgetsList m_subWidgets;
104 };
105 
106 
107 } // namespace iwidgets
108 
109 
110 #endif // !iwidgets_CExtLineEdit_included
111 
112 
Input editor with extended functionality.
Definition: CExtLineEdit.h:31
virtual QString GetText() const
Get editor text.
virtual QString GetStartupText() const
Get the startup text.
CExtLineEdit(QWidget *parent=NULL)
void SetIcon(const QIcon &icon)
Set the icon, that will appeared on the left side of the line edit.
virtual void SetStartupText(const QString &startupText)
Set the text, that will be shown at the first time the editor becomes visible.
virtual void resizeEvent(QResizeEvent *resizeEvent)
#define NULL
Definition: istd.h:64
void AddWidget(QWidget *widgetPtr, int alignmentFlags)
Add a widget to the line edit area according to alginmentFlags.
virtual void focusInEvent(QFocusEvent *focusEvent)

© 2007-2017 Witold Gantzke and Kirill Lepskiy