NDEVR
API Documentation
QTWidgetModel.h
1#pragma once
2#include "DLLInfo.h"
3#include <NDEVR/Model.h>
4#include <NDEVR/MouseController.h>
5#include <QPixmap>
6#include <QWidget>
7#include <QTimer>
8#include <QMouseEvent>
9namespace NDEVR
10{
14 class NDEVR_API QTWidgetImage
15 {
16 public:
22 QTWidgetImage(QWidget* widget, const String& image_id);
29 const String& imageID() const { return m_image_id; }
30 protected:
32 QPixmap* m_pixmap;
34 };
35
39 class NDEVR_API QWidgetModel : public Model
40 {
41 public:
48 QWidgetModel(QWidget* widget, const Model& model, const void* lock);
54 QWidget* widget() const { return m_widget; }
55 protected:
57 void init();
59 void update();
60 protected:
61 const void* m_lock;
62 QTimer* m_timer;
63 QWidget* m_widget;
65 };
66#if NDEVR_VIEWPORT
71 {
72 public:
84 virtual bool processMouseEvent(MouseControllerEvent& event, SelectionInfo& info) override;
93 protected:
95 };
96#endif
97}
A core class where all Design Objects including models, materials, and geometries are stored.
Model()
Default constructor. Creates an uninitialized Model.
Definition Model.h:365
A base class for adding functionality to the user mouse inputs.
Describes a mouse or touch input event with position, button, and modifier information.
Definition Event.h:316
A Qt compatible wrapper for an image for use with QWidgetModel.
const String & imageID() const
Retrieves the image resource identifier.
String m_image_id
The identifier for the image resource.
void updateImage()
Updates the captured image from the current widget state.
QPixmap * m_pixmap
The captured pixmap of the widget.
QTWidgetImage(QWidget *widget, const String &image_id)
Constructs a widget image that captures the given widget's appearance.
QWidget * m_widget_to_paint
The widget being captured.
A 3D Model that mirrors a QWidget object.
void init()
Initializes the model geometry and material for the widget.
const void * m_lock
Lock pointer for thread-safe access.
QWidget * widget() const
Retrieves the underlying QWidget.
QTimer * m_timer
Timer used to trigger periodic image updates.
void update()
Updates the model's texture from the current widget state.
QWidgetModel(QWidget *widget, const Model &model, const void *lock)
Constructs a 3D model that mirrors the given QWidget.
QWidget * m_widget
The QWidget being mirrored.
QTWidgetImage * m_image
The captured image of the widget.
Responsible for turning a user interaction into a selection within a DesignObjectLookup.
Definition Selector.h:52
The core String class for the NDEVR API.
Definition String.h:95
bool processMouseEvent(const MouseEvent &event, DesignObjectLookup *lookup, SelectionInfo &info)
Processes a raw mouse event and converts it to a widget click.
QWidgetModel * m_widget
The widget model receiving forwarded events.
virtual bool processMouseEvent(MouseControllerEvent &event, SelectionInfo &info) override
Processes a mouse controller event and converts it to a widget click.
WidgetMouseController(QWidgetModel *model)
Constructs a mouse controller that forwards 3D clicks to a QWidgetModel.
The primary namespace for the NDEVR SDK.
A wrapper for a mouse event that is used by MouseControllerBase.