BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
loaderselectorpanel.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file gui2/dataloader/loaderselectorpanel.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 <QSplitter>
20 #include <QVBoxLayout>
21 
22 namespace gui2 {
23 
25  : QWidget(parent)
26  , m_fileSelectorWidget(new ImportFileWidget)
27  , m_propertyWidget(new ParserPropertyWidget)
28  , m_splitter(new QSplitter)
29 {
30  auto layout = new QVBoxLayout(this);
31  layout->setContentsMargins(0, 0, 0, 0);
32 
33  m_splitter->setOrientation(Qt::Vertical);
34  m_splitter->setChildrenCollapsible(false);
35 
36  m_splitter->addWidget(m_fileSelectorWidget);
37  m_splitter->addWidget(m_propertyWidget);
38 
39  layout->addWidget(m_splitter);
40 
42 }
43 
45 
46 std::unique_ptr<ParserInterface> LoaderSelectorPanel::createParser() const
47 {
49 }
50 
51 void LoaderSelectorPanel::setTargetCanvas(const QStringList& canvas_names, int current_index)
52 {
53  m_propertyWidget->setTargetCanvas(canvas_names, current_index);
54 }
55 
57 {
58  return m_targetCanvasIndex;
59 }
60 
62 {
64 }
65 
67 {
69 }
70 
72 {
74 }
75 
76 QStringList LoaderSelectorPanel::fileNames() const
77 {
79 }
80 
82 {
83  auto on_file_names_changed = [this]() { fileNamesChanged(m_fileSelectorWidget->fileNames()); };
84  connect(m_fileSelectorWidget, &ImportFileWidget::fileNamesChanged, on_file_names_changed);
85 
86  auto on_selection_changed = [this]() {
88  };
89  connect(m_fileSelectorWidget, &ImportFileWidget::fileSelectionChanged, on_selection_changed);
90 
93 
94  auto on_target_changed = [this](auto index) { m_targetCanvasIndex = index; };
95  connect(m_propertyWidget, &ParserPropertyWidget::targetCanvasChanged, on_target_changed);
96 }
97 
98 } // namespace gui2
Provides the possibility to select file names on disk and add them to list view.
QStringList fileNames() const
Retuns the list of all file names imported by the user.
void onRemoveFileRequest()
Removes currently selected file.
void onAddFilesRequest()
Summons dialog for file selections, update list view with file names.
QStringList selectedFileNames() const
Retuns the list of currently selected file names.
ParserPropertyWidget * m_propertyWidget
LoaderSelectorPanel(QWidget *parent=nullptr)
std::unique_ptr< ParserInterface > createParser() const
QStringList selectedFileNames() const
void fileNamesChanged(const QStringList &file_names)
void setTargetCanvas(const QStringList &canvas_names, int current_index)
void fileSelectionChanged(const QStringList &file_names)
ImportFileWidget * m_fileSelectorWidget
Panel to setup ASCII parser.
int targetCanvasChanged(int canvas_index)
std::unique_ptr< ParserInterface > createParser() const
Creates parser from parser properties.
void setTargetCanvas(const QStringList &canvas_names, int current_index)
Sets list of canvas names as possible import targets.
Defines class CLASS?
Defines class CLASS?
Defines class CLASS?
Based on Qt example "codeeditor" Copyright (C) 2016 The Qt Company Ltd.
Definition: app_constants.h:20
Defines class CLASS?