diff --git a/Polyhedron/demo/Polyhedron/MainWindow.cpp b/Polyhedron/demo/Polyhedron/MainWindow.cpp index 717ef7e4b80..bcafbe1f20d 100644 --- a/Polyhedron/demo/Polyhedron/MainWindow.cpp +++ b/Polyhedron/demo/Polyhedron/MainWindow.cpp @@ -131,7 +131,7 @@ MainWindow::MainWindow(QWidget* parent) viewer->setScene(scene); sceneView->setModel(scene); - // setup the treeview: delegation and columns sizing... + // setup the sceneview: delegation and columns sizing... sceneView->setItemDelegate(new SceneDelegate(this)); sceneView->header()->setStretchLastSection(false); @@ -151,9 +151,6 @@ MainWindow::MainWindow(QWidget* parent) connect(scene, SIGNAL(dataChanged(const QModelIndex &, const QModelIndex & )), this, SLOT(updateInfo())); -connect(scene, SIGNAL(itemsDestroyed()), - this, SLOT(updateInfo())); - connect(scene, SIGNAL(dataChanged(const QModelIndex &, const QModelIndex & )), this, SLOT(updateDisplayInfo())); @@ -791,13 +788,18 @@ Scene_item* MainWindow::load_item(QFileInfo fileinfo, Polyhedron_demo_io_plugin_ void MainWindow::selectSceneItem(int i) { - if(i < 0) return; - if(i >= scene->numberOfEntries()) return; - - sceneView->selectionModel()->select(scene->createSelection(i), - QItemSelectionModel::ClearAndSelect); + if(i < 0 || i >= scene->numberOfEntries()) { + sceneView->selectionModel()->clearSelection(); + updateInfo(); + updateDisplayInfo(); + } + else { + sceneView->selectionModel()->select(scene->createSelection(i), + QItemSelectionModel::ClearAndSelect); + } } + void MainWindow::showSelectedPoint(double x, double y, double z) { information(QString("Selected point: (%1, %2, %3)"). diff --git a/Polyhedron/demo/Polyhedron/Scene.cpp b/Polyhedron/demo/Polyhedron/Scene.cpp index 54346a8b568..8169c09e2c7 100644 --- a/Polyhedron/demo/Polyhedron/Scene.cpp +++ b/Polyhedron/demo/Polyhedron/Scene.cpp @@ -111,8 +111,6 @@ Scene::erase(QList indices) emit updated(); QAbstractListModel::reset(); - emit itemsDestroyed(); - int index = max_index + 1 - indices.size(); if(index >= 0) return index; diff --git a/Polyhedron/demo/Polyhedron/Scene.h b/Polyhedron/demo/Polyhedron/Scene.h index 0a19fd9ee12..a020143068f 100644 --- a/Polyhedron/demo/Polyhedron/Scene.h +++ b/Polyhedron/demo/Polyhedron/Scene.h @@ -130,7 +130,6 @@ signals: void updated_bbox(); void updated(); void itemAboutToBeDestroyed(Scene_item*); - void itemsDestroyed(); void selectionRay(double, double, double, double, double, double); private slots: