void GLWidget::keyReleaseEvent (QKeyEvent * e) { e->ignore (); if (e->key () == Qt::Key_Control) track.ButtonUp (QT2VCG (Qt::NoButton, Qt::ControlModifier)); if (e->key () == Qt::Key_Shift) track.ButtonUp (QT2VCG (Qt::NoButton, Qt::ShiftModifier)); if (e->key () == Qt::Key_Alt) track.ButtonUp (QT2VCG (Qt::NoButton, Qt::AltModifier)); updateGL (); }
void GLWidget::keyPressEvent (QKeyEvent * e) { e->ignore (); if (e->key () == Qt::Key_Control) track.ButtonDown (QT2VCG (Qt::NoButton, Qt::ControlModifier)); if (e->key () == Qt::Key_Shift) track.ButtonDown (QT2VCG (Qt::NoButton, Qt::ShiftModifier)); if (e->key () == Qt::Key_Alt) track.ButtonDown (QT2VCG (Qt::NoButton, Qt::AltModifier)); TwKeyPressQt(e); updateGL (); }
////////////////////////////////////////////////////////////////////////// //@intro 当前控件的键盘按压事件 //@param e:键盘按压事件 ////////////////////////////////////////////////////////////////////////// void GLTextureArea::keyPressEvent(QKeyEvent *e) { if(e->key()== Qt::Key_Control) trackball.MouseDown(0,0,QT2VCG(Qt::NoButton,Qt::ControlModifier)); else if(e->key()== Qt::Key_Shift) trackball.MouseDown(0,0,QT2VCG(Qt::NoButton,Qt::ShiftModifier)); else if(e->key()== Qt::Key_Alt) { cout<<"mouse alt:"<<endl; trackball.MouseDown(0,0,QT2VCG(Qt::NoButton,Qt::AltModifier)); } }
void AlignPairWidget::keyPressEvent (QKeyEvent * e) { e->ignore (); for(int i=0;i<2;++i) { if (e->key () == Qt::Key_Control) tt[i]->ButtonDown (QT2VCG (Qt::NoButton, Qt::ControlModifier)); if (e->key () == Qt::Key_Shift) tt[i]->ButtonDown (QT2VCG (Qt::NoButton, Qt::ShiftModifier)); if (e->key () == Qt::Key_Alt) tt[i]->ButtonDown (QT2VCG (Qt::NoButton, Qt::AltModifier)); } updateGL (); }
void AlignPairWidget::mousePressEvent (QMouseEvent * e) { e->accept (); setFocus (); int index = e->x () < ( width() /2) ? 0 : 1 ; currentTrack = tt[index]; currentTrack->MouseDown (e->x (), height () - e->y (), QT2VCG (e->button (), e->modifiers ())); }
void AlignPairWidget::mouseReleaseEvent (QMouseEvent * e) { if(!currentTrack) { qDebug("Warning useless mouse release"); return; } currentTrack->MouseUp (e->x (), height () - e->y (), QT2VCG (e->button (), e->modifiers ())); currentTrack=0; }
void GLWidget::mousePressEvent (QMouseEvent * e) { if(!TwMousePressQt(e)) { e->accept (); setFocus (); track.MouseDown (e->x (), height () - e->y (), QT2VCG (e->button (), e->modifiers ())); } updateGL (); }
////////////////////////////////////////////////////////////////////////// //@intro 当前控件的键盘释放事件 //@param e:键盘释放控件 ////////////////////////////////////////////////////////////////////////// void GLTextureArea::keyReleaseEvent(QKeyEvent *e) { if(e->key()== Qt::Key_Control) trackball.MouseUp(0,0,QT2VCG(Qt::NoButton,Qt::ControlModifier)); else if(e->key()== Qt::Key_Shift) trackball.MouseUp(0,0,QT2VCG(Qt::NoButton,Qt::ShiftModifier)); else if(e->key()== Qt::Key_Alt) trackball.MouseUp(0,0,QT2VCG(Qt::NoButton,Qt::AltModifier)); else if(mSelectedSliceIndex != -1 && e->key() == Qt::Key_Up) { mEnrolledSlices[mSelectedSliceIndex].Translate(0,0.05); } else if(mSelectedSliceIndex != -1 && e->key() == Qt::Key_Down) { mEnrolledSlices[mSelectedSliceIndex].Translate(0,-0.05); } else if(mSelectedSliceIndex != -1 && e->key() == Qt::Key_Left) { mEnrolledSlices[mSelectedSliceIndex].Translate(-0.05,0); } else if(mSelectedSliceIndex != -1 && e->key() == Qt::Key_Right) { mEnrolledSlices[mSelectedSliceIndex].Translate(0.05,0); } update(); updateGL(); }
////////////////////////////////////////////////////////////////////////// //@intro 当前控件的鼠标释放事件 //@param e:鼠标释放控件 ////////////////////////////////////////////////////////////////////////// void GLTextureArea::mouseReleaseEvent(QMouseEvent *e) { double world_x,world_y,world_z; GetWorldCoordinate(e->x(), height()-e->y(),world_x,world_y,world_z); oldX = world_x; oldY = world_y; if(e->button()== Qt::LeftButton) { trackball.MouseUp(e->x(),height()-e->y(),QT2VCG(e->button(),e->modifiers())); mLeftKeyPressed = false; if(mSelectedSliceIndex != -1 && mControlPointSelected) { mEnrolledSlices[mSelectedSliceIndex].ResetControlPoint(); mControlPointSelected = false; } } update(); updateGL(); }
void EditVasePlugin::mouseReleaseEvent(QMouseEvent* e, MeshModel &, GLArea* gla){ gla->trackball.MouseUp(e->x(),gla->height()-e->y(), QT2VCG(e->button(), e->modifiers() ) ); gla->update(); }
void GLWidget::mouseReleaseEvent (QMouseEvent * e) { track.MouseUp (e->x (), height () - e->y (), QT2VCG (e->button (), e->modifiers ())); TwMouseReleaseQt(e); updateGL (); }