kexi
KexiDBAutoField Class Reference
#include <kexidbautofield.h>
Inheritance diagram for KexiDBAutoField:

Detailed Description
Universal "Auto Field" widget for Kexi forms.It acts as a container for most data-aware widgets.
Definition at line 36 of file kexidbautofield.h.
Public Types | |
enum | WidgetType { Auto = 100, Text, Integer, Double, Boolean, Date, Time, DateTime, MultiLineText, ComboBox, Image } |
enum | LabelPosition { Left = 300, Top, NoLabel } |
Public Slots | |
virtual void | unsetPalette () |
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, LabelPosition pos=Left) | |
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 void | setReadOnly (bool readOnly) |
virtual QVariant | value () |
virtual bool | valueIsNull () |
virtual bool | valueIsEmpty () |
virtual bool | valueIsValid () |
virtual bool | valueChanged () |
virtual void | clear () |
virtual void | installListener (KexiDataItemChangesListener *listener) |
WidgetType | widgetType () const |
void | setWidgetType (WidgetType type) |
LabelPosition | labelPosition () const |
virtual void | setLabelPosition (LabelPosition position) |
QString | caption () const |
void | setCaption (const QString &caption) |
bool | hasAutoCaption () const |
void | setAutoCaption (bool autoCaption) |
virtual void | setDisplayDefaultValue (QWidget *widget, bool displayDefaultValue) |
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) |
const QColor & | paletteForegroundColor () const |
void | setPaletteForegroundColor (const QColor &color) |
const QColor & | paletteBackgroundColor () const |
virtual void | setPaletteBackgroundColor (const QColor &color) |
const QColor & | foregroundLabelColor () const |
virtual void | setForegroundLabelColor (const QColor &color) |
const QColor & | backgroundLabelColor () const |
virtual void | setBackgroundLabelColor (const QColor &color) |
virtual QVariant | property (const char *name) const |
virtual bool | setProperty (const char *name, const QVariant &value) |
virtual bool | keyPressed (QKeyEvent *ke) |
Static Public Member Functions | |
static WidgetType | widgetTypeForFieldType (KexiDB::Field::Type type) |
Protected Slots | |
virtual void | paletteChange (const QPalette &oldPal) |
virtual void | moveCursorToEnd () |
virtual void | moveCursorToStart () |
virtual void | selectAll () |
Protected Member Functions | |
virtual void | setValueInternal (const QVariant &add, bool removeOld) |
void | init (const QString &text, WidgetType type, LabelPosition pos) |
virtual void | createEditor () |
void | changeText (const QString &text, bool beautify=true) |
void | updateInformationAboutUnboundField () |
void | copyPropertiesToEditor () |
virtual bool | eventFilter (QObject *o, QEvent *e) |
void | setLabelPositionInternal (LabelPosition position, bool noLabel) |
void | setColumnInfoInternal (KexiDB::QueryColumnInfo *cinfo, KexiDB::QueryColumnInfo *visibleColumnInfo) |
Properties | |
QColor | foregroundLabelColor [] |
QColor | backgroundLabelColor [] |
bool | autoCaption [] |
QString | dataSource [] |
QCString | dataSourceMimeType [] |
bool | readOnly [] |
LabelPosition | labelPosition [] |
WidgetType | widgetType [] |
int | fieldTypeInternal [] |
QString | fieldCaptionInternal [] |
Member Function Documentation
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 72 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 73 of file kexidbautofield.h.
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 645 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 75 of file kexidbautofield.h.
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.
Reimplemented in KexiDBComboBox.
Definition at line 494 of file kexidbautofield.cpp.
void KexiDBAutoField::setInvalidState | ( | const QString & | text | ) | [virtual] |
Sets 'invalid' state, e.g. a text editor widget should display text displayText and become read only to prevent entering data, because updating at the database backend is not available. displayText is usually set to something i18n'd like "#NAME?". Note: that even widgets that usualy do not display texts (e.g. pixmaps) should display displayText too.
Implements KexiFormDataItemInterface.
Definition at line 296 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 311 of file kexidbautofield.cpp.
void KexiDBAutoField::setReadOnly | ( | bool | readOnly | ) | [virtual] |
Changes 'read only' flag, for this widget. Typically this flag can be passed to a widget itself, e.g. KLineEdit::setReadOnly(bool).
Implements KexiFormDataItemInterface.
Definition at line 321 of file kexidbautofield.cpp.
QVariant KexiDBAutoField::value | ( | ) | [virtual] |
- Returns:
- value currently represented by this item.
Implements KexiDataItemInterface.
Reimplemented in KexiDBComboBox.
Definition at line 338 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 347 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 356 of file kexidbautofield.cpp.
bool KexiDBAutoField::valueIsValid | ( | ) | [virtual] |
- Returns:
- true if editor's value is valid for a given type Used for checking if an entered value is valid, E.g.
a part of time value can be entered: "12:8" and this is invalid, not only null. Null time or date is valid in Kexi, so it is not enough to test value().isValid(). Default implementation just returns true.
Reimplemented from KexiDataItemInterface.
Definition at line 365 of file kexidbautofield.cpp.
bool KexiDBAutoField::valueChanged | ( | ) | [virtual] |
- Returns:
- true if editor's value is changed (compared to original value)
Reimplemented from KexiDataItemInterface.
Reimplemented in KexiDBComboBox.
Definition at line 374 of file kexidbautofield.cpp.
void KexiDBAutoField::clear | ( | ) | [virtual] |
clears item's data, so the data will contain NULL data
Implements KexiDataItemInterface.
Definition at line 451 of file kexidbautofield.cpp.
void KexiDBAutoField::installListener | ( | KexiDataItemChangesListener * | listener | ) | [virtual] |
Reimpelmented to also install listenter for internal editor.
Reimplemented from KexiDataItemInterface.
Definition at line 384 of file kexidbautofield.cpp.
void KexiDBAutoField::setLabelPosition | ( | LabelPosition | position | ) | [virtual] |
void KexiDBAutoField::setDisplayDefaultValue | ( | QWidget * | widget, | |
bool | displayDefaultValue | |||
) | [virtual] |
If displayDefaultValue is true, the value set by KexiDataItemInterface::setValue() is displayed in a special way. Used by KexiFormDataProvider::fillDataItems(). widget is equal to 'this'. Reimplemented after KexiFormDataItemInterface.
Reimplemented from KexiFormDataItemInterface.
Definition at line 810 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 433 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 442 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 459 of file kexidbautofield.cpp.
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 483 of file kexidbautofield.cpp.
const QColor & KexiDBAutoField::paletteForegroundColor | ( | ) | const |
Reimplemented to return internal editor's color.
Definition at line 723 of file kexidbautofield.cpp.
void KexiDBAutoField::setPaletteForegroundColor | ( | const QColor & | color | ) |
const QColor & KexiDBAutoField::paletteBackgroundColor | ( | ) | const |
Reimplemented to return internal editor's color.
Reimplemented in KexiDBComboBox.
Definition at line 734 of file kexidbautofield.cpp.
void KexiDBAutoField::setPaletteBackgroundColor | ( | const QColor & | color | ) | [virtual] |
Reimplemented to set internal editor's color.
Reimplemented in KexiDBComboBox.
Definition at line 739 of file kexidbautofield.cpp.
const QColor& KexiDBAutoField::foregroundLabelColor | ( | ) | const |
- Returns:
- label's foreground color
void KexiDBAutoField::setForegroundLabelColor | ( | const QColor & | color | ) | [virtual] |
const QColor& KexiDBAutoField::backgroundLabelColor | ( | ) | const |
- Returns:
- label's background color
void KexiDBAutoField::setBackgroundLabelColor | ( | const QColor & | color | ) | [virtual] |
QVariant KexiDBAutoField::property | ( | const char * | name | ) | const [virtual] |
bool KexiDBAutoField::setProperty | ( | const char * | name, | |
const QVariant & | value | |||
) | [virtual] |
bool KexiDBAutoField::keyPressed | ( | QKeyEvent * | ke | ) | [virtual] |
Called by the top-level form on key press event to consume widget-specific shortcuts.
Reimplemented from KexiFormDataItemInterface.
Reimplemented in KexiDBComboBox.
Definition at line 838 of file kexidbautofield.cpp.
void KexiDBAutoField::moveCursorToEnd | ( | ) | [protected, virtual, slot] |
Implemented for KexiDataItemInterface.
Reimplemented from KexiDataItemInterface.
Definition at line 817 of file kexidbautofield.cpp.
void KexiDBAutoField::moveCursorToStart | ( | ) | [protected, virtual, slot] |
Implemented for KexiDataItemInterface.
Reimplemented from KexiDataItemInterface.
Definition at line 824 of file kexidbautofield.cpp.
void KexiDBAutoField::selectAll | ( | ) | [protected, virtual, slot] |
Implemented for KexiDataItemInterface.
Reimplemented from KexiDataItemInterface.
Definition at line 831 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.
Reimplemented in KexiDBComboBox.
Definition at line 329 of file kexidbautofield.cpp.
void KexiDBAutoField::createEditor | ( | ) | [protected, virtual] |
void KexiDBAutoField::changeText | ( | const QString & | text, | |
bool | beautify = true | |||
) | [protected] |
Definition at line 567 of file kexidbautofield.cpp.
void KexiDBAutoField::copyPropertiesToEditor | ( | ) | [protected] |
internal editor can be created too late, so certain properties should be copied
Definition at line 205 of file kexidbautofield.cpp.
void KexiDBAutoField::setLabelPositionInternal | ( | LabelPosition | position, | |
bool | noLabel | |||
) | [protected] |
Used by setLabelPositionInternal(LabelPosition).
void KexiDBAutoField::setColumnInfoInternal | ( | KexiDB::QueryColumnInfo * | cinfo, | |
KexiDB::QueryColumnInfo * | visibleColumnInfo | |||
) | [protected] |
Used by KexiDBAutoField::setColumnInfo() and KexiDBComboBox::setColumnInfo().
Definition at line 501 of file kexidbautofield.cpp.
The documentation for this class was generated from the following files: