Skip to content

Commit

Permalink
Fixed a bug in the expand state saving/restoration on ModelObjectsWidget
Browse files Browse the repository at this point in the history
(issue #1843)
  • Loading branch information
rkhaotix committed Jan 29, 2024
1 parent 47d9e8a commit dde9135
Show file tree
Hide file tree
Showing 4 changed files with 130 additions and 134 deletions.
7 changes: 4 additions & 3 deletions libs/libgui/src/mainwindow.cpp
Expand Up @@ -1517,7 +1517,8 @@ void MainWindow::setCurrentModel()
changelog_wgt->setModel(current_model);

if(current_model)
model_objs_wgt->restoreTreeState(model_tree_states[current_model], model_tree_v_pos[current_model]);
model_objs_wgt->restoreTreeState(model_tree_states[current_model],
model_tree_v_pos[current_model]);

model_objs_wgt->saveTreeState(true);
resizeGeneralToolbarButtons();
Expand Down Expand Up @@ -1621,8 +1622,8 @@ void MainWindow::closeModel(int model_id)
(model->isModified() && msg_box.result()==QDialog::Accepted))
{
model_nav_wgt->removeModel(model_id);
model_tree_states.erase(model);
model_tree_v_pos.erase(model);
model_tree_states.remove(model);
model_tree_v_pos.remove(model);

disconnect(model, nullptr, nullptr, nullptr);

Expand Down
4 changes: 2 additions & 2 deletions libs/libgui/src/mainwindow.h
Expand Up @@ -120,10 +120,10 @@ class __libgui MainWindow: public QMainWindow, public Ui::MainWindow {
ModelWidget *current_model;

//! \brief Stores the model objects tree state for each opened model
std::map<ModelWidget *, std::vector<BaseObject *> > model_tree_states;
QMap<ModelWidget *, QStringList> model_tree_states;

//! \brief Stores the model objects tree vertical scrollbar position for each opened model
std::map<ModelWidget *, int> model_tree_v_pos;
QMap<ModelWidget *, int> model_tree_v_pos;

//! \brief Stores the defaul window title
QString window_title;
Expand Down

0 comments on commit dde9135

Please sign in to comment.