Ignore:
Timestamp:
May 5, 2011, 5:36:53 AM (14 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/gui/itemviews/qitemselectionmodel.cpp

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation ([email protected])
     
    293293
    294294/*!
     295
     296
     297
     298
     299
     300
     301
     302
     303
     304
     305
     306
     307
     308
     309
     310
     311
     312
     313
     314
     315
    295316    Returns the list of model index items stored in the selection.
    296317*/
     
    525546        result->append(QItemSelectionRange(tl, br));
    526547        right = other_right;
     548
     549
     550
     551
     552
     553
     554
     555
     556
     557
     558
     559
     560
     561
     562
     563
     564
     565
     566
     567
     568
    527569    }
    528570}
     
    731773    savedPersistentCurrentIndexes.clear();
    732774
    733     // optimisation for when all indexes are selected
     775    // optimiation for when all indexes are selected
    734776    // (only if there is lots of items (1000) because this is not entirely correct)
    735777    if (ranges.isEmpty() && currentSelection.count() == 1) {
     
    794836            QModelIndex nextTl = colSpans.at(i).topLeft();
    795837            QModelIndex nextBr = colSpans.at(i).bottomRight();
     838
     839
     840
     841
    796842            if ((nextTl.column() == prevTl.column()) && (nextBr.column() == br.column())
    797843                && (nextTl.row() == prevTl.row() + 1) && (nextBr.row() == br.row() + 1)) {
     
    891937    : QObject(*new QItemSelectionModelPrivate, model)
    892938{
    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);
    908940}
    909941
     
    914946    : QObject(*new QItemSelectionModelPrivate, parent)
    915947{
    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);
    931949}
    932950
     
    937955    : QObject(dd, model)
    938956{
    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);
    954958}
    955959
     
    959963QItemSelectionModel::~QItemSelectionModel()
    960964{
    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     }
    976965}
    977966
     
    10711060    // store old selection
    10721061    QItemSelection sel = selection;
     1062
     1063