Skip to content
Snippets Groups Projects
Commit b4292ac9 authored by Pospelov, Gennady's avatar Pospelov, Gennady
Browse files

New ModelListView for adding decorations into QListView intended for SessionModel.

parent a45eac66
No related branches found
No related tags found
No related merge requests found
......@@ -40,7 +40,6 @@ QIcon materialIcon(const QColor& color)
}
SessionDecorationModel::SessionDecorationModel(QObject* parent, SessionModel* model)
: QIdentityProxyModel(parent)
, m_model(nullptr)
......
// ************************************************************************** //
//
// BornAgain: simulate and fit scattering at grazing incidence
//
//! @file GUI/coregui/Views/CommonWidgets/ModelListView.cpp
//! @brief Implements class ModelListView
//!
//! @homepage http://www.bornagainproject.org
//! @license GNU General Public License v3 or higher (see COPYING)
//! @copyright Forschungszentrum Jülich GmbH 2017
//! @authors Scientific Computing Group at MLZ Garching
//! @authors J. Burle, J. M. Fisher, M. Ganeva, G. Pospelov, W. Van Herck, J. Wuttke
//
// ************************************************************************** //
#include "ModelListView.h"
#include "SessionDecorationModel.h"
#include "SessionModel.h"
#include "GUIHelpers.h"
#include <QVBoxLayout>
#include <QListView>
ModelListView::ModelListView(QWidget* parent, SessionModel* model)
: QWidget(parent)
, m_listView(new QListView)
, m_decorationProxy(new SessionDecorationModel(this, model))
{
if (!model)
throw GUIHelpers::Error("ModelListView::ModelListView() -> Error. Nullptr as model.");
setObjectName(model->getModelTag());
auto layout = new QVBoxLayout;
layout->setMargin(0);
layout->setSpacing(0);
layout->addWidget(m_listView);
m_decorationProxy->setSessionModel(model);
m_listView->setModel(m_decorationProxy);
setLayout(layout);
}
// ************************************************************************** //
//
// BornAgain: simulate and fit scattering at grazing incidence
//
//! @file GUI/coregui/Views/CommonWidgets/ModelListView.h
//! @brief Defines class ModelListView.
//!
//! @homepage http://www.bornagainproject.org
//! @license GNU General Public License v3 or higher (see COPYING)
//! @copyright Forschungszentrum Jülich GmbH 2017
//! @authors Scientific Computing Group at MLZ Garching
//! @authors J. Burle, J. M. Fisher, M. Ganeva, G. Pospelov, W. Van Herck, J. Wuttke
//
// ************************************************************************** //
#ifndef MODELLISTVIEW_H
#define MODELLISTVIEW_H
#include "WinDllMacros.h"
#include <QWidget>
class QListView;
class SessionModel;
class SessionDecorationModel;
//! Equivalent of QListView for SessionModel allowing to add visual decorations to the list.
class BA_CORE_API_ ModelListView : public QWidget
{
Q_OBJECT
public:
ModelListView(QWidget* parent, SessionModel* model);
private:
QListView* m_listView;
SessionDecorationModel* m_decorationProxy;
};
#endif // MODELLISTVIEW_H
......@@ -2,8 +2,8 @@
//
// BornAgain: simulate and fit scattering at grazing incidence
//
//! @file GUI/coregui/Views/CommonWidgets/ModelTreeView.h
//! @brief Defines class ModelTreeView
//! @file GUI/coregui/Views/CommonWidgets/ModelTreeView.cpp
//! @brief Implements class ModelTreeView
//!
//! @homepage http://www.bornagainproject.org
//! @license GNU General Public License v3 or higher (see COPYING)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment