void QInputGeneratorGeneric::mousePress(const QPoint& pos, Qt::MouseButtons state)
{
    QTT_TRACE_FUNCTION();
    const Qt::MouseButton buttons[] = {Qt::LeftButton, Qt::RightButton, Qt::MidButton, Qt::XButton1, Qt::XButton2};
    QWidget *widget=QApplication::widgetAt(pos);
    if (pos != currentPos) {
        mouseEvent(MouseMove, widget, Qt::NoButton, currentButtons, 0, widget->mapFromGlobal(pos));
        currentPos = pos;
    }
    for (unsigned int i=0; i<sizeof(buttons)/sizeof(Qt::MouseButton); i++) {
        if (state.testFlag(buttons[i])) {
            qttDebug() << "mousePress" << pos << buttons[i] << currentButtons;
            currentButtons |= buttons[i];
            mouseEvent(MousePress, widget, buttons[i], buttons[i], 0, widget->mapFromGlobal(pos));
        }
    }
}
Exemplo n.º 2
0
void EditMarkerGroupDialog::sl_onItemEntered(const QModelIndex &idx) {
    Qt::MouseButtons bs = QApplication::mouseButtons();
    if (bs.testFlag(Qt::LeftButton)) {
        sl_onItemSelected(idx);
    }
}