Qt 4.8
qidentityproxymodel.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Stephen Kelly <stephen.kelly@kdab.com>
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtGui module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 
42 #include "qidentityproxymodel.h"
43 
44 #ifndef QT_NO_IDENTITYPROXYMODEL
45 
46 #include "qitemselectionmodel.h"
47 #include <private/qabstractproxymodel_p.h>
48 
50 
52 {
56  {
57 
58  }
59 
61 
66 
67  void _q_sourceRowsAboutToBeInserted(const QModelIndex &parent, int start, int end);
68  void _q_sourceRowsInserted(const QModelIndex &parent, int start, int end);
69  void _q_sourceRowsAboutToBeRemoved(const QModelIndex &parent, int start, int end);
70  void _q_sourceRowsRemoved(const QModelIndex &parent, int start, int end);
71  void _q_sourceRowsAboutToBeMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destParent, int dest);
72  void _q_sourceRowsMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destParent, int dest);
73 
74  void _q_sourceColumnsAboutToBeInserted(const QModelIndex &parent, int start, int end);
75  void _q_sourceColumnsInserted(const QModelIndex &parent, int start, int end);
76  void _q_sourceColumnsAboutToBeRemoved(const QModelIndex &parent, int start, int end);
77  void _q_sourceColumnsRemoved(const QModelIndex &parent, int start, int end);
78  void _q_sourceColumnsAboutToBeMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destParent, int dest);
79  void _q_sourceColumnsMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destParent, int dest);
80 
81  void _q_sourceDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
82  void _q_sourceHeaderDataChanged(Qt::Orientation orientation, int first, int last);
83 
87  void _q_sourceModelReset();
88 
89 };
90 
122 {
123 
124 }
125 
129  : QAbstractProxyModel(dd, parent)
130 {
131 
132 }
133 
138 {
139 }
140 
145 {
146  Q_ASSERT(parent.isValid() ? parent.model() == this : true);
147  Q_D(const QIdentityProxyModel);
148  return d->model->columnCount(mapToSource(parent));
149 }
150 
154 bool QIdentityProxyModel::dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent)
155 {
156  Q_ASSERT(parent.isValid() ? parent.model() == this : true);
158  return d->model->dropMimeData(data, action, row, column, mapToSource(parent));
159 }
160 
164 QModelIndex QIdentityProxyModel::index(int row, int column, const QModelIndex& parent) const
165 {
166  Q_ASSERT(parent.isValid() ? parent.model() == this : true);
167  Q_D(const QIdentityProxyModel);
168  if (!hasIndex(row, column, parent))
169  return QModelIndex();
170  const QModelIndex sourceParent = mapToSource(parent);
171  const QModelIndex sourceIndex = d->model->index(row, column, sourceParent);
172  Q_ASSERT(sourceIndex.isValid());
173  return mapFromSource(sourceIndex);
174 }
175 
179 bool QIdentityProxyModel::insertColumns(int column, int count, const QModelIndex& parent)
180 {
181  Q_ASSERT(parent.isValid() ? parent.model() == this : true);
183  return d->model->insertColumns(column, count, mapToSource(parent));
184 }
185 
189 bool QIdentityProxyModel::insertRows(int row, int count, const QModelIndex& parent)
190 {
191  Q_ASSERT(parent.isValid() ? parent.model() == this : true);
193  return d->model->insertRows(row, count, mapToSource(parent));
194 }
195 
200 {
201  Q_D(const QIdentityProxyModel);
202  if (!d->model || !sourceIndex.isValid())
203  return QModelIndex();
204 
205  Q_ASSERT(sourceIndex.model() == d->model);
206  return createIndex(sourceIndex.row(), sourceIndex.column(), sourceIndex.internalPointer());
207 }
208 
213 {
214  Q_D(const QIdentityProxyModel);
215  QItemSelection proxySelection;
216 
217  if (!d->model)
218  return proxySelection;
219 
221  const QItemSelection::const_iterator end = selection.constEnd();
222  for ( ; it != end; ++it) {
223  Q_ASSERT(it->model() == d->model);
224  const QItemSelectionRange range(mapFromSource(it->topLeft()), mapFromSource(it->bottomRight()));
225  proxySelection.append(range);
226  }
227 
228  return proxySelection;
229 }
230 
235 {
236  Q_D(const QIdentityProxyModel);
237  QItemSelection sourceSelection;
238 
239  if (!d->model)
240  return sourceSelection;
241 
243  const QItemSelection::const_iterator end = selection.constEnd();
244  for ( ; it != end; ++it) {
245  Q_ASSERT(it->model() == this);
246  const QItemSelectionRange range(mapToSource(it->topLeft()), mapToSource(it->bottomRight()));
247  sourceSelection.append(range);
248  }
249 
250  return sourceSelection;
251 }
252 
257 {
258  Q_D(const QIdentityProxyModel);
259  if (!d->model || !proxyIndex.isValid())
260  return QModelIndex();
261  Q_ASSERT(proxyIndex.model() == this);
262  return d->model->createIndex(proxyIndex.row(), proxyIndex.column(), proxyIndex.internalPointer());
263 }
264 
268 QModelIndexList QIdentityProxyModel::match(const QModelIndex& start, int role, const QVariant& value, int hits, Qt::MatchFlags flags) const
269 {
270  Q_D(const QIdentityProxyModel);
271  Q_ASSERT(start.isValid() ? start.model() == this : true);
272  if (!d->model)
273  return QModelIndexList();
274 
275  const QModelIndexList sourceList = d->model->match(mapToSource(start), role, value, hits, flags);
277  const QModelIndexList::const_iterator end = sourceList.constEnd();
278  QModelIndexList proxyList;
279  for ( ; it != end; ++it)
280  proxyList.append(mapFromSource(*it));
281  return proxyList;
282 }
283 
288 {
289  Q_ASSERT(child.isValid() ? child.model() == this : true);
290  const QModelIndex sourceIndex = mapToSource(child);
291  const QModelIndex sourceParent = sourceIndex.parent();
292  return mapFromSource(sourceParent);
293 }
294 
298 bool QIdentityProxyModel::removeColumns(int column, int count, const QModelIndex& parent)
299 {
300  Q_ASSERT(parent.isValid() ? parent.model() == this : true);
302  return d->model->removeColumns(column, count, mapToSource(parent));
303 }
304 
308 bool QIdentityProxyModel::removeRows(int row, int count, const QModelIndex& parent)
309 {
310  Q_ASSERT(parent.isValid() ? parent.model() == this : true);
312  return d->model->removeRows(row, count, mapToSource(parent));
313 }
314 
319 {
320  Q_ASSERT(parent.isValid() ? parent.model() == this : true);
321  Q_D(const QIdentityProxyModel);
322  return d->model->rowCount(mapToSource(parent));
323 }
324 
329 {
330  beginResetModel();
331 
332  if (sourceModel()) {
334  this, SLOT(_q_sourceRowsAboutToBeInserted(const QModelIndex &, int, int)));
335  disconnect(sourceModel(), SIGNAL(rowsInserted(const QModelIndex &, int, int)),
336  this, SLOT(_q_sourceRowsInserted(const QModelIndex &, int, int)));
338  this, SLOT(_q_sourceRowsAboutToBeRemoved(const QModelIndex &, int, int)));
339  disconnect(sourceModel(), SIGNAL(rowsRemoved(const QModelIndex &, int, int)),
340  this, SLOT(_q_sourceRowsRemoved(const QModelIndex &, int, int)));
341  disconnect(sourceModel(), SIGNAL(rowsAboutToBeMoved(const QModelIndex &, int, int, const QModelIndex &, int)),
342  this, SLOT(_q_sourceRowsAboutToBeMoved(const QModelIndex &, int, int, const QModelIndex &, int)));
343  disconnect(sourceModel(), SIGNAL(rowsMoved(const QModelIndex &, int, int, const QModelIndex &, int)),
344  this, SLOT(_q_sourceRowsMoved(const QModelIndex &, int, int, const QModelIndex &, int)));
346  this, SLOT(_q_sourceColumnsAboutToBeInserted(const QModelIndex &, int, int)));
348  this, SLOT(_q_sourceColumnsInserted(const QModelIndex &, int, int)));
350  this, SLOT(_q_sourceColumnsAboutToBeRemoved(const QModelIndex &, int, int)));
351  disconnect(sourceModel(), SIGNAL(columnsRemoved(const QModelIndex &, int, int)),
352  this, SLOT(_q_sourceColumnsRemoved(const QModelIndex &, int, int)));
353  disconnect(sourceModel(), SIGNAL(columnsAboutToBeMoved(const QModelIndex &, int, int, const QModelIndex &, int)),
354  this, SLOT(_q_sourceColumnsAboutToBeMoved(const QModelIndex &, int, int, const QModelIndex &, int)));
355  disconnect(sourceModel(), SIGNAL(columnsMoved(const QModelIndex &, int, int, const QModelIndex &, int)),
356  this, SLOT(_q_sourceColumnsMoved(const QModelIndex &, int, int, const QModelIndex &, int)));
358  this, SLOT(_q_sourceModelAboutToBeReset()));
360  this, SLOT(_q_sourceModelReset()));
362  this, SLOT(_q_sourceDataChanged(const QModelIndex &, const QModelIndex &)));
364  this, SLOT(_q_sourceHeaderDataChanged(Qt::Orientation,int,int)));
366  this, SLOT(_q_sourceLayoutAboutToBeChanged()));
368  this, SLOT(_q_sourceLayoutChanged()));
369  }
370 
371  QAbstractProxyModel::setSourceModel(newSourceModel);
372 
373  if (sourceModel()) {
375  SLOT(_q_sourceRowsAboutToBeInserted(const QModelIndex &, int, int)));
376  connect(sourceModel(), SIGNAL(rowsInserted(const QModelIndex &, int, int)),
377  SLOT(_q_sourceRowsInserted(const QModelIndex &, int, int)));
379  SLOT(_q_sourceRowsAboutToBeRemoved(const QModelIndex &, int, int)));
380  connect(sourceModel(), SIGNAL(rowsRemoved(const QModelIndex &, int, int)),
381  SLOT(_q_sourceRowsRemoved(const QModelIndex &, int, int)));
382  connect(sourceModel(), SIGNAL(rowsAboutToBeMoved(const QModelIndex &, int, int, const QModelIndex &, int)),
383  SLOT(_q_sourceRowsAboutToBeMoved(const QModelIndex &, int, int, const QModelIndex &, int)));
384  connect(sourceModel(), SIGNAL(rowsMoved(const QModelIndex &, int, int, const QModelIndex &, int)),
385  SLOT(_q_sourceRowsMoved(const QModelIndex &, int, int, const QModelIndex &, int)));
387  SLOT(_q_sourceColumnsAboutToBeInserted(const QModelIndex &, int, int)));
388  connect(sourceModel(), SIGNAL(columnsInserted(const QModelIndex &, int, int)),
389  SLOT(_q_sourceColumnsInserted(const QModelIndex &, int, int)));
391  SLOT(_q_sourceColumnsAboutToBeRemoved(const QModelIndex &, int, int)));
392  connect(sourceModel(), SIGNAL(columnsRemoved(const QModelIndex &, int, int)),
393  SLOT(_q_sourceColumnsRemoved(const QModelIndex &, int, int)));
394  connect(sourceModel(), SIGNAL(columnsAboutToBeMoved(const QModelIndex &, int, int, const QModelIndex &, int)),
395  SLOT(_q_sourceColumnsAboutToBeMoved(const QModelIndex &, int, int, const QModelIndex &, int)));
396  connect(sourceModel(), SIGNAL(columnsMoved(const QModelIndex &, int, int, const QModelIndex &, int)),
397  SLOT(_q_sourceColumnsMoved(const QModelIndex &, int, int, const QModelIndex &, int)));
399  SLOT(_q_sourceModelAboutToBeReset()));
401  SLOT(_q_sourceModelReset()));
403  SLOT(_q_sourceDataChanged(const QModelIndex &, const QModelIndex &)));
405  SLOT(_q_sourceHeaderDataChanged(Qt::Orientation,int,int)));
407  SLOT(_q_sourceLayoutAboutToBeChanged()));
409  SLOT(_q_sourceLayoutChanged()));
410  }
411 
412  endResetModel();
413 }
414 
416 {
417  Q_ASSERT(parent.isValid() ? parent.model() == model : true);
419  q->beginInsertColumns(q->mapFromSource(parent), start, end);
420 }
421 
422 void QIdentityProxyModelPrivate::_q_sourceColumnsAboutToBeMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destParent, int dest)
423 {
424  Q_ASSERT(sourceParent.isValid() ? sourceParent.model() == model : true);
425  Q_ASSERT(destParent.isValid() ? destParent.model() == model : true);
427  q->beginMoveColumns(q->mapFromSource(sourceParent), sourceStart, sourceEnd, q->mapFromSource(destParent), dest);
428 }
429 
431 {
432  Q_ASSERT(parent.isValid() ? parent.model() == model : true);
434  q->beginRemoveColumns(q->mapFromSource(parent), start, end);
435 }
436 
438 {
439  Q_ASSERT(parent.isValid() ? parent.model() == model : true);
441  Q_UNUSED(parent)
442  Q_UNUSED(start)
443  Q_UNUSED(end)
444  q->endInsertColumns();
445 }
446 
447 void QIdentityProxyModelPrivate::_q_sourceColumnsMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destParent, int dest)
448 {
449  Q_ASSERT(sourceParent.isValid() ? sourceParent.model() == model : true);
450  Q_ASSERT(destParent.isValid() ? destParent.model() == model : true);
452  Q_UNUSED(sourceParent)
453  Q_UNUSED(sourceStart)
454  Q_UNUSED(sourceEnd)
455  Q_UNUSED(destParent)
456  Q_UNUSED(dest)
457  q->endMoveColumns();
458 }
459 
461 {
462  Q_ASSERT(parent.isValid() ? parent.model() == model : true);
464  Q_UNUSED(parent)
465  Q_UNUSED(start)
466  Q_UNUSED(end)
467  q->endRemoveColumns();
468 }
469 
471 {
472  Q_ASSERT(topLeft.isValid() ? topLeft.model() == model : true);
473  Q_ASSERT(bottomRight.isValid() ? bottomRight.model() == model : true);
475  q->dataChanged(q->mapFromSource(topLeft), q->mapFromSource(bottomRight));
476 }
477 
479 {
481  q->headerDataChanged(orientation, first, last);
482 }
483 
485 {
486  if (ignoreNextLayoutAboutToBeChanged)
487  return;
488 
490 
491  foreach(const QPersistentModelIndex &proxyPersistentIndex, q->persistentIndexList()) {
492  proxyIndexes << proxyPersistentIndex;
493  Q_ASSERT(proxyPersistentIndex.isValid());
494  const QPersistentModelIndex srcPersistentIndex = q->mapToSource(proxyPersistentIndex);
495  Q_ASSERT(srcPersistentIndex.isValid());
496  layoutChangePersistentIndexes << srcPersistentIndex;
497  }
498 
499  q->layoutAboutToBeChanged();
500 }
501 
503 {
504  if (ignoreNextLayoutChanged)
505  return;
506 
508 
509  for (int i = 0; i < proxyIndexes.size(); ++i) {
510  q->changePersistentIndex(proxyIndexes.at(i), q->mapFromSource(layoutChangePersistentIndexes.at(i)));
511  }
512 
513  layoutChangePersistentIndexes.clear();
514  proxyIndexes.clear();
515 
516  q->layoutChanged();
517 }
518 
520 {
522  q->beginResetModel();
523 }
524 
526 {
528  q->endResetModel();
529 }
530 
532 {
533  Q_ASSERT(parent.isValid() ? parent.model() == model : true);
535  q->beginInsertRows(q->mapFromSource(parent), start, end);
536 }
537 
538 void QIdentityProxyModelPrivate::_q_sourceRowsAboutToBeMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destParent, int dest)
539 {
540  Q_ASSERT(sourceParent.isValid() ? sourceParent.model() == model : true);
541  Q_ASSERT(destParent.isValid() ? destParent.model() == model : true);
543  q->beginMoveRows(q->mapFromSource(sourceParent), sourceStart, sourceEnd, q->mapFromSource(destParent), dest);
544 }
545 
547 {
548  Q_ASSERT(parent.isValid() ? parent.model() == model : true);
550  q->beginRemoveRows(q->mapFromSource(parent), start, end);
551 }
552 
554 {
555  Q_ASSERT(parent.isValid() ? parent.model() == model : true);
557  Q_UNUSED(parent)
558  Q_UNUSED(start)
559  Q_UNUSED(end)
560  q->endInsertRows();
561 }
562 
563 void QIdentityProxyModelPrivate::_q_sourceRowsMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destParent, int dest)
564 {
565  Q_ASSERT(sourceParent.isValid() ? sourceParent.model() == model : true);
566  Q_ASSERT(destParent.isValid() ? destParent.model() == model : true);
568  Q_UNUSED(sourceParent)
569  Q_UNUSED(sourceStart)
570  Q_UNUSED(sourceEnd)
571  Q_UNUSED(destParent)
572  Q_UNUSED(dest)
573  q->endMoveRows();
574 }
575 
577 {
578  Q_ASSERT(parent.isValid() ? parent.model() == model : true);
580  Q_UNUSED(parent)
581  Q_UNUSED(start)
582  Q_UNUSED(end)
583  q->endRemoveRows();
584 }
585 
587 
588 #include "moc_qidentityproxymodel.cpp"
589 
590 #endif // QT_NO_IDENTITYPROXYMODEL
The QVariant class acts like a union for the most common Qt data types.
Definition: qvariant.h:92
double d
Definition: qnumeric_p.h:62
void * internalPointer() const
Returns a void * pointer used by the model to associate the index with the internal data structure...
void _q_sourceRowsAboutToBeInserted(const QModelIndex &parent, int start, int end)
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
bool removeRows(int row, int count, const QModelIndex &parent=QModelIndex())
Reimplemented Function
#define it(className, varName)
void _q_sourceColumnsAboutToBeMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destParent, int dest)
QList< QPersistentModelIndex > layoutChangePersistentIndexes
void _q_sourceHeaderDataChanged(Qt::Orientation orientation, int first, int last)
void _q_sourceColumnsRemoved(const QModelIndex &parent, int start, int end)
QItemSelection mapSelectionFromSource(const QItemSelection &selection) const
Reimplemented Function
bool removeColumns(int column, int count, const QModelIndex &parent=QModelIndex())
Reimplemented Function
virtual void setSourceModel(QAbstractItemModel *sourceModel)
Sets the given sourceModel to be processed by the proxy model.
#define SLOT(a)
Definition: qobjectdefs.h:226
The QItemSelectionRange class manages information about a range of selected items in a model...
const_iterator constBegin() const
Returns a const STL-style iterator pointing to the first item in the list.
Definition: qlist.h:269
void columnsInserted(const QModelIndex &parent, int first, int last)
This signal is emitted after columns have been inserted into the model.
QModelIndex createIndex(int row, int column, void *data=0) const
Creates a model index for the given row and column with the internal pointer ptr. ...
bool insertRows(int row, int count, const QModelIndex &parent=QModelIndex())
Reimplemented Function
bool hasIndex(int row, int column, const QModelIndex &parent=QModelIndex()) const
Returns true if the model returns a valid QModelIndex for row and column with parent, otherwise returns false.
bool insertColumns(int column, int count, const QModelIndex &parent=QModelIndex())
Reimplemented Function
void columnsAboutToBeMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationColumn)
This signal is emitted just before columns are moved within the model.
void _q_sourceRowsAboutToBeRemoved(const QModelIndex &parent, int start, int end)
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
The QObject class is the base class of all Qt objects.
Definition: qobject.h:111
void rowsAboutToBeMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationRow)
This signal is emitted just before rows are moved within the model.
#define Q_D(Class)
Definition: qglobal.h:2482
~QIdentityProxyModel()
Destroys this identity model.
void _q_sourceRowsAboutToBeMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destParent, int dest)
void endResetModel()
Completes a model reset operation.
QModelIndex parent() const
Returns the parent of the model index, or QModelIndex() if it has no parent.
void _q_sourceRowsInserted(const QModelIndex &parent, int start, int end)
#define Q_Q(Class)
Definition: qglobal.h:2483
#define SIGNAL(a)
Definition: qobjectdefs.h:227
void columnsAboutToBeInserted(const QModelIndex &parent, int first, int last)
This signal is emitted just before columns are inserted into the model.
friend class const_iterator
Definition: qlist.h:264
void append(const T &t)
Inserts value at the end of the list.
Definition: qlist.h:507
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
void rowsMoved(const QModelIndex &parent, int start, int end, const QModelIndex &destination, int row)
This signal is emitted after rows have been moved within the model.
void layoutAboutToBeChanged()
This signal is emitted just before the layout of a model is changed.
QAbstractItemModel * sourceModel() const
Returns the model that contains the data that is available through the proxy model.
static bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
Creates a connection of the given type from the signal in the sender object to the method in the rece...
Definition: qobject.cpp:2580
void rowsAboutToBeInserted(const QModelIndex &parent, int first, int last)
This signal is emitted just before rows are inserted into the model.
int row() const
Returns the row this model index refers to.
const QAbstractItemModel * model() const
Returns a pointer to the model containing the item that this index refers to.
bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent)
Reimplemented Function
void _q_sourceDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
void modelAboutToBeReset()
This signal is emitted when reset() is called, before the model&#39;s internal state (e.
DropAction
Definition: qnamespace.h:1597
void layoutChanged()
This signal is emitted whenever the layout of items exposed by the model has changed; for example...
void _q_sourceRowsRemoved(const QModelIndex &parent, int start, int end)
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const
Reimplemented Function
The QMimeData class provides a container for data that records information about its MIME type...
Definition: qmimedata.h:57
void _q_sourceRowsMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destParent, int dest)
bool isValid() const
Returns true if this model index is valid; otherwise returns false.
The QAbstractItemModel class provides the abstract interface for item model classes.
The QAbstractProxyModel class provides a base class for proxy item models that can do sorting...
QModelIndex mapToSource(const QModelIndex &proxyIndex) const
Reimplemented Function
void columnsAboutToBeRemoved(const QModelIndex &parent, int first, int last)
This signal is emitted just before columns are removed from the model.
QList< QModelIndex > QModelIndexList
static bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *member)
Disconnects signal in object sender from method in object receiver.
Definition: qobject.cpp:2895
void _q_sourceColumnsMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destParent, int dest)
#define Q_DECLARE_PUBLIC(Class)
Definition: qglobal.h:2477
The QItemSelection class manages information about selected items in a model.
void setSourceModel(QAbstractItemModel *sourceModel)
Reimplemented Function
void headerDataChanged(Qt::Orientation orientation, int first, int last)
This signal is emitted whenever a header is changed.
The QPersistentModelIndex class is used to locate data in a data model.
void rowsInserted(const QModelIndex &parent, int first, int last)
This signal is emitted after rows have been inserted into the model.
QVariant data(const QModelIndex &proxyIndex, int role=Qt::DisplayRole) const
Reimplemented Function
int rowCount(const QModelIndex &parent=QModelIndex()) const
Reimplemented Function
QIdentityProxyModel(QObject *parent=0)
Constructs an identity model with the given parent.
QObject * parent() const
Returns a pointer to the parent object.
Definition: qobject.h:273
The QModelIndex class is used to locate data in a data model.
void modelReset()
This signal is emitted when reset() is called, after the model&#39;s internal state (e.
void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
This signal is emitted whenever the data in an existing item changes.
Definition: qnamespace.h:54
The QIdentityProxyModel class proxies its source model unmodified.
QModelIndex mapFromSource(const QModelIndex &sourceIndex) const
Reimplemented Function
QObject * parent
Definition: qobject.h:92
Qt::ItemFlags flags(const QModelIndex &index) const
Reimplemented Function
void _q_sourceColumnsAboutToBeRemoved(const QModelIndex &parent, int start, int end)
void _q_sourceColumnsInserted(const QModelIndex &parent, int start, int end)
static const KeyPair *const end
void rowsAboutToBeRemoved(const QModelIndex &parent, int first, int last)
This signal is emitted just before rows are removed from the model.
int columnCount(const QModelIndex &parent=QModelIndex()) const
Reimplemented Function
Orientation
Definition: qnamespace.h:174
void rowsRemoved(const QModelIndex &parent, int first, int last)
This signal is emitted after rows have been removed from the model.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729
void columnsMoved(const QModelIndex &parent, int start, int end, const QModelIndex &destination, int column)
This signal is emitted after columns have been moved within the model.
void columnsRemoved(const QModelIndex &parent, int first, int last)
This signal is emitted after columns have been removed from the model.
void beginResetModel()
Begins a model reset operation.
QItemSelection mapSelectionToSource(const QItemSelection &selection) const
Reimplemented Function
QModelIndexList match(const QModelIndex &start, int role, const QVariant &value, int hits=1, Qt::MatchFlags flags=Qt::MatchFlags(Qt::MatchStartsWith|Qt::MatchWrap)) const
Reimplemented Function
void _q_sourceColumnsAboutToBeInserted(const QModelIndex &parent, int start, int end)
int column() const
Returns the column this model index refers to.
The QList class is a template class that provides lists.
Definition: qdatastream.h:62
const_iterator constEnd() const
Returns a const STL-style iterator pointing to the imaginary item after the last item in the list...
Definition: qlist.h:272