Expand the render model mouse control area
Click the middle mouse on the area out of the canvas can also rotate or move the render model.master
parent
955ebce009
commit
84607fba01
|
@ -219,11 +219,13 @@ SkeletonDocumentWindow::SkeletonDocumentWindow() :
|
|||
containerWidget->setMinimumSize(400, 400);
|
||||
|
||||
m_modelRenderWidget = new ModelWidget(containerWidget);
|
||||
m_modelRenderWidget->setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||
m_modelRenderWidget->setMinimumSize(SkeletonDocumentWindow::m_modelRenderWidgetInitialSize, SkeletonDocumentWindow::m_modelRenderWidgetInitialSize);
|
||||
m_modelRenderWidget->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
|
||||
m_modelRenderWidget->move(SkeletonDocumentWindow::m_modelRenderWidgetInitialX, SkeletonDocumentWindow::m_modelRenderWidgetInitialY);
|
||||
|
||||
m_graphicsWidget->setModelWidget(m_modelRenderWidget);
|
||||
containerWidget->setModelWidget(m_modelRenderWidget);
|
||||
|
||||
m_document->setSharedContextWidget(m_modelRenderWidget);
|
||||
|
||||
|
|
|
@ -11,7 +11,36 @@ void GraphicsContainerWidget::resizeEvent(QResizeEvent *event)
|
|||
emit containerSizeChanged(event->size());
|
||||
}
|
||||
|
||||
void GraphicsContainerWidget::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
if (m_modelWidget)
|
||||
m_modelWidget->inputMousePressEventFromOtherWidget(event);
|
||||
}
|
||||
|
||||
void GraphicsContainerWidget::mouseMoveEvent(QMouseEvent *event)
|
||||
{
|
||||
if (m_modelWidget)
|
||||
m_modelWidget->inputMouseMoveEventFromOtherWidget(event);
|
||||
}
|
||||
|
||||
void GraphicsContainerWidget::mouseReleaseEvent(QMouseEvent *event)
|
||||
{
|
||||
if (m_modelWidget)
|
||||
m_modelWidget->inputMouseReleaseEventFromOtherWidget(event);
|
||||
}
|
||||
|
||||
void GraphicsContainerWidget::wheelEvent(QWheelEvent *event)
|
||||
{
|
||||
if (m_modelWidget)
|
||||
m_modelWidget->inputWheelEventFromOtherWidget(event);
|
||||
}
|
||||
|
||||
void GraphicsContainerWidget::setGraphicsWidget(QWidget *graphicsWidget)
|
||||
{
|
||||
m_graphicsWidget = graphicsWidget;
|
||||
}
|
||||
|
||||
void GraphicsContainerWidget::setModelWidget(ModelWidget *modelWidget)
|
||||
{
|
||||
m_modelWidget = modelWidget;
|
||||
}
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
#define DUST3D_GRAPHICS_CONTAINER_WIDGET_H
|
||||
#include <QWidget>
|
||||
#include <QResizeEvent>
|
||||
#include <QMouseEvent>
|
||||
#include <QWheelEvent>
|
||||
#include "modelwidget.h"
|
||||
|
||||
class GraphicsContainerWidget : public QWidget
|
||||
{
|
||||
|
@ -10,10 +13,17 @@ signals:
|
|||
void containerSizeChanged(QSize size);
|
||||
public:
|
||||
GraphicsContainerWidget();
|
||||
void resizeEvent(QResizeEvent *event) override;
|
||||
void setGraphicsWidget(QWidget *graphicsWidget);
|
||||
void setModelWidget(ModelWidget *modelWidget);
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent *event) override;
|
||||
void mousePressEvent(QMouseEvent *event) override;
|
||||
void mouseMoveEvent(QMouseEvent *event) override;
|
||||
void mouseReleaseEvent(QMouseEvent *event) override;
|
||||
void wheelEvent(QWheelEvent *event) override;
|
||||
private:
|
||||
QWidget *m_graphicsWidget = nullptr;
|
||||
ModelWidget *m_modelWidget = nullptr;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -20,8 +20,6 @@ ModelWidget::ModelWidget(QWidget *parent) :
|
|||
m_moveEnabled(true),
|
||||
m_zoomEnabled(true)
|
||||
{
|
||||
setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||
|
||||
// --transparent causes the clear color to be transparent. Therefore, on systems that
|
||||
// support it, the widget will become transparent apart from the logo.
|
||||
if (m_transparent) {
|
||||
|
@ -295,3 +293,24 @@ void ModelWidget::enableZoom(bool enabled)
|
|||
{
|
||||
m_zoomEnabled = enabled;
|
||||
}
|
||||
|
||||
void ModelWidget::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
inputMousePressEventFromOtherWidget(event);
|
||||
}
|
||||
|
||||
void ModelWidget::mouseMoveEvent(QMouseEvent *event)
|
||||
{
|
||||
inputMouseMoveEventFromOtherWidget(event);
|
||||
}
|
||||
|
||||
void ModelWidget::wheelEvent(QWheelEvent *event)
|
||||
{
|
||||
inputWheelEventFromOtherWidget(event);
|
||||
}
|
||||
|
||||
void ModelWidget::mouseReleaseEvent(QMouseEvent *event)
|
||||
{
|
||||
inputMouseReleaseEventFromOtherWidget(event);
|
||||
}
|
||||
|
||||
|
|
|
@ -51,6 +51,10 @@ protected:
|
|||
void initializeGL() override;
|
||||
void paintGL() override;
|
||||
void resizeGL(int width, int height) override;
|
||||
void mousePressEvent(QMouseEvent *event) override;
|
||||
void mouseMoveEvent(QMouseEvent *event) override;
|
||||
void wheelEvent(QWheelEvent *event) override;
|
||||
void mouseReleaseEvent(QMouseEvent *event) override;
|
||||
public:
|
||||
int xRot();
|
||||
int yRot();
|
||||
|
|
|
@ -8,6 +8,7 @@ MotionWidget::MotionWidget(const Document *document, QUuid motionId) :
|
|||
setObjectName("MotionFrame");
|
||||
|
||||
m_previewWidget = new ModelWidget(this);
|
||||
m_previewWidget->setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||
m_previewWidget->setFixedSize(Theme::motionPreviewImageSize, Theme::motionPreviewImageSize);
|
||||
m_previewWidget->enableMove(false);
|
||||
m_previewWidget->enableZoom(false);
|
||||
|
|
|
@ -56,6 +56,7 @@ PartWidget::PartWidget(const Document *document, QUuid partId) :
|
|||
initButton(m_wrapButton);
|
||||
|
||||
m_previewWidget = new ModelWidget;
|
||||
m_previewWidget->setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||
m_previewWidget->enableMove(false);
|
||||
m_previewWidget->enableZoom(false);
|
||||
m_previewWidget->setFixedSize(Theme::partPreviewImageSize, Theme::partPreviewImageSize);
|
||||
|
|
|
@ -8,6 +8,7 @@ PoseWidget::PoseWidget(const Document *document, QUuid poseId) :
|
|||
setObjectName("PoseFrame");
|
||||
|
||||
m_previewWidget = new ModelWidget(this);
|
||||
m_previewWidget->setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||
m_previewWidget->setFixedSize(Theme::posePreviewImageSize, Theme::posePreviewImageSize);
|
||||
m_previewWidget->enableMove(false);
|
||||
m_previewWidget->enableZoom(false);
|
||||
|
|
Loading…
Reference in New Issue