本文整理汇总了C++中QMouseEvent::posF方法的典型用法代码示例。如果您正苦于以下问题:C++ QMouseEvent::posF方法的具体用法?C++ QMouseEvent::posF怎么用?C++ QMouseEvent::posF使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QMouseEvent
的用法示例。
在下文中一共展示了QMouseEvent::posF方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QMouseEvent
RMouseEvent::RMouseEvent(const QMouseEvent& mouseEvent, RGraphicsScene& s,
RGraphicsView& v, qreal devicePixelRatio) :
QMouseEvent(mouseEvent),
RInputEvent(RVector(mouseEvent.posF().x(), mouseEvent.posF().y()), s, v, devicePixelRatio) {
setAccepted(mouseEvent.isAccepted());
}
示例2: eventFilter
bool CaptureWgt::eventFilter( QObject * o, QEvent * e )
{
if ( e->type() == QEvent::MouseButtonPress )
{
QMouseEvent * m = reinterpret_cast<QMouseEvent *>( e );
pd->crossPos( this, m->posF() );
}
return false;
}
示例3: eventFilter
bool CaptureWgt::eventFilter( QObject * o, QEvent * e )
{
if ( e->type() == QEvent::MouseButtonPress )
{
QMouseEvent * m = reinterpret_cast<QMouseEvent *>( e );
if ( pd->ui.cross->isChecked() )
{
pd->crossPos( this, m->posF() );
// Save to file if checked.
if ( pd->ui.cross->isChecked() )
updateCrossPos( true );
}
if ( pd->modifyLaserPos )
{
pd->laserPos( this, m->posF() );
// Always save it to a file.
updateCrossPos( true );
}
}
return false;
}
示例4:
dmz::V8Value
dmz::JsModuleUiV8QtBasic::_mouse_event_posf (const v8::Arguments &Args) {
v8::HandleScope scope;
V8Object result;
JsModuleUiV8QtBasic *self = _to_self (Args);
if (self) {
QMouseEvent *event = (QMouseEvent *)self->_to_qevent (Args.This ());
if (event) {
QPointF pos = event->posF ();
result = v8::Object::New ();
result->Set(v8::String::NewSymbol ("x"), v8::Number::New (pos.x ()));
result->Set(v8::String::NewSymbol ("y"), v8::Number::New (pos.y ()));
}
}
return scope.Close (result);
}
示例5: forwardHoverEvent
void KisToolProxy::forwardHoverEvent(QEvent *event)
{
switch (event->type()) {
case QEvent::TabletMove: {
QTabletEvent *tabletEvent = static_cast<QTabletEvent*>(event);
QPointF docPoint = widgetToDocument(tabletEvent->posF());
this->tabletEvent(tabletEvent, docPoint);
return;
}
case QEvent::MouseMove: {
QMouseEvent *mouseEvent = static_cast<QMouseEvent*>(event);
QPointF docPoint = widgetToDocument(mouseEvent->posF());
mouseMoveEvent(mouseEvent, docPoint);
return;
}
default: {
qWarning() << "forwardHoverEvent encountered unknown event type.";
return;
}
}
}
示例6: QMouseEvent
RMouseEvent::RMouseEvent(const QMouseEvent& mouseEvent, RGraphicsScene& s,
RGraphicsView& v) :
QMouseEvent(mouseEvent),
RInputEvent(RVector(mouseEvent.posF().x(), mouseEvent.posF().y()), s, v) {
}
示例7: recognize
QGestureRecognizer::Result SingleClickGestureRecognizer::recognize (QGesture* gesture, QObject* watched, QEvent* event)
{
//g_message("%s", __PRETTY_FUNCTION__);
QGestureRecognizer::Result result = QGestureRecognizer::Ignore;
SingleClickGesture* singleClickGesture = static_cast<SingleClickGesture*>(gesture);
static int s_tapRadius = -1;
if (G_UNLIKELY(s_tapRadius < 0))
s_tapRadius = Settings::LunaSettings()->tapRadius;
static uint32_t s_lastDblClickTime = 0;
if (watched == singleClickGesture && event->type() == QEvent::Timer) {
singleClickGesture->stopSingleClickTimer();
if (singleClickGesture->state() != Qt::GestureCanceled
&& singleClickGesture->state() != Qt::GestureFinished)
{
if (!singleClickGesture->m_mouseDown) {
result = QGestureRecognizer::FinishGesture | QGestureRecognizer::ConsumeEventHint;
}
else {
result |= QGestureRecognizer::ConsumeEventHint;
singleClickGesture->m_triggerSingleClickOnRelease = true;
}
// if finger down at the same location for longer than the timer,
// the single tap has to be triggered after the release
}
return result;
}
switch (event->type()) {
case QEvent::TouchBegin:
case QEvent::TouchUpdate:
case QEvent::TouchEnd:
{
if (singleClickGesture->state() == Qt::GestureStarted
|| singleClickGesture->state() == Qt::GestureUpdated)
{
QTouchEvent* touchEvent = static_cast<const QTouchEvent *>(event);
// this starts the gesture, so dont check existing state
if (touchEvent->touchPoints().size() > 1) {
singleClickGesture->m_triggerSingleClickOnRelease = false;
singleClickGesture->stopSingleClickTimer();
result = QGestureRecognizer::CancelGesture;
}
}
break;
}
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
case QEvent::MouseButtonPress:
{
QMouseEvent* mouseEvent = static_cast<const QMouseEvent *>(event);
singleClickGesture->stopSingleClickTimer();
singleClickGesture->m_penDownPos = mouseEvent->posF();
singleClickGesture->setHotSpot (mouseEvent->globalPos());
singleClickGesture->m_mouseDown = true;
singleClickGesture->m_triggerSingleClickOnRelease = false;
singleClickGesture->m_modifiers = mouseEvent->modifiers();
result = QGestureRecognizer::TriggerGesture;
singleClickGesture->startSingleClickTimer();
break;
}
case QEvent::MouseMove:
if (singleClickGesture->state() == Qt::GestureStarted
|| singleClickGesture->state() == Qt::GestureUpdated)
{
QMouseEvent* mouseEvent = static_cast<const QMouseEvent *>(event);
int moveDistance = (int) qAbs(QLineF (mouseEvent->posF(), singleClickGesture->m_penDownPos).length());
if (moveDistance > s_tapRadius)
{
// move is outside tap radius or multiple fingers are down, so this is not a tap
singleClickGesture->stopSingleClickTimer();
singleClickGesture->m_triggerSingleClickOnRelease = false;
result = QGestureRecognizer::CancelGesture;
}
}
break;
case QEvent::MouseButtonRelease:
if (singleClickGesture->state() == Qt::GestureStarted
|| singleClickGesture->state() == Qt::GestureUpdated) {
singleClickGesture->m_mouseDown = false;
if (singleClickGesture->m_triggerSingleClickOnRelease) {
result = QGestureRecognizer::FinishGesture;
singleClickGesture->m_triggerSingleClickOnRelease = false;
}
}
if(G_UNLIKELY(g_logSingleClick)){
g_message("SYSMGR PERF: Single Click Occurred time:%d", Time::curTimeMs());
}
break;
case QEvent::MouseButtonDblClick:
if (singleClickGesture->state() == Qt::GestureStarted
|| singleClickGesture->state() == Qt::GestureUpdated)
{
//.........这里部分代码省略.........
示例8: eventFilter
bool KisMirrorAxis::eventFilter(QObject* target, QEvent* event)
{
if(event->type() == QEvent::MouseButtonPress || event->type() == QEvent::TabletPress) {
QMouseEvent* me = static_cast<QMouseEvent*>(event);
if(d->mirrorHorizontal && d->horizontalHandle.contains(me->posF())) {
d->xActive = true;
QApplication::setOverrideCursor(Qt::ClosedHandCursor);
event->accept();
return true;
}
if(d->mirrorVertical && d->verticalHandle.contains(me->posF())) {
d->yActive = true;
QApplication::setOverrideCursor(Qt::ClosedHandCursor);
event->accept();
return true;
}
}
if(event->type() == QEvent::MouseMove || event->type() == QEvent::TabletMove) {
QMouseEvent* me = static_cast<QMouseEvent*>(event);
if(d->xActive) {
float axisX = view()->viewConverter()->widgetToImage<QPoint>(me->pos()).x();
d->setAxisPosition(axisX, d->axisPosition.y());
d->horizontalHandlePosition = KisAlgebra2D::dotProduct<QPointF>(me->pos() - d->horizontalAxis.p1(), d->horizontalAxis.unitVector().p2() - d->horizontalAxis.p1());
event->accept();
return true;
}
if(d->yActive) {
float axisY = view()->viewConverter()->widgetToImage<QPoint>(me->pos()).y();
d->setAxisPosition(d->axisPosition.x(), axisY);
d->verticalHandlePosition = KisAlgebra2D::dotProduct<QPointF>(me->pos() - d->verticalAxis.p1(), d->verticalAxis.unitVector().p2() - d->verticalAxis.p1());
event->accept();
return true;
}
if(d->mirrorHorizontal) {
if(d->horizontalHandle.contains(me->posF())) {
if(!d->horizontalContainsCursor) {
QApplication::setOverrideCursor(Qt::OpenHandCursor);
d->horizontalContainsCursor = true;
}
} else if(d->horizontalContainsCursor) {
QApplication::restoreOverrideCursor();
d->horizontalContainsCursor = false;
}
}
if(d->mirrorVertical) {
if(d->verticalHandle.contains(me->posF())) {
if(!d->verticalContainsCursor) {
QApplication::setOverrideCursor(Qt::OpenHandCursor);
d->verticalContainsCursor = true;
}
} else if(d->verticalContainsCursor) {
QApplication::restoreOverrideCursor();
d->verticalContainsCursor = false;
}
}
}
if(event->type() == QEvent::MouseButtonRelease || event->type() == QEvent::TabletRelease) {
QApplication::restoreOverrideCursor();
if(d->xActive) {
d->xActive = false;
event->accept();
return true;
}
if(d->yActive) {
d->yActive = false;
event->accept();
return true;
}
}
return QObject::eventFilter(target, event);
}
示例9: end
void KisChangePrimarySettingAction::end(QEvent *event)
{
QMouseEvent *mouseEvent = dynamic_cast<QMouseEvent*>(event);
QMouseEvent targetEvent(QEvent::MouseButtonRelease, mouseEvent->pos(), Qt::LeftButton, Qt::LeftButton, Qt::ShiftModifier);
inputManager()->toolProxy()->mouseReleaseEvent(&targetEvent, inputManager()->widgetToPixel(mouseEvent->posF()));
KisAbstractInputAction::end(event);
}
示例10: begin
void KisChangePrimarySettingAction::begin(int shortcut, QEvent *event)
{
KisAbstractInputAction::begin(shortcut, event);
QMouseEvent *mouseEvent = dynamic_cast<QMouseEvent*>(event);
QMouseEvent targetEvent(QEvent::MouseButtonPress, mouseEvent->pos(), Qt::LeftButton, Qt::LeftButton, Qt::ShiftModifier);
inputManager()->toolProxy()->mousePressEvent(&targetEvent, inputManager()->widgetToPixel(mouseEvent->posF()));
}
示例11: end
void KisAlternateInvocationAction::end(QEvent *event)
{
QMouseEvent *mouseEvent = dynamic_cast<QMouseEvent*>(event);
QMouseEvent targetEvent(*mouseEvent);
switch (m_savedShortcut) {
case PrimaryAlternateToggleShortcut:
targetEvent = QMouseEvent(QEvent::MouseButtonRelease, mouseEvent->pos(), Qt::LeftButton, Qt::LeftButton, Qt::ControlModifier);
break;
case SecondaryAlternateToggleShortcut:
targetEvent = QMouseEvent(QEvent::MouseButtonRelease, mouseEvent->pos(), Qt::LeftButton, Qt::LeftButton, Qt::ControlModifier | Qt::AltModifier);
break;
}
inputManager()->toolProxy()->mouseReleaseEvent(&targetEvent, inputManager()->widgetToPixel(mouseEvent->posF()));
KisAbstractInputAction::end(event);
}