##// END OF EJS Templates
Exports core module as a shared library...
Exports core module as a shared library Export will be necessary to use anywhere constants that will be defined in core module (used for settings)

File last commit:

r327:87af69bdce8a
r461:b8af3b4730c2
Show More
VisualizationTabWidget.cpp
110 lines | 2.9 KiB | text/x-c | CppLexer
/ gui / src / Visualization / VisualizationTabWidget.cpp
mv visualization -> Visualization...
r95 #include "Visualization/VisualizationTabWidget.h"
Alexandre Leroux
Updates visitor interface...
r207 #include "Visualization/IVisualizationWidgetVisitor.h"
Creation of VisualizationWidget, VizualizationTabWidget, VisualizationZoneWidget, VisualizationGraphWidget
r58 #include "ui_VisualizationTabWidget.h"
Add the visualization gui classes
r118 #include "Visualization/VisualizationZoneWidget.h"
Alexandre Leroux
Adds logs for null visitors
r219 Q_LOGGING_CATEGORY(LOG_VisualizationTabWidget, "VisualizationTabWidget")
Alexandre Leroux
Completes the method of creating a zone from a variable
r201 namespace {
/// Generates a default name for a new zone, according to the number of zones already displayed in
/// the tab
QString defaultZoneName(const QLayout &layout)
{
auto count = 0;
for (auto i = 0; i < layout.count(); ++i) {
if (dynamic_cast<VisualizationZoneWidget *>(layout.itemAt(i)->widget())) {
count++;
}
}
return QObject::tr("Zone %1").arg(count + 1);
}
} // namespace
Alexandre Leroux
Adds a name for a tab...
r198 struct VisualizationTabWidget::VisualizationTabWidgetPrivate {
explicit VisualizationTabWidgetPrivate(const QString &name) : m_Name{name} {}
Add the visualization gui classes
r118
Alexandre Leroux
Adds a name for a tab...
r198 QString m_Name;
};
VisualizationTabWidget::VisualizationTabWidget(const QString &name, QWidget *parent)
: QWidget{parent},
ui{new Ui::VisualizationTabWidget},
impl{spimpl::make_unique_impl<VisualizationTabWidgetPrivate>(name)}
Creation of VisualizationWidget, VizualizationTabWidget, VisualizationZoneWidget, VisualizationGraphWidget
r58 {
ui->setupUi(this);
Alexandre Leroux
Updates tab widget so it can be deleted when closed
r267
// Widget is deleted when closed
setAttribute(Qt::WA_DeleteOnClose);
Creation of VisualizationWidget, VizualizationTabWidget, VisualizationZoneWidget, VisualizationGraphWidget
r58 }
VisualizationTabWidget::~VisualizationTabWidget()
{
delete ui;
}
Add the visualization gui classes
r118
void VisualizationTabWidget::addZone(VisualizationZoneWidget *zoneWidget)
{
Alexandre Leroux
Adds scrollbar to tabs
r307 tabLayout().addWidget(zoneWidget);
Add the visualization gui classes
r118 }
Alexandre Leroux
Completes the method of creating a zone from a variable
r201 VisualizationZoneWidget *VisualizationTabWidget::createZone(std::shared_ptr<Variable> variable)
Add the visualization gui classes
r118 {
Alexandre Leroux
Adds scrollbar to tabs
r307 auto zoneWidget = new VisualizationZoneWidget{defaultZoneName(tabLayout()), this};
Add the visualization gui classes
r118 this->addZone(zoneWidget);
Alexandre Leroux
Completes the method of creating a zone from a variable
r201 // Creates a new graph into the zone
zoneWidget->createGraph(variable);
Add the visualization gui classes
r118 return zoneWidget;
}
Alexandre Leroux
Updates visitor interface...
r207 void VisualizationTabWidget::accept(IVisualizationWidgetVisitor *visitor)
Add the visualization gui classes
r118 {
Alexandre Leroux
Implements accept() method of visualization widgets
r208 if (visitor) {
visitor->visitEnter(this);
// Apply visitor to zone children
Alexandre Leroux
Adds scrollbar to tabs
r307 auto &layout = tabLayout();
for (auto i = 0; i < layout.count(); ++i) {
if (auto item = layout.itemAt(i)) {
Alexandre Leroux
Add comments
r220 // Widgets different from zones are not visited (no action)
Alexandre Leroux
Implements accept() method of visualization widgets
r208 if (auto visualizationZoneWidget
= dynamic_cast<VisualizationZoneWidget *>(item->widget())) {
visualizationZoneWidget->accept(visitor);
}
}
}
visitor->visitLeave(this);
}
Alexandre Leroux
Adds logs for null visitors
r219 else {
qCCritical(LOG_VisualizationTabWidget()) << tr("Can't visit widget : the visitor is null");
}
Add the visualization gui classes
r118 }
Alexandre Leroux
Creates a interface that defines a variable container...
r209 bool VisualizationTabWidget::canDrop(const Variable &variable) const
{
// A tab can always accomodate a variable
Q_UNUSED(variable);
return true;
}
Alexandre Leroux
Unplot menu (5): adds contains() method to an IVariableContainer...
r327 bool VisualizationTabWidget::contains(const Variable &variable) const
{
Q_UNUSED(variable);
return false;
}
Add const and override
r119 QString VisualizationTabWidget::name() const
Add the visualization gui classes
r118 {
Alexandre Leroux
Adds a name for a tab...
r198 return impl->m_Name;
Add the visualization gui classes
r118 }
Alexandre Leroux
Adds scrollbar to tabs
r307
QLayout &VisualizationTabWidget::tabLayout() const noexcept
{
return *ui->scrollAreaWidgetContents->layout();
}