• Skip to content
  • Skip to link menu
KDE 4.7 API Reference
  • KDE API Reference
  • kdelibs
  • KDE Home
  • Contact Us
 

KDEUI

Public Member Functions | Protected Slots | Protected Member Functions | Protected Attributes
KIdentityProxyModel Class Reference

#include <kidentityproxymodel.h>

Inheritance diagram for KIdentityProxyModel:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 KIdentityProxyModel (QObject *parent=0)
virtual ~KIdentityProxyModel ()
virtual bool canFetchMore (const QModelIndex &parent) const
int columnCount (const QModelIndex &parent=QModelIndex()) const
bool dropMimeData (const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent)
virtual void fetchMore (const QModelIndex &parent)
QModelIndex index (int row, int column, const QModelIndex &parent=QModelIndex()) const
bool insertColumns (int column, int count, const QModelIndex &parent=QModelIndex())
bool insertRows (int row, int count, const QModelIndex &parent=QModelIndex())
QModelIndex mapFromSource (const QModelIndex &sourceIndex) const
QItemSelection mapSelectionFromSource (const QItemSelection &selection) const
QItemSelection mapSelectionToSource (const QItemSelection &selection) const
QModelIndex mapToSource (const QModelIndex &proxyIndex) const
QModelIndexList match (const QModelIndex &start, int role, const QVariant &value, int hits=1, Qt::MatchFlags flags=Qt::MatchFlags(Qt::MatchStartsWith|Qt::MatchWrap)) const
virtual QMimeData * mimeData (const QModelIndexList &indexes) const
virtual QStringList mimeTypes () const
QModelIndex parent (const QModelIndex &child) const
bool removeColumns (int column, int count, const QModelIndex &parent=QModelIndex())
bool removeRows (int row, int count, const QModelIndex &parent=QModelIndex())
int rowCount (const QModelIndex &parent=QModelIndex()) const
void setSourceModel (QAbstractItemModel *sourceModel)
virtual Qt::DropActions supportedDropActions () const

Protected Slots

virtual void resetInternalData ()

Protected Member Functions

 KIdentityProxyModel (KIdentityProxyModelPrivate *privateClass, QObject *parent)

Protected Attributes

KIdentityProxyModelPrivate *const d_ptr

Detailed Description

The KIdentityProxyModel class proxies its source model unmodified.

Since:
4.6

KIdentityProxyModel can be used to forward the structure of a source model exactly, with no sorting, filtering or other transformation. This is similar in concept to an identity matrix where A.I = A.

Because it does no sorting or filtering, this class is most suitable to proxy models which transform the data() of the source model. For example, a proxy model could be created to define the font used, or the background colour, or the tooltip etc. This removes the need to implement all data handling in the same class that creates the structure of the model, and can also be used to create re-usable components.

This also provides a way to change the data in the case where a source model is supplied by a third party which can not be modified.

      class DateFormatProxyModel : public KIdentityProxyModel
      {
        // ...

        void setDateFormatString(const QString &formatString)
        {
          m_formatString = formatString;
        }

        QVariant data(const QModelIndex &index, int role)
        {
          if (role != Qt::DisplayRole)
            return KIdentityProxyModel::data(index, role);

          const QDateTime dateTime = sourceModel()->data(SourceClass::DateRole).toDateTime();

          return dateTime.toString(m_formatString);
        }

      private:
        QString m_formatString;
      };
Since:
4.6
Author:
Stephen Kelly <stephen@kdab.com>

Constructor & Destructor Documentation

KIdentityProxyModel::KIdentityProxyModel ( QObject *  parent = 0) [explicit]

Constructs an identity model with the given parent.

Definition at line 122 of file kidentityproxymodel.cpp.

KIdentityProxyModel::~KIdentityProxyModel ( ) [virtual]

Destroys this identity model.

Definition at line 139 of file kidentityproxymodel.cpp.

KIdentityProxyModel::KIdentityProxyModel ( KIdentityProxyModelPrivate *  privateClass,
QObject *  parent 
) [protected]

Definition at line 130 of file kidentityproxymodel.cpp.


Member Function Documentation

bool KIdentityProxyModel::canFetchMore ( const QModelIndex &  parent) const [virtual]
Reimplemented from superclass.

Definition at line 147 of file kidentityproxymodel.cpp.

int KIdentityProxyModel::columnCount ( const QModelIndex &  parent = QModelIndex()) const

\reimp

Definition at line 158 of file kidentityproxymodel.cpp.

bool KIdentityProxyModel::dropMimeData ( const QMimeData *  data,
Qt::DropAction  action,
int  row,
int  column,
const QModelIndex &  parent 
)

\reimp

Definition at line 180 of file kidentityproxymodel.cpp.

void KIdentityProxyModel::fetchMore ( const QModelIndex &  parent) [virtual]
Reimplemented from superclass.

Definition at line 169 of file kidentityproxymodel.cpp.

QModelIndex KIdentityProxyModel::index ( int  row,
int  column,
const QModelIndex &  parent = QModelIndex() 
) const
Reimplemented from superclass.

Definition at line 191 of file kidentityproxymodel.cpp.

bool KIdentityProxyModel::insertColumns ( int  column,
int  count,
const QModelIndex &  parent = QModelIndex() 
)
Reimplemented from superclass.

Definition at line 207 of file kidentityproxymodel.cpp.

bool KIdentityProxyModel::insertRows ( int  row,
int  count,
const QModelIndex &  parent = QModelIndex() 
)
Reimplemented from superclass.

Definition at line 218 of file kidentityproxymodel.cpp.

QModelIndex KIdentityProxyModel::mapFromSource ( const QModelIndex &  sourceIndex) const
Reimplemented from superclass.

Definition at line 229 of file kidentityproxymodel.cpp.

QItemSelection KIdentityProxyModel::mapSelectionFromSource ( const QItemSelection &  selection) const
Reimplemented from superclass.

Definition at line 241 of file kidentityproxymodel.cpp.

QItemSelection KIdentityProxyModel::mapSelectionToSource ( const QItemSelection &  selection) const
Reimplemented from superclass.

Definition at line 262 of file kidentityproxymodel.cpp.

QModelIndex KIdentityProxyModel::mapToSource ( const QModelIndex &  proxyIndex) const
Reimplemented from superclass.

Definition at line 298 of file kidentityproxymodel.cpp.

QModelIndexList KIdentityProxyModel::match ( const QModelIndex &  start,
int  role,
const QVariant &  value,
int  hits = 1,
Qt::MatchFlags  flags = Qt::MatchFlags(Qt::MatchStartsWith|Qt::MatchWrap) 
) const
Reimplemented from superclass.

Definition at line 309 of file kidentityproxymodel.cpp.

QMimeData * KIdentityProxyModel::mimeData ( const QModelIndexList &  indexes) const [virtual]

Definition at line 335 of file kidentityproxymodel.cpp.

QStringList KIdentityProxyModel::mimeTypes ( ) const [virtual]
Reimplemented from superclass.

Definition at line 327 of file kidentityproxymodel.cpp.

QModelIndex KIdentityProxyModel::parent ( const QModelIndex &  child) const

\reimp

Definition at line 351 of file kidentityproxymodel.cpp.

bool KIdentityProxyModel::removeColumns ( int  column,
int  count,
const QModelIndex &  parent = QModelIndex() 
)
Reimplemented from superclass.

Definition at line 365 of file kidentityproxymodel.cpp.

bool KIdentityProxyModel::removeRows ( int  row,
int  count,
const QModelIndex &  parent = QModelIndex() 
)
Reimplemented from superclass.

Definition at line 377 of file kidentityproxymodel.cpp.

void KIdentityProxyModel::resetInternalData ( ) [protected, virtual, slot]

This slot is automatically invoked when the model is reset. It can be used to clear any data internal to the proxy at the approporiate time.

See also:
QAbstractItemModel::internalDataReset()

Definition at line 749 of file kidentityproxymodel.cpp.

int KIdentityProxyModel::rowCount ( const QModelIndex &  parent = QModelIndex()) const
Reimplemented from superclass.

Definition at line 389 of file kidentityproxymodel.cpp.

void KIdentityProxyModel::setSourceModel ( QAbstractItemModel *  sourceModel)
Reimplemented from superclass.

Reimplemented in KCheckableProxyModel.

Definition at line 400 of file kidentityproxymodel.cpp.

Qt::DropActions KIdentityProxyModel::supportedDropActions ( ) const [virtual]

Definition at line 504 of file kidentityproxymodel.cpp.


Member Data Documentation

KIdentityProxyModelPrivate* const KIdentityProxyModel::d_ptr [protected]

Definition at line 64 of file kidentityproxymodel.h.


The documentation for this class was generated from the following files:
  • kidentityproxymodel.h
  • kidentityproxymodel.cpp

KDEUI

Skip menu "KDEUI"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.7.5
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal