KDbTableViewData

Search for usage in LXR

#include <KDbTableViewData.h>

Inheritance diagram for KDbTableViewData:

Signals

void aboutToChangeCell (KDbRecordData *record, int colnum, QVariant *newValue, KDbResultInfo *result)
 
void aboutToDeleteRecord (KDbRecordData *record, KDbResultInfo *result, bool repaint)
 
void aboutToInsertRecord (KDbRecordData *record, KDbResultInfo *result, bool repaint)
 
void aboutToUpdateRecord (KDbRecordData *record, KDbRecordEditBuffer *buffer, KDbResultInfo *result)
 
void destroying ()
 
void recordDeleted ()
 
void recordInserted (KDbRecordData *, bool repaint)
 
void recordInserted (KDbRecordData *, int index, bool repaint)
 
void recordRepaintRequested (KDbRecordData *)
 
void recordsDeleted (const QList< int > &recordsToDelete)
 
void recordUpdated (KDbRecordData *)
 
void reloadRequested ()
 

Public Slots

void deleteLater ()
 

Public Member Functions

 KDbTableViewData ()
 
 KDbTableViewData (const QList< QVariant > &keys, const QList< QVariant > &values, KDbField::Type keyType=KDbField::Text, KDbField::Type valueType=KDbField::Text)
 
 KDbTableViewData (KDbCursor *c)
 
 KDbTableViewData (KDbField::Type keyType, KDbField::Type valueType)
 
void addColumn (KDbTableViewColumn *col)
 
void append (KDbRecordData *record)
 
KDbRecordDataat (int index)
 
int autoIncrementedColumn () const
 
KDbTableViewDataIterator begin ()
 
virtual void clearInternal (bool processEvents=true)
 
void clearRecordEditBuffer ()
 
KDbTableViewColumncolumn (int c)
 
int columnCount () const
 
QList< KDbTableViewColumn * > * columns ()
 
KDbTableViewDataConstIterator constBegin () const
 
KDbTableViewDataConstIterator constEnd () const
 
bool containsRecordIdInfo () const
 
virtual int count () const
 
KDbRecordDatacreateItem () const
 
KDbCursorcursor () const
 
QString dbTableName () const
 
virtual bool deleteAllRecords (bool repaint=false)
 
bool deleteRecord (KDbRecordData *record, bool repaint=false)
 
void deleteRecords (const QList< int > &recordsToDelete, bool repaint=false)
 
KDbTableViewDataIterator end ()
 
KDbRecordDatafirst ()
 
int globalIndexOfVisibleColumn (int visibleIndex) const
 
int indexOf (const KDbRecordData *record, int from=0) const
 
void insertRecord (KDbRecordData *record, int index, bool repaint=false)
 
bool isDBAware () const
 
bool isEmpty () const
 
virtual bool isInsertingEnabled () const
 
virtual bool isReadOnly () const
 
KDbRecordDatalast ()
 
bool preloadAllRecords ()
 
void prepend (KDbRecordData *record)
 
KDbRecordEditBufferrecordEditBuffer () const
 
void reload ()
 
void removeFirst ()
 
void removeLast ()
 
const KDbResultInforesult () const
 
bool saveNewRecord (KDbRecordData *record, bool repaint=false)
 
bool saveRecordChanges (KDbRecordData *record, bool repaint=false)
 
virtual void setInsertingEnabled (bool set)
 
virtual void setReadOnly (bool set)
 
void setSorting (int column, KDbOrderByColumn::SortOrder order=KDbOrderByColumn::SortOrder::Ascending)
 
void sort ()
 
int sortColumn () const
 
KDbOrderByColumn::SortOrder sortOrder () const
 
bool updateRecordEditBuffer (KDbRecordData *record, int colnum, const QVariant &newval, bool allowSignals=true)
 
bool updateRecordEditBuffer (KDbRecordData *record, int colnum, KDbTableViewColumn *col, const QVariant &newval, bool allowSignals=true)
 
bool updateRecordEditBufferRef (KDbRecordData *record, int colnum, KDbTableViewColumn *col, QVariant *newval, bool allowSignals=true, QVariant *visibleValueForLookupField=nullptr)
 
KDbTableViewColumnvisibleColumn (int index)
 
int visibleColumnCount () const
 
int visibleColumnIndex (int globalIndex) const
 
QList< KDbTableViewColumn * > * visibleColumns ()
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
bool blockSignals (bool block)
 
const QObjectListchildren () const const
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method) const const
 
bool disconnect (const QObject *receiver, const char *method) const const
 
void dumpObjectInfo ()
 
void dumpObjectInfo () const const
 
void dumpObjectTree ()
 
void dumpObjectTree () const const
 
QList< QByteArraydynamicPropertyNames () const const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
findChild (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegExp &regExp, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QString &name, Qt::FindChildOptions options) const const
 
bool inherits (const char *className) const const
 
void installEventFilter (QObject *filterObj)
 
bool isWidgetType () const const
 
bool isWindowType () const const
 
void killTimer (int id)
 
virtual const QMetaObjectmetaObject () const const
 
void moveToThread (QThread *targetThread)
 
QString objectName () const const
 
void objectNameChanged (const QString &objectName)
 
QObjectparent () const const
 
QVariant property (const char *name) const const
 
 Q_CLASSINFO (Name, Value)
 
 Q_DISABLE_COPY (Class)
 
 Q_DISABLE_COPY_MOVE (Class)
 
 Q_DISABLE_MOVE (Class)
 
 Q_EMIT Q_EMIT
 
 Q_ENUM (...)
 
 Q_ENUM_NS (...)
 
 Q_ENUMS (...)
 
 Q_FLAG (...)
 
 Q_FLAG_NS (...)
 
 Q_FLAGS (...)
 
 Q_GADGET Q_GADGET
 
 Q_INTERFACES (...)
 
 Q_INVOKABLE Q_INVOKABLE
 
 Q_NAMESPACE Q_NAMESPACE
 
 Q_NAMESPACE_EXPORT (EXPORT_MACRO)
 
 Q_OBJECT Q_OBJECT
 
 Q_PROPERTY (...)
 
 Q_REVISION Q_REVISION
 
 Q_SET_OBJECT_NAME (Object)
 
 Q_SIGNAL Q_SIGNAL
 
 Q_SIGNALS Q_SIGNALS
 
 Q_SLOT Q_SLOT
 
 Q_SLOTS Q_SLOTS
 
qFindChild (const QObject *obj, const QString &name)
 
QList< T > qFindChildren (const QObject *obj, const QRegExp &regExp)
 
QList< T > qFindChildren (const QObject *obj, const QString &name)
 
qobject_cast (const QObject *object)
 
qobject_cast (QObject *object)
 
 QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
 
void removeEventFilter (QObject *obj)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool signalsBlocked () const const
 
int startTimer (int interval, Qt::TimerType timerType)
 
int startTimer (std::chrono::milliseconds time, Qt::TimerType timerType)
 
QThreadthread () const const
 

Static Public Member Functions

static QString messageYouCanImproveData ()
 
- Static Public Member Functions inherited from QObject
QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, Functor functor)
 
bool disconnect (const QMetaObject::Connection &connection)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
bool disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 

Protected Member Functions

void columnVisibilityChanged (const KDbTableViewColumn &column)
 
- Protected Member Functions inherited from QObject
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 
bool isSignalConnected (const QMetaMethod &signal) const const
 
int receivers (const char *signal) const const
 
QObjectsender () const const
 
int senderSignalIndex () const const
 
virtual void timerEvent (QTimerEvent *event)
 
- Protected Member Functions inherited from KDbUtils::AutodeletedList< T >
 AutodeletedList (bool autoDelete=true)
 
 AutodeletedList (const AutodeletedList &other)
 
bool autoDelete () const
 
void clear ()
 
QList< T >::iterator erase (typename QList< T >::iterator afirst, typename QList< T >::iterator alast)
 
QList< T >::iterator erase (typename QList< T >::iterator pos)
 
void insert (int i, const T &value)
 
void pop_back ()
 
void pop_front ()
 
int removeAll (const T &value)
 
void removeAt (int i)
 
void removeFirst ()
 
void removeLast ()
 
void replace (int i, const T &value)
 
void setAutoDelete (bool set)
 
- Protected Member Functions inherited from QList< T >
 QList (const QList< T > &other)
 
 QList (InputIterator first, InputIterator last)
 
 QList (QList< T > &&other)
 
 QList (std::initializer_list< T > args)
 
void append (const QList< T > &value)
 
void append (const T &value)
 
const T & at (int i) const const
 
T & back ()
 
const T & back () const const
 
QList::iterator begin ()
 
QList::const_iterator begin () const const
 
QList::const_iterator cbegin () const const
 
QList::const_iterator cend () const const
 
void clear ()
 
QList::const_iterator constBegin () const const
 
QList::const_iterator constEnd () const const
 
const T & constFirst () const const
 
const T & constLast () const const
 
bool contains (const T &value) const const
 
int count () const const
 
int count (const T &value) const const
 
QList::const_reverse_iterator crbegin () const const
 
QList::const_reverse_iterator crend () const const
 
bool empty () const const
 
QList::iterator end ()
 
QList::const_iterator end () const const
 
bool endsWith (const T &value) const const
 
QList::iterator erase (QList::iterator begin, QList::iterator end)
 
QList::iterator erase (QList::iterator pos)
 
T & first ()
 
const T & first () const const
 
T & front ()
 
const T & front () const const
 
int indexOf (const T &value, int from) const const
 
void insert (int i, const T &value)
 
QList::iterator insert (QList::iterator before, const T &value)
 
bool isEmpty () const const
 
T & last ()
 
const T & last () const const
 
int lastIndexOf (const T &value, int from) const const
 
int length () const const
 
QList< T > mid (int pos, int length) const const
 
void move (int from, int to)
 
bool operator!= (const QList< T > &other) const const
 
QList< T > operator+ (const QList< T > &other) const const
 
QList< T > & operator+= (const QList< T > &other)
 
QList< T > & operator+= (const T &value)
 
bool operator< (const QList< T > &lhs, const QList< T > &rhs)
 
QList< T > & operator<< (const QList< T > &other)
 
QList< T > & operator<< (const T &value)
 
QDataStreamoperator<< (QDataStream &out, const QList< T > &list)
 
bool operator<= (const QList< T > &lhs, const QList< T > &rhs)
 
QList< T > & operator= (const QList< T > &other)
 
QList< T > & operator= (QList< T > &&other)
 
bool operator== (const QList< T > &other) const const
 
bool operator> (const QList< T > &lhs, const QList< T > &rhs)
 
bool operator>= (const QList< T > &lhs, const QList< T > &rhs)
 
QDataStreamoperator>> (QDataStream &in, QList< T > &list)
 
T & operator[] (int i)
 
const T & operator[] (int i) const const
 
void pop_back ()
 
void pop_front ()
 
void prepend (const T &value)
 
void push_back (const T &value)
 
void push_front (const T &value)
 
uint qHash (const QList< T > &key, uint seed)
 
QList::reverse_iterator rbegin ()
 
QList::const_reverse_iterator rbegin () const const
 
int removeAll (const T &value)
 
void removeAt (int i)
 
void removeFirst ()
 
void removeLast ()
 
bool removeOne (const T &value)
 
QList::reverse_iterator rend ()
 
QList::const_reverse_iterator rend () const const
 
void replace (int i, const T &value)
 
void reserve (int alloc)
 
int size () const const
 
bool startsWith (const T &value) const const
 
void swap (int i, int j)
 
void swap (QList< T > &other)
 
void swapItemsAt (int i, int j)
 
takeAt (int i)
 
takeFirst ()
 
takeLast ()
 
QSet< T > toSet () const const
 
std::list< T > toStdList () const const
 
QVector< T > toVector () const const
 
value (int i) const const
 
value (int i, const T &defaultValue) const const
 

Additional Inherited Members

- Properties inherited from QObject
 objectName
 
- Public Attributes inherited from QObject
typedef QObjectList
 
- Static Protected Member Functions inherited from QList< T >
QList< T > fromSet (const QSet< T > &set)
 
QList< T > fromStdList (const std::list< T > &list)
 
QList< T > fromVector (const QVector< T > &vector)
 
- Protected Attributes inherited from QList< T >
typedef const_pointer
 
typedef const_reference
 
typedef const_reverse_iterator
 
typedef ConstIterator
 
typedef difference_type
 
typedef Iterator
 
typedef pointer
 
typedef reference
 
typedef reverse_iterator
 
typedef size_type
 
typedef value_type
 

Detailed Description

A list of records to allow configurable sorting and more.

Todo:
improve API

Definition at line 45 of file KDbTableViewData.h.

Constructor & Destructor Documentation

◆ KDbTableViewData() [1/4]

KDbTableViewData::KDbTableViewData ( )

Non-db-aware version.

Definition at line 307 of file KDbTableViewData.cpp.

◆ KDbTableViewData() [2/4]

KDbTableViewData::KDbTableViewData ( KDbCursor c)
explicit

Db-aware version. The cursor is not owned by the data.

Definition at line 317 of file KDbTableViewData.cpp.

◆ KDbTableViewData() [3/4]

KDbTableViewData::KDbTableViewData ( const QList< QVariant > &  keys,
const QList< QVariant > &  values,
KDbField::Type  keyType = KDbField::Text,
KDbField::Type  valueType = KDbField::Text 
)

Defines two-column table usually used with comboboxes. First column is invisible and contains key values. Second column and contains user-visible value.

Parameters
keysa list of keys
valuesa list of text values (must be of the same length as keys list)
keyTypea type for keys
valueTypea type for values
Todo:
make this more generic: allow to add more columns!

Definition at line 353 of file KDbTableViewData.cpp.

◆ KDbTableViewData() [4/4]

KDbTableViewData::KDbTableViewData ( KDbField::Type  keyType,
KDbField::Type  valueType 
)

Like above constructor, but keys and values are not provided. You can do this later by calling append(KDbRecordData*) method. (KDbRecordData object must have exactly two columns)

Definition at line 380 of file KDbTableViewData.cpp.

Member Function Documentation

◆ aboutToChangeCell

void KDbTableViewData::aboutToChangeCell ( KDbRecordData record,
int  colnum,
QVariant newValue,
KDbResultInfo result 
)
signal

Emitted before change of the single, currently edited cell. Connect this signal to your slot and set result->success to false to disallow this change. You can also change newValue to other value, or change other columns in record.

◆ aboutToDeleteRecord

void KDbTableViewData::aboutToDeleteRecord ( KDbRecordData record,
KDbResultInfo result,
bool  repaint 
)
signal

Emitted before deleting of a current record. Connect this signal to your slot and set result->success to false to disallow this deleting.

◆ aboutToInsertRecord

void KDbTableViewData::aboutToInsertRecord ( KDbRecordData record,
KDbResultInfo result,
bool  repaint 
)
signal

Emitted before inserting of a new, current record. Connect this signal to your slot and set result->success to false to disallow this inserting. You can also change columns in record.

◆ aboutToUpdateRecord

void KDbTableViewData::aboutToUpdateRecord ( KDbRecordData record,
KDbRecordEditBuffer buffer,
KDbResultInfo result 
)
signal

Emitted before changing of an edited, current record. Connect this signal to your slot and set result->success to false to disallow this change. You can also change columns in record.

◆ addColumn()

void KDbTableViewData::addColumn ( KDbTableViewColumn col)

Adds column col. Warning: col will be owned by this object, and deleted on its destruction.

Definition at line 399 of file KDbTableViewData.cpp.

◆ autoIncrementedColumn()

int KDbTableViewData::autoIncrementedColumn ( ) const
Todo:

add this as well? void insertRecord(KDbRecordData *record, KDbRecordData *aboveRecord)

what about changing column order?

Returns
index of autoincremented column. The result is cached.
Todo:
what about multiple autoinc columns?

Definition at line 877 of file KDbTableViewData.cpp.

◆ clearInternal()

void KDbTableViewData::clearInternal ( bool  processEvents = true)
virtual

method, used mostly by specialized classes like KexiTableView. Clears internal record structures. Record-edit buffer is cleared. Does not touch data @ database backend. Use deleteAllRecords() to safely delete all records.

Todo:
this is time consuming: find better data model

Definition at line 845 of file KDbTableViewData.cpp.

◆ clearRecordEditBuffer()

void KDbTableViewData::clearRecordEditBuffer ( )

Clears and initializes internal record edit buffer for incoming editing. Creates buffer using recordEditBuffer(false) (false means not db-aware type) if our data is not db-aware, or db-aware buffer if data is db-aware (isDBAware()==true).

See also
KDbRecordEditBuffer

Definition at line 585 of file KDbTableViewData.cpp.

◆ column()

KDbTableViewColumn * KDbTableViewData::column ( int  c)
Returns
column at index index (visible or not)

Definition at line 475 of file KDbTableViewData.cpp.

◆ columns()

QList< KDbTableViewColumn * > * KDbTableViewData::columns ( )
Returns
list of all columns

Definition at line 465 of file KDbTableViewData.cpp.

◆ columnVisibilityChanged()

void KDbTableViewData::columnVisibilityChanged ( const KDbTableViewColumn column)
protected

Used by KDbTableViewColumn::setVisible()

Definition at line 416 of file KDbTableViewData.cpp.

◆ containsRecordIdInfo()

bool KDbTableViewData::containsRecordIdInfo ( ) const
Returns
true if ROWID information is stored within every record. Only reasonable for db-aware version. ROWID information is available if KDbDriverBehavior::ROW_ID_FIELD_RETURNS_LAST_AUTOINCREMENTED_VALUE == false for a KDb database driver and a table has no primary key defined. Phisically, ROWID information is stored after last KDbRecordData's element, so every KDbRecordData's length is expanded by one.

Definition at line 510 of file KDbTableViewData.cpp.

◆ createItem()

KDbRecordData * KDbTableViewData::createItem ( ) const

Creates a single record data with proper number of columns.

Definition at line 515 of file KDbTableViewData.cpp.

◆ dbTableName()

QString KDbTableViewData::dbTableName ( ) const

For db-aware data set only: table name is returned; equivalent to cursor()->query()->parentTable()->name().

Definition at line 520 of file KDbTableViewData.cpp.

◆ deleteAllRecords()

bool KDbTableViewData::deleteAllRecords ( bool  repaint = false)
virtual

Deletes all records. Works either for db-aware and non db-aware tables. Column's definition is not changed. For db-aware version, all records are removed from a database. Record-edit buffer is cleared.

If repaint is true, reloadRequested() signal is emitted after deleting (if at least one record was deleted), so presenters can repaint their contents.

Returns
true on success.

Definition at line 862 of file KDbTableViewData.cpp.

◆ deleteLater

void KDbTableViewData::deleteLater ( )
slot

Clean up.

Definition at line 393 of file KDbTableViewData.cpp.

◆ deleteRecord()

bool KDbTableViewData::deleteRecord ( KDbRecordData record,
bool  repaint = false 
)
Todo:
use KDberrorMessage() for description as in KDbTableViewData::saveRecord() *‍/

Definition at line 790 of file KDbTableViewData.cpp.

◆ deleteRecords()

void KDbTableViewData::deleteRecords ( const QList< int > &  recordsToDelete,
bool  repaint = false 
)

Deletes records (by number) passed with recordsToDelete. Currently, this method is only for non data-aware tables.

Definition at line 820 of file KDbTableViewData.cpp.

◆ globalIndexOfVisibleColumn()

int KDbTableViewData::globalIndexOfVisibleColumn ( int  visibleIndex) const
Returns
Index of visible column visibleIndex on global list.

Definition at line 445 of file KDbTableViewData.cpp.

◆ insertRecord()

void KDbTableViewData::insertRecord ( KDbRecordData record,
int  index,
bool  repaint = false 
)

Inserts new record at index index. record will be owned by this data object. Note: Reasonable only for not not-db-aware version.

Definition at line 839 of file KDbTableViewData.cpp.

◆ isDBAware()

bool KDbTableViewData::isDBAware ( ) const
Returns
true if this db-aware data set.
Todo:
virtual?

Definition at line 485 of file KDbTableViewData.cpp.

◆ isInsertingEnabled()

bool KDbTableViewData::isInsertingEnabled ( ) const
virtual
Returns
true if data inserting is enabled (the default).

Definition at line 495 of file KDbTableViewData.cpp.

◆ isReadOnly()

bool KDbTableViewData::isReadOnly ( ) const
virtual
Returns
true if data is not editable. Can be set using setReadOnly() but it's still true if database cursor returned by cursor() is not 0 and has read-only connection.

Definition at line 922 of file KDbTableViewData.cpp.

◆ messageYouCanImproveData()

QString KDbTableViewData::messageYouCanImproveData ( )
static
Returns
reusable i18n'd message "Please correct data in this record or use the \"Cancel record changes" function."

Definition at line 928 of file KDbTableViewData.cpp.

◆ preloadAllRecords()

bool KDbTableViewData::preloadAllRecords ( )

Preloads all records provided by cursor (only for db-aware version).

Definition at line 891 of file KDbTableViewData.cpp.

◆ recordDeleted

void KDbTableViewData::recordDeleted ( )
signal

Current record has been deleted.

◆ recordEditBuffer()

KDbRecordEditBuffer * KDbTableViewData::recordEditBuffer ( ) const
Returns
record edit buffer for currently edited record. Can be 0 or empty.

Definition at line 500 of file KDbTableViewData.cpp.

◆ recordInserted [1/2]

void KDbTableViewData::recordInserted ( KDbRecordData ,
bool  repaint 
)
signal

A record has been inserted.

◆ recordInserted [2/2]

void KDbTableViewData::recordInserted ( KDbRecordData ,
int  index,
bool  repaint 
)
signal

A record has been inserted at index position (not db-aware data only)

◆ recordsDeleted

void KDbTableViewData::recordsDeleted ( const QList< int > &  recordsToDelete)
signal

Records have been deleted.

◆ recordUpdated

void KDbTableViewData::recordUpdated ( KDbRecordData )
signal

Current record has been updated.

◆ reload()

void KDbTableViewData::reload ( )
inline

Emits reloadRequested() signal to reload presenters.

Definition at line 229 of file KDbTableViewData.h.

◆ reloadRequested

void KDbTableViewData::reloadRequested ( )
signal

Displayed data needs to be reloaded in all presenters.

◆ result()

const KDbResultInfo & KDbTableViewData::result ( ) const
Returns
last operation's result information (always not null).

Definition at line 505 of file KDbTableViewData.cpp.

◆ setInsertingEnabled()

void KDbTableViewData::setInsertingEnabled ( bool  set)
virtual

Sets insertingEnabled flag. If true, empty record is available If set is true, read-only flag will be cleared automatically.

See also
setReadOnly()

Definition at line 576 of file KDbTableViewData.cpp.

◆ setReadOnly()

void KDbTableViewData::setReadOnly ( bool  set)
virtual

Sets readOnly flag for this data. If set is true, insertingEnabled flag will be cleared automatically.

See also
isInsertingEnabled()

Definition at line 567 of file KDbTableViewData.cpp.

◆ setSorting()

void KDbTableViewData::setSorting ( int  column,
KDbOrderByColumn::SortOrder  order = KDbOrderByColumn::SortOrder::Ascending 
)

Sets sorting for column. If column is -1, sorting is disabled.

Definition at line 527 of file KDbTableViewData.cpp.

◆ sort()

void KDbTableViewData::sort ( )

Sorts this data using previously set order.

Definition at line 559 of file KDbTableViewData.cpp.

◆ sortColumn()

int KDbTableViewData::sortColumn ( ) const
Returns
the column number by which the data is sorted, or -1 if sorting is disabled. Initial sorted column number for data after instantiating object is -1.

Definition at line 549 of file KDbTableViewData.cpp.

◆ sortOrder()

KDbOrderByColumn::SortOrder KDbTableViewData::sortOrder ( ) const
Returns
sorting order. This is independent of whether the data is actually sorted. sortColumn() should be checked first to see if sorting for any column is enabled (by default it is not).

Definition at line 554 of file KDbTableViewData.cpp.

◆ updateRecordEditBuffer() [1/2]

bool KDbTableViewData::updateRecordEditBuffer ( KDbRecordData record,
int  colnum,
const QVariant newval,
bool  allowSignals = true 
)

Added for convenience. Like above but it's assumed that record record's columns are ordered like in table view, not like in form view. Don't use this with form views.

Definition at line 649 of file KDbTableViewData.cpp.

◆ updateRecordEditBuffer() [2/2]

bool KDbTableViewData::updateRecordEditBuffer ( KDbRecordData record,
int  colnum,
KDbTableViewColumn col,
const QVariant newval,
bool  allowSignals = true 
)

Added for convenience. Like above but newval is passed by value.

Definition at line 641 of file KDbTableViewData.cpp.

◆ updateRecordEditBufferRef()

bool KDbTableViewData::updateRecordEditBufferRef ( KDbRecordData record,
int  colnum,
KDbTableViewColumn col,
QVariant newval,
bool  allowSignals = true,
QVariant visibleValueForLookupField = nullptr 
)

Updates internal record edit buffer: currently edited column col (number colnum) has now assigned new value of newval. Uses column's caption to address the column in buffer if the buffer is of simple type, or db-aware buffer if (isDBAware()==true). (then fields are addressed with KDbField, instead of caption strings). If allowSignals is true (the default), aboutToChangeCell() signal is emitted. visibleValueForLookupField allows to pass visible value (usually a text) for a lookup field (only reasonable if col->visibleLookupColumnInfo != 0). Note that newval may be changed in aboutToChangeCell() signal handler. If either record or col or newval is nullptr, false is returned.

See also
KDbRecordEditBuffer

Definition at line 594 of file KDbTableViewData.cpp.

◆ visibleColumn()

KDbTableViewColumn * KDbTableViewData::visibleColumn ( int  index)
Returns
visible column at index index

Definition at line 480 of file KDbTableViewData.cpp.

◆ visibleColumnCount()

int KDbTableViewData::visibleColumnCount ( ) const
Returns
number of visible columns

Definition at line 460 of file KDbTableViewData.cpp.

◆ visibleColumnIndex()

int KDbTableViewData::visibleColumnIndex ( int  globalIndex) const
Returns
Index on list of visible columns for column globalIndex or -1 if column at globalIndex is not visible.

Definition at line 450 of file KDbTableViewData.cpp.

◆ visibleColumns()

QList< KDbTableViewColumn * > * KDbTableViewData::visibleColumns ( )
Returns
list of visible columns

Definition at line 470 of file KDbTableViewData.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Thu Dec 8 2022 04:10:39 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.