MCPcopy Create free account
hub / github.com/KDAB/GammaRay / setModel

Method setModel

plugins/modelinspector/selectionmodelmodel.cpp:116–139  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

114}
115
116void SelectionModelModel::setModel(QAbstractItemModel *model)
117{
118 if (model == m_model)
119 return;
120
121 if (!m_currentSelectionModels.isEmpty()) {
122 beginRemoveRows(QModelIndex(), 0, m_currentSelectionModels.size() - 1);
123 m_currentSelectionModels.clear();
124 endRemoveRows();
125 }
126
127 m_model = model;
128 QVector<QItemSelectionModel *> models;
129 std::copy_if(m_selectionModels.constBegin(), m_selectionModels.constEnd(), std::back_inserter(models), [this](QItemSelectionModel *model) {
130 return model->model() == m_model;
131 });
132
133 if (models.isEmpty())
134 return;
135
136 beginInsertRows(QModelIndex(), 0, models.size() - 1);
137 m_currentSelectionModels = std::move(models);
138 endInsertRows();
139}
140
141int SelectionModelModel::columnCount(const QModelIndex &parent) const
142{

Callers 15

InspectorWidgetMethod · 0.45
TimezoneTabMethod · 0.45
LocaleTabMethod · 0.45
TimerTopWidgetMethod · 0.45
ModelInspectorWidgetMethod · 0.45
modelSelectedMethod · 0.45
NetworkReplyWidgetMethod · 0.45
CookieTabMethod · 0.45
KJobTrackerWidgetMethod · 0.45

Calls 7

QModelIndexClass · 0.70
isEmptyMethod · 0.45
sizeMethod · 0.45
clearMethod · 0.45
constBeginMethod · 0.45
constEndMethod · 0.45
modelMethod · 0.45

Tested by 8

InspectorWidgetMethod · 0.36
ModelInspectorWidgetMethod · 0.36
modelSelectedMethod · 0.36
WidgetInspectorWidgetMethod · 0.36
WebInspectorWidgetMethod · 0.36
ActionInspectorWidgetMethod · 0.36