Kexi API Documentation (2.0 alpha)

KexiDBComboBox Class Reference

#include <kexidbcombobox.h>

Inheritance diagram for KexiDBComboBox:

KexiDBAutoField KexiComboBoxBase QWidget KexiFormDataItemInterface KFormDesigner::DesignTimeDynamicChildWidgetHandler KFormDesigner::WidgetWithSubpropertiesInterface KexiDataItemInterface List of all members.

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.

Public Slots

void slotRowAccepted (KexiTableItem *item, int row)
 Call this from slot.
void slotItemSelected (KexiTableItem *item)
 Call this from slot.

Public Member Functions

 KexiDBComboBox (QWidget *parent, const char *name=0, bool designMode=true)
virtual ~KexiDBComboBox ()
virtual KexiTableViewColumncolumn () const
 Implemented for KexiComboBoxBase: form has no 'related data' model (only the full database model).
virtual KexiDB::Fieldfield () const
 Implemented for KexiComboBoxBase.
virtual QVariant origValue () const
 Implemented for KexiComboBoxBase.
void setEditable (bool set)
bool isEditable () const
virtual void setLabelPosition (LabelPosition position)
virtual QVariant value ()
virtual QVariant visibleValue ()
virtual bool valueChanged ()
 Reimpemented because to avoid taking value from the internal editor (index is taken from the popup instead).
virtual QSize sizeHint () const
virtual void setColumnInfo (KexiDB::QueryColumnInfo *cinfo)
 Reimplemented after KexiDBAutoField: jsut sets cinfo without initializing a subwidget.
virtual void setVisibleColumnInfo (KexiDB::QueryColumnInfo *cinfo)
virtual KexiDB::QueryColumnInfovisibleColumnInfo () const
const QColor & paletteBackgroundColor () const
 Reimplemented to return internal editor's color.
virtual void setPaletteBackgroundColor (const QColor &color)
 Reimplemented to also set 'this' widget's background color, not only subwidget's.
virtual void undoChanges ()

Protected Slots

void slotInternalEditorValueChanged (const QVariant &v)
 Call this from slot.

Protected Member Functions

QRect buttonGeometry () const
virtual void paintEvent (QPaintEvent *)
virtual void mousePressEvent (QMouseEvent *e)
void mouseDoubleClickEvent (QMouseEvent *e)
virtual bool eventFilter (QObject *o, QEvent *e)
QRect editorGeometry () const
virtual void createEditor ()
 Creates editor.
virtual void styleChange (QStyle &oldStyle)
virtual void fontChange (const QFont &oldFont)
virtual bool subwidgetStretchRequired (KexiDBAutoField *autoField) const
virtual QWidgetinternalEditor () const
 Implemented for KexiComboBoxBase.
virtual void moveCursorToEndInInternalEditor ()
 Implemented for KexiComboBoxBase. Does nothing if the widget is not editable.
virtual void selectAllInInternalEditor ()
 Implemented for KexiComboBoxBase. Does nothing if the widget is not editable.
virtual void setValueInInternalEditor (const QVariant &value)
 Implemented for KexiComboBoxBase.
virtual QVariant valueFromInternalEditor ()
 Implemented for KexiComboBoxBase.
virtual void editRequested ()
 Implemented for KexiComboBoxBase.
virtual void acceptRequested ()
 Implemented for KexiComboBoxBase.
virtual QPoint mapFromParentToGlobal (const QPoint &pos) const
 Implement this to return a position pos mapped from parent (e.g.
virtual int popupWidthHint () const
 Implement this to return a hint for popup width.
virtual void setValueInternal (const QVariant &add, bool removeOld)
virtual void setVisibleValueInternal (const QVariant &value)
 Implemented to handle visible value instead of index.
bool handleMousePressEvent (QMouseEvent *e)
bool handleKeyPressEvent (QKeyEvent *ke)
virtual void beforeSignalValueChanged ()
 Implemented for KexiDataItemInterface.
virtual KexiComboBoxPopuppopup () const
virtual void setPopup (KexiComboBoxPopup *popup)
virtual bool keyPressed (QKeyEvent *ke)

Protected Attributes

Private *const d

Properties

bool editable


Constructor & Destructor Documentation

KexiDBComboBox::KexiDBComboBox QWidget parent,
const char *  name = 0,
bool  designMode = true
 

Definition at line 74 of file kexidbcombobox.cpp.

References d, and KexiDBAutoField::setFocusPolicy().

KexiDBComboBox::~KexiDBComboBox  )  [virtual]
 

Definition at line 87 of file kexidbcombobox.cpp.

References d.


Member Function Documentation

void KexiDBComboBox::acceptRequested  )  [protected, virtual]
 

Implemented for KexiComboBoxBase.

Implements KexiComboBoxBase.

Definition at line 509 of file kexidbcombobox.cpp.

References KexiDataItemInterface::signalValueChanged().

void KexiDBComboBox::beforeSignalValueChanged  )  [protected, virtual]
 

Implemented for KexiDataItemInterface.

Reimplemented from KexiDataItemInterface.

Definition at line 521 of file kexidbcombobox.cpp.

References d, KFormDesigner::WidgetWithSubpropertiesInterface::m_subwidget, slotInternalEditorValueChanged(), and KexiDataItemInterface::value().

QRect KexiDBComboBox::buttonGeometry  )  const [protected]
 

Definition at line 230 of file kexidbcombobox.cpp.

References d.

Referenced by eventFilter(), and handleMousePressEvent().

virtual KexiTableViewColumn* KexiDBComboBox::column  )  const [inline, virtual]
 

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

Implements KexiComboBoxBase.

Definition at line 50 of file kexidbcombobox.h.

void KexiDBComboBox::createEditor  )  [protected, virtual]
 

Creates editor.

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

Reimplemented from KexiDBAutoField.

Definition at line 180 of file kexidbcombobox.cpp.

References KexiDBAutoField::createEditor(), d, editorGeometry(), and KFormDesigner::WidgetWithSubpropertiesInterface::m_subwidget.

Referenced by setEditable().

QRect KexiDBComboBox::editorGeometry  )  const [protected]
 

Returns:
internal editor's geometry

Definition at line 169 of file kexidbcombobox.cpp.

References d.

Referenced by createEditor(), eventFilter(), paintEvent(), setLabelPosition(), and styleChange().

void KexiDBComboBox::editRequested  )  [protected, virtual]
 

Implemented for KexiComboBoxBase.

Implements KexiComboBoxBase.

Definition at line 505 of file kexidbcombobox.cpp.

bool KexiDBComboBox::eventFilter QObject *  o,
QEvent *  e
[protected, virtual]
 

Reimplemented from KexiDBAutoField.

Definition at line 328 of file kexidbcombobox.cpp.

References buttonGeometry(), d, editorGeometry(), KexiDBAutoField::eventFilter(), handleKeyPressEvent(), handleMousePressEvent(), KFormDesigner::WidgetWithSubpropertiesInterface::m_subwidget, and size.

virtual KexiDB::Field* KexiDBComboBox::field  )  const [inline, virtual]
 

Implemented for KexiComboBoxBase.

Implements KexiComboBoxBase.

Definition at line 53 of file kexidbcombobox.h.

References KexiFormDataItemInterface::field().

void KexiDBComboBox::fontChange const QFont &  oldFont  )  [protected, virtual]
 

Reimplemented

Definition at line 478 of file kexidbcombobox.cpp.

References d.

bool KexiDBComboBox::handleKeyPressEvent QKeyEvent *  ke  )  [protected]
 

Definition at line 269 of file kexidbcombobox.cpp.

References KexiComboBoxBase::acceptPopupSelection(), d, KexiComboBoxBase::handleKeyPressForPopup(), popup(), and KexiComboBoxBase::showPopup().

Referenced by eventFilter().

bool KexiDBComboBox::handleMousePressEvent QMouseEvent *  e  )  [protected]
 

Definition at line 239 of file kexidbcombobox.cpp.

References buttonGeometry(), d, isEditable(), and KexiComboBoxBase::showPopup().

Referenced by eventFilter(), and mousePressEvent().

virtual QWidget* KexiDBComboBox::internalEditor  )  const [inline, protected, virtual]
 

Implemented for KexiComboBoxBase.

Implements KexiComboBoxBase.

Definition at line 129 of file kexidbcombobox.h.

bool KexiDBComboBox::isEditable  )  const
 

Definition at line 117 of file kexidbcombobox.cpp.

References d.

Referenced by handleMousePressEvent().

bool KexiDBComboBox::keyPressed QKeyEvent *  ke  )  [protected, virtual]
 

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".

Reimplemented from KexiDBAutoField.

Definition at line 297 of file kexidbcombobox.cpp.

References KexiDBAutoField::keyPressed(), and popup().

QPoint KexiDBComboBox::mapFromParentToGlobal const QPoint &  pos  )  const [protected, virtual]
 

Implement this to return a position pos mapped from parent (e.g.

viewport) to global coordinates. QPoint(-1, -1) should be returned if this cannot be computed.

Implements KexiComboBoxBase.

Definition at line 465 of file kexidbcombobox.cpp.

void KexiDBComboBox::mouseDoubleClickEvent QMouseEvent *  e  )  [protected]
 

Definition at line 323 of file kexidbcombobox.cpp.

References mousePressEvent().

void KexiDBComboBox::mousePressEvent QMouseEvent *  e  )  [protected, virtual]
 

Definition at line 312 of file kexidbcombobox.cpp.

References handleMousePressEvent().

Referenced by mouseDoubleClickEvent().

void KexiDBComboBox::moveCursorToEndInInternalEditor  )  [protected, virtual]
 

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

Implements KexiComboBoxBase.

Definition at line 420 of file kexidbcombobox.cpp.

References d, KexiComboBoxBase::m_moveCursorToEndInInternalEditor_enabled, and KexiDBAutoField::moveCursorToEnd().

virtual QVariant KexiDBComboBox::origValue  )  const [inline, virtual]
 

Implemented for KexiComboBoxBase.

Implements KexiComboBoxBase.

Definition at line 56 of file kexidbcombobox.h.

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

Todo:
support reverse layout

Definition at line 122 of file kexidbcombobox.cpp.

References d, editorGeometry(), and paletteBackgroundColor().

const QColor& KexiDBComboBox::paletteBackgroundColor  )  const [inline]
 

Reimplemented to return internal editor's color.

Reimplemented from KexiDBAutoField.

Definition at line 84 of file kexidbcombobox.h.

References KexiDBAutoField::paletteBackgroundColor().

Referenced by paintEvent().

KexiComboBoxPopup * KexiDBComboBox::popup  )  const [protected, virtual]
 

Implements KexiComboBoxBase.

Definition at line 92 of file kexidbcombobox.cpp.

References d.

Referenced by handleKeyPressEvent(), and keyPressed().

int KexiDBComboBox::popupWidthHint  )  const [protected, virtual]
 

Implement this to return a hint for popup width.

Implements KexiComboBoxBase.

Definition at line 473 of file kexidbcombobox.cpp.

void KexiDBComboBox::selectAllInInternalEditor  )  [protected, virtual]
 

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

Implements KexiComboBoxBase.

Definition at line 426 of file kexidbcombobox.cpp.

References d, KexiComboBoxBase::m_selectAllInInternalEditor_enabled, and KexiDBAutoField::selectAll().

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 403 of file kexidbcombobox.cpp.

References KexiFormDataItemInterface::setColumnInfo().

void KexiDBComboBox::setEditable bool  set  ) 
 

Definition at line 102 of file kexidbcombobox.cpp.

References createEditor(), d, and KFormDesigner::WidgetWithSubpropertiesInterface::m_subwidget.

void KexiDBComboBox::setLabelPosition LabelPosition  position  )  [virtual]
 

Todo:
support right-to-left layout where positions are inverted

Reimplemented from KexiDBAutoField.

Definition at line 209 of file kexidbcombobox.cpp.

References editorGeometry(), KexiDBAutoField::Left, and KFormDesigner::WidgetWithSubpropertiesInterface::m_subwidget.

void KexiDBComboBox::setPaletteBackgroundColor const QColor &  color  )  [virtual]
 

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

Reimplemented from KexiDBAutoField.

Definition at line 384 of file kexidbcombobox.cpp.

References KexiDBAutoField::setPaletteBackgroundColor().

void KexiDBComboBox::setPopup KexiComboBoxPopup popup  )  [protected, virtual]
 

Implements KexiComboBoxBase.

Definition at line 97 of file kexidbcombobox.cpp.

References d.

void KexiDBComboBox::setValueInInternalEditor const QVariant &  value  )  [protected, virtual]
 

Implemented for KexiComboBoxBase.

removeOld

Implements KexiComboBoxBase.

Definition at line 451 of file kexidbcombobox.cpp.

References KexiComboBoxBase::m_setValueInInternalEditor_enabled, KFormDesigner::WidgetWithSubpropertiesInterface::m_subwidget, and KexiDataItemInterface::setValue().

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

Reimplemented from KexiDBAutoField.

Definition at line 432 of file kexidbcombobox.cpp.

References KexiComboBoxBase::setValueInternal().

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 408 of file kexidbcombobox.cpp.

References KexiFormDataItemInterface::columnInfo(), d, and KexiDBAutoField::setColumnInfoInternal().

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

Implemented to handle visible value instead of index.

removeOld

Reimplemented from KexiDataItemInterface.

Definition at line 439 of file kexidbcombobox.cpp.

References KFormDesigner::WidgetWithSubpropertiesInterface::m_subwidget, and KexiDataItemInterface::setValue().

QSize KexiDBComboBox::sizeHint  )  const [virtual]
 

Reimplemented from KexiDBAutoField.

Definition at line 492 of file kexidbcombobox.cpp.

References d.

void KexiDBComboBox::slotInternalEditorValueChanged const QVariant &  v  )  [inline, protected, slot]
 

Call this from slot.

Reimplemented from KexiComboBoxBase.

Definition at line 99 of file kexidbcombobox.h.

References KexiComboBoxBase::slotInternalEditorValueChanged().

Referenced by beforeSignalValueChanged().

void KexiDBComboBox::slotItemSelected KexiTableItem item  )  [inline, virtual, slot]
 

Call this from slot.

Reimplemented from KexiComboBoxBase.

Definition at line 96 of file kexidbcombobox.h.

References KexiComboBoxBase::slotItemSelected().

void KexiDBComboBox::slotRowAccepted KexiTableItem item,
int  row
[virtual, slot]
 

Call this from slot.

Reimplemented from KexiComboBoxBase.

Definition at line 514 of file kexidbcombobox.cpp.

References d, and KexiComboBoxBase::slotRowAccepted().

void KexiDBComboBox::styleChange QStyle oldStyle  )  [protected, virtual]
 

Reimplemented

Definition at line 484 of file kexidbcombobox.cpp.

References d, editorGeometry(), and KFormDesigner::WidgetWithSubpropertiesInterface::m_subwidget.

bool KexiDBComboBox::subwidgetStretchRequired KexiDBAutoField autoField  )  const [protected, virtual]
 

Definition at line 378 of file kexidbcombobox.cpp.

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 KexiComboBoxBase.

Definition at line 531 of file kexidbcombobox.cpp.

References KexiComboBoxBase::undoChanges(), and KexiFormDataItemInterface::undoChanges().

virtual QVariant KexiDBComboBox::value  )  [inline, virtual]
 

Returns:
value currently represented by this item.

Reimplemented from KexiDBAutoField.

Definition at line 63 of file kexidbcombobox.h.

References KexiComboBoxBase::value().

Referenced by 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 396 of file kexidbcombobox.cpp.

References KexiDataItemInterface::m_origValue, and value().

QVariant KexiDBComboBox::valueFromInternalEditor  )  [protected, virtual]
 

Implemented for KexiComboBoxBase.

Implements KexiComboBoxBase.

Definition at line 460 of file kexidbcombobox.cpp.

References KexiDBAutoField::value().

KexiDB::QueryColumnInfo * KexiDBComboBox::visibleColumnInfo  )  const [virtual]
 

Returns:
visible database column information for this item. Reimplemented.

Reimplemented from KexiFormDataItemInterface.

Definition at line 415 of file kexidbcombobox.cpp.

References d.

QVariant KexiDBComboBox::visibleValue  )  [virtual]
 

Reimplemented from KexiComboBoxBase.

Definition at line 446 of file kexidbcombobox.cpp.

References KexiComboBoxBase::visibleValue().


Member Data Documentation

Private* const KexiDBComboBox::d [protected]
 

Reimplemented from KexiDBAutoField.

Definition at line 176 of file kexidbcombobox.h.

Referenced by beforeSignalValueChanged(), buttonGeometry(), createEditor(), editorGeometry(), eventFilter(), fontChange(), handleKeyPressEvent(), handleMousePressEvent(), isEditable(), KexiDBComboBox(), moveCursorToEndInInternalEditor(), paintEvent(), popup(), selectAllInInternalEditor(), setEditable(), setPopup(), setVisibleColumnInfo(), sizeHint(), slotRowAccepted(), styleChange(), visibleColumnInfo(), and ~KexiDBComboBox().


Property Documentation

bool KexiDBComboBox::editable [read, write]
 

Definition at line 38 of file kexidbcombobox.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:49:49 2008 by doxygen 1.4.2 written by Dimitri van Heesch, © 1997-2003