Commit a8bd5a1a authored by finetjul's avatar finetjul
Browse files

BUG: show sceneviews taken from qMRMLThreeDViewsControllerWidget

vtkMRMLSceneViewNode are hidden from Editors by default; keep this behavior
consistent across all vtkMRMLSceneViewNodes but make the tree widget
display hidden view nodes by default.
Fix crashes when the image data is not set.

git-svn-id: http://svn.slicer.org/Slicer4/trunk@15643 3bd1e089-480b-0410-8dfb-8563597acbee
parent 20cb0f82
...@@ -96,7 +96,7 @@ void vtkSlicerSceneViewLogic::CreateSceneView(const char* name, const char* desc ...@@ -96,7 +96,7 @@ void vtkSlicerSceneViewLogic::CreateSceneView(const char* name, const char* desc
newSceneViewNode->SetScreenshotType(screenshotType); newSceneViewNode->SetScreenshotType(screenshotType);
newSceneViewNode->SetScreenshot(screenshot); newSceneViewNode->SetScreenshot(screenshot);
newSceneViewNode->StoreScene(); newSceneViewNode->StoreScene();
newSceneViewNode->HideFromEditorsOff(); //newSceneViewNode->HideFromEditorsOff();
this->GetMRMLScene()->AddNode(newSceneViewNode); this->GetMRMLScene()->AddNode(newSceneViewNode);
} }
......
...@@ -142,6 +142,11 @@ QPixmap qMRMLUtils::createColorPixmap(QStyle * style, const QColor &color) ...@@ -142,6 +142,11 @@ QPixmap qMRMLUtils::createColorPixmap(QStyle * style, const QColor &color)
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
bool qMRMLUtils::qImageToVtkImageData(const QImage& img, vtkImageData* vtkimage) bool qMRMLUtils::qImageToVtkImageData(const QImage& img, vtkImageData* vtkimage)
{ {
if (vtkimage == 0)
{
return false;
}
int height = img.height(); int height = img.height();
int width = img.width(); int width = img.width();
int numcomponents = img.hasAlphaChannel() ? 4 : 3; int numcomponents = img.hasAlphaChannel() ? 4 : 3;
...@@ -176,7 +181,8 @@ bool qMRMLUtils::qImageToVtkImageData(const QImage& img, vtkImageData* vtkimage) ...@@ -176,7 +181,8 @@ bool qMRMLUtils::qImageToVtkImageData(const QImage& img, vtkImageData* vtkimage)
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
bool qMRMLUtils::vtkImageDataToQImage(vtkImageData* vtkimage, QImage& img) bool qMRMLUtils::vtkImageDataToQImage(vtkImageData* vtkimage, QImage& img)
{ {
if (vtkimage->GetScalarType() != VTK_UNSIGNED_CHAR) if (!vtkimage ||
vtkimage->GetScalarType() != VTK_UNSIGNED_CHAR)
{ {
return false; return false;
} }
......
...@@ -81,6 +81,7 @@ void qMRMLSceneViewsTreeWidgetPrivate::init() ...@@ -81,6 +81,7 @@ void qMRMLSceneViewsTreeWidgetPrivate::init()
//this->SortFilterModel->setNodeTypes(nodeTypes); //this->SortFilterModel->setNodeTypes(nodeTypes);
q->setNodeTypes(nodeTypes); q->setNodeTypes(nodeTypes);
this->SortFilterModel = q->sortFilterProxyModel(); this->SortFilterModel = q->sortFilterProxyModel();
this->SortFilterModel->setShowHidden(true);
//this->SortFilterModel->setSourceModel(this->SceneModel); //this->SortFilterModel->setSourceModel(this->SceneModel);
//q->qMRMLTreeWidget::setModel(this->SortFilterModel); //q->qMRMLTreeWidget::setModel(this->SortFilterModel);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment