本文整理汇总了C++中qt::MouseButtons类的典型用法代码示例。如果您正苦于以下问题:C++ MouseButtons类的具体用法?C++ MouseButtons怎么用?C++ MouseButtons使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MouseButtons类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mousePress
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));
}
}
}
示例2: sl_onItemEntered
void EditMarkerGroupDialog::sl_onItemEntered(const QModelIndex &idx) {
Qt::MouseButtons bs = QApplication::mouseButtons();
if (bs.testFlag(Qt::LeftButton)) {
sl_onItemSelected(idx);
}
}