kexi

KexiDBAutoField Class Reference

#include <kexidbautofield.h>

Inheritance diagram for KexiDBAutoField:

KexiFormDataItemInterface KFormDesigner::DesignTimeDynamicChildWidgetHandler KexiDataItemInterface List of all members.

Detailed Description

Universal "Auto Field" widget for Kexi forms.

It acts as a container for most data-aware widgets.

Definition at line 35 of file kexidbautofield.h.


Public Types

enum  WidgetType {
  Auto = 100, Text, Integer, Double,
  Boolean, Date, Time, DateTime,
  MultiLineText, Enum, Image
}
enum  LabelPosition { Left = 300, Top, NoLabel }

Public Member Functions

 KexiDBAutoField (const QString &text, WidgetType type, LabelPosition pos, QWidget *parent=0, const char *name=0, bool designMode=true)
 KexiDBAutoField (QWidget *parent=0, const char *name=0, bool designMode=true)
virtual ~KexiDBAutoField ()
QString dataSource () const
QCString dataSourceMimeType () const
virtual void setDataSource (const QString &ds)
virtual void setDataSourceMimeType (const QCString &ds)
virtual void setColumnInfo (KexiDB::QueryColumnInfo *cinfo)
virtual void setInvalidState (const QString &text)
virtual bool isReadOnly () const
virtual QVariant value ()
virtual bool valueIsNull ()
virtual bool valueIsEmpty ()
virtual bool valueChanged ()
virtual void clear ()
virtual void installListener (KexiDataItemChangesListener *listener)
WidgetType widgetType () const
void setWidgetType (WidgetType type)
LabelPosition labelPosition () const
void setLabelPosition (LabelPosition position)
QString caption () const
void setCaption (const QString &caption)
bool hasAutoCaption () const
void setAutoCaption (bool autoCaption)
QWidget * editor () const
QLabel * label () const
virtual bool cursorAtStart ()
virtual bool cursorAtEnd ()
void setFieldTypeInternal (int kexiDBFieldType)
void setFieldCaptionInternal (const QString &text)
int fieldTypeInternal () const
QString fieldCaptionInternal () const
virtual QSize sizeHint () const
virtual void setFocusPolicy (FocusPolicy policy)

Static Public Member Functions

static WidgetType widgetTypeForFieldType (KexiDB::Field::Type type)

Protected Slots

void slotValueChanged ()
virtual void paletteChange (const QPalette &oldPal)

Protected Member Functions

virtual void setValueInternal (const QVariant &add, bool removeOld)
void init (const QString &text, WidgetType type, LabelPosition pos)
void createEditor ()
void changeText (const QString &text, bool beautify=true)
void updateInformationAboutUnboundField ()

Properties

bool autoCaption
QString dataSource
QCString dataSourceMimeType
LabelPosition labelPosition
WidgetType widgetType
int fieldTypeInternal
QString fieldCaptionInternal

Member Function Documentation

void KexiDBAutoField::changeText const QString &  text,
bool  beautify = true
[protected]
 

Todo:
look at appendColonToAutoLabels setting [bool]

look at makeFirstCharacterUpperCaseInAutoLabels setting [bool] (see doc/dev/settings.txt)

Definition at line 435 of file kexidbautofield.cpp.

void KexiDBAutoField::clear  )  [virtual]
 

clears item's data, so the data will contain NULL data

Implements KexiDataItemInterface.

Definition at line 335 of file kexidbautofield.cpp.

void KexiDBAutoField::createEditor  )  [protected]
 

Todo:
using kexitableview combo box editor when it's ready
Todo:
create db-aware spinboxes, date, time edit, etc

Definition at line 109 of file kexidbautofield.cpp.

bool KexiDBAutoField::cursorAtEnd  )  [virtual]
 

Returns:
true if the item widget's cursor (whatever that means, eg. line edit cursor) is at the end of editor's contents. This can inform table/form view that after pressing "right arrow" key should stop editing and move to a field on the right hand.

Implements KexiDataItemInterface.

Definition at line 326 of file kexidbautofield.cpp.

bool KexiDBAutoField::cursorAtStart  )  [virtual]
 

Returns:
true if the item widget's cursor (whatever that means, eg. line edit cursor) is at the beginning of editor's contents. This can inform table/form view that after pressing "left arrow" key should stop editing and move to a field on the left hand.

Implements KexiDataItemInterface.

Definition at line 317 of file kexidbautofield.cpp.

QString KexiDBAutoField::dataSource  )  const [inline]
 

Returns:
the name of the data source for this widget. Data source usually means here a table or query, a field name or an expression.

Reimplemented from KexiFormDataItemInterface.

Definition at line 63 of file kexidbautofield.h.

QCString KexiDBAutoField::dataSourceMimeType  )  const [inline]
 

Returns:
the mime type of the data source for this widget. Data source mime type means here types like "kexi/table" or "kexi/query" in.the data source is set to object (as within form or subform) or is empty if the data source is set to table field or query column.

Reimplemented from KexiFormDataItemInterface.

Definition at line 64 of file kexidbautofield.h.

void KexiDBAutoField::installListener KexiDataItemChangesListener listener  )  [virtual]
 

Reimpelmented to also install listenter for internal editor.

Reimplemented from KexiDataItemInterface.

Definition at line 308 of file kexidbautofield.cpp.

bool KexiDBAutoField::isReadOnly  )  const [virtual]
 

Returns:
'readOnly' flag for this item. The flag is usually taken from the item's widget, e.g. KLineEdit::isReadOnly(). By default, always returns false.

Reimplemented from KexiDataItemInterface.

Definition at line 239 of file kexidbautofield.cpp.

void KexiDBAutoField::setColumnInfo KexiDB::QueryColumnInfo cinfo  )  [virtual]
 

Used internally to set database column information. Reimplement if you need to do additional actions, e.g. set data validator based on field type. Don't forget about calling superclass implementation.

Reimplemented from KexiFormDataItemInterface.

Definition at line 368 of file kexidbautofield.cpp.

void KexiDBAutoField::setDataSource const QString &  ds  )  [virtual]
 

Sets the name of the data source for this widget.

Data source usually means here a table or query or field name name.

Reimplemented from KexiFormDataItemInterface.

Definition at line 511 of file kexidbautofield.cpp.

virtual void KexiDBAutoField::setDataSourceMimeType const QCString &  ds  )  [inline, virtual]
 

Sets the mime type of the data source for this widget. Data source usually means here a "kexi/table" or "kexi/query".

See also:
dataSourceMimeType()

Reimplemented from KexiFormDataItemInterface.

Definition at line 66 of file kexidbautofield.h.

void KexiDBAutoField::setFieldCaptionInternal const QString &  text  ) 
 

On design time it is not possible to pass a reference to KexiDB::Field object so we're just providing field caption. Only used when widget type is Auto.

Definition at line 357 of file kexidbautofield.cpp.

void KexiDBAutoField::setFieldTypeInternal int  kexiDBFieldType  ) 
 

On design time it is not possible to pass a reference to KexiDB::Field object so we're just providing field type. Only used when widget type is Auto.

Definition at line 343 of file kexidbautofield.cpp.

void KexiDBAutoField::setInvalidState const QString &  text  )  [virtual]
 

Todo:
or set this to editor's text?

Implements KexiFormDataItemInterface.

Definition at line 225 of file kexidbautofield.cpp.

void KexiDBAutoField::setLabelPosition LabelPosition  position  ) 
 

Todo:
support right-to-left layout where positions are inverted

Definition at line 178 of file kexidbautofield.cpp.

void KexiDBAutoField::setValueInternal const QVariant &  add,
bool  removeOld
[protected, virtual]
 

Initializes this editor with add value, which should be somewhat added to the current value (already storted in m_origValue). If removeOld is true, a value should be set to add, otherwise -it should be set to current m_origValue + add, if possible. Implement this.

Implements KexiDataItemInterface.

Definition at line 257 of file kexidbautofield.cpp.

QVariant KexiDBAutoField::value  )  [virtual]
 

Returns:
value currently represented by this item.

Implements KexiDataItemInterface.

Definition at line 265 of file kexidbautofield.cpp.

bool KexiDBAutoField::valueChanged  )  [virtual]
 

Returns:
true if editor's value is changed (compared to original value)

Reimplemented from KexiDataItemInterface.

Definition at line 298 of file kexidbautofield.cpp.

bool KexiDBAutoField::valueIsEmpty  )  [virtual]
 

Returns:
true if editor's value is empty (not necessary null). Only few data types can accept "EMPTY" property (use KexiDB::Field::hasEmptyProperty() to check this). Used for checking if a given constraint within table of form is met.

Implements KexiDataItemInterface.

Definition at line 289 of file kexidbautofield.cpp.

bool KexiDBAutoField::valueIsNull  )  [virtual]
 

Returns:
true if editor's value is null (not empty) Used for checking if a given constraint within table or form is met.

Implements KexiDataItemInterface.

Definition at line 280 of file kexidbautofield.cpp.


The documentation for this class was generated from the following files:
KDE Home | KDE Accessibility Home | Description of Access Keys