#include <kexitableedit.h>
Signals | |
| void | editRequested () |
| void | cancelRequested () |
| void | acceptRequested () |
Public Member Functions | |
| KexiTableEdit (KexiTableViewColumn &column, TQWidget *parent=0) | |
| virtual KexiDB::Field * | field () const |
| virtual KexiDB::QueryColumnInfo * | columnInfo () const |
| virtual void | setColumnInfo (KexiDB::QueryColumnInfo *) |
| KexiTableViewColumn * | column () const |
| KexiDB::Field * | displayedField () const |
| virtual void | resize (int w, int h) |
| virtual TQWidget * | widget () |
| virtual void | hideWidget () |
| virtual void | showWidget () |
| virtual void | paintFocusBorders (TQPainter *p, TQVariant &cal, int x, int y, int w, int h) |
| virtual void | setupContents (TQPainter *p, bool focused, const TQVariant &val, TQString &txt, int &align, int &x, int &y_offset, int &w, int &h) |
| bool | usesSelectedTextColor () const |
| virtual void | paintSelectionBackground (TQPainter *p, bool focused, const TQString &txt, int align, int x, int y_offset, int w, int h, const TQColor &fillColor, const TQFontMetrics &fm, bool readOnly, bool fullRowSelection) |
| int | leftMargin () const |
| int | rightMargin (bool focused) const |
| virtual bool | handleKeyPress (TQKeyEvent *ke, bool editorActive) |
| virtual bool | handleDoubleClick () |
| virtual void | handleCopyAction (const TQVariant &value, const TQVariant &visibleValue)=0 |
| virtual int | widthForValue (TQVariant &val, const TQFontMetrics &fm) |
| virtual TQSize | totalSize () |
| virtual bool | showToolTipIfNeeded (const TQVariant &value, const TQRect &rect, const TQFontMetrics &fm, bool focused) |
| virtual void | createInternalEditor (KexiDB::QuerySchema &schema) |
Public Member Functions inherited from KexiDataItemInterface | |
| void | setValue (const TQVariant &value, const TQVariant &add=TQVariant(), bool removeOld=false, const TQVariant *visibleValue=0) |
| virtual void | installListener (KexiDataItemChangesListener *listener) |
| virtual TQVariant | value ()=0 |
| virtual bool | valueIsValid () |
| virtual bool | valueIsNull ()=0 |
| virtual bool | valueIsEmpty ()=0 |
| virtual TQVariant | visibleValue () |
| virtual bool | isReadOnly () const |
| 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 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) |
Protected Member Functions | |
| virtual bool | eventFilter (TQObject *watched, TQEvent *e) |
| void | setViewWidget (TQWidget *v) |
| void | moveChild (TQWidget *child, int x, int y) |
| void | repaintRelatedCell () |
Protected Member Functions inherited from KexiDataItemInterface | |
| virtual void | setValueInternal (const TQVariant &add, bool removeOld)=0 |
| virtual void | setVisibleValueInternal (const TQVariant &value) |
| virtual void | signalValueChanged () |
| virtual void | beforeSignalValueChanged () |
| KexiDataItemChangesListener * | listener () |
Protected Attributes | |
| KexiTableViewColumn * | m_column |
| int | m_leftMargin |
| int | m_rightMargin |
| int | m_rightMarginWhenFocused |
| TQScrollView * | m_scrollView |
| bool | m_usesSelectedTextColor: 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 |
Detailed Description
Abstract class for a cell editor. Handles cell painting and displaying the editor widget.
Definition at line 39 of file kexitableedit.h.
Constructor & Destructor Documentation
◆ KexiTableEdit()
| KexiTableEdit::KexiTableEdit | ( | KexiTableViewColumn & | column, |
| TQWidget * | parent = 0 |
||
| ) |
Definition at line 33 of file kexitableedit.cpp.
◆ ~KexiTableEdit()
|
virtual |
Definition at line 74 of file kexitableedit.cpp.
Member Function Documentation
◆ column()
|
inline |
- Returns
- column information for this item (extended information, comparing to field()).
Definition at line 63 of file kexitableedit.h.
◆ columnInfo()
|
inlinevirtual |
A rich field information for db-aware data. For not-db-aware data it is always 0 (use field() instead.
Implements KexiDataItemInterface.
Definition at line 55 of file kexitableedit.h.
◆ createInternalEditor()
|
inlinevirtual |
Created internal editor for this editor is needed. This method is only implemented in KexiComboBoxTableEdit since it's visible value differs from internal value, so a different KexiTableEdit object is used to displaying the data.
Reimplemented in KexiComboBoxTableEdit.
Definition at line 173 of file kexitableedit.h.
◆ displayedField()
| KexiDB::Field * KexiTableEdit::displayedField | ( | ) | const |
- Returns
- displayed field. This is equal to field() in typical case but can return a different field definition if the column contains a lookup field. This distiction is especially used for displaying data dependent on the type and specifics of the field definition (e.g. text type versus integer type). Note that to compute the editor's value we still use field().
Definition at line 78 of file kexitableedit.cpp.
◆ eventFilter()
|
protectedvirtual |
Definition at line 112 of file kexitableedit.cpp.
◆ field()
|
inlinevirtual |
Implemented for KexiDataItemInterface.
- Returns
- field information for this item
Implements KexiDataItemInterface.
Reimplemented in KexiComboBoxTableEdit.
Definition at line 51 of file kexitableedit.h.
◆ handleCopyAction()
|
pure virtual |
Handles copy action for value. The value is copied to clipboard in format appropriate for the editor's impementation, e.g. for image cell it can be a pixmap. For a special case (combo box), visibleValue can be provided, so it can be copied to the clipboard instead of unreadable value. For reimplementation.
Implemented in KexiTDEIconTableEdit, KexiBoolTableEdit, KexiComboBoxTableEdit, KexiDateTableEdit, KexiDateTimeTableEdit, KexiInputTableEdit, and KexiTimeTableEdit.
◆ handleDoubleClick()
|
inlinevirtual |
Handles double click request coming from the table view.
- Returns
- true if it has been consumed. Reimplemented in KexiBlobTableEdit (to execute "insert file" action.
Definition at line 143 of file kexitableedit.h.
◆ handleKeyPress()
|
inlinevirtual |
Handles ke key event that came over the column that is bound to this editor. For implementation: true should be returned if ke should be accepted. If editorActive is true, this editor is currently active, i.e. the table view is in edit mode. By default false is returned.
Reimplemented in KexiComboBoxTableEdit.
Definition at line 137 of file kexitableedit.h.
◆ hideWidget()
|
inlinevirtual |
Hides item's widget, if available.
Reimplemented from KexiDataItemInterface.
Definition at line 79 of file kexitableedit.h.
◆ leftMargin()
|
inline |
Sometimes, editor can contain non-standard margin, for example combobox editor contains dropdown button at the right side.
- Returns
- left margin's size; 0 by default. For reimplementation.
Definition at line 126 of file kexitableedit.h.
◆ moveChild()
|
protected |
Moves child widget within the viewport if the parent is scrollview (otherwise does nothing). Use this for child widgets that are outside of this editor widget, instead of calling TQWidget::move().
Definition at line 94 of file kexitableedit.cpp.
◆ paintFocusBorders()
|
virtual |
Paints a border for the cell described by x, y, w, h on p painter. The cell's value is val (may be useful if you want to reimplement this method).
Reimplemented in KexiComboBoxTableEdit.
Definition at line 143 of file kexitableedit.cpp.
◆ paintSelectionBackground()
|
virtual |
For reimplementation. Paints selection's background using p. Most parameters are similar to these from setupContents().
Definition at line 188 of file kexitableedit.cpp.
◆ repaintRelatedCell()
|
protected |
Allows to force redrawing the related cell by the editor itself. Usable when the editor is not displayed by a TQWidget but rather by table view cell itself, for example KexiBlobTableEdit.
Definition at line 216 of file kexitableedit.cpp.
◆ resize()
|
virtual |
Reimplemented: resizes a view().
Reimplemented in KexiComboBoxTableEdit.
Definition at line 100 of file kexitableedit.cpp.
◆ rightMargin()
| int KexiTableEdit::rightMargin | ( | bool | focused | ) | const |
Sometimes, editor can contain non-standard margin, for example combobox editor contains dropdown button at the right side. THe dropdown button's width is counted only if focused is true.
- Returns
- right margin's size; 0 by default. For reimplementation.
Definition at line 232 of file kexitableedit.cpp.
◆ setColumnInfo()
|
inlinevirtual |
Implemented for KexiDataItemInterface.
Does nothing because instead KexiTableViewColumn is used to get field's schema.
Implements KexiDataItemInterface.
Definition at line 59 of file kexitableedit.h.
◆ setupContents()
|
virtual |
For reimplementation. Sets up and paints cell's contents using context of val value. focused is true if the cell is focused. align is set using TQt::AlignmentFlags. Some additional things may be painted using p, but it is not needed to paint the text (this is done automatically outside of this method).
Before calling, x, y_offset, w, h parameters are initialized, but you can tune these values depending on the context. You should set txt to a text representation of val, otherwise no text will be painted.
p can be 0 - in this case no painting should be performed, becasue caller only expects that x, y_offset, w, h, txt parameters are tuned, if needed. p painter's pen is set to foreground color (usually black) that should be used to paint foreground information, if needed. For example boolean editor widget paints a rectangle using this color.
- Todo:
- ADD OPTION to displaying NULL VALUES as e.g. "(null)"
Reimplemented in KexiTDEIconTableEdit, KexiBoolTableEdit, KexiComboBoxTableEdit, KexiDateTableEdit, KexiDateTimeTableEdit, and KexiTimeTableEdit.
Definition at line 148 of file kexitableedit.cpp.
◆ setViewWidget()
|
protected |
Sets v as view widget for this editor. The view will be assigned as focus proxy for the editor, its events will be filtered, it will be resized when neede, and so on.
Definition at line 86 of file kexitableedit.cpp.
◆ showToolTipIfNeeded()
|
virtual |
Shows a special tooltip for value if needed, i.e. if the value could not fit inside rect for a given font metrics fm.
- Returns
- true a normal tooltip should be displayed (using TQToolTip,) and false if no tooltip should be displayed or a custom tooltip was displayed internally (not yet supported). Default implementation does nothing and returns false. If the cell is currentl focused (selected), focused is true.
Reimplemented in KexiInputTableEdit.
Definition at line 222 of file kexitableedit.cpp.
◆ showWidget()
|
inlinevirtual |
Shows item's widget, if available.
Reimplemented from KexiDataItemInterface.
Definition at line 82 of file kexitableedit.h.
◆ totalSize()
|
inlinevirtual |
- Returns
- total size of this editor, including any buttons, etc. (if present). Reimpelment this if you want to return more appropriate size. This impelmentation just returns TQWidget::size().
Reimplemented in KexiInputTableEdit.
Definition at line 159 of file kexitableedit.h.
◆ usesSelectedTextColor()
|
inline |
- Returns
- true if "selected text" color should be used to paint contents of the editor. True by default. It's false e.g. in boolean editor, where no selection is painted using paintSelectionBackground(). This flag is set in editor's constructor and checked in KexiTableView::paintCell(). Depending on it, appropriate ("text" or "selected text" color is set for painter) before setupContents() is called.
Definition at line 114 of file kexitableedit.h.
◆ widget()
|
inlinevirtual |
- Returns
- the view widget of this editor, e.g. line edit widget.
Implements KexiDataItemInterface.
Definition at line 76 of file kexitableedit.h.
◆ widthForValue()
|
virtual |
- Returns
- width of value. For the default implementation val is converted to a string and width of this string is returned.
Reimplemented in KexiBoolTableEdit, and KexiComboBoxTableEdit.
Definition at line 211 of file kexitableedit.cpp.
Member Data Documentation
◆ m_column
|
protected |
Definition at line 195 of file kexitableedit.h.
◆ m_leftMargin
|
protected |
Definition at line 196 of file kexitableedit.h.
◆ m_rightMargin
|
protected |
Definition at line 197 of file kexitableedit.h.
◆ m_rightMarginWhenFocused
|
protected |
Definition at line 197 of file kexitableedit.h.
◆ m_scrollView
|
protected |
may be 0 if the parent is not a scrollview
Definition at line 198 of file kexitableedit.h.
◆ m_usesSelectedTextColor
|
protected |
The documentation for this class was generated from the following files:

Public Member Functions inherited from