BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
materialtreeview.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file gui2/materialeditor/materialtreeview.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_MATERIALEDITOR_MATERIALTREEVIEW_H
16 #define BORNAGAIN_GUI2_MATERIALEDITOR_MATERIALTREEVIEW_H
17 
18 #include "darefl_export.h"
19 #include <QTreeView>
20 
21 namespace gui2 {
22 
23 //! Extension of QTreeView for material editing.
24 //! Provide better user experinece while navigating between cells.
25 //! Part of MaterialTableWidget.
26 
27 class DAREFLCORE_EXPORT MaterialTreeView : public QTreeView {
28 public:
29  using QTreeView::QTreeView;
30 
31  explicit MaterialTreeView(QWidget* parent = nullptr);
32  ~MaterialTreeView() override;
33 
34  void setModel(QAbstractItemModel* model) override;
35 
36 protected:
37  void keyPressEvent(QKeyEvent* event) override;
38  QModelIndex moveCursor(QAbstractItemView::CursorAction cursorAction,
39  Qt::KeyboardModifiers modifiers) override;
40 
41 private:
42  bool isTextField(const QModelIndex& index) const;
43  bool isKeyboardEditable(const QModelIndex& index) const;
44 };
45 
46 } // namespace gui2
47 
48 #endif // BORNAGAIN_GUI2_MATERIALEDITOR_MATERIALTREEVIEW_H
Extension of QTreeView for material editing.
~MaterialTreeView() override
Based on Qt example "codeeditor" Copyright (C) 2016 The Qt Company Ltd.
Definition: app_constants.h:20