1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 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 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 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 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208
|
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QAbstractItemModel Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">  </td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a> · <a href="classes.html"><font color="#004faf">All Classes</font></a> · <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QAbstractItemModel Class Reference<br /><sup><sup>[<a href="qtcore.html">QtCore</a> module]</sup></sup></h1><p>The QAbstractItemModel class provides the abstract interface for
item model classes. <a href="#details">More...</a></p>
<p>Inherits <a href="qobject.html">QObject</a>.</p><p>Inherited by <a href="qabstractlistmodel.html">QAbstractListModel</a>, <a href="qabstractproxymodel.html">QAbstractProxyModel</a>, <a href="qabstracttablemodel.html">QAbstractTableModel</a>, <a href="qdirmodel.html">QDirModel</a>, <a href="qfilesystemmodel.html">QFileSystemModel</a>, <a href="qhelpcontentmodel.html">QHelpContentModel</a>, <a href="qproxymodel.html">QProxyModel</a> and <a href="qstandarditemmodel.html">QStandardItemModel</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qabstractitemmodel.html#QAbstractItemModel">__init__</a></b> (<i>self</i>, QObject <i>parent</i> = None)</li><li><div class="fn" /><b><a href="qabstractitemmodel.html#beginInsertColumns">beginInsertColumns</a></b> (<i>self</i>, QModelIndex <i>parent</i>, int <i>first</i>, int <i>last</i>)</li><li><div class="fn" /><b><a href="qabstractitemmodel.html#beginInsertRows">beginInsertRows</a></b> (<i>self</i>, QModelIndex <i>parent</i>, int <i>first</i>, int <i>last</i>)</li><li><div class="fn" />bool <b><a href="qabstractitemmodel.html#beginMoveColumns">beginMoveColumns</a></b> (<i>self</i>, QModelIndex <i>sourceParent</i>, int <i>sourceFirst</i>, int <i>sourceLast</i>, QModelIndex <i>destinationParent</i>, int <i>destinationColumn</i>)</li><li><div class="fn" />bool <b><a href="qabstractitemmodel.html#beginMoveRows">beginMoveRows</a></b> (<i>self</i>, QModelIndex <i>sourceParent</i>, int <i>sourceFirst</i>, int <i>sourceLast</i>, QModelIndex <i>destinationParent</i>, int <i>destinationRow</i>)</li><li><div class="fn" /><b><a href="qabstractitemmodel.html#beginRemoveColumns">beginRemoveColumns</a></b> (<i>self</i>, QModelIndex <i>parent</i>, int <i>first</i>, int <i>last</i>)</li><li><div class="fn" /><b><a href="qabstractitemmodel.html#beginRemoveRows">beginRemoveRows</a></b> (<i>self</i>, QModelIndex <i>parent</i>, int <i>first</i>, int <i>last</i>)</li><li><div class="fn" /><b><a href="qabstractitemmodel.html#beginResetModel">beginResetModel</a></b> (<i>self</i>)</li><li><div class="fn" />QModelIndex <b><a href="qabstractitemmodel.html#buddy">buddy</a></b> (<i>self</i>, QModelIndex <i>index</i>)</li><li><div class="fn" />bool <b><a href="qabstractitemmodel.html#canFetchMore">canFetchMore</a></b> (<i>self</i>, QModelIndex <i>parent</i>)</li><li><div class="fn" /><b><a href="qabstractitemmodel.html#changePersistentIndex">changePersistentIndex</a></b> (<i>self</i>, QModelIndex <i>from</i>, QModelIndex <i>to</i>)</li><li><div class="fn" /><b><a href="qabstractitemmodel.html#changePersistentIndexList">changePersistentIndexList</a></b> (<i>self</i>, unknown-type <i>from</i>, unknown-type <i>to</i>)</li><li><div class="fn" />int <b><a href="qabstractitemmodel.html#columnCount">columnCount</a></b> (<i>self</i>, QModelIndex <i>parent</i> = QModelIndex())</li><li><div class="fn" />QModelIndex <b><a href="qabstractitemmodel.html#createIndex">createIndex</a></b> (<i>self</i>, int <i>row</i>, int <i>column</i>, object <i>object</i> = 0)</li><li><div class="fn" />QVariant <b><a href="qabstractitemmodel.html#data">data</a></b> (<i>self</i>, QModelIndex <i>index</i>, int <i>role</i> = Qt.DisplayRole)</li><li><div class="fn" />bool <b><a href="qabstractitemmodel.html#decodeData">decodeData</a></b> (<i>self</i>, int <i>row</i>, int <i>column</i>, QModelIndex <i>parent</i>, QDataStream <i>stream</i>)</li><li><div class="fn" />bool <b><a href="qabstractitemmodel.html#dropMimeData">dropMimeData</a></b> (<i>self</i>, QMimeData <i>data</i>, Qt.DropAction <i>action</i>, int <i>row</i>, int <i>column</i>, QModelIndex <i>parent</i>)</li><li><div class="fn" /><b><a href="qabstractitemmodel.html#encodeData">encodeData</a></b> (<i>self</i>, unknown-type <i>indexes</i>, QDataStream <i>stream</i>)</li><li><div class="fn" /><b><a href="qabstractitemmodel.html#endInsertColumns">endInsertColumns</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qabstractitemmodel.html#endInsertRows">endInsertRows</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qabstractitemmodel.html#endMoveColumns">endMoveColumns</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qabstractitemmodel.html#endMoveRows">endMoveRows</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qabstractitemmodel.html#endRemoveColumns">endRemoveColumns</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qabstractitemmodel.html#endRemoveRows">endRemoveRows</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qabstractitemmodel.html#endResetModel">endResetModel</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qabstractitemmodel.html#fetchMore">fetchMore</a></b> (<i>self</i>, QModelIndex <i>parent</i>)</li><li><div class="fn" />Qt.ItemFlags <b><a href="qabstractitemmodel.html#flags">flags</a></b> (<i>self</i>, QModelIndex <i>index</i>)</li><li><div class="fn" />bool <b><a href="qabstractitemmodel.html#hasChildren">hasChildren</a></b> (<i>self</i>, QModelIndex <i>parent</i> = QModelIndex())</li><li><div class="fn" />bool <b><a href="qabstractitemmodel.html#hasIndex">hasIndex</a></b> (<i>self</i>, int <i>row</i>, int <i>column</i>, QModelIndex <i>parent</i> = QModelIndex())</li><li><div class="fn" />QVariant <b><a href="qabstractitemmodel.html#headerData">headerData</a></b> (<i>self</i>, int <i>section</i>, Qt.Orientation <i>orientation</i>, int <i>role</i> = Qt.DisplayRole)</li><li><div class="fn" />QModelIndex <b><a href="qabstractitemmodel.html#index">index</a></b> (<i>self</i>, int <i>row</i>, int <i>column</i>, QModelIndex <i>parent</i> = QModelIndex())</li><li><div class="fn" />bool <b><a href="qabstractitemmodel.html#insertColumn">insertColumn</a></b> (<i>self</i>, int <i>column</i>, QModelIndex <i>parent</i> = QModelIndex())</li><li><div class="fn" />bool <b><a href="qabstractitemmodel.html#insertColumns">insertColumns</a></b> (<i>self</i>, int <i>column</i>, int <i>count</i>, QModelIndex <i>parent</i> = QModelIndex())</li><li><div class="fn" />bool <b><a href="qabstractitemmodel.html#insertRow">insertRow</a></b> (<i>self</i>, int <i>row</i>, QModelIndex <i>parent</i> = QModelIndex())</li><li><div class="fn" />bool <b><a href="qabstractitemmodel.html#insertRows">insertRows</a></b> (<i>self</i>, int <i>row</i>, int <i>count</i>, QModelIndex <i>parent</i> = QModelIndex())</li><li><div class="fn" />unknown-type <b><a href="qabstractitemmodel.html#itemData">itemData</a></b> (<i>self</i>, QModelIndex <i>index</i>)</li><li><div class="fn" />unknown-type <b><a href="qabstractitemmodel.html#match">match</a></b> (<i>self</i>, QModelIndex <i>start</i>, int <i>role</i>, QVariant <i>value</i>, int <i>hits</i> = 1, Qt.MatchFlags <i>flags</i> = Qt.MatchStartsWith|Qt.MatchWrap)</li><li><div class="fn" />QMimeData <b><a href="qabstractitemmodel.html#mimeData">mimeData</a></b> (<i>self</i>, unknown-type <i>indexes</i>)</li><li><div class="fn" />QStringList <b><a href="qabstractitemmodel.html#mimeTypes">mimeTypes</a></b> (<i>self</i>)</li><li><div class="fn" />QModelIndex <b><a href="qabstractitemmodel.html#parent">parent</a></b> (<i>self</i>, QModelIndex <i>child</i>)</li><li><div class="fn" />QObject <b><a href="qabstractitemmodel.html#parent-2">parent</a></b> (<i>self</i>)</li><li><div class="fn" />unknown-type <b><a href="qabstractitemmodel.html#persistentIndexList">persistentIndexList</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qabstractitemmodel.html#removeColumn">removeColumn</a></b> (<i>self</i>, int <i>column</i>, QModelIndex <i>parent</i> = QModelIndex())</li><li><div class="fn" />bool <b><a href="qabstractitemmodel.html#removeColumns">removeColumns</a></b> (<i>self</i>, int <i>column</i>, int <i>count</i>, QModelIndex <i>parent</i> = QModelIndex())</li><li><div class="fn" />bool <b><a href="qabstractitemmodel.html#removeRow">removeRow</a></b> (<i>self</i>, int <i>row</i>, QModelIndex <i>parent</i> = QModelIndex())</li><li><div class="fn" />bool <b><a href="qabstractitemmodel.html#removeRows">removeRows</a></b> (<i>self</i>, int <i>row</i>, int <i>count</i>, QModelIndex <i>parent</i> = QModelIndex())</li><li><div class="fn" /><b><a href="qabstractitemmodel.html#reset">reset</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qabstractitemmodel.html#resetInternalData">resetInternalData</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qabstractitemmodel.html#revert">revert</a></b> (<i>self</i>)</li><li><div class="fn" />unknown-type <b><a href="qabstractitemmodel.html#roleNames">roleNames</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qabstractitemmodel.html#rowCount">rowCount</a></b> (<i>self</i>, QModelIndex <i>parent</i> = QModelIndex())</li><li><div class="fn" />bool <b><a href="qabstractitemmodel.html#setData">setData</a></b> (<i>self</i>, QModelIndex <i>index</i>, QVariant <i>value</i>, int <i>role</i> = Qt.EditRole)</li><li><div class="fn" />bool <b><a href="qabstractitemmodel.html#setHeaderData">setHeaderData</a></b> (<i>self</i>, int <i>section</i>, Qt.Orientation <i>orientation</i>, QVariant <i>value</i>, int <i>role</i> = Qt.EditRole)</li><li><div class="fn" />bool <b><a href="qabstractitemmodel.html#setItemData">setItemData</a></b> (<i>self</i>, QModelIndex <i>index</i>, unknown-type <i>roles</i>)</li><li><div class="fn" /><b><a href="qabstractitemmodel.html#setRoleNames">setRoleNames</a></b> (<i>self</i>, unknown-type <i>roleNames</i>)</li><li><div class="fn" /><b><a href="qabstractitemmodel.html#setSupportedDragActions">setSupportedDragActions</a></b> (<i>self</i>, Qt.DropActions)</li><li><div class="fn" />QModelIndex <b><a href="qabstractitemmodel.html#sibling">sibling</a></b> (<i>self</i>, int <i>row</i>, int <i>column</i>, QModelIndex <i>idx</i>)</li><li><div class="fn" /><b><a href="qabstractitemmodel.html#sort">sort</a></b> (<i>self</i>, int <i>column</i>, Qt.SortOrder <i>order</i> = Qt.AscendingOrder)</li><li><div class="fn" />QSize <b><a href="qabstractitemmodel.html#span">span</a></b> (<i>self</i>, QModelIndex <i>index</i>)</li><li><div class="fn" />bool <b><a href="qabstractitemmodel.html#submit">submit</a></b> (<i>self</i>)</li><li><div class="fn" />Qt.DropActions <b><a href="qabstractitemmodel.html#supportedDragActions">supportedDragActions</a></b> (<i>self</i>)</li><li><div class="fn" />Qt.DropActions <b><a href="qabstractitemmodel.html#supportedDropActions">supportedDropActions</a></b> (<i>self</i>)</li></ul><h3>Qt Signals</h3><ul><li><div class="fn" />void <b><a href="qabstractitemmodel.html#columnsAboutToBeInserted">columnsAboutToBeInserted</a></b> (const ::QModelIndex&,int,int)</li><li><div class="fn" />void <b><a href="qabstractitemmodel.html#columnsAboutToBeMoved">columnsAboutToBeMoved</a></b> (const ::QModelIndex&,int,int,const ::QModelIndex&,int)</li><li><div class="fn" />void <b><a href="qabstractitemmodel.html#columnsAboutToBeRemoved">columnsAboutToBeRemoved</a></b> (const ::QModelIndex&,int,int)</li><li><div class="fn" />void <b><a href="qabstractitemmodel.html#columnsInserted">columnsInserted</a></b> (const ::QModelIndex&,int,int)</li><li><div class="fn" />void <b><a href="qabstractitemmodel.html#columnsMoved">columnsMoved</a></b> (const ::QModelIndex&,int,int,const ::QModelIndex&,int)</li><li><div class="fn" />void <b><a href="qabstractitemmodel.html#columnsRemoved">columnsRemoved</a></b> (const ::QModelIndex&,int,int)</li><li><div class="fn" />void <b><a href="qabstractitemmodel.html#dataChanged">dataChanged</a></b> (const ::QModelIndex&,const ::QModelIndex&)</li><li><div class="fn" />void <b><a href="qabstractitemmodel.html#headerDataChanged">headerDataChanged</a></b> ( ::Qt::Orientation,int,int)</li><li><div class="fn" />void <b><a href="qabstractitemmodel.html#layoutAboutToBeChanged">layoutAboutToBeChanged</a></b> ()</li><li><div class="fn" />void <b><a href="qabstractitemmodel.html#layoutChanged">layoutChanged</a></b> ()</li><li><div class="fn" />void <b><a href="qabstractitemmodel.html#modelAboutToBeReset">modelAboutToBeReset</a></b> ()</li><li><div class="fn" />void <b><a href="qabstractitemmodel.html#modelReset">modelReset</a></b> ()</li><li><div class="fn" />void <b><a href="qabstractitemmodel.html#rowsAboutToBeInserted">rowsAboutToBeInserted</a></b> (const ::QModelIndex&,int,int)</li><li><div class="fn" />void <b><a href="qabstractitemmodel.html#rowsAboutToBeMoved">rowsAboutToBeMoved</a></b> (const ::QModelIndex&,int,int,const ::QModelIndex&,int)</li><li><div class="fn" />void <b><a href="qabstractitemmodel.html#rowsAboutToBeRemoved">rowsAboutToBeRemoved</a></b> (const ::QModelIndex&,int,int)</li><li><div class="fn" />void <b><a href="qabstractitemmodel.html#rowsInserted">rowsInserted</a></b> (const ::QModelIndex&,int,int)</li><li><div class="fn" />void <b><a href="qabstractitemmodel.html#rowsMoved">rowsMoved</a></b> (const ::QModelIndex&,int,int,const ::QModelIndex&,int)</li><li><div class="fn" />void <b><a href="qabstractitemmodel.html#rowsRemoved">rowsRemoved</a></b> (const ::QModelIndex&,int,int)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QAbstractItemModel class provides the abstract interface for
item model classes.</p>
<p>The QAbstractItemModel class defines the standard interface that
item models must use to be able to interoperate with other
components in the model/view architecture. It is not supposed to be
instantiated directly. Instead, you should subclass it to create
new models.</p>
<p>The QAbstractItemModel class is one of the <a href="model-view.html">Model/View Classes</a> and is part of Qt's
<a href="model-view-programming.html">model/view framework</a>.</p>
<p>If you need a model to use with a <a href="qlistview.html">QListView</a> or a <a href="qtableview.html">QTableView</a>, you should consider subclassing
<a href="qabstractlistmodel.html">QAbstractListModel</a> or
<a href="qabstracttablemodel.html">QAbstractTableModel</a> instead
of this class.</p>
<p>The underlying data model is exposed to views and delegates as a
hierarchy of tables. If you do not make use of the hierarchy, then
the model is a simple table of rows and columns. Each item has a
unique index specified by a <a href="qmodelindex.html">QModelIndex</a>.</p>
<p class="centerAlign"><img alt="" src="images/modelindex-no-parent.png" /></p>
<p>Every item of data that can be accessed via a model has an
associated model index. You can obtain this model index using the
<a href="qabstractitemmodel.html#index">index</a>() function. Each
index may have a <a href="qabstractitemmodel.html#sibling">sibling</a>() index; child items
have a <a href="qabstractitemmodel.html#parent">parent</a>()
index.</p>
<p>Each item has a number of data elements associated with it and
they can be retrieved by specifying a role (see <a href="qt.html#ItemDataRole-enum">Qt.ItemDataRole</a>) to the model's
<a href="qabstractitemmodel.html#data">data</a>() function. Data
for all available roles can be obtained at the same time using the
<a href="qabstractitemmodel.html#itemData">itemData</a>()
function.</p>
<p>Data for each role is set using a particular <a href="qt.html#ItemDataRole-enum">Qt.ItemDataRole</a>. Data for
individual roles are set individually with <a href="qabstractitemmodel.html#setData">setData</a>(), or they can be set
for all roles with <a href="qabstractitemmodel.html#setItemData">setItemData</a>().</p>
<p>Items can be queried with <a href="qabstractitemmodel.html#flags">flags</a>() (see <a href="qt.html#ItemFlag-enum">Qt.ItemFlag</a>) to see if they can be
selected, dragged, or manipulated in other ways.</p>
<p>If an item has child objects, <a href="qabstractitemmodel.html#hasChildren">hasChildren</a>() returns
true for the corresponding index.</p>
<p>The model has a <a href="qabstractitemmodel.html#rowCount">rowCount</a>() and a <a href="qabstractitemmodel.html#columnCount">columnCount</a>() for each
level of the hierarchy. Rows and columns can be inserted and
removed with <a href="qabstractitemmodel.html#insertRows">insertRows</a>(), <a href="qabstractitemmodel.html#insertColumns">insertColumns</a>(),
<a href="qabstractitemmodel.html#removeRows">removeRows</a>(), and
<a href="qabstractitemmodel.html#removeColumns">removeColumns</a>().</p>
<p>The model emits signals to indicate changes. For example,
<a href="qabstractitemmodel.html#dataChanged">dataChanged</a>() is
emitted whenever items of data made available by the model are
changed. Changes to the headers supplied by the model cause
<a href="qabstractitemmodel.html#headerDataChanged">headerDataChanged</a>()
to be emitted. If the structure of the underlying data changes, the
model can emit <a href="qabstractitemmodel.html#layoutChanged">layoutChanged</a>() to
indicate to any attached views that they should redisplay any items
shown, taking the new structure into account.</p>
<p>The items available through the model can be searched for
particular data using the <a href="qabstractitemmodel.html#match">match</a>() function.</p>
<p>To sort the model, you can use <a href="qabstractitemmodel.html#sort">sort</a>().</p>
<a id="subclassing" name="subclassing" />
<h3>Subclassing</h3>
<p><b>Note:</b> Some general guidelines for subclassing models are
available in the <a href="model-view-programming.html#model-subclassing-reference">Model
Subclassing Reference</a>.</p>
<p>When subclassing QAbstractItemModel, at the very least you must
implement <a href="qabstractitemmodel.html#index">index</a>(),
<a href="qabstractitemmodel.html#parent">parent</a>(), <a href="qabstractitemmodel.html#rowCount">rowCount</a>(), <a href="qabstractitemmodel.html#columnCount">columnCount</a>(), and
<a href="qabstractitemmodel.html#data">data</a>(). These functions
are used in all read-only models, and form the basis of editable
models.</p>
<p>You can also reimplement <a href="qabstractitemmodel.html#hasChildren">hasChildren</a>() to provide
special behavior for models where the implementation of <a href="qabstractitemmodel.html#rowCount">rowCount</a>() is expensive.
This makes it possible for models to restrict the amount of data
requested by views, and can be used as a way to implement lazy
population of model data.</p>
<p>To enable editing in your model, you must also implement
<a href="qabstractitemmodel.html#setData">setData</a>(), and
reimplement <a href="qabstractitemmodel.html#flags">flags</a>() to
ensure that <tt>ItemIsEditable</tt> is returned. You can also
reimplement <a href="qabstractitemmodel.html#headerData">headerData</a>() and <a href="qabstractitemmodel.html#setHeaderData">setHeaderData</a>() to
control the way the headers for your model are presented.</p>
<p>The <a href="qabstractitemmodel.html#dataChanged">dataChanged</a>() and
<a href="qabstractitemmodel.html#headerDataChanged">headerDataChanged</a>()
signals must be emitted explicitly when reimplementing the <a href="qabstractitemmodel.html#setData">setData</a>() and <a href="qabstractitemmodel.html#setHeaderData">setHeaderData</a>()
functions, respectively.</p>
<p>Custom models need to create model indexes for other components
to use. To do this, call <a href="qabstractitemmodel.html#createIndex">createIndex</a>() with
suitable row and column numbers for the item, and an identifier for
it, either as a pointer or as an integer value. The combination of
these values must be unique for each item. Custom models typically
use these unique identifiers in other reimplemented functions to
retrieve item data and access information about the item's parents
and children. See the <a href="itemviews-simpletreemodel.html">Simple Tree Model Example</a> for
more information about unique identifiers.</p>
<p>It is not necessary to support every role defined in <a href="qt.html#ItemDataRole-enum">Qt.ItemDataRole</a>. Depending on the
type of data contained within a model, it may only be useful to
implement the <a href="qabstractitemmodel.html#data">data</a>()
function to return valid information for some of the more common
roles. Most models provide at least a textual representation of
item data for the <a href="qt.html#ItemDataRole-enum">Qt.DisplayRole</a>, and well-behaved
models should also provide valid information for the <a href="qt.html#ItemDataRole-enum">Qt.ToolTipRole</a> and <a href="qt.html#ItemDataRole-enum">Qt.WhatsThisRole</a>. Supporting these
roles enables models to be used with standard Qt views. However,
for some models that handle highly-specialized data, it may be
appropriate to provide data only for user-defined roles.</p>
<p>Models that provide interfaces to resizable data structures can
provide implementations of <a href="qabstractitemmodel.html#insertRows">insertRows</a>(), <a href="qabstractitemmodel.html#removeRows">removeRows</a>(), <a href="qabstractitemmodel.html#insertColumns">insertColumns</a>(),and
<a href="qabstractitemmodel.html#removeColumns">removeColumns</a>(). When
implementing these functions, it is important to notify any
connected views about changes to the model's dimensions both
<i>before</i> and <i>after</i> they occur:</p>
<ul>
<li>An <a href="qabstractitemmodel.html#insertRows">insertRows</a>()
implementation must call <a href="qabstractitemmodel.html#beginInsertRows">beginInsertRows</a>()
<i>before</i> inserting new rows into the data structure, and
<a href="qabstractitemmodel.html#endInsertRows">endInsertRows</a>()
<i>immediately afterwards</i>.</li>
<li>An <a href="qabstractitemmodel.html#insertColumns">insertColumns</a>()
implementation must call <a href="qabstractitemmodel.html#beginInsertColumns">beginInsertColumns</a>()
<i>before</i> inserting new columns into the data structure, and
<a href="qabstractitemmodel.html#endInsertColumns">endInsertColumns</a>()
<i>immediately afterwards</i>.</li>
<li>A <a href="qabstractitemmodel.html#removeRows">removeRows</a>()
implementation must call <a href="qabstractitemmodel.html#beginRemoveRows">beginRemoveRows</a>()
<i>before</i> the rows are removed from the data structure, and
<a href="qabstractitemmodel.html#endRemoveRows">endRemoveRows</a>()
<i>immediately afterwards</i>.</li>
<li>A <a href="qabstractitemmodel.html#removeColumns">removeColumns</a>()
implementation must call <a href="qabstractitemmodel.html#beginRemoveColumns">beginRemoveColumns</a>()
<i>before</i> the columns are removed from the data structure, and
<a href="qabstractitemmodel.html#endRemoveColumns">endRemoveColumns</a>()
<i>immediately afterwards</i>.</li>
</ul>
<p>The <i>private</i> signals that these functions emit give
attached components the chance to take action before any data
becomes unavailable. The encapsulation of the insert and remove
operations with these begin and end functions also enables the
model to manage <a href="qpersistentmodelindex.html">persistent
model indexes</a> correctly. <b>If you want selections to be
handled properly, you must ensure that you call these
functions.</b> If you insert or remove an item with children, you
do not need to call these functions for the child items. In other
words, the parent item will take care of its child items.</p>
<p>To create models that populate incrementally, you can
reimplement <a href="qabstractitemmodel.html#fetchMore">fetchMore</a>() and <a href="qabstractitemmodel.html#canFetchMore">canFetchMore</a>(). If the
reimplementation of <a href="qabstractitemmodel.html#fetchMore">fetchMore</a>() adds rows to
the model, <a href="qabstractitemmodel.html#beginInsertRows">beginInsertRows()</a> and
<a href="qabstractitemmodel.html#endInsertRows">endInsertRows()</a>
must be called.</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QAbstractItemModel" />QAbstractItemModel.__init__ (<i>self</i>, <a href="qobject.html">QObject</a> <i>parent</i> = None)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs an abstract item model with the given
<i>parent</i>.</p>
<h3 class="fn"><a name="beginInsertColumns" />QAbstractItemModel.beginInsertColumns (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a> <i>parent</i>, int <i>first</i>, int <i>last</i>)</h3><p>Begins a column insertion operation.</p>
<p>When reimplementing <a href="qabstractitemmodel.html#insertColumns">insertColumns</a>() in a
subclass, you must call this function <i>before</i> inserting data
into the model's underlying data store.</p>
<p>The <i>parent</i> index corresponds to the parent into which the
new columns are inserted; <i>first</i> and <i>last</i> are the
column numbers of the new columns will have after they have been
inserted.</p>
<table class="generic" width="80%">
<tr class="odd" valign="top">
<td><img alt="Inserting columns" src="images/modelview-begin-insert-columns.png" /></td>
<td>Specify the first and last column numbers for the span of
columns you want to insert into an item in a model.
<p>For example, as shown in the diagram, we insert three columns
before column 4, so <i>first</i> is 4 and <i>last</i> is 6:</p>
<pre class="cpp">
beginInsertColumns(parent<span class="operator">,</span> <span class="number">4</span><span class="operator">,</span> <span class="number">6</span>);
</pre>
<p>This inserts the three new columns as columns 4, 5, and 6.</p>
</td>
</tr>
<tr class="even" valign="top">
<td><img alt="Appending columns" src="images/modelview-begin-append-columns.png" /></td>
<td>To append columns, insert them after the last column.
<p>For example, as shown in the diagram, we append three columns to
a collection of six existing columns (ending in column 5), so
<i>first</i> is 6 and <i>last</i> is 8:</p>
<pre class="cpp">
beginInsertColumns(parent<span class="operator">,</span> <span class="number">6</span><span class="operator">,</span> <span class="number">8</span>);
</pre>
<p>This appends the two new columns as columns 6, 7, and 8.</p>
</td>
</tr>
</table>
<p><b>Note:</b> This function emits the <a href="qabstractitemmodel.html#columnsAboutToBeInserted">columnsAboutToBeInserted</a>()
signal which connected views (or proxies) must handle before the
data is inserted. Otherwise, the views may end up in an invalid
state.</p>
<p><b>See also</b> <a href="qabstractitemmodel.html#endInsertColumns">endInsertColumns</a>().</p>
<h3 class="fn"><a name="beginInsertRows" />QAbstractItemModel.beginInsertRows (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a> <i>parent</i>, int <i>first</i>, int <i>last</i>)</h3><p>Begins a row insertion operation.</p>
<p>When reimplementing <a href="qabstractitemmodel.html#insertRows">insertRows</a>() in a
subclass, you must call this function <i>before</i> inserting data
into the model's underlying data store.</p>
<p>The <i>parent</i> index corresponds to the parent into which the
new rows are inserted; <i>first</i> and <i>last</i> are the row
numbers that the new rows will have after they have been
inserted.</p>
<table class="generic" width="80%">
<tr class="odd" valign="top">
<td><img alt="Inserting rows" src="images/modelview-begin-insert-rows.png" /></td>
<td>Specify the first and last row numbers for the span of rows you
want to insert into an item in a model.
<p>For example, as shown in the diagram, we insert three rows
before row 2, so <i>first</i> is 2 and <i>last</i> is 4:</p>
<pre class="cpp">
beginInsertRows(parent<span class="operator">,</span> <span class="number">2</span><span class="operator">,</span> <span class="number">4</span>);
</pre>
<p>This inserts the three new rows as rows 2, 3, and 4.</p>
</td>
</tr>
<tr class="even" valign="top">
<td><img alt="Appending rows" src="images/modelview-begin-append-rows.png" /></td>
<td>To append rows, insert them after the last row.
<p>For example, as shown in the diagram, we append two rows to a
collection of 4 existing rows (ending in row 3), so <i>first</i> is
4 and <i>last</i> is 5:</p>
<pre class="cpp">
beginInsertRows(parent<span class="operator">,</span> <span class="number">4</span><span class="operator">,</span> <span class="number">5</span>);
</pre>
<p>This appends the two new rows as rows 4 and 5.</p>
</td>
</tr>
</table>
<p><b>Note:</b> This function emits the <a href="qabstractitemmodel.html#rowsAboutToBeInserted">rowsAboutToBeInserted</a>()
signal which connected views (or proxies) must handle before the
data is inserted. Otherwise, the views may end up in an invalid
state.</p>
<p><b>See also</b> <a href="qabstractitemmodel.html#endInsertRows">endInsertRows</a>().</p>
<h3 class="fn"><a name="beginMoveColumns" />bool QAbstractItemModel.beginMoveColumns (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a> <i>sourceParent</i>, int <i>sourceFirst</i>, int <i>sourceLast</i>, <a href="qmodelindex.html">QModelIndex</a> <i>destinationParent</i>, int <i>destinationColumn</i>)</h3><p>Begins a column move operation.</p>
<p>When reimplementing a subclass, this method simplifies moving
entities in your model. This method is responsible for moving
persistent indexes in the model, which you would otherwise be
required to do yourself. Using beginMoveRows and endMoveRows is an
alternative to emitting layoutAboutToBeChanged and layoutChanged
directly along with changePersistentIndexes. layoutAboutToBeChanged
is emitted by this method for compatibility reasons.</p>
<p>The <i>sourceParent</i> index corresponds to the parent from
which the columns are moved; <i>sourceFirst</i> and
<i>sourceLast</i> are the first and last column numbers of the
columns to be moved. The <i>destinationParent</i> index corresponds
to the parent into which those columns are moved. The
<i>destinationChild</i> is the column to which the columns will be
moved. That is, the index at column <i>sourceFirst</i> in
<i>sourceParent</i> will become column <i>destinationChild</i> in
<i>destinationParent</i>, followed by all other columns up to
<i>sourceLast</i>.</p>
<p>However, when moving columns down in the same parent
(<i>sourceParent</i> and <i>destinationParent</i> are equal), the
columnss will be placed before the <i>destinationChild</i> index.
That is, if you wish to move columns 0 and 1 so they will become
columns 1 and 2, <i>destinationChild</i> should be 3. In this case,
the new index for the source column <tt>i</tt> (which is between
<i>sourceFirst</i> and <i>sourceLast</i>) is equal to
<tt>(destinationChild-sourceLast-1+i)</tt>.</p>
<p>Note that if <i>sourceParent</i> and <i>destinationParent</i>
are the same, you must ensure that the <i>destinationChild</i> is
not within the range of <i>sourceFirst</i> and <i>sourceLast</i> +
1. You must also ensure that you do not attempt to move a column to
one of its own children or ancestors. This method returns false if
either condition is true, in which case you should abort your move
operation.</p>
<p>This function was introduced in Qt 4.6.</p>
<p><b>See also</b> <a href="qabstractitemmodel.html#endMoveColumns">endMoveColumns</a>().</p>
<h3 class="fn"><a name="beginMoveRows" />bool QAbstractItemModel.beginMoveRows (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a> <i>sourceParent</i>, int <i>sourceFirst</i>, int <i>sourceLast</i>, <a href="qmodelindex.html">QModelIndex</a> <i>destinationParent</i>, int <i>destinationRow</i>)</h3><p>Begins a row move operation.</p>
<p>When reimplementing a subclass, this method simplifies moving
entities in your model. This method is responsible for moving
persistent indexes in the model, which you would otherwise be
required to do yourself. Using beginMoveRows and endMoveRows is an
alternative to emitting layoutAboutToBeChanged and layoutChanged
directly along with changePersistentIndexes. layoutAboutToBeChanged
is emitted by this method for compatibility reasons.</p>
<p>The <i>sourceParent</i> index corresponds to the parent from
which the rows are moved; <i>sourceFirst</i> and <i>sourceLast</i>
are the first and last row numbers of the rows to be moved. The
<i>destinationParent</i> index corresponds to the parent into which
those rows are moved. The <i>destinationChild</i> is the row to
which the rows will be moved. That is, the index at row
<i>sourceFirst</i> in <i>sourceParent</i> will become row
<i>destinationChild</i> in <i>destinationParent</i>, followed by
all other rows up to <i>sourceLast</i>.</p>
<p>However, when moving rows down in the same parent
(<i>sourceParent</i> and <i>destinationParent</i> are equal), the
rows will be placed before the <i>destinationChild</i> index. That
is, if you wish to move rows 0 and 1 so they will become rows 1 and
2, <i>destinationChild</i> should be 3. In this case, the new index
for the source row <tt>i</tt> (which is between <i>sourceFirst</i>
and <i>sourceLast</i>) is equal to
<tt>(destinationChild-sourceLast-1+i)</tt>.</p>
<p>Note that if <i>sourceParent</i> and <i>destinationParent</i>
are the same, you must ensure that the <i>destinationChild</i> is
not within the range of <i>sourceFirst</i> and <i>sourceLast</i> +
1. You must also ensure that you do not attempt to move a row to
one of its own children or ancestors. This method returns false if
either condition is true, in which case you should abort your move
operation.</p>
<table class="generic" width="80%">
<tr class="odd" valign="top">
<td><img alt="Moving rows to another parent" src="images/modelview-move-rows-1.png" /></td>
<td>Specify the first and last row numbers for the span of rows in
the source parent you want to move in the model. Also specify the
row in the destination parent to move the span to.
<p>For example, as shown in the diagram, we move three rows from
row 2 to 4 in the source, so <i>sourceFirst</i> is 2 and
<i>sourceLast</i> is 4. We move those items to above row 2 in the
destination, so <i>destinationChild</i> is 2.</p>
<pre class="cpp">
beginMoveRows(sourceParent<span class="operator">,</span> <span class="number">2</span><span class="operator">,</span> <span class="number">4</span><span class="operator">,</span> destinationParent<span class="operator">,</span> <span class="number">2</span>);
</pre>
<p>This moves the three rows rows 2, 3, and 4 in the source to
become 2, 3 and 4 in the destination. Other affected siblings are
displaced accordingly.</p>
</td>
</tr>
<tr class="even" valign="top">
<td><img alt="Moving rows to append to another parent" src="images/modelview-move-rows-2.png" /></td>
<td>To append rows to another parent, move them to after the last
row.
<p>For example, as shown in the diagram, we move three rows to a
collection of 6 existing rows (ending in row 5), so
<i>destinationChild</i> is 6:</p>
<pre class="cpp">
beginMoveRows(sourceParent<span class="operator">,</span> <span class="number">2</span><span class="operator">,</span> <span class="number">4</span><span class="operator">,</span> destinationParent<span class="operator">,</span> <span class="number">6</span>);
</pre>
<p>This moves the target rows to the end of the target parent as 6,
7 and 8.</p>
</td>
</tr>
<tr class="odd" valign="top">
<td><img alt="Moving rows in the same parent up" src="images/modelview-move-rows-3.png" /></td>
<td>To move rows within the same parent, specify the row to move
them to.
<p>For example, as shown in the diagram, we move one item from row
2 to row 0, so <i>sourceFirst</i> and <i>sourceLast</i> are 2 and
<i>destinationChild</i> is 0.</p>
<pre class="cpp">
beginMoveRows(parent<span class="operator">,</span> <span class="number">2</span><span class="operator">,</span> <span class="number">2</span><span class="operator">,</span> parent<span class="operator">,</span> <span class="number">0</span>);
</pre>
<p>Note that other rows may be displaced accordingly. Note also
that when moving items within the same parent you should not
attempt invalid or no-op moves. In the above example, item 2 is at
row 2 before the move, so it can not be moved to row 2 (where it is
already) or row 3 (no-op as row 3 means above row 3, where it is
already)</p>
</td>
</tr>
<tr class="even" valign="top">
<td><img alt="Moving rows in the same parent down" src="images/modelview-move-rows-4.png" /></td>
<td>To move rows within the same parent, specify the row to move
them to.
<p>For example, as shown in the diagram, we move one item from row
2 to row 4, so <i>sourceFirst</i> and <i>sourceLast</i> are 2 and
<i>destinationChild</i> is 4.</p>
<pre class="cpp">
beginMoveRows(parent<span class="operator">,</span> <span class="number">2</span><span class="operator">,</span> <span class="number">2</span><span class="operator">,</span> parent<span class="operator">,</span> <span class="number">4</span>);
</pre>
<p>Note that other rows may be displaced accordingly.</p>
</td>
</tr>
</table>
<p>This function was introduced in Qt 4.6.</p>
<p><b>See also</b> <a href="qabstractitemmodel.html#endMoveRows">endMoveRows</a>().</p>
<h3 class="fn"><a name="beginRemoveColumns" />QAbstractItemModel.beginRemoveColumns (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a> <i>parent</i>, int <i>first</i>, int <i>last</i>)</h3><p>Begins a column removal operation.</p>
<p>When reimplementing <a href="qabstractitemmodel.html#removeColumns">removeColumns</a>() in a
subclass, you must call this function <i>before</i> removing data
from the model's underlying data store.</p>
<p>The <i>parent</i> index corresponds to the parent from which the
new columns are removed; <i>first</i> and <i>last</i> are the
column numbers of the first and last columns to be removed.</p>
<table class="generic" width="80%">
<tr class="odd" valign="top">
<td><img alt="Removing columns" src="images/modelview-begin-remove-columns.png" /></td>
<td>Specify the first and last column numbers for the span of
columns you want to remove from an item in a model.
<p>For example, as shown in the diagram, we remove the three
columns from column 4 to column 6, so <i>first</i> is 4 and
<i>last</i> is 6:</p>
<pre class="cpp">
beginRemoveColumns(parent<span class="operator">,</span> <span class="number">4</span><span class="operator">,</span> <span class="number">6</span>);
</pre></td>
</tr>
</table>
<p><b>Note:</b> This function emits the <a href="qabstractitemmodel.html#columnsAboutToBeRemoved">columnsAboutToBeRemoved</a>()
signal which connected views (or proxies) must handle before the
data is removed. Otherwise, the views may end up in an invalid
state.</p>
<p><b>See also</b> <a href="qabstractitemmodel.html#endRemoveColumns">endRemoveColumns</a>().</p>
<h3 class="fn"><a name="beginRemoveRows" />QAbstractItemModel.beginRemoveRows (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a> <i>parent</i>, int <i>first</i>, int <i>last</i>)</h3><p>Begins a row removal operation.</p>
<p>When reimplementing <a href="qabstractitemmodel.html#removeRows">removeRows</a>() in a
subclass, you must call this function <i>before</i> removing data
from the model's underlying data store.</p>
<p>The <i>parent</i> index corresponds to the parent from which the
new rows are removed; <i>first</i> and <i>last</i> are the row
numbers of the rows to be removed.</p>
<table class="generic" width="80%">
<tr class="odd" valign="top">
<td><img alt="Removing rows" src="images/modelview-begin-remove-rows.png" /></td>
<td>Specify the first and last row numbers for the span of rows you
want to remove from an item in a model.
<p>For example, as shown in the diagram, we remove the two rows
from row 2 to row 3, so <i>first</i> is 2 and <i>last</i> is 3:</p>
<pre class="cpp">
beginRemoveRows(parent<span class="operator">,</span> <span class="number">2</span><span class="operator">,</span> <span class="number">3</span>);
</pre></td>
</tr>
</table>
<p><b>Note:</b> This function emits the <a href="qabstractitemmodel.html#rowsAboutToBeRemoved">rowsAboutToBeRemoved</a>()
signal which connected views (or proxies) must handle before the
data is removed. Otherwise, the views may end up in an invalid
state.</p>
<p><b>See also</b> <a href="qabstractitemmodel.html#endRemoveRows">endRemoveRows</a>().</p>
<h3 class="fn"><a name="beginResetModel" />QAbstractItemModel.beginResetModel (<i>self</i>)</h3><p>Begins a model reset operation.</p>
<p>A reset operation resets the model to its current state in any
attached views.</p>
<p><b>Note:</b> Any views attached to this model will be reset as
well.</p>
<p>When a model is reset it means that any previous data reported
from the model is now invalid and has to be queried for again. This
also means that the current item and any selected items will become
invalid.</p>
<p>When a model radically changes its data it can sometimes be
easier to just call this function rather than emit <a href="qabstractitemmodel.html#dataChanged">dataChanged</a>() to inform
other components when the underlying data source, or its structure,
has changed.</p>
<p>You must call this function before resetting any internal data
structures in your model or proxy model.</p>
<p>This function was introduced in Qt 4.6.</p>
<p><b>See also</b> <a href="qabstractitemmodel.html#modelAboutToBeReset">modelAboutToBeReset</a>(),
<a href="qabstractitemmodel.html#modelReset">modelReset</a>(), and
<a href="qabstractitemmodel.html#endResetModel">endResetModel</a>().</p>
<h3 class="fn"><a name="buddy" /><a href="qmodelindex.html">QModelIndex</a> QAbstractItemModel.buddy (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a> <i>index</i>)</h3><p>Returns a model index for the buddy of the item represented by
<i>index</i>. When the user wants to edit an item, the view will
call this function to check whether another item in the model
should be edited instead. Then, the view will construct a delegate
using the model index returned by the buddy item.</p>
<p>The default implementation of this function has each item as its
own buddy.</p>
<h3 class="fn"><a name="canFetchMore" />bool QAbstractItemModel.canFetchMore (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a> <i>parent</i>)</h3><p>Returns true if there is more data available for <i>parent</i>;
otherwise returns false.</p>
<p>The default implementation always returns false.</p>
<p>If canFetchMore() returns true, <a href="qabstractitemview.html">QAbstractItemView</a> will call <a href="qabstractitemmodel.html#fetchMore">fetchMore</a>(). However, the
<a href="qabstractitemmodel.html#fetchMore">fetchMore</a>()
function is only called when the model is being populated
incrementally.</p>
<p><b>See also</b> <a href="qabstractitemmodel.html#fetchMore">fetchMore</a>().</p>
<h3 class="fn"><a name="changePersistentIndex" />QAbstractItemModel.changePersistentIndex (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a> <i>from</i>, <a href="qmodelindex.html">QModelIndex</a> <i>to</i>)</h3><p>Changes the <a href="qpersistentmodelindex.html">QPersistentModelIndex</a> that is
equal to the given <i>from</i> model index to the given <i>to</i>
model index.</p>
<p>If no persistent model index equal to the given <i>from</i>
model index was found, nothing is changed.</p>
<p><b>See also</b> <a href="qabstractitemmodel.html#persistentIndexList">persistentIndexList</a>()
and <a href="qabstractitemmodel.html#changePersistentIndexList">changePersistentIndexList</a>().</p>
<h3 class="fn"><a name="changePersistentIndexList" />QAbstractItemModel.changePersistentIndexList (<i>self</i>, unknown-type <i>from</i>, unknown-type <i>to</i>)</h3><p>Changes the QPersistentModelIndexes that is equal to the indexes
in the given <i>from</i> model index list to the given <i>to</i>
model index list.</p>
<p>If no persistent model indexes equal to the indexes in the given
<i>from</i> model index list was found, nothing is changed.</p>
<p>This function was introduced in Qt 4.1.</p>
<p><b>See also</b> <a href="qabstractitemmodel.html#persistentIndexList">persistentIndexList</a>()
and <a href="qabstractitemmodel.html#changePersistentIndex">changePersistentIndex</a>().</p>
<h3 class="fn"><a name="columnCount" />int QAbstractItemModel.columnCount (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a> <i>parent</i> = QModelIndex())</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>Returns the number of columns for the children of the given
<i>parent</i>.</p>
<p>In most subclasses, the number of columns is independent of the
<i>parent</i>.</p>
<p>For example:</p>
<pre class="cpp">
<span class="type">int</span> DomModel<span class="operator">.</span>columnCount(<span class="keyword">const</span> <span class="type"><a href="qmodelindex.html">QModelIndex</a></span> <span class="operator">&</span><span class="comment">/*parent*/</span>) <span class="keyword">const</span>
{
<span class="keyword">return</span> <span class="number">3</span>;
}
</pre>
<p><b>Note:</b> When implementing a table based model,
columnCount() should return 0 when the parent is valid.</p>
<p><b>See also</b> <a href="qabstractitemmodel.html#rowCount">rowCount</a>().</p>
<h3 class="fn"><a name="createIndex" /><a href="qmodelindex.html">QModelIndex</a> QAbstractItemModel.createIndex (<i>self</i>, int <i>row</i>, int <i>column</i>, object <i>object</i> = 0)</h3><p>Creates a model index for the given <i>row</i> and <i>column</i>
with the internal pointer <i>ptr</i>.</p>
<p>When using a <a href="qsortfilterproxymodel.html">QSortFilterProxyModel</a>, its indexes
have their own internal pointer. It is not advisable to access this
internal pointer outside of the model. Use the <a href="qabstractitemmodel.html#data">data</a>() function instead.</p>
<p>This function provides a consistent interface that model
subclasses must use to create model indexes.</p>
<h3 class="fn"><a name="data" />QVariant QAbstractItemModel.data (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a> <i>index</i>, int <i>role</i> = Qt.DisplayRole)</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>Returns the data stored under the given <i>role</i> for the item
referred to by the <i>index</i>.</p>
<p><b>Note:</b> If you do not have a value to return, return an
<b>invalid</b> <a href="qvariant.html">QVariant</a> instead of
returning 0.</p>
<p><b>See also</b> <a href="qt.html#ItemDataRole-enum">Qt.ItemDataRole</a>, <a href="qabstractitemmodel.html#setData">setData</a>(), and <a href="qabstractitemmodel.html#headerData">headerData</a>().</p>
<h3 class="fn"><a name="decodeData" />bool QAbstractItemModel.decodeData (<i>self</i>, int <i>row</i>, int <i>column</i>, <a href="qmodelindex.html">QModelIndex</a> <i>parent</i>, <a href="qdatastream.html">QDataStream</a> <i>stream</i>)</h3><h3 class="fn"><a name="dropMimeData" />bool QAbstractItemModel.dropMimeData (<i>self</i>, <a href="qmimedata.html">QMimeData</a> <i>data</i>, <a href="qt.html#DropAction-enum">Qt.DropAction</a> <i>action</i>, int <i>row</i>, int <i>column</i>, <a href="qmodelindex.html">QModelIndex</a> <i>parent</i>)</h3><p>Handles the <i>data</i> supplied by a drag and drop operation
that ended with the given <i>action</i>.</p>
<p>Returns true if the data and action can be handled by the model;
otherwise returns false.</p>
<p>The specified <i>row</i>, <i>column</i> and <i>parent</i>
indicate the location of an item in the model where the operation
ended. It is the responsibility of the model to complete the action
at the correct location.</p>
<p>For instance, a drop action on an item in a <a href="qtreeview.html">QTreeView</a> can result in new items either being
inserted as children of the item specified by <i>row</i>,
<i>column</i>, and <i>parent</i>, or as siblings of the item.</p>
<p>When <i>row</i> and <i>column</i> are -1 it means that the
dropped data should be considered as dropped directly on
<i>parent</i>. Usually this will mean appending the data as child
items of <i>parent</i>. If <i>row</i> and column are greater than
or equal zero, it means that the drop occurred just before the
specified <i>row</i> and <i>column</i> in the specified
<i>parent</i>.</p>
<p><b>See also</b> <a href="qabstractitemmodel.html#supportedDropActions">supportedDropActions</a>()
and <a href="model-view-programming.html#using-drag-and-drop-with-item-views">Using
drag and drop with item views</a>.</p>
<h3 class="fn"><a name="encodeData" />QAbstractItemModel.encodeData (<i>self</i>, unknown-type <i>indexes</i>, <a href="qdatastream.html">QDataStream</a> <i>stream</i>)</h3><h3 class="fn"><a name="endInsertColumns" />QAbstractItemModel.endInsertColumns (<i>self</i>)</h3><p>Ends a column insertion operation.</p>
<p>When reimplementing <a href="qabstractitemmodel.html#insertColumns">insertColumns</a>() in a
subclass, you must call this function <i>after</i> inserting data
into the model's underlying data store.</p>
<p><b>See also</b> <a href="qabstractitemmodel.html#beginInsertColumns">beginInsertColumns</a>().</p>
<h3 class="fn"><a name="endInsertRows" />QAbstractItemModel.endInsertRows (<i>self</i>)</h3><p>Ends a row insertion operation.</p>
<p>When reimplementing <a href="qabstractitemmodel.html#insertRows">insertRows</a>() in a
subclass, you must call this function <i>after</i> inserting data
into the model's underlying data store.</p>
<p><b>See also</b> <a href="qabstractitemmodel.html#beginInsertRows">beginInsertRows</a>().</p>
<h3 class="fn"><a name="endMoveColumns" />QAbstractItemModel.endMoveColumns (<i>self</i>)</h3><p>Ends a column move operation.</p>
<p>When implementing a subclass, you must call this function
<i>after</i> moving data within the model's underlying data
store.</p>
<p>layoutChanged is emitted by this method for compatibility
reasons.</p>
<p>This function was introduced in Qt 4.6.</p>
<p><b>See also</b> <a href="qabstractitemmodel.html#beginMoveColumns">beginMoveColumns</a>().</p>
<h3 class="fn"><a name="endMoveRows" />QAbstractItemModel.endMoveRows (<i>self</i>)</h3><p>Ends a row move operation.</p>
<p>When implementing a subclass, you must call this function
<i>after</i> moving data within the model's underlying data
store.</p>
<p>layoutChanged is emitted by this method for compatibility
reasons.</p>
<p>This function was introduced in Qt 4.6.</p>
<p><b>See also</b> <a href="qabstractitemmodel.html#beginMoveRows">beginMoveRows</a>().</p>
<h3 class="fn"><a name="endRemoveColumns" />QAbstractItemModel.endRemoveColumns (<i>self</i>)</h3><p>Ends a column removal operation.</p>
<p>When reimplementing <a href="qabstractitemmodel.html#removeColumns">removeColumns</a>() in a
subclass, you must call this function <i>after</i> removing data
from the model's underlying data store.</p>
<p><b>See also</b> <a href="qabstractitemmodel.html#beginRemoveColumns">beginRemoveColumns</a>().</p>
<h3 class="fn"><a name="endRemoveRows" />QAbstractItemModel.endRemoveRows (<i>self</i>)</h3><p>Ends a row removal operation.</p>
<p>When reimplementing <a href="qabstractitemmodel.html#removeRows">removeRows</a>() in a
subclass, you must call this function <i>after</i> removing data
from the model's underlying data store.</p>
<p><b>See also</b> <a href="qabstractitemmodel.html#beginRemoveRows">beginRemoveRows</a>().</p>
<h3 class="fn"><a name="endResetModel" />QAbstractItemModel.endResetModel (<i>self</i>)</h3><p>Completes a model reset operation.</p>
<p>You must call this function after resetting any internal data
structure in your model or proxy model.</p>
<p>This function was introduced in Qt 4.6.</p>
<p><b>See also</b> <a href="qabstractitemmodel.html#beginResetModel">beginResetModel</a>().</p>
<h3 class="fn"><a name="fetchMore" />QAbstractItemModel.fetchMore (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a> <i>parent</i>)</h3><p>Fetches any available data for the items with the parent
specified by the <i>parent</i> index.</p>
<p>Reimplement this if you are populating your model
incrementally.</p>
<p>The default implementation does nothing.</p>
<p><b>See also</b> <a href="qabstractitemmodel.html#canFetchMore">canFetchMore</a>().</p>
<h3 class="fn"><a name="flags" /><a href="qt-itemflags.html">Qt.ItemFlags</a> QAbstractItemModel.flags (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a> <i>index</i>)</h3><p>Returns the item flags for the given <i>index</i>.</p>
<p>The base class implementation returns a combination of flags
that enables the item (<tt>ItemIsEnabled</tt>) and allows it to be
selected (<tt>ItemIsSelectable</tt>).</p>
<p><b>See also</b> <a href="qt.html#ItemFlag-enum">Qt.ItemFlags</a>.</p>
<h3 class="fn"><a name="hasChildren" />bool QAbstractItemModel.hasChildren (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a> <i>parent</i> = QModelIndex())</h3><p>Returns true if <i>parent</i> has any children; otherwise
returns false.</p>
<p>Use <a href="qabstractitemmodel.html#rowCount">rowCount</a>() on
the parent to find out the number of children.</p>
<p><b>See also</b> <a href="qabstractitemmodel.html#parent">parent</a>() and <a href="qabstractitemmodel.html#index">index</a>().</p>
<h3 class="fn"><a name="hasIndex" />bool QAbstractItemModel.hasIndex (<i>self</i>, int <i>row</i>, int <i>column</i>, <a href="qmodelindex.html">QModelIndex</a> <i>parent</i> = QModelIndex())</h3><p>Returns true if the model returns a valid <a href="qmodelindex.html">QModelIndex</a> for <i>row</i> and <i>column</i>
with <i>parent</i>, otherwise returns false.</p>
<h3 class="fn"><a name="headerData" />QVariant QAbstractItemModel.headerData (<i>self</i>, int <i>section</i>, <a href="qt.html#Orientation-enum">Qt.Orientation</a> <i>orientation</i>, int <i>role</i> = Qt.DisplayRole)</h3><p>Returns the data for the given <i>role</i> and <i>section</i> in
the header with the specified <i>orientation</i>.</p>
<p>For horizontal headers, the section number corresponds to the
column number. Similarly, for vertical headers, the section number
corresponds to the row number.</p>
<p><b>See also</b> <a href="qt.html#ItemDataRole-enum">Qt.ItemDataRole</a>, <a href="qabstractitemmodel.html#setHeaderData">setHeaderData</a>(), and
<a href="qheaderview.html">QHeaderView</a>.</p>
<h3 class="fn"><a name="index" /><a href="qmodelindex.html">QModelIndex</a> QAbstractItemModel.index (<i>self</i>, int <i>row</i>, int <i>column</i>, <a href="qmodelindex.html">QModelIndex</a> <i>parent</i> = QModelIndex())</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>Returns the index of the item in the model specified by the
given <i>row</i>, <i>column</i> and <i>parent</i> index.</p>
<p>When reimplementing this function in a subclass, call <a href="qabstractitemmodel.html#createIndex">createIndex</a>() to generate
model indexes that other components can use to refer to items in
your model.</p>
<p><b>See also</b> <a href="qabstractitemmodel.html#createIndex">createIndex</a>().</p>
<h3 class="fn"><a name="insertColumn" />bool QAbstractItemModel.insertColumn (<i>self</i>, int <i>column</i>, <a href="qmodelindex.html">QModelIndex</a> <i>parent</i> = QModelIndex())</h3><p>Inserts a single column before the given <i>column</i> in the
child items of the <i>parent</i> specified.</p>
<p>Returns true if the column is inserted; otherwise returns
false.</p>
<p><b>See also</b> <a href="qabstractitemmodel.html#insertColumns">insertColumns</a>(),
<a href="qabstractitemmodel.html#insertRow">insertRow</a>(), and
<a href="qabstractitemmodel.html#removeColumn">removeColumn</a>().</p>
<h3 class="fn"><a name="insertColumns" />bool QAbstractItemModel.insertColumns (<i>self</i>, int <i>column</i>, int <i>count</i>, <a href="qmodelindex.html">QModelIndex</a> <i>parent</i> = QModelIndex())</h3><p>On models that support this, inserts <i>count</i> new columns
into the model before the given <i>column</i>. The items in each
new column will be children of the item represented by the
<i>parent</i> model index.</p>
<p>If <i>column</i> is 0, the columns are prepended to any existing
columns.</p>
<p>If <i>column</i> is <a href="qabstractitemmodel.html#columnCount">columnCount</a>(), the
columns are appended to any existing columns.</p>
<p>If <i>parent</i> has no children, a single row with <i>count</i>
columns is inserted.</p>
<p>Returns true if the columns were successfully inserted;
otherwise returns false.</p>
<p>The base class implementation does nothing and returns
false.</p>
<p>If you implement your own model, you can reimplement this
function if you want to support insertions. Alternatively, you can
provide your own API for altering the data.</p>
<p><b>See also</b> <a href="qabstractitemmodel.html#insertRows">insertRows</a>(), <a href="qabstractitemmodel.html#removeColumns">removeColumns</a>(),
<a href="qabstractitemmodel.html#beginInsertColumns">beginInsertColumns</a>(),
and <a href="qabstractitemmodel.html#endInsertColumns">endInsertColumns</a>().</p>
<h3 class="fn"><a name="insertRow" />bool QAbstractItemModel.insertRow (<i>self</i>, int <i>row</i>, <a href="qmodelindex.html">QModelIndex</a> <i>parent</i> = QModelIndex())</h3><p><b>Note:</b> The base class implementation of this function does
nothing and returns false.</p>
<p>Inserts a single row before the given <i>row</i> in the child
items of the <i>parent</i> specified.</p>
<p>Returns true if the row is inserted; otherwise returns
false.</p>
<p><b>See also</b> <a href="qabstractitemmodel.html#insertRows">insertRows</a>(), <a href="qabstractitemmodel.html#insertColumn">insertColumn</a>(), and
<a href="qabstractitemmodel.html#removeRow">removeRow</a>().</p>
<h3 class="fn"><a name="insertRows" />bool QAbstractItemModel.insertRows (<i>self</i>, int <i>row</i>, int <i>count</i>, <a href="qmodelindex.html">QModelIndex</a> <i>parent</i> = QModelIndex())</h3><p><b>Note:</b> The base class implementation of this function does
nothing and returns false.</p>
<p>On models that support this, inserts <i>count</i> rows into the
model before the given <i>row</i>. Items in the new row will be
children of the item represented by the <i>parent</i> model
index.</p>
<p>If <i>row</i> is 0, the rows are prepended to any existing rows
in the parent.</p>
<p>If <i>row</i> is <a href="qabstractitemmodel.html#rowCount">rowCount</a>(), the rows are
appended to any existing rows in the parent.</p>
<p>If <i>parent</i> has no children, a single column with
<i>count</i> rows is inserted.</p>
<p>Returns true if the rows were successfully inserted; otherwise
returns false.</p>
<p>If you implement your own model, you can reimplement this
function if you want to support insertions. Alternatively, you can
provide your own API for altering the data. In either case, you
will need to call <a href="qabstractitemmodel.html#beginInsertRows">beginInsertRows</a>() and
<a href="qabstractitemmodel.html#endInsertRows">endInsertRows</a>()
to notify other components that the model has changed.</p>
<p><b>See also</b> <a href="qabstractitemmodel.html#insertColumns">insertColumns</a>(),
<a href="qabstractitemmodel.html#removeRows">removeRows</a>(),
<a href="qabstractitemmodel.html#beginInsertRows">beginInsertRows</a>(),
and <a href="qabstractitemmodel.html#endInsertRows">endInsertRows</a>().</p>
<h3 class="fn"><a name="itemData" />unknown-type QAbstractItemModel.itemData (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a> <i>index</i>)</h3><p>Returns a map with values for all predefined roles in the model
for the item at the given <i>index</i>.</p>
<p>Reimplement this function if you want to extend the default
behavior of this function to include custom roles in the map.</p>
<p><b>See also</b> <a href="qabstractitemmodel.html#setItemData">setItemData</a>(), <a href="qt.html#ItemDataRole-enum">Qt.ItemDataRole</a>, and <a href="qabstractitemmodel.html#data">data</a>().</p>
<h3 class="fn"><a name="match" />unknown-type QAbstractItemModel.match (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a> <i>start</i>, int <i>role</i>, QVariant <i>value</i>, int <i>hits</i> = 1, <a href="qt-matchflags.html">Qt.MatchFlags</a> <i>flags</i> = Qt.MatchStartsWith|Qt.MatchWrap)</h3><p>Returns a list of indexes for the items in the column of the
<i>start</i> index where data stored under the given <i>role</i>
matches the specified <i>value</i>. The way the search is performed
is defined by the <i>flags</i> given. The list that is returned may
be empty.</p>
<p>The search begins from the <i>start</i> index, and continues
until the number of matching data items equals <i>hits</i>, the
search reaches the last row, or the search reaches <i>start</i>
again - depending on whether <tt>MatchWrap</tt> is specified in
<i>flags</i>. If you want to search for all matching items, use
<i>hits</i> = -1.</p>
<p>By default, this function will perform a wrapping, string-based
comparison on all items, searching for items that begin with the
search term specified by <i>value</i>.</p>
<p><b>Note:</b> The default implementation of this function only
searches columns. Reimplement this function to include a different
search behavior.</p>
<h3 class="fn"><a name="mimeData" /><a href="qmimedata.html">QMimeData</a> QAbstractItemModel.mimeData (<i>self</i>, unknown-type <i>indexes</i>)</h3><p>The <i>QMimeData</i> result</p><p>Returns an object that contains serialized items of data
corresponding to the list of <i>indexes</i> specified. The formats
used to describe the encoded data is obtained from the <a href="qabstractitemmodel.html#mimeTypes">mimeTypes</a>() function.</p>
<p>If the list of indexes is empty, or there are no supported MIME
types, 0 is returned rather than a serialized empty list.</p>
<p><b>See also</b> <a href="qabstractitemmodel.html#mimeTypes">mimeTypes</a>() and <a href="qabstractitemmodel.html#dropMimeData">dropMimeData</a>().</p>
<h3 class="fn"><a name="mimeTypes" />QStringList QAbstractItemModel.mimeTypes (<i>self</i>)</h3><p>Returns a list of MIME types that can be used to describe a list
of model indexes.</p>
<p><b>See also</b> <a href="qabstractitemmodel.html#mimeData">mimeData</a>().</p>
<h3 class="fn"><a name="parent" /><a href="qmodelindex.html">QModelIndex</a> QAbstractItemModel.parent (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a> <i>child</i>)</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>Returns the parent of the model item with the given
<i>index</i>. If the item has no parent, an invalid <a href="qmodelindex.html">QModelIndex</a> is returned.</p>
<p>A common convention used in models that expose tree data
structures is that only items in the first column have children.
For that case, when reimplementing this function in a subclass the
column of the returned <a href="qmodelindex.html">QModelIndex</a>
would be 0.</p>
<p>When reimplementing this function in a subclass, be careful to
avoid calling <a href="qmodelindex.html">QModelIndex</a> member
functions, such as <a href="qmodelindex.html#parent">QModelIndex.parent</a>(), since indexes
belonging to your model will simply call your implementation,
leading to infinite recursion.</p>
<p><b>See also</b> <a href="qabstractitemmodel.html#createIndex">createIndex</a>().</p>
<h3 class="fn"><a name="parent-2" /><a href="qobject.html">QObject</a> QAbstractItemModel.parent (<i>self</i>)</h3><h3 class="fn"><a name="persistentIndexList" />unknown-type QAbstractItemModel.persistentIndexList (<i>self</i>)</h3><p>Returns the list of indexes stored as persistent indexes in the
model.</p>
<p>This function was introduced in Qt 4.2.</p>
<h3 class="fn"><a name="removeColumn" />bool QAbstractItemModel.removeColumn (<i>self</i>, int <i>column</i>, <a href="qmodelindex.html">QModelIndex</a> <i>parent</i> = QModelIndex())</h3><p>Removes the given <i>column</i> from the child items of the
<i>parent</i> specified.</p>
<p>Returns true if the column is removed; otherwise returns
false.</p>
<p><b>See also</b> <a href="qabstractitemmodel.html#removeColumns">removeColumns</a>(),
<a href="qabstractitemmodel.html#removeRow">removeRow</a>(), and
<a href="qabstractitemmodel.html#insertColumn">insertColumn</a>().</p>
<h3 class="fn"><a name="removeColumns" />bool QAbstractItemModel.removeColumns (<i>self</i>, int <i>column</i>, int <i>count</i>, <a href="qmodelindex.html">QModelIndex</a> <i>parent</i> = QModelIndex())</h3><p>On models that support this, removes <i>count</i> columns
starting with the given <i>column</i> under parent <i>parent</i>
from the model.</p>
<p>Returns true if the columns were successfully removed; otherwise
returns false.</p>
<p>The base class implementation does nothing and returns
false.</p>
<p>If you implement your own model, you can reimplement this
function if you want to support removing. Alternatively, you can
provide your own API for altering the data.</p>
<p><b>See also</b> <a href="qabstractitemmodel.html#removeColumn">removeColumn</a>(), <a href="qabstractitemmodel.html#removeRows">removeRows</a>(), <a href="qabstractitemmodel.html#insertColumns">insertColumns</a>(),
<a href="qabstractitemmodel.html#beginRemoveColumns">beginRemoveColumns</a>(),
and <a href="qabstractitemmodel.html#endRemoveColumns">endRemoveColumns</a>().</p>
<h3 class="fn"><a name="removeRow" />bool QAbstractItemModel.removeRow (<i>self</i>, int <i>row</i>, <a href="qmodelindex.html">QModelIndex</a> <i>parent</i> = QModelIndex())</h3><p>Removes the given <i>row</i> from the child items of the
<i>parent</i> specified.</p>
<p>Returns true if the row is removed; otherwise returns false.</p>
<p>This is a convenience function that calls <a href="qabstractitemmodel.html#removeRows">removeRows</a>(). The <a href="qabstractitemmodel.html">QAbstractItemModel</a> implementation of
<a href="qabstractitemmodel.html#removeRows">removeRows</a>() does
nothing.</p>
<p><b>See also</b> <a href="qabstractitemmodel.html#removeRows">removeRows</a>(), <a href="qabstractitemmodel.html#removeColumn">removeColumn</a>(), and
<a href="qabstractitemmodel.html#insertRow">insertRow</a>().</p>
<h3 class="fn"><a name="removeRows" />bool QAbstractItemModel.removeRows (<i>self</i>, int <i>row</i>, int <i>count</i>, <a href="qmodelindex.html">QModelIndex</a> <i>parent</i> = QModelIndex())</h3><p>On models that support this, removes <i>count</i> rows starting
with the given <i>row</i> under parent <i>parent</i> from the
model.</p>
<p>Returns true if the rows were successfully removed; otherwise
returns false.</p>
<p>The base class implementation does nothing and returns
false.</p>
<p>If you implement your own model, you can reimplement this
function if you want to support removing. Alternatively, you can
provide your own API for altering the data.</p>
<p><b>See also</b> <a href="qabstractitemmodel.html#removeRow">removeRow</a>(), <a href="qabstractitemmodel.html#removeColumns">removeColumns</a>(),
<a href="qabstractitemmodel.html#insertColumns">insertColumns</a>(),
<a href="qabstractitemmodel.html#beginRemoveRows">beginRemoveRows</a>(),
and <a href="qabstractitemmodel.html#endRemoveRows">endRemoveRows</a>().</p>
<h3 class="fn"><a name="reset" />QAbstractItemModel.reset (<i>self</i>)</h3><p>Resets the model to its original state in any attached
views.</p>
<p><b>Note:</b> Use <a href="qabstractitemmodel.html#beginResetModel">beginResetModel</a>() and
<a href="qabstractitemmodel.html#endResetModel">endResetModel</a>()
instead whenever possible. Use this method only if there is no way
to call <a href="qabstractitemmodel.html#beginResetModel">beginResetModel</a>()
before invalidating the model. Otherwise it could lead to
unexpected behaviour, especially when used with proxy models.</p>
<h3 class="fn"><a name="resetInternalData" />QAbstractItemModel.resetInternalData (<i>self</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void resetInternalData()</tt>.</p><p>This slot is called just after the internal data of a model is
cleared while it is being reset.</p>
<p>This slot is provided the convenience of subclasses of concrete
proxy models, such as subclasses of <a href="qsortfilterproxymodel.html">QSortFilterProxyModel</a> which
maintain extra data.</p>
<pre class="cpp">
<span class="keyword">class</span> CustomDataProxy : <span class="keyword">public</span> <span class="type"><a href="qsortfilterproxymodel.html">QSortFilterProxyModel</a></span>
{
Q_OBJECT
<span class="keyword">public</span>:
CustomDataProxy(<span class="type"><a href="qobject.html">QObject</a></span> <span class="operator">*</span>parent)
: <span class="type"><a href="qsortfilterproxymodel.html">QSortFilterProxyModel</a></span>(parent)
{
}
<span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>
<span class="type"><a href="qvariant.html">QVariant</a></span> data(<span class="keyword">const</span> <span class="type"><a href="qmodelindex.html">QModelIndex</a></span> <span class="operator">&</span>index<span class="operator">,</span> <span class="type">int</span> role)
{
<span class="keyword">if</span> (role <span class="operator">!</span><span class="operator">=</span> <span class="type"><a href="qt.html">Qt</a></span><span class="operator">.</span>BackgroundRole)
<span class="keyword">return</span> <span class="type"><a href="qsortfilterproxymodel.html">QSortFilterProxyModel</a></span><span class="operator">.</span>data(index<span class="operator">,</span> role);
<span class="keyword">if</span> (m_customData<span class="operator">.</span>contains(index<span class="operator">.</span>row()))
<span class="keyword">return</span> m_customData<span class="operator">.</span>value(index<span class="operator">.</span>row());
<span class="keyword">return</span> <span class="type"><a href="qsortfilterproxymodel.html">QSortFilterProxyModel</a></span><span class="operator">.</span>data(index<span class="operator">,</span> role);
}
<span class="keyword">private</span> <span class="keyword">slots</span>:
<span class="type">void</span> resetInternalData()
{
m_customData<span class="operator">.</span>clear();
}
<span class="keyword">private</span>:
<span class="type"><a href="qhash.html">QHash</a></span><span class="operator"><</span><span class="type">int</span><span class="operator">,</span> <span class="type"><a href="qvariant.html">QVariant</a></span><span class="operator">></span> m_customData;
};
</pre>
<p>This function was introduced in Qt 4.8.</p>
<p><b>See also</b> <a href="qabstractitemmodel.html#modelAboutToBeReset">modelAboutToBeReset</a>()
and <a href="qabstractitemmodel.html#modelReset">modelReset</a>().</p>
<h3 class="fn"><a name="revert" />QAbstractItemModel.revert (<i>self</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void revert()</tt>.</p><p>Lets the model know that it should discard cached information.
This function is typically used for row editing.</p>
<p><b>See also</b> <a href="qabstractitemmodel.html#submit">submit</a>().</p>
<h3 class="fn"><a name="roleNames" />unknown-type QAbstractItemModel.roleNames (<i>self</i>)</h3><p>Returns the model's role names.</p>
<p>This function was introduced in Qt 4.6.</p>
<p><b>See also</b> <a href="qabstractitemmodel.html#setRoleNames">setRoleNames</a>().</p>
<h3 class="fn"><a name="rowCount" />int QAbstractItemModel.rowCount (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a> <i>parent</i> = QModelIndex())</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>Returns the number of rows under the given <i>parent</i>. When
the parent is valid it means that rowCount is returning the number
of children of parent.</p>
<p><b>Note:</b> When implementing a table based model, rowCount()
should return 0 when the parent is valid.</p>
<p><b>See also</b> <a href="qabstractitemmodel.html#columnCount">columnCount</a>().</p>
<h3 class="fn"><a name="setData" />bool QAbstractItemModel.setData (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a> <i>index</i>, QVariant <i>value</i>, int <i>role</i> = Qt.EditRole)</h3><p>Sets the <i>role</i> data for the item at <i>index</i> to
<i>value</i>.</p>
<p>Returns true if successful; otherwise returns false.</p>
<p>The <a href="qabstractitemmodel.html#dataChanged">dataChanged</a>() signal
should be emitted if the data was successfully set.</p>
<p>The base class implementation returns false. This function and
<a href="qabstractitemmodel.html#data">data</a>() must be
reimplemented for editable models.</p>
<p><b>See also</b> <a href="qt.html#ItemDataRole-enum">Qt.ItemDataRole</a>, <a href="qabstractitemmodel.html#data">data</a>(), and <a href="qabstractitemmodel.html#itemData">itemData</a>().</p>
<h3 class="fn"><a name="setHeaderData" />bool QAbstractItemModel.setHeaderData (<i>self</i>, int <i>section</i>, <a href="qt.html#Orientation-enum">Qt.Orientation</a> <i>orientation</i>, QVariant <i>value</i>, int <i>role</i> = Qt.EditRole)</h3><p>Sets the data for the given <i>role</i> and <i>section</i> in
the header with the specified <i>orientation</i> to the
<i>value</i> supplied.</p>
<p>Returns true if the header's data was updated; otherwise returns
false.</p>
<p>When reimplementing this function, the <a href="qabstractitemmodel.html#headerDataChanged">headerDataChanged</a>()
signal must be emitted explicitly.</p>
<p><b>See also</b> <a href="qt.html#ItemDataRole-enum">Qt.ItemDataRole</a> and <a href="qabstractitemmodel.html#headerData">headerData</a>().</p>
<h3 class="fn"><a name="setItemData" />bool QAbstractItemModel.setItemData (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a> <i>index</i>, unknown-type <i>roles</i>)</h3><p>Sets the role data for the item at <i>index</i> to the
associated value in <i>roles</i>, for every <a href="qt.html#ItemDataRole-enum">Qt.ItemDataRole</a>.</p>
<p>Returns true if successful; otherwise returns false.</p>
<p>Roles that are not in <i>roles</i> will not be modified.</p>
<p><b>See also</b> <a href="qabstractitemmodel.html#setData">setData</a>(), <a href="qabstractitemmodel.html#data">data</a>(), and <a href="qabstractitemmodel.html#itemData">itemData</a>().</p>
<h3 class="fn"><a name="setRoleNames" />QAbstractItemModel.setRoleNames (<i>self</i>, unknown-type <i>roleNames</i>)</h3><p>Sets the model's role names to <i>roleNames</i>.</p>
<p>This function allows mapping of role identifiers to role
property names in Declarative UI. This function must be called
before the model is used. Modifying the role names after the model
has been set may result in undefined behaviour.</p>
<p>This function was introduced in Qt 4.6.</p>
<p><b>See also</b> <a href="qabstractitemmodel.html#roleNames">roleNames</a>().</p>
<h3 class="fn"><a name="setSupportedDragActions" />QAbstractItemModel.setSupportedDragActions (<i>self</i>, <a href="qt-dropactions.html">Qt.DropActions</a>)</h3><p>Sets the supported drag <i>actions</i> for the items in the
model.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also</b> <a href="qabstractitemmodel.html#supportedDragActions">supportedDragActions</a>()
and <a href="model-view-programming.html#using-drag-and-drop-with-item-views">Using
drag and drop with item views</a>.</p>
<h3 class="fn"><a name="sibling" /><a href="qmodelindex.html">QModelIndex</a> QAbstractItemModel.sibling (<i>self</i>, int <i>row</i>, int <i>column</i>, <a href="qmodelindex.html">QModelIndex</a> <i>idx</i>)</h3><p>Returns the sibling at <i>row</i> and <i>column</i> for the item
at <i>index</i>, or an invalid <a href="qmodelindex.html">QModelIndex</a> if there is no sibling at that
location.</p>
<p>sibling() is just a convenience function that finds the item's
parent, and uses it to retrieve the index of the child item in the
specified <i>row</i> and <i>column</i>.</p>
<p><b>See also</b> <a href="qabstractitemmodel.html#index">index</a>(), <a href="qmodelindex.html#row">QModelIndex.row</a>(), and <a href="qmodelindex.html#column">QModelIndex.column</a>().</p>
<h3 class="fn"><a name="sort" />QAbstractItemModel.sort (<i>self</i>, int <i>column</i>, <a href="qt.html#SortOrder-enum">Qt.SortOrder</a> <i>order</i> = Qt.AscendingOrder)</h3><p>Sorts the model by <i>column</i> in the given <i>order</i>.</p>
<p>The base class implementation does nothing.</p>
<h3 class="fn"><a name="span" /><a href="qsize.html">QSize</a> QAbstractItemModel.span (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a> <i>index</i>)</h3><p>Returns the row and column span of the item represented by
<i>index</i>.</p>
<p><b>Note:</b> Currently, span is not used.</p>
<h3 class="fn"><a name="submit" />bool QAbstractItemModel.submit (<i>self</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>bool submit()</tt>.</p><p>Lets the model know that it should submit cached information to
permanent storage. This function is typically used for row
editing.</p>
<p>Returns true if there is no error; otherwise returns false.</p>
<p><b>See also</b> <a href="qabstractitemmodel.html#revert">revert</a>().</p>
<h3 class="fn"><a name="supportedDragActions" /><a href="qt-dropactions.html">Qt.DropActions</a> QAbstractItemModel.supportedDragActions (<i>self</i>)</h3><p>Returns the actions supported by the data in this model.</p>
<p>The default implementation returns <a href="qabstractitemmodel.html#supportedDropActions">supportedDropActions</a>()
unless specific values have been set with <a href="qabstractitemmodel.html#setSupportedDragActions">setSupportedDragActions</a>().</p>
<p>supportedDragActions() is used by <a href="qabstractitemview.html#startDrag">QAbstractItemView.startDrag</a>()
as the default values when a drag occurs.</p>
<p><b>See also</b> <a href="qabstractitemmodel.html#setSupportedDragActions">setSupportedDragActions</a>(),
<a href="qt.html#DropAction-enum">Qt.DropActions</a>, and <a href="model-view-programming.html#using-drag-and-drop-with-item-views">Using
drag and drop with item views</a>.</p>
<h3 class="fn"><a name="supportedDropActions" /><a href="qt-dropactions.html">Qt.DropActions</a> QAbstractItemModel.supportedDropActions (<i>self</i>)</h3><p>Returns the drop actions supported by this model.</p>
<p>The default implementation returns <a href="qt.html#DropAction-enum">Qt.CopyAction</a>. Reimplement this
function if you wish to support additional actions. You must also
reimplement the <a href="qabstractitemmodel.html#dropMimeData">dropMimeData</a>() function
to handle the additional operations.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also</b> <a href="qabstractitemmodel.html#dropMimeData">dropMimeData</a>(), <a href="qt.html#DropAction-enum">Qt.DropActions</a>, and <a href="model-view-programming.html#using-drag-and-drop-with-item-views">Using
drag and drop with item views</a>.</p>
<hr /><h2>Qt Signal Documentation</h2><h3 class="fn"><a name="columnsAboutToBeInserted" />void columnsAboutToBeInserted (const ::QModelIndex&,int,int)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted just before columns are inserted into the
model. The new items will be positioned between <i>start</i> and
<i>end</i> inclusive, under the given <i>parent</i> item.</p>
<p><b>Note:</b> Components connected to this signal use it to adapt
to changes in the model's dimensions. It can only be emitted by the
<a href="qabstractitemmodel.html">QAbstractItemModel</a>
implementation, and cannot be explicitly emitted in subclass
code.</p>
<p><b>See also</b> <a href="qabstractitemmodel.html#insertColumns">insertColumns</a>() and
<a href="qabstractitemmodel.html#beginInsertColumns">beginInsertColumns</a>().</p>
<h3 class="fn"><a name="columnsAboutToBeMoved" />void columnsAboutToBeMoved (const ::QModelIndex&,int,int,const ::QModelIndex&,int)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted just before columns are moved within the
model. The items that will be moved are those between
<i>sourceStart</i> and <i>sourceEnd</i> inclusive, under the given
<i>sourceParent</i> item. They will be moved to
<i>destinationParent</i> starting at the column
<i>destinationColumn</i>.</p>
<p><b>Note:</b> Components connected to this signal use it to adapt
to changes in the model's dimensions. It can only be emitted by the
<a href="qabstractitemmodel.html">QAbstractItemModel</a>
implementation, and cannot be explicitly emitted in subclass
code.</p>
<p>This function was introduced in Qt 4.6.</p>
<p><b>See also</b> <a href="qabstractitemmodel.html#beginMoveRows">beginMoveRows</a>().</p>
<h3 class="fn"><a name="columnsAboutToBeRemoved" />void columnsAboutToBeRemoved (const ::QModelIndex&,int,int)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted just before columns are removed from the
model. The items to be removed are those between <i>start</i> and
<i>end</i> inclusive, under the given <i>parent</i> item.</p>
<p><b>Note:</b> Components connected to this signal use it to adapt
to changes in the model's dimensions. It can only be emitted by the
<a href="qabstractitemmodel.html">QAbstractItemModel</a>
implementation, and cannot be explicitly emitted in subclass
code.</p>
<p><b>See also</b> <a href="qabstractitemmodel.html#removeColumns">removeColumns</a>() and
<a href="qabstractitemmodel.html#beginRemoveColumns">beginRemoveColumns</a>().</p>
<h3 class="fn"><a name="columnsInserted" />void columnsInserted (const ::QModelIndex&,int,int)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted after columns have been inserted into the
model. The new items are those between <i>start</i> and <i>end</i>
inclusive, under the given <i>parent</i> item.</p>
<p><b>Note:</b> Components connected to this signal use it to adapt
to changes in the model's dimensions. It can only be emitted by the
<a href="qabstractitemmodel.html">QAbstractItemModel</a>
implementation, and cannot be explicitly emitted in subclass
code.</p>
<p><b>See also</b> <a href="qabstractitemmodel.html#insertColumns">insertColumns</a>() and
<a href="qabstractitemmodel.html#beginInsertColumns">beginInsertColumns</a>().</p>
<h3 class="fn"><a name="columnsMoved" />void columnsMoved (const ::QModelIndex&,int,int,const ::QModelIndex&,int)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted after columns have been moved within the
model. The items between <i>sourceStart</i> and <i>sourceEnd</i>
inclusive, under the given <i>sourceParent</i> item have been moved
to <i>destinationParent</i> starting at the column
<i>destinationColumn</i>.</p>
<p><b>Note:</b> Components connected to this signal use it to adapt
to changes in the model's dimensions. It can only be emitted by the
<a href="qabstractitemmodel.html">QAbstractItemModel</a>
implementation, and cannot be explicitly emitted in subclass
code.</p>
<p>This function was introduced in Qt 4.6.</p>
<p><b>See also</b> <a href="qabstractitemmodel.html#beginMoveRows">beginMoveRows</a>().</p>
<h3 class="fn"><a name="columnsRemoved" />void columnsRemoved (const ::QModelIndex&,int,int)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted after columns have been removed from the
model. The removed items are those between <i>start</i> and
<i>end</i> inclusive, under the given <i>parent</i> item.</p>
<p><b>Note:</b> Components connected to this signal use it to adapt
to changes in the model's dimensions. It can only be emitted by the
<a href="qabstractitemmodel.html">QAbstractItemModel</a>
implementation, and cannot be explicitly emitted in subclass
code.</p>
<p><b>See also</b> <a href="qabstractitemmodel.html#removeColumns">removeColumns</a>() and
<a href="qabstractitemmodel.html#beginRemoveColumns">beginRemoveColumns</a>().</p>
<h3 class="fn"><a name="dataChanged" />void dataChanged (const ::QModelIndex&,const ::QModelIndex&)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted whenever the data in an existing item
changes.</p>
<p>If the items are of the same parent, the affected ones are those
between <i>topLeft</i> and <i>bottomRight</i> inclusive. If the
items do not have the same parent, the behavior is undefined.</p>
<p>When reimplementing the <a href="qabstractitemmodel.html#setData">setData</a>() function, this
signal must be emitted explicitly.</p>
<p><b>See also</b> <a href="qabstractitemmodel.html#headerDataChanged">headerDataChanged</a>(),
<a href="qabstractitemmodel.html#setData">setData</a>(), and
<a href="qabstractitemmodel.html#layoutChanged">layoutChanged</a>().</p>
<h3 class="fn"><a name="headerDataChanged" />void headerDataChanged ( ::Qt::Orientation,int,int)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted whenever a header is changed. The
<i>orientation</i> indicates whether the horizontal or vertical
header has changed. The sections in the header from the
<i>first</i> to the <i>last</i> need to be updated.</p>
<p>When reimplementing the <a href="qabstractitemmodel.html#setHeaderData">setHeaderData</a>()
function, this signal must be emitted explicitly.</p>
<p>If you are changing the number of columns or rows you do not
need to emit this signal, but use the begin/end functions (refer to
the section on subclassing in the <a href="qabstractitemmodel.html">QAbstractItemModel</a> class description
for details).</p>
<p><b>See also</b> <a href="qabstractitemmodel.html#headerData">headerData</a>(), <a href="qabstractitemmodel.html#setHeaderData">setHeaderData</a>(), and
<a href="qabstractitemmodel.html#dataChanged">dataChanged</a>().</p>
<h3 class="fn"><a name="layoutAboutToBeChanged" />void layoutAboutToBeChanged ()</h3><p>This is the default overload of this signal.</p><p>This signal is emitted just before the layout of a model is
changed. Components connected to this signal use it to adapt to
changes in the model's layout.</p>
<p>Subclasses should update any persistent model indexes after
emitting layoutAboutToBeChanged().</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also</b> <a href="qabstractitemmodel.html#layoutChanged">layoutChanged</a>() and
<a href="qabstractitemmodel.html#changePersistentIndex">changePersistentIndex</a>().</p>
<h3 class="fn"><a name="layoutChanged" />void layoutChanged ()</h3><p>This is the default overload of this signal.</p><p>This signal is emitted whenever the layout of items exposed by
the model has changed; for example, when the model has been sorted.
When this signal is received by a view, it should update the layout
of items to reflect this change.</p>
<p>When subclassing <a href="qabstractitemmodel.html">QAbstractItemModel</a> or <a href="qabstractproxymodel.html">QAbstractProxyModel</a>, ensure that you
emit <a href="qabstractitemmodel.html#layoutAboutToBeChanged">layoutAboutToBeChanged</a>()
before changing the order of items or altering the structure of the
data you expose to views, and emit layoutChanged() after changing
the layout.</p>
<p>Subclasses should update any persistent model indexes before
emitting layoutChanged(). In other words, when the structure
changes:</p>
<ul>
<li>emit layoutAboutToBeChanged</li>
<li>Remember the <a href="qmodelindex.html">QModelIndex</a> that
will change</li>
<li>Update your internal data</li>
<li>Call <a href="qabstractitemmodel.html#changePersistentIndex">changePersistentIndex</a>()</li>
<li>emit layoutChanged</li>
</ul>
<p><b>See also</b> <a href="qabstractitemmodel.html#layoutAboutToBeChanged">layoutAboutToBeChanged</a>(),
<a href="qabstractitemmodel.html#dataChanged">dataChanged</a>(),
<a href="qabstractitemmodel.html#headerDataChanged">headerDataChanged</a>(),
<a href="qabstractitemmodel.html#modelReset">modelReset</a>(), and
<a href="qabstractitemmodel.html#changePersistentIndex">changePersistentIndex</a>().</p>
<h3 class="fn"><a name="modelAboutToBeReset" />void modelAboutToBeReset ()</h3><p>This is the default overload of this signal.</p><p>This signal is emitted when <a href="qabstractitemmodel.html#reset">reset</a>() is called, before the
model's internal state (e.g. persistent model indexes) has been
invalidated.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also</b> <a href="qabstractitemmodel.html#beginResetModel">beginResetModel</a>() and
<a href="qabstractitemmodel.html#modelReset">modelReset</a>().</p>
<h3 class="fn"><a name="modelReset" />void modelReset ()</h3><p>This is the default overload of this signal.</p><p>This signal is emitted when <a href="qabstractitemmodel.html#reset">reset</a>() is called, after the
model's internal state (e.g. persistent model indexes) has been
invalidated.</p>
<p>This function was introduced in Qt 4.1.</p>
<p><b>See also</b> <a href="qabstractitemmodel.html#endResetModel">endResetModel</a>() and
<a href="qabstractitemmodel.html#modelAboutToBeReset">modelAboutToBeReset</a>().</p>
<h3 class="fn"><a name="rowsAboutToBeInserted" />void rowsAboutToBeInserted (const ::QModelIndex&,int,int)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted just before rows are inserted into the
model. The new items will be positioned between <i>start</i> and
<i>end</i> inclusive, under the given <i>parent</i> item.</p>
<p><b>Note:</b> Components connected to this signal use it to adapt
to changes in the model's dimensions. It can only be emitted by the
<a href="qabstractitemmodel.html">QAbstractItemModel</a>
implementation, and cannot be explicitly emitted in subclass
code.</p>
<p><b>See also</b> <a href="qabstractitemmodel.html#insertRows">insertRows</a>() and <a href="qabstractitemmodel.html#beginInsertRows">beginInsertRows</a>().</p>
<h3 class="fn"><a name="rowsAboutToBeMoved" />void rowsAboutToBeMoved (const ::QModelIndex&,int,int,const ::QModelIndex&,int)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted just before rows are moved within the
model. The items that will be moved are those between
<i>sourceStart</i> and <i>sourceEnd</i> inclusive, under the given
<i>sourceParent</i> item. They will be moved to
<i>destinationParent</i> starting at the row
<i>destinationRow</i>.</p>
<p><b>Note:</b> Components connected to this signal use it to adapt
to changes in the model's dimensions. It can only be emitted by the
<a href="qabstractitemmodel.html">QAbstractItemModel</a>
implementation, and cannot be explicitly emitted in subclass
code.</p>
<p>This function was introduced in Qt 4.6.</p>
<p><b>See also</b> <a href="qabstractitemmodel.html#beginMoveRows">beginMoveRows</a>().</p>
<h3 class="fn"><a name="rowsAboutToBeRemoved" />void rowsAboutToBeRemoved (const ::QModelIndex&,int,int)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted just before rows are removed from the
model. The items that will be removed are those between
<i>start</i> and <i>end</i> inclusive, under the given
<i>parent</i> item.</p>
<p><b>Note:</b> Components connected to this signal use it to adapt
to changes in the model's dimensions. It can only be emitted by the
<a href="qabstractitemmodel.html">QAbstractItemModel</a>
implementation, and cannot be explicitly emitted in subclass
code.</p>
<p><b>See also</b> <a href="qabstractitemmodel.html#removeRows">removeRows</a>() and <a href="qabstractitemmodel.html#beginRemoveRows">beginRemoveRows</a>().</p>
<h3 class="fn"><a name="rowsInserted" />void rowsInserted (const ::QModelIndex&,int,int)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted after rows have been inserted into the
model. The new items are those between <i>start</i> and <i>end</i>
inclusive, under the given <i>parent</i> item.</p>
<p><b>Note:</b> Components connected to this signal use it to adapt
to changes in the model's dimensions. It can only be emitted by the
<a href="qabstractitemmodel.html">QAbstractItemModel</a>
implementation, and cannot be explicitly emitted in subclass
code.</p>
<p><b>See also</b> <a href="qabstractitemmodel.html#insertRows">insertRows</a>() and <a href="qabstractitemmodel.html#beginInsertRows">beginInsertRows</a>().</p>
<h3 class="fn"><a name="rowsMoved" />void rowsMoved (const ::QModelIndex&,int,int,const ::QModelIndex&,int)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted after rows have been moved within the
model. The items between <i>sourceStart</i> and <i>sourceEnd</i>
inclusive, under the given <i>sourceParent</i> item have been moved
to <i>destinationParent</i> starting at the row
<i>destinationRow</i>.</p>
<p><b>Note:</b> Components connected to this signal use it to adapt
to changes in the model's dimensions. It can only be emitted by the
<a href="qabstractitemmodel.html">QAbstractItemModel</a>
implementation, and cannot be explicitly emitted in subclass
code.</p>
<p>This function was introduced in Qt 4.6.</p>
<p><b>See also</b> <a href="qabstractitemmodel.html#beginMoveRows">beginMoveRows</a>().</p>
<h3 class="fn"><a name="rowsRemoved" />void rowsRemoved (const ::QModelIndex&,int,int)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted after rows have been removed from the
model. The removed items are those between <i>start</i> and
<i>end</i> inclusive, under the given <i>parent</i> item.</p>
<p><b>Note:</b> Components connected to this signal use it to adapt
to changes in the model's dimensions. It can only be emitted by the
<a href="qabstractitemmodel.html">QAbstractItemModel</a>
implementation, and cannot be explicitly emitted in subclass
code.</p>
<p><b>See also</b> <a href="qabstractitemmodel.html#removeRows">removeRows</a>() and <a href="qabstractitemmodel.html#beginRemoveRows">beginRemoveRows</a>().</p>
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt 4.12.1 for X11</td><td align="center" width="50%">Copyright © <a href="http://www.riverbankcomputing.com">Riverbank Computing Ltd</a> and <a href="http://www.qt.io">The Qt Company</a> 2015</td><td align="right" width="25%">Qt 4.8.7</td></tr></table></div></address></body></html>
|