Changeset 846 for trunk/src/gui/itemviews/qitemselectionmodel.cpp
- Timestamp:
- May 5, 2011, 5:36:53 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.7.2 (added) merged: 845 /branches/vendor/nokia/qt/current merged: 844 /branches/vendor/nokia/qt/4.6.3 removed
- Property svn:mergeinfo changed
-
trunk/src/gui/itemviews/qitemselectionmodel.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) … … 293 293 294 294 /*! 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 295 316 Returns the list of model index items stored in the selection. 296 317 */ … … 525 546 result->append(QItemSelectionRange(tl, br)); 526 547 right = other_right; 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 527 569 } 528 570 } … … 731 773 savedPersistentCurrentIndexes.clear(); 732 774 733 // optimi sation for when all indexes are selected775 // optimiation for when all indexes are selected 734 776 // (only if there is lots of items (1000) because this is not entirely correct) 735 777 if (ranges.isEmpty() && currentSelection.count() == 1) { … … 794 836 QModelIndex nextTl = colSpans.at(i).topLeft(); 795 837 QModelIndex nextBr = colSpans.at(i).bottomRight(); 838 839 840 841 796 842 if ((nextTl.column() == prevTl.column()) && (nextBr.column() == br.column()) 797 843 && (nextTl.row() == prevTl.row() + 1) && (nextBr.row() == br.row() + 1)) { … … 891 937 : QObject(*new QItemSelectionModelPrivate, model) 892 938 { 893 d_func()->model = model; 894 if (model) { 895 connect(model, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)), 896 this, SLOT(_q_rowsAboutToBeRemoved(QModelIndex,int,int))); 897 connect(model, SIGNAL(columnsAboutToBeRemoved(QModelIndex,int,int)), 898 this, SLOT(_q_columnsAboutToBeRemoved(QModelIndex,int,int))); 899 connect(model, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)), 900 this, SLOT(_q_rowsAboutToBeInserted(QModelIndex,int,int))); 901 connect(model, SIGNAL(columnsAboutToBeInserted(QModelIndex,int,int)), 902 this, SLOT(_q_columnsAboutToBeInserted(QModelIndex,int,int))); 903 connect(model, SIGNAL(layoutAboutToBeChanged()), 904 this, SLOT(_q_layoutAboutToBeChanged())); 905 connect(model, SIGNAL(layoutChanged()), 906 this, SLOT(_q_layoutChanged())); 907 } 939 d_func()->initModel(model); 908 940 } 909 941 … … 914 946 : QObject(*new QItemSelectionModelPrivate, parent) 915 947 { 916 d_func()->model = model; 917 if (model) { 918 connect(model, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)), 919 this, SLOT(_q_rowsAboutToBeRemoved(QModelIndex,int,int))); 920 connect(model, SIGNAL(columnsAboutToBeRemoved(QModelIndex,int,int)), 921 this, SLOT(_q_columnsAboutToBeRemoved(QModelIndex,int,int))); 922 connect(model, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)), 923 this, SLOT(_q_rowsAboutToBeInserted(QModelIndex,int,int))); 924 connect(model, SIGNAL(columnsAboutToBeInserted(QModelIndex,int,int)), 925 this, SLOT(_q_columnsAboutToBeInserted(QModelIndex,int,int))); 926 connect(model, SIGNAL(layoutAboutToBeChanged()), 927 this, SLOT(_q_layoutAboutToBeChanged())); 928 connect(model, SIGNAL(layoutChanged()), 929 this, SLOT(_q_layoutChanged())); 930 } 948 d_func()->initModel(model); 931 949 } 932 950 … … 937 955 : QObject(dd, model) 938 956 { 939 d_func()->model = model; 940 if (model) { 941 connect(model, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)), 942 this, SLOT(_q_rowsAboutToBeRemoved(QModelIndex,int,int))); 943 connect(model, SIGNAL(columnsAboutToBeRemoved(QModelIndex,int,int)), 944 this, SLOT(_q_columnsAboutToBeRemoved(QModelIndex,int,int))); 945 connect(model, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)), 946 this, SLOT(_q_rowsAboutToBeInserted(QModelIndex,int,int))); 947 connect(model, SIGNAL(columnsAboutToBeInserted(QModelIndex,int,int)), 948 this, SLOT(_q_columnsAboutToBeInserted(QModelIndex,int,int))); 949 connect(model, SIGNAL(layoutAboutToBeChanged()), 950 this, SLOT(_q_layoutAboutToBeChanged())); 951 connect(model, SIGNAL(layoutChanged()), 952 this, SLOT(_q_layoutChanged())); 953 } 957 dd.initModel(model); 954 958 } 955 959 … … 959 963 QItemSelectionModel::~QItemSelectionModel() 960 964 { 961 Q_D(QItemSelectionModel);962 if (d->model) {963 disconnect(d->model, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)),964 this, SLOT(_q_rowsAboutToBeRemoved(QModelIndex,int,int)));965 disconnect(d->model, SIGNAL(columnsAboutToBeRemoved(QModelIndex,int,int)),966 this, SLOT(_q_columnsAboutToBeRemoved(QModelIndex,int,int)));967 disconnect(d->model, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)),968 this, SLOT(_q_rowsAboutToBeInserted(QModelIndex,int,int)));969 disconnect(d->model, SIGNAL(columnsAboutToBeInserted(QModelIndex,int,int)),970 this, SLOT(_q_columnsAboutToBeInserted(QModelIndex,int,int)));971 disconnect(d->model, SIGNAL(layoutAboutToBeChanged()),972 this, SLOT(_q_layoutAboutToBeChanged()));973 disconnect(d->model, SIGNAL(layoutChanged()),974 this, SLOT(_q_layoutChanged()));975 }976 965 } 977 966 … … 1071 1060 // store old selection 1072 1061 QItemSelection sel = selection; 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1073 1075 QItemSelection old = d->ranges; 1074 1076 old.merge(d->currentSelection, d->currentCommand);
Note:
See TracChangeset
for help on using the changeset viewer.