1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
|
// ************************************************************************** //
//
// BornAgain: simulate and fit scattering at grazing incidence
//
//! @file GUI/coregui/Views/SampleDesigner/MultiLayerView.h
//! @brief Defines class MultiLayerView
//!
//! @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 BORNAGAIN_GUI_COREGUI_VIEWS_SAMPLEDESIGNER_MULTILAYERVIEW_H
#define BORNAGAIN_GUI_COREGUI_VIEWS_SAMPLEDESIGNER_MULTILAYERVIEW_H
#include "GUI/coregui/Views/SampleDesigner/ILayerView.h"
class DesignerMimeData;
class QGraphicsSceneDragDropEvent;
//! Class representing view of MultiLayer.
//! Handles drop of other MultiLayer and Layer views on top of it
class MultiLayerView : public ILayerView
{
Q_OBJECT
public:
MultiLayerView(QGraphicsItem* parent = 0);
int type() const override { return ViewTypes::MULTILAYER; }
QRectF boundingRect() const override;
void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget) override;
void addView(IView* childView, int row = 0) override;
virtual void addNewLayer(ILayerView* layer, int row);
virtual void removeLayer(ILayerView* layer);
int getDropArea(QPointF pos);
QRectF getDropAreaRectangle(int row);
QLineF getInterfaceLine(int row);
public slots:
void updateGeometry();
void updateHeight();
void updateWidth();
void onLayerAboutToBeDeleted();
protected:
void dropEvent(QGraphicsSceneDragDropEvent* event) override;
void dragMoveEvent(QGraphicsSceneDragDropEvent* event) override;
const DesignerMimeData* checkDragEvent(QGraphicsSceneDragDropEvent* event);
QVariant itemChange(GraphicsItemChange change, const QVariant& value) override;
private:
QList<ILayerView*> m_layers;
QList<QRectF> m_drop_areas;
QList<QLineF> m_interfaces;
};
#endif // BORNAGAIN_GUI_COREGUI_VIEWS_SAMPLEDESIGNER_MULTILAYERVIEW_H
|