kexi

#include <kexidbcombobox.h>

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

Public Slots

void slotRowAccepted (KexiTableItem *item, int row)
void slotItemSelected (KexiTableItem *item)
Public Slots inherited from KexiDBAutoField
virtual void unsetPalette ()

Public Member Functions

 KexiDBComboBox (TQWidget *parent, const char *name=0, bool designMode=true)
virtual KexiTableViewColumn * column () const
virtual KexiDB::Field * field () const
virtual TQVariant origValue () const
void setEditable (bool set)
bool isEditable () const
virtual void setLabelPosition (LabelPosition position)
virtual TQVariant value ()
virtual TQVariant visibleValue ()
virtual bool valueChanged ()
virtual TQSize sizeHint () const
virtual void setColumnInfo (KexiDB::QueryColumnInfo *cinfo)
virtual void setVisibleColumnInfo (KexiDB::QueryColumnInfo *cinfo)
virtual KexiDB::QueryColumnInfo * visibleColumnInfo () const
const TQColor & paletteBackgroundColor () const
virtual void setPaletteBackgroundColor (const TQColor &color)
virtual void undoChanges ()
Public Member Functions inherited from KexiDBAutoField
 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 setInvalidState (const TQString &text)
virtual bool isReadOnly () const
virtual void setReadOnly (bool readOnly)
virtual bool valueIsNull ()
virtual bool valueIsEmpty ()
virtual bool valueIsValid ()
virtual void clear ()
virtual void installListener (KexiDataItemChangesListener *listener)
WidgetType widgetType () const
void setWidgetType (WidgetType type)
LabelPosition labelPosition () const
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 void setFocusPolicy (TQWidget::FocusPolicy policy)
const TQColor & paletteForegroundColor () const
void setPaletteForegroundColor (const TQColor &color)
const TQColor & paletteBackgroundColor () const
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)
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::QueryColumnInfo * columnInfo () const
virtual void hideWidget ()
virtual void showWidget ()
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 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)
Public Member Functions inherited from KexiComboBoxBase
virtual void clear ()
virtual tristate valueChangedInternal ()
virtual bool valueIsNull ()
virtual bool valueIsEmpty ()
virtual void hide ()
void createPopup (bool show)
void showPopup ()
virtual void slotRowAccepted (KexiTableItem *item, int row)
virtual void slotItemSelected (KexiTableItem *)
void slotInternalEditorValueChanged (const TQVariant &v)

Protected Slots

void slotInternalEditorValueChanged (const TQVariant &v)
Protected Slots inherited from KexiDBAutoField
virtual void paletteChange (const TQPalette &oldPal)
virtual void moveCursorToEnd ()
virtual void moveCursorToStart ()
virtual void selectAll ()

Protected Member Functions

TQRect buttonGeometry () const
virtual void paintEvent (TQPaintEvent *)
virtual void mousePressEvent (TQMouseEvent *e)
void mouseDoubleClickEvent (TQMouseEvent *e)
virtual bool eventFilter (TQObject *o, TQEvent *e)
TQRect editorGeometry () const
virtual void createEditor ()
virtual void styleChange (TQStyle &oldStyle)
virtual void fontChange (const TQFont &oldFont)
virtual bool subwidgetStretchRequired (KexiDBAutoField *autoField) const
virtual TQWidget * internalEditor () const
virtual void moveCursorToEndInInternalEditor ()
virtual void selectAllInInternalEditor ()
virtual void setValueInInternalEditor (const TQVariant &value)
virtual TQVariant valueFromInternalEditor ()
virtual void editRequested ()
virtual void acceptRequested ()
virtual TQPoint mapFromParentToGlobal (const TQPoint &pos) const
virtual int popupWidthHint () const
virtual void setValueInternal (const TQVariant &add, bool removeOld)
virtual void setVisibleValueInternal (const TQVariant &value)
bool handleMousePressEvent (TQMouseEvent *e)
bool handleKeyPressEvent (TQKeyEvent *ke)
virtual void beforeSignalValueChanged ()
virtual KexiComboBoxPopup * popup () const
virtual void setPopup (KexiComboBoxPopup *popup)
virtual bool keyPressed (TQKeyEvent *ke)
Protected Member Functions inherited from KexiDBAutoField
void init (const TQString &text, WidgetType type, LabelPosition pos)
void changeText (const TQString &text, bool beautify=true)
void updateInformationAboutUnboundField ()
void copyPropertiesToEditor ()
void setLabelPositionInternal (LabelPosition position, bool noLabel)
void setColumnInfoInternal (KexiDB::QueryColumnInfo *cinfo, KexiDB::QueryColumnInfo *visibleColumnInfo)
Protected Member Functions inherited from KexiDataItemInterface
virtual void signalValueChanged ()
KexiDataItemChangesListener * listener ()
Protected Member Functions inherited from KFormDesigner::DesignTimeDynamicChildWidgetHandler
void childWidgetAdded (TQWidget *w)
void assignItem (ObjectTreeItem *item)
Protected Member Functions inherited from KexiComboBoxBase
KexiTableItem * selectItemForEnteredValueInLookupTable (const TQVariant &v)
TQString valueForString (const TQString &str, int *row, uint lookInColumn, uint returnFromColumn, bool allowNulls=false)
void setValueOrTextInInternalEditor (const TQVariant &value)
KexiDB::LookupFieldSchema * lookupFieldSchema () const
int rowToHighlightForLookupTable () const
virtual void updateButton ()
virtual TQVariant visibleValueForLookupField ()
void updateTextForHighlightedRow ()
bool handleKeyPressForPopup (TQKeyEvent *ke)
void acceptPopupSelection ()
void undoChanges ()

Protected Attributes

Private *const d
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
Protected Attributes inherited from KexiComboBoxBase
TQVariant m_visibleValue
TQVariant m_userEnteredValue
bool m_internalEditorValueChanged: 1
bool m_slotInternalEditorValueChanged_enabled: 1
bool m_setValueOrTextInInternalEditor_enabled: 1
bool m_mouseBtnPressedWhenPopupVisible: 1
bool m_insideCreatePopup: 1
bool m_updatePopupSelectionOnShow: 1
bool m_moveCursorToEndInInternalEditor_enabled: 1
bool m_selectAllInInternalEditor_enabled: 1
bool m_setValueInInternalEditor_enabled: 1
bool m_setVisibleValueOnSetValueInternal: 1

Additional Inherited Members

Public Types inherited from KexiDBAutoField
enum  WidgetType {
  Auto = 100 , Text , Integer , Double ,
  Boolean , Date , Time , DateTime ,
  MultiLineText , ComboBox , Image
}
enum  LabelPosition { Left = 300 , Top , NoLabel }
Static Public Member Functions inherited from KexiDBAutoField
static WidgetType widgetTypeForFieldType (KexiDB::Field::Type type)

Detailed Description

Combo box widget for Kexi forms.

This widget is implemented on top of KexiDBAutoField, so as it uses KexiDBAutoField's ability of embedding subwidgets, it can display not only a line edit but also text edit or image box (more can be added in the future). A drop-down button is added to mimic native combo box widget's functionality.

Definition at line 34 of file kexidbcombobox.h.

Constructor & Destructor Documentation

◆ KexiDBComboBox()

KexiDBComboBox::KexiDBComboBox ( TQWidget * parent,
const char * name = 0,
bool designMode = true )

Definition at line 75 of file kexidbcombobox.cpp.

◆ ~KexiDBComboBox()

KexiDBComboBox::~KexiDBComboBox ( )
virtual

Definition at line 89 of file kexidbcombobox.cpp.

Member Function Documentation

◆ acceptRequested()

void KexiDBComboBox::acceptRequested ( )
protectedvirtual

Implemented for KexiComboBoxBase.

Implements KexiComboBoxBase.

Definition at line 521 of file kexidbcombobox.cpp.

◆ beforeSignalValueChanged()

void KexiDBComboBox::beforeSignalValueChanged ( )
protectedvirtual

Implemented for KexiDataItemInterface.

Reimplemented from KexiDataItemInterface.

Definition at line 533 of file kexidbcombobox.cpp.

◆ buttonGeometry()

TQRect KexiDBComboBox::buttonGeometry ( ) const
protected

Definition at line 231 of file kexidbcombobox.cpp.

◆ column()

virtual KexiTableViewColumn * KexiDBComboBox::column ( ) const
inlinevirtual

Implemented for KexiComboBoxBase: form has no 'related data' model (only the full database model).

Implements KexiComboBoxBase.

Definition at line 51 of file kexidbcombobox.h.

◆ createEditor()

void KexiDBComboBox::createEditor ( )
protectedvirtual

Creates editor. Reimplemented, because if the combo box is not editable, editor should not be created.

Reimplemented from KexiDBAutoField.

Definition at line 182 of file kexidbcombobox.cpp.

◆ editorGeometry()

TQRect KexiDBComboBox::editorGeometry ( ) const
protected
Returns
internal editor's geometry

Definition at line 171 of file kexidbcombobox.cpp.

◆ editRequested()

void KexiDBComboBox::editRequested ( )
protectedvirtual

Implemented for KexiComboBoxBase.

Implements KexiComboBoxBase.

Definition at line 517 of file kexidbcombobox.cpp.

◆ eventFilter()

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

Reimplemented from KexiDBAutoField.

Definition at line 331 of file kexidbcombobox.cpp.

◆ field()

virtual KexiDB::Field * KexiDBComboBox::field ( ) const
inlinevirtual

Implemented for KexiComboBoxBase.

Reimplemented from KexiFormDataItemInterface.

Definition at line 54 of file kexidbcombobox.h.

◆ fontChange()

void KexiDBComboBox::fontChange ( const TQFont & oldFont)
protectedvirtual

Reimplemented

Definition at line 490 of file kexidbcombobox.cpp.

◆ handleKeyPressEvent()

bool KexiDBComboBox::handleKeyPressEvent ( TQKeyEvent * ke)
protected

Definition at line 270 of file kexidbcombobox.cpp.

◆ handleMousePressEvent()

bool KexiDBComboBox::handleMousePressEvent ( TQMouseEvent * e)
protected

Definition at line 240 of file kexidbcombobox.cpp.

◆ internalEditor()

virtual TQWidget * KexiDBComboBox::internalEditor ( ) const
inlineprotectedvirtual

Implemented for KexiComboBoxBase.

Implements KexiComboBoxBase.

Definition at line 130 of file kexidbcombobox.h.

◆ isEditable()

bool KexiDBComboBox::isEditable ( ) const

Definition at line 119 of file kexidbcombobox.cpp.

◆ keyPressed()

bool KexiDBComboBox::keyPressed ( TQKeyEvent * ke)
protectedvirtual

Called by top-level form on key press event. Used for Key_Escape to if the popup is visible, so the key press won't be consumed to perform "cancel editing". Also used for grabbing page down/up keys.

Reimplemented from KexiDBAutoField.

Definition at line 298 of file kexidbcombobox.cpp.

◆ mapFromParentToGlobal()

TQPoint KexiDBComboBox::mapFromParentToGlobal ( const TQPoint & pos) const
protectedvirtual

Implement this to return a position pos mapped from parent (e.g. viewport) to global coordinates. TQPoint(-1, -1) should be returned if this cannot be computed.

Implements KexiComboBoxBase.

Definition at line 476 of file kexidbcombobox.cpp.

◆ mouseDoubleClickEvent()

void KexiDBComboBox::mouseDoubleClickEvent ( TQMouseEvent * e)
protected

Definition at line 326 of file kexidbcombobox.cpp.

◆ mousePressEvent()

void KexiDBComboBox::mousePressEvent ( TQMouseEvent * e)
protectedvirtual

Definition at line 315 of file kexidbcombobox.cpp.

◆ moveCursorToEndInInternalEditor()

void KexiDBComboBox::moveCursorToEndInInternalEditor ( )
protectedvirtual

Implemented for KexiComboBoxBase. Does nothing if the widget is not editable.

Implements KexiComboBoxBase.

Definition at line 429 of file kexidbcombobox.cpp.

◆ origValue()

virtual TQVariant KexiDBComboBox::origValue ( ) const
inlinevirtual

Implemented for KexiComboBoxBase.

Implements KexiComboBoxBase.

Definition at line 57 of file kexidbcombobox.h.

◆ paintEvent()

void KexiDBComboBox::paintEvent ( TQPaintEvent * )
protectedvirtual
Todo
support reverse layout

Definition at line 124 of file kexidbcombobox.cpp.

◆ paletteBackgroundColor()

const TQColor & KexiDBComboBox::paletteBackgroundColor ( ) const
inline

Definition at line 85 of file kexidbcombobox.h.

◆ popup()

KexiComboBoxPopup * KexiDBComboBox::popup ( ) const
protectedvirtual

Implements KexiComboBoxBase.

Definition at line 94 of file kexidbcombobox.cpp.

◆ popupWidthHint()

int KexiDBComboBox::popupWidthHint ( ) const
protectedvirtual

Implement this to return a hint for popup width.

Implements KexiComboBoxBase.

Definition at line 485 of file kexidbcombobox.cpp.

◆ selectAllInInternalEditor()

void KexiDBComboBox::selectAllInInternalEditor ( )
protectedvirtual

Implemented for KexiComboBoxBase. Does nothing if the widget is not editable.

Implements KexiComboBoxBase.

Definition at line 435 of file kexidbcombobox.cpp.

◆ setColumnInfo()

void KexiDBComboBox::setColumnInfo ( KexiDB::QueryColumnInfo * cinfo)
virtual

Reimplemented after KexiDBAutoField: jsut sets cinfo without initializing a subwidget. Initialization is performed by setVisibleColumnInfo().

Reimplemented from KexiDBAutoField.

Definition at line 412 of file kexidbcombobox.cpp.

◆ setEditable()

void KexiDBComboBox::setEditable ( bool set)

Definition at line 104 of file kexidbcombobox.cpp.

◆ setLabelPosition()

void KexiDBComboBox::setLabelPosition ( LabelPosition position)
virtual

Reimplemented from KexiDBAutoField.

Definition at line 210 of file kexidbcombobox.cpp.

◆ setPaletteBackgroundColor()

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

Reimplemented to also set 'this' widget's background color, not only subwidget's.

Reimplemented from KexiDBAutoField.

Definition at line 393 of file kexidbcombobox.cpp.

◆ setPopup()

void KexiDBComboBox::setPopup ( KexiComboBoxPopup * popup)
protectedvirtual

Implements KexiComboBoxBase.

Definition at line 99 of file kexidbcombobox.cpp.

◆ setValueInInternalEditor()

void KexiDBComboBox::setValueInInternalEditor ( const TQVariant & value)
protectedvirtual

Implemented for KexiComboBoxBase.

removeOld

Implements KexiComboBoxBase.

Definition at line 462 of file kexidbcombobox.cpp.

◆ setValueInternal()

void KexiDBComboBox::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.

Reimplemented from KexiDBAutoField.

Definition at line 441 of file kexidbcombobox.cpp.

◆ setVisibleColumnInfo()

void KexiDBComboBox::setVisibleColumnInfo ( KexiDB::QueryColumnInfo * cinfo)
virtual

Used internally to set visible database column information. Reimplemented: performs initialization of the subwidget.

Reimplemented from KexiFormDataItemInterface.

Definition at line 417 of file kexidbcombobox.cpp.

◆ setVisibleValueInternal()

void KexiDBComboBox::setVisibleValueInternal ( const TQVariant & value)
protectedvirtual

Implemented to handle visible value instead of index.

removeOld

Reimplemented from KexiDataItemInterface.

Definition at line 450 of file kexidbcombobox.cpp.

◆ sizeHint()

TQSize KexiDBComboBox::sizeHint ( ) const
virtual

Reimplemented from KexiDBAutoField.

Definition at line 504 of file kexidbcombobox.cpp.

◆ slotInternalEditorValueChanged

void KexiDBComboBox::slotInternalEditorValueChanged ( const TQVariant & v)
inlineprotectedslot

Definition at line 100 of file kexidbcombobox.h.

◆ slotItemSelected

void KexiDBComboBox::slotItemSelected ( KexiTableItem * item)
inlineslot

Definition at line 97 of file kexidbcombobox.h.

◆ slotRowAccepted

void KexiDBComboBox::slotRowAccepted ( KexiTableItem * item,
int row )
slot

Definition at line 526 of file kexidbcombobox.cpp.

◆ styleChange()

void KexiDBComboBox::styleChange ( TQStyle & oldStyle)
protectedvirtual

Reimplemented

Definition at line 496 of file kexidbcombobox.cpp.

◆ subwidgetStretchRequired()

bool KexiDBComboBox::subwidgetStretchRequired ( KexiDBAutoField * autoField) const
protectedvirtual

Definition at line 387 of file kexidbcombobox.cpp.

◆ undoChanges()

void KexiDBComboBox::undoChanges ( )
virtual

Undoes changes made to this item - just resets the widget to original value. Reimplemented after KexiFormDataItemInterface to also revert the visible value (i.e. text) to the original state.

Reimplemented from KexiFormDataItemInterface.

Definition at line 543 of file kexidbcombobox.cpp.

◆ value()

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

Reimplemented from KexiDBAutoField.

Definition at line 64 of file kexidbcombobox.h.

◆ valueChanged()

bool KexiDBComboBox::valueChanged ( )
virtual

Reimpemented because to avoid taking value from the internal editor (index is taken from the popup instead).

Reimplemented from KexiDBAutoField.

Definition at line 405 of file kexidbcombobox.cpp.

◆ valueFromInternalEditor()

TQVariant KexiDBComboBox::valueFromInternalEditor ( )
protectedvirtual

Implemented for KexiComboBoxBase.

Implements KexiComboBoxBase.

Definition at line 471 of file kexidbcombobox.cpp.

◆ visibleColumnInfo()

KexiDB::QueryColumnInfo * KexiDBComboBox::visibleColumnInfo ( ) const
virtual
Returns
visible database column information for this item. Reimplemented.

Reimplemented from KexiFormDataItemInterface.

Definition at line 424 of file kexidbcombobox.cpp.

◆ visibleValue()

TQVariant KexiDBComboBox::visibleValue ( )
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.

Reimplemented from KexiDataItemInterface.

Definition at line 457 of file kexidbcombobox.cpp.

Member Data Documentation

◆ d

Private* const KexiDBComboBox::d
protected

Definition at line 179 of file kexidbcombobox.h.


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