Ignore:
Timestamp:
Feb 11, 2010, 11:19:06 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.1 sources.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/corelib/kernel/qabstractitemmodel.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    56**
    67** This file is part of the QtCore module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    252252    Returns true if this persistent model index refers to the same location as
    253253    the \a other model index; otherwise returns false.
    254     Note that all values in the persistent model index are used when comparing
    255     with another model index.
     254
     255    All values in the persistent model index are used when comparing with
     256    another model index.
    256257*/
    257258
     
    336337
    337338/*!
    338   Returns the parent QModelIndex for this persistent index, or
    339   QModelIndex() if it has no parent.
    340 
    341   \sa child() sibling() model()
     339 
     340  if it has no parent.
     341
     342  \sa child() sibling() model()
    342343*/
    343344QModelIndex QPersistentModelIndex::parent() const
     
    349350
    350351/*!
    351   Returns the sibling at \a row and \a column or an invalid
    352   QModelIndex if there is no sibling at this position.
    353 
    354   \sa parent() child()
     352 
     353  there is no sibling at this position.
     354
     355  \sa parent() child()
    355356*/
    356357
     
    363364
    364365/*!
    365   Returns the child of the model index that is stored in the given
    366   \a row and \a column.
    367 
    368   \sa parent() sibling()
     366 
     367  and \a column.
     368
     369  \sa parent() sibling()
    369370*/
    370371
     
    377378
    378379/*!
    379   Returns the data for the given \a role for the item referred to by the index.
    380 
    381   \sa Qt::ItemDataRole, QAbstractItemModel::setData()
     380    Returns the data for the given \a role for the item referred to by the
     381    index.
     382
     383    \sa Qt::ItemDataRole, QAbstractItemModel::setData()
    382384*/
    383385QVariant QPersistentModelIndex::data(int role) const
     
    389391
    390392/*!
    391   \since 4.2
    392 
    393   Returns the flags for the item referred to by the index.
     393  \since 4.2
     394
     395  Returns the flags for the item referred to by the index.
    394396*/
    395397Qt::ItemFlags QPersistentModelIndex::flags() const
     
    401403
    402404/*!
    403   Returns the model that the index belongs to.
     405  Returns the model that the index belongs to.
    404406*/
    405407const QAbstractItemModel *QPersistentModelIndex::model() const
     
    415417    Returns true if this persistent model index is valid; otherwise returns
    416418    false.
    417     A valid index belongs to a model, and has non-negative row and column numbers.
     419
     420    A valid index belongs to a model, and has non-negative row and column
     421    numbers.
    418422
    419423    \sa model(), row(), column()
     
    429433{
    430434#ifndef Q_BROKEN_DEBUG_STREAM
    431     dbg.nospace() << "QModelIndex(" << idx.row() << "," << idx.column()
    432                   << "," << idx.internalPointer() << "," << idx.model() << ")";
     435    dbg.nospace() << "QModelIndex(" << idx.row() << << idx.column()
     436                  << ;
    433437    return dbg.space();
    434438#else
     
    466470{
    467471    return qEmptyModel();
     472
     473
     474
     475
     476
     477
     478
     479
     480
     481
     482
     483
     484
     485
     486
     487
     488
     489
     490
     491
     492
     493
     494
     495
     496
     497
     498
     499
     500
     501
     502
     503
     504
     505
     506
     507
     508
     509
     510
     511
     512
     513
     514
     515
     516
     517
     518
     519
     520
     521
     522
     523
     524
     525
     526
     527
     528
     529
     530
     531
     532
     533
     534
     535
     536
    468537}
    469538
     
    526595            persistent.insertMultiAtEnd(data->index, data);
    527596        } else {
    528             qWarning() << "QAbstractItemModel::endInsertRows:  Invalid index (" << old.row() + count << "," << old.column() << ") in model" << q_func();
     597            qWarning() << "QAbstractItemModel::endInsertRows:  Invalid index (" << old.row() + count << << old.column() << ") in model" << q_func();
    529598        }
    530599    }
     600
     601
     602
     603
     604
     605
     606
     607
     608
     609
     610
     611
     612
     613
     614
     615
     616
     617
     618
     619
     620
     621
     622
     623
     624
     625
     626
     627
     628
     629
     630
     631
     632
     633
     634
     635
     636
     637
     638
     639
     640
     641
     642
     643
     644
     645
     646
     647
     648
     649
     650
     651
     652
     653
     654
     655
     656
     657
     658
     659
     660
     661
     662
     663
     664
     665
     666
     667
     668
     669
     670
     671
     672
     673
     674
     675
     676
     677
     678
     679
     680
     681
     682
     683
     684
     685
     686
     687
     688
     689
     690
     691
     692
     693
     694
     695
     696
     697
     698
     699
     700
     701
     702
     703
     704
     705
     706
     707
     708
     709
     710
    531711}
    532712
     
    575755            persistent.insertMultiAtEnd(data->index, data);
    576756        } else {
    577             qWarning() << "QAbstractItemModel::endRemoveRows:  Invalid index (" << old.row() - count << "," << old.column() << ") in model" << q_func();
     757            qWarning() << "QAbstractItemModel::endRemoveRows:  Invalid index (" << old.row() - count << << old.column() << ") in model" << q_func();
    578758        }
    579759    }
     
    620800            persistent.insertMultiAtEnd(data->index, data);
    621801        } else {
    622             qWarning() << "QAbstractItemModel::endInsertColumns:  Invalid index (" << old.row() << "," << old.column() + count << ") in model" << q_func();
     802            qWarning() << "QAbstractItemModel::endInsertColumns:  Invalid index (" << old.row() << << old.column() + count << ") in model" << q_func();
    623803        }
    624804     }
     
    670850            persistent.insertMultiAtEnd(data->index, data);
    671851        } else {
    672             qWarning() << "QAbstractItemModel::endRemoveColumns:  Invalid index (" << old.row() << "," << old.column() - count << ") in model" << q_func();
     852            qWarning() << "QAbstractItemModel::endRemoveColumns:  Invalid index (" << old.row() << << old.column() - count << ") in model" << q_func();
    673853        }
    674854    }
     
    689869
    690870    \ingroup model-view
    691     \mainclass
     871
    692872
    693873    This class is used as an index into item models derived from
     
    696876
    697877    New QModelIndex objects are created by the model using the
    698     QAbstractItemModel::createIndex() function. An \e invalid model index
    699     can be constructed with the QModelIndex constructor. Invalid indexes are
    700     often used as parent indexes when referring to top-level items in a model.
     878    QAbstractItemModel::createIndex() function. An \e invalid model index
     879   
     880    used as parent indexes when referring to top-level items in a model.
    701881
    702882    Model indexes refer to items in models, and contain all the information
    703883    required to specify their locations in those models. Each index is located
    704     in a given row and column, and may have a parent index; use row(), column(),
    705     and parent() to obtain this information. Each top-level item in a model is
    706     represented by a model index that does not have a parent index - in this
    707     case, parent() will return an invalid model index, equivalent to an index
    708     constructed with the zero argument form of the QModelIndex() constructor.
     884    in a given row and column, and may have a parent index; use row(),
     885    column(), and parent() to obtain this information. Each top-level item in a
     886    model is represented by a model index that does not have a parent index -
     887    in this case, parent() will return an invalid model index, equivalent to an
     888    index constructed with the zero argument form of the QModelIndex()
     889    constructor.
    709890
    710891    To obtain a model index that refers to an existing item in a model, call
    711     QAbstractItemModel::index() with the required row and column
    712     values, and the model index of the parent. When referring to
    713     top-level items in a model, supply QModelIndex() as the parent index.
     892    QAbstractItemModel::index() with the required row and column
     893   
     894    model, supply QModelIndex() as the parent index.
    714895
    715896    The model() function returns the model that the index references as a
    716     QAbstractItemModel.
    717     The child() function is used to examine the items held beneath the index
    718     in the model.
    719     The sibling() function allows you to traverse items in the model on the
    720     same level as the index.
     897    QAbstractItemModel. The child() function is used to examine items held
     898    under the index in the model. The sibling() function allows you to traverse
     899    items in the model on the same level as the index.
    721900
    722901    \note Model indexes should be used immediately and then discarded. You
     
    725904    keep a model index over time use a QPersistentModelIndex.
    726905
    727     \sa \link model-view-programming.html Model/View Programming\endlink QPersistentModelIndex QAbstractItemModel
     906    \sa QAbstractItemModel
    728907*/
    729908
     
    731910    \fn QModelIndex::QModelIndex()
    732911
    733     Creates a new empty model index.
    734     This type of model index is used to indicate
    735     that the position in the model is invalid.
     912    Creates a new empty model index. This type of model index is used to
     913    indicate that the position in the model is invalid.
    736914
    737915    \sa isValid() QAbstractItemModel
     
    796974
    797975    Returns true if this model index is valid; otherwise returns false.
    798     A valid index belongs to a model, and has non-negative row and column numbers.
     976
     977    A valid index belongs to a model, and has non-negative row and column
     978    numbers.
    799979
    800980    \sa model(), row(), column()
     
    807987    refers to.
    808988
    809     You receive a const pointer to the model because calls to
    810     non-const functions of the model might invalidate the model index
    811     - and possibly crash your application.
     989   
     990   
     991    crash your application.
    812992*/
    813993
     
    815995    \fn QModelIndex QModelIndex::sibling(int row, int column) const
    816996
    817     Returns the sibling at \a row and \a column or an invalid
    818     QModelIndex if there is no sibling at this position.
    819 
    820     \sa parent() child()
     997    Returns the sibling at \a row and \a column
     998    .
     999
     1000    \sa parent() child()
    8211001*/
    8221002
     
    8241004    \fn QModelIndex QModelIndex::child(int row, int column) const
    8251005
    826     Returns the child of the model index that is stored in the given
    827     \a row and \a column.
    828 
    829     \sa parent() sibling()
     1006    Returns the child of the model index that is stored in the given
     1007    \a column.
     1008
     1009    \sa parent() sibling()
    8301010*/
    8311011
     
    8331013    \fn QVariant QModelIndex::data(int role) const
    8341014
    835     Returns the data for the given \a role for the item referred to by the index.
     1015    Returns the data for the given \a role for the item referred to by the
     1016    index.
    8361017*/
    8371018
     
    8461027    \fn bool QModelIndex::operator==(const QModelIndex &other) const
    8471028
    848     Returns true if this model index refers to the same location as
     1029    Returns true if this model index refers to the same location as the
     1030    \a other model index; otherwise returns false.
     1031
     1032    All values in the model index are used when comparing with another model
     1033    index.
     1034*/
     1035
     1036
     1037/*!
     1038    \fn bool QModelIndex::operator!=(const QModelIndex &other) const
     1039
     1040    Returns true if this model index does not refer to the same location as
    8491041    the \a other model index; otherwise returns false.
    850     Note that all values in the model index are used when comparing
    851     with another model index.
    852 */
    853 
    854 
    855 /*!
    856     \fn bool QModelIndex::operator!=(const QModelIndex &other) const
    857 
    858     Returns true if this model index does not refer to the same
    859     location as the \a other model index; otherwise returns false.
    860 */
    861 
    862 
    863 /*!
    864   \fn QModelIndex QModelIndex::parent() const
    865 
    866   Returns the parent of the model index, or QModelIndex() if it has no
    867   parent.
    868 
    869   \sa child() sibling() model()
     1042*/
     1043
     1044
     1045/*!
     1046    \fn QModelIndex QModelIndex::parent() const
     1047
     1048    Returns the parent of the model index, or QModelIndex() if it has no
     1049    parent.
     1050
     1051    \sa child(), sibling(), model()
    8701052*/
    8711053
     
    8771059
    8781060    \ingroup model-view
    879     \mainclass
     1061
    8801062
    8811063    The QAbstractItemModel class defines the standard interface that item
     
    8961078    a QModelIndex.
    8971079
    898     \img modelindex-no-parent.png
     1080    \im modelindex-no-parent.png
    8991081
    9001082    Every item of data that can be accessed via a model has an associated model
     
    10141196    \sa {Model Classes}, {Model Subclassing Reference}, QModelIndex,
    10151197        QAbstractItemView, {Using Drag and Drop with Item Views},
    1016         {Simple DOM Model Example},
    1017         {Simple Tree Model Example}, {Editable Tree Model Example},
    1018         {Fetch More Example}
     1198        {Simple DOM Model Example}, {Simple Tree Model Example},
     1199        {Editable Tree Model Example}, {Fetch More Example}
    10191200*/
    10201201
     
    10251206    \a column and \a parent index.
    10261207
    1027     When reimplementing this function in a subclass, call createIndex() to generate
    1028     model indexes that other components can use to refer to items in your model.
     1208    When reimplementing this function in a subclass, call createIndex() to
     1209    generate model indexes that other components can use to refer to items in
     1210    your model.
    10291211
    10301212    \sa createIndex()
     
    10351217
    10361218    Inserts a single column before the given \a column in the child items of
    1037     the \a parent specified. Returns true if the column is inserted; otherwise
     1219    the \a parent specified.
     1220
     1221    Returns true if the column is inserted; otherwise returns false.
     1222
     1223    \sa insertColumns() insertRow() removeColumn()
     1224*/
     1225
     1226/*!
     1227    \fn bool QAbstractItemModel::insertRow(int row, const QModelIndex &parent)
     1228
     1229    \note The base class implementation of this function does nothing and
    10381230    returns false.
    10391231
    1040     \sa insertColumns() insertRow() removeColumn()
    1041 */
    1042 
    1043 /*!
    1044     \fn bool QAbstractItemModel::insertRow(int row, const QModelIndex &parent)
    1045 
    10461232    Inserts a single row before the given \a row in the child items of the
    1047     \a parent specified. Returns true if the row is inserted; otherwise
    1048     returns false.
     1233    \a parent specified.
     1234
     1235    Returns true if the row is inserted; otherwise returns false.
    10491236
    10501237    \sa insertRows() insertColumn() removeRow()
     
    10591246    \fn QModelIndex QAbstractItemModel::parent(const QModelIndex &index) const = 0
    10601247
    1061     Returns the parent of the model item with the given \a index, or QModelIndex()
    1062     if it has no parent.
     1248    Returns the parent of the model item with the given \a index
     1249    .
    10631250
    10641251    A common convention used in models that expose tree data structures is that
    1065     only items in the first column have children. For that case, when reimplementing
    1066     this function in a subclass the column of the returned QModelIndex would be 0.
    1067 
    1068     \note When reimplementing this function in a subclass, be careful to avoid
     1252    only items in the first column have children. For that case, when
     1253    reimplementing this function in a subclass the column of the returned
     1254    QModelIndex would be 0.
     1255
     1256    When reimplementing this function in a subclass, be careful to avoid
    10691257    calling QModelIndex member functions, such as QModelIndex::parent(), since
    1070     indexes belonging to your model will simply call your implementation, leading
    1071     to infinite recursion.
     1258    indexes belonging to your model will simply call your implementation,
     1259    to infinite recursion.
    10721260
    10731261    \sa createIndex()
     
    10771265    \fn bool QAbstractItemModel::removeColumn(int column, const QModelIndex &parent)
    10781266
    1079     Removes the given \a column from the child items of the \a parent specified.
     1267    Removes the given \a column from the child items of the \a parent
     1268    specified.
     1269
    10801270    Returns true if the column is removed; otherwise returns false.
    10811271
     
    10871277
    10881278    Removes the given \a row from the child items of the \a parent specified.
     1279
    10891280    Returns true if the row is removed; otherwise returns false.
    10901281
    1091     The removeRow() is a convenience function that calls removeRows().
    1092     The QAbstractItemModel implementation of removeRows does nothing.
     1282    Th
     1283    does nothing.
    10931284
    10941285    \sa removeRows(), removeColumn(), insertRow()
     
    11021293    sections in the header from the \a first to the \a last need to be updated.
    11031294
    1104     Note that this signal must be emitted explicitly when
    1105     reimplementing the setHeaderData() function.
    1106 
    1107     If you are changing the number of columns or rows you don't need
    1108     to emit this signal, but use the begin/end functions (see the
    1109     section on subclassing in the QAbstractItemModel class description
    1110     for details).
     1295    When reimplementing the setHeaderData() function, this signal must be
     1296    emitted explicitly.
     1297
     1298    If you are changing the number of columns or rows you do not need to emit
     1299    this signal, but use the begin/end functions (refer to the section on
     1300    subclassing in the QAbstractItemModel class description for details).
    11111301
    11121302    \sa headerData(), setHeaderData(), dataChanged()
     
    11181308
    11191309    This signal is emitted just before the layout of a model is changed.
    1120     Components connected to this signal use it to adapt to changes
    1121     in the model's layout.
     1310    Components connected to this signal use it to adapt to changes
     1311    model's layout.
    11221312
    11231313    Subclasses should update any persistent model indexes after emitting
     
    11311321
    11321322    This signal is emitted whenever the layout of items exposed by the model
    1133     has changed; for example, when the model has been sorted. When this signal is
    1134     received by a view, it should update the layout of items to reflect this
     1323    has changed; for example, when the model has been sorted. When this signal
     1324    received by a view, it should update the layout of items to reflect this
    11351325    change.
    11361326
    1137     When subclassing QAbstractItemModel or QAbstractProxyModel, ensure that
    1138     you emit layoutAboutToBeChanged() before changing the order of items or
     1327    When subclassing QAbstractItemModel or QAbstractProxyModel, ensure that
     1328    emit layoutAboutToBeChanged() before changing the order of items or
    11391329    altering the structure of the data you expose to views, and emit
    11401330    layoutChanged() after changing the layout.
    11411331
    1142     Subclasses should update any persistent model indexes before
    1143     emitting layoutChanged().
    1144 
    1145     \sa layoutAboutToBeChanged(), dataChanged(), headerDataChanged(), reset(), changePersistentIndex()
     1332    Subclasses should update any persistent model indexes before emitting
     1333    layoutChanged(). In other words, when the structure changes:
     1334
     1335    \list
     1336        \o  Call beginLayoutChanged()
     1337        \o  Remember the QModelIndex that will change
     1338        \o  Update your internal data
     1339        \o  Call changePersistentIndex()
     1340        \o  Call endLayoutChanged()
     1341    \endlist
     1342
     1343
     1344    \sa layoutAboutToBeChanged(), dataChanged(), headerDataChanged(), modelReset(),
     1345        changePersistentIndex()
    11461346*/
    11471347
     
    11731373    \fn QModelIndex QAbstractItemModel::sibling(int row, int column, const QModelIndex &index) const
    11741374
    1175     Returns the sibling at \a row and \a column for the item at \a index, or
    1176     an invalid QModelIndex if there is no sibling at that location.
     1375    Returns the sibling at \a row and \a column for the item at \a index, or
     1376    invalid QModelIndex if there is no sibling at that location.
    11771377
    11781378    sibling() is just a convenience function that finds the item's parent, and
    1179     uses it to retrieve the index of the child item in the specified \a row
    1180     and \a column.
     1379    uses it to retrieve the index of the child item in the specified \a row
     1380    \a column.
    11811381
    11821382    \sa index(), QModelIndex::row(), QModelIndex::column()
     
    11871387    \fn int QAbstractItemModel::rowCount(const QModelIndex &parent) const
    11881388
    1189     Returns the number of rows under the given \a parent.   When the parent
    1190     is valid it means that rowCount is returning the number of children of parent.
    1191 
    1192     \bold{Tip:} When implementing a table based model, rowCount() should return 0 when
    1193     the parent is valid.
     1389    Returns the number of rows under the given \a parent.
     1390    valid it means that rowCount is returning the number of children of parent.
     1391
     1392    \
     1393    the parent is valid.
    11941394
    11951395    \sa columnCount()
     
    12011401    Returns the number of columns for the children of the given \a parent.
    12021402
    1203     In most subclasses, the number of columns is independent of the
    1204     \a parent. For example:
     1403    In most subclasses, the number of columns is independent of the \a parent.
     1404
     1405    For example:
    12051406
    12061407    \snippet examples/itemviews/simpledommodel/dommodel.cpp 2
    12071408
    1208     \bold{Tip:} When implementing a table based model, columnCount() should return 0 when
    1209     the parent is valid.
     1409    \
     1410    the parent is valid.
    12101411
    12111412    \sa rowCount()
     
    12341435    inclusive, under the given \a parent item.
    12351436
     1437
     1438
     1439
     1440
     1441
     1442
     1443
     1444
     1445
     1446
     1447
     1448
     1449
     1450
     1451
     1452
     1453
     1454
     1455
     1456
     1457
     1458
     1459
     1460
     1461
     1462
     1463
     1464
     1465
     1466
     1467
     1468
     1469
     1470
     1471
     1472
     1473
     1474
     1475
     1476
     1477
     1478
     1479
     1480
     1481
     1482
     1483
     1484
     1485
     1486
     1487
     1488
     1489
     1490
     1491
     1492
     1493
     1494
    12361495    \bold{Note:} Components connected to this signal use it to adapt to changes
    12371496    in the model's dimensions. It can only be emitted by the QAbstractItemModel
    12381497    implementation, and cannot be explicitly emitted in subclass code.
    12391498
    1240     \sa insertRows(), beginInsertRows()
    1241 */
    1242 
    1243 /*!
    1244     \fn void QAbstractItemModel::rowsAboutToBeInserted(const QModelIndex &parent, int start, int end)
    1245 
    1246     This signal is emitted just before rows are inserted into the
    1247     model. The new items will be positioned between \a start and \a end
    1248     inclusive, under the given \a parent item.
     1499    \sa beginMoveRows()
     1500*/
     1501
     1502/*!
     1503    \fn void QAbstractItemModel::rowsAboutToBeMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationRow)
     1504    \since 4.6
     1505
     1506    This signal is emitted just before rows are moved within the
     1507    model. The items that will be moved are those between \a sourceStart and \a sourceEnd
     1508    inclusive, under the given \a sourceParent item. They will be moved to \a destinationParent
     1509    starting at the row \a destinationRow.
    12491510
    12501511    \bold{Note:} Components connected to this signal use it to adapt to changes
     
    12521513    implementation, and cannot be explicitly emitted in subclass code.
    12531514
    1254     \sa insertRows(), beginInsertRows()
    1255 */
    1256 
    1257 /*!
    1258     \fn void QAbstractItemModel::rowsRemoved(const QModelIndex &parent, int start, int end)
    1259 
    1260     This signal is emitted after rows have been removed from the
    1261     model. The removed items are those between \a start and \a end
    1262     inclusive, under the given \a parent item.
     1515    \sa beginMoveRows()
     1516*/
     1517
     1518/*!
     1519    \fn void QAbstractItemModel::columnsMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationColumn)
     1520    \since 4.6
     1521
     1522    This signal is emitted after columns have been moved within the
     1523    model. The items between \a sourceStart and \a sourceEnd
     1524    inclusive, under the given \a sourceParent item have been moved to \a destinationParent
     1525    starting at the column \a destinationColumn.
    12631526
    12641527    \bold{Note:} Components connected to this signal use it to adapt to changes
     
    12661529    implementation, and cannot be explicitly emitted in subclass code.
    12671530
    1268     \sa removeRows(), beginRemoveRows()
    1269 */
    1270 
    1271 /*!
    1272     \fn void QAbstractItemModel::rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end)
    1273 
    1274     This signal is emitted just before rows are removed from the
    1275     model. The items that will be removed are those between \a start and \a end
    1276     inclusive, under the given \a parent item.
     1531    \sa beginMoveRows()
     1532*/
     1533
     1534/*!
     1535    \fn void QAbstractItemModel::columnsAboutToBeMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationColumn)
     1536    \since 4.6
     1537
     1538    This signal is emitted just before columns are moved within the
     1539    model. The items that will be moved are those between \a sourceStart and \a sourceEnd
     1540    inclusive, under the given \a sourceParent item. They will be moved to \a destinationParent
     1541    starting at the column \a destinationColumn.
    12771542
    12781543    \bold{Note:} Components connected to this signal use it to adapt to changes
     
    12801545    implementation, and cannot be explicitly emitted in subclass code.
    12811546
    1282     \sa removeRows(), beginRemoveRows()
     1547    \sa oveRows()
    12831548*/
    12841549
     
    12861551    \fn void QAbstractItemModel::columnsInserted(const QModelIndex &parent, int start, int end)
    12871552
    1288     This signal is emitted after columns have been inserted into the
    1289     model. The new items are those between \a start and \a end
    1290     inclusive, under the given \a parent item.
    1291 
    1292     \bold{Note:} Components connected to this signal use it to adapt to changes
    1293     in the model's dimensions. It can only be emitted by the QAbstractItemModel
     1553    This signal is emitted after columns have been inserted into the
     1554   
     1555    \a parent item.
     1556
     1557    \
     1558    model's dimensions. It can only be emitted by the QAbstractItemModel
    12941559    implementation, and cannot be explicitly emitted in subclass code.
    12951560
     
    13001565    \fn void QAbstractItemModel::columnsAboutToBeInserted(const QModelIndex &parent, int start, int end)
    13011566
    1302     This signal is emitted just before columns are inserted into the
    1303     model. The new items will be positioned between \a start and \a end
    1304     inclusive, under the given \a parent item.
    1305 
    1306     \bold{Note:} Components connected to this signal use it to adapt to changes
    1307     in the model's dimensions. It can only be emitted by the QAbstractItemModel
     1567    This signal is emitted just before columns are inserted into the
     1568   
     1569    the given \a parent item.
     1570
     1571    \
     1572    model's dimensions. It can only be emitted by the QAbstractItemModel
    13081573    implementation, and cannot be explicitly emitted in subclass code.
    13091574
     
    13141579    \fn void QAbstractItemModel::columnsRemoved(const QModelIndex &parent, int start, int end)
    13151580
    1316     This signal is emitted after columns have been removed from the
    1317     model. The removed items are those between \a start and \a end
    1318     inclusive, under the given \a parent item.
    1319 
    1320     \bold{Note:} Components connected to this signal use it to adapt to changes
    1321     in the model's dimensions. It can only be emitted by the QAbstractItemModel
     1581    This signal is emitted after columns have been removed from the
     1582   
     1583    under the given \a parent item.
     1584
     1585    \
     1586    the model's dimensions. It can only be emitted by the QAbstractItemModel
    13221587    implementation, and cannot be explicitly emitted in subclass code.
    13231588
     
    13281593    \fn void QAbstractItemModel::columnsAboutToBeRemoved(const QModelIndex &parent, int start, int end)
    13291594
    1330     This signal is emitted just before columns are removed
    1331     from the model. The items to be removed are those between \a start and
    1332     \a end inclusive, under the given \a parent item.
    1333 
    1334     \bold{Note:} Components connected to this signal use it to adapt to changes
    1335     in the model's dimensions. It can only be emitted by the QAbstractItemModel
     1595    This signal is emitted just before columns are removed
     1596   
     1597    the given \a parent item.
     1598
     1599    \
     1600    model's dimensions. It can only be emitted by the QAbstractItemModel
    13361601    implementation, and cannot be explicitly emitted in subclass code.
    13371602
     
    13401605
    13411606/*!
    1342   Returns true if the model returns a valid QModelIndex for \a row and
    1343   \a column with \a parent, otherwise returns false.
     1607  Returns true if the model returns a valid QModelIndex for \a row and
     1608  \a column with \a parent, otherwise returns false.
    13441609*/
    13451610bool QAbstractItemModel::hasIndex(int row, int column, const QModelIndex &parent) const
     
    13521617
    13531618/*!
    1354   Returns true if \a parent has any children; otherwise returns false.
    1355   Use rowCount() on the parent to find out the number of children.
    1356 
    1357   \sa parent() index()
     1619    Returns true if \a parent has any children; otherwise returns false.
     1620
     1621    Use rowCount() on the parent to find out the number of children.
     1622
     1623    \sa parent() index()
    13581624*/
    13591625bool QAbstractItemModel::hasChildren(const QModelIndex &parent) const
     
    13641630
    13651631/*!
    1366     Returns a map with values for all predefined roles in the model
    1367     for the item at the given \a index.
    1368 
    1369     Reimplemented this function if you want to extend the default behavior
    1370     of this function to include custom roles in the map.
     1632    Returns a map with values for all predefined roles in the model
     1633    item at the given \a index.
     1634
     1635    Reimplement
     1636    this function to include custom roles in the map.
    13711637
    13721638    \sa Qt::ItemDataRole, data()
     
    13771643    for (int i = 0; i < Qt::UserRole; ++i) {
    13781644        QVariant variantData = data(index, i);
    1379         if (variantData.type() != QVariant::Invalid)
     1645        if (variantData.)
    13801646            roles.insert(i, variantData);
    13811647    }
     
    13851651/*!
    13861652    Sets the \a role data for the item at \a index to \a value.
     1653
    13871654    Returns true if successful; otherwise returns false.
    13881655
    1389     The dataChanged() signal should be emitted if the data was successfully set.
    1390 
    1391     The base class implementation returns false. This function and
    1392     data() must be reimplemented for editable models. Note that the
    1393     dataChanged() signal must be emitted explicitly when
    1394     reimplementing this function.
     1656    The dataChanged() signal should be emitted if the data was successfully
     1657    set.
     1658
     1659    The base class implementation returns false. This function and data() must
     1660    be reimplemented for editable models.
    13951661
    13961662    \sa Qt::ItemDataRole, data(), itemData()
     
    14111677
    14121678    \note If you do not have a value to return, return an \bold invalid
    1413     QVariant() instead of returning 0.
     1679    QVariant instead of returning 0.
    14141680
    14151681    \sa Qt::ItemDataRole, setData(), headerData()
     
    14181684/*!
    14191685    Sets the role data for the item at \a index to the associated value in
    1420     \a roles, for every Qt::ItemDataRole. Returns true if successful; otherwise
    1421     returns false.
     1686    \a roles, for every Qt::ItemDataRole.
     1687
     1688    Returns true if successful; otherwise returns false.
    14221689
    14231690    Roles that are not in \a roles will not be modified.
     
    14341701
    14351702/*!
    1436     Returns a list of MIME types that can be used to describe a list of
    1437     model indexes.
     1703    Returns a list of MIME types that can be used to describe a list of
     1704    indexes.
    14381705
    14391706    \sa mimeData()
     
    14471714
    14481715/*!
    1449     Returns an object that contains serialized items of data corresponding to the
    1450     list of \a indexes specified. The formats used to describe the encoded data
    1451     is obtained from the mimeTypes() function.
    1452 
    1453     If the list of indexes is empty, or there are no supported MIME types,
    1454     0 is returned rather than a serialized empty list.
     1716    Returns an object that contains serialized items of data corresponding to
     1717   
     1718    is obtained from the mimeTypes() function.
     1719
     1720    If the list of indexes is empty, or there are no supported MIME types,
     1721    returned rather than a serialized empty list.
    14551722
    14561723    \sa mimeTypes(), dropMimeData()
     
    14741741/*!
    14751742    Handles the \a data supplied by a drag and drop operation that ended with
    1476     the given \a action. Returns true if the data and action can be handled
    1477     by the model; otherwise returns false.
    1478 
    1479     Although the specified \a row, \a column and \a parent indicate the location of
    1480     an item in the model where the operation ended, it is the responsibility of the
    1481     view to provide a suitable location for where the data should be inserted.
    1482 
    1483     For instance, a drop action on an item in a QTreeView can result in new items
    1484     either being inserted as children of the item specified by \a row, \a column,
    1485     and \a parent, or as siblings of the item.
     1743    the given \a action.
     1744
     1745    Returns true if the data and action can be handled by the model; otherwise
     1746    returns false.
     1747
     1748    Although the specified \a row, \a column and \a parent indicate the
     1749    location of an item in the model where the operation ended, it is the
     1750    responsibility of the view to provide a suitable location for where the
     1751    data should be inserted.
     1752
     1753    For instance, a drop action on an item in a QTreeView can result in new
     1754    items either being inserted as children of the item specified by \a row,
     1755    \a column, and \a parent, or as siblings of the item.
    14861756
    14871757    When row and column are -1 it means that it is up to the model to decide
    1488     where to place the data.  This can occur in a tree when data is dropped
    1489     on a parent.  Models will usually append the data to the parent in this case.
    1490 
    1491     Returns true if the dropping was successful otherwise false.
     1758    where to place the data. This can occur in a tree when data is dropped on
     1759    a parent. Models will usually append the data to the parent in this case.
    14921760
    14931761    \sa supportedDropActions(), {Using Drag and Drop with Item Views}
     
    15191787
    15201788/*!
    1521   \since 4.2
    1522 
    1523   Returns the drop actions supported by this model.
    1524 
    1525   The default implementation returns Qt::CopyAction. Reimplement this
    1526   function if you wish to support additional actions. Note that you
    1527   must also reimplement the dropMimeData() function to handle the
    1528   additional operations.
    1529 
    1530   \sa dropMimeData(), Qt::DropActions, {Using Drag and Drop with Item
    1531   Views}
     1789  \since 4.2
     1790
     1791  Returns the drop actions supported by this model.
     1792
     1793  The default implementation returns Qt::CopyAction. Reimplement this
     1794 
     1795 
     1796  operations.
     1797
     1798  \sa dropMimeData(), Qt::DropActions, {Using Drag and Drop with Item
     1799  Views}
    15321800*/
    15331801Qt::DropActions QAbstractItemModel::supportedDropActions() const
     
    15371805
    15381806/*!
    1539   Returns the actions supported by the data in this model.
    1540 
    1541   The default implementation returns supportedDropActions() unless
    1542   specific values have been set with setSupportedDragActions().
    1543 
    1544   supportedDragActions() is used by QAbstractItemView::startDrag() as
    1545   the default values when a drag occurs.
    1546 
    1547   \sa Qt::DropActions, {Using Drag and Drop with Item Views}
     1807  Returns the actions supported by the data in this model.
     1808
     1809 
     1810  values have been set with setSupportedDragActions().
     1811
     1812 
     1813  default values when a drag occurs.
     1814
     1815  \sa Qt::DropActions, {Using Drag and Drop with Item Views}
    15481816*/
    15491817Qt::DropActions QAbstractItemModel::supportedDragActions() const
     
    15701838
    15711839/*!
    1572   On models that support this, inserts \a count rows into the model before the
    1573   given \a row.  The items in the new row will be children of the item
    1574   represented by the \a parent model index.
    1575 
    1576   If \a row is 0, the rows are prepended to any existing rows in the parent.
    1577   If \a row is rowCount(), the rows are appended to any existing rows in the
    1578   parent.
    1579   If \a parent has no children, a single column with \a count rows is inserted.
    1580 
    1581   Returns true if the rows were successfully inserted; otherwise returns
    1582   false.
    1583 
    1584   The base class implementation does nothing and returns false.
    1585 
    1586   If you implement your own model, you can reimplement this function
    1587   if you want to support insertions. Alternatively, you can provide
    1588   you own API for altering the data.
    1589 
    1590   \sa insertColumns(), removeRows(), beginInsertRows(), endInsertRows()
     1840    \note The base class implementation of this function does nothing and
     1841    returns false.
     1842
     1843    On models that support this, inserts \a count rows into the model before
     1844    the given \a row. Items in the new row will be children of the item
     1845    represented by the \a parent model index.
     1846
     1847    If \a row is 0, the rows are prepended to any existing rows in the parent.
     1848
     1849    If \a row is rowCount(), the rows are appended to any existing rows in the
     1850    parent.
     1851
     1852    If \a parent has no children, a single column with \a count rows is
     1853    inserted.
     1854
     1855    Returns true if the rows were successfully inserted; otherwise returns
     1856    false.
     1857
     1858    If you implement your own model, you can reimplement this function if you
     1859    want to support insertions. Alternatively, you can provide your own API for
     1860    altering the data. In either case, you will need to call
     1861    beginInsertRows() and endInsertRows() to notify other components that the
     1862    model has changed.
     1863
     1864    \sa insertColumns(), removeRows(), beginInsertRows(), endInsertRows()
    15911865*/
    15921866bool QAbstractItemModel::insertRows(int, int, const QModelIndex &)
     
    15961870
    15971871/*!
    1598   On models that support this, inserts \a count new columns into the model
    1599   before the given \a column.  The items in each new column will be children
    1600   of the item represented by the \a parent model index.
    1601 
    1602   If \a column is 0, the columns are prepended to any existing columns.
    1603   If \a column is columnCount(), the columns are appended to any existing
    1604   columns.
    1605   If \a parent has no children, a single row with \a count columns is inserted.
    1606 
    1607   Returns true if the columns were successfully inserted; otherwise returns
    1608   false.
    1609 
    1610   The base class implementation does nothing and returns false.
    1611 
    1612   If you implement your own model, you can reimplement this function
    1613   if you want to support insertions. Alternatively, you can provide
    1614   you own API for altering the data.
    1615 
    1616   \sa insertRows(), removeColumns(), beginInsertColumns(), endInsertColumns()
     1872    On models that support this, inserts \a count new columns into the model
     1873    before the given \a column. The items in each new column will be children
     1874    of the item represented by the \a parent model index.
     1875
     1876    If \a column is 0, the columns are prepended to any existing columns.
     1877
     1878    If \a column is columnCount(), the columns are appended to any existing
     1879    columns.
     1880
     1881    If \a parent has no children, a single row with \a count columns is
     1882    inserted.
     1883
     1884    Returns true if the columns were successfully inserted; otherwise returns
     1885    false.
     1886
     1887    The base class implementation does nothing and returns false.
     1888
     1889    If you implement your own model, you can reimplement this function if you
     1890    want to support insertions. Alternatively, you can provide your own API for
     1891    altering the data.
     1892
     1893    \sa insertRows(), removeColumns(), beginInsertColumns(), endInsertColumns()
    16171894*/
    16181895bool QAbstractItemModel::insertColumns(int, int, const QModelIndex &)
     
    16231900/*!
    16241901    On models that support this, removes \a count rows starting with the given
    1625     \a row under parent \a parent from the model. Returns true if the rows
    1626     were successfully removed; otherwise returns false.
     1902    \a row under parent \a parent from the model.
     1903
     1904    Returns true if the rows were successfully removed; otherwise returns
     1905    false.
    16271906
    16281907    The base class implementation does nothing and returns false.
    16291908
    1630     If you implement your own model, you can reimplement this function
    1631     if you want to support removing. Alternatively, you can provide
    1632     you own API for altering the data.
    1633 
    1634     \sa removeRow(), removeColumns(), insertColumns(), beginRemoveRows(), endRemoveRows()
     1909    If you implement your own model, you can reimplement this function if you
     1910    want to support removing. Alternatively, you can provide your own API for
     1911    altering the data.
     1912
     1913    \sa removeRow(), removeColumns(), insertColumns(), beginRemoveRows(),
     1914        endRemoveRows()
    16351915*/
    16361916bool QAbstractItemModel::removeRows(int, int, const QModelIndex &)
     
    16411921/*!
    16421922    On models that support this, removes \a count columns starting with the
    1643     given \a column under parent \a parent from the model. Returns true if the
    1644     columns were successfully removed; otherwise returns false.
     1923    given \a column under parent \a parent from the model.
     1924
     1925    Returns true if the columns were successfully removed; otherwise returns
     1926    false.
    16451927
    16461928    The base class implementation does nothing and returns false.
    16471929
    1648     If you implement your own model, you can reimplement this function
    1649     if you want to support removing. Alternatively, you can provide
    1650     you own API for altering the data.
    1651 
    1652     \sa removeColumn(), removeRows(), insertColumns(), beginRemoveColumns(), endRemoveColumns()
     1930    If you implement your own model, you can reimplement this function if you
     1931    want to support removing. Alternatively, you can provide your own API for
     1932    altering the data.
     1933
     1934    \sa removeColumn(), removeRows(), insertColumns(), beginRemoveColumns(),
     1935        endRemoveColumns()
    16531936*/
    16541937bool QAbstractItemModel::removeColumns(int, int, const QModelIndex &)
     
    16731956
    16741957/*!
    1675     Returns true if there is more data available for \a parent; otherwise returns
    1676     false.
    1677    
     1958    Returns true if there is more data available for \a parent; otherwise
     1959    false.
     1960
    16781961    The default implementation always returns false.
    16791962
     
    16921975    Returns the item flags for the given \a index.
    16931976
    1694     The base class implementation returns a combination of flags that
    1695     enables the item (\c ItemIsEnabled) and allows it to be
    1696     selected (\c ItemIsSelectable).
     1977    The base class implementation returns a combination of flags that
     1978   
     1979    (\c ItemIsSelectable).
    16971980
    16981981    \sa Qt::ItemFlags
     
    17202003
    17212004/*!
    1722   Returns a model index for the buddy of the item represented by \a index.
    1723   When the user wants to edit an item, the view will call this function to
    1724   check whether another item in the model should be edited instead, and
    1725   construct a delegate using the model index returned by the buddy item.
    1726 
    1727   In the default implementation each item is its own buddy.
     2005    Returns a model index for the buddy of the item represented by \a index.
     2006    When the user wants to edit an item, the view will call this function to
     2007    check whether another item in the model should be edited instead. Then, the
     2008    view will construct a delegate using the model index returned by the buddy
     2009    item.
     2010
     2011    The default implementation of this function has each item as its own buddy.
    17282012*/
    17292013QModelIndex QAbstractItemModel::buddy(const QModelIndex &index) const
     
    17332017
    17342018/*!
    1735     Returns a list of indexes for the items in the column of the \a
    1736     start index where the data stored under the given \a role matches
    1737     the specified \a value. The way the search is performed is defined
    1738     by the \a flags given. The list that is returned may be empty.
    1739 
    1740     The search starts from the \a start index, and continues until the
    1741     number of matching data items equals \a hits, the search reaches
    1742     the last row, or the search reaches \a start again, depending on
    1743     whether \c MatchWrap is specified in \a flags. If you want to search
    1744     for all matching items, use \a hits = -1.
     2019    Returns a list of indexes for the items in the column of the \a
     2020   
     2021   
     2022    that is returned may be empty.
     2023
     2024    The search
     2025   
     2026    the
     2027   
     2028    \a hits = -1.
    17452029
    17462030    By default, this function will perform a wrapping, string-based comparison
    17472031    on all items, searching for items that begin with the search term specified
    17482032    by \a value.
    1749    
    1750     \note The default implementation of this function only searches columns,
    1751     This function can be reimplemented to include other search behavior.
     2033
     2034    \note The default implementation of this function only searches columns
     2035    search behavior.
    17522036*/
    17532037QModelIndexList QAbstractItemModel::match(const QModelIndex &start, int role,
     
    18242108    Returns the row and column span of the item represented by \a index.
    18252109
    1826     Note: span is not used currently, but will be in the future.
     2110    .
    18272111*/
    18282112
     
    18332117
    18342118/*!
    1835   Called to let the model know that it should submit whatever it has cached
    1836   to the permanent storage. Typically used for row editing.
    1837 
    1838   Returns false on error, otherwise true.
     2119    \since 4.6
     2120
     2121    Sets the model's role names to \a roleNames.
     2122
     2123    This function allows mapping of role identifiers to role property names in
     2124    Declarative UI.  This function must be called before the model is used.
     2125    Modifying the role names after the model has been set may result in
     2126    undefined behaviour.
     2127
     2128    \sa roleNames()
     2129*/
     2130void QAbstractItemModel::setRoleNames(const QHash<int,QByteArray> &roleNames)
     2131{
     2132    Q_D(QAbstractItemModel);
     2133    d->roleNames = roleNames;
     2134}
     2135
     2136/*!
     2137    \since 4.6
     2138
     2139    Returns the model's role names.
     2140
     2141    \sa setRoleNames()
     2142*/
     2143const QHash<int,QByteArray> &QAbstractItemModel::roleNames() const
     2144{
     2145    Q_D(const QAbstractItemModel);
     2146    return d->roleNames;
     2147}
     2148
     2149/*!
     2150    Lets the model know that it should submit cached information to permanent
     2151    storage. This function is typically used for row editing.
     2152
     2153    Returns true if there is no error; otherwise returns false.
     2154
     2155    \sa revert()
    18392156*/
    18402157
     
    18452162
    18462163/*!
    1847   Called to let the model know that it should discard whatever it has cached.
    1848   Typically used for row editing.
     2164    Lets the model know that it should discard cached information. This
     2165    function is typically used for row editing.
     2166
     2167    \sa submit()
    18492168*/
    18502169
     
    18552174
    18562175/*!
    1857   Returns the data for the given \a role and \a section in the header
    1858   with the specified \a orientation.
    1859 
    1860   For horizontal headers, the section number corresponds to the column
    1861   number of items shown beneath it. For vertical headers, the section
    1862   number typically to the row number of items shown alongside it.
    1863 
    1864   \sa Qt::ItemDataRole, setHeaderData(), QHeaderView
     2176 
     2177  the specified \a orientation.
     2178
     2179  For horizontal headers, the section number corresponds to the column
     2180 
     2181  .
     2182
     2183  \sa Qt::ItemDataRole, setHeaderData(), QHeaderView
    18652184*/
    18662185
     
    18742193
    18752194/*!
    1876   Sets the data for the given \a role and \a section in the header with
    1877   the specified \a orientation to the \a value supplied.
    1878   Returns true if the header's data was updated; otherwise returns false.
    1879 
    1880   Note that the headerDataChanged() signal must be emitted explicitly
    1881   when reimplementing this function.
    1882 
    1883   \sa Qt::ItemDataRole, headerData()
     2195    Sets the data for the given \a role and \a section in the header with the
     2196    specified \a orientation to the \a value supplied.
     2197
     2198    Returns true if the header's data was updated; otherwise returns false.
     2199
     2200    When reimplementing this function, the headerDataChanged() signal must be
     2201    emitted explicitly.
     2202
     2203    \sa Qt::ItemDataRole, headerData()
    18842204*/
    18852205
     
    18972217    \fn QModelIndex QAbstractItemModel::createIndex(int row, int column, void *ptr) const
    18982218
    1899     Creates a model index for the given \a row and \a column with the internal pointer \a ptr.
    1900 
    1901     Note that when you are using a QSortFilterProxyModel its indexes have their own
    1902     internal pointer.  It is not advisable to access the internal pointer in the index
    1903     outside of the model.  Use the data() function instead.
     2219    Creates a model index for the given \a row and \a column with the internal
     2220    pointer \a ptr.
     2221
     2222    When using a QSortFilterProxyModel, its indexes have their own internal
     2223    pointer. It is not advisable to access this internal pointer outside of the
     2224    model. Use the data() function instead.
    19042225
    19052226    This function provides a consistent interface that model subclasses must
     
    19112232    \obsolete
    19122233
    1913     Use QModelIndex QAbstractItemModel::createIndex(int row, int column, quint32 id) instead.
     2234    Use QModelIndex
     2235    QAbstractItemModel::createIndex(int row, int column, quint32 id) instead.
    19142236*/
    19152237
     
    19222244    This function provides a consistent interface that model subclasses must
    19232245    use to create model indexes.
     2246
    19242247    \sa QModelIndex::internalId()
    19252248*/
     
    20252348    Begins a row insertion operation.
    20262349
    2027     When reimplementing insertRows() in a subclass, you must call this
    2028     function \e before inserting data into the model's underlying data
    2029     store.
    2030 
    2031     The \a parent index corresponds to the parent into which the new
    2032     rows are inserted; \a first and \a last are the row numbers that the
    2033     new rows will have after they have been inserted.
     2350    When reimplementing insertRows() in a subclass, you must call this function
     2351    \e before inserting data into the model's underlying data store.
     2352
     2353    The \a parent index corresponds to the parent into which the new rows are
     2354    inserted; \a first and \a last are the row numbers that the new rows will
     2355    have after they have been inserted.
    20342356
    20352357    \table 80%
    2036     \row \o \inlineimage modelview-begin-insert-rows.png Inserting rows
    2037     \o Specify the first and last row numbers for the span of rows
    2038        you want to insert into an item in a model.
    2039 
    2040     For example, as shown in the diagram, we insert three rows before
    2041     row 2, so \a first is 2 and \a last is 4:
    2042     \snippet doc/src/snippets/code/src_corelib_kernel_qabstractitemmodel.cpp 0
    2043     This inserts the three new rows as rows 2, 3, and 4.
    20442358    \row
    2045     \o \inlineimage modelview-begin-append-rows.png Appending rows
    2046     \o To append rows, insert them after the last row.
    2047 
    2048     For example, as shown in the diagram, we append two rows to a
    2049     collection of 4 existing rows (ending in row 3), so \a first is 4
    2050     and \a last is 5:
    2051     \snippet doc/src/snippets/code/src_corelib_kernel_qabstractitemmodel.cpp 1
    2052     This appends the two new rows as rows 4 and 5.
     2359        \o  \inlineimage modelview-begin-insert-rows.png Inserting rows
     2360        \o  Specify the first and last row numbers for the span of rows you
     2361            want to insert into an item in a model.
     2362
     2363            For example, as shown in the diagram, we insert three rows before
     2364            row 2, so \a first is 2 and \a last is 4:
     2365
     2366            \snippet doc/src/snippets/code/src_corelib_kernel_qabstractitemmodel.cpp 0
     2367
     2368            This inserts the three new rows as rows 2, 3, and 4.
     2369    \row
     2370        \o  \inlineimage modelview-begin-append-rows.png Appending rows
     2371        \o  To append rows, insert them after the last row.
     2372
     2373            For example, as shown in the diagram, we append two rows to a
     2374            collection of 4 existing rows (ending in row 3), so \a first is 4
     2375            and \a last is 5:
     2376
     2377            \snippet doc/src/snippets/code/src_corelib_kernel_qabstractitemmodel.cpp 1
     2378
     2379            This appends the two new rows as rows 4 and 5.
    20532380    \endtable
    20542381
     2382
     2383
     2384
    20552385    \sa endInsertRows()
    20562386*/
     
    20682398    Ends a row insertion operation.
    20692399
    2070     When reimplementing insertRows() in a subclass, you must call this
    2071     function \e after inserting data into the model's underlying data
    2072     store.
     2400    When reimplementing insertRows() in a subclass, you must call this function
     2401    \e after inserting data into the model's underlying data store.
    20732402
    20742403    \sa beginInsertRows()
     
    20862415
    20872416    When reimplementing removeRows() in a subclass, you must call this
    2088     function \e before removing data from the model's underlying data
    2089     store.
    2090 
    2091     The \a parent index corresponds to the parent from which the new
    2092     rows are removed; \a first and \a last are the row numbers of the
    2093     rows to be removed.
     2417    function \e before removing data from the model's underlying data store.
     2418
     2419    The \a parent index corresponds to the parent from which the new rows are
     2420    removed; \a first and \a last are the row numbers of the rows to be
     2421    removed.
    20942422
    20952423    \table 80%
    2096     \row \o \inlineimage modelview-begin-remove-rows.png Removing rows
    2097     \o Specify the first and last row numbers for the span of rows
    2098        you want to remove from an item in a model.
    2099 
    2100     For example, as shown in the diagram, we remove the two rows from
    2101     row 2 to row 3, so \a first is 2 and \a last is 3:
    2102     \snippet doc/src/snippets/code/src_corelib_kernel_qabstractitemmodel.cpp 2
     2424    \row
     2425        \o  \inlineimage modelview-begin-remove-rows.png Removing rows
     2426        \o  Specify the first and last row numbers for the span of rows you
     2427            want to remove from an item in a model.
     2428
     2429            For example, as shown in the diagram, we remove the two rows from
     2430            row 2 to row 3, so \a first is 2 and \a last is 3:
     2431
     2432            \snippet doc/src/snippets/code/src_corelib_kernel_qabstractitemmodel.cpp 2
    21032433    \endtable
     2434
     2435
     2436
     2437
    21042438
    21052439    \sa endRemoveRows()
     
    21182452    Ends a row removal operation.
    21192453
    2120     When reimplementing removeRows() in a subclass, you must call this
    2121     function \e after removing data from the model's underlying data
    2122     store.
     2454    When reimplementing removeRows() in a subclass, you must call this function
     2455    \e after removing data from the model's underlying data store.
    21232456
    21242457    \sa beginRemoveRows()
     
    21332466
    21342467/*!
     2468
     2469
     2470
     2471
     2472
     2473
     2474
     2475
     2476
     2477
     2478
     2479
     2480
     2481
     2482
     2483
     2484
     2485
     2486
     2487
     2488
     2489
     2490
     2491
     2492
     2493
     2494
     2495
     2496
     2497
     2498
     2499
     2500
     2501
     2502
     2503
     2504
     2505
     2506
     2507
     2508
     2509
     2510
     2511
     2512
     2513
     2514
     2515
     2516
     2517
     2518
     2519
     2520
     2521
     2522
     2523
     2524
     2525
     2526
     2527
     2528
     2529
     2530
     2531
     2532
     2533
     2534
     2535
     2536
     2537
     2538
     2539
     2540
     2541
     2542
     2543
     2544
     2545
     2546
     2547
     2548
     2549
     2550
     2551
     2552
     2553
     2554
     2555
     2556
     2557
     2558
     2559
     2560
     2561
     2562
     2563
     2564
     2565
     2566
     2567
     2568
     2569
     2570
     2571
     2572
     2573
     2574
     2575
     2576
     2577
     2578
     2579
     2580
     2581
    21352582    Begins a column insertion operation.
    21362583
    21372584    When reimplementing insertColumns() in a subclass, you must call this
    2138     function \e before inserting data into the model's underlying data
    2139     store.
    2140 
    2141     The \a parent index corresponds to the parent into which the new
    2142     columns are inserted; \a first and \a last are the column numbers of
    2143     the new columns will have after they have been inserted.
     2585    function \e before inserting data into the model's underlying data store.
     2586
     2587    The \a parent index corresponds to the parent into which the new columns
     2588    are inserted; \a first and \a last are the column numbers of the new
     2589    columns will have after they have been inserted.
    21442590
    21452591    \table 80%
    2146     \row \o \inlineimage modelview-begin-insert-columns.png Inserting columns
    2147     \o Specify the first and last column numbers for the span of columns
    2148        you want to insert into an item in a model.
    2149 
    2150     For example, as shown in the diagram, we insert three columns before
    2151     column 4, so \a first is 4 and \a last is 6:
    2152     \snippet doc/src/snippets/code/src_corelib_kernel_qabstractitemmodel.cpp 3
    2153     This inserts the three new columns as columns 4, 5, and 6.
    21542592    \row
    2155     \o \inlineimage modelview-begin-append-columns.png Appending columns
    2156     \o To append columns, insert them after the last column.
    2157 
    2158     For example, as shown in the diagram, we append three columns to a
    2159     collection of six existing columns (ending in column 5), so \a first
    2160     is 6 and \a last is 8:
    2161     \snippet doc/src/snippets/code/src_corelib_kernel_qabstractitemmodel.cpp 4
    2162     This appends the two new columns as columns 6, 7, and 8.
     2593        \o  \inlineimage modelview-begin-insert-columns.png Inserting columns
     2594        \o  Specify the first and last column numbers for the span of columns
     2595            you want to insert into an item in a model.
     2596
     2597            For example, as shown in the diagram, we insert three columns
     2598            before column 4, so \a first is 4 and \a last is 6:
     2599
     2600            \snippet doc/src/snippets/code/src_corelib_kernel_qabstractitemmodel.cpp 3
     2601
     2602            This inserts the three new columns as columns 4, 5, and 6.
     2603    \row
     2604        \o  \inlineimage modelview-begin-append-columns.png Appending columns
     2605        \o  To append columns, insert them after the last column.
     2606
     2607            For example, as shown in the diagram, we append three columns to a
     2608            collection of six existing columns (ending in column 5), so
     2609            \a first is 6 and \a last is 8:
     2610
     2611            \snippet doc/src/snippets/code/src_corelib_kernel_qabstractitemmodel.cpp 4
     2612
     2613            This appends the two new columns as columns 6, 7, and 8.
    21632614    \endtable
     2615
     2616
     2617
     2618
    21642619
    21652620    \sa endInsertColumns()
     
    21962651
    21972652    When reimplementing removeColumns() in a subclass, you must call this
    2198     function \e before removing data from the model's underlying data
    2199     store.
    2200 
    2201     The \a parent index corresponds to the parent from which the new
    2202     columns are removed; \a first and \a last are the column numbers of
    2203     the first and last columns to be removed.
     2653    function \e before removing data from the model's underlying data store.
     2654
     2655    The \a parent index corresponds to the parent from which the new columns
     2656    are removed; \a first and \a last are the column numbers of the first and
     2657    last columns to be removed.
    22042658
    22052659    \table 80%
    2206     \row \o \inlineimage modelview-begin-remove-columns.png Removing columns
    2207     \o Specify the first and last column numbers for the span of columns
    2208        you want to remove from an item in a model.
    2209 
    2210     For example, as shown in the diagram, we remove the three columns
    2211     from column 4 to column 6, so \a first is 4 and \a last is 6:
    2212     \snippet doc/src/snippets/code/src_corelib_kernel_qabstractitemmodel.cpp 5
     2660    \row
     2661        \o  \inlineimage modelview-begin-remove-columns.png Removing columns
     2662        \o  Specify the first and last column numbers for the span of columns
     2663            you want to remove from an item in a model.
     2664
     2665            For example, as shown in the diagram, we remove the three columns
     2666            from column 4 to column 6, so \a first is 4 and \a last is 6:
     2667
     2668            \snippet doc/src/snippets/code/src_corelib_kernel_qabstractitemmodel.cpp 5
    22132669    \endtable
     2670
     2671
     2672
     2673
    22142674
    22152675    \sa endRemoveColumns()
     
    22292689
    22302690    When reimplementing removeColumns() in a subclass, you must call this
    2231     function \e after removing data from the model's underlying data
    2232     store.
     2691    function \e after removing data from the model's underlying data store.
    22332692
    22342693    \sa beginRemoveColumns()
     
    22432702
    22442703/*!
     2704
     2705
     2706
     2707
     2708
     2709
     2710
     2711
     2712
     2713
     2714
     2715
     2716
     2717
     2718
     2719
     2720
     2721
     2722
     2723
     2724
     2725
     2726
     2727
     2728
     2729
     2730
     2731
     2732
     2733
     2734
     2735
     2736
     2737
     2738
     2739
     2740
     2741
     2742
     2743
     2744
     2745
     2746
     2747
     2748
     2749
     2750
     2751
     2752
     2753
     2754
     2755
     2756
     2757
     2758
     2759
     2760
     2761
     2762
     2763
     2764
     2765
     2766
     2767
     2768
     2769
     2770
     2771
     2772
     2773
     2774
     2775
     2776
     2777
     2778
     2779
     2780
     2781
     2782
     2783
     2784
     2785
    22452786    Resets the model to its original state in any attached views.
    22462787
    2247     \note The view to which the model is attached to will be reset as well.
    2248 
    2249     When a model is reset it means that any previous data reported from the
    2250     model is now invalid and has to be queried for again.
    2251 
    2252     When a model radically changes its data it can sometimes be easier to just
    2253     call this function rather than emit dataChanged() to inform other
    2254     components when the underlying data source, or its structure, has changed.
    2255 
    2256     \sa modelAboutToBeReset(), modelReset()
     2788    \note Use beginResetModel() and endResetModel() instead whenever possible.
     2789    Use this method only if there is no way to call beginResetModel() before invalidating the model.
     2790    Otherwise it could lead to unexcpected behaviour, especially when used with proxy models.
    22572791*/
    22582792void QAbstractItemModel::reset()
     
    22652799
    22662800/*!
    2267   Changes the QPersistentModelIndex that is equal to the given \a from
    2268   model index to the given \a to model index.
    2269 
    2270   If no persistent model index equal to the given \a from model index was
    2271   found, nothing is changed.
    2272 
    2273   \sa persistentIndexList(), changePersistentIndexList()
     2801    Begins a model reset operation.
     2802
     2803    A reset operation resets the model to its current state in any attached views.
     2804
     2805    \note Any views attached to this model will be reset as well.
     2806
     2807    When a model is reset it means that any previous data reported from the
     2808    model is now invalid and has to be queried for again. This also means that
     2809    the current item and any selected items will become invalid.
     2810
     2811    When a model radically changes its data it can sometimes be easier to just
     2812    call this function rather than emit dataChanged() to inform other
     2813    components when the underlying data source, or its structure, has changed.
     2814
     2815    You must call this function before resetting any internal data structures in your model
     2816    or proxy model.
     2817
     2818    \sa modelAboutToBeReset(), modelReset(), endResetModel()
     2819    \since 4.6
     2820*/
     2821void QAbstractItemModel::beginResetModel()
     2822{
     2823    emit modelAboutToBeReset();
     2824}
     2825
     2826/*!
     2827    Completes a model reset operation.
     2828
     2829    You must call this function after resetting any internal data structure in your model
     2830    or proxy model.
     2831
     2832    \sa beginResetModel()
     2833    \since 4.6
     2834*/
     2835void QAbstractItemModel::endResetModel()
     2836{
     2837    Q_D(QAbstractItemModel);
     2838    d->invalidatePersistentIndexes();
     2839    emit modelReset();
     2840}
     2841
     2842/*!
     2843    Changes the QPersistentModelIndex that is equal to the given \a from model
     2844    index to the given \a to model index.
     2845
     2846    If no persistent model index equal to the given \a from model index was
     2847    found, nothing is changed.
     2848
     2849    \sa persistentIndexList(), changePersistentIndexList()
    22742850*/
    22752851void QAbstractItemModel::changePersistentIndex(const QModelIndex &from, const QModelIndex &to)
     
    22922868
    22932869/*!
    2294   \since 4.1
    2295 
    2296   Changes the QPersistentModelIndexes that is equal to the indexes in the given \a from
    2297   model index list to the given \a to model index list.
    2298 
    2299   If no persistent model indexes equal to the indexes in the given \a from model index list
    2300   was found, nothing is changed.
    2301 
    2302   \sa persistentIndexList(), changePersistentIndex()
     2870  \since 4.1
     2871
     2872 
     2873  model index list to the given \a to model index list.
     2874
     2875 
     2876  was found, nothing is changed.
     2877
     2878  \sa persistentIndexList(), changePersistentIndex()
    23032879*/
    23042880void QAbstractItemModel::changePersistentIndexList(const QModelIndexList &from,
     
    23332909
    23342910/*!
    2335   \since 4.2
    2336 
    2337   Returns the list of indexes stored as persistent indexes in the model.
     2911  \since 4.2
     2912
     2913  Returns the list of indexes stored as persistent indexes in the model.
    23382914*/
    23392915QModelIndexList QAbstractItemModel::persistentIndexList() const
     
    23622938
    23632939    Since the model provides a more specialized interface than
    2364     QAbstractItemModel, it is not suitable for use with tree views, although
    2365     it can be used to provide data to a QListView. If you need to represent
    2366     a simple list of items, and only need a model to contain a single column
    2367     of data, subclassing the QAbstractListModel may be more appropriate.
     2940    QAbstractItemModel, it is not suitable for use with tree views, although
     2941   
     2942   
     2943    data, subclassing the QAbstractListModel may be more appropriate.
    23682944
    23692945    The rowCount() and columnCount() functions return the dimensions of the
     
    23722948
    23732949    \section1 Subclassing
    2374 
    2375     \bold{Note:} Some general guidelines for subclassing models are
    2376     available in the \l{Model Subclassing Reference}.
    23772950
    23782951    When subclassing QAbstractTableModel, you must implement rowCount(),
     
    24062979    \endlist
    24072980
    2408     \sa {Model Classes}, {Model Subclassing Reference}, QAbstractItemModel,
    2409         QAbstractListModel,
    2410         {Pixelator Example}
     2981    \note Some general guidelines for subclassing models are available in the
     2982    \l{Model Subclassing Reference}.
     2983
     2984    \note
     2985
     2986    \sa {Model Classes}, QAbstractItemModel, QAbstractListModel,
     2987    {Pixelator Example}
    24112988*/
    24122989
     
    25053082
    25063083    \section1 Subclassing
    2507 
    2508     \bold{Note:} Some general guidelines for subclassing models are
    2509     available in the \l{Model Subclassing Reference}.
    25103084
    25113085    When subclassing QAbstractListModel, you must provide implementations
     
    25343108       call endRemoveRows() \e{immediately afterwards}.
    25353109    \endlist
     3110
     3111
     3112
    25363113
    25373114    \sa {Model Classes}, {Model Subclassing Reference}, QAbstractItemView,
     
    27303307    state (e.g. persistent model indexes) has been invalidated.
    27313308
    2732     \sa reset(), modelReset()
     3309    \sa (), modelReset()
    27333310*/
    27343311
     
    27403317    state (e.g. persistent model indexes) has been invalidated.
    27413318
    2742     \sa reset(), modelAboutToBeReset()
     3319    \sa (), modelAboutToBeReset()
    27433320*/
    27443321
Note: See TracChangeset for help on using the changeset viewer.