kexi

KexiDataItemInterface Class Reference

#include <kexidataiteminterface.h>

Inheritance diagram for KexiDataItemInterface:

KexiFormDataItemInterface KexiTableEdit KexiDBAutoField KexiDBCheckBox KexiDBDateEdit KexiDBDateTimeEdit KexiDBDoubleSpinBox KexiDBForm KexiDBImageBox KexiDBIntSpinBox KexiDBLabel KexiDBLineEdit KexiDBTextEdit KexiDBTimeEdit KexiBoolTableEdit KexiInputTableEdit KexiKIconTableEdit

List of all members.


Detailed Description

An interface for declaring widgets to be data-aware.

Definition at line 51 of file kexidataiteminterface.h.


Public Member Functions

void setValue (const QVariant &value, const QVariant &add=QVariant(), bool removeOld=false, const QVariant *visibleValue=0)
virtual KexiDB::Fieldfield () const =0
virtual KexiDB::QueryColumnInfocolumnInfo () const =0
virtual void setColumnInfo (KexiDB::QueryColumnInfo *cinfo)=0
virtual void installListener (KexiDataItemChangesListener *listener)
virtual QVariant value ()=0
virtual bool valueIsValid ()
virtual bool valueIsNull ()=0
virtual bool valueIsEmpty ()=0
virtual QVariant visibleValue ()
virtual bool isReadOnly () const
virtual QWidget * widget ()=0
virtual void hideWidget ()
virtual void showWidget ()
virtual bool valueChanged ()
virtual bool cursorAtStart ()=0
virtual bool cursorAtEnd ()=0
virtual void moveCursorToEnd ()
virtual void moveCursorToStart ()
virtual void selectAll ()
virtual void clear ()=0
bool hasFocusableWidget () const
virtual void showFocus (const QRect &r, bool readOnly)
virtual void hideFocus ()
virtual void clickedOnContents ()
bool acceptEditorAfterDeleteContents () const
virtual void setFocus ()
bool cursorAtNewRow ()
void setParentDataItemInterface (KexiDataItemInterface *parentDataItemInterface)
KexiDataItemInterfaceparentInterface () const
virtual void handleAction (const QString &actionName)

Protected Member Functions

virtual void setValueInternal (const QVariant &add, bool removeOld)=0
virtual void setVisibleValueInternal (const QVariant &value)
virtual void signalValueChanged ()
virtual void beforeSignalValueChanged ()
KexiDataItemChangesListenerlistener ()

Protected Attributes

QGuardedPtr< QObject > m_listenerObject
KexiDataItemChangesListenerm_listener
bool m_listenerIsQObject
QVariant m_origValue
KexiDataItemInterfacem_parentDataItemInterface
bool m_hasFocusableWidget: 1
bool m_disable_signalValueChanged: 1
bool m_acceptEditorAfterDeleteContents: 1

Member Function Documentation

void KexiDataItemInterface::setValue ( const QVariant &  value,
const QVariant &  add = QVariant(),
bool  removeOld = false,
const QVariant *  visibleValue = 0 
)

Just initializes value, and calls setValueInternal(const QString& add, bool removeOld). If removeOld is true, current value is set up as add. If removeOld if false, current value is set up as value + add. value is stored as 'old value' -it'd be usable in the future (e.g. Combo Box editor can use old value if current value does not match any item on the list).

visibleValue (if not NULL) is passed to provide visible value to display instead of value. This is currently used only in case of the combo box form widget, where displayed content (usually a text of image) differs from the value of the widget (a numeric index).

This method is called by table view's and form's editors.

Definition at line 48 of file kexidataiteminterface.cpp.

virtual KexiDB::Field* KexiDataItemInterface::field (  )  const [pure virtual]

Returns:
field information for this item

Implemented in KexiFormDataItemInterface, KexiDBComboBox, KexiComboBoxTableEdit, and KexiTableEdit.

virtual KexiDB::QueryColumnInfo* KexiDataItemInterface::columnInfo (  )  const [pure virtual]

Returns:
column information for this item

Implemented in KexiFormDataItemInterface, and KexiTableEdit.

virtual void KexiDataItemInterface::setColumnInfo ( KexiDB::QueryColumnInfo cinfo  )  [pure virtual]

void KexiDataItemInterface::installListener ( KexiDataItemChangesListener listener  )  [virtual]

Sets listener. No need to reimplement this.

Reimplemented in KexiDBAutoField.

Definition at line 111 of file kexidataiteminterface.cpp.

bool KexiDataItemInterface::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 in KexiDBAutoField, KexiDBLineEdit, KexiDateTableEdit, KexiDateTimeTableEdit, and KexiTimeTableEdit.

Definition at line 133 of file kexidataiteminterface.cpp.

virtual bool KexiDataItemInterface::valueIsNull (  )  [pure virtual]

virtual bool KexiDataItemInterface::valueIsEmpty (  )  [pure 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.

Implemented in KexiDBAutoField, KexiDBCheckBox, KexiDBDateEdit, KexiDBDateTimeEdit, KexiDBDoubleSpinBox, KexiDBForm, KexiDBImageBox, KexiDBIntSpinBox, KexiDBLabel, KexiDBLineEdit, KexiDBTextEdit, KexiDBTimeEdit, KexiKIconTableEdit, KexiBoolTableEdit, KexiDateTableEdit, KexiDateTimeTableEdit, KexiInputTableEdit, and KexiTimeTableEdit.

virtual QVariant KexiDataItemInterface::visibleValue (  )  [inline, virtual]

Returns:
value that should be displayed for this item. Only used for items like combo box, where real value is an integer while displayed value is usually a text. For other item types this method should be empty.

Definition at line 112 of file kexidataiteminterface.h.

virtual bool KexiDataItemInterface::isReadOnly (  )  const [inline, 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 in KexiDBAutoField, KexiDBCheckBox, KexiDBDateEdit, KexiDBDateTimeEdit, KexiDBDoubleSpinBox, KexiDBForm, KexiDBImageBox, KexiDBIntSpinBox, KexiDBLabel, KexiDBLineEdit, KexiDBTextEdit, and KexiDBTimeEdit.

Definition at line 117 of file kexidataiteminterface.h.

virtual QWidget* KexiDataItemInterface::widget (  )  [pure virtual]

virtual void KexiDataItemInterface::hideWidget (  )  [inline, virtual]

Hides item's widget, if available.

Reimplemented in KexiFormDataItemInterface, and KexiTableEdit.

Definition at line 123 of file kexidataiteminterface.h.

virtual void KexiDataItemInterface::showWidget (  )  [inline, virtual]

Shows item's widget, if available.

Reimplemented in KexiFormDataItemInterface, and KexiTableEdit.

Definition at line 126 of file kexidataiteminterface.h.

bool KexiDataItemInterface::valueChanged (  )  [virtual]

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

Reimplemented in KexiDBAutoField, KexiDBComboBox, KexiComboBoxTableEdit, and KexiInputTableEdit.

Definition at line 85 of file kexidataiteminterface.cpp.

virtual bool KexiDataItemInterface::cursorAtStart (  )  [pure 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.

Implemented in KexiDBAutoField, KexiDBCheckBox, KexiDBDateEdit, KexiDBDateTimeEdit, KexiDBDoubleSpinBox, KexiDBForm, KexiDBImageBox, KexiDBIntSpinBox, KexiDBLabel, KexiDBLineEdit, KexiDBTextEdit, KexiDBTimeEdit, KexiKIconTableEdit, KexiBoolTableEdit, and KexiInputTableEdit.

virtual bool KexiDataItemInterface::cursorAtEnd (  )  [pure 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.

Implemented in KexiDBAutoField, KexiDBCheckBox, KexiDBDateEdit, KexiDBDateTimeEdit, KexiDBDoubleSpinBox, KexiDBForm, KexiDBImageBox, KexiDBIntSpinBox, KexiDBLabel, KexiDBLineEdit, KexiDBTextEdit, KexiDBTimeEdit, KexiKIconTableEdit, KexiBoolTableEdit, and KexiInputTableEdit.

virtual void KexiDataItemInterface::moveCursorToEnd (  )  [inline, virtual]

Moves cursor after the last character (or element). For implementation in items supporting text cursor's movement; by default does nothing.

Reimplemented in KexiDBAutoField, KexiDBLineEdit, KexiDBTextEdit, KexiComboBoxTableEdit, and KexiInputTableEdit.

Definition at line 143 of file kexidataiteminterface.h.

virtual void KexiDataItemInterface::moveCursorToStart (  )  [inline, virtual]

Moves cursor before the first character (or element). For implementation in items supporting text cursor's movement; by default does nothing.

Reimplemented in KexiDBAutoField, KexiDBLineEdit, KexiDBTextEdit, KexiComboBoxTableEdit, and KexiInputTableEdit.

Definition at line 147 of file kexidataiteminterface.h.

virtual void KexiDataItemInterface::selectAll (  )  [inline, virtual]

Selects all characters (or elements) of the item. For implementation in items supporting text or elements; by default does nothing.

Reimplemented in KexiDBAutoField, KexiDBLineEdit, KexiDBTextEdit, KexiComboBoxTableEdit, and KexiInputTableEdit.

Definition at line 151 of file kexidataiteminterface.h.

virtual void KexiDataItemInterface::clear (  )  [pure virtual]

bool KexiDataItemInterface::hasFocusableWidget (  )  const [inline]

Returns:
true if this editor offers a widget (e.g. line edit) that we can move focus to. Editor for boolean values has this set to false (see KexiBoolTableEdit). This is true by default. You can override this flag by changing m_hasFocusableWidget in your subclass' constructor.

Definition at line 160 of file kexidataiteminterface.h.

void KexiDataItemInterface::showFocus ( const QRect &  r,
bool  readOnly 
) [virtual]

Displays additional elements that are needed for indicating that the current cell is selected. For example, combobox editor (KexiComboBoxTableEdit) moves and shows dropdown button. r is the rectangle for the cell. If readOnly is true, additional elements should be visually disabled, e.g. dropdown button of the combobox editor should be disabled. For reimplementation. By default does nothing.

Reimplemented in KexiComboBoxTableEdit.

Definition at line 119 of file kexidataiteminterface.cpp.

void KexiDataItemInterface::hideFocus (  )  [virtual]

Hides additional elements that are needed for indicating that the current cell is selected. For reimplementation. By default does nothing.

Reimplemented in KexiComboBoxTableEdit.

Definition at line 125 of file kexidataiteminterface.cpp.

void KexiDataItemInterface::clickedOnContents (  )  [virtual]

Allows to define reaction for clicking on cell's contents. Currently it's used for editor of type boolean, where we want to toggle true/false on single mouse click.

See also:
hasFocusableWidget(), KexiBoolTableEdit. Default implementation does nothing.

Reimplemented in KexiBoolTableEdit.

Definition at line 129 of file kexidataiteminterface.cpp.

bool KexiDataItemInterface::acceptEditorAfterDeleteContents (  )  const [inline]

Returns:
true if editing should be accepted immediately after deleting contents for the cell (usually using Delete key). This flag is false by default, and is true e.g. for date, time and datetime types.

Definition at line 184 of file kexidataiteminterface.h.

void KexiDataItemInterface::setParentDataItemInterface ( KexiDataItemInterface parentDataItemInterface  ) 

Sets a pointer to a Parent Data Item Interface. This pointer is 0 by default, but can be set by parent widget if this interface is a building block of a larger data widget. It is the case for KexiDBFieldEdit widget (see KexiDBFieldEdit::createEditor()). Use with care. signalValueChanged() method will check this pointer, and if it's not 0, m_parentDataItemInterface->signalValueChanged() is called, so a changes can be signalled at higher level.

Definition at line 138 of file kexidataiteminterface.cpp.

KexiDataItemInterface* KexiDataItemInterface::parentInterface (  )  const [inline]

Returns:
a pointer to a Parent Data Item Interface.
See also:
setParentDataItemInterface()

Definition at line 199 of file kexidataiteminterface.h.

virtual void KexiDataItemInterface::handleAction ( const QString &  actionName  )  [inline, virtual]

Handles action having standard name actionName. Action could be: "edit_cut", "edit_paste", etc. For reimplementation.

Reimplemented in KexiDBLineEdit, KexiBoolTableEdit, KexiComboBoxTableEdit, KexiDateTableEdit, KexiDateTimeTableEdit, KexiInputTableEdit, and KexiTimeTableEdit.

Definition at line 204 of file kexidataiteminterface.h.

virtual void KexiDataItemInterface::setValueInternal ( const QVariant &  add,
bool  removeOld 
) [protected, pure 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.

Implemented in KexiDBAutoField, KexiDBCheckBox, KexiDBComboBox, KexiDBDateEdit, KexiDBDateTimeEdit, KexiDBDoubleSpinBox, KexiDBForm, KexiDBImageBox, KexiDBIntSpinBox, KexiDBLabel, KexiDBLineEdit, KexiDBTextEdit, KexiDBTimeEdit, KexiKIconTableEdit, KexiBoolTableEdit, KexiDateTableEdit, KexiDateTimeTableEdit, KexiInputTableEdit, and KexiTimeTableEdit.

void KexiDataItemInterface::setVisibleValueInternal ( const QVariant &  value  )  [protected, virtual]

Initializes this editor with value visible value. This is currently used only in case of the combo box form widget, where displayed content (usually a text of image) differs from the value of the widget (a numeric index). For implementation in the combo box widget, by default does nothing.

Reimplemented in KexiDBComboBox.

Definition at line 66 of file kexidataiteminterface.cpp.

void KexiDataItemInterface::signalValueChanged (  )  [protected, virtual]

Call this in your implementation when value changes, so installed listener can react on this change. If there is a parent data item defined (see setParentDataItemInterface()), parent's signalValueChanged() method will be called instead.

Definition at line 71 of file kexidataiteminterface.cpp.

virtual void KexiDataItemInterface::beforeSignalValueChanged (  )  [inline, protected, virtual]

Used to perform some actions before signalValueChanged() call. We need this because the intrface is not QObject and thus has got no real signals. Used in KexiDBComboBox.

Reimplemented in KexiDBComboBox.

Definition at line 232 of file kexidataiteminterface.h.


Member Data Documentation

See also:
parentDataItemInterface()

Definition at line 243 of file kexidataiteminterface.h.


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