Kexi API Documentation (2.0 alpha)

KexiDBLineEdit Class Reference

#include <kexidblineedit.h>

Inheritance diagram for KexiDBLineEdit:

KLineEdit KexiDBTextWidgetInterface KexiFormDataItemInterface KexiSubwidgetInterface KexiDataItemInterface List of all members.

Detailed Description

Line edit widget for Kexi forms.

Handles many data types. User input is validated by using validators and/or input masks.

Definition at line 43 of file kexidblineedit.h.

Public Slots

void setDataSource (const QString &ds)
 Sets the name of the data source for this widget.
void setDataSourceMimeType (const QCString &ds)
virtual void setReadOnly (bool readOnly)
virtual void undo ()
 Reimplemented, so "undo" means the same as "cancelEditor" action.
virtual void moveCursorToEnd ()
 Implemented for KexiDataItemInterface.
virtual void moveCursorToStart ()
 Implemented for KexiDataItemInterface.
virtual void selectAll ()
 Implemented for KexiDataItemInterface.

Public Member Functions

 KexiDBLineEdit (QWidget *parent, const char *name=0)
virtual ~KexiDBLineEdit ()
QString dataSource () const
QCString dataSourceMimeType () const
virtual QVariant value ()
virtual void setInvalidState (const QString &displayText)
virtual bool valueIsNull ()
virtual bool valueIsEmpty ()
virtual bool valueIsValid ()
virtual bool isReadOnly () const
virtual void setDisplayDefaultValue (QWidget *widget, bool displayDefaultValue)
virtual QWidgetwidget ()
virtual bool cursorAtStart ()
virtual bool cursorAtEnd ()
virtual void clear ()
 clears item's data, so the data will contain NULL data
virtual void setColumnInfo (KexiDB::QueryColumnInfo *cinfo)
virtual void handleAction (const QString &actionName)
virtual bool keyPressed (QKeyEvent *ke)

Protected Slots

void slotTextChanged (const QString &)

Protected Member Functions

virtual void paintEvent (QPaintEvent *)
virtual void setValueInternal (const QVariant &add, bool removeOld)
virtual bool event (QEvent *)
virtual QPopupMenu * createPopupMenu ()
virtual bool appendStretchRequired (KexiDBAutoField *autoField) const
 Implemented for KexiSubwidgetInterface.

Protected Attributes

KexiTextFormatter m_textFormatter
 Used to format text.
QGuardedPtr< const QValidatorm_readOnlyValidator
 Used for read only flag to disable editing.
QGuardedPtr< const QValidatorm_readWriteValidator
 Used to remember the previous validator used forf r/w mode, after setting the read only flag.
KexiDBWidgetContextMenuExtender m_menuExtender
 Used for extending context menu.
bool m_internalReadOnly: 1
 Used in isReadOnly, as sometimes we want to have the flag set tot true when KLineEdit::isReadOnly is still false.
bool m_slotTextChanged_enabled: 1
 Used in slotTextChanged().

Properties

QString dataSource
QCString dataSourceMimeType


Constructor & Destructor Documentation

KexiDBLineEdit::KexiDBLineEdit QWidget parent,
const char *  name = 0
 

Definition at line 53 of file kexidblineedit.cpp.

References lighterGrayBackgroundColor(), slotTextChanged(), and widget().

KexiDBLineEdit::~KexiDBLineEdit  )  [virtual]
 

Definition at line 73 of file kexidblineedit.cpp.


Member Function Documentation

bool KexiDBLineEdit::appendStretchRequired KexiDBAutoField autoField  )  const [protected, virtual]
 

Implemented for KexiSubwidgetInterface.

Reimplemented from KexiSubwidgetInterface.

Definition at line 360 of file kexidblineedit.cpp.

References KexiDBAutoField::labelPosition, and KexiDBAutoField::Top.

void KexiDBLineEdit::clear  )  [virtual]
 

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

Implements KexiDataItemInterface.

Definition at line 291 of file kexidblineedit.cpp.

References m_internalReadOnly.

QPopupMenu * KexiDBLineEdit::createPopupMenu  )  [protected, virtual]
 

Definition at line 268 of file kexidblineedit.cpp.

References KexiDBWidgetContextMenuExtender::createTitle(), and m_menuExtender.

bool KexiDBLineEdit::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 286 of file kexidblineedit.cpp.

bool KexiDBLineEdit::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 281 of file kexidblineedit.cpp.

QString KexiDBLineEdit::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 58 of file kexidblineedit.h.

References KexiFormDataItemInterface::dataSource().

QCString KexiDBLineEdit::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 59 of file kexidblineedit.h.

References KexiFormDataItemInterface::dataSourceMimeType().

bool KexiDBLineEdit::event QEvent *  e  )  [protected, virtual]
 

Todo:
add option to set cursor at the beginning

Definition at line 344 of file kexidblineedit.cpp.

References KexiDBTextWidgetInterface::event().

void KexiDBLineEdit::handleAction const QString actionName  )  [virtual]
 

Handles action having standard name actionName. Action could be: "edit_copy", "edit_paste", etc. Reimplemented after KexiDataItemChangesListener.

Reimplemented from KexiDataItemInterface.

Definition at line 365 of file kexidblineedit.cpp.

bool KexiDBLineEdit::isReadOnly  )  const [virtual]
 

Returns:
'readOnly' flag for this widget.

Reimplemented from KexiDataItemInterface.

Definition at line 242 of file kexidblineedit.cpp.

References m_internalReadOnly.

bool KexiDBLineEdit::keyPressed QKeyEvent *  ke  )  [virtual]
 

Called by top-level form on key press event to consume widget-specific shortcuts.

Reimplemented from KexiFormDataItemInterface.

Definition at line 411 of file kexidblineedit.cpp.

void KexiDBLineEdit::moveCursorToEnd  )  [virtual, slot]
 

Implemented for KexiDataItemInterface.

mark

Reimplemented from KexiDataItemInterface.

Definition at line 396 of file kexidblineedit.cpp.

void KexiDBLineEdit::moveCursorToStart  )  [virtual, slot]
 

Implemented for KexiDataItemInterface.

mark

Reimplemented from KexiDataItemInterface.

Definition at line 401 of file kexidblineedit.cpp.

void KexiDBLineEdit::paintEvent QPaintEvent *   )  [protected, virtual]
 

Definition at line 337 of file kexidblineedit.cpp.

References KexiDBTextWidgetInterface::paint().

void KexiDBLineEdit::selectAll  )  [virtual, slot]
 

Implemented for KexiDataItemInterface.

Reimplemented from KexiDataItemInterface.

Definition at line 406 of file kexidblineedit.cpp.

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

Todo:
handle input mask (via QLineEdit::setInputMask()) using a special KexiDB::FieldInputMask class

Reimplemented from KexiFormDataItemInterface.

Definition at line 298 of file kexidblineedit.cpp.

References KexiDB::Field::Date, KexiDB::Field::DateTime, dateTimeInputMask(), KexiDB::QueryColumnInfo::field, KexiTextFormatter::inputMask(), m_textFormatter, KexiDBTextWidgetInterface::setColumnInfo(), KexiFormDataItemInterface::setColumnInfo(), KexiTextFormatter::setField(), and KexiDB::Field::Time.

void KexiDBLineEdit::setDataSource const QString ds  )  [inline, slot]
 

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 103 of file kexidblineedit.h.

References KexiFormDataItemInterface::setDataSource().

void KexiDBLineEdit::setDataSourceMimeType const QCString &  ds  )  [inline, slot]
 

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 104 of file kexidblineedit.h.

References KexiFormDataItemInterface::setDataSourceMimeType().

void KexiDBLineEdit::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 379 of file kexidblineedit.cpp.

References KexiDisplayUtils::DisplayParameters::font, KexiFormDataItemInterface::m_displayParametersForDefaultValue, KexiFormDataItemInterface::m_displayParametersForEnteredValue, KexiFormDataItemInterface::setDisplayDefaultValue(), and KexiDisplayUtils::DisplayParameters::textColor.

void KexiDBLineEdit::setInvalidState const QString displayText  )  [virtual]
 

Todo:
move this to KexiDataItemInterface::setInvalidStateInternal() ?

Implements KexiFormDataItemInterface.

Definition at line 79 of file kexidblineedit.cpp.

void KexiDBLineEdit::setReadOnly bool  readOnly  )  [virtual, slot]
 

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 247 of file kexidblineedit.cpp.

References m_internalReadOnly, m_menuExtender, m_readOnlyValidator, m_readWriteValidator, and KexiDBWidgetContextMenuExtender::updatePopupMenuActions().

void KexiDBLineEdit::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 88 of file kexidblineedit.cpp.

References KexiDB::Field::Boolean, KexiDB::Field::Date, KexiDB::Field::DateTime, KexiFormDataItemInterface::m_columnInfo, KexiDataItemInterface::m_origValue, m_slotTextChanged_enabled, m_textFormatter, KexiDB::Field::Time, value(), and KexiTextFormatter::valueToText().

void KexiDBLineEdit::slotTextChanged const QString  )  [protected, slot]
 

Definition at line 185 of file kexidblineedit.cpp.

References m_slotTextChanged_enabled, and KexiDataItemInterface::signalValueChanged().

Referenced by KexiDBLineEdit().

void KexiDBLineEdit::undo  )  [virtual, slot]
 

Reimplemented, so "undo" means the same as "cancelEditor" action.

Definition at line 391 of file kexidblineedit.cpp.

References KexiFormDataItemInterface::cancelEditor().

QVariant KexiDBLineEdit::value  )  [virtual]
 

Returns:
value currently represented by this item.

Implements KexiDataItemInterface.

Definition at line 145 of file kexidblineedit.cpp.

References KexiDB::Field::BigInteger, KexiDB::Field::Boolean, KexiDB::Field::Byte, KexiDB::Field::Date, KexiDB::Field::DateTime, KexiDB::Field::Double, KexiDB::QueryColumnInfo::field, KexiDB::Field::Float, KexiDB::Field::Integer, KexiDB::Field::LongText, KexiFormDataItemInterface::m_columnInfo, m_textFormatter, KexiDB::Field::ShortInteger, stringToDateTime(), KexiDB::Field::Text, KexiTextFormatter::textToValue(), and KexiDB::Field::Time.

Referenced by setValueInternal().

bool KexiDBLineEdit::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 or form is met.

Implements KexiDataItemInterface.

Definition at line 197 of file kexidblineedit.cpp.

References KexiDB::Field::Date, dateTimeIsEmpty(), KexiDB::QueryColumnInfo::field, KexiFormDataItemInterface::m_columnInfo, m_textFormatter, KexiDB::Field::Time, and KexiTextFormatter::valueIsEmpty().

Referenced by valueIsNull(), and valueIsValid().

bool KexiDBLineEdit::valueIsNull  )  [virtual]
 

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

Implements KexiDataItemInterface.

Definition at line 192 of file kexidblineedit.cpp.

References valueIsEmpty().

bool KexiDBLineEdit::valueIsValid  )  [virtual]
 

Returns:
true if the value is valid

Reimplemented from KexiDataItemInterface.

Definition at line 219 of file kexidblineedit.cpp.

References KexiDB::Field::Date, KexiDB::Field::DateTime, dateTimeIsValid(), KexiDB::QueryColumnInfo::field, KexiFormDataItemInterface::m_columnInfo, m_textFormatter, KexiDB::Field::Time, valueIsEmpty(), and KexiTextFormatter::valueIsValid().

QWidget * KexiDBLineEdit::widget  )  [virtual]
 

Returns:
the view widget of this item, e.g. line edit widget.

Reimplemented from KexiFormDataItemInterface.

Definition at line 276 of file kexidblineedit.cpp.

Referenced by KexiDBLineEdit().


Member Data Documentation

bool KexiDBLineEdit::m_internalReadOnly [protected]
 

Used in isReadOnly, as sometimes we want to have the flag set tot true when KLineEdit::isReadOnly is still false.

Definition at line 164 of file kexidblineedit.h.

Referenced by clear(), isReadOnly(), and setReadOnly().

KexiDBWidgetContextMenuExtender KexiDBLineEdit::m_menuExtender [protected]
 

Used for extending context menu.

Definition at line 160 of file kexidblineedit.h.

Referenced by createPopupMenu(), and setReadOnly().

QGuardedPtr<const QValidator> KexiDBLineEdit::m_readOnlyValidator [protected]
 

Used for read only flag to disable editing.

Definition at line 154 of file kexidblineedit.h.

Referenced by setReadOnly().

QGuardedPtr<const QValidator> KexiDBLineEdit::m_readWriteValidator [protected]
 

Used to remember the previous validator used forf r/w mode, after setting the read only flag.

Definition at line 157 of file kexidblineedit.h.

Referenced by setReadOnly().

bool KexiDBLineEdit::m_slotTextChanged_enabled [protected]
 

Used in slotTextChanged().

Definition at line 167 of file kexidblineedit.h.

Referenced by setValueInternal(), and slotTextChanged().

KexiTextFormatter KexiDBLineEdit::m_textFormatter [protected]
 

Used to format text.

Definition at line 151 of file kexidblineedit.h.

Referenced by setColumnInfo(), setValueInternal(), value(), valueIsEmpty(), and valueIsValid().


Property Documentation

QString KexiDBLineEdit::dataSource [read, write]
 

Definition at line 50 of file kexidblineedit.h.

QCString KexiDBLineEdit::dataSourceMimeType [read, write]
 

Definition at line 51 of file kexidblineedit.h.


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for Kexi 2.0 alpha.
Documentation copyright © 2002-2007 the Kexi Team.
Generated on Tue Apr 1 20:50:10 2008 by doxygen 1.4.2 written by Dimitri van Heesch, © 1997-2003