void FaceColors::on_boxSelection_clicked() { Gui::View3DInventor* view = qobject_cast<Gui::View3DInventor*>(Gui::getMainWindow()->activeWindow()); if (view) { Gui::View3DInventorViewer* viewer = view->getViewer(); if (!viewer->isSelecting()) { viewer->startSelection(Gui::View3DInventorViewer::Rubberband); viewer->addEventCallback(SoMouseButtonEvent::getClassTypeId(), Private::selectionCallback, this); // avoid that the selection node handles the event otherwise the callback function won't be // called immediately SoNode* root = viewer->getSceneGraph(); static_cast<Gui::SoFCUnifiedSelection*>(root)->selectionRole.setValue(false); d->view = viewer; } } }