Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
QItemSelectionModelPrivate Class Reference

#include <qitemselectionmodel_p.h>

+ Inheritance diagram for QItemSelectionModelPrivate:
+ Collaboration diagram for QItemSelectionModelPrivate:

Public Member Functions

 QItemSelectionModelPrivate ()
 
QItemSelection expandSelection (const QItemSelection &selection, QItemSelectionModel::SelectionFlags command) const
 
void initModel (QAbstractItemModel *model)
 
void _q_rowsAboutToBeRemoved (const QModelIndex &parent, int start, int end)
 
void _q_columnsAboutToBeRemoved (const QModelIndex &parent, int start, int end)
 
void _q_rowsAboutToBeInserted (const QModelIndex &parent, int start, int end)
 
void _q_columnsAboutToBeInserted (const QModelIndex &parent, int start, int end)
 
void _q_layoutAboutToBeChanged (const QList< QPersistentModelIndex > &parents=QList< QPersistentModelIndex >(), QAbstractItemModel::LayoutChangeHint hint=QAbstractItemModel::NoLayoutChangeHint)
 
void _q_layoutChanged (const QList< QPersistentModelIndex > &parents=QList< QPersistentModelIndex >(), QAbstractItemModel::LayoutChangeHint hint=QAbstractItemModel::NoLayoutChangeHint)
 
void _q_modelDestroyed ()
 
void remove (QList< QItemSelectionRange > &r)
 
void finalize ()
 
void setModel (QAbstractItemModel *mod)
 
void modelChanged (QAbstractItemModel *mod)
 
 Q_OBJECT_COMPAT_PROPERTY_WITH_ARGS (QItemSelectionModelPrivate, QAbstractItemModel *, model, &QItemSelectionModelPrivate::setModel, &QItemSelectionModelPrivate::modelChanged, nullptr) QItemSelection ranges
 
- Public Member Functions inherited from QObjectPrivate
void ensureExtraData ()
 
 QObjectPrivate (int version=QObjectPrivateVersion)
 
virtual ~QObjectPrivate ()
 
void deleteChildren ()
 
void clearBindingStorage ()
 
void checkForIncompatibleLibraryVersion (int version) const
 
void setParent_helper (QObject *)
 
void moveToThread_helper ()
 
void setThreadData_helper (QThreadData *currentData, QThreadData *targetData, QBindingStatus *status)
 
void _q_reregisterTimers (void *pointer)
 
bool isSender (const QObject *receiver, const char *signal) const
 
QObjectList receiverList (const char *signal) const
 
QObjectList senderList () const
 
void ensureConnectionData ()
 
void addConnection (int signal, Connection *c)
 
int signalIndex (const char *signalName, const QMetaObject **meta=nullptr) const
 
bool isSignalConnected (uint signalIdx, bool checkDeclarative=true) const
 
bool maybeSignalConnected (uint signalIndex) const
 
bool isDeclarativeSignalConnected (uint signalIdx) const
 
void connectNotify (const QMetaMethod &signal)
 
void disconnectNotify (const QMetaMethod &signal)
 
void reinitBindingStorageAfterThreadMove ()
 
virtual std::string flagsForDumping () const
 
QtPrivate::QPropertyAdaptorSlotObjectgetPropertyAdaptorSlotObject (const QMetaProperty &property)
 
- Public Member Functions inherited from QObjectData
 QObjectData ()=default
 
virtual ~QObjectData ()=0
 
QMetaObjectdynamicMetaObject () const
 

Public Attributes

QItemSelection currentSelection
 
QPersistentModelIndex currentIndex
 
QItemSelectionModel::SelectionFlags currentCommand
 
QList< QPersistentModelIndexsavedPersistentIndexes
 
QList< QPersistentModelIndexsavedPersistentCurrentIndexes
 
QList< QPair< QPersistentModelIndex, uint > > savedPersistentRowLengths
 
QList< QPair< QPersistentModelIndex, uint > > savedPersistentCurrentRowLengths
 
bool tableSelected
 
QPersistentModelIndex tableParent
 
int tableColCount
 
int tableRowCount
 
- Public Attributes inherited from QObjectPrivate
ExtraDataextraData
 
QAtomicPointer< QThreadDatathreadData
 
QAtomicPointer< ConnectionDataconnections
 
union { 
 
   QObject *   currentChildBeingDeleted 
 
   QAbstractDeclarativeData *   declarativeData 
 
};  
 
QAtomicPointer< QtSharedPointer::ExternalRefCountDatasharedRefcount
 
- Public Attributes inherited from QObjectData
QObjectq_ptr
 
QObjectparent
 
QObjectList children
 
uint isWidget: 1
 
uint blockSig: 1
 
uint wasDeleted: 1
 
uint isDeletingChildren: 1
 
uint sendChildEvents: 1
 
uint receiveChildEvents: 1
 
uint isWindow: 1
 
uint deleteLaterCalled: 1
 
uint isQuickItem: 1
 
uint willBeWidget: 1
 
uint wasWidget: 1
 
uint unused: 21
 
QAtomicInt postedEvents
 
QDynamicMetaObjectDatametaObject
 
QBindingStorage bindingStorage
 

Additional Inherited Members

- Public Types inherited from QObjectPrivate
typedef void(* StaticMetaCallFunction) (QObject *, QMetaObject::Call, int, void **)
 
using ConnectionDataPointer = QExplicitlySharedDataPointer< ConnectionData >
 
- Static Public Member Functions inherited from QObjectPrivate
static bool removeConnection (Connection *c)
 
static QObjectPrivateget (QObject *o)
 
static const QObjectPrivateget (const QObject *o)
 
template<typename Func1 , typename Func2 >
static QMetaObject::Connection connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiverPrivate, Func2 slot, Qt::ConnectionType type=Qt::AutoConnection)
 
template<typename Func1 , typename Func2 >
static bool disconnect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiverPrivate, Func2 slot)
 
static QMetaObject::Connection connectImpl (const QObject *sender, int signal_index, const QObject *receiver, void **slot, QtPrivate::QSlotObjectBase *slotObj, int type, const int *types, const QMetaObject *senderMetaObject)
 
static QMetaObject::Connection connect (const QObject *sender, int signal_index, QtPrivate::QSlotObjectBase *slotObj, Qt::ConnectionType type)
 
static QMetaObject::Connection connect (const QObject *sender, int signal_index, const QObject *receiver, QtPrivate::QSlotObjectBase *slotObj, Qt::ConnectionType type)
 
static bool disconnect (const QObject *sender, int signal_index, void **slot)
 
static bool disconnect (const QObject *sender, int signal_index, const QObject *receiver, void **slot)
 

Detailed Description

Definition at line 26 of file qitemselectionmodel_p.h.

Constructor & Destructor Documentation

◆ QItemSelectionModelPrivate()

QItemSelectionModelPrivate::QItemSelectionModelPrivate ( )
inline

Definition at line 30 of file qitemselectionmodel_p.h.

Member Function Documentation

◆ _q_columnsAboutToBeInserted()

void QItemSelectionModelPrivate::_q_columnsAboutToBeInserted ( const QModelIndex parent,
int  start,
int  end 
)

Split selection ranges if columns are about to be inserted in the middle.

Definition at line 761 of file qitemselectionmodel.cpp.

References QSet< T >::begin(), QSet< T >::end(), QSet< T >::erase(), finalize(), QAbstractTableModel::index(), it, model, QObjectData::parent, Q_UNUSED, and split().

Referenced by initModel().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _q_columnsAboutToBeRemoved()

void QItemSelectionModelPrivate::_q_columnsAboutToBeRemoved ( const QModelIndex parent,
int  start,
int  end 
)

Definition at line 724 of file qitemselectionmodel.cpp.

References QPersistentModelIndex::column(), currentIndex, QItemSelectionModel::Deselect, emit, finalize(), QAbstractTableModel::index(), QPersistentModelIndex::isValid(), model, QPersistentModelIndex::parent(), QObjectData::parent, QPersistentModelIndex::row(), QModelIndex::row(), and QSqlQueryModel::rowCount().

Referenced by initModel().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _q_layoutAboutToBeChanged()

void QItemSelectionModelPrivate::_q_layoutAboutToBeChanged ( const QList< QPersistentModelIndex > &  parents = QList<QPersistentModelIndex>(),
QAbstractItemModel::LayoutChangeHint  hint = QAbstractItemModel::NoLayoutChangeHint 
)

Split selection into individual (persistent) indexes. This is done in preparation for the layoutChanged() signal, where the indexes can be merged again.

Definition at line 832 of file qitemselectionmodel.cpp.

References QList< T >::clear(), QSqlQueryModel::columnCount(), QList< T >::constFirst(), currentSelection, hint(), model, QObjectData::parent, QObject::parent(), qSelectionPersistentRowLengths(), QSqlQueryModel::rowCount(), savedPersistentCurrentIndexes, savedPersistentCurrentRowLengths, savedPersistentIndexes, savedPersistentRowLengths, QList< T >::size(), tableColCount, tableParent, tableRowCount, tableSelected, and QAbstractItemModel::VerticalSortHint.

Referenced by initModel().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _q_layoutChanged()

void QItemSelectionModelPrivate::_q_layoutChanged ( const QList< QPersistentModelIndex > &  parents = QList<QPersistentModelIndex>(),
QAbstractItemModel::LayoutChangeHint  hint = QAbstractItemModel::NoLayoutChangeHint 
)

Merge the selected indexes into selection ranges again.

Definition at line 997 of file qitemselectionmodel.cpp.

References QList< T >::begin(), QList< T >::clear(), QSqlQueryModel::columnCount(), currentSelection, QList< T >::end(), hint(), QAbstractTableModel::index(), QList< T >::isEmpty(), mergeIndexes(), mergeRowLengths(), model, qt_PersistentModelIndexLessThan(), QSqlQueryModel::rowCount(), savedPersistentCurrentIndexes, savedPersistentCurrentRowLengths, savedPersistentIndexes, savedPersistentRowLengths, tableColCount, tableParent, tableRowCount, tableSelected, and QAbstractItemModel::VerticalSortHint.

Referenced by initModel().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _q_modelDestroyed()

void QItemSelectionModelPrivate::_q_modelDestroyed ( )

Called when the used model gets destroyed.

It is impossible to have a correct implementation here. In the following situation, there are two contradicting rules:

QItemSelectionModel myItemSelectionModel;
myItemSelectionModel.bindableModel().setBinding([&](){ return leader.value(); }
delete mymodel;
QAbstractItemModel *returnedModel = myItemSelectionModel.model();
QBindable< QAbstractItemModel * > bindableModel()
QAbstractItemModel * model
\inmodule QtCore
Definition qproperty.h:349

What should returnedModel be in this situation?

Rules for bindable properties say that myItemSelectionModel.model() should return the same as leader.value(), namely the pointer to the now deleted model.

However, backward compatibility requires myItemSelectionModel.model() to return a nullptr, because that was done in the past after the model used was deleted.

We decide to break the new rule, imposed by bindable properties, and not break the old rule, because that may break existing code.

Definition at line 1081 of file qitemselectionmodel.cpp.

References model.

Referenced by initModel().

+ Here is the caller graph for this function:

◆ _q_rowsAboutToBeInserted()

void QItemSelectionModelPrivate::_q_rowsAboutToBeInserted ( const QModelIndex parent,
int  start,
int  end 
)

Split selection ranges if rows are about to be inserted in the middle.

Definition at line 791 of file qitemselectionmodel.cpp.

References QSet< T >::begin(), emit, QSet< T >::end(), QSet< T >::erase(), finalize(), QAbstractTableModel::index(), it, model, QObjectData::parent, Q_UNUSED, and split().

Referenced by initModel().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _q_rowsAboutToBeRemoved()

void QItemSelectionModelPrivate::_q_rowsAboutToBeRemoved ( const QModelIndex parent,
int  start,
int  end 
)

Definition at line 641 of file qitemselectionmodel.cpp.

References QList< T >::append(), QSet< T >::begin(), QPersistentModelIndex::column(), QModelIndex::column(), currentIndex, emit, QSet< T >::end(), QSet< T >::erase(), finalize(), QAbstractTableModel::index(), QList< T >::isEmpty(), QPersistentModelIndex::isValid(), QModelIndex::isValid(), it, model, QModelIndex::parent(), QPersistentModelIndex::parent(), QObjectData::parent, Q_ASSERT, QPersistentModelIndex::row(), QModelIndex::row(), and QItemSelection::split().

Referenced by initModel().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ expandSelection()

QItemSelection QItemSelectionModelPrivate::expandSelection ( const QItemSelection selection,
QItemSelectionModel::SelectionFlags  command 
) const

returns a QItemSelection where all ranges have been expanded to: Rows: left: 0 and right: columnCount()-1 Columns: top: 0 and bottom: rowCount()-1

Definition at line 607 of file qitemselectionmodel.cpp.

References QList< T >::at(), QItemSelectionRange::bottom(), QSqlQueryModel::columnCount(), QItemSelectionModel::Columns, i, QAbstractTableModel::index(), QList< T >::isEmpty(), QItemSelectionRange::left(), QItemSelection::merge(), model, QItemSelectionRange::parent(), QObjectData::parent, QItemSelectionRange::right(), QSqlQueryModel::rowCount(), QItemSelectionModel::Rows, QItemSelectionModel::Select, selection, QList< T >::size(), and QItemSelectionRange::top().

+ Here is the call graph for this function:

◆ finalize()

void QItemSelectionModelPrivate::finalize ( )
inline

Definition at line 54 of file qitemselectionmodel_p.h.

References QList< T >::clear(), currentCommand, currentSelection, and QList< T >::isEmpty().

Referenced by _q_columnsAboutToBeInserted(), _q_columnsAboutToBeRemoved(), _q_rowsAboutToBeInserted(), and _q_rowsAboutToBeRemoved().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initModel()

void QItemSelectionModelPrivate::initModel ( QAbstractItemModel model)

Definition at line 551 of file qitemselectionmodel.cpp.

References _q_columnsAboutToBeInserted(), _q_columnsAboutToBeRemoved(), _q_layoutAboutToBeChanged(), _q_layoutChanged(), _q_modelDestroyed(), _q_rowsAboutToBeInserted(), _q_rowsAboutToBeRemoved(), QObject::connect(), QObjectPrivate::connections, QObject::disconnect(), i, model, qOffsetStringArray(), QT_STRINGIFY_SIGNAL, and QT_STRINGIFY_SLOT.

Referenced by QItemSelectionModel::QItemSelectionModel().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ modelChanged()

void QItemSelectionModelPrivate::modelChanged ( QAbstractItemModel mod)
inline

Definition at line 62 of file qitemselectionmodel_p.h.

◆ Q_OBJECT_COMPAT_PROPERTY_WITH_ARGS()

QItemSelectionModelPrivate::Q_OBJECT_COMPAT_PROPERTY_WITH_ARGS ( QItemSelectionModelPrivate  ,
QAbstractItemModel ,
model  ,
&QItemSelectionModelPrivate::setModel  ,
&QItemSelectionModelPrivate::modelChanged  ,
nullptr   
)

◆ remove()

void QItemSelectionModelPrivate::remove ( QList< QItemSelectionRange > &  r)
inline

Definition at line 47 of file qitemselectionmodel_p.h.

References QSet< T >::constBegin(), QSet< T >::constEnd(), and it.

+ Here is the call graph for this function:

◆ setModel()

void QItemSelectionModelPrivate::setModel ( QAbstractItemModel mod)
inline

Definition at line 61 of file qitemselectionmodel_p.h.

Member Data Documentation

◆ currentCommand

QItemSelectionModel::SelectionFlags QItemSelectionModelPrivate::currentCommand

Definition at line 70 of file qitemselectionmodel_p.h.

Referenced by finalize().

◆ currentIndex

QPersistentModelIndex QItemSelectionModelPrivate::currentIndex

Definition at line 69 of file qitemselectionmodel_p.h.

Referenced by _q_columnsAboutToBeRemoved(), and _q_rowsAboutToBeRemoved().

◆ currentSelection

QItemSelection QItemSelectionModelPrivate::currentSelection

Definition at line 68 of file qitemselectionmodel_p.h.

Referenced by _q_layoutAboutToBeChanged(), _q_layoutChanged(), and finalize().

◆ savedPersistentCurrentIndexes

QList<QPersistentModelIndex> QItemSelectionModelPrivate::savedPersistentCurrentIndexes

Definition at line 72 of file qitemselectionmodel_p.h.

Referenced by _q_layoutAboutToBeChanged(), and _q_layoutChanged().

◆ savedPersistentCurrentRowLengths

QList<QPair<QPersistentModelIndex, uint> > QItemSelectionModelPrivate::savedPersistentCurrentRowLengths

Definition at line 74 of file qitemselectionmodel_p.h.

Referenced by _q_layoutAboutToBeChanged(), and _q_layoutChanged().

◆ savedPersistentIndexes

QList<QPersistentModelIndex> QItemSelectionModelPrivate::savedPersistentIndexes

Definition at line 71 of file qitemselectionmodel_p.h.

Referenced by _q_layoutAboutToBeChanged(), and _q_layoutChanged().

◆ savedPersistentRowLengths

QList<QPair<QPersistentModelIndex, uint> > QItemSelectionModelPrivate::savedPersistentRowLengths

Definition at line 73 of file qitemselectionmodel_p.h.

Referenced by _q_layoutAboutToBeChanged(), and _q_layoutChanged().

◆ tableColCount

int QItemSelectionModelPrivate::tableColCount

Definition at line 78 of file qitemselectionmodel_p.h.

Referenced by _q_layoutAboutToBeChanged(), and _q_layoutChanged().

◆ tableParent

QPersistentModelIndex QItemSelectionModelPrivate::tableParent

Definition at line 77 of file qitemselectionmodel_p.h.

Referenced by _q_layoutAboutToBeChanged(), and _q_layoutChanged().

◆ tableRowCount

int QItemSelectionModelPrivate::tableRowCount

Definition at line 78 of file qitemselectionmodel_p.h.

Referenced by _q_layoutAboutToBeChanged(), and _q_layoutChanged().

◆ tableSelected

bool QItemSelectionModelPrivate::tableSelected

Definition at line 76 of file qitemselectionmodel_p.h.

Referenced by _q_layoutAboutToBeChanged(), and _q_layoutChanged().


The documentation for this class was generated from the following files: