bool DataSource::setData(double *data, const int *dims, int num_dims) { if (num_dims <= 0 || num_dims > 3) { qWarning("DataSource::setData invalid number of dimensions"); return false; } bool num_dims_changed = (m_num_dims != num_dims); bool size_changed = num_dims_changed; m_num_dims = num_dims; for (int i = 0; i < 3; ++i) { if (i < num_dims) { size_changed = size_changed || (m_dims[i] != dims[i]); m_dims[i] = dims[i]; } else { m_dims[i] = 0; } } m_data = data; if (num_dims_changed) { emit dataimensionsChanged(); } if (size_changed) { emit dataSizeChanged(); } commitData(); return true; }
void QAbstractAttribute::setDataSize(uint size) { Q_D(QAbstractAttribute); if (d->m_dataSize == size) return; Q_ASSERT(size >= 1 && size <= 4); d->m_dataSize = size; emit dataSizeChanged(); }