kexi

#include <kexidbautofield.h>

Inheritance diagram for KexiDBAutoField:
KexiFormDataItemInterface KFormDesigner::DesignTimeDynamicChildWidgetHandler KFormDesigner::WidgetWithSubpropertiesInterface KexiDataItemInterface KexiDBComboBox

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 TQString &text, WidgetType type, LabelPosition pos, TQWidget *parent=0, const char *name=0, bool designMode=true)
 
 KexiDBAutoField (TQWidget *parent=0, const char *name=0, bool designMode=true, LabelPosition pos=Left)
 
TQString dataSource () const
 
TQCString dataSourceMimeType () const
 
virtual void setDataSource (const TQString &ds)
 
virtual void setDataSourceMimeType (const TQCString &ds)
 
virtual void setColumnInfo (KexiDB::QueryColumnInfo *cinfo)
 
virtual void setInvalidState (const TQString &text)
 
virtual bool isReadOnly () const
 
virtual void setReadOnly (bool readOnly)
 
virtual TQVariant 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)
 
TQString caption () const
 
void setCaption (const TQString &caption)
 
bool hasAutoCaption () const
 
void setAutoCaption (bool autoCaption)
 
virtual void setDisplayDefaultValue (TQWidget *widget, bool displayDefaultValue)
 
TQWidget * editor () const
 
TQLabel * label () const
 
virtual bool cursorAtStart ()
 
virtual bool cursorAtEnd ()
 
void setFieldTypeInternal (int kexiDBFieldType)
 
void setFieldCaptionInternal (const TQString &text)
 
int fieldTypeInternal () const
 
TQString fieldCaptionInternal () const
 
virtual TQSize sizeHint () const
 
virtual void setFocusPolicy (TQWidget::FocusPolicy policy)
 
const TQColor & paletteForegroundColor () const
 
void setPaletteForegroundColor (const TQColor &color)
 
const TQColor & paletteBackgroundColor () const
 
virtual void setPaletteBackgroundColor (const TQColor &color)
 
const TQColor & foregroundLabelColor () const
 
virtual void setForegroundLabelColor (const TQColor &color)
 
const TQColor & backgroundLabelColor () const
 
virtual void setBackgroundLabelColor (const TQColor &color)
 
virtual TQVariant property (const char *name) const
 
virtual bool setProperty (const char *name, const TQVariant &value)
 
virtual bool keyPressed (TQKeyEvent *ke)
 
- Public Member Functions inherited from KexiFormDataItemInterface
TQString dataSource () const
 
void setDataSource (const TQString &ds)
 
TQCString dataSourceMimeType () const
 
void setDataSourceMimeType (const TQCString &ds)
 
virtual bool hasDisplayedDefaultValue () const
 
virtual TQWidget * widget ()
 
virtual KexiDB::Field * field () const
 
virtual KexiDB::QueryColumnInfo * columnInfo () const
 
virtual void setVisibleColumnInfo (KexiDB::QueryColumnInfo *cinfo)
 
virtual KexiDB::QueryColumnInfo * visibleColumnInfo () const
 
virtual void hideWidget ()
 
virtual void showWidget ()
 
virtual void undoChanges ()
 
void cancelEditor ()
 
- Public Member Functions inherited from KexiDataItemInterface
void setValue (const TQVariant &value, const TQVariant &add=TQVariant(), bool removeOld=false, const TQVariant *visibleValue=0)
 
virtual TQVariant visibleValue ()
 
virtual void moveCursorToEnd ()
 
virtual void moveCursorToStart ()
 
virtual void selectAll ()
 
bool hasFocusableWidget () const
 
virtual void showFocus (const TQRect &r, bool readOnly)
 
virtual void hideFocus ()
 
virtual void clickedOnContents ()
 
bool acceptEditorAfterDeleteContents () const
 
virtual void setFocus ()
 
bool cursorAtNewRow ()
 
void setParentDataItemInterface (KexiDataItemInterface *parentDataItemInterface)
 
KexiDataItemInterface * parentInterface () const
 
virtual void handleAction (const TQString &actionName)
 
- Public Member Functions inherited from KFormDesigner::WidgetWithSubpropertiesInterface
void setSubwidget (TQWidget *widget)
 
TQWidget * subwidget () const
 
TQValueList< TQCString > subproperies () const
 
const TQMetaProperty * findMetaSubproperty (const char *name) const
 
TQVariant subproperty (const char *name, bool &ok) const
 
bool setSubproperty (const char *name, const TQVariant &value)
 

Static Public Member Functions

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

Protected Slots

virtual void paletteChange (const TQPalette &oldPal)
 
virtual void moveCursorToEnd ()
 
virtual void moveCursorToStart ()
 
virtual void selectAll ()
 

Protected Member Functions

virtual void setValueInternal (const TQVariant &add, bool removeOld)
 
void init (const TQString &text, WidgetType type, LabelPosition pos)
 
virtual void createEditor ()
 
void changeText (const TQString &text, bool beautify=true)
 
void updateInformationAboutUnboundField ()
 
void copyPropertiesToEditor ()
 
virtual bool eventFilter (TQObject *o, TQEvent *e)
 
void setLabelPositionInternal (LabelPosition position, bool noLabel)
 
void setColumnInfoInternal (KexiDB::QueryColumnInfo *cinfo, KexiDB::QueryColumnInfo *visibleColumnInfo)
 
- Protected Member Functions inherited from KexiDataItemInterface
virtual void setVisibleValueInternal (const TQVariant &value)
 
virtual void signalValueChanged ()
 
virtual void beforeSignalValueChanged ()
 
KexiDataItemChangesListener * listener ()
 
- Protected Member Functions inherited from KFormDesigner::DesignTimeDynamicChildWidgetHandler
void childWidgetAdded (TQWidget *w)
 
void assignItem (ObjectTreeItem *item)
 

Additional Inherited Members

- Protected Attributes inherited from KexiFormDataItemInterface
TQString m_dataSource
 
TQCString m_dataSourceMimeType
 
KexiDB::QueryColumnInfo * m_columnInfo
 
KexiDisplayUtils::DisplayParameters * m_displayParametersForEnteredValue
 
KexiDisplayUtils::DisplayParameters * m_displayParametersForDefaultValue
 
bool m_displayDefaultValue: 1
 
- Protected Attributes inherited from KexiDataItemInterface
TQGuardedPtr< TQObject > m_listenerObject
 
KexiDataItemChangesListener * m_listener
 
bool m_listenerIsTQObject
 
TQVariant m_origValue
 
KexiDataItemInterface * m_parentDataItemInterface
 
bool m_hasFocusableWidget: 1
 
bool m_disable_signalValueChanged: 1
 
bool m_acceptEditorAfterDeleteContents: 1
 
- Protected Attributes inherited from KFormDesigner::WidgetWithSubpropertiesInterface
TQGuardedPtr< TQWidget > m_subwidget
 
TQValueList< TQCString > m_subproperies
 

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.

Member Enumeration Documentation

◆ LabelPosition

enum KexiDBAutoField::LabelPosition

Definition at line 64 of file kexidbautofield.h.

◆ WidgetType

enum KexiDBAutoField::WidgetType

Definition at line 62 of file kexidbautofield.h.

Constructor & Destructor Documentation

◆ KexiDBAutoField() [1/2]

KexiDBAutoField::KexiDBAutoField ( const TQString &  text,
WidgetType  type,
LabelPosition  pos,
TQWidget *  parent = 0,
const char *  name = 0,
bool  designMode = true 
)

Definition at line 74 of file kexidbautofield.cpp.

◆ KexiDBAutoField() [2/2]

KexiDBAutoField::KexiDBAutoField ( TQWidget *  parent = 0,
const char *  name = 0,
bool  designMode = true,
LabelPosition  pos = Left 
)

Definition at line 85 of file kexidbautofield.cpp.

◆ ~KexiDBAutoField()

KexiDBAutoField::~KexiDBAutoField ( )
virtual

Definition at line 95 of file kexidbautofield.cpp.

Member Function Documentation

◆ backgroundLabelColor()

const TQColor & KexiDBAutoField::backgroundLabelColor ( ) const
Returns
label's background color

Definition at line 763 of file kexidbautofield.cpp.

◆ caption()

TQString KexiDBAutoField::caption ( ) const

Definition at line 402 of file kexidbautofield.cpp.

◆ changeText()

void KexiDBAutoField::changeText ( const TQString &  text,
bool  beautify = true 
)
protected
Todo:
look at appendColonToAutoLabels setting [bool]
Todo:
Todo:
look at makeFirstCharacterUpperCaseInCaptions setting [bool] (see doc/dev/settings.txt)
Todo:
":" suffix looks weird for checkbox; remove this condition when [x] is displayed after label
Todo:
Todo:
support right-to-left layout where position of ":" is inverted

Definition at line 567 of file kexidbautofield.cpp.

◆ clear()

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.

◆ copyPropertiesToEditor()

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.

◆ createEditor()

void KexiDBAutoField::createEditor ( )
protectedvirtual
Todo:
setup validator
Todo:
setup validator

Reimplemented in KexiDBComboBox.

Definition at line 142 of file kexidbautofield.cpp.

◆ cursorAtEnd()

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.

◆ cursorAtStart()

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.

◆ dataSource()

TQString KexiDBAutoField::dataSource ( ) const
inline

Definition at line 73 of file kexidbautofield.h.

◆ dataSourceMimeType()

TQCString KexiDBAutoField::dataSourceMimeType ( ) const
inline

Definition at line 74 of file kexidbautofield.h.

◆ editor()

TQWidget * KexiDBAutoField::editor ( ) const

Definition at line 412 of file kexidbautofield.cpp.

◆ eventFilter()

bool KexiDBAutoField::eventFilter ( TQObject *  o,
TQEvent *  e 
)
protectedvirtual

Definition at line 801 of file kexidbautofield.cpp.

◆ fieldCaptionInternal()

TQString KexiDBAutoField::fieldCaptionInternal ( ) const

Definition at line 427 of file kexidbautofield.cpp.

◆ fieldTypeInternal()

int KexiDBAutoField::fieldTypeInternal ( ) const

Definition at line 422 of file kexidbautofield.cpp.

◆ foregroundLabelColor()

const TQColor & KexiDBAutoField::foregroundLabelColor ( ) const
Returns
label's foreground color

Definition at line 745 of file kexidbautofield.cpp.

◆ hasAutoCaption()

bool KexiDBAutoField::hasAutoCaption ( ) const

Definition at line 407 of file kexidbautofield.cpp.

◆ init()

void KexiDBAutoField::init ( const TQString &  text,
WidgetType  type,
LabelPosition  pos 
)
protected

Definition at line 104 of file kexidbautofield.cpp.

◆ installListener()

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.

◆ isReadOnly()

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.

◆ keyPressed()

bool KexiDBAutoField::keyPressed ( TQKeyEvent *  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.

◆ label()

TQLabel * KexiDBAutoField::label ( ) const

Definition at line 417 of file kexidbautofield.cpp.

◆ labelPosition()

KexiDBAutoField::LabelPosition KexiDBAutoField::labelPosition ( ) const

Definition at line 397 of file kexidbautofield.cpp.

◆ moveCursorToEnd

void KexiDBAutoField::moveCursorToEnd ( )
protectedvirtualslot

Implemented for KexiDataItemInterface.

Definition at line 817 of file kexidbautofield.cpp.

◆ moveCursorToStart

void KexiDBAutoField::moveCursorToStart ( )
protectedvirtualslot

Implemented for KexiDataItemInterface.

Definition at line 824 of file kexidbautofield.cpp.

◆ paletteBackgroundColor()

const TQColor & KexiDBAutoField::paletteBackgroundColor ( ) const

Reimplemented to return internal editor's color.

Definition at line 734 of file kexidbautofield.cpp.

◆ paletteChange

void KexiDBAutoField::paletteChange ( const TQPalette &  oldPal)
protectedvirtualslot

Definition at line 709 of file kexidbautofield.cpp.

◆ paletteForegroundColor()

const TQColor & KexiDBAutoField::paletteForegroundColor ( ) const

Reimplemented to return internal editor's color.

Definition at line 723 of file kexidbautofield.cpp.

◆ property()

TQVariant KexiDBAutoField::property ( const char *  name) const
virtual

Reimplemented to accept subproperties.

See also
KFormDesigner::WidgetWithSubpropertiesInterface

Definition at line 784 of file kexidbautofield.cpp.

◆ selectAll

void KexiDBAutoField::selectAll ( )
protectedvirtualslot

Implemented for KexiDataItemInterface.

Definition at line 831 of file kexidbautofield.cpp.

◆ setAutoCaption()

void KexiDBAutoField::setAutoCaption ( bool  autoCaption)

Definition at line 628 of file kexidbautofield.cpp.

◆ setBackgroundLabelColor()

void KexiDBAutoField::setBackgroundLabelColor ( const TQColor &  color)
virtual

Sets label's background color.

Definition at line 771 of file kexidbautofield.cpp.

◆ setCaption()

void KexiDBAutoField::setCaption ( const TQString &  caption)

Definition at line 620 of file kexidbautofield.cpp.

◆ setColumnInfo()

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.

◆ setColumnInfoInternal()

void KexiDBAutoField::setColumnInfoInternal ( KexiDB::QueryColumnInfo *  cinfo,
KexiDB::QueryColumnInfo *  visibleColumnInfo 
)
protected

◆ setDataSource()

void KexiDBAutoField::setDataSource ( const TQString &  ds)
virtual

Definition at line 645 of file kexidbautofield.cpp.

◆ setDataSourceMimeType()

virtual void KexiDBAutoField::setDataSourceMimeType ( const TQCString &  ds)
inlinevirtual

Definition at line 76 of file kexidbautofield.h.

◆ setDisplayDefaultValue()

void KexiDBAutoField::setDisplayDefaultValue ( TQWidget *  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.

◆ setFieldCaptionInternal()

void KexiDBAutoField::setFieldCaptionInternal ( const TQString &  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.

◆ setFieldTypeInternal()

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.

◆ setFocusPolicy()

void KexiDBAutoField::setFocusPolicy ( TQWidget::FocusPolicy  policy)
virtual

Definition at line 670 of file kexidbautofield.cpp.

◆ setForegroundLabelColor()

void KexiDBAutoField::setForegroundLabelColor ( const TQColor &  color)
virtual

Sets label's foreground color.

Definition at line 753 of file kexidbautofield.cpp.

◆ setInvalidState()

void KexiDBAutoField::setInvalidState ( const TQString &  displayText)
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.

Todo:
or set this to editor's text?

Implements KexiFormDataItemInterface.

Definition at line 296 of file kexidbautofield.cpp.

◆ setLabelPosition()

void KexiDBAutoField::setLabelPosition ( LabelPosition  position)
virtual
Todo:
support right-to-left layout where positions are inverted

Definition at line 222 of file kexidbautofield.cpp.

◆ setLabelPositionInternal()

void KexiDBAutoField::setLabelPositionInternal ( LabelPosition  position,
bool  noLabel 
)
protected

Used by setLabelPositionInternal(LabelPosition)

◆ setPaletteBackgroundColor()

void KexiDBAutoField::setPaletteBackgroundColor ( const TQColor &  color)
virtual

Reimplemented to set internal editor's color.

Reimplemented in KexiDBComboBox.

Definition at line 739 of file kexidbautofield.cpp.

◆ setPaletteForegroundColor()

void KexiDBAutoField::setPaletteForegroundColor ( const TQColor &  color)

Reimplemented to set internal editor's color.

Definition at line 728 of file kexidbautofield.cpp.

◆ setProperty()

bool KexiDBAutoField::setProperty ( const char *  name,
const TQVariant &  value 
)
virtual

Reimplemented to accept subproperties.

See also
KFormDesigner::WidgetWithSubpropertiesInterface

Definition at line 793 of file kexidbautofield.cpp.

◆ setReadOnly()

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.

◆ setValueInternal()

void KexiDBAutoField::setValueInternal ( const TQVariant &  add,
bool  removeOld 
)
protectedvirtual

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.

◆ setWidgetType()

void KexiDBAutoField::setWidgetType ( WidgetType  type)

Definition at line 124 of file kexidbautofield.cpp.

◆ sizeHint()

TQSize KexiDBAutoField::sizeHint ( ) const
virtual

Definition at line 653 of file kexidbautofield.cpp.

◆ unsetPalette

void KexiDBAutoField::unsetPalette ( )
virtualslot

Definition at line 715 of file kexidbautofield.cpp.

◆ updateInformationAboutUnboundField()

void KexiDBAutoField::updateInformationAboutUnboundField ( )
protected

Definition at line 680 of file kexidbautofield.cpp.

◆ value()

TQVariant KexiDBAutoField::value ( )
virtual
Returns
value currently represented by this item.

Implements KexiDataItemInterface.

Reimplemented in KexiDBComboBox.

Definition at line 338 of file kexidbautofield.cpp.

◆ valueChanged()

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.

◆ valueIsEmpty()

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.

◆ valueIsNull()

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.

◆ valueIsValid()

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.

◆ widgetType()

KexiDBAutoField::WidgetType KexiDBAutoField::widgetType ( ) const

Definition at line 392 of file kexidbautofield.cpp.

◆ widgetTypeForFieldType()

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

Definition at line 532 of file kexidbautofield.cpp.


The documentation for this class was generated from the following files: