4 #ifndef BPSTABLEMODEL_H
5 #define BPSTABLEMODEL_H
9 #include <QAbstractItemModel>
24 friend class BpsTableItemPrivate;
282 void copy(
const QModelIndexList& aIndexList);
476 void setModified(
bool aModified);
#define BPS_PRIVATE(Class)
Declare pointer to private object in a public class.
Definition: bpsglobals.h:102
Public include file for BPS GUI library macros.
#define BPSGUI_EXPORT
Declare class an import from the shared library.
Definition: bpsgui_global.h:22
Public include file for BpsTableOptions type.
Database table descriptor.
Definition: bpstable.h:19
Items used by BpsTableModel.
Definition: bpstableitem.h:18
A model for hierarchical or flat database tables.
Definition: bpstablemodel.h:21
void setReadOnly(bool aReadOnly)
Enable or disable read-only mode.
void itemsAdded(const QModelIndexList &aIndexes)
This signal is emitted after one or more new rows is/are added either by calling addItem,...
void moveItem(const QModelIndex &aSrc, int aDstRow, const QModelIndex &aDstParent=QModelIndex())
Moves the source item to the target.
void loadSlaveModels(BpsTableItem *aItem)
Load slave models of the item, in case they were not yet loaded.
QVariantList allKeys(const QModelIndex &aParent=QModelIndex()) const
Fetches all yet not fetched rows from database, and returns all record keys.
void enableTree(bool aEnable)
Enables or disables tree mode.
void deleteItem(const QModelIndex &aIndex)
Delete a single row from the model.
virtual void updateTableItem(BpsTable *aTable, BpsTableItem *aItem)
Update a existing item into the database.
void paste(const QModelIndex &aParent=QModelIndex())
Paste clipboard data into new items.
void setEmpty()
Clears the model and inhibits loading any records from database, independent from filter.
QString optionsAttribTable(const QString &aMappingTable) const
Get the attribute table of a option mapping table.
BpsTable * slaveTable(const QString &aName) const
void unmodified(bool aUnmodified)
Emitted when the modification status of the model changes.
void copy(const QModelIndexList &aIndexList)
Copy items to clipboard.
virtual void loadTableItem(BpsTable *aTable, BpsTableItem *aItem, bool aAdditionalFields)
Overload this method to process items immediately after loading from the database.
virtual void insertTableItem(BpsTable *aTable, BpsTableItem *aItem)
Inserts a new item into the database.
void modified(bool aModified)
Emitted when the modification status of the model changes.
QVariant key(const QModelIndex &aIndex) const
BpsTableModel(BpsTable *aTable, QObject *aParent)
Create a master table model.
QString optionsNameColumn(const QString &aMappingTable) const
Get the name column in the attributes table of a option mapping table.
void deleteItems(const QModelIndexList &aIndexList)
Delete a number of rows from the model.
void addSlaveTable(BpsTable *aTable, const QString &aRefColumn)
Add a slave table.
QStringList slaveTables() const
void loadOptions(BpsTableItem *aItem)
Load options of the record from the mapping tables, in case they were not yet loaded.
virtual void deleteTableItem(BpsTable *aTable, BpsTableItem *aItem)
Delete a existing item from the database.
void addOptions(const QString &aMappingTable, const QString &aMasterColumn, const QString &aAttribColumn, const QString &aAttribTable, const QString &aNameColumn)
Add a slave options definition.
QModelIndex keyIndex(const QVariant &aKey) const
Get index from a key.
QModelIndex firstIndex(const QModelIndex &aParent=QModelIndex())
Get index of first item.
BpsTableItem * item(const QModelIndex &aIndex) const
Get the table item of a certain index.
virtual BpsTableModel * createSlaveModel(BpsTable *aTable, const QString &aRefColumn, BpsTableItem *aMasterItem)
Create a slave table model.
void loadAdditionalFields(BpsTableItem *aItem)
Load additional fields of the record, in case they were not yet loaded.
bool save(QString &aMessage, QModelIndexList &aIndexes, QString &aColumn)
Save pending changes to the datastore.
void refresh()
Refresh the model immediately.
QModelIndex addItem(const QModelIndex &aParent=QModelIndex(), bool aSignal=true)
Creates a new row in the model.
virtual void loadTableOptions(BpsTable *aTable, BpsTableItem *aItem, const QString &aMappingTable)
Overload this method to process options immediately after loading from the database.
QString keyToolTipLabel() const
BpsTableModel(BpsTable *aTable, const QString &aRefColumn, BpsTableItem *aMasterItem)
Constructor for slave table models.
QStringList optionsMappingTables() const
void setKeyToolTipLabel(const QString &aLabel)
Set label to display the record key as tool tip.
virtual bool canFetchMore(const QModelIndex &parent) const const
virtual int columnCount(const QModelIndex &parent) const const=0
virtual QVariant data(const QModelIndex &index, int role) const const=0
virtual bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent)
virtual void fetchMore(const QModelIndex &parent)
virtual Qt::ItemFlags flags(const QModelIndex &index) const const
virtual bool hasChildren(const QModelIndex &parent) const const
virtual QModelIndex index(int row, int column, const QModelIndex &parent) const const=0
virtual QMimeData * mimeData(const QModelIndexList &indexes) const const
virtual QStringList mimeTypes() const const
virtual bool removeRows(int row, int count, const QModelIndex &parent)
virtual int rowCount(const QModelIndex &parent) const const=0
virtual bool setData(const QModelIndex &index, const QVariant &value, int role)
virtual Qt::DropActions supportedDropActions() const const
QObject * parent() const const