Tianchi  v0.0.2 build 20130701
C++ library for Qt with VC & mingW
tclineedit.h
1 // **************************************************************************
2 // Tianchi C++ library for Qt (open source)
3 // 天池共享源码库
4 // 版权所有 (C) 天池共享源码库开发组
5 // 授权协议:请阅读天池共享源码库附带的授权协议
6 // **************************************************************************
7 // 文档说明:extended QLineEdit widget
8 // ==========================================================================
9 // 开发日志:
10 // 日期 人员 说明
11 // --------------------------------------------------------------------------
12 // 2013.04.22 XChinux 建立
13 // 2013.04.29 XChinux add LineEditPrivate::_q_editingFinished()
14 // add LineEdit::clear()
15 // ==========================================================================
17 // ==========================================================================
18 #ifndef TIANCHI_TCLINEEDIT_H
19 #define TIANCHI_TCLINEEDIT_H
20 
21 #include <tianchi/tcglobal.h>
22 #include <QLineEdit>
23 
24 QT_BEGIN_NAMESPACE
25 class QPaintEvent;
26 class QMouseEvent;
27 class QContextMenuEvent;
28 QT_END_NAMESPACE
29 
30 class TcLineEditPrivate;
31 
35 class TIANCHI_API TcLineEdit : public QLineEdit
36 {
37  Q_OBJECT
38 
40  Q_PROPERTY(QString labelText
41  READ labelText
42  WRITE setLabelText
43  NOTIFY labelTextChanged
44  DESIGNABLE true)
46  Q_PROPERTY(QVariant data
47  READ data
48  WRITE setData
49  NOTIFY dataChanged
50  DESIGNABLE false)
51 public:
52  TcLineEdit(QWidget *parent = 0);
53  virtual ~TcLineEdit();
54  QString labelText() const;
55  QVariant data() const;
56 Q_SIGNALS:
58  void labelTextChanged(const QString &labelText);
60  void dataChanged(const QVariant &userData);
62  void doubleClicked();
63 public Q_SLOTS:
65  void setLabelText(const QString &labelText);
67  void setData(const QVariant &userData);
69  void clear();
70 protected:
71  virtual void paintEvent(QPaintEvent *event);
72  virtual void mouseDoubleClickEvent(QMouseEvent *event);
73  virtual void contextMenuEvent(QContextMenuEvent *event);
74 private:
75  Q_DISABLE_COPY(TcLineEdit)
76  Q_DECLARE_PRIVATE(TcLineEdit)
77  Q_PRIVATE_SLOT(d_func(), void _q_editingFinished())
78  TcLineEditPrivate* const d_ptr;
79 };
80 
81 #endif