BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
customeventfilters.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // qt-mvvm: Model-view-view-model framework for large GUI applications
4 //
5 //! @file mvvm/viewmodel/mvvm/editors/customeventfilters.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 Gennady Pospelov et al, Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************************************
14 
15 #ifndef BORNAGAIN_MVVM_VIEWMODEL_MVVM_EDITORS_CUSTOMEVENTFILTERS_H
16 #define BORNAGAIN_MVVM_VIEWMODEL_MVVM_EDITORS_CUSTOMEVENTFILTERS_H
17 
18 #include "mvvm/viewmodel_export.h"
19 #include <QObject>
20 
21 namespace ModelView {
22 
23 //! Event filter to prevent loss of the focus.
24 //! Can be used in the context of QTreeView and similar widgets to call external editor. Such an
25 //! editor is created by clicking on a cell of a tree and it appears as modal window on top of a
26 //! tree.
27 
28 class MVVM_VIEWMODEL_EXPORT LostFocusFilter : public QObject {
29  Q_OBJECT
30 
31 public:
32  LostFocusFilter(QObject* parent = nullptr);
33 
34 protected:
35  bool eventFilter(QObject* obj, QEvent* event) override;
36 };
37 
38 //! Event filter to install on combo boxes and spin boxes to ignore wheel events during scrolling.
39 //! Helpful than the spin box is a child of some larger scroll area.
40 
41 class MVVM_VIEWMODEL_EXPORT WheelEventFilter : public QObject {
42  Q_OBJECT
43 
44 public:
45  WheelEventFilter(QObject* parent = nullptr);
46 
47 protected:
48  bool eventFilter(QObject* obj, QEvent* event);
49 };
50 
51 } // namespace ModelView
52 
53 #endif // BORNAGAIN_MVVM_VIEWMODEL_MVVM_EDITORS_CUSTOMEVENTFILTERS_H
Event filter to prevent loss of the focus.
Event filter to install on combo boxes and spin boxes to ignore wheel events during scrolling.
materialitems.h Collection of materials to populate MaterialModel.