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)
 
QBindable< QStringbindableObjectName ()
 
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 () const const
 
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 QRegularExpression &re, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (Qt::FindChildOptions options) const const
 
bool inherits (const char *className) const const
 
void installEventFilter (QObject *filterObj)
 
bool isQuickItemType () const const
 
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_EMIT Q_EMIT
 
 Q_ENUM (...)
 
 Q_ENUM_NS (...)
 
 Q_ENUMS (...)
 
 Q_FLAG (...)
 
 Q_FLAG_NS (...)
 
 Q_FLAGS (...)
 
 Q_GADGET Q_GADGET
 
 Q_GADGET_EXPORT (EXPORT_MACRO)
 
 Q_INTERFACES (...)
 
 Q_INVOKABLE Q_INVOKABLE
 
 Q_MOC_INCLUDE Q_MOC_INCLUDE
 
 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
 
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 setObjectName (QAnyStringView name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool setProperty (const char *name, QVariant &&value)
 
bool signalsBlocked () const const
 
int startTimer (int interval, Qt::TimerType timerType)
 
int startTimer (std::chrono::milliseconds interval, 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)
 

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 (qsizetype size)
 
 QList (qsizetype size, parameter_type value)
 
 QList (std::initializer_list< T > args)
 
void append (const QList< T > &value)
 
void append (parameter_type value)
 
void append (QList< T > &&value)
 
void append (rvalue_ref value)
 
const_reference at (qsizetype i) const const
 
reference back ()
 
const_reference back () const const
 
iterator begin ()
 
const_iterator begin () const const
 
qsizetype capacity () const const
 
const_iterator cbegin () const const
 
const_iterator cend () const const
 
void clear ()
 
const_iterator constBegin () const const
 
const_pointer constData () const const
 
const_iterator constEnd () const const
 
const T & constFirst () const const
 
const T & constLast () const const
 
bool contains (const AT &value) const const
 
qsizetype count () const const
 
qsizetype count (const AT &value) const const
 
const_reverse_iterator crbegin () const const
 
const_reverse_iterator crend () const const
 
pointer data ()
 
const_pointer data () const const
 
iterator emplace (const_iterator before, Args &&... args)
 
iterator emplace (qsizetype i, Args &&... args)
 
reference emplace_back (Args &&... args)
 
reference emplaceBack (Args &&... args)
 
bool empty () const const
 
iterator end ()
 
const_iterator end () const const
 
bool endsWith (parameter_type value) const const
 
iterator erase (const_iterator begin, const_iterator end)
 
iterator erase (const_iterator pos)
 
qsizetype erase (QList< T > &list, const AT &t)
 
qsizetype erase_if (QList< T > &list, Predicate pred)
 
QList< T > & fill (parameter_type value, qsizetype size)
 
T & first ()
 
const T & first () const const
 
QList< T > first (qsizetype n) const const
 
reference front ()
 
const_reference front () const const
 
qsizetype indexOf (const AT &value, qsizetype from) const const
 
iterator insert (const_iterator before, parameter_type value)
 
iterator insert (const_iterator before, qsizetype count, parameter_type value)
 
iterator insert (const_iterator before, rvalue_ref value)
 
iterator insert (qsizetype i, parameter_type value)
 
iterator insert (qsizetype i, qsizetype count, parameter_type value)
 
iterator insert (qsizetype i, rvalue_ref value)
 
bool isEmpty () const const
 
T & last ()
 
const T & last () const const
 
QList< T > last (qsizetype n) const const
 
qsizetype lastIndexOf (const AT &value, qsizetype from) const const
 
qsizetype length () const const
 
QList< T > mid (qsizetype pos, qsizetype length) const const
 
void move (qsizetype from, qsizetype to)
 
bool operator!= (const QList< T > &other) const const
 
QList< T > operator+ (const QList< T > &other) &&
 
QList< T > operator+ (const QList< T > &other) const &const
 
QList< T > operator+ (QList< T > &&other) &&
 
QList< T > operator+ (QList< T > &&other) const &const
 
QList< T > & operator+= (const QList< T > &other)
 
QList< T > & operator+= (parameter_type value)
 
QList< T > & operator+= (QList< T > &&other)
 
QList< T > & operator+= (rvalue_ref value)
 
bool operator< (const QList< T > &other) const const
 
QList< T > & operator<< (const QList< T > &other)
 
QList< T > & operator<< (parameter_type value)
 
QDataStreamoperator<< (QDataStream &out, const QList< T > &list)
 
QList< T > & operator<< (QList< T > &&other)
 
QList< T > & operator<< (rvalue_ref value)
 
bool operator<= (const QList< T > &other) const const
 
QList< T > & operator= (const QList< T > &other)
 
QList< T > & operator= (QList< T > &&other)
 
QList< T > & operator= (std::initializer_list< T > args)
 
bool operator== (const QList< T > &other) const const
 
bool operator> (const QList< T > &other) const const
 
bool operator>= (const QList< T > &other) const const
 
QDataStreamoperator>> (QDataStream &in, QList< T > &list)
 
reference operator[] (qsizetype i)
 
const_reference operator[] (qsizetype i) const const
 
void pop_back ()
 
void pop_front ()
 
void prepend (parameter_type value)
 
void prepend (rvalue_ref value)
 
void push_back (parameter_type value)
 
void push_back (rvalue_ref value)
 
void push_front (parameter_type value)
 
void push_front (rvalue_ref value)
 
size_t qHash (const QList< T > &key, size_t seed)
 
reverse_iterator rbegin ()
 
const_reverse_iterator rbegin () const const
 
void remove (qsizetype i, qsizetype n)
 
qsizetype removeAll (const AT &t)
 
void removeAt (qsizetype i)
 
void removeFirst ()
 
qsizetype removeIf (Predicate pred)
 
void removeLast ()
 
bool removeOne (const AT &t)
 
reverse_iterator rend ()
 
const_reverse_iterator rend () const const
 
void replace (qsizetype i, parameter_type value)
 
void replace (qsizetype i, rvalue_ref value)
 
void reserve (qsizetype size)
 
void resize (qsizetype size)
 
void resize (qsizetype size, parameter_type c)
 
void shrink_to_fit ()
 
qsizetype size () const const
 
QList< T > sliced (qsizetype pos) const const
 
QList< T > sliced (qsizetype pos, qsizetype n) const const
 
void squeeze ()
 
bool startsWith (parameter_type value) const const
 
void swap (QList< T > &other)
 
void swapItemsAt (qsizetype i, qsizetype j)
 
takeAt (qsizetype i)
 
value_type takeFirst ()
 
value_type takeLast ()
 
QList< T > toList () const const
 
QList< T > toVector () const const
 
value (qsizetype i) const const
 
value (qsizetype i, parameter_type 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 > fromList (const QList< T > &list)
 
QList< T > fromVector (const QList< T > &list)
 
- Protected Attributes inherited from QList< T >
typedef const_pointer
 
typedef const_reference
 
typedef const_reverse_iterator
 
typedef ConstIterator
 
typedef difference_type
 
typedef Iterator
 
typedef parameter_type
 
typedef pointer
 
typedef reference
 
typedef reverse_iterator
 
typedef rvalue_ref
 
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.

◆ ~KDbTableViewData()

KDbTableViewData::~KDbTableViewData ( )
override

Definition at line 385 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.

◆ append()

void KDbTableViewData::append ( KDbRecordData * record)
inline

Definition at line 257 of file KDbTableViewData.h.

◆ at()

KDbRecordData * KDbTableViewData::at ( int index)
inline

Definition at line 233 of file KDbTableViewData.h.

◆ autoIncrementedColumn()

int KDbTableViewData::autoIncrementedColumn ( ) const
Todo
add this as well? void insertRecord(KDbRecordData *record, KDbRecordData *aboveRecord)
Returns
index of autoincremented column. The result is cached.
Todo

what about multiple autoinc columns?

what about changing column order?

Definition at line 877 of file KDbTableViewData.cpp.

◆ begin()

KDbTableViewDataIterator KDbTableViewData::begin ( )
inline

Definition at line 269 of file KDbTableViewData.h.

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

◆ columnCount()

int KDbTableViewData::columnCount ( ) const

Definition at line 455 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.

◆ constBegin()

KDbTableViewDataConstIterator KDbTableViewData::constBegin ( ) const
inline

Definition at line 263 of file KDbTableViewData.h.

◆ constEnd()

KDbTableViewDataConstIterator KDbTableViewData::constEnd ( ) const
inline

Definition at line 266 of file KDbTableViewData.h.

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

◆ count()

virtual int KDbTableViewData::count ( ) const
inlinevirtual

Definition at line 236 of file KDbTableViewData.h.

◆ createItem()

KDbRecordData * KDbTableViewData::createItem ( ) const

Creates a single record data with proper number of columns.

Definition at line 515 of file KDbTableViewData.cpp.

◆ cursor()

KDbCursor * KDbTableViewData::cursor ( ) const

Definition at line 490 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.

◆ end()

KDbTableViewDataIterator KDbTableViewData::end ( )
inline

Definition at line 272 of file KDbTableViewData.h.

◆ first()

KDbRecordData * KDbTableViewData::first ( )
inline

Definition at line 242 of file KDbTableViewData.h.

◆ globalIndexOfVisibleColumn()

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

Definition at line 445 of file KDbTableViewData.cpp.

◆ indexOf()

int KDbTableViewData::indexOf ( const KDbRecordData * record,
int from = 0 ) const
inline

Definition at line 248 of file KDbTableViewData.h.

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

◆ isEmpty()

bool KDbTableViewData::isEmpty ( ) const
inline

Definition at line 239 of file KDbTableViewData.h.

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

◆ last()

KDbRecordData * KDbTableViewData::last ( )
inline

Definition at line 245 of file KDbTableViewData.h.

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

◆ prepend()

void KDbTableViewData::prepend ( KDbRecordData * record)
inline

Definition at line 260 of file KDbTableViewData.h.

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

◆ removeFirst()

void KDbTableViewData::removeFirst ( )
inline

Definition at line 251 of file KDbTableViewData.h.

◆ removeLast()

void KDbTableViewData::removeLast ( )
inline

Definition at line 254 of file KDbTableViewData.h.

◆ result()

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

Definition at line 505 of file KDbTableViewData.cpp.

◆ saveNewRecord()

bool KDbTableViewData::saveNewRecord ( KDbRecordData * record,
bool repaint = false )

Definition at line 776 of file KDbTableViewData.cpp.

◆ saveRecordChanges()

bool KDbTableViewData::saveRecordChanges ( KDbRecordData * record,
bool repaint = false )

Definition at line 762 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-2024 The KDE developers.
Generated on Fri May 17 2024 11:56:03 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.