DI-Guy SDK Documentation  13.7.1
diguyQGraphicsProxyWidget.h
Go to the documentation of this file.
1 /****************************************************************************
2  * Copyright (c) 2022 MAK Technologies, Inc.
3  * All rights reserved.
4  ****************************************************************************/
5 
6 #pragma once
7 
8 #include <QGraphicsView>
9 #include <QObject>
10 #include <QGraphicsProxyWidget>
11 #include <QList>
12 #include <QString>
13 
14 class QGraphicsRectItem;
15 class QGraphicsSimpleTextItem;
16 
18 class bdiQGraphicsView;
19 
20 #include <diguy_constants.h>
21 
22 
23 /****************************************************************************/
24 /*
25  A graphics proxy widget embeds a widget in a scene. An instance should only
26  be made by a factory function, which has a pointer to a graphics view instance.
27 */
28 class diguyQGraphicsProxyWidget : public QGraphicsProxyWidget
29 { Q_OBJECT;
30 public:
31 
32  friend class bdiQGraphicsView;
33 
34  diguyQGraphicsProxyWidget(const char* name,
35  bdiQGraphicsView* view,
36  QGraphicsItem* parent = 0,
37  Qt::WindowFlags wFlags = 0,
38  int base_x = 10,
39  int base_y = 10,
40  int base_z = 50,
41  int base_w = 0,
42  int base_h = 0);
44 
45  void resizeEvent(QGraphicsSceneResizeEvent* event);
46 
47  const QString& get_name() { return m_name; }
48 
49  void set_base_position( int base_x, int base_y );
50  void set_base_size( int base_w, int base_h );
51  void set_base_depth( int base_z );
52  void set_handle_own_justification( bool state ) { m_handle_own_justification = state; }
53 
54  int get_x() { return m_base_x; }
55  int get_y() { return m_base_y; }
56  int get_w() { return m_base_w; }
57  int get_h() { return m_base_h; }
58 
61  void update_position();
62 
63 signals:
64 
66 
67 protected:
68 
69  QString m_name;
70 
71  QGraphicsRectItem* m_item_title_bar;
72  QGraphicsSimpleTextItem* m_item_title_bar_text;
73 
75  int m_base_x;
76  int m_base_y;
77  int m_base_z;
78  int m_base_w;
79  int m_base_h;
80 
83 
84 };
void set_base_position(int base_x, int base_y)
friend class bdiQGraphicsView
Definition: diguyQGraphicsProxyWidget.h:28
void set_base_depth(int base_z)
Definition: diguyQGraphicsProxyWidget.h:27
QGraphicsRectItem * m_item_title_bar
Definition: diguyQGraphicsProxyWidget.h:70
bdiQGraphicsView * m_view
Definition: diguyQGraphicsProxyWidget.h:73
int m_base_y
Definition: diguyQGraphicsProxyWidget.h:75
virtual ~diguyQGraphicsProxyWidget()
void set_base_size(int base_w, int base_h)
int m_base_x
Definition: diguyQGraphicsProxyWidget.h:74
int get_w()
Definition: diguyQGraphicsProxyWidget.h:55
int get_h()
Definition: diguyQGraphicsProxyWidget.h:56
bool m_updating_position
Definition: diguyQGraphicsProxyWidget.h:80
QString m_name
Definition: diguyQGraphicsProxyWidget.h:68
int m_base_h
Definition: diguyQGraphicsProxyWidget.h:78
void resizeEvent(QGraphicsSceneResizeEvent *event)
QGraphicsSimpleTextItem * m_item_title_bar_text
Definition: diguyQGraphicsProxyWidget.h:71
int get_y()
Definition: diguyQGraphicsProxyWidget.h:54
diguyQGraphicsProxyWidget(const char *name, bdiQGraphicsView *view, QGraphicsItem *parent=0, Qt::WindowFlags wFlags=0, int base_x=10, int base_y=10, int base_z=50, int base_w=0, int base_h=0)
const QString & get_name()
Definition: diguyQGraphicsProxyWidget.h:46
void set_handle_own_justification(bool state)
Definition: diguyQGraphicsProxyWidget.h:51
bdiQGraphicsView * get_graphics_view()
bool get_updating_position()
Definition: diguyQGraphicsProxyWidget.h:59
int m_base_z
Definition: diguyQGraphicsProxyWidget.h:76
int m_base_w
Definition: diguyQGraphicsProxyWidget.h:77
bool m_handle_own_justification
Definition: diguyQGraphicsProxyWidget.h:81
int get_x()
Definition: diguyQGraphicsProxyWidget.h:53