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

Kross

  • kross
  • ui
model.cpp
Go to the documentation of this file.
1/***************************************************************************
2 * model.cpp
3 * This file is part of the KDE project
4 * copyright (C) 2006-2007 by Sebastian Sauer (mail@dipe.org)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public License
15 * along with this program; see the file COPYING. If not, write to
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18 ***************************************************************************/
19
20#include "model.h"
21
22#include <kross/core/action.h>
23#include <kross/core/actioncollection.h>
24#include <kross/core/manager.h>
25
26#include <kglobal.h>
27#include <klocale.h>
28#include <kdebug.h>
29
30#include <QtCore/QEvent>
31#include <QtCore/QMimeData>
32#include <QtCore/QPointer>
33
34using namespace Kross;
35
36/******************************************************************************
37 * ActionCollectionModel
38 */
39
40namespace Kross {
41
43 class ActionCollectionModel::Private
44 {
45 public:
46 QPointer<ActionCollection> collection;
47 Mode mode;
48 };
49
50}
51
52ActionCollectionModel::ActionCollectionModel(QObject* parent, ActionCollection* collection, Mode mode)
53 : QAbstractItemModel(parent)
54 , d( new Private() )
55{
56 //krossdebug( QString( "ActionCollectionModel::ActionCollectionModel:") );
57 d->collection = collection ? collection : Kross::Manager::self().actionCollection();
58 d->mode = mode;
59 //setSupportedDragActions(Qt::MoveAction);
60
61 //ActionCollection propagates signals to parent
62 QObject::connect( d->collection, SIGNAL(dataChanged(Action*)), this, SLOT(slotDataChanged(Action*)) );
63 QObject::connect( d->collection, SIGNAL(dataChanged(ActionCollection*)), this, SLOT(slotDataChanged(ActionCollection*)) );
64
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*)) );
69
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*)) );
74}
75
76ActionCollectionModel::~ActionCollectionModel()
77{
78 delete d;
79}
80
81ActionCollection *ActionCollectionModel::rootCollection() const
82{
83 return d->collection;
84}
85
86int ActionCollectionModel::rowNumber( ActionCollection *collection ) const
87{
88 Q_ASSERT( collection != 0 );
89 ActionCollection *par = collection->parentCollection();
90 Q_ASSERT( par != 0 );
91 int row = par->collections().indexOf( collection->objectName() ) + par->actions().count();
92 return row;
93}
94
95QModelIndex ActionCollectionModel::indexForCollection( ActionCollection *collection ) const
96{
97 if ( collection == d->collection ) {
98 return QModelIndex();
99 }
100 return createIndex( rowNumber( collection ), 0, collection->parentCollection() );
101}
102
103QModelIndex ActionCollectionModel::indexForAction( Action *act ) const
104{
105 ActionCollection *coll = static_cast<ActionCollection*>( act->parent() );
106 return createIndex( coll->actions().indexOf( act ), 0, coll );
107}
108
109void ActionCollectionModel::slotCollectionToBeInserted( ActionCollection* child, ActionCollection* parent )
110{
111 //krossdebug( QString( "ActionCollectionModel::slotCollectionToBeInserted: %1 %2" ).arg( child->name() ).arg( parent->name( ) ) );
112 Q_ASSERT( parent );
113 Q_UNUSED( child )
114 int row = parent->actions().count() + parent->collections().count(); // we assume child is appended!!
115 QModelIndex parIdx = indexForCollection( parent );
116 beginInsertRows( parIdx, row, row );
117}
118
119void ActionCollectionModel::slotCollectionInserted( ActionCollection*, ActionCollection* )
120{
121 //krossdebug( QString( "ActionCollectionModel::slotCollectionInserted: %1 %2" ).arg( child->name( ) ).arg( parent->name( ) ) );
122 endInsertRows();
123}
124
125void ActionCollectionModel::slotCollectionToBeRemoved( ActionCollection* child, ActionCollection* parent )
126{
127 //krossdebug( QString( "ActionCollectionModel::slotCollectionToBeRemoved: %1 %2" ).arg( child->name() ).arg( parent->name() ) );
128 int row = rowNumber( child );
129 QModelIndex parIdx = indexForCollection( parent );
130 beginRemoveRows( parIdx, row, row );
131}
132
133void ActionCollectionModel::slotCollectionRemoved( ActionCollection*, ActionCollection* )
134{
135 //krossdebug( QString( "ActionCollectionModel::slotCollectionRemoved: %1 %2" ).arg( child->name() ).arg( parent->name() ) );
136 endRemoveRows();
137}
138
139void ActionCollectionModel::slotActionToBeInserted( Action* child, ActionCollection* parent )
140{
141 //krossdebug( QString( "ActionCollectionModel::slotActionInserted: %1 %2" ).arg( child->name() ).arg( parent->name() ) );
142 Q_ASSERT( parent );
143 Q_UNUSED( child )
144 int row = parent->actions().count(); // assume child is appended to actions!!
145 QModelIndex parIdx = indexForCollection( parent );
146 beginInsertRows( parIdx, row, row );
147}
148
149void ActionCollectionModel::slotActionInserted( Action*, ActionCollection* )
150{
151 //krossdebug( QString( "ActionCollectionModel::slotActionInserted: %1 %2" ).arg( child->name() ).arg( parent->name() ) );
152 endInsertRows();
153}
154
155void ActionCollectionModel::slotActionToBeRemoved( Action* child, ActionCollection* parent )
156{
157 //krossdebug( QString( "ActionCollectionModel::slotActionToBeRemoved: %1 %2" ).arg( child->name() ).arg( parent->name() ) );
158 Q_ASSERT( parent );
159 int row = parent->actions().indexOf( child );
160 QModelIndex parIdx = indexForCollection( parent );
161 beginRemoveRows( parIdx, row, row );
162}
163
164void ActionCollectionModel::slotActionRemoved( Action*, ActionCollection* )
165{
166 //krossdebug( QString( "ActionCollectionModel::slotActionRemoved: %1 %2" ).arg( child->name() ).arg( parent->name() ) );
167 endRemoveRows();
168}
169
170//NOTE: not used anymore, remove?
171void ActionCollectionModel::slotUpdated()
172{
173 //emit layoutAboutToBeChanged();
174 //emit layoutChanged();
175}
176
177void ActionCollectionModel::slotDataChanged( ActionCollection* coll )
178{
179 //krossdebug( QString( "ActionCollectionModel::slotDataChanged: %1" ).arg( coll->name() ) );
180 QModelIndex idx = indexForCollection( coll );
181 emit dataChanged( idx, idx ); // NOTE: change if more than one column
182}
183
184void ActionCollectionModel::slotDataChanged( Action* act )
185{
186 //krossdebug( QString( "ActionCollectionModel::slotDataChanged: %1" ).arg( act->name() ) );
187 QModelIndex idx = indexForAction( act );
188 emit dataChanged( idx, idx ); // NOTE: change if more than one column
189}
190
191Action* ActionCollectionModel::action(const QModelIndex& index)
192{
193 ActionCollection *par = static_cast<ActionCollection*>( index.internalPointer() );
194 if ( par == 0 || index.row() >= par->actions().count() ) {
195 return 0;
196 }
197 return par->actions().value( index.row() );
198}
199
200ActionCollection* ActionCollectionModel::collection(const QModelIndex& index)
201{
202 ActionCollection *par = static_cast<ActionCollection*>( index.internalPointer() );
203 if ( par == 0 ) {
204 return 0;
205 }
206 int row = index.row() - par->actions().count();
207 if ( row < 0 ) {
208 return 0; // this is probably an action
209 }
210 return par->collection( par->collections().value( row) );
211}
212
213int ActionCollectionModel::columnCount(const QModelIndex&) const
214{
215 return 1;
216}
217
218int ActionCollectionModel::rowCount(const QModelIndex& index) const
219{
220 if ( action( index) ) {
221 return 0;
222 }
223 ActionCollection* par = index.isValid() ? collection( index ) : d->collection.data();
224 Q_ASSERT_X( par, "ActionCollectionModel::rowCount", "index is not an action nor a collection" );
225 if (!par) {
226 kWarning()<<"index is not an action nor a collection"<<index;
227 return 0;
228 }
229 int rows = par->actions().count() + par->collections().count();
230 return rows;
231}
232
233QModelIndex ActionCollectionModel::index(int row, int column, const QModelIndex& parent) const
234{
235 if ( ! hasIndex( row, column, parent ) ) {
236 return QModelIndex();
237 }
238 ActionCollection* par = parent.isValid() ? collection( parent ) : d->collection.data();
239 if ( par == 0 ) {
240 // safety: may happen if parent index is an action (ModelTest tests this)
241 return QModelIndex();
242 }
243 return createIndex( row, column, par );
244}
245
246QModelIndex ActionCollectionModel::parent(const QModelIndex& index) const
247{
248 if( ! index.isValid() ) {
249 return QModelIndex();
250 }
251 ActionCollection *par = static_cast<ActionCollection*>( index.internalPointer() );
252 Q_ASSERT( par != 0 );
253 if ( par == d->collection ) {
254 return QModelIndex();
255 }
256 return createIndex( rowNumber( par ), 0, par->parentCollection() );
257}
258
259Qt::ItemFlags ActionCollectionModel::flags(const QModelIndex &index) const
260{
261 Qt::ItemFlags flags = QAbstractItemModel::flags(index);
262 if( ! index.isValid() )
263 return Qt::ItemIsDropEnabled | flags;
264
265 flags |= Qt::ItemIsSelectable;
266 //flags |= Qt::ItemIsEditable;
267 flags |= Qt::ItemIsDragEnabled;
268 flags |= Qt::ItemIsDropEnabled;
269
270 if( (index.column() == 0) && (d->mode & UserCheckable) )
271 flags |= Qt::ItemIsUserCheckable;
272 return flags;
273}
274
275QVariant ActionCollectionModel::data(const QModelIndex& index, int role) const
276{
277 if( index.isValid() ) {
278 Action *act = action( index );
279 if ( act ) {
280 switch( role ) {
281 case Qt::DecorationRole: {
282 if( d->mode & Icons )
283 if( ! act->iconName().isEmpty() )
284 return act->icon();
285 } break;
286 case Qt::DisplayRole:
287 return KGlobal::locale()->removeAcceleratorMarker( act->text() );
288 case Qt::ToolTipRole: // fall through
289 case Qt::WhatsThisRole: {
290 if( d->mode & ToolTips ) {
291 const QString file = QFileInfo( act->file() ).fileName();
292 return QString( "<qt><b>%1</b><br>%2</qt>" )
293 .arg( file.isEmpty() ? act->name() : file )
294 .arg( act->description() );
295 }
296 } break;
297 case Qt::CheckStateRole: {
298 if( d->mode & UserCheckable )
299 return act->isEnabled() ? Qt::Checked : Qt::Unchecked;
300 } break;
301 default: break;
302 }
303 return QVariant();
304 }
305 ActionCollection *coll = collection( index );
306 if ( coll ) {
307 switch( role ) {
308 case Qt::DecorationRole: {
309 if( d->mode & Icons )
310 if( ! coll->iconName().isEmpty() )
311 return coll->icon();
312 } break;
313 case Qt::DisplayRole:
314 return coll->text();
315 case Qt::ToolTipRole: // fall through
316 case Qt::WhatsThisRole: {
317 if( d->mode & ToolTips )
318 return QString( "<qt><b>%1</b><br>%2</qt>" ).arg( coll->text() ).arg( coll->description() );
319 } break;
320 case Qt::CheckStateRole: {
321 if( d->mode & UserCheckable )
322 return coll->isEnabled() ? Qt::Checked : Qt::Unchecked;
323 } break;
324 default: break;
325 }
326 return QVariant();
327 }
328 }
329 return QVariant();
330}
331
332bool ActionCollectionModel::setData(const QModelIndex &index, const QVariant &value, int role)
333{
334 Q_UNUSED(value);
335 if( ! index.isValid() /*|| ! (d->mode & UserCheckable)*/ )
336 return false;
337
338 Action *act = action( index );
339 if ( act ) {
340 switch( role ) {
341 //case Qt::EditRole: act->setText( value.toString() ); break;
342 case Qt::CheckStateRole: act->setEnabled( ! act->isEnabled() ); break;
343 default: return false;
344 }
345 return false;
346 }
347 ActionCollection *coll = collection( index );
348 if ( coll ) {
349 switch( role ) {
350 //case Qt::EditRole: item->coll->setText( value.toString() ); break;
351 case Qt::CheckStateRole: coll->setEnabled( ! coll->isEnabled() ); break;
352 default: return false;
353 }
354 return false;
355 }
356 //emit dataChanged(index, index);
357 return true;
358}
359
360bool ActionCollectionModel::insertRows(int row, int count, const QModelIndex& parent)
361{
362 krossdebug( QString("ActionCollectionModel::insertRows: row=%1 count=%2").arg(row).arg(count) );
363 if( ! parent.isValid() )
364 return false;
365
366 ActionCollection* coll = collection( parent );
367 if ( coll ) {
368 krossdebug( QString( "ActionCollectionModel::insertRows: parentindex is ActionCollection with name=%1" ).arg( coll->name() ) );
369 } else {
370 Action *act = action( parent );
371 if ( act ) {
372 krossdebug( QString( "ActionCollectionModel::insertRows: parentindex is Action with name=%1" ).arg( act->name() ) );
373 }
374 }
375 return QAbstractItemModel::insertRows(row, count, parent);
376}
377
378bool ActionCollectionModel::removeRows(int row, int count, const QModelIndex& parent)
379{
380 krossdebug( QString("ActionCollectionModel::removeRows: row=%1 count=%2").arg(row).arg(count) );
381 return QAbstractItemModel::removeRows(row, count, parent);
382}
383
384bool ActionCollectionModel::insertColumns(int column, int count, const QModelIndex& parent)
385{
386 krossdebug( QString("ActionCollectionModel::insertColumns: column=%1 count=%2").arg(column).arg(count) );
387 return QAbstractItemModel::insertColumns(column, count, parent);
388}
389
390bool ActionCollectionModel::removeColumns(int column, int count, const QModelIndex& parent)
391{
392 krossdebug( QString("ActionCollectionModel::removeColumns: column=%1 count=%2").arg(column).arg(count) );
393 return QAbstractItemModel::removeColumns(column, count, parent);
394}
395
396QStringList ActionCollectionModel::mimeTypes() const
397{
398 //krossdebug( QString("ActionCollectionModel::mimeTypes") );
399 return QStringList() << "application/vnd.text.list";
400}
401
402QString fullPath(const QModelIndex& index)
403{
404 if( ! index.isValid() ) return QString();
405 QString n;
406 Action *a = ActionCollectionModel::action( index );
407 if ( a ) {
408 n = a->name();
409 } else {
410 ActionCollection *c = ActionCollectionModel::collection( index );
411 if ( c ) {
412 n = c->name() + '/';
413 if ( ! n.endsWith('/' ) )
414 n += '/';
415 }
416 }
417 ActionCollection* par = static_cast<ActionCollection*>( index.internalPointer() );
418 for ( ActionCollection *p = par; p != 0; p = par->parentCollection() ) {
419 QString s = p->name();
420 if ( ! s.endsWith( '/' ) ) {
421 s += '/';
422 }
423 n = s + n;
424 }
425 return n;
426}
427
428QMimeData* ActionCollectionModel::mimeData(const QModelIndexList& indexes) const
429{
430 //krossdebug( QString("ActionCollectionModel::mimeData") );
431 QMimeData* mimeData = new QMimeData();
432 QByteArray encodedData;
433
434 QDataStream stream(&encodedData, QIODevice::WriteOnly);
435 foreach(const QModelIndex &index, indexes) {
436 //if( ! index.isValid() ) continue;
437 //QString text = data(index, Qt::DisplayRole).toString();
438 QString path = fullPath(index);
439 if( ! path.isNull() )
440 stream << path;
441 }
442
443 mimeData->setData("application/vnd.text.list", encodedData);
444 return mimeData;
445}
446
447bool ActionCollectionModel::dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent)
448{
449 krossdebug( QString("ActionCollectionModel::dropMimeData: row=%1 col=%2").arg(row).arg(column) );
450 if( action == Qt::IgnoreAction ) return true;
451 if( ! data->hasFormat("application/vnd.text.list") ) return false;
452 if( column > 0 ) return false;
453
454 krossdebug( QString("ActionCollectionModel::dropMimeData: ENCODED DATA:") );
455 QByteArray encodedData = data->data("application/vnd.text.list");
456 QDataStream stream(&encodedData, QIODevice::ReadOnly);
457 QStringList newItems;
458 int rows = 0;
459 while( ! stream.atEnd() ) {
460 QString text;
461 stream >> text;
462 newItems << text;
463 krossdebug( QString(" %1 \"%2\"").arg(rows).arg(text) );
464 ++rows;
465 }
466
467 //FIXME: return false for now since insertRows/removeRows need to be implemented before!
468 //return false;
469
470 /*
471 int beginRow;
472 if( row != -1 )
473 beginRow = row;
474 else if( parent.isValid() )
475 beginRow = parent.row();
476 else
477 beginRow = rowCount( QModelIndex() );
478 krossdebug( QString("ActionCollectionModel::dropMimeData: beginRow=%1").arg(beginRow) );
479 */
480
481 QModelIndex targetindex = index( row, column, parent );
482 ActionCollection *coll = collection( targetindex );
483 if ( coll ) {
484 krossdebug( QString( "ActionCollectionModel::dropMimeData: parentindex is ActionCollection with name=%1" ).arg( coll->name() ) );
485 } else {
486 Action *act = this->action( targetindex );
487 if ( act ) {
488 krossdebug( QString( "ActionCollectionModel::dropMimeData: parentindex is Action with name=%1" ).arg( act->name() ) );
489 }
490 }
491 return false;
492 //return QAbstractItemModel::dropMimeData(data, action, row, column, parent);
493}
494
495Qt::DropActions ActionCollectionModel::supportedDropActions() const
496{
497 return Qt::CopyAction | Qt::MoveAction | Qt::TargetMoveAction;
498 //return Qt::CopyAction | Qt::MoveAction | Qt::TargetMoveAction | Qt::LinkAction;
499}
500
501/******************************************************************************
502 * ActionCollectionProxyModel
503 */
504
505ActionCollectionProxyModel::ActionCollectionProxyModel(QObject* parent, ActionCollectionModel* model)
506 : QSortFilterProxyModel(parent)
507{
508 setSourceModel( model ? model : new ActionCollectionModel(this) );
509 setFilterCaseSensitivity(Qt::CaseInsensitive);
510 setDynamicSortFilter(true);
511}
512
513ActionCollectionProxyModel::~ActionCollectionProxyModel()
514{
515}
516
517void ActionCollectionProxyModel::setSourceModel(QAbstractItemModel* sourceModel)
518{
519 Q_ASSERT( dynamic_cast< ActionCollectionModel* >(sourceModel) );
520 QSortFilterProxyModel::setSourceModel(sourceModel);
521}
522
523bool ActionCollectionProxyModel::filterAcceptsRow(int source_row, const QModelIndex& source_parent) const
524{
525 //krossdebug( QString( "ActionCollectionProxyModel::filterAcceptsRow: row=%1 parentrow=%2" ).arg( source_row ).arg( source_parent.row() ) );
526 QModelIndex index = sourceModel()->index(source_row, 0, source_parent);
527 if( ! index.isValid() )
528 return false;
529
530 Action *action = ActionCollectionModel::action( index );
531 if ( action ) {
532 return action->isEnabled() && QSortFilterProxyModel::filterAcceptsRow( source_row, source_parent );
533 }
534 ActionCollection *collection = ActionCollectionModel::collection( index );
535 if( collection ) {
536 return collection->isEnabled();
537 }
538 return true;
539}
540
541#include "model.moc"
action.h
actioncollection.h
KLocale::removeAcceleratorMarker
QString removeAcceleratorMarker(const QString &label) const
Kross::ActionCollectionModel
The ActionCollectionModel class implements a QAbstractItemModel to provide a model for views of a Act...
Definition: model.h:47
Kross::ActionCollectionModel::dropMimeData
virtual bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent)
Definition: model.cpp:447
Kross::ActionCollectionModel::supportedDropActions
virtual Qt::DropActions supportedDropActions() const
Definition: model.cpp:495
Kross::ActionCollectionModel::ActionCollectionModel
ActionCollectionModel(QObject *parent, ActionCollection *collection=0, Mode mode=Mode(Icons|ToolTips))
Definition: model.cpp:52
Kross::ActionCollectionModel::insertColumns
virtual bool insertColumns(int column, int count, const QModelIndex &parent=QModelIndex())
Definition: model.cpp:384
Kross::ActionCollectionModel::flags
virtual Qt::ItemFlags flags(const QModelIndex &index) const
Definition: model.cpp:259
Kross::ActionCollectionModel::indexForCollection
QModelIndex indexForCollection(ActionCollection *collection) const
Definition: model.cpp:95
Kross::ActionCollectionModel::mimeTypes
virtual QStringList mimeTypes() const
Definition: model.cpp:396
Kross::ActionCollectionModel::insertRows
virtual bool insertRows(int row, int count, const QModelIndex &parent=QModelIndex())
Definition: model.cpp:360
Kross::ActionCollectionModel::indexForAction
QModelIndex indexForAction(Action *action) const
Definition: model.cpp:103
Kross::ActionCollectionModel::removeRows
virtual bool removeRows(int row, int count, const QModelIndex &parent=QModelIndex())
Definition: model.cpp:378
Kross::ActionCollectionModel::Mode
Mode
Definition: model.h:50
Kross::ActionCollectionModel::UserCheckable
@ UserCheckable
Definition: model.h:54
Kross::ActionCollectionModel::ToolTips
@ ToolTips
Definition: model.h:53
Kross::ActionCollectionModel::Icons
@ Icons
Definition: model.h:52
Kross::ActionCollectionModel::columnCount
virtual int columnCount(const QModelIndex &parent=QModelIndex()) const
Definition: model.cpp:213
Kross::ActionCollectionModel::parent
virtual QModelIndex parent(const QModelIndex &index) const
Definition: model.cpp:246
Kross::ActionCollectionModel::removeColumns
virtual bool removeColumns(int column, int count, const QModelIndex &parent=QModelIndex())
Definition: model.cpp:390
Kross::ActionCollectionModel::rootCollection
ActionCollection * rootCollection() const
Return the root collection.
Definition: model.cpp:81
Kross::ActionCollectionModel::rowNumber
int rowNumber(ActionCollection *collection) const
Definition: model.cpp:86
Kross::ActionCollectionModel::collection
static ActionCollection * collection(const QModelIndex &index)
Definition: model.cpp:200
Kross::ActionCollectionModel::index
virtual QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const
Definition: model.cpp:233
Kross::ActionCollectionModel::mimeData
virtual QMimeData * mimeData(const QModelIndexList &indexes) const
Definition: model.cpp:428
Kross::ActionCollectionModel::setData
virtual bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole)
Definition: model.cpp:332
Kross::ActionCollectionModel::~ActionCollectionModel
virtual ~ActionCollectionModel()
Definition: model.cpp:76
Kross::ActionCollectionModel::data
virtual QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const
Definition: model.cpp:275
Kross::ActionCollectionModel::rowCount
virtual int rowCount(const QModelIndex &parent=QModelIndex()) const
Definition: model.cpp:218
Kross::ActionCollectionModel::action
static Action * action(const QModelIndex &index)
Definition: model.cpp:191
Kross::ActionCollectionProxyModel::~ActionCollectionProxyModel
virtual ~ActionCollectionProxyModel()
Definition: model.cpp:513
Kross::ActionCollectionProxyModel::ActionCollectionProxyModel
ActionCollectionProxyModel(QObject *parent, ActionCollectionModel *model=0)
Definition: model.cpp:505
Kross::ActionCollection
The ActionCollection class manages collections of Action instances.
Definition: actioncollection.h:46
Kross::ActionCollection::description
QString description() const
Definition: actioncollection.cpp:88
Kross::ActionCollection::name
QString name() const
Definition: actioncollection.cpp:83
Kross::ActionCollection::actions
QList< Action * > actions() const
Definition: actioncollection.cpp:163
Kross::ActionCollection::parentCollection
ActionCollection * parentCollection() const
Definition: actioncollection.cpp:98
Kross::ActionCollection::text
QString text() const
Definition: actioncollection.cpp:85
Kross::ActionCollection::isEnabled
bool isEnabled() const
Return the enable this ActionCollection has.
Definition: actioncollection.cpp:95
Kross::ActionCollection::setEnabled
void setEnabled(bool enabled)
Enable or disable this ActionCollection.
Definition: actioncollection.cpp:96
Kross::ActionCollection::iconName
QString iconName() const
Definition: actioncollection.cpp:91
Kross::ActionCollection::collection
ActionCollection * collection(const QString &name) const
Definition: actioncollection.cpp:128
Kross::ActionCollection::icon
QIcon icon() const
Definition: actioncollection.cpp:93
Kross::ActionCollection::collections
QStringList collections() const
Definition: actioncollection.cpp:133
Kross::Action
The Action class is an abstract container to deal with scripts like a single standalone script file.
Definition: action.h:99
Kross::Action::name
QString name() const
Kross::Action::description
QString description() const
Definition: action.cpp:281
Kross::Action::setEnabled
void setEnabled(bool enabled)
Set the enable state of this Action to enabled .
Definition: action.cpp:311
Kross::Action::isEnabled
bool isEnabled() const
Return true if this Action is enabled else false is returned.
Definition: action.cpp:306
Kross::Action::iconName
QString iconName() const
Return the name of the icon.
Definition: action.cpp:293
Kross::Action::file
QString file() const
Definition: action.cpp:351
Kross::Manager::self
static Manager & self()
Return the Manager instance.
Definition: manager.cpp:73
Kross::Manager::actionCollection
ActionCollection * actionCollection() const
Definition: manager.cpp:285
QAbstractItemModel
QObject
QSortFilterProxyModel
kWarning
#define kWarning
kdebug.h
kglobal.h
klocale.h
manager.h
fullPath
QString fullPath(const QModelIndex &index)
Definition: model.cpp:402
model.h
KGlobal::locale
KLocale * locale()
Kross
Definition: action.cpp:36
Kross::krossdebug
void krossdebug(const QString &s)
Debugging function.
Definition: krossconfig.cpp:28
Action
Action::name
QString name
Definition: action.cpp:271
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

Kross

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

kdelibs-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 API Reference"
  • 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
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