@@ -176,7 +176,7 @@ MainWindow::MainWindow(QWidget* parent)
176176 // setup connections
177177 connect (scene, SIGNAL (dataChanged (const QModelIndex &, const QModelIndex & )),
178178 this , SLOT (updateInfo ()));
179-
179+
180180 connect (scene, SIGNAL (dataChanged (const QModelIndex &, const QModelIndex & )),
181181 this , SLOT (updateDisplayInfo ()));
182182
@@ -203,7 +203,7 @@ MainWindow::MainWindow(QWidget* parent)
203203 SIGNAL (selectionChanged ( const QItemSelection & , const QItemSelection & ) ),
204204 this , SLOT (updateDisplayInfo ()));
205205
206- connect (sceneView->selectionModel (),
206+ connect (sceneView->selectionModel (),
207207 SIGNAL (selectionChanged ( const QItemSelection & , const QItemSelection & ) ),
208208 this , SLOT (selectionChanged ()));
209209
@@ -362,6 +362,7 @@ MainWindow::MainWindow(QWidget* parent)
362362
363363 // setup menu filtering
364364 connect (ui->menuOperations , SIGNAL (aboutToShow ()), this , SLOT (filterOperations ()));
365+
365366}
366367
367368// Recursive function that do a pass over a menu and its sub-menus(etc.) and hide them when they are empty
@@ -1032,9 +1033,10 @@ Scene_item* MainWindow::loadItem(QFileInfo fileinfo, CGAL::Three::Polyhedron_dem
10321033
10331034 item->setProperty (" source filename" , fileinfo.absoluteFilePath ());
10341035 item->setProperty (" loader_name" , loader->name ());
1036+
10351037 if (!reloading)
10361038 {
1037- this -> addToRecentFiles (fileinfo.absoluteFilePath ());
1039+ addToRecentFiles (fileinfo.absoluteFilePath ());
10381040 }
10391041 item->moveToThread (QApplication::instance ()->thread ());
10401042 return item;
@@ -1447,7 +1449,6 @@ void MainWindow::on_actionLoad_triggered()
14471449 if (it != filterPluginMap.end ()) {
14481450 selectedPlugin = it.value ();
14491451 }
1450-
14511452 QList<InfoLoader> list;
14521453 if (selectedPlugin) {
14531454 Q_FOREACH (const QString& filename, dialog.selectedFiles ()) {
@@ -1781,7 +1782,7 @@ void MainWindow::makeNewGroup()
17811782{
17821783 Scene_group_item * group =
17831784 new Scene_group_item (QString (" New group" ), scene);
1784- scene->addItem (group);
1785+ scene->addItem (group, false );
17851786}
17861787
17871788void MainWindow::on_upButton_pressed ()
@@ -2061,7 +2062,7 @@ void ReloadingController::handleResults(CT::Scene_item* item)
20612062 finish (false );
20622063 return ;
20632064 }
2064- item->setName (QString ( " %1 reloaded " ). arg ( original->name () ));
2065+ item->setName (original->name ());
20652066 item->setColor (original->color ());
20662067 item->setRenderingMode (original->renderingMode ());
20672068 item->setVisible (original->visible ());
@@ -2077,7 +2078,7 @@ void ReloadingController::handleResults(CT::Scene_item* item)
20772078void ReloadingController::process ()
20782079{
20792080 original->reading ();
2080- workerThread ->start ();
2081+ QThreadPool::globalInstance () ->start (workerThread );
20812082}
20822083
20832084LoadingController::LoadingController (const QList<InfoLoader>& input,
@@ -2091,7 +2092,6 @@ LoadingController::LoadingController(const QList<InfoLoader>& input,
20912092 workerThread = new LoadingThread (input, mw, false );
20922093 connect (workerThread, SIGNAL (resultReady (CT::Scene_item*)),
20932094 this , SLOT (handleResults (CT::Scene_item*)));
2094- connect (workerThread, SIGNAL (finished ()), workerThread, SLOT (deleteLater ()));
20952095 colors_.reserve (input.size ());
20962096 compute_color_map (CT::Scene_item::defaultColor (),
20972097 static_cast <unsigned >(input.size ()),
@@ -2102,7 +2102,7 @@ LoadingController::LoadingController(const QList<InfoLoader>& input,
21022102
21032103void LoadingController::handleResults (CT::Scene_item* item)
21042104{
2105- counter++ ;
2105+ ++counter ;
21062106 if (!item)
21072107 {
21082108 error ();
@@ -2113,14 +2113,20 @@ void LoadingController::handleResults(CT::Scene_item* item)
21132113 if (!group
21142114 || group->getChildrenIds ().size () == 0 )
21152115 item->setColor (colors_[counter-1 ]);
2116- mw->selectSceneItem (scene->item_id (item));
21172116
2118- scene->addItem (item);
2117+ scene->addItem (item,
2118+ counter == input.size ());
21192119
2120- if (group)
2120+ if (group
2121+ && group->getChildrenIds ().size () > 0 )
2122+ {
21212123 scene->redraw_model ();
2124+ }
21222125 if (counter == input.size ())
2126+ {
2127+ mw->selectSceneItem (scene->item_id (item));
21232128 finished ();
2129+ }
21242130}
21252131
21262132void StatisticsController::handleResults (QString res)
0 commit comments