BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
ModelView::CollapsibleListWidget Class Reference

Vertical widget with column of panels displayed one under another. More...

Inheritance diagram for ModelView::CollapsibleListWidget:
[legend]
Collaboration diagram for ModelView::CollapsibleListWidget:
[legend]

Public Member Functions

 CollapsibleListWidget (QWidget *parent=nullptr)
 
void addWidget (QWidget *widget, const QString &title, bool collapsed=false)
 

Private Attributes

QSplitter * m_splitter {nullptr}
 

Detailed Description

Vertical widget with column of panels displayed one under another.

Each panel contains user widget and can be collapsed/expanded. When expanded, the place occupied by the panel can be changed by draging a splitter.

Definition at line 30 of file collapsiblelistwidget.h.

Constructor & Destructor Documentation

◆ CollapsibleListWidget()

CollapsibleListWidget::CollapsibleListWidget ( QWidget *  parent = nullptr)

Definition at line 22 of file collapsiblelistwidget.cpp.

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 }

References m_splitter.

Member Function Documentation

◆ addWidget()

void CollapsibleListWidget::addWidget ( QWidget *  widget,
const QString &  title,
bool  collapsed = false 
)

Definition at line 32 of file collapsiblelistwidget.cpp.

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.

References m_splitter.

Referenced by gui2::DataSelectorWidget::DataSelectorWidget(), and gui2::SimulationView::initEditorList().

Member Data Documentation

◆ m_splitter

QSplitter* ModelView::CollapsibleListWidget::m_splitter {nullptr}
private

Definition at line 39 of file collapsiblelistwidget.h.

Referenced by CollapsibleListWidget(), and addWidget().


The documentation for this class was generated from the following files: