void cVideoLabel::mouseMoveEvent(QMouseEvent *ev) { this->xCoord = ev->pos().x(); this->yCoord = ev->pos().y(); //JJV DEBUG - there seems to be an issue here the cursor will appear with negative coordinates - the max positive limits work fine if (this->xCoord > width()) { this->xCoord = width(); } if (this->xCoord <= 0) { this->xCoord = 0; } if (this->yCoord > height()) { this->yCoord = height(); } if (this->yCoord <= 0) { this->yCoord = 0; } QCursor::setPos(mapToGlobal(QPoint(xCoord,yCoord))); emit mouseMoving(); }
/** * \brief When we move the mouse and if the left button is pressed we send a signal to draw the rectangle evolving * \author Jules Gorny - ALCoV team, ISIT, UMR 6284 UdA – CNRS **/ void QImageLabel::mouseMoveEvent(QMouseEvent* event) { mouseX = event->pos().x(); mouseY = event->pos().y(); if( refreshMoveEvent ) { if( ratio != 1 ) refreshMoveEvent = false; if(event->buttons() == Qt::LeftButton) mouseMoving(mouseX, mouseY); } }
ComboBoxToolTip::ComboBoxToolTip(QWidget *parent, const char *name, const char* rtips[], const int& r_size ) : QWidget( parent ) { // tool tip for ListBoxItems inside combo boxes // created from scratch since ListBoxItems ain't widgets //qt3to4 -- BW //tipLabel = new QLabel( QApplication::desktop(), "toolTipTip",Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint | Qt::WStyle_Tool | Qt::WX11BypassWM ); tipLabel = new QLabel("toolTipTip",parent,Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint |Qt::Tool | Qt::X11BypassWindowManagerHint ); tipLabel->setPalette( QToolTip::palette()); tipLabel->hide(); hide(); //qt3to4 -- BW if ( parent->inherits( "QComboBox" ) ){ //if ( parent->inherits( "Q3ComboBox" ) ){ //qt3to4 -- BW //lb = ((QComboBox*)parent)->listBox(); //lb = ((Q3ComboBox*)parent)->listBox(); lb = (QComboBox*)parent; eFilter = new MEventFilter( lb , 0); } else { eFilter = new MEventFilter( parent, 0); } connect( eFilter, SIGNAL( mouseMoving() ), this, SLOT( MovingMouseOnBox() ) ); connect( eFilter, SIGNAL( hideEvent() ), tipLabel, SLOT( hide() ) ); //connect( parent, SIGNAL( activated(int) ), this, SLOT( showTipLabel( int) ) ); //qt3to4 -- BW -- this causes a bus error and is actually not a QComboBox signal //connect( lb, SIGNAL( selected(int) ), this, SLOT( showTipLabel( int) ) ); connect( eFilter, SIGNAL( mouseButRelease() ), tipLabel, SLOT( hide() ) ); //connect( eFilter, SIGNAL( mouseButPress() ), this, SLOT( MovingMouseOnBox() ) ); tips = rtips; tipSize = r_size;; // this gives you the name of the object <= useful for debugging //cout << "No. of tips for "<< parent->name()<< " : " << tipSize << endl; }
int myView::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QGraphicsView::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: mouseOnScene(); break; case 1: mouseOutScene(); break; case 2: mouseMoving((*reinterpret_cast< float(*)>(_a[1])),(*reinterpret_cast< float(*)>(_a[2]))); break; case 3: mouseClick((*reinterpret_cast< float(*)>(_a[1])),(*reinterpret_cast< float(*)>(_a[2]))); break; case 4: mouseDoubleClick(); break; case 5: ameliorerItem(); break; case 6: vendreItem(); break; case 7: switchMouseMoving(); break; default: ; } _id -= 8; } return _id; }
/** * \brief Force an update if the mouse stops move * \author Jules Gorny - ALCoV team, ISIT, UMR 6284 UdA – CNRS **/ void QImageLabel::slot_forceMoveUpdate() { if( rectNotEnded && refreshMoveEvent ) mouseMoving(mouseX, mouseY); }