BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
parserpropertywidget.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file gui2/dataloader/parserpropertywidget.h
6 //! @brief Defines 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 
15 #ifndef BORNAGAIN_GUI2_DATALOADER_PARSERPROPERTYWIDGET_H
16 #define BORNAGAIN_GUI2_DATALOADER_PARSERPROPERTYWIDGET_H
17 
18 #include "darefl_export.h"
20 #include <QWidget>
21 #include <memory>
22 
23 class QGridLayout;
24 class QButtonGroup;
25 class QComboBox;
26 class QLineEdit;
27 
28 namespace gui2 {
29 
30 class ParserInterface;
31 
32 //! Panel to setup ASCII parser. Intended for concrete class DefaultParser.
33 //! Contains selection of separator symbols, patterns to ignore lines, and import target settings.
34 
35 class DAREFLCORE_EXPORT ParserPropertyWidget : public QWidget {
36  Q_OBJECT
37 
38 public:
39  enum SeparatorButtonId { AUTOMATIC, SPACE, COMMA, CUSTOM };
40 
41  ParserPropertyWidget(QWidget* parent = nullptr);
43 
44  std::unique_ptr<ParserInterface> createParser() const;
45 
46  void setTargetCanvas(const QStringList& canvas_names, int current_index);
47 
48 signals:
50  int targetCanvasChanged(int canvas_index);
51 
52 private slots:
53  void onParserPropertyChange();
54 
55 private:
56  void readSettings();
57  void writeSettings();
58  QGridLayout* createGridLayout();
59 
60  void addSectionLabel(const QString& text, QGridLayout* layout);
61  void addStandardSeparatorRow(QGridLayout* layout, QButtonGroup* group);
62  void addCustomSeparatorRow(QGridLayout* layout, QButtonGroup* group);
63  void addIgnoreStringPatternRow(QGridLayout* layout);
64  void addIgnoreNumbersPatternRow(QGridLayout* layout);
65  void addImportToBlock(QGridLayout* layout);
66 
68  QButtonGroup* m_separatorButtonGroup{nullptr};
69  QComboBox* m_targetCanvasCombo{nullptr};
70  QLineEdit* m_customSeparatorLineEdit{nullptr};
71 };
72 
73 } // namespace gui2
74 
75 #endif // BORNAGAIN_GUI2_DATALOADER_PARSERPROPERTYWIDGET_H
Panel to setup ASCII parser.
int targetCanvasChanged(int canvas_index)
Defines class CLASS?
Based on Qt example "codeeditor" Copyright (C) 2016 The Qt Company Ltd.
Definition: app_constants.h:20
Parser options to process multi column ASCII files.