bool AbstractFilteredDeviceModel::filterAcceptsRow(int sourceRow, const QModelIndex &) const { DeviceModel *model = qobject_cast<DeviceModel *>(this->sourceModel()); if (!model) { //Should not happen return false; } return this->filterAcceptsDevice(qobject_cast<Device *>(model->get(sourceRow).value<QObject *>())); }
void AbstractFilteredDeviceModel::rowsAdded(const QModelIndex &, int start, int end) { DeviceModel *model = qobject_cast<DeviceModel *>(this->sourceModel()); if (!model) { return; } for (int i = start; i <= end; ++i ) { Device *device = qobject_cast<Device *>(model->get(i).value<QObject *>()); connect(device, SIGNAL(nameChanged()), this, SLOT(invalidate())); this->deviceAdded(device); } }