bool PrintTool::mousePressEvent(QMouseEvent* event, MapCoordF map_coord, MapWidget* widget) { if (event->button() == Qt::LeftButton) { mouseMoved(map_coord, widget); dragging = true; click_pos = event->pos(); click_pos_map = map_coord; if (region == Inside || region == Outside) widget->setCursor(Qt::ClosedHandCursor); return true; } if (event->button() == Qt::RightButton) { return true; // disable context menu } return false; }
bool PrintTool::mouseReleaseEvent(QMouseEvent* event, MapCoordF map_coord, MapWidget* widget) { if (dragging && event->button() == Qt::LeftButton) { if (region == Outside) { mapWidget()->getMapView()->finishPanning(event->pos() - click_pos); } else { updateDragging(map_coord); } dragging = false; region = Unknown; // forces mouseMoved() to update cursor and status mouseMoved(map_coord, widget); return true; } return false; }
void Transform3DWidget::addTranslationControls(QString uid, QString name, int index, QVBoxLayout* layout) { QHBoxLayout* hLayout = new QHBoxLayout; DoublePropertyPtr adapter = DoubleProperty::initialize(uid, name, "", 0, DoubleRange(-10000,10000,0.1),1); connect(adapter.get(), SIGNAL(changed()), this, SLOT(changedSlot())); adapter->setInternal2Display(1.0); hLayout->addWidget(new SpinBoxGroupWidget(this, adapter)); QSize mMinBarSize = QSize(20,20); MousePadWidget* pad = new MousePadWidget(this, mMinBarSize); pad->setFixedYPos(true); hLayout->addWidget(pad); // use QtSignalAdapters library to work magic: QtSignalAdapters::connect1<void(QPointF)>(pad, SIGNAL(mouseMoved(QPointF)), boost::bind(&Transform3DWidget::translateSlot, this, _1, index)); layout->addLayout(hLayout); mTranslationAdapter[index] = adapter; }
void Window::widgetShown(const gcn::Event& event) { mVisible = true; requestMoveToTop(); requestFocus(); int widgetX, widgetY; getAbsolutePosition(widgetX, widgetY); widgetX = gui->getMouseX() - widgetX; widgetY = gui->getMouseY() - widgetY; if (getChildrenArea().isPointInRect(widgetX, widgetY)) { gcn::MouseEvent mouseEvent(this, false, false, false, false, gcn::MouseEvent::MOVED, 0, widgetX, widgetY, 0); mouseMoved(mouseEvent); } }
void CInputEventsTranslator::deactivateMouseMotionTranslation() { Messages::MessageType mouseMoved("MOUSE_MOVED"); CMessageModule* messageModule = CMessageModule::getInstancePtr(); Messages::Messenger* messageManager = messageModule->getMessageManager(); try { messageManager->delListener ( mouseMotionEventsTranslator, mouseMoved ); Gnoll::Log::CLogModule::getInstancePtr()->logMessage( "mouseMotionEventsTranslator listener removed" ); messageManager->delListener ( mouseMotionStateTranslator, mouseMoved ); Gnoll::Log::CLogModule::getInstancePtr()->logMessage( "mouseMotionStateTranslator listener removed" ); } catch(...) { throw; } }
bool MyScene::event(QEvent* event) { switch(event->type()) { case QEvent::Leave: emit mouseLeft(); break; case QEvent::GraphicsSceneMouseMove: x = (int)(static_cast<QGraphicsSceneMouseEvent*>(event)->scenePos().x()); y = (int)(static_cast<QGraphicsSceneMouseEvent*>(event)->scenePos().y()); emit mouseMoved(); break; case QEvent::GraphicsSceneMousePress: emit mousePressed();; break; case QEvent::GraphicsSceneMouseRelease: emit mouseReleased(); break; default: return false; } return false; }
void AMBeamConfigurationWizard::addPoint(QPointF position) { int index = relativeId() - numberOfPoints()/2; QPointF* newPoint; if(topLeft_) { newPoint = (*pointList())[2*(index)]; connect(view(), SIGNAL(mouseMoved(QPointF)), this, SLOT(addPoint(QPointF))); topLeft_ = !topLeft_; } else { newPoint = (*pointList())[2*(index) + 1]; } *newPoint = mapPointToVideo(position); emit showShape(index); }
void SequenceDialog::fillDiagram() { if (!info_->sainfo() || file_closed_) return; QCustomPlot *sp = ui->sequencePlot; if (info_->sainfo()->type == SEQ_ANALYSIS_VOIP) { seq_diagram_->setData(info_->sainfo()); } else { seq_diagram_->clearData(); sequence_analysis_list_free(info_->sainfo()); sequence_analysis_list_get(cap_file_.capFile(), info_->sainfo()); num_items_ = sequence_analysis_get_nodes(info_->sainfo()); seq_diagram_->setData(info_->sainfo()); } sequence_w_ = one_em_ * 15 ; // Arbitrary mouseMoved(NULL); resetAxes(); // XXX QCustomPlot doesn't seem to draw any sort of focus indicator. sp->setFocus(); }
void CanvasWidget::updateBar() { QPoint p = mapFromGlobal(cursor().pos()); if (lastMousePosition == p) { return; } lastMousePosition = p; // don't move the mouse if the user was using the keys to play // after a while however (when usingKeys == 0) the mouse gets released // this avoids accidentally moving the mouse while playing using the keys if (usingKeys > 0) { --usingKeys; if (usingKeys == 0) { handleResetMousePosition(); } return; } // TODO: put scaling somewhere else... (???) // convert the screen position to scene position int posX = qRound((double)(p.x() - Item::borderLeft()) / Item::scale()); emit mouseMoved(posX); }
void AdapterWidget::mouseMoveEvent ( QMouseEvent* event ) { _gw->getEventQueue()->mouseMotion ( event->x(), event->y() ); emit mouseMoved(); }
void QOolTextEdit::mouseMoveEvent(QMouseEvent *e) { mouseMoved(e); }
/* * Initialize the GUI interface for the plugin - this is only called once when the plugin is * added to the plugin registry in the QGIS application. */ void CoordinateCapture::initGui() { mCrs.createFromSrsId( GEOCRS_ID ); // initialize the CRS object connect( mQGisIface->mapCanvas()->mapRenderer(), SIGNAL( destinationSrsChanged() ), this, SLOT( setSourceCrs() ) ); setSourceCrs(); //set up the source CRS mTransform.setDestCRS( mCrs ); // set the CRS in the transform mUserCrsDisplayPrecision = ( mCrs.mapUnits() == QGis::Degrees ) ? 8 : 3; // precision depends on CRS units // Create the action for tool mQActionPointer = new QAction( QIcon( ":/coordinatecapture/coordinate_capture.png" ), tr( "Coordinate Capture" ), this ); // Set the what's this text mQActionPointer->setWhatsThis( tr( "Click on the map to view coordinates and capture to clipboard." ) ); // Connect the action to the run connect( mQActionPointer, SIGNAL( triggered() ), this, SLOT( run() ) ); // Add the icon to the toolbar mQGisIface->addToolBarIcon( mQActionPointer ); mQGisIface->addPluginToMenu( tr( "&Coordinate Capture" ), mQActionPointer ); // create our map tool mpMapTool = new CoordinateCaptureMapTool( mQGisIface->mapCanvas() ); connect( mpMapTool, SIGNAL( mouseMoved( QgsPoint ) ), this, SLOT( mouseMoved( QgsPoint ) ) ); connect( mpMapTool, SIGNAL( mouseClicked( QgsPoint ) ), this, SLOT( mouseClicked( QgsPoint ) ) ); // create a little widget with x and y display to put into our dock widget QWidget * mypWidget = new QWidget(); QGridLayout *mypLayout = new QGridLayout( mypWidget ); mypLayout->setColumnMinimumWidth( 0, 36 ); mypWidget->setLayout( mypLayout ); QToolButton * mypUserCrsToolButton = new QToolButton( mypWidget ); mypUserCrsToolButton->setIcon( QIcon( ":/coordinatecapture/geographic.png" ) ); mypUserCrsToolButton->setToolTip( tr( "Click to select the CRS to use for coordinate display" ) ); connect( mypUserCrsToolButton, SIGNAL( clicked() ), this, SLOT( setCRS() ) ); QLabel * mypCRSLabel = new QLabel( mypWidget ); mypCRSLabel->setPixmap( QPixmap( ":/coordinatecapture/transformed.png" ) ); mypCRSLabel->setGeometry( mypUserCrsToolButton->geometry() ); mpUserCrsEdit = new QLineEdit( mypWidget ); mpUserCrsEdit->setReadOnly( true ); mpUserCrsEdit->setToolTip( tr( "Coordinate in your selected CRS" ) ); mpCanvasEdit = new QLineEdit( mypWidget ); mpCanvasEdit->setReadOnly( true ); mpCanvasEdit->setToolTip( tr( "Coordinate in map canvas coordinate reference system" ) ); QPushButton * mypCopyButton = new QPushButton( mypWidget ); mypCopyButton->setText( tr( "Copy to clipboard" ) ); connect( mypCopyButton, SIGNAL( clicked() ), this, SLOT( copy() ) ); mpTrackMouseButton = new QToolButton( mypWidget ); mpTrackMouseButton->setCheckable( true ); mpTrackMouseButton->setToolTip( tr( "Click to enable mouse tracking. Click the canvas to stop" ) ); mpTrackMouseButton->setChecked( false ); mpTrackMouseButton->setIcon( QIcon( ":/coordinatecapture/tracking.png" ) ); mypLayout->addWidget( mypUserCrsToolButton, 0, 0 ); mypLayout->addWidget( mpUserCrsEdit, 0, 1 ); mypLayout->addWidget( mypCRSLabel, 1, 0 ); mypLayout->addWidget( mpCanvasEdit, 1, 1 ); mypLayout->addWidget( mpTrackMouseButton, 2, 0 ); mypLayout->addWidget( mypCopyButton, 2, 1 ); //create the dock widget mpDockWidget = new QDockWidget( tr( "Coordinate Capture" ), mQGisIface->mainWindow() ); mpDockWidget->setObjectName( "CoordinateCapture" ); mpDockWidget->setAllowedAreas( Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea ); mQGisIface->addDockWidget( Qt::LeftDockWidgetArea, mpDockWidget ); // now add our custom widget to the dock - ownership of the widget is passed to the dock mpDockWidget->setWidget( mypWidget ); }
void MapWindow::MapMouseMove(QPoint pos) { emit mouseMoved(pos); }
void ofxTLTrack::_mouseMoved(ofMouseEventArgs& args, long millis){ if(enabled){ hover = bounds.inside(args.x, args.y); mouseMoved(args, millis); } }
void MockUInput::moveMouse(int dx, int dy) { Q_EMIT mouseMoved(dx, dy); }
void CoordinateCaptureMapTool::canvasMoveEvent( QgsMapMouseEvent * thepEvent ) { QgsPoint myOriginalPoint = mCanvas->getCoordinateTransform()->toMapCoordinates( thepEvent->x(), thepEvent->y() ); emit mouseMoved( myOriginalPoint ); }
void QoccHarnessWindow::createActions() { newAction = new QAction(tr("&New"), this); newAction->setShortcut(tr("Ctrl+N")); newAction->setStatusTip(tr("Create a new file")); connect(newAction, SIGNAL(triggered()), this, SLOT(newFile())); openAction = new QAction(tr("&Open..."), this); openAction->setShortcut(tr("Ctrl+O")); openAction->setStatusTip(tr("Open an existing file")); connect(openAction, SIGNAL(triggered()), this, SLOT(open())); saveAction = new QAction(tr("&Save"), this); saveAction->setShortcut(tr("Ctrl+S")); saveAction->setStatusTip(tr("Save the document to disk")); connect(saveAction, SIGNAL(triggered()), this, SLOT(save())); printAction = new QAction(tr("&Print..."), this); printAction->setShortcut(tr("Ctrl+P")); printAction->setStatusTip(tr("Print the document")); connect(printAction, SIGNAL(triggered()), this, SLOT(print())); exitAction = new QAction(tr("E&xit"), this); exitAction->setShortcut(tr("Ctrl+X")); exitAction->setStatusTip(tr("Exit the application")); connect(exitAction, SIGNAL(triggered()), this, SLOT(close())); undoAction = new QAction(tr("&Undo"), this); undoAction->setShortcut(tr("Ctrl+Z")); undoAction->setStatusTip(tr("Undo the last operation")); connect(undoAction, SIGNAL(triggered()), this, SLOT(undo())); redoAction = new QAction(tr("&Redo"), this); redoAction->setShortcut(tr("Ctrl+Y")); redoAction->setStatusTip(tr("Redo the last operation")); connect(redoAction, SIGNAL(triggered()), this, SLOT(redo())); cutAction = new QAction(tr("Cu&t"), this); cutAction->setShortcut(tr("Ctrl+X")); cutAction->setStatusTip(tr("Cut the current selection's contents to the clipboard")); connect(cutAction, SIGNAL(triggered()), this, SLOT(cut())); copyAction = new QAction(tr("&Copy"), this); copyAction->setShortcut(tr("Ctrl+C")); copyAction->setStatusTip(tr("Copy the current selection's contents to the clipboard")); connect(copyAction, SIGNAL(triggered()), this, SLOT(copy())); pasteAction = new QAction(tr("&Paste"), this); pasteAction->setShortcut(tr("Ctrl+V")); pasteAction->setStatusTip(tr("Paste the clipboard's contents into the current selection")); connect(pasteAction, SIGNAL(triggered()), this, SLOT(paste())); aboutAction = new QAction(tr("&About"), this); aboutAction->setStatusTip(tr("Show the application's About box")); connect(aboutAction, SIGNAL(triggered()), this, SLOT(about())); aboutQtAction = new QAction(tr("About &Qt"), this); aboutQtAction->setStatusTip(tr("Show the Qt library's About box")); connect(aboutQtAction, SIGNAL(triggered()), qApp, SLOT(aboutQt())); connect(aboutQtAction, SIGNAL(triggered()), this, SLOT(aboutQt())); // Now for the QtOCCViewWidget slots. /* fitAction = new QAction(tr("&Fit Window"), this); fitAction->setShortcut(tr("Ctrl+F")); fitAction->setStatusTip(tr("Fit to window")); connect(fitAction, SIGNAL(triggered()), myOCC, SLOT(fitExtents())); */ fitAllAction = new QAction(tr("&Fit All"), this); fitAllAction->setShortcut(tr("Ctrl+F")); fitAllAction->setStatusTip(tr("Fit contents to viewport")); connect(fitAllAction, SIGNAL(triggered()), myOCC, SLOT(fitAll())); zoomAction = new QAction(tr("&Zoom"), this); zoomAction->setStatusTip(tr("Zoom in window")); connect(zoomAction, SIGNAL(triggered()), myOCC, SLOT(fitArea())); panAction = new QAction(tr("&Pan"), this); panAction->setStatusTip(tr("Window panning")); connect(panAction, SIGNAL(triggered()), myOCC, SLOT(pan())); rotAction = new QAction(tr("&Rotate"), this); rotAction->setShortcut(tr("Ctrl+R")); rotAction->setStatusTip(tr("Window rotation")); connect(rotAction, SIGNAL(triggered()), myOCC, SLOT(rotation())); gridToggleAction = new QAction(tr("Toggle &Grid"), this); gridToggleAction->setShortcut(tr("Ctrl+G")); gridToggleAction->setStatusTip(tr("Turn the grid on or off")); connect(gridToggleAction, SIGNAL(triggered()), myVC, SLOT(gridToggle())); /* gridOffAction = new QAction(tr("Gri&d Off"), this); gridOffAction->setShortcut(tr("Ctrl+D")); gridOffAction->setStatusTip(tr("Turn the grid on")); connect(gridOffAction, SIGNAL(triggered()), myVC, SLOT(gridOff())); */ gridXYAction = new QAction(tr("XY Grid"), this); gridXYAction->setStatusTip(tr("Grid on XY Plane")); //gridOffAction->setShortcut(tr("Ctrl+Z")); connect(gridXYAction, SIGNAL(triggered()), myVC, SLOT(gridXY())); gridXZAction = new QAction(tr("XZ Grid"), this); gridXZAction->setStatusTip(tr("Grid on XZ Plane")); //gridXZAction->setShortcut(tr("Ctrl+Y")); connect(gridXZAction, SIGNAL(triggered()), myVC, SLOT(gridXZ())); gridYZAction = new QAction(tr("YZ Grid"), this); gridYZAction->setStatusTip(tr("Grid on YZ Plane")); //gridOffAction->setShortcut(tr("Ctrl+Z")); connect(gridYZAction, SIGNAL(triggered()), myVC, SLOT(gridYZ())); gridRectAction = new QAction(tr("Rectangular"), this); gridRectAction->setStatusTip(tr("Retangular grid")); //gridOffAction->setShortcut(tr("Ctrl+Z")); connect(gridRectAction, SIGNAL(triggered()), myVC, SLOT(gridRect())); gridCircAction = new QAction(tr("Circular"), this); gridCircAction->setStatusTip(tr("Circular grid")); //gridOffAction->setShortcut(tr("Ctrl+Z")); connect(gridCircAction, SIGNAL(triggered()), myVC, SLOT(gridCirc())); // Standard View viewFrontAction = new QAction(tr("Front"), this); viewFrontAction->setStatusTip(tr("View From Front")); connect(viewFrontAction, SIGNAL(triggered()), myOCC, SLOT(viewFront())); viewBackAction = new QAction(tr("Back"), this); viewBackAction->setStatusTip(tr("View From Back")); connect(viewBackAction, SIGNAL(triggered()), myOCC, SLOT(viewBack())); viewTopAction = new QAction(tr("Top"), this); viewTopAction->setStatusTip(tr("View From Top")); connect(viewTopAction, SIGNAL(triggered()), myOCC, SLOT(viewTop())); viewBottomAction = new QAction(tr("Bottom"), this); viewBottomAction->setStatusTip(tr("View From Bottom")); connect(viewBottomAction, SIGNAL(triggered()), myOCC, SLOT(viewBottom())); viewLeftAction = new QAction(tr("Left"), this); viewLeftAction->setStatusTip(tr("View From Left")); connect(viewLeftAction, SIGNAL(triggered()), myOCC, SLOT(viewLeft())); viewRightAction = new QAction(tr("Right"), this); viewRightAction->setStatusTip(tr("View From Right")); connect(viewRightAction, SIGNAL(triggered()), myOCC, SLOT(viewRight())); viewAxoAction = new QAction(tr("&Axonometric Fit"), this); viewAxoAction->setStatusTip(tr("Axonometric view and fit all")); viewAxoAction->setShortcut(tr("Ctrl+A")); connect(viewAxoAction, SIGNAL(triggered()), myOCC, SLOT(viewAxo())); viewGridAction = new QAction(tr("Grid"), this); viewGridAction->setStatusTip(tr("View from grid")); connect(viewGridAction, SIGNAL(triggered()), myOCC, SLOT(viewGrid())); viewResetAction = new QAction(tr("Reset"), this); viewResetAction->setStatusTip(tr("Reset the view")); connect(viewResetAction, SIGNAL(triggered()), myOCC, SLOT(viewReset())); backgroundAction = new QAction( tr("&Background"), this ); backgroundAction->setStatusTip(tr("Change the background colour")); connect(backgroundAction, SIGNAL(triggered()), myOCC, SLOT(background())); // The co-ordinates from the view connect( myOCC, SIGNAL(mouseMoved(V3d_Coordinate,V3d_Coordinate,V3d_Coordinate)), this, SLOT(xyzPosition(V3d_Coordinate,V3d_Coordinate,V3d_Coordinate)) ); // Add a point from the view connect( myOCC, SIGNAL(pointClicked(V3d_Coordinate,V3d_Coordinate,V3d_Coordinate)), this, SLOT (addPoint (V3d_Coordinate,V3d_Coordinate,V3d_Coordinate)) ); connect( myOCC, SIGNAL(sendStatus(const QString)), this, SLOT (statusMessage(const QString)) ); // And the bottle example bottleAction = new QAction(tr("Load &Bottle"), this); bottleAction->setShortcut(tr("Ctrl+B")); bottleAction->setStatusTip(tr("Bottle sample.")); connect(bottleAction, SIGNAL(triggered()), this, SLOT(bottle())); }
void ClickableLabel::mouseMoveEvent ( QMouseEvent * event ) { //const QPoint p = event->pos(); emit mouseMoved( event ); //emit clicked(); }
void GLScene::mouseMoveEvent(QMouseEvent *event) { QPointF pos = mapToScene(event->pos()); emit mouseMoved(pos); }
void InputMapper::mouseMoveEventHandlerCallback(GLFWwindow* window, double xPos, double yPos) { auto inputMapper = reinterpret_cast<InputMapper*>(glfwGetWindowUserPointer(window)); if (inputMapper) inputMapper->mouseMoved(xPos, yPos); }
MainWindow::MainWindow( QWidget * parent) : QMainWindow(parent) { setupUi(this); version = "2015-08-28"; inimage = false; x1drag = false; x2drag = false; y1drag = false; y2drag = false; image = QImage(); pixmap = scene.addPixmap(QPixmap()); pixmap->setZValue(0); QPen pen; pen.setColor(QColor(255,255,0)); pen.setStyle(Qt::DashLine); // limit lines x1line = scene.addLine(QLineF(), pen); x1line->setZValue(1); x2line = scene.addLine(QLineF(), pen); x2line->setZValue(1); y1line = scene.addLine(QLineF(), pen); y1line->setZValue(1); y2line = scene.addLine(QLineF(), pen); y2line->setZValue(1); pen.setColor(QColor(255,0,0)); pen.setStyle(Qt::SolidLine); // projections, beam profile, centroid xprojection = scene.addPath(QPainterPath(), pen); xprojection->setZValue(2); yprojection = scene.addPath(QPainterPath(), pen); yprojection->setZValue(2); ellipse = scene.addEllipse(0,0,0,0, pen); ellipse->setZValue(2); centerAline = scene.addLine(QLineF(), pen); centerAline->setZValue(2); centerBline = scene.addLine(QLineF(), pen); centerBline->setZValue(2); QObject::connect(&scene, SIGNAL(mouseMoved()), this, SLOT(mouseMovedOnScene())); QObject::connect(&scene, SIGNAL(mousePressed()), this, SLOT(mousePressedOnScene())); QObject::connect(&scene, SIGNAL(mouseReleased()), this, SLOT(mouseReleasedOnScene())); QObject::connect(&scene, SIGNAL(mouseLeft()), this, SLOT(mouseLeftScene())); graphicsView->setScene(&scene); graphicsView->setContextMenuPolicy(Qt::CustomContextMenu); X1SpinBox->setRange(0, MAX_HEIGHT-1); X2SpinBox->setRange(0, MAX_HEIGHT-1); Y1SpinBox->setRange(0, MAX_WIDTH-1); Y2SpinBox->setRange(0, MAX_WIDTH-1); scaleLabel->setScaledContents(true); AllocateMemory(); dataloaded = false; refloaded = false; RestoreSession(); LoadRef(reffile); LoadData(datafile); // Scale image scale = QImage(20, 256, QImage::Format_Indexed8); SetColorTable(); for(int i=0; i<20; i++) for(int j=0; j<=255; j++) scale.setPixel(i, j, 255-j); scaleLabel->setPixmap(QPixmap::fromImage(scale)); graphicsView->scale(pow(2,zoom/2), pow(2,zoom/2)); InitializeShortcuts(); UpdateVisibility(); }
void AMSimpleBeamConfigurationSetPage::releaseShape() { disconnect(view(), SIGNAL(mouseMoved(QPointF)), this, SLOT(moveShape(QPointF))); }
// handle mouse move void RenderArea::mouseMoveEvent(QMouseEvent * event) { mousePosition = event->pos(); emit mouseMoved(mousePosition.x ()); update(); }
void TitleLabel::mouseMoveEvent(QGraphicsSceneMouseEvent *event) { emit mouseMoved(event->scenePos() - buttonDownPos); }
void GdvCanvas3D::mouseMoveEvent(QMouseEvent* e) { emit mouseMoved(e->pos().x(), e->pos().y()); }
ZoneViewWidget::ZoneViewWidget(Player *_player, CardZone *_origZone, int numberCards, bool _revealZone, bool _writeableRevealZone, const QList<const ServerInfo_Card *> &cardList) : QGraphicsWidget(0, Qt::Tool | Qt::FramelessWindowHint), player(_player) { setAcceptHoverEvents(true); setAttribute(Qt::WA_DeleteOnClose); setZValue(2000000006); setFlag(ItemIgnoresTransformations); QGraphicsLinearLayout *hbox = new QGraphicsLinearLayout(Qt::Horizontal); titleLabel = new TitleLabel; connect(titleLabel, SIGNAL(mouseMoved(QPointF)), this, SLOT(moveWidget(QPointF))); closeButton = new QPushButton("X"); connect(closeButton, SIGNAL(clicked()), this, SLOT(close())); closeButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); QGraphicsProxyWidget *closeButtonProxy = new QGraphicsProxyWidget; closeButtonProxy->setWidget(closeButton); hbox->addItem(titleLabel); hbox->addItem(closeButtonProxy); QGraphicsLinearLayout *vbox = new QGraphicsLinearLayout(Qt::Vertical); vbox->addItem(hbox); if (numberCards < 0) { QGraphicsProxyWidget *sortByNameProxy = new QGraphicsProxyWidget; sortByNameProxy->setWidget(&sortByNameCheckBox); vbox->addItem(sortByNameProxy); QGraphicsProxyWidget *sortByTypeProxy = new QGraphicsProxyWidget; sortByTypeProxy->setWidget(&sortByTypeCheckBox); vbox->addItem(sortByTypeProxy); QGraphicsProxyWidget *lineProxy = new QGraphicsProxyWidget; QFrame *line = new QFrame; line->setFrameShape(QFrame::HLine); line->setFrameShadow(QFrame::Sunken); lineProxy->setWidget(line); vbox->addItem(lineProxy); QGraphicsProxyWidget *pileViewProxy = new QGraphicsProxyWidget; pileViewProxy->setWidget(&pileViewCheckBox); vbox->addItem(pileViewProxy); } if (_origZone->getIsShufflable() && (numberCards == -1)) { shuffleCheckBox.setChecked(settingsCache->getZoneViewShuffle()); QGraphicsProxyWidget *shuffleProxy = new QGraphicsProxyWidget; shuffleProxy->setWidget(&shuffleCheckBox); vbox->addItem(shuffleProxy); } extraHeight = vbox->sizeHint(Qt::PreferredSize).height(); resize(150, 150); QGraphicsLinearLayout *zoneHBox = new QGraphicsLinearLayout(Qt::Horizontal); zoneContainer = new QGraphicsWidget(this); zoneContainer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); zoneContainer->setFlag(QGraphicsItem::ItemClipsChildrenToShape); zoneHBox->addItem(zoneContainer); scrollBar = new QScrollBar(Qt::Vertical); scrollBar->setMinimum(0); scrollBar->setSingleStep(50); connect(scrollBar, SIGNAL(valueChanged(int)), this, SLOT(handleScrollBarChange(int))); QGraphicsProxyWidget *scrollBarProxy = new QGraphicsProxyWidget; scrollBarProxy->setWidget(scrollBar); zoneHBox->addItem(scrollBarProxy); vbox->addItem(zoneHBox); zone = new ZoneViewZone(player, _origZone, numberCards, _revealZone, _writeableRevealZone, zoneContainer); connect(zone, SIGNAL(wheelEventReceived(QGraphicsSceneWheelEvent *)), this, SLOT(handleWheelEvent(QGraphicsSceneWheelEvent *))); // numberCard is the num of cards we want to reveal from an area. Ex: scry the top 3 cards. // If the number is < 0 then it means that we can make the area sorted and we dont care about the order. if (numberCards < 0) { connect(&sortByNameCheckBox, SIGNAL(stateChanged(int)), this, SLOT(processSortByName(int))); connect(&sortByTypeCheckBox, SIGNAL(stateChanged(int)), this, SLOT(processSortByType(int))); connect(&pileViewCheckBox, SIGNAL(stateChanged(int)), this, SLOT(processSetPileView(int))); sortByNameCheckBox.setChecked(settingsCache->getZoneViewSortByName()); sortByTypeCheckBox.setChecked(settingsCache->getZoneViewSortByType()); pileViewCheckBox.setChecked(settingsCache->getZoneViewPileView()); if (!settingsCache->getZoneViewSortByType()) pileViewCheckBox.setEnabled(false); }
///////////////// emit mouse signals void IrrWidget::mouseMoveEvent(QMouseEvent *event) { emit mouseMoved(event->pos()); }
void NxGuiManager::touchMoved( int x, int y, int touchId ) { mouseMoved( x, y ); }
//----------------------------------------------------------------------------------------- TestTransformation::TestTransformation() : m_bPressed(false) , m_bTouch(false) , m_StartPan(-1, -1) , m_LastPan(-1, -1) { // On cr�e une camera CCamera* pCamera = m_pSceneManager->createCamera(); m_vNewEyePosition = QVector3D(8., 8., 4.); pCamera->setEyePosition(m_vNewEyePosition); pCamera->setCenter(QVector3D(0., 0., 0.)); qDebug() << "Create View"; m_pView = createWidget3D(pCamera); m_pView->setAttribute(Qt::WA_AcceptTouchEvents); qDebug() << "End create View"; // On cr�e un noeud afin d'y placer une lumi�re CSceneNode* pRootNode = getSceneManager()->getRootNode(); // On cr�e une lumi�re diffuse bleue CLight* pLight = getSceneManager()->createLight(); pLight->setDiffuseColor(1.0, 1.0, 1.0); pLight->setAmbientColor(1.0, 1.0, 1.0); pLight->setDirection(QVector3D(-1, 0, 0)); pLight->setSpecularColor(1.0f, 1.0f, 1.0f); // On l'associe au noeud pRootNode->addItem(pLight); // SkyBox CSkyBox* pSkyBoxMesh = CMeshManager::getInstance().createCustomMesh<CSkyBox>("CSkyBox", "SkyBoxMesh"); CMeshInstance* pSkyBox = getSceneManager()->createMeshInstance(pSkyBoxMesh, "SkyBox"); pSkyBox->setSelectable(false); CSceneNode* pSkyBoxNode = pRootNode->createChild("SkyBoxNode"); pSkyBoxNode->scale(400.); pSkyBoxNode->addItem(pSkyBox); CMaterial* pSkyBoxMat = CMaterialManager::getInstance().createMaterial("SkyBoxMaterial"); pSkyBox->setMaterialName(pSkyBoxMat->getName()); QStringList fileNames; fileNames << "://Resources/xpos.png" << "://Resources/xneg.png" << "://Resources/ypos.png" << "://Resources/yneg.png" << "://Resources/zpos.png" << "://Resources/zneg.png"; ATexture* pSkyBoxTexture = CTextureManager::getInstance().createTextureCube("SkyBoxTexCube", fileNames); pSkyBoxMat->addTexture(pSkyBoxTexture, eDiffuse); #ifdef EMBEDDED_TARGET CShader* pShader = CShaderManager::getInstance().createShader( "SkyBoxShader", "://Resources/skyboxES.vertex.glsl", "", "://Resources/skyboxES.fragment.glsl"); #else CShader* pShader = CShaderManager::getInstance().createShader( "SkyBoxShader", "://Resources/skybox.vertex.glsl", "", "://Resources/skybox.fragment.glsl"); #endif pSkyBoxMat->getRenderPass(0)->setShaderName(pShader->getName()); pSkyBoxMat->getRenderPass(0)->renderStates().setFaceCulling(CFaceCulling(false)); // Particules CBillboard* pBillboard = getSceneManager()->createBillboard(); QVector<QVector3D> pos; for (int i = 0; i < 1000; ++i) pos << QVector3D( Math::randDouble(-200., +200.), Math::randDouble(-200., +200.), Math::randDouble(-200., +200.)); pBillboard->addPositions(pos); CMaterial* pBillboardMat = CMaterialManager::getInstance().createMaterial("BillboardMaterial"); pBillboardMat->getRenderPass(0)->renderStates().setFaceCulling(CFaceCulling(false)); CBlending blending; blending.setEnabled(true); blending.setBlendEquation(eAdd, eAdd); blending.setBlendSeparateFunction(Source::eSourceAlpha, Destination::eOneMinusSourceAlpha, Source::eOne, Destination::eZero); pBillboardMat->getRenderPass(0)->renderStates().setBlending(blending); ATexture* pBillboardTexture = CTextureManager::getInstance().createTexture2D("BillBoardTex", "://Resources/particle.png"); pBillboardMat->addTexture(pBillboardTexture, eDiffuse); CShader* pBillboardShader = CShaderManager::getInstance().createShader("BillboardShader", "://Resources/billboard.vertex.glsl", "://Resources/billboard.geometry.glsl", "://Resources/billboard.fragment.glsl"); pBillboardMat->getRenderPass(0)->setShaderName(pBillboardShader->getName()); pBillboard->setMaterialName(pBillboardMat->getName()); pBillboardShader->setUniformValue("halfSize", 1.); CSceneNode* pBillboardNode = pRootNode->createChild("BillboardNode"); pBillboardNode->addItem(pBillboard); // Orbites CPolyLine* pPolyLine = CMeshManager::getInstance().createCustomMesh<CPolyLine>("CPolyLine", "CPolyLine"); QList<QVector3D> pts; for (int i = 0; i <= 360; ++i) { pts << QVector3D(cos(Math::degToRad((real)i)), 0., sin(Math::degToRad((real)i))); } pPolyLine->addPoints(pts); CSphereMesh* pSphereMesh = CMeshManager::getInstance().createCustomMesh<CSphereMesh>("CSphereMesh", "SphereMesh"); CMeshInstance* pSun = getSceneManager()->createMeshInstance(pSphereMesh, "Sun"); CMaterial* pSunMat = CMaterialManager::getInstance().createMaterial("SunMat"); pSunMat->setAmbientColor(1., 1., 1.); CTexture2D* pSunTexture = CTextureManager::getInstance().createTexture2D("SunTex", ":/Resources/sun.png"); pSunMat->addTexture(pSunTexture, eDiffuse); pSun->setMaterialName(pSunMat->getName()); CMeshInstance* pEarth = getSceneManager()->createMeshInstance(pSphereMesh, "Earth"); CMaterial* pEarthMat = CMaterialManager::getInstance().createMaterial("EarthMat"); CTexture2D* pEarthTexture = CTextureManager::getInstance().createTexture2D("EarthTex", ":/Resources/earth.png"); pEarthMat->addTexture(pEarthTexture, eDiffuse); pEarthMat->setAmbientColor(0.1, 0.1, 0.1); pEarthMat->setDiffuseColor(1.0, 1.0, 1.0); pEarthMat->setShininessFactor(10); pEarth->setMaterialName(pEarthMat->getName()); CMeshInstance* pJupiter = getSceneManager()->createMeshInstance(pSphereMesh, "Jupiter"); CMaterial* pJupiterMat = CMaterialManager::getInstance().createMaterial("JupiterMat"); pJupiterMat->setAmbientColor(0.4, 0.4, 0.4); CTexture2D* pJupiterTexture = CTextureManager::getInstance().createTexture2D("JupiterTex", ":/Resources/jupiter.png"); pJupiterMat->addTexture(pJupiterTexture, eDiffuse); pJupiter->setMaterialName(pJupiterMat->getName()); CMeshInstance* pMoon = getSceneManager()->createMeshInstance(pSphereMesh, "Moon"); CMaterial* pMoonMat = CMaterialManager::getInstance().createMaterial("MoonMat"); CTexture2D* pMoonTexture = CTextureManager::getInstance().createTexture2D("MoonTex", ":/Resources/moon.png"); pMoonMat->addTexture(pMoonTexture, eDiffuse); pMoon->setMaterialName(pMoonMat->getName()); CCoordinateSystem* pCoordinateSystemMesh = CMeshManager::getInstance().createCustomMesh<CCoordinateSystem>("CCoordinateSystem", "CCoordinateSystem"); CMeshInstance* pCoordinateSystem = getSceneManager()->createMeshInstance(pCoordinateSystemMesh, "CoordinateSystem"); pRootNode->addItem(pCoordinateSystem); pRootNode->addItem(pSkyBox); m_pSolarSystemNode = pRootNode->createChild(QVector3D(0., 0., 0.)); m_pSunNode = m_pSolarSystemNode->createChild(QVector3D(0., 0., 0.)); m_pSunNode->scale(4.0); m_pSunNode->addItem(pSun); m_pSunToEarthNode = m_pSolarSystemNode->createChild(); m_pSunToJupiterNode = m_pSolarSystemNode->createChild(); CMeshInstance* pSunToEarthPLine = getSceneManager()->createMeshInstance(pPolyLine, "SunToEarth"); pSunToEarthPLine->setMaterialName(CMaterialManager::getInstance().getMaterialNameByColor(Color::eWhite)); m_pSunToEarthNode->addItem(pSunToEarthPLine); m_pSunToEarthNode->scale(10.0); m_pEarthNode = m_pSolarSystemNode->createChild(QVector3D(10.0, 0., 0.)); m_pEarthNode->scale(1.0); m_pEarthNode->addItem(pEarth); CMeshInstance* pSunToJupiterPLine = getSceneManager()->createMeshInstance(pPolyLine, "SunToJupiter"); pSunToJupiterPLine->setMaterialName(CMaterialManager::getInstance().getMaterialNameByColor(Color::eWhite)); m_pSunToJupiterNode->addItem(pSunToJupiterPLine); m_pSunToJupiterNode->scale(20); m_pJupiterNode = m_pSolarSystemNode->createChild(QVector3D(20.0, 0., 0.)); m_pJupiterNode->scale(4.0); m_pJupiterNode->addItem(pJupiter); m_pEarthToMoonNode = m_pEarthNode->createChild(); CMeshInstance* pEarthToMoonPLine = getSceneManager()->createMeshInstance(pPolyLine, "EarthToMoon"); pEarthToMoonPLine->setMaterialName(CMaterialManager::getInstance().getMaterialNameByColor(Color::eWhite)); m_pEarthToMoonNode->addItem(pEarthToMoonPLine); m_pEarthToMoonNode->scale(2.0); m_pEarthToMoonNode->rotate(QVector3D(1.0, 0.0, 0.0), 30); m_pMoonNode = m_pEarthToMoonNode->createChild(QVector3D(1.0, 0.0, 0.)); m_pMoonNode->scale(0.2); m_pMoonNode->addItem(pMoon); QTimer* pTimer = new QTimer(this); connect(pTimer, SIGNAL(timeout()), this, SLOT(onTimeout())); pTimer->start(5); connect(m_pView, SIGNAL(mouseMoved()), this, SLOT(onMouseMoved())); connect(m_pView, SIGNAL(mouseReleased()), this, SLOT(onMouseReleased())); connect(m_pView, SIGNAL(mousePressed()), this, SLOT(onMousePressed())); connect(m_pView, SIGNAL(touchScaleStarted()), this, SLOT(onTouchScaleStarted())); connect(m_pView, SIGNAL(touchScaleChanged(real)), this, SLOT(onTouchScaleChanged(real))); connect(m_pView, SIGNAL(touchScaleEnded()), this, SLOT(onTouchScaleEnded())); //m_pView->setGeometry(QRect(1920, 100, 400, 300)); m_GlobalTime.start(); }
void RDLabel::mouseMoveEvent(QMouseEvent *event) { emit(mouseMoved(event)); QLabel::mouseMoveEvent(event); }