BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
importtablewidget.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file gui2/dataloader/importtablewidget.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 Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************************************
14 
19 #include <QStandardItemModel>
20 #include <QTableView>
21 #include <QVBoxLayout>
22 
23 namespace gui2 {
24 
26  : QWidget(parent)
27  , m_tableModel(new ImportTableModel(this))
28  , m_tableView(new QTableView)
29  , m_delegate(new ModelView::ViewModelDelegate)
30 {
31  auto layout = new QVBoxLayout(this);
32  layout->setContentsMargins(0, 0, 0, 0);
33  layout->addWidget(m_tableView);
34 
35  m_tableView->setItemDelegate(m_delegate.get());
36  m_tableView->setModel(m_tableModel);
37 }
38 
40 
41 void ImportTableWidget::setRawData(const std::vector<std::vector<std::string>>& table_data)
42 {
43  m_tableModel->setRawData(table_data);
44 }
45 
46 std::vector<ColumnInfo> ImportTableWidget::columnInfo() const
47 {
48  return m_tableModel->columnInfo();
49 }
50 
51 } // namespace gui2
Model delegate to provide editing/painting for custom variants.
Table model to hold imported ASCII data after parsing it to multi-column presentation.
void setRawData(const raw_data_t &raw_data)
Sets content of the model.
std::vector< ColumnInfo > columnInfo() const
void setRawData(const std::vector< std::vector< std::string >> &table_data)
std::unique_ptr< ModelView::ViewModelDelegate > m_delegate
ImportTableModel * m_tableModel
std::vector< ColumnInfo > columnInfo() const
ImportTableWidget(QWidget *parent=nullptr)
Defines class CLASS?
Defines class CLASS?
Defines class CLASS?
materialitems.h Collection of materials to populate MaterialModel.
Based on Qt example "codeeditor" Copyright (C) 2016 The Qt Company Ltd.
Definition: app_constants.h:20
Defines class CLASS?