本文整理汇总了C++中QMouseEvent::globalY方法的典型用法代码示例。如果您正苦于以下问题:C++ QMouseEvent::globalY方法的具体用法?C++ QMouseEvent::globalY怎么用?C++ QMouseEvent::globalY使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QMouseEvent
的用法示例。
在下文中一共展示了QMouseEvent::globalY方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: eventFilter
bool QVistaHelper::eventFilter(QObject *obj, QEvent *event)
{
if (obj != wizard)
return QObject::eventFilter(obj, event);
if (event->type() == QEvent::MouseMove) {
QMouseEvent *mouseEvent = static_cast<QMouseEvent*>(event);
long result;
MSG msg;
msg.message = WM_NCHITTEST;
msg.wParam = 0;
msg.lParam = MAKELPARAM(mouseEvent->globalX(), mouseEvent->globalY());
msg.hwnd = wizardHWND();
winEvent(&msg, &result);
msg.wParam = result;
msg.message = WM_NCMOUSEMOVE;
winEvent(&msg, &result);
} else if (event->type() == QEvent::MouseButtonPress) {
QMouseEvent *mouseEvent = static_cast<QMouseEvent*>(event);
if (mouseEvent->button() == Qt::LeftButton) {
long result;
MSG msg;
msg.message = WM_NCHITTEST;
msg.wParam = 0;
msg.lParam = MAKELPARAM(mouseEvent->globalX(), mouseEvent->globalY());
msg.hwnd = wizardHWND();
winEvent(&msg, &result);
msg.wParam = result;
msg.message = WM_NCLBUTTONDOWN;
winEvent(&msg, &result);
}
} else if (event->type() == QEvent::MouseButtonRelease) {
QMouseEvent *mouseEvent = static_cast<QMouseEvent*>(event);
if (mouseEvent->button() == Qt::LeftButton) {
long result;
MSG msg;
msg.message = WM_NCHITTEST;
msg.wParam = 0;
msg.lParam = MAKELPARAM(mouseEvent->globalX(), mouseEvent->globalY());
msg.hwnd = wizardHWND();
winEvent(&msg, &result);
msg.wParam = result;
msg.message = WM_NCLBUTTONUP;
winEvent(&msg, &result);
}
}
return false;
}
示例2: eventFilter
bool TopBar::eventFilter(QObject *object, QEvent *event) {
if(object == ui->buttonIcon) {
if(event->type() == QEvent::MouseButtonPress) {
canMoveTopbar = true;
QMouseEvent *e = (QMouseEvent *)event;
pressedMouseX = e->x();
pressedMouseY = e->y();
event->accept();
} else if (event->type() == QEvent::MouseMove) {
if(canMoveTopbar) {
QMouseEvent *e = (QMouseEvent *)event;
ui->buttonIcon->setCursor(Qt::ClosedHandCursor);
move(e->globalX() - pressedMouseX, e->globalY() - pressedMouseY);
}
} else if(event->type() == QEvent::MouseButtonRelease) {
canMoveTopbar = false;
ui->buttonIcon->setCursor(Qt::OpenHandCursor);
event->accept();
} else if(event->type() == QEvent::Enter) {
ui->buttonIcon->setCursor(Qt::OpenHandCursor);
}
}
return QObject::eventFilter(object, event);
}
示例3: storeMouseState
void GAllEvents::storeMouseState(QEvent *event)
{
QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event);
this->nX = mouseEvent->x();
this->nY = mouseEvent->y();
this->nGlobalX = mouseEvent->globalX();
this->nGlobalY = mouseEvent->globalY();
this->nButton = mouseEvent->button();
this->nButtons = mouseEvent->buttons();
}
示例4: mouseMoveEvent
void CPrivateInfo::mouseMoveEvent(QMouseEvent *ev)
{
QMouseEvent *mv = (QMouseEvent*) ev;
QRect labelrect = QRect(ui->lb_top->pos() + this->pos(), ui->lb_top->size());
if(labelrect.contains(mv->globalPos()))
{
this->move(mv->globalX() - m_Ptcur.rx(), mv->globalY() - m_Ptcur.ry());
m_Ptbefore = mv->globalPos();
sleep(0.1);
}
}
示例5: pointerEvent
void QKmsCursor::pointerEvent(const QMouseEvent &event)
{
m_moved = true;
int status = drmModeMoveCursor(m_screen->device()->fd(),
m_screen->crtcId(),
event.globalX(),
event.globalY());
if (status) {
qWarning("failed to move cursor: %d", status);
}
}
示例6:
dmz::V8Value
dmz::JsModuleUiV8QtBasic::_mouse_event_global_y (const v8::Arguments &Args) {
v8::HandleScope scope;
V8Value result = v8::Undefined ();
JsModuleUiV8QtBasic *self = _to_self (Args);
if (self) {
QMouseEvent *event = (QMouseEvent *)self->_to_qevent (Args.This ());
if (event) { result = v8::Number::New (event->globalY ()); }
}
return scope.Close (result);
}
示例7: eventFilter
bool UIDnDMimeData::eventFilter(QObject *pObject, QEvent *pEvent)
{
if (pEvent)
{
switch (pEvent->type())
{
#ifdef DEBUG_andy
case QEvent::MouseMove:
{
QMouseEvent *pMouseEvent = (QMouseEvent*)(pEvent);
AssertPtr(pMouseEvent);
LogFlowFunc(("MouseMove: x=%d, y=%d\n",
pMouseEvent->globalX(), pMouseEvent->globalY()));
return true;
/* Never reached. */
}
#endif
case QEvent::MouseButtonRelease:
{
LogFlowFunc(("MouseButtonRelease\n"));
m_enmState = Dropped;
return true;
/* Never reached. */
}
case QEvent::KeyPress:
{
/* ESC pressed? */
if (static_cast<QKeyEvent*>(pEvent)->key() == Qt::Key_Escape)
{
LogFlowFunc(("ESC pressed, cancelling drag and drop operation\n"));
m_enmState = Canceled;
}
return true;
/* Never reached. */
}
default:
break;
}
}
return QObject::eventFilter(pObject, pEvent);
}
示例8: eventFilter
bool XCA_application::eventFilter(QObject *watched, QEvent *ev)
{
static int mctr;
QMouseEvent *me;
QStringList l;
XcaTreeView *treeview;
int key;
switch (ev->type()) {
case QEvent::FileOpen:
l << static_cast<QFileOpenEvent *>(ev)->file();
mainw->openURLs(l);
return true;
case QEvent::MouseMove:
case QEvent::NonClientAreaMouseMove:
if (mctr++ > 8) {
me = static_cast<QMouseEvent *>(ev);
entropy.add(me->globalX());
entropy.add(me->globalY());
mctr = 0;
}
break;
case QEvent::KeyPress:
key = static_cast<QKeyEvent *>(ev)->key();
if (key < 0x100) {
entropy.add(key);
}
break;
case QEvent::MouseButtonPress:
me = static_cast<QMouseEvent *>(ev);
treeview = watched ?
dynamic_cast<XcaTreeView*>(watched->parent()) : NULL;
if ((watched == mainw || treeview) &&
me->button() == Qt::MidButton &&
QApplication::clipboard()->supportsSelection())
{
mainw->pastePem();
return true;
}
break;
default:
break;
}
return false;
}
示例9: eventFilter
bool CameraWidget::eventFilter(QObject *target, QEvent *event) {
if (target == _POIsImageWidget && event->type() == QEvent::MouseButtonPress) {
QMouseEvent *mouseEvent = static_cast<QMouseEvent *> (event);
//--- Pauses Video Capture
_videoController->stopVideoCapture();
POI selectedPOI = _POIsImageWidget->getPOIAtPosition(mouseEvent->x(), mouseEvent->y());
//--- Valid POI must have coordinates > 0
if (selectedPOI.getCoordinates2d().x > 0) {
//--- Removes old POI if it already has semantic
if (selectedPOI.isInitialized()) {
_videoController->getCamera()->removePOI(selectedPOI.getSemantic().toStdString());
}
QPoint dialogPosition(mouseEvent->globalX(), mouseEvent->globalY());
POISemanticSelectionDialog POISemanticDialog(this, &selectedPOI, dialogPosition, _POISemanticTypesRef);
//--- POI semantic selection
POISemanticDialog.exec();
//--- Predicted position now should be the observed position
selectedPOI.setPredictedPosition(selectedPOI.getCoordinates2d());
//--- Inserts POI with updated semantic
_videoController->getCamera()->insertPOI(selectedPOI);
}
_videoController->startVideoCapture();
}
return QWidget::eventFilter(target, event);
}
示例10: switch
bool Application::
notify(QObject * receiver, QEvent * e)
{
bool v = false;
string err;
try {
if (e)
{
QEvent::Type t = e->type();
switch (t)
{
case QEvent::MouseButtonPress:
{
QMouseEvent* m = static_cast<QMouseEvent*>(e);
TaskInfo("QEvent::MouseButtonPress button=%d at %d, %d (%d, %d) on %s %s %p",
m->button(), m->x(), m->y(), m->globalX(), m->globalY(), vartype(*receiver).c_str(), receiver->objectName().toStdString().c_str(), receiver);
break;
}
case QEvent::MouseButtonRelease:
{
QMouseEvent* m = static_cast<QMouseEvent*>(e);
TaskInfo("QEvent::MouseButtonRelease button=%d at %d, %d (%d, %d) from %s %s %p",
m->button(), m->pos().x(), m->pos().y(), m->globalX(), m->globalY(), vartype(*receiver).c_str(), receiver->objectName().toStdString().c_str(), receiver);
break;
}
case QEvent::KeyPress:
{
QKeyEvent* m = static_cast<QKeyEvent*>(e);
TaskInfo(boost::format("QEvent::KeyPress key=0x%x on %s [%s %p]")
% m->key()
% vartype(*receiver)
% receiver->objectName().toStdString()
% receiver);
break;
}
default:
break;
}
switch (t)
{
case QEvent::MouseButtonPress:
case QEvent::KeyPress:
case QEvent::Show:
case QEvent::Enter:
foreach (pProject p, _projects)
{
if (receiver == p->mainWindow())
p->tools().render_view()->redraw();
}
break;
default:
break;
}
}
v = QApplication::notify(receiver,e);
} catch (...) {
Tools::ApplicationErrorLogController::registerException (boost::current_exception ());
}
return v;
}
示例11: eventFilter
bool MainWindow::eventFilter(QObject *obj, QEvent *event)
{
QKeyEvent *kevent;
QMouseEvent *mevent;
QString position;
static bool interior = false;
UNUSED_PARAMETER(obj);
switch (event->type()) {
case QEvent::MouseMove:
mevent = static_cast<QMouseEvent *>(event);
interior = frameGeometry().contains(mevent->globalPos());
if (m_mouseAcquired) {
position = QString::number(mevent->globalX()) + "," + QString::number(mevent->globalY());
ui->statusBar->showMessage("Mouse move " + position);
writeDatagram(DFBINPUT_MOUSE_MOTION, 0, mevent->globalX(), mevent->globalY());
}
break;
case QEvent::KeyPress:
kevent = static_cast<QKeyEvent *>(event);
if (m_mouseAcquired) {
// Forward the event to the MainWindow
if (kevent->modifiers() & Qt::ControlModifier)
return false;
ui->statusBar->showMessage("Key press " + kevent->text());
if (kevent->text().length() > 0)
writeDatagram(DFBINPUT_KEYPRESS, kevent->text().at(0).toAscii(), 0, 0);
}
break;
case QEvent::MouseButtonPress:
if (m_mouseAcquired) {
mevent = static_cast<QMouseEvent *>(event);
position = QString::number(mevent->globalX()) + "," + QString::number(mevent->globalY());
ui->statusBar->showMessage("Mouse click at " + position);
writeDatagram(DFBINPUT_MOUSE_CLICK, mevent->button() == Qt::LeftButton ? 1 :
(mevent->button() == Qt::RightButton ? 2 : 0),
mevent->globalX(), mevent->globalY());
}
break;
case QEvent::MouseButtonDblClick:
if (m_mouseAcquired) {
mevent = static_cast<QMouseEvent *>(event);
position = QString::number(mevent->globalX()) + "," + QString::number(mevent->globalY());
ui->statusBar->showMessage("Mouse double-click at " + position);
writeDatagram(DFBINPUT_MOUSE_DBLCLICK, mevent->button() == Qt::LeftButton ? 1 :
(mevent->button() == Qt::RightButton ? 2 : 0),
mevent->globalX(), mevent->globalY());
}
break;
case QEvent::Leave:
if (m_mouseAcquired && interior)
grabMouse();
break;
default:
return false;
}
return true;
}
示例12: eventFilter
//.........这里部分代码省略.........
}
// If there's a visible QGraphicsItem under the mouse and mouse is not in FPS mode,
// the click's supposed to go there - don't send it at all to inworld scene.
// if (itemUnderMouse && mouseCursorVisible)
// return false;
// The mouse coordinates we receive can come from different widgets, and we are interested only in the coordinates
// in the QGraphicsView client area, so we need to remap them.
QPoint mousePos = MapPointToMainGraphicsView(obj, e->pos());
MouseEvent mouseEvent;
mouseEvent.itemUnderMouse = GetVisibleItemAtCoords(e->x(), e->y());
mouseEvent.origin = mouseEvent.itemUnderMouse ? MouseEvent::PressOriginQtWidget : MouseEvent::PressOriginScene;
if ( !doubleClickDetected)
{
mouseEvent.eventType = (event->type() == QEvent::MouseButtonPress) ? MouseEvent::MousePressed : MouseEvent::MouseReleased;
} else
{
mouseEvent.eventType = MouseEvent::MouseDoubleClicked;
}
mouseEvent.button = (MouseEvent::MouseButton)e->button();
mouseEvent.x = mousePos.x();
mouseEvent.y = mousePos.y();
mouseEvent.z = 0;
mouseEvent.relativeX = mouseEvent.x - lastMouseX;
mouseEvent.relativeY = mouseEvent.y - lastMouseY;
mouseEvent.modifiers = current_modifiers_;
lastMouseX = mouseEvent.x;
lastMouseY = mouseEvent.y;
mouseEvent.globalX = e->globalX();
mouseEvent.globalY = e->globalY();
mouseEvent.otherButtons = e->buttons();
// mouseEvent.heldKeys = heldKeys; ///\todo
mouseEvent.handled = false;
// The mouse press is going to the inworld scene - clear keyboard focus from the QGraphicsScene widget, if any had it so key events also go to inworld scene.
if (event->type() == QEvent::MouseButtonPress && !mouseEvent.itemUnderMouse && mouseCursorVisible)
mainView->scene()->clearFocus();
TriggerMouseEvent(mouseEvent);
return mouseEvent.handled;
}
case QEvent::MouseMove:
{
// If a mouse button is held down, we get the mouse drag events from the viewport widget.
// If a mouse button is not held down, the application main window will get the events.
// Duplicate events are not received, so no need to worry about filtering them here.
QMouseEvent *e = static_cast<QMouseEvent *>(event);
//QGraphicsItem *itemUnderMouse = GetVisibleItemAtCoords(e->x(), e->y());
// If there is a graphicsItem under the mouse, don't pass the move message to the inworld scene, unless the inworld scene has captured it.
// if (mouseCursorVisible)
// if ((itemUnderMouse && sceneMouseCapture != SceneMouseCapture) || sceneMouseCapture == QtMouseCapture)
// return false;
// if (mouseCursorVisible && itemUnderMouse)
// return false;