void VoxCad::SetupGLWindow(void) { QGLFormat format; // double buffering and depth buffering is turned on in the default format, so no need to reset those GLWindow = new CQOpenGL(format); ui.horizontalLayout->addWidget(GLWindow); //opengl info connect(GLWindow, SIGNAL(FindDims(Vec3D<>*, Vec3D<>*)), &MainObj, SLOT(GetDim(Vec3D<>*, Vec3D<>*))); connect(GLWindow, SIGNAL(DrawGL(bool)), this, SLOT(DrawCurScene(bool))); connect(GLWindow, SIGNAL(DrawGLOverlay()), this, SLOT(DrawCurSceneOverlay())); connect(GLWindow, SIGNAL(MousePressIndex(int)), this, SLOT(SetGLSelected(int))); connect(GLWindow, SIGNAL(FastModeChanged(bool)), this, SLOT(FastModeChanged(bool))); //mouse handling connect(GLWindow, SIGNAL(WantGLIndex(bool*)), this, SLOT(WantGLIndex(bool*))); connect(GLWindow, SIGNAL(WantCoord3D(bool*)), this, SLOT(WantCoord3D(bool*))); connect(GLWindow, SIGNAL(MouseMoveHover(float, float, float)), this, SLOT(HoverMove(float, float, float))); connect(GLWindow, SIGNAL(LMouseMovePressed(float, float, float)), this, SLOT(LMouseDownMove(float, float, float))); connect(GLWindow, SIGNAL(LMouseDown(float, float, float, bool)), this, SLOT(LMouseDown(float, float, float, bool))); connect(GLWindow, SIGNAL(LMouseUp(float, float, float)), this, SLOT(LMouseUp(float, float, float))); connect(GLWindow, SIGNAL(PressedEscape()), this, SLOT(PressedEscape())); connect(GLWindow, SIGNAL(CtrlWheelRoll(bool)), this, SLOT(CtrlMouseRoll(bool))); MainSim.pGLWin = GLWindow; }
Dlg_StructureEditor::Dlg_StructureEditor(CQDM_Edit* pEditIn, QWidget *parent) : QWidget(parent) { pEdit = pEditIn; ui.setupUi(this); pGLWin = new CQOpenGL(); ui.horizontalLayout->addWidget(pGLWin); resize(500, 300); SetupRef3DWindow(); //// // connect(GLWindow, SIGNAL(FindDims(Vec3D*)), &MainObj, SLOT(GetDim(Vec3D*))); // connect(GLWindow, SIGNAL(DrawGL()), this, SLOT(DrawCurScene())); // connect(GLWindow, SIGNAL(MousePressIndex(int)), this, SLOT(SetGLSelected(int))); // // //mouse handling // connect(GLWindow, SIGNAL(WantGLIndex(bool*)), this, SLOT(WantGLIndex(bool*))); // connect(GLWindow, SIGNAL(WantCoord3D(bool*)), this, SLOT(WantCoord3D(bool*))); // // connect(GLWindow, SIGNAL(MouseMoveHover(float, float, float)), this, SLOT(HoverMove(float, float, float))); // connect(GLWindow, SIGNAL(LMouseMovePressed(float, float, float)), this, SLOT(LMouseDownMove(float, float, float))); // connect(GLWindow, SIGNAL(LMouseDown(float, float, float)), this, SLOT(LMouseDown(float, float, float))); // connect(GLWindow, SIGNAL(LMouseUp(float, float, float)), this, SLOT(LMouseUp(float, float, float))); // connect(GLWindow, SIGNAL(PressedEscape()), this, SLOT(PressedEscape())); // connect(GLWindow, SIGNAL(CtrlWheelRoll(bool)), this, SLOT(CtrlMouseRoll(bool))); //// connect(pGLWin, SIGNAL(FindDims(Vec3D*)), pEdit, SLOT(GetDim(Vec3D*))); connect(pGLWin, SIGNAL(DrawGL()), pEdit, SLOT(DrawSceneEdit())); connect(pGLWin, SIGNAL(WantGLIndex(bool*)), this, SLOT(WantGLIndex(bool*))); connect(pGLWin, SIGNAL(WantCoord3D(bool*)), this, SLOT(WantCoord3D(bool*))); // connect(pGLWin, SIGNAL(IsExtScene2D(bool*)), this, SLOT(IsEditMode(bool*))); connect(pGLWin, SIGNAL(MouseMoveHover(float, float, float)), this, SLOT(HoverMove(float, float, float))); connect(pGLWin, SIGNAL(LMouseMovePressed(float, float, float)), this, SLOT(LMouseDownMove(float, float, float))); connect(pGLWin, SIGNAL(LMouseDown(float, float, float)), this, SLOT(LMouseDown(float, float, float))); connect(pGLWin, SIGNAL(LMouseUp(float, float, float)), this, SLOT(LMouseUp(float, float, float))); connect(pGLWin, SIGNAL(PressedEscape()), this, SLOT(PressedEscape())); connect(pGLWin, SIGNAL(CtrlWheelRoll(bool)), this, SLOT(CtrlMouseRoll(bool))); connect(pEdit, SIGNAL(UpdateGLWindows()), this, SLOT(UpdateGLWins())); connect(pEdit, SIGNAL(GetCurMaterial(int*)), this, SLOT(CurMaterial(int*))); //connect this! void GetCurMaterial(int* MatIndex); //UI handlers: connect(ui.pencilButton, SIGNAL(clicked()), this, SLOT(ClickedPencil())); connect(ui.squareButton, SIGNAL(clicked()), this, SLOT(ClickedBox())); connect(ui.ellipseButton, SIGNAL(clicked()), this, SLOT(ClickedEllipse())); connect(ui.layerbackButton, SIGNAL(clicked()), this, SLOT(ClickedLayerBack())); connect(ui.layerforwardButton, SIGNAL(clicked()), this, SLOT(ClickedLayerForward())); connect(ui.refviewButton, SIGNAL(clicked(bool)), this, SLOT(ClickedRefView(bool))); IniUpdateUI(); }
void VoxCad::SetupGLWindow(void) { GLWindow = new CQOpenGL(); ui.horizontalLayout->addWidget(GLWindow); //opengl info connect(GLWindow, SIGNAL(FindDims(Vec3D*)), &MainObj, SLOT(GetDim(Vec3D*))); connect(GLWindow, SIGNAL(DrawGL()), this, SLOT(DrawCurScene())); connect(GLWindow, SIGNAL(MousePressIndex(int)), this, SLOT(SetGLSelected(int))); //mouse handling connect(GLWindow, SIGNAL(WantGLIndex(bool*)), this, SLOT(WantGLIndex(bool*))); connect(GLWindow, SIGNAL(WantCoord3D(bool*)), this, SLOT(WantCoord3D(bool*))); connect(GLWindow, SIGNAL(MouseMoveHover(float, float, float)), this, SLOT(HoverMove(float, float, float))); connect(GLWindow, SIGNAL(LMouseMovePressed(float, float, float)), this, SLOT(LMouseDownMove(float, float, float))); connect(GLWindow, SIGNAL(LMouseDown(float, float, float)), this, SLOT(LMouseDown(float, float, float))); connect(GLWindow, SIGNAL(LMouseUp(float, float, float)), this, SLOT(LMouseUp(float, float, float))); connect(GLWindow, SIGNAL(PressedEscape()), this, SLOT(PressedEscape())); connect(GLWindow, SIGNAL(CtrlWheelRoll(bool)), this, SLOT(CtrlMouseRoll(bool))); }
void CQOpenGL::keyPressEvent(QKeyEvent *event) { // bool ExtScene2DProcess; // emit IsExtScene2D(&ExtScene2DProcess); //do we want to emit the mouse handle signals? switch (event->key()){ case Qt::Key_Escape: emit PressedEscape(); // if (ExtScene2DProcess) emit PressedEscape(); // else GLCenterView(); // updateGL(); break; // default: CQOpenGL::keyPressEvent(event); //pass along if we don't use it... } }