Skip to content
Snippets Groups Projects
Commit 82fdbde6 authored by Yurov, Dmitry's avatar Yurov, Dmitry
Browse files

Introduced Plot1DCanvas (SpecularPlotCanvas copy)

Redmine: #2106
parent 769cb893
No related branches found
No related tags found
No related merge requests found
// ************************************************************************** //
//
// BornAgain: simulate and fit scattering at grazing incidence
//
//! @file GUI/coregui/Views/SpecularDataWidgets/Plot1DCanvas.cpp
//! @brief Implements class Plot1DCanvas
//!
//! @homepage http://www.bornagainproject.org
//! @license GNU General Public License v3 or higher (see COPYING)
//! @copyright Forschungszentrum Jülich GmbH 2018
//! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
//
// ************************************************************************** //
#include "Plot1DCanvas.h"
#include "FontScalingEvent.h"
#include "PlotStatusLabel.h"
#include "SpecularPlot.h"
#include "SpecularDataItem.h"
#include <QVBoxLayout>
Plot1DCanvas::Plot1DCanvas(QWidget *parent)
: SessionItemWidget(parent)
, m_plot(new SpecularPlot)
, m_canvasEvent(new FontScalingEvent(m_plot, this))
, m_statusLabel(new PlotStatusLabel(m_plot, this))
{
this->installEventFilter(m_canvasEvent);
QVBoxLayout* layout = new QVBoxLayout;
layout->setMargin(0);
layout->setSpacing(0);
layout->addWidget(m_plot);
layout->addWidget(m_statusLabel);
setLayout(layout);
setStatusLabelEnabled(false);
}
void Plot1DCanvas::setItem(SessionItem* specularDataItem)
{
SessionItemWidget::setItem(specularDataItem);
m_plot->setItem(dynamic_cast<SpecularDataItem*>(specularDataItem));
}
SpecularPlot* Plot1DCanvas::specularPlot()
{
return m_plot;
}
QCustomPlot* Plot1DCanvas::customPlot()
{
return m_plot->customPlot();
}
void Plot1DCanvas::setStatusLabelEnabled(bool flag)
{
m_statusLabel->setLabelEnabled(flag);
m_statusLabel->setHidden(!flag);
}
void Plot1DCanvas::onStatusString(const QString& name)
{
m_statusLabel->setText(name);
}
// ************************************************************************** //
//
// BornAgain: simulate and fit scattering at grazing incidence
//
//! @file GUI/coregui/Views/SpecularDataWidgets/Plot1DCanvas.h
//! @brief Defines class Plot1DCanvas
//!
//! @homepage http://www.bornagainproject.org
//! @license GNU General Public License v3 or higher (see COPYING)
//! @copyright Forschungszentrum Jülich GmbH 2018
//! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
//
// ************************************************************************** //
#ifndef PLOT1DCANVAS_H
#define PLOT1DCANVAS_H
#include "SessionItemWidget.h"
class FontScalingEvent;
class PlotStatusLabel;
class QCustomPlot;
class SpecularPlot;
//! The Plot1DCanvas class contains SpecularPlotWithDataView
//! for specular data presentation, and provides
//! status string appearance.
class BA_CORE_API_ Plot1DCanvas : public SessionItemWidget
{
Q_OBJECT
public:
explicit Plot1DCanvas(QWidget* parent = nullptr);
void setItem(SessionItem* specularDataItem) override;
SpecularPlot* specularPlot();
QCustomPlot* customPlot();
void setStatusLabelEnabled(bool flag);
public slots:
void onStatusString(const QString& name);
private:
SpecularPlot* m_plot;
FontScalingEvent* m_canvasEvent;
PlotStatusLabel* m_statusLabel;
};
#endif // PLOT1DCANVAS_H
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment