• Skip to content
  • Skip to link menu
KDE 4.3 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

Kross

model.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  * model.h
00003  * This file is part of the KDE project
00004  * copyright (C) 2006-2007 by Sebastian Sauer (mail@dipe.org)
00005  *
00006  * This program is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Library General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2 of the License, or (at your option) any later version.
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  * Library General Public License for more details.
00014  * You should have received a copy of the GNU Library General Public License
00015  * along with this program; see the file COPYING.  If not, write to
00016  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017  * Boston, MA 02110-1301, USA.
00018  ***************************************************************************/
00019 
00020 #ifndef KROSS_MODEL_H
00021 #define KROSS_MODEL_H
00022 
00023 #include <kross/core/krossconfig.h>
00024 
00025 #include <QtCore/QModelIndex>
00026 #include <QtGui/QSortFilterProxyModel>
00027 
00028 namespace Kross {
00029 
00030     // Forward declarations.
00031     class Action;
00032     class ActionCollection;
00033     class ActionCollectionModelItem;
00034 
00046     class KROSSUI_EXPORT ActionCollectionModel : public QAbstractItemModel
00047     {
00048             Q_OBJECT
00049         public:
00050             enum Mode {
00051                 None = 0,
00052                 Icons = 1,
00053                 ToolTips = 2,
00054                 UserCheckable = 4
00055                 //Editable = 8
00056             };
00057 
00058             explicit ActionCollectionModel(QObject* parent, ActionCollection* collection = 0, Mode mode = Mode(Icons|ToolTips));
00059             virtual ~ActionCollectionModel();
00060 
00061             virtual int columnCount(const QModelIndex& parent = QModelIndex()) const;
00062             virtual int rowCount(const QModelIndex& parent = QModelIndex()) const;
00063             virtual QModelIndex index(int row, int column, const QModelIndex& parent = QModelIndex()) const;
00064             virtual QModelIndex parent(const QModelIndex& index) const;
00065             virtual Qt::ItemFlags flags(const QModelIndex &index) const;
00066             virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
00067             virtual bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
00068 
00069             virtual bool insertRows(int row, int count, const QModelIndex& parent = QModelIndex());
00070             virtual bool removeRows(int row, int count, const QModelIndex& parent = QModelIndex());
00071             virtual bool insertColumns(int column, int count, const QModelIndex& parent = QModelIndex());
00072             virtual bool removeColumns(int column, int count, const QModelIndex& parent = QModelIndex());
00073 
00074             //Qt::DropActions supportedDragActions() const;
00075             virtual QStringList mimeTypes() const;
00076             virtual QMimeData* mimeData(const QModelIndexList& indexes) const;
00077             virtual bool dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent);
00078 
00079             virtual Qt::DropActions supportedDropActions() const;
00080 
00081             QModelIndex indexForCollection( ActionCollection *collection ) const;
00082             QModelIndex indexForAction( Action *action ) const;
00084             ActionCollection *rootCollection() const;
00085 
00090             static Action* action(const QModelIndex& index);
00091 
00096             static ActionCollection* collection(const QModelIndex& index);
00097 
00098         protected:
00100             int rowNumber( ActionCollection *collection ) const;
00101 
00102         private Q_SLOTS:
00103             void slotUpdated();
00104 
00105             void slotDataChanged( ActionCollection* );
00106             void slotDataChanged( Action* );
00107 
00108             void slotCollectionToBeInserted( ActionCollection* child, ActionCollection* parent );
00109             void slotCollectionInserted( ActionCollection* child, ActionCollection* parent );
00110             void slotCollectionToBeRemoved( ActionCollection* child, ActionCollection* parent );
00111             void slotCollectionRemoved( ActionCollection* child, ActionCollection* parent );
00112 
00113             void slotActionToBeInserted( Action* child, ActionCollection* parent );
00114             void slotActionInserted( Action* child, ActionCollection* parent );
00115             void slotActionToBeRemoved( Action* child, ActionCollection* parent );
00116             void slotActionRemoved( Action* child, ActionCollection* parent );
00117         private:
00119             class Private;
00121             Private* const d;
00122     };
00123 
00128     class KROSSUI_EXPORT ActionCollectionProxyModel : public QSortFilterProxyModel
00129     {
00130         public:
00131             explicit ActionCollectionProxyModel(QObject* parent, ActionCollectionModel* model = 0);
00132             virtual ~ActionCollectionProxyModel();
00133 
00134         private:
00136             virtual void setSourceModel(QAbstractItemModel* sourceModel);
00138             virtual bool filterAcceptsRow(int source_row, const QModelIndex& source_parent) const;
00139     };
00140 
00141 }
00142 
00143 #endif
00144 

Kross

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

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.6.1
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