Kross
model.cpp
Go to the documentation of this file.
52 ActionCollectionModel::ActionCollectionModel(QObject* parent, ActionCollection* collection, Mode mode)
62 QObject::connect( d->collection, SIGNAL(dataChanged(Action*)), this, SLOT(slotDataChanged(Action*)) );
63 QObject::connect( d->collection, SIGNAL(dataChanged(ActionCollection*)), this, SLOT(slotDataChanged(ActionCollection*)) );
65 QObject::connect( d->collection, SIGNAL(collectionToBeInserted(ActionCollection*,ActionCollection*)), this, SLOT(slotCollectionToBeInserted(ActionCollection*,ActionCollection*)) );
66 QObject::connect( d->collection, SIGNAL(collectionInserted(ActionCollection*,ActionCollection*)), this, SLOT(slotCollectionInserted(ActionCollection*,ActionCollection*)) );
67 QObject::connect( d->collection, SIGNAL(collectionToBeRemoved(ActionCollection*,ActionCollection*)), this, SLOT(slotCollectionToBeRemoved(ActionCollection*,ActionCollection*)) );
68 QObject::connect( d->collection, SIGNAL(collectionRemoved(ActionCollection*,ActionCollection*)), this, SLOT(slotCollectionRemoved(ActionCollection*,ActionCollection*)) );
70 QObject::connect( d->collection, SIGNAL(actionToBeInserted(Action*,ActionCollection*)), this, SLOT(slotActionToBeInserted(Action*,ActionCollection*)) );
71 QObject::connect( d->collection, SIGNAL(actionInserted(Action*,ActionCollection*)), this, SLOT(slotActionInserted(Action*,ActionCollection*)) );
72 QObject::connect( d->collection, SIGNAL(actionToBeRemoved(Action*,ActionCollection*)), this, SLOT(slotActionToBeRemoved(Action*,ActionCollection*)) );
73 QObject::connect( d->collection, SIGNAL(actionRemoved(Action*,ActionCollection*)), this, SLOT(slotActionRemoved(Action*,ActionCollection*)) );
109 void ActionCollectionModel::slotCollectionToBeInserted( ActionCollection* child, ActionCollection* parent )
111 //krossdebug( QString( "ActionCollectionModel::slotCollectionToBeInserted: %1 %2" ).arg( child->name() ).arg( parent->name( ) ) );
114 int row = parent->actions().count() + parent->collections().count(); // we assume child is appended!!
121 //krossdebug( QString( "ActionCollectionModel::slotCollectionInserted: %1 %2" ).arg( child->name( ) ).arg( parent->name( ) ) );
125 void ActionCollectionModel::slotCollectionToBeRemoved( ActionCollection* child, ActionCollection* parent )
127 //krossdebug( QString( "ActionCollectionModel::slotCollectionToBeRemoved: %1 %2" ).arg( child->name() ).arg( parent->name() ) );
135 //krossdebug( QString( "ActionCollectionModel::slotCollectionRemoved: %1 %2" ).arg( child->name() ).arg( parent->name() ) );
141 //krossdebug( QString( "ActionCollectionModel::slotActionInserted: %1 %2" ).arg( child->name() ).arg( parent->name() ) );
151 //krossdebug( QString( "ActionCollectionModel::slotActionInserted: %1 %2" ).arg( child->name() ).arg( parent->name() ) );
157 //krossdebug( QString( "ActionCollectionModel::slotActionToBeRemoved: %1 %2" ).arg( child->name() ).arg( parent->name() ) );
166 //krossdebug( QString( "ActionCollectionModel::slotActionRemoved: %1 %2" ).arg( child->name() ).arg( parent->name() ) );
224 Q_ASSERT_X( par, "ActionCollectionModel::rowCount", "index is not an action nor a collection" );
362 krossdebug( QString("ActionCollectionModel::insertRows: row=%1 count=%2").arg(row).arg(count) );
368 krossdebug( QString( "ActionCollectionModel::insertRows: parentindex is ActionCollection with name=%1" ).arg( coll->name() ) );
372 krossdebug( QString( "ActionCollectionModel::insertRows: parentindex is Action with name=%1" ).arg( act->name() ) );
380 krossdebug( QString("ActionCollectionModel::removeRows: row=%1 count=%2").arg(row).arg(count) );
386 krossdebug( QString("ActionCollectionModel::insertColumns: column=%1 count=%2").arg(column).arg(count) );
392 krossdebug( QString("ActionCollectionModel::removeColumns: column=%1 count=%2").arg(column).arg(count) );
447 bool ActionCollectionModel::dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent)
449 krossdebug( QString("ActionCollectionModel::dropMimeData: row=%1 col=%2").arg(row).arg(column) );
484 krossdebug( QString( "ActionCollectionModel::dropMimeData: parentindex is ActionCollection with name=%1" ).arg( coll->name() ) );
488 krossdebug( QString( "ActionCollectionModel::dropMimeData: parentindex is Action with name=%1" ).arg( act->name() ) );
505 ActionCollectionProxyModel::ActionCollectionProxyModel(QObject* parent, ActionCollectionModel* model)
523 bool ActionCollectionProxyModel::filterAcceptsRow(int source_row, const QModelIndex& source_parent) const
525 //krossdebug( QString( "ActionCollectionProxyModel::filterAcceptsRow: row=%1 parentrow=%2" ).arg( source_row ).arg( source_parent.row() ) );
532 return action->isEnabled() && QSortFilterProxyModel::filterAcceptsRow( source_row, source_parent );
bool hasIndex(int row, int column, const QModelIndex &parent) const
virtual QModelIndex index(int row, int column, const QModelIndex &parent) const
virtual QMimeData * mimeData(const QModelIndexList &indexes) const
Definition: model.cpp:428
static Action * action(const QModelIndex &index)
Definition: model.cpp:191
text
static ActionCollection * collection(const QModelIndex &index)
Definition: model.cpp:200
ActionCollection * parentCollection() const
Definition: actioncollection.cpp:98
void setEnabled(bool enabled)
Set the enable state of this Action to enabled .
Definition: action.cpp:311
void setFilterCaseSensitivity(Qt::CaseSensitivity cs)
QByteArray data(const QString &mimeType) const
virtual QModelIndex index(int row, int column, const QModelIndex &parent) const =0
virtual ~ActionCollectionProxyModel()
Definition: model.cpp:513
The ActionCollectionModel class implements a QAbstractItemModel to provide a model for views of a Act...
Definition: model.h:46
QList< Action * > actions() const
Definition: actioncollection.cpp:163
virtual void setSourceModel(QAbstractItemModel *sourceModel)
virtual bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent)
Definition: model.cpp:447
virtual bool hasFormat(const QString &mimeType) const
Definition: model.h:52
icon
virtual Qt::DropActions supportedDropActions() const
Definition: model.cpp:495
bool isEnabled() const
Return the enable this ActionCollection has.
Definition: actioncollection.cpp:95
virtual QStringList mimeTypes() const
Definition: model.cpp:396
virtual bool insertColumns(int column, int count, const QModelIndex &parent=QModelIndex())
Definition: model.cpp:384
virtual bool removeColumns(int column, int count, const QModelIndex &parent=QModelIndex())
Definition: model.cpp:390
virtual int columnCount(const QModelIndex &parent=QModelIndex()) const
Definition: model.cpp:213
virtual bool removeRows(int row, int count, const QModelIndex &parent=QModelIndex())
Definition: model.cpp:378
virtual bool insertRows(int row, int count, const QModelIndex &parent)
bool isNull() const
virtual QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const
Definition: model.cpp:233
T value(int i) const
virtual int rowCount(const QModelIndex &parent=QModelIndex()) const
Definition: model.cpp:218
virtual ~ActionCollectionModel()
Definition: model.cpp:76
ActionCollectionProxyModel(QObject *parent, ActionCollectionModel *model=0)
Definition: model.cpp:505
bool isValid() const
ActionCollectionModel(QObject *parent, ActionCollection *collection=0, Mode mode=Mode(Icons|ToolTips))
Definition: model.cpp:52
int count(const T &value) const
virtual QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const
Definition: model.cpp:275
void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
void endInsertRows()
objectName
bool isEmpty() const
void beginRemoveRows(const QModelIndex &parent, int first, int last)
int row() const
virtual bool removeColumns(int column, int count, const QModelIndex &parent)
void setDynamicSortFilter(bool enable)
void * internalPointer() const
bool endsWith(const QString &s, Qt::CaseSensitivity cs) const
void setEnabled(bool enabled)
Enable or disable this ActionCollection.
Definition: actioncollection.cpp:96
ActionCollection * collection(const QString &name) const
Definition: actioncollection.cpp:128
virtual bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole)
Definition: model.cpp:332
virtual bool insertRows(int row, int count, const QModelIndex &parent=QModelIndex())
Definition: model.cpp:360
ActionCollection * actionCollection() const
Definition: manager.cpp:285
bool atEnd() const
QStringList collections() const
Definition: actioncollection.cpp:133
QModelIndex createIndex(int row, int column, void *ptr) const
int rowNumber(ActionCollection *collection) const
Definition: model.cpp:86
virtual bool insertColumns(int column, int count, const QModelIndex &parent)
virtual bool removeRows(int row, int count, const QModelIndex &parent)
void beginInsertRows(const QModelIndex &parent, int first, int last)
KLocale * locale()
QModelIndex indexForAction(Action *action) const
Definition: model.cpp:103
QString removeAcceleratorMarker(const QString &label) const
virtual bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const
virtual Qt::ItemFlags flags(const QModelIndex &index) const
Definition: model.cpp:259
QAbstractItemModel * sourceModel() const
typedef DropActions
bool isEnabled() const
Return true if this Action is enabled else false is returned.
Definition: action.cpp:306
int column() const
static QDebug kWarning(bool cond, int area=KDE_DEFAULT_DEBUG_AREA)
virtual Qt::ItemFlags flags(const QModelIndex &index) const
int indexOf(const QRegExp &rx, int from) const
Definition: model.h:53
The Action class is an abstract container to deal with scripts like a single standalone script file...
Definition: action.h:94
void setData(const QString &mimeType, const QByteArray &data)
void endRemoveRows()
QModelIndex indexForCollection(ActionCollection *collection) const
Definition: model.cpp:95
The ActionCollection class manages collections of Action instances.
Definition: actioncollection.h:45
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
QObject * parent() const
QString arg(qlonglong a, int fieldWidth, int base, const QChar &fillChar) const
typedef ItemFlags
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:24:44 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:24:44 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.