HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RE_QPainterDrawable.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: RE_QPainterDrawable.h (RE Library, C++)
7  *
8  * COMMENTS:
9  *
10  * This is a drawable that hanles only QPainter painting.
11  * It does not support OpenGL painting and therefore does not work with RE_Render.
12  *
13  * This drawable is more lightweight and faster than RE_WindowDrawable
14  * since it does not work with OpenGL and does not require an OpenGL window
15  * backend.
16  */
17 
18 #ifndef __RE_QPAINTERDRAWABLE_H_INCLUDED__
19 #define __RE_QPAINTERDRAWABLE_H_INCLUDED__
20 
21 #include "RE_API.h"
22 
23 #include "RE_WindowDrawable.h"
24 
25 #include <QtWidgets/QWidget>
26 
27 #undef emit
28 
29 
30 #define RE_QPAINTER_DRAWABLE_OBJ_NAME "RE_QPainterDrawable"
31 
32 
33 class QPaintEvent;
34 class QShowEvent;
35 class RE_Window;
36 
37 /// Window drawable that uses only QPainter for the new UI path.
38 class RE_API RE_QPainterDrawable : public QWidget
39 {
40 public:
41  explicit RE_QPainterDrawable(QWidget *parent = nullptr);
42  ~RE_QPainterDrawable() override;
43 
44  /// Assign the drawable to the given window.
45  /// The given drawable will be used to render the contents of the window.
46  void setREWindow(RE_Window *window);
47 
48  /// Return the window that the drawable is currently assigned to.
49  const RE_Window *getREWindow() const { return myREWindow; }
50 
51  static const char *widgetTag() { return RE_QPAINTER_DRAWABLE_OBJ_NAME; }
52 
53  /// Return the painter used to paint the contents of the drawable.
54  RE_WindowDrawablePainter &painter();
55 
56 protected:
57  void paintEvent(QPaintEvent *event) override;
58  void showEvent(QShowEvent *event) override;
59 
60 private:
61  void init_();
62 
63  RE_Window *myREWindow = nullptr;
64  bool myIsPainting = false;
65  bool myNeedsOwnerUpdate = false;
66  RE_WindowDrawablePainter myPainter;
67 };
68 
69 
70 #endif // __RE_QPAINTERDRAWABLE_H_INCLUDED__
#define RE_API
Definition: RE_API.h:10
==========================================================================
Definition: RE_Window.h:56
struct _cl_event * event
Definition: glcorearb.h:2961
const RE_Window * getREWindow() const
Return the window that the drawable is currently assigned to.
static const char * widgetTag()
#define RE_QPAINTER_DRAWABLE_OBJ_NAME
Window drawable that uses only QPainter for the new UI path.