Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong variable setting after Column Insert before #5340

Merged
merged 1 commit into from
Dec 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Desktop/data/columnmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ ColumnModel::ColumnModel(DataSetTableModel* dataSetTableModel)
connect(DataSetPackage::pkg(), &DataSetPackage::columnDataTypeChanged, this, &ColumnModel::columnDataTypeChanged );
connect(DataSetPackage::pkg(), &DataSetPackage::labelsReordered, this, &ColumnModel::refresh );
connect(DataSetPackage::pkg(), &DataSetPackage::columnsBeingRemoved, this, &ColumnModel::checkRemovedColumns );
connect(DataSetPackage::pkg(), &DataSetPackage::columnsInserted, this, &ColumnModel::checkInsertedColumns );
connect(DataSetPackage::pkg(), &DataSetPackage::datasetChanged, this, &ColumnModel::checkCurrentColumn );
connect(DataSetPackage::pkg(), &DataSetPackage::workspaceEmptyValuesChanged, this, &ColumnModel::emptyValuesChanged );

Expand Down Expand Up @@ -560,6 +561,15 @@ void ColumnModel::changeSelectedColumn(QPoint selectionStart)
setChosenColumn(selectionStart.x());
}

void ColumnModel::checkInsertedColumns(const QModelIndex &, int first, int)
{
if (_currentColIndex >= first)
{
_currentColIndex = -1; // Force the setting of new column.
setChosenColumn(first);
}
}

void ColumnModel::checkRemovedColumns(int columnIndex, int count)
{
int currentCol = chosenColumn();
Expand Down
1 change: 1 addition & 0 deletions Desktop/data/columnmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ public slots:
void refresh();
void changeSelectedColumn(QPoint selectionStart);
void checkRemovedColumns(int columnIndex, int count);
void checkInsertedColumns(const QModelIndex & parent, int first, int last);
void openComputedColumn(const QString & name);
void checkCurrentColumn( QStringList changedColumns, QStringList missingColumns, QMap<QString, QString> changeNameColumns, bool rowCountChanged, bool hasNewColumns);
void setCompactMode(bool newCompactMode);
Expand Down
Loading