Commit 6a136d4d authored by NICLAUSSE Nicolas's avatar NICLAUSSE Nicolas

add checkbox for scalar bars

parent 263572d8
......@@ -67,6 +67,7 @@ public:
public:
QComboBox *fields_box = nullptr;
QCheckBox *display_scalarbar = nullptr;
};
// ///////////////////////////////////////////////////////////////////
......@@ -210,6 +211,29 @@ void dtkVisualizationDecoratorClutEditor::setCanvas(dtkVisualizationCanvas *canv
d->fields_box = new QComboBox;
d->fields_box->addItems(d->eligible_field_names);
d->fields_box->setCurrentText(d->current_field_name);
d->fields_box->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
d->display_scalarbar = new QCheckBox;
d->display_scalarbar->setChecked(true);
connect(d->display_scalarbar, &QCheckBox::stateChanged, [=] (int value) {
if (value == Qt::Checked)
this->canvas()->renderer()->AddActor2D(d->scalar_bar);
else
this->canvas()->renderer()->RemoveActor2D(d->scalar_bar);
this->canvas()->renderer()->GetRenderWindow()->Render();
});
QHBoxLayout *h_layout = new QHBoxLayout;
h_layout->setAlignment(Qt::AlignLeft);
h_layout->addWidget(new QLabel("Display ScalarBar:"));
h_layout->addWidget(d->display_scalarbar);
h_layout->addWidget(new QLabel("Field:"));
h_layout->addWidget(d->fields_box);
QWidget *scalar_w = new QWidget;
scalar_w->setLayout(h_layout);
connect(d->fields_box, &QComboBox::currentTextChanged,
this, &dtkVisualizationDecoratorClutEditor::setCurrentFieldName);
......@@ -219,7 +243,7 @@ void dtkVisualizationDecoratorClutEditor::setCanvas(dtkVisualizationCanvas *canv
dtkWidgetsOverlayPaneItem *pane_item = new dtkWidgetsOverlayPaneItem;
pane_item->setTitle("Clut Editor");
pane_item->addWidget(d->fields_box);
pane_item->addWidget(scalar_w);
pane_item->addWidget(clut_editor);
canvas_pane->addWidget(pane_item);
......
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