void GLScene::mousePressEvent(QMouseEvent *event) { QPointF pos = mapToScene(event->pos()); if (event->button() == Qt::LeftButton) { emit mouseLeftButtonPressed(pos); } else if (event->button() == Qt::RightButton) { emit mouseRightButtonPressed(pos); } }
void MainForm::initConnections() { connect(btnResetView, SIGNAL(clicked()), this, SLOT(sPressedReset())); connect(btnLoadModel, SIGNAL(clicked()), this, SLOT(sPressedLoadModel())); connect(sliWindow, SIGNAL(valueChanged(int)), this, SLOT(sChangedWindowValue(int))); connect(sliLevel, SIGNAL(valueChanged(int)), this, SLOT(sChangedLevelValue(int))); connect(sliSlicerNumSlices, SIGNAL(valueChanged(int)), this, SLOT(sChangedNumSlices(int))); connect(cmbSlicerMode, SIGNAL(currentIndexChanged(QString)), this, SLOT(sChangedSlicerMode(QString))); connect(cmbExaminerMode, SIGNAL(currentIndexChanged(QString)), this, SLOT(sChangedExaminerMode(QString))); connect(btnColorTop, SIGNAL(changedColor()), this, SLOT(sChangedColorTop())); connect(btnColorMiddle, SIGNAL(changedColor()), this, SLOT(sChangedColorMiddle())); connect(btnColorBottom, SIGNAL(changedColor()), this, SLOT(sChangedColorBottom())); connect(sliRampWidth, SIGNAL(valueChanged(int)), this, SLOT(sChangedRampWidth(int))); connect(sliRampCenter, SIGNAL(valueChanged(int)), this, SLOT(sChangedRampCenter(int))); connect(txtRampWidth, SIGNAL(returnPressed()), this, SLOT(sConfirmedRampWidth())); connect(txtRampCenter, SIGNAL(returnPressed()), this, SLOT(sConfirmedRampCenter())); connect(btnMaxTopLeft, SIGNAL(clicked()), this, SLOT(sClickedMaxTopLeft())); connect(btnMaxTopRight, SIGNAL(clicked()), this, SLOT(sClickedMaxTopRight())); connect(btnMaxBottomLeft, SIGNAL(clicked()), this, SLOT(sClickedMaxBottomLeft())); connect(btnMaxBottomRight, SIGNAL(clicked()), this, SLOT(sClickedMaxBottomRight())); connect(btnViewAll, SIGNAL(clicked()), this, SLOT(sClickedViewAll())); connect(txtWindow, SIGNAL(returnPressed()), this, SLOT(sConfirmedWindowValue())); connect(txtLevel, SIGNAL(returnPressed()), this, SLOT(sConfirmedLevelValue())); connect(actOpen, SIGNAL(triggered()), this, SLOT(sPressedLoadModel())); connect(actExit, SIGNAL(triggered()), this, SLOT(sClickedExit())); connect(glWidget, SIGNAL(mouseRightButtonPressed()), this, SLOT(sPressedRightButton())); connect(btnToggleCrossfader, SIGNAL(toggled(bool)), this, SLOT(sTogglePresetMixerForm(bool))); connect(btnToggleDicom, SIGNAL(toggled(bool)), this, SLOT(sToggleDicomForm(bool))); connect(ViewerCore::get()->getPresetMixerForm(), SIGNAL(sigClosed()), this, SLOT(sPresetMixerFormClosed())); connect(ViewerCore::get()->getDicomForm(), SIGNAL(sigClosed()), this, SLOT(sDicomFormClosed())); }
void QXipIvWidget::mousePressEvent(QMouseEvent* event) { //m_mouseMode = RESIZE_NONE; //if ((event->pos().x() > (this->width() - 10)) || (event->pos().y() > (this->height() - 10))) //{ // //if ((event->pos().x() > (this->width() - 10)) || (event->pos().y() > (this->height() - 10))) // { // if ((event->pos().x() > (this->width() - 10)) && (event->pos().y() > (this->height() - 10))) // { // m_mouseMode = RESIZE_CORNER; // setCursor(Qt::SizeFDiagCursor); // } // else if (event->pos().x() > (this->width() - 10)) // { // m_mouseMode = RESIZE_WIDTH; // setCursor(Qt::SizeHorCursor); // } // else if (event->pos().y() > (this->height() - 10)) // { // m_mouseMode = RESIZE_HEIGHT; // setCursor(Qt::SizeVerCursor); // } // } // event->accept(); // return; //} event->accept(); // Pass the QT mouse button event to open inventor SbTime time; time.setToTimeOfDay(); SoMouseButtonEvent e; e.setTime(time); switch (event->button()) { default: case Qt::LeftButton: e.setButton(SoMouseButtonEvent::BUTTON1); break; case Qt::MidButton: e.setButton(SoMouseButtonEvent::BUTTON2); break; case Qt::RightButton: emit mouseRightButtonPressed(); break; } if (event->modifiers() & Qt::ShiftModifier) e.setShiftDown(TRUE); if (event->modifiers() & Qt::ControlModifier) e.setCtrlDown(TRUE); e.setState(SoButtonEvent::DOWN); e.setPosition(SbVec2s(event->pos().x(), m_height - event->pos().y())); if (m_sceneManager->processEvent(&e)) { processDelayQueue(); updateCursor(true); } else { updateCursor(false); } }