FougTools  0.7.0dev-046fb6a
Handy tools for C++, Qt and OpenCascade
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
qt_view.h
Go to the documentation of this file.
1 /****************************************************************************
2 ** FougTools
3 ** Copyright Fougue (30 Mar. 2015)
4 ** contact@fougue.pro
5 **
6 ** This software is a computer program whose purpose is to provide utility
7 ** tools for the C++ language and the Qt toolkit.
8 **
9 ** This software is governed by the CeCILL-C license under French law and
10 ** abiding by the rules of distribution of free software. You can use,
11 ** modify and/ or redistribute the software under the terms of the CeCILL-C
12 ** license as circulated by CEA, CNRS and INRIA at the following URL
13 ** "http://www.cecill.info".
14 ****************************************************************************/
15 
16 #pragma once
17 
18 #include "occtools.h"
19 
20 #ifndef OCCTOOLS_QTVIEW_NO_PAINTCALLBACK
21 # include <functional>
22 #endif
23 
24 #include <QWidget>
25 
26 #include <Aspect_GraphicCallbackProc.hxx>
27 #include <Handle_AIS_InteractiveContext.hxx>
28 #include <Handle_V3d_View.hxx>
29 
30 namespace occ {
31 
32 // Obsolete use QWidgetView3d
33 class OCCTOOLS_EXPORT QtView : public QWidget
34 {
35  Q_OBJECT
36 
37 public:
38  QtView(const Handle_AIS_InteractiveContext& context3d,
39  QWidget* parent = NULL);
40  ~QtView();
41 
42  Handle_AIS_InteractiveContext context() const;
43  Handle_V3d_View internalView() const;
44 
45 #ifndef OCCTOOLS_QTVIEW_NO_PAINTCALLBACK
46  typedef std::function<void()> PaintCallback;
47  int addPaintCallback(const PaintCallback& callback);
48  void removePaintCallback(int callbackId);
49  Aspect_GraphicCallbackStruct* paintCallbackData() const;
50 #endif
51 
52  QPaintEngine* paintEngine() const override;
53 
54 public slots:
55  void redraw();
56  void fitAll();
57 
58 protected:
59  void paintEvent(QPaintEvent* event) override;
60  void resizeEvent(QResizeEvent* event) override;
61 
62 private:
63  friend int occ_QtView_paintCallBack(
64  Aspect_Drawable, void*, Aspect_GraphicCallbackStruct*);
65  class Private;
66  Private* const d;
67 };
68 
69 } // namespace occ
Qt wrapper around the V3d_View class.
Definition: qt_view.h:33
#define OCCTOOLS_EXPORT
Definition: occtools.h:27
int occ_QtView_paintCallBack(Aspect_Drawable, void *pointer, Aspect_GraphicCallbackStruct *data)
Callback executed each time a paint is requested (on paintEvent())
Definition: qt_view.cpp:80
Definition: ais_text.cpp:31
std::function< void()> PaintCallback
Definition: qt_view.h:46