Logo Search packages:      
Sourcecode: qt4-x11 version File versions

QPoint QCursor::pos (  )  [static]

Returns the position of the cursor (hot spot) in global screen coordinates.

You can call QWidget::mapFromGlobal() to translate it to widget coordinates.

See also:
setPos(), QWidget::mapFromGlobal(), QWidget::mapToGlobal()

Definition at line 143 of file qcursor_x11.cpp.

References QX11Info::appRootWindow().

Referenced by QDialog::adjustPosition(), QAbstractItemView::doAutoScroll(), Q3IconView::doAutoScroll(), Q3Table::doAutoScroll(), Q3ScrollView::doDragAutoScroll(), Window::dropEvent(), QToolBar::event(), QShortcut::event(), QDockWidget::event(), QMenu::internalDelayedPopup(), QGraphicsItem::isUnderMouse(), Q3TextEdit::optimDoAutoScroll(), QMenu::popup(), QContextMenuEvent::QContextMenuEvent(), QMouseEvent::QMouseEvent(), QWheelEvent::QWheelEvent(), QGraphicsItem::setCursor(), QHeaderView::setOffset(), QPlainTextEdit::timerEvent(), QTreeView::timerEvent(), QTextEdit::timerEvent(), and QGraphicsItem::unsetCursor().

{
    Window root;
    Window child;
    int root_x, root_y, win_x, win_y;
    uint buttons;
    Display* dpy = X11->display;
    for (int i = 0; i < ScreenCount(dpy); ++i) {
        if (XQueryPointer(dpy, QX11Info::appRootWindow(i), &root, &child, &root_x, &root_y,
                          &win_x, &win_y, &buttons))

            return QPoint(root_x, root_y);
    }
    return QPoint();
}


Generated by  Doxygen 1.6.0   Back to index