• 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
 

Protected Member Functions

int countItems () const
 
void setItems (const QString &sourceName, const QVariantList &list)
 

Properties

int count
 
QObject dataSource
 
QString keyRoleFilter
 
QString sourceFilter
 

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

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-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:02:42 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