• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kde-runtime API Reference
  • KDE Home
  • Contact Us
 

PlasmaCore

  • Plasma
  • DataModel
Signals | Public Member Functions | Protected Member Functions | Properties | List of all members
Plasma::DataModel Class Reference

#include <datamodel.h>

Inheritance diagram for Plasma::DataModel:
Inheritance graph
[legend]

Signals

void countChanged ()
 
void filterRegExpChanged (const QString &)
 
void sourceModelChanged (QObject *)
 

Public Member Functions

 DataModel (QObject *parent=0)
 
 ~DataModel ()
 
int columnCount (const QModelIndex &parent=QModelIndex()) const
 
int count () const
 
QVariant data (const QModelIndex &index, int role) const
 
QObject * dataSource () const
 
Q_INVOKABLE QVariantHash get (int i) const
 
QVariant headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const
 
QModelIndex index (int row, int column, const QModelIndex &parent=QModelIndex()) const
 
QString keyRoleFilter () const
 
QModelIndex parent (const QModelIndex &child) const
 
int roleNameToId (const QString &name)
 
int rowCount (const QModelIndex &parent=QModelIndex()) const
 
void setDataSource (QObject *source)
 
void setKeyRoleFilter (const QString &key)
 
void setSourceFilter (const QString &key)
 
QString sourceFilter () const
 
- Public Member Functions inherited from QAbstractItemModel
 QAbstractItemModel (QObject *parent)
 
virtual  ~QAbstractItemModel ()
 
virtual QModelIndex buddy (const QModelIndex &index) const
 
virtual bool canFetchMore (const QModelIndex &parent) const
 
virtual int columnCount (const QModelIndex &parent) const =0
 
void columnsAboutToBeInserted (const QModelIndex &parent, int start, int end)
 
void columnsAboutToBeMoved (const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationColumn)
 
void columnsAboutToBeRemoved (const QModelIndex &parent, int start, int end)
 
void columnsInserted (const QModelIndex &parent, int start, int end)
 
void columnsMoved (const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationColumn)
 
void columnsRemoved (const QModelIndex &parent, int start, int end)
 
virtual QVariant data (const QModelIndex &index, int role) const =0
 
void dataChanged (const QModelIndex &topLeft, const QModelIndex &bottomRight)
 
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
 
virtual bool hasChildren (const QModelIndex &parent) const
 
bool hasIndex (int row, int column, const QModelIndex &parent) const
 
void headerDataChanged (Qt::Orientation orientation, int first, int last)
 
virtual QModelIndex index (int row, int column, const QModelIndex &parent) const =0
 
bool insertColumn (int column, const QModelIndex &parent)
 
virtual bool insertColumns (int column, int count, const QModelIndex &parent)
 
bool insertRow (int row, const QModelIndex &parent)
 
virtual bool insertRows (int row, int count, const QModelIndex &parent)
 
virtual QMap< int, QVariant > itemData (const QModelIndex &index) const
 
void layoutAboutToBeChanged ()
 
void layoutChanged ()
 
virtual QModelIndexList match (const QModelIndex &start, int role, const QVariant &value, int hits, QFlags< Qt::MatchFlag > flags) const
 
virtual QMimeData * mimeData (const QModelIndexList &indexes) const
 
virtual QStringList mimeTypes () const
 
void modelAboutToBeReset ()
 
void modelReset ()
 
virtual QModelIndex parent (const QModelIndex &index) const =0
 
bool removeColumn (int column, const QModelIndex &parent)
 
virtual bool removeColumns (int column, int count, const QModelIndex &parent)
 
bool removeRow (int row, const QModelIndex &parent)
 
virtual bool removeRows (int row, int count, const QModelIndex &parent)
 
virtual void revert ()
 
const QHash< int, QByteArray > & roleNames () const
 
virtual int rowCount (const QModelIndex &parent) const =0
 
void rowsAboutToBeInserted (const QModelIndex &parent, int start, int end)
 
void rowsAboutToBeMoved (const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationRow)
 
void rowsAboutToBeRemoved (const QModelIndex &parent, int start, int end)
 
void rowsInserted (const QModelIndex &parent, int start, int end)
 
void rowsMoved (const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationRow)
 
void rowsRemoved (const QModelIndex &parent, int start, int end)
 
virtual bool setData (const QModelIndex &index, const QVariant &value, int role)
 
virtual bool setHeaderData (int section, Qt::Orientation orientation, const QVariant &value, int role)
 
virtual bool setItemData (const QModelIndex &index, const QMap< int, QVariant > &roles)
 
void setSupportedDragActions (QFlags< Qt::DropAction > actions)
 
QModelIndex sibling (int row, int column, const QModelIndex &index) const
 
virtual void sort (int column, Qt::SortOrder order)
 
virtual QSize span (const QModelIndex &index) const
 
virtual bool submit ()
 
Qt::DropActions supportedDragActions () const
 
virtual Qt::DropActions supportedDropActions () const
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
 QObject (QObject *parent, const char *name)
 
virtual  ~QObject ()
 
bool blockSignals (bool block)
 
QObject * child (const char *objName, const char *inheritsClass, bool recursiveSearch) const
 
const QObjectList & children () const
 
const char * className () const
 
bool connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const QObject *receiver, const char *method)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method)
 
void dumpObjectInfo ()
 
void dumpObjectTree ()
 
QList< QByteArray > dynamicPropertyNames () const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
T findChild (const QString &name) const
 
QList< T > findChildren (const QRegExp &regExp) const
 
QList< T > findChildren (const QString &name) const
 
bool inherits (const char *className) const
 
void insertChild (QObject *object)
 
void installEventFilter (QObject *filterObj)
 
bool isA (const char *className) const
 
bool isWidgetType () const
 
void killTimer (int id)
 
virtual const QMetaObject * metaObject () const
 
void moveToThread (QThread *targetThread)
 
const char * name () const
 
const char * name (const char *defaultName) const
 
QString objectName () const
 
QObject * parent () const
 
QVariant property (const char *name) const
 
void removeChild (QObject *object)
 
void removeEventFilter (QObject *obj)
 
void setName (const char *name)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool signalsBlocked () const
 
int startTimer (int interval)
 
QThread * thread () const
 

Protected Member Functions

int countItems () const
 
void setItems (const QString &sourceName, const QVariantList &list)
 
- Protected Member Functions inherited from QAbstractItemModel
void beginInsertColumns (const QModelIndex &parent, int first, int last)
 
void beginInsertRows (const QModelIndex &parent, int first, int last)
 
bool beginMoveColumns (const QModelIndex &sourceParent, int sourceFirst, int sourceLast, const QModelIndex &destinationParent, int destinationChild)
 
bool beginMoveRows (const QModelIndex &sourceParent, int sourceFirst, int sourceLast, const QModelIndex &destinationParent, int destinationChild)
 
void beginRemoveColumns (const QModelIndex &parent, int first, int last)
 
void beginRemoveRows (const QModelIndex &parent, int first, int last)
 
void beginResetModel ()
 
void changePersistentIndex (const QModelIndex &from, const QModelIndex &to)
 
void changePersistentIndexList (const QModelIndexList &from, const QModelIndexList &to)
 
QModelIndex createIndex (int row, int column, void *ptr) const
 
QModelIndex createIndex (int row, int column, int id) const
 
QModelIndex createIndex (int row, int column, quint32 id) const
 
void endInsertColumns ()
 
void endInsertRows ()
 
void endMoveColumns ()
 
void endMoveRows ()
 
void endRemoveColumns ()
 
void endRemoveRows ()
 
void endResetModel ()
 
QModelIndexList persistentIndexList () const
 
void reset ()
 
void resetInternalData ()
 
void setRoleNames (const QHash< int, QByteArray > &roleNames)
 
- Protected Member Functions inherited from QObject
bool checkConnectArgs (const char *signal, const QObject *object, const char *method)
 
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const char *signal)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const char *signal)
 
int receivers (const char *signal) const
 
QObject * sender () const
 
int senderSignalIndex () const
 
virtual void timerEvent (QTimerEvent *event)
 

Properties

int count
 
QObject dataSource
 
QString keyRoleFilter
 
QString sourceFilter
 
- Properties inherited from QObject
 objectName
 

Additional Inherited Members

- Static Public Member Functions inherited from QObject
bool connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
bool connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
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)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 
- Static Protected Member Functions inherited from QObject
QByteArray normalizeSignalSlot (const char *signalSlot)
 

Detailed Description

Definition at line 128 of file datamodel.h.

Constructor & Destructor Documentation

Plasma::DataModel::DataModel ( QObject *  parent = 0)

Definition at line 172 of file datamodel.cpp.

Plasma::DataModel::~DataModel ( )

Definition at line 191 of file datamodel.cpp.

Member Function Documentation

int Plasma::DataModel::columnCount ( const QModelIndex &  parent = QModelIndex()) const

Definition at line 489 of file datamodel.cpp.

int Plasma::DataModel::count ( ) const
inline

Definition at line 184 of file datamodel.h.

void Plasma::DataModel::countChanged ( )
signal
int Plasma::DataModel::countItems ( ) const
inlineprotected

Definition at line 220 of file datamodel.h.

QVariant Plasma::DataModel::data ( const QModelIndex &  index,
int  role 
) const

Definition at line 419 of file datamodel.cpp.

QObject* Plasma::DataModel::dataSource ( ) const
void Plasma::DataModel::filterRegExpChanged ( const QString &  )
signal
QVariantHash Plasma::DataModel::get ( int  i) const

Returns the item at index in the list model.

This allows the item data to be accessed (but not modified) from JavaScript. It returns an Object with a property for each role.

  • int i the row we want

Definition at line 498 of file datamodel.cpp.

QVariant Plasma::DataModel::headerData ( int  section,
Qt::Orientation  orientation,
int  role = Qt::DisplayRole 
) const
virtual

Reimplemented from QAbstractItemModel.

Definition at line 453 of file datamodel.cpp.

QModelIndex Plasma::DataModel::index ( int  row,
int  column,
const QModelIndex &  parent = QModelIndex() 
) const

Definition at line 462 of file datamodel.cpp.

QString Plasma::DataModel::keyRoleFilter ( ) const
QModelIndex Plasma::DataModel::parent ( const QModelIndex &  child) const

Definition at line 471 of file datamodel.cpp.

int Plasma::DataModel::roleNameToId ( const QString &  name)

Definition at line 511 of file datamodel.cpp.

int Plasma::DataModel::rowCount ( const QModelIndex &  parent = QModelIndex()) const

Definition at line 478 of file datamodel.cpp.

void Plasma::DataModel::setDataSource ( QObject *  source)

Definition at line 242 of file datamodel.cpp.

void Plasma::DataModel::setItems ( const QString &  sourceName,
const QVariantList &  list 
)
protected

Definition at line 321 of file datamodel.cpp.

void Plasma::DataModel::setKeyRoleFilter ( const QString &  key)

Include only items with a key that matches this regexp in the model.

Definition at line 277 of file datamodel.cpp.

void Plasma::DataModel::setSourceFilter ( const QString &  key)

Include only sources that matches this regexp in the model.

Definition at line 299 of file datamodel.cpp.

QString Plasma::DataModel::sourceFilter ( ) const
void Plasma::DataModel::sourceModelChanged ( QObject *  )
signal

Property Documentation

int Plasma::DataModel::count
read

How many items are in this model.

Definition at line 151 of file datamodel.h.

QObject * Plasma::DataModel::dataSource
readwrite

The instance of DataSource to construct this model on.

Definition at line 135 of file datamodel.h.

QString Plasma::DataModel::keyRoleFilter
readwrite

It's a regular expression.

Only data with keys that match this filter expression will be inserted in the model

Definition at line 140 of file datamodel.h.

QString Plasma::DataModel::sourceFilter
readwrite

it's a regular expression.

If the DataSource is connected to more than one source, only inserts data from sources matching this filter expression in the model. If we want to have a source watch all sources beginning with say "name:", the required regexp would be sourceFilter: "name:.*"

Definition at line 146 of file datamodel.h.


The documentation for this class was generated from the following files:
  • datamodel.h
  • datamodel.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:08:28 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

PlasmaCore

Skip menu "PlasmaCore"
  • Main Page
  • Namespace List
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kde-runtime API Reference

Skip menu "kde-runtime API Reference"
  • KCMShell
  • KNotify
  • Plasma Runtime
  •     PlasmaCore
  •     DragAndDrop
  •     PlasmaComponents
  •     PlasmaExtraComponents
  •     QtExtraComponents

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal