コード例 #1
0
bool CComputerConfModel::insertColumns(int iColumn, int iCount, const QModelIndex &parent)
{
	if (iColumn<0 || iColumn > columnCount())
		return false;
	if (iCount==1)
		beginInsertColumns(QModelIndex(), iColumn, iColumn);
	else
		beginInsertColumns(QModelIndex(), iColumn, iColumn+iCount-1);
	ShopEntry	shopItem;
	std::vector<ShopEntry>::iterator iterShop;
	if (iColumn==columnCount())
	{
		iterShop = m_ptrPriv->vShopsList.end();
	}
	else
	{
		iterShop = m_ptrPriv->vShopsList.begin();
		for(int i=0;i<iColumn;++i)
			++iterShop;
	}
	m_ptrPriv->vShopsList.insert(iterShop,iCount,shopItem);

	m_ptrPriv->vvPricesMatrix.resize(rowCount());
	for(unsigned int i=0;i<m_ptrPriv->vvPricesMatrix.size();++i)
		m_ptrPriv->vvPricesMatrix[i].resize(columnCount()-FROZEN_COLUMN_FIX);
	m_ptrPriv->updateShopsList();
	endInsertColumns();
	return true;
}
コード例 #2
0
ファイル: MatrixModel.cpp プロジェクト: rosswhitfield/mantid
bool MatrixModel::insertColumns(int column, int count,
                                const QModelIndex &parent) {
  if (!canResize(d_rows, d_cols + count))
    return false;

  beginInsertColumns(parent, column, column + count - 1);

  int offset = column + count;
  int oldCell = d_rows * d_cols - 1;
  d_cols += count;
  int cell = d_rows * d_cols - 1;
  for (int i = d_rows - 1; i >= 0; i--) {
    for (int j = d_cols - 1; j >= offset; j--)
      d_data[cell--] = d_data[oldCell--];

    for (int j = offset - 1; j >= column; j--)
      d_data[cell--] = GSL_NAN;

    for (int j = column - 1; j >= 0; j--)
      d_data[cell--] = d_data[oldCell--];
  }

  endInsertColumns();
  return true;
}
コード例 #3
0
void QgsAttributeTableModel::loadAttributes()
{
  if ( !layer() )
  {
    return;
  }

  bool ins = false, rm = false;

  QgsAttributeList attributes;
  const QgsFields &fields = layer()->fields();

  mWidgetFactories.clear();
  mAttributeWidgetCaches.clear();
  mWidgetConfigs.clear();

  for ( int idx = 0; idx < fields.count(); ++idx )
  {
    const QgsEditorWidgetSetup setup = QgsGui::editorWidgetRegistry()->findBest( layer(), fields[idx].name() );
    QgsEditorWidgetFactory *widgetFactory = QgsGui::editorWidgetRegistry()->factory( setup.type() );
    QgsFieldFormatter *fieldFormatter = QgsApplication::fieldFormatterRegistry()->fieldFormatter( setup.type() );

    mWidgetFactories.append( widgetFactory );
    mWidgetConfigs.append( setup.config() );
    mAttributeWidgetCaches.append( fieldFormatter->createCache( layer(), idx, setup.config() ) );
    mFieldFormatters.append( fieldFormatter );

    attributes << idx;
  }

  if ( mFieldCount + mExtraColumns < attributes.size() + mExtraColumns )
  {
    ins = true;
    beginInsertColumns( QModelIndex(), mFieldCount + mExtraColumns, attributes.size() - 1 );
  }
  else if ( attributes.size() + mExtraColumns < mFieldCount + mExtraColumns )
  {
    rm = true;
    beginRemoveColumns( QModelIndex(), attributes.size(), mFieldCount + mExtraColumns - 1 );
  }

  mFieldCount = attributes.size();
  mAttributes = attributes;

  for ( SortCache &cache : mSortCaches )
  {
    if ( cache.sortFieldIndex >= mAttributes.count() )
      cache.sortFieldIndex = -1;
  }

  if ( ins )
  {
    endInsertColumns();
  }
  else if ( rm )
  {
    endRemoveColumns();
  }
}
コード例 #4
0
ファイル: UMemoryModel.cpp プロジェクト: gauldoth/UniCore
void UMemoryModel::addColumnInfo(ColumnInfo columnInfo)
{
    beginInsertColumns(QModelIndex(),columnCount(),columnCount());
    columnInfos_.push_back(columnInfo);  
    compileScripts();
    endInsertColumns();
    emit columnInfoChanged();
}
コード例 #5
0
ファイル: kremotemodel.cpp プロジェクト: tonton1728/Karte
void KRemoteModel::gotHeaders(QVariantList headers) {
	if(st_ == Headers) {
		emit beginInsertColumns(QModelIndex(), 0, headers.length() - 1);
		hdrs_ = headers;
		emit endInsertColumns();
		setState(Fetching);
	}
}
コード例 #6
0
void ActionsProxyModel::sourceColumnsInserted(const QModelIndex &sourceParent, int start, int end)
{
    Q_UNUSED(sourceParent)
    Q_UNUSED(start)
    Q_UNUSED(end)

    endInsertColumns();
}
コード例 #7
0
void AlterSchemaTableModel::setSchema(KexiDB::TableSchema *ts)
{
    m_schema = ts;
    kDebug() << m_schema->fieldCount();

    beginInsertColumns(QModelIndex(), 0, m_schema->fieldCount() - 1);
    endInsertColumns();
}
コード例 #8
0
void FilterProxyModel::commitBatchToModel (int src_from, int src_to, BatchCmd const & batch)
{
	int const rows = src_to - src_from;
	int const from = m_map_from_tgt.size();

	m_map_from_src.reserve(m_log_widget.m_src_model->rowCount());

	QVector<int> accepted_rows; // grr
	accepted_rows.reserve(32);
	int tgt_idx = m_map_from_tgt.size();
	for (size_t src_idx = src_from; src_idx < src_to; ++src_idx)
	{
		if (filterAcceptsRow(src_idx, QModelIndex()))
		{
			accepted_rows.push_back(src_idx);
			m_map_from_src.insert(std::make_pair(src_idx, tgt_idx));
			++tgt_idx;
		}
	}

	if (int const n_accepted = accepted_rows.size())
	{
		m_map_from_tgt.reserve(from + n_accepted);
		int const to = from + n_accepted - 1;
		beginInsertRows(QModelIndex(), from, to);
		for (int i = 0, ie = n_accepted; i < ie; ++i)
		{
			m_map_from_tgt.push_back(accepted_rows[i]);
		}
		endInsertRows();
	}

	//@FIXME l8r: this does not work in general!
	if (m_cmap_from_src.size() < m_log_widget.m_src_model->columnCount())
	{
		int const from = m_cmap_from_src.size();
		m_cmap_from_tgt.clear();
		m_cmap_from_src.clear();
		m_cmap_from_src.reserve(m_log_widget.m_src_model->columnCount());
		int ctgt_idx = 0;
		for (size_t src_idx = 0, se = m_log_widget.m_src_model->columnCount(); src_idx < se; ++src_idx)
		{
			if (filterAcceptsColumn(src_idx, QModelIndex()))
			{
				m_cmap_from_src.insert(std::make_pair(src_idx, ctgt_idx));
				++ctgt_idx;
			}
		}
		int const to = ctgt_idx - 1;
		beginInsertColumns(QModelIndex(), from, to);
		m_cmap_from_tgt.resize(m_cmap_from_src.size());
		for (map_t::const_iterator it = m_cmap_from_src.begin(), ite = m_cmap_from_src.end(); it != ite; ++it)
		{
			m_cmap_from_tgt[it->second] = it->first;
		}
		endInsertColumns();
	}
}
コード例 #9
0
ファイル: regionmap.cpp プロジェクト: AAlderman/openmw
void CSMWorld::RegionMap::updateSize()
{
    std::pair<CellCoordinates, CellCoordinates> size = getSize();

    if (int diff = size.first.getX() - mMin.getX())
    {
        beginInsertColumns (QModelIndex(), 0, std::abs (diff)-1);
        mMin = CellCoordinates (size.first.getX(), mMin.getY());
        endInsertColumns();
    }

    if (int diff = size.first.getY() - mMin.getY())
    {
        beginInsertRows (QModelIndex(), 0, std::abs (diff)-1);
        mMin = CellCoordinates (mMin.getX(), size.first.getY());
        endInsertRows();
    }

    if (int diff = size.second.getX() - mMax.getX())
    {
        int columns = columnCount();

        if (diff>0)
            beginInsertColumns (QModelIndex(), columns, columns+diff-1);
        else
            beginRemoveColumns (QModelIndex(), columns+diff, columns-1);

        mMax = CellCoordinates (size.second.getX(), mMax.getY());
        endInsertColumns();
    }

    if (int diff = size.second.getY() - mMax.getY())
    {
        int rows = rowCount();

        if (diff>0)
            beginInsertRows (QModelIndex(), rows, rows+diff-1);
        else
            beginRemoveRows (QModelIndex(), rows+diff, rows-1);

        mMax = CellCoordinates (mMax.getX(), size.second.getY());
        endInsertRows();
    }
}
コード例 #10
0
ファイル: treemodel.cpp プロジェクト: HaronK/BinaryDigger
bool TreeModel::insertColumns(int position, int columns, const QModelIndex &parent)
{
    bool success;

    beginInsertColumns(parent, position, position + columns - 1);
    success = rootItem->insertColumns(position, columns);
    endInsertColumns();

    return success;
}
コード例 #11
0
void FilterProxyModel::resizeToCfg (logs::LogConfig const & config)
{
  //@TODO: dedup: logtablemodel, findproxy, filterproxy
	if (config.m_columns_setup.size() > m_column_count)
	{
		int const last = config.m_columns_setup.size() - 1;
		beginInsertColumns(QModelIndex(), m_column_count, last);
		insertColumns(m_column_count, last);
		m_column_count = last + 1;
		endInsertColumns();
	}
  else if (config.m_columns_setup.size() < m_column_count)
	{
		int const last = config.m_columns_setup.size() + 1;
		beginRemoveColumns(QModelIndex(), last, m_column_count);
		removeColumns(last, m_column_count);
		m_column_count = last - 1;
		endInsertColumns();
	}
}
コード例 #12
0
HexFileModel::HexFileModel(QWidget *parent)
    : QAbstractTableModel(parent)
    , focusPosition(-1)
    , focused(true)
    , hlPosition(-1)
    , hlSize(0)
    , headerCharCount(0)
{
    beginInsertColumns(QModelIndex(),0,columnCount(QModelIndex()));
    endInsertColumns();
}
コード例 #13
0
ファイル: nmproxy.cpp プロジェクト: palinek/nm-tray
void NmProxy::onSourceColumnsMoved( const QModelIndex &sourceParent, int, int, const QModelIndex &destinationParent, int)
{
    if (root == sourceParent)
    {
        if (root == destinationParent)
            endMoveColumns();
        else
            endRemoveColumns();
    } else if (root == destinationParent)
        endInsertColumns();
}
コード例 #14
0
SettingsSaverModel::SettingsSaverModel(QObject *parent) :
    QAbstractTableModel(parent)
{
    m_uiImporter = new UIFileImporter();

    beginInsertColumns(index(0, 0), 0, 4);
    for (int i = 0; i<5; i++) {
        insertColumn(i);
    }
    endInsertColumns();
}
コード例 #15
0
ファイル: adjmatrixmodel.cpp プロジェクト: olefav/graph
void AdjMatrixModel::incrementN()
{
    ++n;
    beginInsertRows(QModelIndex(), n, n);
    for(uint i = 0; i < n; ++i)
        els[index(n-1, i)] = false;
    endInsertRows();
    beginInsertColumns(QModelIndex(), n, n);
    for(uint i = 0; i < n; ++i)
        els[index(i, n-1)] = false;
    endInsertColumns();
}
コード例 #16
0
LogTableModel::LogTableModel (QObject * parent, logs::LogWidget & lw)
	: BaseTableModel(parent, lw.m_config.m_columns_setup, lw.m_config.m_columns_sizes)
	, m_log_widget(lw)
{
	qDebug("%s this=0x%08x", __FUNCTION__, this);

	m_data.init();

	beginInsertColumns(QModelIndex(), 0, columnCount() - 1);
	insertColumns(0, columnCount() - 1);
	endInsertColumns();
}
コード例 #17
0
void QgsAttributeTableModel::loadAttributes()
{
  if ( !mLayer )
  {
    return;
  }

  bool ins = false, rm = false;

  QgsAttributeList attributes;
  for ( QgsFieldMap::const_iterator it = mLayer->pendingFields().constBegin(); it != mLayer->pendingFields().end(); it++ )
  {
    switch ( mLayer->editType( it.key() ) )
    {
      case QgsVectorLayer::Hidden:
        continue;

      case QgsVectorLayer::ValueMap:
        mValueMaps.insert( it.key(), &mLayer->valueMap( it.key() ) );
        break;

      default:
        break;
    }

    attributes << it.key();
  }

  if ( mFieldCount < attributes.size() )
  {
    ins = true;
    beginInsertColumns( QModelIndex(), mFieldCount, attributes.size() - 1 );
  }
  else if ( attributes.size() < mFieldCount )
  {
    rm = true;
    beginRemoveColumns( QModelIndex(), attributes.size(), mFieldCount - 1 );
  }

  mFieldCount = attributes.size();
  mAttributes = attributes;
  mValueMaps.clear();

  if ( ins )
  {
    endInsertColumns();
  }
  else if ( rm )
  {
    endRemoveColumns();
  }
}
コード例 #18
0
void QgsAttributeTableModel::loadAttributes()
{
  if ( !layer() )
  {
    return;
  }

  bool ins = false, rm = false;

  QgsAttributeList attributes;
  const QgsFields& fields = layer()->pendingFields();

  mWidgetFactories.clear();
  mAttributeWidgetCaches.clear();
  mWidgetConfigs.clear();

  for ( int idx = 0; idx < fields.count(); ++idx )
  {
    QgsEditorWidgetFactory* widgetFactory = QgsEditorWidgetRegistry::instance()->factory( layer()->editorWidgetV2( idx ) );
    if ( !widgetFactory || !layer() )
      continue;

    mWidgetFactories.append( widgetFactory );
    mWidgetConfigs.append( layer()->editorWidgetV2Config( idx ) );
    mAttributeWidgetCaches.append( widgetFactory->createCache( layer(), idx, mWidgetConfigs.last() ) );

    attributes << idx;
  }

  if ( mFieldCount < attributes.size() )
  {
    ins = true;
    beginInsertColumns( QModelIndex(), mFieldCount, attributes.size() - 1 );
  }
  else if ( attributes.size() < mFieldCount )
  {
    rm = true;
    beginRemoveColumns( QModelIndex(), attributes.size(), mFieldCount - 1 );
  }

  mFieldCount = attributes.size();
  mAttributes = attributes;

  if ( ins )
  {
    endInsertColumns();
  }
  else if ( rm )
  {
    endRemoveColumns();
  }
}
コード例 #19
0
bool PersonsTableModel::insertColumns(int column, int count, const QModelIndex &parent)
{
    if(column == 0)
        return false;
    Q_D(PersonsTableModel);
    beginInsertColumns(parent, column, column+count-1);
    QList<QDate>::Iterator iterBefore = d->columns.begin()+column-1;
    for(int i=0; i<count; ++i) {
        iterBefore = d->columns.insert(iterBefore, QDate());
    }
    endInsertColumns();
    return true;
}
コード例 #20
0
ファイル: model.cpp プロジェクト: Fale/qtmoko
bool TableModel::insertColumns(int position, int columns, const QModelIndex &parent)
{
    int rows = rowCount();
    beginInsertColumns(parent, position, position + columns - 1);

    for (int row = 0; row < rows; ++row) {
        for (int column = position; column < columns; ++column) {
            rowList[row].insert(position, "");
        }
    }

    endInsertColumns();
    return true;
}
コード例 #21
0
ファイル: wg_transpose_proxy.cpp プロジェクト: wgsyd/wgtf
void WGTransposeProxy::setSourceModel(QAbstractItemModel* sourceModel)
{
	beginResetModel();
	connections_.reset();
	QAbstractProxyModel::setSourceModel(sourceModel);
	if (sourceModel != nullptr)
	{
		connections_ +=
		QObject::connect(sourceModel, &QAbstractItemModel::modelAboutToBeReset, [this]() { beginResetModel(); });
		connections_ += QObject::connect(sourceModel, &QAbstractItemModel::modelReset, [this]() { endResetModel(); });
		connections_ += QObject::connect(
		sourceModel, &QAbstractItemModel::dataChanged,
		[this](const QModelIndex& topLeft, const QModelIndex& bottomRight, const QVector<int>& roles) {
			auto proxyTopLeft = topLeft.isValid() ? index(topLeft.column(), topLeft.row()) : QModelIndex();
			auto proxyBottomRight =
			bottomRight.isValid() ? index(bottomRight.column(), bottomRight.row()) : QModelIndex();
			dataChanged(proxyTopLeft, proxyBottomRight, roles);
		});
		connections_ += QObject::connect(sourceModel, &QAbstractItemModel::rowsAboutToBeInserted,
		                                 [this](const QModelIndex& parent, int first, int last) {
			                                 TF_ASSERT(!parent.isValid());
			                                 beginInsertColumns(QModelIndex(), first, last);
			                             });
		connections_ +=
		QObject::connect(sourceModel, &QAbstractItemModel::rowsInserted, [this]() { endInsertColumns(); });
		connections_ += QObject::connect(sourceModel, &QAbstractItemModel::rowsAboutToBeRemoved,
		                                 [this](const QModelIndex& parent, int first, int last) {
			                                 TF_ASSERT(!parent.isValid());
			                                 beginRemoveColumns(QModelIndex(), first, last);
			                             });
		connections_ +=
		QObject::connect(sourceModel, &QAbstractItemModel::rowsRemoved, [this]() { endRemoveColumns(); });
		connections_ += QObject::connect(sourceModel, &QAbstractItemModel::columnsAboutToBeInserted,
		                                 [this](const QModelIndex& parent, int first, int last) {
			                                 TF_ASSERT(!parent.isValid());
			                                 beginInsertRows(QModelIndex(), first, last);
			                             });
		connections_ +=
		QObject::connect(sourceModel, &QAbstractItemModel::columnsInserted, [this]() { endInsertRows(); });
		connections_ += QObject::connect(sourceModel, &QAbstractItemModel::columnsAboutToBeRemoved,
		                                 [this](const QModelIndex& parent, int first, int last) {
			                                 TF_ASSERT(!parent.isValid());
			                                 beginRemoveRows(QModelIndex(), first, last);
			                             });
		connections_ +=
		QObject::connect(sourceModel, &QAbstractItemModel::columnsRemoved, [this]() { endRemoveRows(); });
	}
	endResetModel();
}
コード例 #22
0
ファイル: vectormodel.cpp プロジェクト: jhgorse/kst
bool VectorModel::addVector(VectorPtr v)
{
  assert(v);
  if (!_vectorList.contains(v)) {
    beginInsertColumns(QModelIndex(), columnCount(), columnCount());
    _vectorList.append(v);
    // Standard nb of digits after comma: 6
    _digitNbList.append(6);
    endInsertColumns();
    reset();
    _rows = rowCount();
    return true;
  }
  return false;
}
コード例 #23
0
void RKVarEditModel::addObject (int index, RKVariable* object) {
	RK_TRACE (EDITOR);
	RK_ASSERT (object);

	if ((index < 0) || (index >= objects.size ())) index = objects.size ();

	beginInsertColumns (QModelIndex (), index, index);
	if (meta_model) meta_model->beginAddDataObject (index);
	if (object->isPending () && (!object->getLength ())) object->setLength (trueRows ());	// probably we just created it ourselves
	listenForObject (object);
	objects.insert (index, object);
	if (meta_model) meta_model->endAddDataObject ();
	endInsertColumns ();

	checkDuplicates ();
}
コード例 #24
0
void mainCorrelationModel::add(correlationRow *row_, const correlationRow &key_)
{
    beginInsertRows(QModelIndex(), m_rows.count(), m_rows.count());
    // add correlation to every other row, which is calculated and passed in with the row_ object
    foreach(baseRow *existingRow, m_rows)
        static_cast<correlationRow*>(existingRow)->correlationValues.insert(key_, row_->correlationValues.value(*static_cast<correlationRow*>(existingRow)));
    m_rows.append(row_);
    endInsertRows();

    beginInsertColumns(QModelIndex(), m_rows.count(), m_rows.count());
    // add dummy column
    m_viewableColumns.append(0);
    endInsertColumns();

    sortRows();
    emit dataChanged(index(0, 0), index(rowCount(QModelIndex()) - 1, columnCount(QModelIndex()) - 1));
}
コード例 #25
0
void DataFrameModel::endChanges(int oldnr, int oldnc) {
    if (oldnr != -1) {
        int nr = rowCount(QModelIndex());
        int nc = columnCount(QModelIndex());
        if (oldnc > nc)
            endRemoveColumns();
        else if (oldnc < nc)
            endInsertColumns(); // just in case column names/roles changed
        else headerDataChanged(Qt::Horizontal, 0, nc);
        if (oldnr > nr) // insert rows
            endRemoveRows();
        else if (oldnr < nr)
            endInsertRows();
        else headerDataChanged(Qt::Vertical, 0, nr);
        // be lazy and just say everything changed
        // will not matter unless many rows/cols are in view (rare)
        dataChanged(index(0, 0), index(nr, nc));
    }
}
コード例 #26
0
ファイル: JobshopModel.cpp プロジェクト: konserw/jobshop
void JobshopModel::setOperationsCount(int count)
{
    int cc = Jobshop::instance()->operationsCount();
    if(cc == count)
        return;

    if(cc > count)
    {
        beginRemoveColumns(QModelIndex(), columnCount()-1, m_nonOperationColumns + count);
        Jobshop::instance()->setOperationsCount(count);
        endRemoveColumns();
    }
    else if(cc < count)
    {
        beginInsertColumns(QModelIndex(), columnCount(), m_nonOperationColumns + count - 1);
        Jobshop::instance()->setOperationsCount(count);
        endInsertColumns();
    }
}
コード例 #27
0
ファイル: FilterTable.cpp プロジェクト: 2ion/stmtools
bool FilterTable::insertColumns(int column, int count, const QModelIndex &parent) {
    beginInsertColumns(parent, column, column+count-1);
    /* prepend columns */
    if(column == 0) {
        for(int c=0; c < count; ++c)
            table.prepend(new QList<void*>());
    } else {
        /* append columns */
        if(column == column_count) {
            for(int c=0; c < count; ++c)
                table.append(new QList<void*>());
        } else {
            /* insert columns within table */
            for(int pos=column; pos < column+count; ++pos)
                table.insert(pos, new QList<void*>());
        }
    }
    endInsertColumns();
    return true;
}
コード例 #28
0
void DemandListModel::setNumberOfChoices(int n_choix){

	if(n_choix > 0){
		unsigned int n_c = (unsigned int) n_choix;

		if(_numberOfChoices != n_c){
			if(n_c < _numberOfChoices){
				beginRemoveColumns(QModelIndex(), 2 + n_c, 1 + _numberOfChoices);
				_numberOfChoices = n_c;
				endRemoveColumns();
			} else {
				beginInsertColumns(QModelIndex(), 2 + _numberOfChoices, 1 + n_c);
				_numberOfChoices = n_c;
				endInsertColumns();
			}
			emit(numberOfChoicesChanged(_numberOfChoices));
		}
	}

}
コード例 #29
0
void GELFMessageModel::onMessage(QJsonObject message)
{

    QStringList keys = message.keys();
    QStringListIterator i_keys(keys);
    while (i_keys.hasNext()) {
        QString key = i_keys.next();
        if (!column_names.contains(key)) {
            auto column_index = column_names.count();
            beginInsertColumns(QModelIndex(), column_index, column_index);
            column_names << key;
            endInsertColumns();
        }
    }

    // Insert row
    auto row_index = messages.size();
    beginInsertRows(QModelIndex(), row_index, row_index);
    messages << message;
    endInsertRows();
}
コード例 #30
0
ファイル: akonadibrowsermodel.cpp プロジェクト: KDE/kdepim
void AkonadiBrowserModel::setItemDisplayMode(AkonadiBrowserModel::ItemDisplayMode itemDisplayMode)
{
    const int oldColumnCount = columnCount();
    m_itemDisplayMode = itemDisplayMode;
    AkonadiBrowserModel::State *newState = Q_NULLPTR;
    switch (itemDisplayMode) {
    case MailMode:
        newState = m_mailState;
        break;
    case ContactsMode:
        newState = m_contactsState;
        break;
    case CalendarMode:
        newState = m_calendarState;
        break;
    case GenericMode:
    default:
        newState = m_genericState;
        break;
    }
    const int newColumnCount = qMax(newState->m_collectionHeaders.count(), newState->m_itemHeaders.count());

    //qCDebug(AKONADICONSOLE_LOG) << "column count changed from" << oldColumnCount << "to" << newColumnCount;
    if (newColumnCount > oldColumnCount) {
        beginInsertColumns(QModelIndex(), oldColumnCount, newColumnCount - 1);
        m_currentState = newState;
        endInsertColumns();
    } else if (newColumnCount < oldColumnCount) {
        beginRemoveColumns(QModelIndex(), newColumnCount, oldColumnCount - 1);
        m_currentState = newState;
        endRemoveColumns();
    } else {
        m_currentState = newState;
    }
    headerDataChanged(Qt::Horizontal, 0, newColumnCount - 1);

    // The above is not enough to see the new headers, because EntityMimeTypeFilterModel gets column count and headers from our data,
    // and doesn't listen to dataChanged/headerDataChanged...
    columnsChanged();
}