From ddb0cdf75cd02ac538dc881e41150fd14d2fefb5 Mon Sep 17 00:00:00 2001 From: Kyle Lutz Date: Wed, 22 May 2013 13:35:15 -0400 Subject: [PATCH 1/2] Add 'Show All Blocks' button to context-menu This adds a new button to the context-menu for multi-block data sets which sets the visibility of all blocks to true. Change-Id: I17044090cd128c627ec497906f2a78a62da9f7bd --- .../pqPipelineContextMenuBehavior.cxx | 15 +++++++++++++++ .../pqPipelineContextMenuBehavior.h | 3 +++ Qt/Components/pqMultiBlockInspectorPanel.cxx | 9 +++++++++ Qt/Components/pqMultiBlockInspectorPanel.h | 1 + 4 files changed, 28 insertions(+) diff --git a/Qt/ApplicationComponents/pqPipelineContextMenuBehavior.cxx b/Qt/ApplicationComponents/pqPipelineContextMenuBehavior.cxx index 16200d597ea..d0160927374 100644 --- a/Qt/ApplicationComponents/pqPipelineContextMenuBehavior.cxx +++ b/Qt/ApplicationComponents/pqPipelineContextMenuBehavior.cxx @@ -246,6 +246,11 @@ void pqPipelineContextMenuBehavior::buildMenu(pqDataRepresentation* repr, this->connect(showOnlyBlockAction, SIGNAL(triggered()), this, SLOT(showOnlyBlock())); + QAction *showAllBlocksAction = + this->Menu->addAction("Show All Blocks"); + this->connect(showAllBlocksAction, SIGNAL(triggered()), + this, SLOT(showAllBlocks())); + QAction *unsetVisibilityAction = this->Menu->addAction(QString("Unset Block %1") .arg(multipleBlocks ? "Visibilities" : "Visibility")); @@ -491,6 +496,16 @@ void pqPipelineContextMenuBehavior::showOnlyBlock() } } +//----------------------------------------------------------------------------- +void pqPipelineContextMenuBehavior::showAllBlocks() +{ + pqMultiBlockInspectorPanel *panel = getMultiBlockInspectorPanel(); + if (panel) + { + panel->showAllBlocks(); + } +} + //----------------------------------------------------------------------------- void pqPipelineContextMenuBehavior::unsetBlockVisibility() { diff --git a/Qt/ApplicationComponents/pqPipelineContextMenuBehavior.h b/Qt/ApplicationComponents/pqPipelineContextMenuBehavior.h index f64b55329ce..be801c492e4 100644 --- a/Qt/ApplicationComponents/pqPipelineContextMenuBehavior.h +++ b/Qt/ApplicationComponents/pqPipelineContextMenuBehavior.h @@ -75,6 +75,9 @@ protected slots: /// signal will contain the block index in its data(). void showOnlyBlock(); + /// called to show all blocks. + void showAllBlocks(); + /// called to unset the visibility flag for the block. after this call the /// block will inherit the visibility from its parent. the action which /// emits the signal will contain the block index in its data() diff --git a/Qt/Components/pqMultiBlockInspectorPanel.cxx b/Qt/Components/pqMultiBlockInspectorPanel.cxx index cbfcb6e39ea..48980fefdd9 100644 --- a/Qt/Components/pqMultiBlockInspectorPanel.cxx +++ b/Qt/Components/pqMultiBlockInspectorPanel.cxx @@ -435,6 +435,15 @@ void pqMultiBlockInspectorPanel::showOnlyBlock(unsigned int index) this->showOnlyBlocks(indices); } +//----------------------------------------------------------------------------- +void pqMultiBlockInspectorPanel::showAllBlocks() +{ + this->BlockVisibilites.clear(); + this->BlockVisibilites[0] = true; // show root block + this->updateBlockVisibilities(); + this->Representation->renderViewEventually(); +} + //----------------------------------------------------------------------------- void pqMultiBlockInspectorPanel::showOnlyBlocks( const QList& indices) diff --git a/Qt/Components/pqMultiBlockInspectorPanel.h b/Qt/Components/pqMultiBlockInspectorPanel.h index e7737233b91..65dcbf0b2e6 100644 --- a/Qt/Components/pqMultiBlockInspectorPanel.h +++ b/Qt/Components/pqMultiBlockInspectorPanel.h @@ -70,6 +70,7 @@ public slots: void showOnlyBlock(unsigned int index); void showOnlyBlocks(const QList& indices); + void showAllBlocks(); private slots: void treeWidgetCustomContextMenuRequested(const QPoint &pos); From ebf184d3c8d1e2bc8d2d49677b9c4719e3f38085 Mon Sep 17 00:00:00 2001 From: Kyle Lutz Date: Wed, 22 May 2013 13:51:28 -0400 Subject: [PATCH 2/2] Fix bug when setting color for multi-block data sets This fixes a bug which occurs when the user clicks cancel in the color chooser dialog when changing the color for a block. Change-Id: I229896ce88c210a27a731f5d80e795daae969b93 --- Qt/ApplicationComponents/pqPipelineContextMenuBehavior.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Qt/ApplicationComponents/pqPipelineContextMenuBehavior.cxx b/Qt/ApplicationComponents/pqPipelineContextMenuBehavior.cxx index d0160927374..21e7b618f35 100644 --- a/Qt/ApplicationComponents/pqPipelineContextMenuBehavior.cxx +++ b/Qt/ApplicationComponents/pqPipelineContextMenuBehavior.cxx @@ -535,7 +535,10 @@ void pqPipelineContextMenuBehavior::setBlockColor() if (panel) { QColor color = QColorDialog::getColor(Qt::gray); - panel->setBlockColor(this->PickedBlocks, color); + if(color.isValid()) + { + panel->setBlockColor(this->PickedBlocks, color); + } } }