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