BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
importdataeditortoolbal.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file gui2/importdataview/importdataeditortoolbal.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 
18 #include <QAction>
19 
20 namespace gui2 {
21 
23  QWidget* parent)
24  : QToolBar(parent), m_editorActions(editorActions)
25 {
27 
28  auto action = new QAction("Import", this);
29  action->setToolTip("Opens the data import dialog.");
30  action->setIcon(QIcon(":/icons/import.svg"));
31  connect(action, &QAction::triggered, this,
32  [this]() { m_editorActions->onImportDialogRequest(); });
33  addAction(action);
34 
35  addSeparator();
36 
37  auto add_canvas_action = new QAction("Add canvas", this);
38  add_canvas_action->setToolTip(
39  "Creates an empty canvas and appends it to the list.\n"
40  "Canvas can hold multiple graphs, graphs can be moved between canvas.");
41  add_canvas_action->setIcon(QIcon(":/icons/plus-box-outline.svg"));
42  connect(add_canvas_action, &QAction::triggered, [this]() { m_editorActions->onAddCanvas(); });
43  addAction(add_canvas_action);
44 
45  auto merge_canvases_action = new QAction("Merge", this);
46  merge_canvases_action->setToolTip("Merge several selected canvases into one.\n"
47  "All graphs will appear on a single canvas.");
48  merge_canvases_action->setIcon(QIcon(":/icons/set-merge.svg"));
49  connect(merge_canvases_action, &QAction::triggered,
50  [this]() { m_editorActions->onMergeCanvases(); });
51  addAction(merge_canvases_action);
52 
53  auto delete_action = new QAction("Remove", this);
54  delete_action->setToolTip("Remove the currently selected item,\n"
55  "single graph or canvas with whole content.");
56  delete_action->setIcon(QIcon(":/icons/beaker-remove-outline.svg"));
57  connect(delete_action, &QAction::triggered, [this]() { m_editorActions->onDeleteItem(); });
58  addAction(delete_action);
59 
60  addSeparator();
61 
62  auto undo_action = new QAction("Undo", this);
63  undo_action->setToolTip("Undo the action last performed.");
64  undo_action->setIcon(QIcon(":/icons/undo.svg"));
65  undo_action->setEnabled(editorActions->isUndoEnabled());
66  connect(undo_action, &QAction::triggered, [this]() { m_editorActions->onUndo(); });
67  addAction(undo_action);
68 
69  auto redo_action = new QAction("Redo", this);
70  redo_action->setToolTip("Redo the action just performed.");
71  redo_action->setIcon(QIcon(":/icons/redo.svg"));
72  redo_action->setEnabled(editorActions->isUndoEnabled());
73  connect(redo_action, &QAction::triggered, [this]() { m_editorActions->onRedo(); });
74  addAction(redo_action);
75 
76  auto empty = new QWidget(this);
77  empty->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
78  addWidget(empty);
79 
80  auto reset_graph_action = new QAction("Replot", this);
81  reset_graph_action->setToolTip("Set plot axes to default range");
82  reset_graph_action->setIcon(QIcon(":/icons/aspect-ratio.svg"));
83  connect(reset_graph_action, &QAction::triggered, this,
85  addAction(reset_graph_action);
86 }
87 
88 } // namespace gui2
Actions for ImportDataEditor.
void onAddCanvas()
Create new canvas and append it to the end of canvas container.
void onDeleteItem()
Delete currently selected items.
void onMergeCanvases()
Merge selected canvases. All graphs will appear below canvas selected first.
ImportDataEditorToolBar(ImportDataEditorActions *editorActions, QWidget *parent=nullptr)
ImportDataEditorActions * m_editorActions
Defines class CLASS?
Defines class CLASS?
Defines class CLASS?
DAREFLCORE_EXPORT void SetToolBarStyleTextBesides(QToolBar *toolbar)
Set common style for a toolbar.
Definition: styleutils.cpp:39
Based on Qt example "codeeditor" Copyright (C) 2016 The Qt Company Ltd.
Definition: app_constants.h:20