kexi

KexiDataAwareObjectInterface Class Reference

#include <kexidataawareobjectiface.h>

Inheritance diagram for KexiDataAwareObjectInterface:

KexiFormScrollView KexiTableView KexiDataTableView List of all members.

Detailed Description

This interface is implemented by KexiTableView and KexiFormView and used by KexiDataAwareView.

If yu're implementing this interface, add KEXI_DATAAWAREOBJECTINTERFACE convenience macro just after Q_OBJECT.

You should add following code to your destructor so data is deleted:

    if (m_owner)
        delete m_data;
    m_data = 0;
This is not performed in KexiDataAwareObjectInterface because you may need to access m_data in your desctructor.

Definition at line 67 of file kexidataawareobjectiface.h.


Public Types

enum  DeletionPolicy { NoDelete = 0, AskDelete = 1, ImmediateDelete = 2, SignalDelete = 3 }

Public Member Functions

 KexiDataAwareObjectInterface ()
virtual ~KexiDataAwareObjectInterface ()
void setData (KexiTableViewData *data, bool owner=true)
KexiTableViewDatadata () const
int currentColumn () const
int currentRow () const
virtual int lastVisibleRow () const=0
KexiTableItemselectedItem () const
int rows () const
virtual int columns () const
int dataColumns () const
virtual bool isReadOnly () const
void setReadOnly (bool set)
bool isSortingEnabled () const
virtual void setSorting (int col, bool ascending=true)
virtual void setSortingEnabled (bool set)
int dataSortedColumn () const
int dataSortingOrder () const
virtual bool sort ()
void sortAscending ()
void sortDescending ()
virtual bool isInsertingEnabled () const
void setInsertingEnabled (bool set)
bool isDeleteEnabled () const
bool isEmptyRowInsertingEnabled () const
void setEmptyRowInsertingEnabled (bool set)
virtual void setFilteringEnabled (bool set)
bool isFilteringEnabled () const
virtual void setSpreadSheetMode ()
bool spreadSheetMode () const
bool rowEditing () const
DeletionPolicy deletionPolicy () const
virtual void setDeletionPolicy (DeletionPolicy policy)
virtual void deleteCurrentRow ()
virtual KexiTableIteminsertEmptyRow (int row=-1)
virtual bool beforeDeleteItem (KexiTableItem *item)
bool deleteItem (KexiTableItem *item)
void insertItem (KexiTableItem *newItem, int row=-1)
tristate deleteAllRows (bool ask=false, bool repaint=true)
virtual int rowsPerPage () const=0
virtual void selectRow (int row)
virtual void selectNextRow ()
virtual void selectPrevRow ()
virtual void selectNextPage ()
virtual void selectPrevPage ()
virtual void selectFirstRow ()
virtual void selectLastRow ()
virtual void clearSelection ()
virtual void setCursorPosition (int row, int col=-1, bool forceSet=false)
virtual void ensureCellVisible (int row, int col)=0
virtual void setAcceptsRowEditAfterCellAccepting (bool set)
bool acceptsRowEditAfterCellAccepting () const
bool dropsAtRowEnabled () const
virtual void setDropsAtRowEnabled (bool set)
KexiDataItemInterfaceeditor () const
virtual bool cancelRowEdit ()
virtual bool acceptRowEdit ()
virtual void removeEditor ()
virtual bool cancelEditor ()
virtual bool acceptEditor ()
virtual void createEditor (int row, int col, const QString &addText=QString::null, bool removeOld=false)=0
virtual void startEditCurrentCell (const QString &setText=QString::null)
virtual void deleteAndStartEditCurrentCell ()
KexiTableItemitemAt (int row) const
virtual KexiTableViewColumncolumn (int col)
virtual int fieldNumberForColumn (int col)
bool hasDefaultValueAt (const KexiTableViewColumn &tvcol)
const QVariant * bufferedValueAt (int col, bool useDefaultValueIfPossible=true)
int columnType (int col)
QVariant columnDefaultValue (int col) const
virtual bool columnEditable (int col)
virtual void updateCurrentCell ()=0
KexiRecordMarkerverticalHeader () const
virtual void itemChanged (KexiTableItem *, int row, int col)=0
virtual void itemChanged (KexiTableItem *, int row, int col, QVariant oldValue)=0
virtual void itemDeleteRequest (KexiTableItem *, int row, int col)=0
virtual void currentItemDeleteRequest ()=0
virtual void newItemAppendedForAfterDeletingInSpreadSheetMode ()=0
virtual void dataRefreshed ()=0
virtual void dataSet (KexiTableViewData *data)=0
KPopupMenu * contextMenu () const
bool contextMenuEnabled () const
void setContextMenuEnabled (bool set)
bool scrollbarToolTipsEnabled () const
void setScrollbarToolTipsEnabled (bool set)
void startEditOrToggleValue ()
bool newRowEditing () const
virtual void boolToggled ()
virtual void connectCellSelectedSignal (const QObject *receiver, const char *intIntMember)=0
virtual void connectRowEditStartedSignal (const QObject *receiver, const char *intMember)=0
virtual void connectRowEditTerminatedSignal (const QObject *receiver, const char *voidMember)=0
virtual void connectReloadActionsSignal (const QObject *receiver, const char *voidMember)=0
virtual void connectDataSetSignal (const QObject *receiver, const char *kexiTableViewDataMember)=0
virtual void connectToReloadDataSlot (const QObject *sender, const char *voidSignal)=0
virtual void slotDataDestroying ()
virtual void copySelection ()=0
virtual void cutSelection ()=0
virtual void paste ()=0
virtual QScrollBar * verticalScrollBar () const=0
virtual bool handleKeyPress (QKeyEvent *e, int &curRow, int &curCol, bool fullRowSelection, bool *moveToFirstField=0, bool *moveToLastField=0)

Protected Member Functions

virtual void initDataContents ()
virtual void clearColumns (bool repaint=true)
virtual void clearColumnsInternal (bool repaint)=0
virtual void addHeaderColumn (const QString &caption, const QString &description, const QIconSet &icon, int size)=0
virtual int currentLocalSortingOrder () const=0
virtual int currentLocalSortColumn () const=0
virtual void setLocalSortingOrder (int col, int order)=0
virtual void sortColumnInternal (int col, int order=0)
virtual void updateGUIAfterSorting ()=0
virtual void reloadActions ()=0
virtual void reloadData ()
virtual void itemSelected (KexiTableItem *)=0
virtual void cellSelected (int col, int row)=0
virtual void sortedColumnChanged (int col)=0
virtual void rowEditTerminated (int row)=0
virtual void clearVariables ()
virtual KexiDataItemInterfaceeditor (int col, bool ignoreMissingEditor=false)=0
virtual void editorShowFocus (int row, int col)=0
virtual void updateCell (int row, int col)=0
virtual void updateRow (int row)=0
virtual void updateWidgetContents ()=0
virtual void updateWidgetContentsSize ()=0
virtual void updateWidgetScrollBars ()=0
virtual void updateAfterCancelRowEdit ()
virtual void updateAfterAcceptRowEdit ()
virtual void slotRowRepaintRequested (KexiTableItem &item)
virtual void slotAboutToDeleteRow (KexiTableItem &item, KexiDB::ResultInfo *result, bool repaint)
virtual void slotRowDeleted ()
virtual void slotRowInserted (KexiTableItem *item, bool repaint)
virtual void slotRowInserted (KexiTableItem *item, uint row, bool repaint)
virtual void slotRowsDeleted (const QValueList< int > &)
bool hasData () const
virtual void selectCellInternal ()
virtual void updateAllVisibleRowsBelow (int row)
virtual void addNewRecordRequested ()
virtual void focusOutEvent (QFocusEvent *e)
virtual void vScrollBarValueChanged (int v)
virtual void vScrollBarSliderReleased ()
virtual void scrollBarTipTimeout ()
int showErrorMessageForResult (KexiDB::ResultInfo *resultInfo)

Protected Attributes

KexiTableViewDatam_data
bool m_owner: 1
int m_curRow
int m_curCol
KexiTableItemm_currentItem
KexiTableViewData::Iteratorm_itemIterator
KexiTableItemm_insertItem
bool m_rowEditing: 1
bool m_newRowEditing: 1
bool m_isSortingEnabled: 1
bool m_isFilteringEnabled: 1
bool m_acceptsRowEditAfterCellAccepting: 1
bool m_inside_acceptEditor: 1
bool m_internal_acceptsRowEditAfterCellAccepting: 1
bool m_emptyRowInsertingEnabled: 1
int m_readOnly
bool m_contentsMousePressEvent_dblClick: 1
int m_insertingEnabled
bool m_initDataContentsOnShow: 1
bool m_cursorPositionSetExplicityBeforeShow: 1
bool m_spreadSheetMode: 1
bool m_dropsAtRowEnabled: 1
bool m_updateEntireRowWhenMovingToOtherRow: 1
DeletionPolicy m_deletionPolicy
KexiRecordMarkerm_verticalHeader
KexiTableViewHeaderm_horizontalHeader
KexiDataItemInterfacem_editor
KexiRecordNavigatorm_navPanel
bool m_navPanelEnabled: 1
bool m_verticalHeaderAlreadyAdded: 1
int m_dragIndicatorLine
KPopupMenu * m_popupMenu
bool m_contextMenuEnabled: 1
bool m_alsoUpdateNextRow: 1
int m_rowWillBeDeleted
QGuardedPtr< KexiArrowTipm_errorMessagePopup
bool m_vScrollBarValueChanged_enabled: 1
bool m_scrollbarToolTipsEnabled: 1
QLabel * m_scrollBarTip
QTimer m_scrollBarTipTimer
uint m_scrollBarTipTimerCnt

Member Function Documentation

void KexiDataAwareObjectInterface::setData ( KexiTableViewData data,
bool  owner = true 
)

Sets data for this object. if owner is true, the object will own data and therefore will be destroyed when needed, else: data is (possibly) shared and not owned by the widget. If widget already has _different_ data object assigned (and owns this data), old data is destroyed before new assignment.

Todo:
add col width configuration and storage

Todo:
: store sorting settings?

Reimplemented in KexiTableView.

Definition at line 113 of file kexidataawareobjectiface.cpp.

KexiTableViewData* KexiDataAwareObjectInterface::data (  )  const [inline]

Returns:
data structure displayed for this object

Definition at line 82 of file kexidataawareobjectiface.h.

int KexiDataAwareObjectInterface::currentColumn (  )  const [inline]

Returns:
currently selected column number or -1.

Definition at line 85 of file kexidataawareobjectiface.h.

int KexiDataAwareObjectInterface::currentRow (  )  const [inline]

Returns:
currently selected row number or -1.

Definition at line 88 of file kexidataawareobjectiface.h.

virtual int KexiDataAwareObjectInterface::lastVisibleRow (  )  const [pure virtual]

Returns:
last row visible on the screen (counting from 0). The returned value is guaranteed to be smaller or equal to currentRow() or -1 if there are no rows.

Implemented in KexiFormScrollView, and KexiTableView.

KexiTableItem* KexiDataAwareObjectInterface::selectedItem (  )  const [inline]

Returns:
currently selected item (row data) or null.

Definition at line 96 of file kexidataawareobjectiface.h.

int KexiDataAwareObjectInterface::rows (  )  const

Returns:
number of rows in this view.

Definition at line 1438 of file kexidataawareobjectiface.cpp.

virtual int KexiDataAwareObjectInterface::columns (  )  const [inline, virtual]

Returns:
number of visible columns in this view. By default returns dataColumns(), what is proper table view. In case of form view, there can be a number of duplicated columns defined (data-aware widgets, see KexiFormScrollView::columns()), so columns() can return greater number than dataColumns().

Reimplemented in KexiFormScrollView.

Definition at line 106 of file kexidataawareobjectiface.h.

int KexiDataAwareObjectInterface::dataColumns (  )  const

Helper function.

Returns:
number of columns of data.

Definition at line 1445 of file kexidataawareobjectiface.cpp.

bool KexiDataAwareObjectInterface::isReadOnly (  )  const [virtual]

Returns:
true if data represented by this object is not editable (it can be editable with other ways although, outside of this object).

Definition at line 402 of file kexidataawareobjectiface.cpp.

void KexiDataAwareObjectInterface::setReadOnly ( bool  set  ) 

Sets readOnly flag for this object. Unless the flag is set, the widget inherits readOnly flag from it's data structure assigned with setData(). The default value if false.

This method is useful when you need to switch on the flag indepentently from the data structure. Note: it is not allowed to force readOnly off when internal data is readOnly - in that case the method does nothing. You can check internal data flag calling data()->isReadOnly().

If set is true, insertingEnabled flag will be cleared automatically.

See also:
isInsertingEnabled()

Definition at line 391 of file kexidataawareobjectiface.cpp.

bool KexiDataAwareObjectInterface::isSortingEnabled (  )  const [inline]

Returns:
true if sorting is enabled.

Definition at line 133 of file kexidataawareobjectiface.h.

void KexiDataAwareObjectInterface::setSorting ( int  col,
bool  ascending = true 
) [virtual]

Sets sorting on column col, or (when col == -1) sets rows unsorted this will dont work if sorting is disabled with setSortingEnabled()

Definition at line 262 of file kexidataawareobjectiface.cpp.

void KexiDataAwareObjectInterface::setSortingEnabled ( bool  set  )  [virtual]

Enables or disables sorting for this object This method is different that setSorting() because it prevents both user and programmer from sorting by clicking a column's header or calling setSorting(). By default sorting is enabled.

Definition at line 254 of file kexidataawareobjectiface.cpp.

int KexiDataAwareObjectInterface::dataSortedColumn (  )  const

Returns:
sorted column number or -1 if no column is sorted within data. This does not mean that any sorting has been performed within GUI of this object, because the data could be changed in the meantime outside of this GUI object.

Definition at line 271 of file kexidataawareobjectiface.cpp.

int KexiDataAwareObjectInterface::dataSortingOrder (  )  const

Returns:
1 if ascending order for data sorting data is set, -1 for descending, 0 for no sorting. This does not mean that any sorting has been performed within GUI of this objetct, because the data could be changed in the meantime outside of this GUI object.

Definition at line 278 of file kexidataawareobjectiface.cpp.

bool KexiDataAwareObjectInterface::sort (  )  [virtual]

Sorts all rows by column selected with setSorting(). If there is currently row edited, it is accepted. If acception failed, sort() will return false.

Returns:
true on success.

Definition at line 283 of file kexidataawareobjectiface.cpp.

void KexiDataAwareObjectInterface::sortAscending (  ) 

Sorts currently selected column in ascending order. This slot is used typically for "data_sort_az" action.

Definition at line 326 of file kexidataawareobjectiface.cpp.

void KexiDataAwareObjectInterface::sortDescending (  ) 

Sorts currently selected column in descending order. This slot is used typically for "data_sort_za" action.

Definition at line 333 of file kexidataawareobjectiface.cpp.

bool KexiDataAwareObjectInterface::isInsertingEnabled (  )  const [virtual]

Returns:
true if data inserting is enabled (the default).

Definition at line 364 of file kexidataawareobjectiface.cpp.

void KexiDataAwareObjectInterface::setInsertingEnabled ( bool  set  ) 

Sets insertingEnabled flag. If true, empty row is available at the end of this widget for new entering new data. Unless the flag is set, the widget inherits insertingEnabled flag from it's data structure assigned with setData(). The default value if false.

Note: it is not allowed to force insertingEnabled on when internal data has insertingEnabled set off - in that case the method does nothing. You can check internal data flag calling data()->insertingEnabled().

Setting this flag to true will have no effect if read-only flag is true.

See also:
setReadOnly()

Definition at line 413 of file kexidataawareobjectiface.cpp.

bool KexiDataAwareObjectInterface::isDeleteEnabled (  )  const

Returns:
true if row deleting is enabled. Equal to deletionPolicy() != NoDelete && !isReadOnly()).

Definition at line 380 of file kexidataawareobjectiface.cpp.

bool KexiDataAwareObjectInterface::isEmptyRowInsertingEnabled (  )  const [inline]

Returns:
true if inserting empty rows are enabled (false by default). Mostly usable for not db-aware objects (e.g. used in Kexi Alter Table). Note, that if inserting is disabled, or the data set is read-only, this flag will be ignored.

Definition at line 197 of file kexidataawareobjectiface.h.

void KexiDataAwareObjectInterface::setEmptyRowInsertingEnabled ( bool  set  ) 

Sets emptyRowInserting flag. Note, that if inserting is disabled, this flag is ignored.

Definition at line 1479 of file kexidataawareobjectiface.cpp.

void KexiDataAwareObjectInterface::setFilteringEnabled ( bool  set  )  [virtual]

Enables or disables filtering. Filtering is enabled by default.

Definition at line 375 of file kexidataawareobjectiface.cpp.

bool KexiDataAwareObjectInterface::isFilteringEnabled (  )  const [inline]

Returns:
true if filtering is enabled.

Definition at line 207 of file kexidataawareobjectiface.h.

void KexiDataAwareObjectInterface::setSpreadSheetMode (  )  [virtual]

Added for convenience: configure this object to behave more like spreadsheet (it's used for things like alter-table view).

Reimplemented in KexiTableView.

Definition at line 428 of file kexidataawareobjectiface.cpp.

bool KexiDataAwareObjectInterface::spreadSheetMode (  )  const [inline]

Returns:
true id "spreadSheetMode" is enabled. It's false by default.

Definition at line 218 of file kexidataawareobjectiface.h.

bool KexiDataAwareObjectInterface::rowEditing (  )  const [inline]

Returns:
true if currently selected row is edited.

Definition at line 221 of file kexidataawareobjectiface.h.

DeletionPolicy KexiDataAwareObjectInterface::deletionPolicy (  )  const [inline]

Returns:
deletion policy for this object. The default (after allocating) is AskDelete.

Definition at line 233 of file kexidataawareobjectiface.h.

void KexiDataAwareObjectInterface::deleteCurrentRow (  )  [virtual]

Deletes currently selected record; does nothing if no record is currently selected. If record is in edit mode, editing is cancelled before deleting.

Reimplemented in KexiTableView.

Definition at line 1187 of file kexidataawareobjectiface.cpp.

KexiTableItem * KexiDataAwareObjectInterface::insertEmptyRow ( int  row = -1  )  [virtual]

Inserts one empty row above row row. If row is -1 (the default), new row is inserted above the current row (or above 1st row if there is no current). A new item becomes current if row is -1 or if row is equal currentRow(). This method does nothing if: -inserting flag is disabled (see isInsertingEnabled()) -read-only flag is set (see isReadOnly()) \ return inserted row's data

Reimplemented in KexiTableView.

Definition at line 1224 of file kexidataawareobjectiface.cpp.

bool KexiDataAwareObjectInterface::beforeDeleteItem ( KexiTableItem item  )  [virtual]

For reimplementation: called by deleteItem(). If returns false, deleting is aborted. Default implementation just returns true.

Definition at line 1514 of file kexidataawareobjectiface.cpp.

bool KexiDataAwareObjectInterface::deleteItem ( KexiTableItem item  ) 

Deletes item. Used by deleteCurrentRow(). Calls beforeDeleteItem() before deleting, to double-check if deleting is allowed.

Returns:
true on success.

Definition at line 1520 of file kexidataawareobjectiface.cpp.

void KexiDataAwareObjectInterface::insertItem ( KexiTableItem newItem,
int  row = -1 
)

Inserts newItem at row. -1 means current row. Used by insertEmptyRow().

Definition at line 1235 of file kexidataawareobjectiface.cpp.

tristate KexiDataAwareObjectInterface::deleteAllRows ( bool  ask = false,
bool  repaint = true 
)

Clears entire table data, its visible representation and deletes data at database backend (if this is db-aware object). Does not clear columns information. Does not destroy KexiTableViewData object (if present) but only clears its contents. Displays confirmation dialog if ask is true (the default is false). Repaints widget if repaint is true (the default). For empty tables, true is returned immediately. If isDeleteEnabled() is false, false is returned. For spreadsheet mode all current rows are just replaced by empty rows.

Returns:
true on success, false on failure, and cancelled if user cancelled deletion (only possible if ask is true).

Definition at line 1314 of file kexidataawareobjectiface.cpp.

virtual int KexiDataAwareObjectInterface::rowsPerPage (  )  const [pure virtual]

Returns:
maximum number of rows that can be displayed per one "page" for current view's size.

Implemented in KexiFormScrollView, and KexiTableView.

void KexiDataAwareObjectInterface::selectNextPage (  )  [virtual]

page down action

Definition at line 451 of file kexidataawareobjectiface.cpp.

void KexiDataAwareObjectInterface::selectPrevPage (  )  [virtual]

page up action

Definition at line 444 of file kexidataawareobjectiface.cpp.

void KexiDataAwareObjectInterface::clearSelection (  )  [virtual]

Clears current selection. Current row and column will be now unspecified: currentRow(), currentColumn() will return -1, and selectedItem() will return null.

Definition at line 484 of file kexidataawareobjectiface.cpp.

void KexiDataAwareObjectInterface::setCursorPosition ( int  row,
int  col = -1,
bool  forceSet = false 
) [virtual]

Moves cursor to row and col. If col is -1, current column number is used. If forceSet is true, cursor position is updated even if row and col doesn't differ from actual position.

Definition at line 497 of file kexidataawareobjectiface.cpp.

virtual void KexiDataAwareObjectInterface::ensureCellVisible ( int  row,
int  col 
) [pure virtual]

Ensures that cell at row and col is visible. If col is -1, current column number is used. row and col (if not -1) must be between 0 and rows() (or cols() accordingly).

Implemented in KexiFormScrollView, and KexiTableView.

void KexiDataAwareObjectInterface::setAcceptsRowEditAfterCellAccepting ( bool  set  )  [virtual]

Specifies, if this object automatically accepts row editing (using acceptRowEdit()) on accepting any cell's edit (i.e. after acceptEditor()).

See also:
acceptsRowEditAfterCellAccepting()

Reimplemented in KexiTableView.

Definition at line 1459 of file kexidataawareobjectiface.cpp.

bool KexiDataAwareObjectInterface::acceptsRowEditAfterCellAccepting (  )  const [inline]

Returns:
true, if this object automatically accepts row editing (using acceptRowEdit()) on accepting any cell's edit (i.e. after acceptEditor()). By default this flag is set to false. Not that if the query for this table has given constraints defined, like NOT NULL / NOT EMPTY for more than one field - editing a record would be impossible for the flag set to true, because of constraints violation. However, setting this flag to true can be useful especially for not-db-aware data set (it's used e.g. in Kexi Alter Table's field editor).

Definition at line 318 of file kexidataawareobjectiface.h.

bool KexiDataAwareObjectInterface::dropsAtRowEnabled (  )  const [inline]

Returns:
true, if this table accepts dropping data on the rows.

Definition at line 321 of file kexidataawareobjectiface.h.

void KexiDataAwareObjectInterface::setDropsAtRowEnabled ( bool  set  )  [virtual]

Specifies, if this table accepts dropping data on the rows. If enabled:

  • dragging over row is indicated by drawing a line at bottom side of this row
  • dragOverRow() signal will be emitted on dragging, -droppedAtRow() will be emitted on dropping By default this flag is set to false.

Reimplemented in KexiTableView.

Definition at line 1464 of file kexidataawareobjectiface.cpp.

KexiDataItemInterface* KexiDataAwareObjectInterface::editor (  )  const [inline]

Returns:
currently used data (field/cell) editor or 0 if there is no data editing.

Definition at line 332 of file kexidataawareobjectiface.h.

bool KexiDataAwareObjectInterface::cancelRowEdit (  )  [virtual]

Cancels row editing All changes made to the editing row during this current session will be undone.

Returns:
true on success or false on failure (e.g. when editor does not exist)

Todo:
(js): cancel changes for this row!

Reimplemented in KexiTableView.

Definition at line 810 of file kexidataawareobjectiface.cpp.

bool KexiDataAwareObjectInterface::acceptRowEdit (  )  [virtual]

Accepts row editing. All changes made to the editing row during this current session will be accepted (saved).

Returns:
true if accepting was successful, false otherwise (e.g. when current row contain data that does not meet given constraints).

Reimplemented in KexiTableView.

Definition at line 688 of file kexidataawareobjectiface.cpp.

bool KexiDataAwareObjectInterface::cancelEditor (  )  [virtual]

Cancels changes made to the currently active editor. Reverts the editor's value to old one.

Returns:
true on success or false on failure (e.g. when editor does not exist)

Reimplemented in KexiFormScrollView, and KexiTableView.

Definition at line 875 of file kexidataawareobjectiface.cpp.

bool KexiDataAwareObjectInterface::acceptEditor (  )  [virtual]

Accepst changes made to the currently active editor.

Returns:
true on success or false on failure (e.g. when editor does not exist or there is data validation error)

Todo:
allow displaying user-defined warning

also use for other error messages

Todo:
validation rules for this value?

Reimplemented in KexiTableView.

Definition at line 900 of file kexidataawareobjectiface.cpp.

virtual void KexiDataAwareObjectInterface::createEditor ( int  row,
int  col,
const QString &  addText = QString::null,
bool  removeOld = false 
) [pure virtual]

Creates editors and shows it, what usually means the beginning of a cell editing.

Implemented in KexiFormScrollView, and KexiTableView.

void KexiDataAwareObjectInterface::startEditCurrentCell ( const QString &  setText = QString::null  )  [virtual]

Used when Return key is pressed on cell, the cell has been double clicked or "+" navigator's button is clicked. Also used when we want to continue editing a cell after "invalid value" message was displayed (in this case, setText is usually not empty, what means that text will be set in the cell replacing previous value).

Reimplemented in KexiTableView.

Definition at line 1142 of file kexidataawareobjectiface.cpp.

void KexiDataAwareObjectInterface::deleteAndStartEditCurrentCell (  )  [virtual]

Deletes currently selected cell's contents, if allowed. In most cases delete is not accepted immediately but "row editing" mode is just started.

Reimplemented in KexiTableView.

Definition at line 1163 of file kexidataawareobjectiface.cpp.

KexiTableViewColumn * KexiDataAwareObjectInterface::column ( int  col  )  [virtual]

Returns:
column information for column number col. Default implementation just returns column # col, but for Kexi Forms column data corresponding to widget number is used here (see KexiFormScrollView::fieldNumberForColumn()).

Reimplemented in KexiFormScrollView.

Definition at line 1555 of file kexidataawareobjectiface.cpp.

virtual int KexiDataAwareObjectInterface::fieldNumberForColumn ( int  col  )  [inline, virtual]

Returns:
field number within data model connected to a data-aware widget at column col. Can return -1 if there's no such column.

Reimplemented in KexiFormScrollView.

Definition at line 383 of file kexidataawareobjectiface.h.

int KexiDataAwareObjectInterface::columnType ( int  col  ) 

Returns:
a type of column col - one of KexiDB::Field::Type

Definition at line 1426 of file kexidataawareobjectiface.cpp.

QVariant KexiDataAwareObjectInterface::columnDefaultValue ( int  col  )  const

Returns:
default value for column col

Definition at line 1452 of file kexidataawareobjectiface.cpp.

bool KexiDataAwareObjectInterface::columnEditable ( int  col  )  [virtual]

Returns:
true is column col is editable. Default implementation takes information about 'readOnly' flag from data member. Within forms, this is reimplemented for checking 'readOnly' flag from a widget ('readOnly' flag from data member is still checked though).

Reimplemented in KexiFormScrollView.

Definition at line 1432 of file kexidataawareobjectiface.cpp.

virtual void KexiDataAwareObjectInterface::updateCurrentCell (  )  [pure virtual]

Redraws the current cell. To be implemented.

Implemented in KexiFormScrollView, and KexiTableView.

virtual void KexiDataAwareObjectInterface::itemChanged ( KexiTableItem ,
int  row,
int  col 
) [pure virtual]

signals

Implemented in KexiFormScrollView, and KexiTableView.

virtual void KexiDataAwareObjectInterface::newItemAppendedForAfterDeletingInSpreadSheetMode (  )  [pure virtual]

Emitted for spreadsheet mode when an item was deleted and a new item has been appended.

Implemented in KexiFormScrollView, and KexiTableView.

virtual void KexiDataAwareObjectInterface::dataRefreshed (  )  [pure virtual]

Data has been refreshed on-screen - emitted from initDataContents().

Implemented in KexiFormScrollView, and KexiTableView.

KPopupMenu* KexiDataAwareObjectInterface::contextMenu (  )  const [inline]

Returns:
a pointer to context menu. This can be used to plug some actions there.

Definition at line 420 of file kexidataawareobjectiface.h.

bool KexiDataAwareObjectInterface::contextMenuEnabled (  )  const [inline]

Returns:
true if the context menu is enabled (visible) for the view. True by default.

Definition at line 424 of file kexidataawareobjectiface.h.

void KexiDataAwareObjectInterface::setContextMenuEnabled ( bool  set  )  [inline]

Enables or disables the context menu for the view.

Definition at line 427 of file kexidataawareobjectiface.h.

bool KexiDataAwareObjectInterface::scrollbarToolTipsEnabled (  )  const

Returns:
true if vertical scrollbar's tooltips are enabled (true by default).

Definition at line 1785 of file kexidataawareobjectiface.cpp.

void KexiDataAwareObjectInterface::setScrollbarToolTipsEnabled ( bool  set  ) 

Enables or disables vertical scrollbar's tooltip.

Definition at line 1790 of file kexidataawareobjectiface.cpp.

void KexiDataAwareObjectInterface::startEditOrToggleValue (  ) 

Typically handles pressing Enter or F2 key: if current cell has boolean type, toggles it's value, otherwise starts editing (startEditCurrentCell()).

Definition at line 1605 of file kexidataawareobjectiface.cpp.

bool KexiDataAwareObjectInterface::newRowEditing (  )  const [inline]

Returns:
true if new row is edited; implies: rowEditing==true.

Definition at line 441 of file kexidataawareobjectiface.h.

void KexiDataAwareObjectInterface::boolToggled (  )  [virtual]

Reaction on toggling a boolean value of a cell: we're starting to edit the cell and inverting it's state.

Definition at line 1618 of file kexidataawareobjectiface.cpp.

virtual void KexiDataAwareObjectInterface::copySelection (  )  [pure virtual]

Copy current selection to a clipboard (e.g. cell).

Implemented in KexiFormScrollView, and KexiTableView.

virtual void KexiDataAwareObjectInterface::cutSelection (  )  [pure virtual]

Cut current selection to a clipboard (e.g. cell).

Implemented in KexiFormScrollView, and KexiTableView.

virtual void KexiDataAwareObjectInterface::paste (  )  [pure virtual]

Paste current clipboard contents (e.g. to a cell).

Implemented in KexiFormScrollView, and KexiTableView.

virtual QScrollBar* KexiDataAwareObjectInterface::verticalScrollBar (  )  const [pure virtual]

Returns:
vertical scrollbar

Implemented in KexiFormScrollView, and KexiTableView.

bool KexiDataAwareObjectInterface::handleKeyPress ( QKeyEvent *  e,
int &  curRow,
int &  curCol,
bool  fullRowSelection,
bool *  moveToFirstField = 0,
bool *  moveToLastField = 0 
) [virtual]

Used in KexiTableView::keyPressEvent() (and in continuous forms).

Returns:
true when the key press event was consumed. You should also check e->isAccepted(), if it's true, nothing should be done; if it is false, you should call setCursorPosition() for the altered curCol and curRow variables.
If moveToFirstField is not 0, *moveToFirstField will be set to true when the cursor should be moved to the first field (in tab order) and to false otherwise. If moveToLastField is not 0, *moveToLastField will be set to true when the cursor should be moved to the last field (in tab order) and to false otherwise. Note for forms: if moveToFirstField and moveToLastField are not 0, curCol is altered after calling this method, so setCursorPosition() will set to the index of an appropriate column (field). This is needed because field widgets can be inserted and ordered in custom tab order, so the very first field in the data source can be other than the very first field in the form.

Used by KexiTableView::keyPressEvent() and KexiTableView::keyPressEvent().

Definition at line 1656 of file kexidataawareobjectiface.cpp.

void KexiDataAwareObjectInterface::initDataContents (  )  [protected, virtual]

Reimplementation for KexiDataAwareObjectInterface. Initializes data contents (resizes it, sets cursor at 1st row). Sets record count for record navigator. Sets cursor positin (using setCursorPosition()) to first row or sets (-1, -1) position if no rows are available. Called on setData(). Also called once on show event after refreshRequested() signal was received from KexiTableViewData object.

Reimplemented in KexiFormScrollView, and KexiTableView.

Definition at line 212 of file kexidataawareobjectiface.cpp.

void KexiDataAwareObjectInterface::clearColumns ( bool  repaint = true  )  [protected, virtual]

Clears columns information and thus all internal table data and its visible representation. Repaints widget if repaint is true.

Definition at line 1361 of file kexidataawareobjectiface.cpp.

virtual void KexiDataAwareObjectInterface::clearColumnsInternal ( bool  repaint  )  [protected, pure virtual]

Called by clearColumns() to clear internals of the object. For example, KexiTableView removes contents of it's horizontal header.

Implemented in KexiFormScrollView, and KexiTableView.

virtual void KexiDataAwareObjectInterface::reloadActions (  )  [protected, pure virtual]

Emitted in initActions() to force reload actions You should remove existing actions and add them again. Define and emit reloadActions() signal here.

Implemented in KexiFormScrollView, and KexiTableView.

void KexiDataAwareObjectInterface::reloadData (  )  [protected, virtual]

Reloads data for this object.

Reimplemented in KexiFormScrollView, and KexiTableView.

Definition at line 1396 of file kexidataawareobjectiface.cpp.

virtual void KexiDataAwareObjectInterface::itemSelected ( KexiTableItem  )  [protected, pure virtual]

for implementation as a signal

Implemented in KexiFormScrollView, and KexiTableView.

virtual void KexiDataAwareObjectInterface::cellSelected ( int  col,
int  row 
) [protected, pure virtual]

for implementation as a signal

Implemented in KexiFormScrollView, and KexiTableView.

virtual void KexiDataAwareObjectInterface::sortedColumnChanged ( int  col  )  [protected, pure virtual]

for implementation as a signal

Implemented in KexiFormScrollView, and KexiTableView.

virtual void KexiDataAwareObjectInterface::rowEditTerminated ( int  row  )  [protected, pure virtual]

for implementation as a signal

Implemented in KexiFormScrollView, and KexiTableView.

void KexiDataAwareObjectInterface::clearVariables (  )  [protected, virtual]

Clear temporary members like the pointer to current editor. If you reimplement this method, don't forget to call this one.

Reimplemented in KexiTableView.

Definition at line 102 of file kexidataawareobjectiface.cpp.

virtual void KexiDataAwareObjectInterface::editorShowFocus ( int  row,
int  col 
) [protected, pure virtual]

Updates editor's position, size and shows its focus (not the editor!) for row and col, using editor(). Does nothing if editor not found.

Implemented in KexiFormScrollView, and KexiTableView.

virtual void KexiDataAwareObjectInterface::updateCell ( int  row,
int  col 
) [protected, pure virtual]

Redraws specified cell.

Implemented in KexiFormScrollView, and KexiTableView.

virtual void KexiDataAwareObjectInterface::updateRow ( int  row  )  [protected, pure virtual]

Redraws all cells of specified row.

Implemented in KexiFormScrollView, and KexiTableView.

virtual void KexiDataAwareObjectInterface::updateWidgetContents (  )  [protected, pure virtual]

Updates contents of the widget. Just call update() here on your widget.

Implemented in KexiFormScrollView, and KexiTableView.

virtual void KexiDataAwareObjectInterface::updateWidgetContentsSize (  )  [protected, pure virtual]

Updates widget's contents size e.g. using QScrollView::resizeContents().

Implemented in KexiFormScrollView, and KexiTableView.

virtual void KexiDataAwareObjectInterface::updateWidgetScrollBars (  )  [protected, pure virtual]

Updates scrollbars of the widget. QScrollView::updateScrollbars() will be usually called here.

Implemented in KexiFormScrollView, and KexiTableView.

virtual void KexiDataAwareObjectInterface::slotRowRepaintRequested ( KexiTableItem item  )  [inline, protected, virtual]

Handles KexiTableViewData::rowRepaintRequested() signal.

Reimplemented in KexiFormScrollView, and KexiTableView.

Definition at line 623 of file kexidataawareobjectiface.h.

void KexiDataAwareObjectInterface::slotAboutToDeleteRow ( KexiTableItem item,
KexiDB::ResultInfo result,
bool  repaint 
) [protected, virtual]

Handles KexiTableViewData::aboutToDeleteRow() signal. Prepares info for slotRowDeleted().

Reimplemented in KexiFormScrollView, and KexiTableView.

Definition at line 1485 of file kexidataawareobjectiface.cpp.

void KexiDataAwareObjectInterface::slotRowDeleted (  )  [protected, virtual]

Handles KexiTableViewData::rowDeleted() signal to repaint when needed.

Reimplemented in KexiFormScrollView, and KexiTableView.

Definition at line 1493 of file kexidataawareobjectiface.cpp.

void KexiDataAwareObjectInterface::slotRowInserted ( KexiTableItem item,
bool  repaint 
) [protected, virtual]

Handles KexiTableViewData::rowInserted() signal to repaint when needed.

Reimplemented in KexiFormScrollView, and KexiTableView.

Definition at line 1278 of file kexidataawareobjectiface.cpp.

void KexiDataAwareObjectInterface::slotRowInserted ( KexiTableItem item,
uint  row,
bool  repaint 
) [protected, virtual]

Like above, not db-aware version.

Reimplemented in KexiFormScrollView, and KexiTableView.

Definition at line 1284 of file kexidataawareobjectiface.cpp.

bool KexiDataAwareObjectInterface::hasData (  )  const [inline, protected]

for sanity checks (return true if m_data is present; else: outputs warning)

Definition at line 815 of file kexidataawareobjectiface.h.

virtual void KexiDataAwareObjectInterface::selectCellInternal (  )  [inline, protected, virtual]

Only needed for forms: called by KexiDataAwareObjectInterface::setCursorPosition() if cursor's position is really changed.

Reimplemented in KexiFormScrollView.

Definition at line 645 of file kexidataawareobjectiface.h.

virtual void KexiDataAwareObjectInterface::updateAllVisibleRowsBelow ( int  row  )  [inline, protected, virtual]

Used in KexiDataAwareObjectInterface::slotRowDeleted() to repaint tow row and all visible below. Implemented if there is more than one row displayed, i.e. currently for KexiTableView.

Reimplemented in KexiTableView.

Definition at line 650 of file kexidataawareobjectiface.h.

void KexiDataAwareObjectInterface::focusOutEvent ( QFocusEvent *  e  )  [protected, virtual]

Call this from the subclass. */.

Reimplemented in KexiTableView.

Definition at line 1815 of file kexidataawareobjectiface.cpp.

void KexiDataAwareObjectInterface::vScrollBarValueChanged ( int  v  )  [protected, virtual]

Handles verticalScrollBar()'s valueChanged(int) signal. Called when vscrollbar's value has been changed. Call this method from the subclass.

Reimplemented in KexiFormScrollView, and KexiTableView.

Definition at line 1741 of file kexidataawareobjectiface.cpp.

void KexiDataAwareObjectInterface::vScrollBarSliderReleased (  )  [protected, virtual]

Handles sliderReleased() signal of the verticalScrollBar(). Used to hide the "row number" tooltip.

Reimplemented in KexiFormScrollView, and KexiTableView.

Definition at line 1795 of file kexidataawareobjectiface.cpp.

void KexiDataAwareObjectInterface::scrollBarTipTimeout (  )  [protected, virtual]

Handles timeout() signal of the m_scrollBarTipTimer. If the tooltip is visible, m_scrollBarTipTimerCnt is set to 0 and m_scrollBarTipTimerCnt is restarted; else the m_scrollBarTipTimerCnt is just set to 0.

Reimplemented in KexiFormScrollView, and KexiTableView.

Definition at line 1801 of file kexidataawareobjectiface.cpp.

int KexiDataAwareObjectInterface::showErrorMessageForResult ( KexiDB::ResultInfo resultInfo  )  [protected]

Shows error message box suitable for resultInfo. This can be "sorry" or "detailedSorry" message box or "queryYesNo" if resultInfo->allowToDiscardChanges is true.

Returns:
code of button clicked: KMessageBox::Ok in case of "sorry" or "detailedSorry" messages and KMessageBox::Yes or KMessageBox::No in case of "queryYesNo" message.

Definition at line 1824 of file kexidataawareobjectiface.cpp.


Member Data Documentation

data structure displayed for this object

Definition at line 677 of file kexidataawareobjectiface.h.

true if m_data member is owned by this object

Definition at line 680 of file kexidataawareobjectiface.h.

cursor position

Definition at line 683 of file kexidataawareobjectiface.h.

current data item

Definition at line 686 of file kexidataawareobjectiface.h.

data item's iterator

Definition at line 689 of file kexidataawareobjectiface.h.

item data for inserting

Definition at line 692 of file kexidataawareobjectiface.h.

when (current or new) row is edited - changed field values are temporary stored here

true if currently selected row is edited

Definition at line 698 of file kexidataawareobjectiface.h.

true if new row is edited; implies: rowEditing==true.

Definition at line 701 of file kexidataawareobjectiface.h.

'sorting by column' availability flag for widget

Definition at line 704 of file kexidataawareobjectiface.h.

true if filtering is enabled for the view.

Definition at line 707 of file kexidataawareobjectiface.h.

Public version of 'acceptsRowEditAfterCellAcceptin' flag (available for a user). It's OR'es together with above flag.

Definition at line 712 of file kexidataawareobjectiface.h.

Used in acceptEditor() to avoid infinite recursion, eg. when we're calling acceptRowEdit() during cell accepting phase.

Definition at line 716 of file kexidataawareobjectiface.h.

true, if inserting empty rows are enabled (false by default)

Definition at line 724 of file kexidataawareobjectiface.h.

Contains 1 if the object is readOnly, 0 if not; otherwise (-1 means "dont know") the 'readOnly' flag from object's internal data structure (KexiTableViewData *KexiTableViewm_data) is reused.

Definition at line 730 of file kexidataawareobjectiface.h.

true if currently double click action was is performed (so accept/cancel editor shoudn't be executed)

Definition at line 735 of file kexidataawareobjectiface.h.

like for readOnly: 1 if inserting is enabled

Definition at line 738 of file kexidataawareobjectiface.h.

true, if initDataContents() should be called on show event.

Definition at line 741 of file kexidataawareobjectiface.h.

Set to true in setCursorPosition() to indicate that cursor position was set before show() and it shouldn't be changed on show(). Only used if initDataContentsOnShow is true.

Definition at line 746 of file kexidataawareobjectiface.h.

true if spreadSheetMode is enabled. False by default.

See also:
KexiTableView::setSpreadSheetMode()

Definition at line 750 of file kexidataawareobjectiface.h.

true, if this table accepts dropping data on the rows (false by default).

Definition at line 753 of file kexidataawareobjectiface.h.

true, if this entire (visible) row should be updated when boving to other row. False by default. For table view with 'row highlighting' flag enabled, it is true.

Definition at line 757 of file kexidataawareobjectiface.h.

Todo:
make generic interface out of KexiRecordMarker

Definition at line 762 of file kexidataawareobjectiface.h.

main navigation widget

Navigation panel, used if navigationPanelEnabled is true.

Definition at line 771 of file kexidataawareobjectiface.h.

true, if certical header shouldn't be increased in KexiTableView::slotRowInserted() because it was already done in KexiTableView::createEditor().

Definition at line 778 of file kexidataawareobjectiface.h.

Row number that over which user drags a mouse pointer. Used to indicate dropping possibility for that row. Equal -1 if no indication is needed.

Definition at line 783 of file kexidataawareobjectiface.h.

Context menu widget.

Definition at line 786 of file kexidataawareobjectiface.h.

Row number (>=0 or -1 == no row) that will be deleted in deleteRow(). It is set in slotAboutToDeleteRow(KexiTableItem&,KexiDB::ResultInfo*,bool)) slot received from KexiTableViewData member. This value will be used in slotRowDeleted() after rowDeleted() signal is received from KexiTableViewData member and then cleared (set to -1).

Definition at line 798 of file kexidataawareobjectiface.h.

Displays passive error popup label used when invalid data has been entered.

Definition at line 801 of file kexidataawareobjectiface.h.

Used to enable/disable execution of vScrollBarValueChanged() when users navigate through rows using keyboard, so vscrollbar tooltips are not visible.

Definition at line 805 of file kexidataawareobjectiface.h.

True, if vscrollbar tooltips are enabled (true by default).

Definition at line 808 of file kexidataawareobjectiface.h.

scrollbar tooltip

Definition at line 810 of file kexidataawareobjectiface.h.

scrollbar tooltip's timer

Definition at line 811 of file kexidataawareobjectiface.h.

helper for timeout counting (scrollbar tooltip)

Definition at line 812 of file kexidataawareobjectiface.h.


The documentation for this class was generated from the following files:
KDE Home | KDE Accessibility Home | Description of Access Keys