BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
collapsiblelistwidget.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // qt-mvvm: Model-view-view-model framework for large GUI applications
4 //
5 //! @file mvvm/view/mvvm/widgets/collapsiblelistwidget.cpp
6 //! @brief Implements class CLASS?
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2020
11 //! @authors Gennady Pospelov et al, Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************************************
14 
17 #include <QSplitter>
18 #include <QVBoxLayout>
19 
20 using namespace ModelView;
21 
23  : QWidget(parent), m_splitter(new QSplitter)
24 {
25  m_splitter->setOrientation(Qt::Vertical);
26 
27  auto layout = new QVBoxLayout(this);
28  layout->setContentsMargins(0, 0, 0, 0);
29  layout->addWidget(m_splitter);
30 }
31 
32 void CollapsibleListWidget::addWidget(QWidget* widget, const QString& title, bool collapsed)
33 {
34  // add bar which will be uncollapsible and will control the appearance of our widget
35  auto bar = new CollapsibleBar(m_splitter);
36  m_splitter->addWidget(bar);
37 
38  // add widget itself
39  m_splitter->addWidget(widget);
40 
41  // setup bar for widget
42  bar->setWidget(widget, title);
43  m_splitter->setCollapsible(m_splitter->indexOf(bar), false);
44 
45  if (collapsed)
46  widget->setVisible(false);
47 }
Horizontal collapsible bar, part of CollapsibleListWidget.
CollapsibleListWidget(QWidget *parent=nullptr)
void addWidget(QWidget *widget, const QString &title, bool collapsed=false)
Defines class CLASS?
Defines class CLASS?
materialitems.h Collection of materials to populate MaterialModel.