##// END OF EJS Templates
Updates visitor interface...
Updates visitor interface + corrects accept() method's signature of widgets that can be visited

File last commit:

r207:6308522bc3bb
r207:6308522bc3bb
Show More
VisualizationZoneWidget.cpp
72 lines | 1.7 KiB | text/x-c | CppLexer
/ gui / src / Visualization / VisualizationZoneWidget.cpp
mv visualization -> Visualization...
r95 #include "Visualization/VisualizationZoneWidget.h"
Alexandre Leroux
Updates visitor interface...
r207 #include "Visualization/IVisualizationWidgetVisitor.h"
Creation of VisualizationWidget, VizualizationTabWidget, VisualizationZoneWidget, VisualizationGraphWidget
r58 #include "ui_VisualizationZoneWidget.h"
Add the visualization gui classes
r118 #include "Visualization/VisualizationGraphWidget.h"
Alexandre Leroux
Completes the method of creating a zone from a variable
r200 namespace {
/// Generates a default name for a new graph, according to the number of graphs already displayed in
/// the zone
QString defaultGraphName(const QLayout &layout)
{
auto count = 0;
for (auto i = 0; i < layout.count(); ++i) {
if (dynamic_cast<VisualizationGraphWidget *>(layout.itemAt(i)->widget())) {
count++;
}
}
return QObject::tr("Graph %1").arg(count + 1);
}
} // namespace
Alexandre Leroux
Adds a name for a zone...
r197 VisualizationZoneWidget::VisualizationZoneWidget(const QString &name, QWidget *parent)
Modify construction of objects to use initializer list...
r91 : QWidget{parent}, ui{new Ui::VisualizationZoneWidget}
Creation of VisualizationWidget, VizualizationTabWidget, VisualizationZoneWidget, VisualizationGraphWidget
r58 {
ui->setupUi(this);
Alexandre Leroux
Adds a name for a zone...
r197
ui->zoneNameLabel->setText(name);
Creation of VisualizationWidget, VizualizationTabWidget, VisualizationZoneWidget, VisualizationGraphWidget
r58 }
VisualizationZoneWidget::~VisualizationZoneWidget()
{
delete ui;
}
Add the visualization gui classes
r118
void VisualizationZoneWidget::addGraph(VisualizationGraphWidget *graphWidget)
{
ui->visualizationZoneFrame->layout()->addWidget(graphWidget);
}
Alexandre Leroux
Completes the method of creating a zone from a variable
r200 VisualizationGraphWidget *VisualizationZoneWidget::createGraph(std::shared_ptr<Variable> variable)
Add the visualization gui classes
r118 {
Alexandre Leroux
Completes the method of creating a zone from a variable
r200 auto graphWidget = new VisualizationGraphWidget{
defaultGraphName(*ui->visualizationZoneFrame->layout()), this};
Add the visualization gui classes
r118 this->addGraph(graphWidget);
Alexandre Leroux
Completes the method of creating a zone from a variable
r200 graphWidget->addVariable(variable);
Add the visualization gui classes
r118 return graphWidget;
}
void VisualizationZoneWidget::removeGraph(VisualizationGraphWidget *graph)
{
}
Alexandre Leroux
Updates visitor interface...
r207 void VisualizationZoneWidget::accept(IVisualizationWidgetVisitor *visitor)
Add the visualization gui classes
r118 {
// TODO: manage the visitor
}
void VisualizationZoneWidget::close()
{
// The main view cannot be directly closed.
return;
}
Add const and override
r119 QString VisualizationZoneWidget::name() const
Add the visualization gui classes
r118 {
Alexandre Leroux
Adds a name for a zone...
r197 return ui->zoneNameLabel->text();
Add the visualization gui classes
r118 }