Ananas Library  0.9.5
wfield.h
1 /****************************************************************************
2 ** $Id: wfield.h,v 1.38 2008/07/05 12:19:40 app Exp $
3 **
4 ** Header file of the field plugin of Ananas
5 ** Designer and Engine applications
6 **
7 ** Created : 20031201
8 **
9 ** Copyright (C) 2003-2004 Leader InfoTech. All rights reserved.
10 ** Copyright (C) 2003-2004 Grigory Panov, Yoshkar-Ola.
11 **
12 ** This file is part of the Ananas Plugins of the Ananas
13 ** automation accounting system.
14 **
15 ** This file may be distributed and/or modified under the terms of the
16 ** GNU General Public License version 2 as published by the Free Software
17 ** Foundation and appearing in the file LICENSE.GPL included in the
18 ** packaging of this file.
19 **
20 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
21 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
22 **
23 ** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
24 ** See http://www.leaderit.ru/gpl/ for GPL licensing information.
25 **
26 ** Contact org@leaderit.ru if any conditions of this licensing are
27 ** not clear to you.
28 **
29 **********************************************************************/
30 
31 #ifndef QAFIELD_H
32 #define QAFIELD_H
33 
34 #include <qwidget.h>
35 #include <qwidgetplugin.h>
36 #include <qpushbutton.h>
37 #include <qlabel.h>
38 #include <qdatetimeedit.h>
39 #include <qcheckbox.h>
40 #include "qlineedit.h"
41 #include "wdateedit.h"
42 #include "adatabase.h"
43 #include "ananas.h"
44 #include "acalendar.h"
45 #include <qvalidator.h>
46 
47 class wCatButton;
48 class wCheckBox;
49 
63 class QT_WIDGET_PLUGIN_EXPORT wField : public aWidget
64 {
65  Q_OBJECT
66 
67  Q_PROPERTY( QString value READ value WRITE setValue)
68  Q_PROPERTY( QString FieldType READ getFieldType WRITE setFieldType )
69  Q_PROPERTY( tEditorType EditorType READ getEditorType WRITE setEditorType )
70  Q_ENUMS(tEditorType)
71  Q_ENUMS(FieldMode)
72 public:
73  enum tEditorType { Unknown, Numberic, String, Date, DateTime, Boolean, Catalogue=101, Document};
74 
75  wField( QWidget *parent, const char *name, WFlags fl = 0 );
76 // wField( QWidget *parent, const char *name, WFlags fl, bool dbf = TRUE );
77  virtual ~wField();
78 
79  virtual QDialog* createEditor( QWidget *parent );
80 
81 signals:
82  void valueChanged( const QString & );
83  void valueChanged( const QVariant & );
84  void inputInvalid();
85  void lostFocus();
86 
87 public slots:
88  bool getOpt() const { return false; };
89  void setOpt( bool fn ) { if(fn) widgetEditor(); };
90  virtual QString value() const;
91  QString text() const;
92  virtual void setValue( const QString &fn );
93  virtual void Validate( const QString &fn );
94  void setValue( const QDate& d);
95  virtual QString textValue() {return text();};
96  void setFieldType( QString n );
97  QString getFieldType() const {return vFieldType;};
98  void setEditorType( tEditorType n );
99  tEditorType getEditorType() const { return vEditorType; };
100  void fieldSelect();
101 // void propertyUpdate(QString propName);
102  virtual void focusInEvent();
103  virtual void focusOutEvent();
104  void selectAll();
105  virtual void SetReadOnly(bool);
106  virtual void SetNonZero(bool);
107  virtual void SetMask(QString);
108  virtual void SetValidator(QString Validator, int twostate);
109 
110 private slots:
111  void on_selected( Q_ULLONG uid );
112  void popupCalendar();
113 
114 protected:
115  QLineEdit *lineEdit;
116  wDateEdit *dateEdit;
117  QLabel *objLabel;
118  QLabel *nzLabel;
119  wCatButton *objButton;
120  wCheckBox *checkBox;
121  QValidator *v;
122  int two_state;
123  tEditorType vEditorType;
124  QString vFieldType;
125  QString vValue;
126 // virtual void updateProp();
127  void widgetInit();
128 private:
129  int loaded;
130  int md_oid, md_fid;
131  void popupCalendar(QDateEdit *dateEdit);
132 // QColorGroup::ColorRole defaultFrameBorderLightColor;
133 // QColorGroup::ColorRole defaultFrameBorderDarkColor;
134  QPalette defaultLineEditPalette;
135  int defaultLineEditFrameMargin;
136  int defaultLineEditFrameStyle;
137 };
138 
139 class wCatButton: public QPushButton
140 {
141  Q_OBJECT
142  public:
143  wCatButton(const char * caption, QWidget *parent);
144  virtual ~wCatButton();
145  protected:
146  void keyPressEvent ( QKeyEvent * e );
147 };
148 class wCheckBox: public QCheckBox
149 {
150  Q_OBJECT
151  public:
152  wCheckBox(QWidget *parent, const char * name =0);
153  virtual ~wCheckBox();
154 
155  public slots:
156  void on_toggled();
157  signals:
158  void valueChanged(const QString &);
159 };
160 
161 #endif
wCatButton(const char *caption, QWidget *parent)
Definition: wfield.cpp:735
virtual QDialog * createEditor(QWidget *parent)
Definition: awidget.cpp:347
virtual void setValue(const QString &)
Definition: awidget.cpp:883
Плагин – виджет используется в экранных формах в качес...
Definition: wdateedit.h:65
Definition: wfield.h:139
virtual void SetReadOnly(bool)
Definition: awidget.cpp:945
Базовый класс для визуальных объектов. Наследует QWidget...
Definition: awidget.h:52
Плагин – виджет предназначенный для редактирования зн...
Definition: wfield.h:63
Definition: wfield.h:148