本文整理汇总了C++中QMouseEvent::isAccepted方法的典型用法代码示例。如果您正苦于以下问题:C++ QMouseEvent::isAccepted方法的具体用法?C++ QMouseEvent::isAccepted怎么用?C++ QMouseEvent::isAccepted使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QMouseEvent
的用法示例。
在下文中一共展示了QMouseEvent::isAccepted方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mouseReleaseEvent
bool PicItem::mouseReleaseEvent( const EventInfo &info )
{
QMouseEvent *e = info.mouseReleaseEvent( 0, 0 );
if ( !m_pressed ) {
delete e;
return CNItem::mouseReleaseEvent( info );
}
const PinItemList::iterator end = m_pinItemList.end();
for ( PinItemList::iterator it = m_pinItemList.begin(); it != end; ++it )
if ( !e->isAccepted() ) {
continue;
} else if ( (*it)->boundingRect().contains(m_pos) && (*it)->boundingRect().contains( info.pos ) ) {
if ( m_dragged ) {
(*it)->dragged( m_dx );
} else {
(*it)->switchState();
}
m_pressed = false;
m_dragged = false;
m_pos = QPoint();
m_dx = 0;
delete e;
return true;
}
delete e;
return CNItem::mouseReleaseEvent( info );
}
示例2: 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());
}
示例3: mouseReleaseEvent
void CurveEditorItem::mouseReleaseEvent(QMouseEvent* event)
{
QMouseEvent* mouseEvent = new QMouseEvent(event->type(), event->pos(), event->button(), event->buttons(), event->modifiers());
d->curveWidget->mouseReleaseEvent(mouseEvent);
if(mouseEvent->isAccepted()) {
event->accept();
}
d->repaint();
}
示例4: mousePressEvent
void CurveEditorItem::mousePressEvent(QGraphicsSceneMouseEvent* event)
{
QMouseEvent* mouseEvent = new QMouseEvent(event->type(), event->pos().toPoint(), event->button(), event->buttons(), event->modifiers());
d->curveWidget->mousePressEvent(mouseEvent);
if(mouseEvent->isAccepted()) {
event->accept();
}
d->repaint();
}
示例5: mouseMoveEvent
bool PicItem::mouseMoveEvent( const EventInfo &info )
{
QMouseEvent *e = info.mouseMoveEvent( 0, 0 );
const PinItemList::iterator end = m_pinItemList.end();
for ( PinItemList::iterator it = m_pinItemList.begin(); it != end; ++it )
if ( e->isAccepted() && (*it)->boundingRect().contains( info.pos ) ) {
QPoint vec = info.pos - m_pos;
if ( m_pressed && vec.manhattanLength() > 4 ) {
m_dragged = true;
m_dx = vec.x();
}
delete e;
return true;
}
delete e;
return CNItem::mouseMoveEvent( info );
}
示例6: mousePressEvent
bool PicItem::mousePressEvent( const EventInfo &info )
{
QMouseEvent *e = info.mousePressEvent( 0, 0 );
const PinItemList::iterator end = m_pinItemList.end();
for ( PinItemList::iterator it = m_pinItemList.begin(); it != end; ++it )
if ( e->isAccepted() && (*it)->boundingRect().contains( info.pos ) ) {
//reset mouse-gesture state
m_pressed = true;
m_pos = info.pos;
m_dragged = false;
m_dx = 0;
delete e;
return true;
}
m_pressed = false;
delete e;
return CNItem::mousePressEvent( info );
}
示例7: sendWidgetMouseEvent
/*!
\internal
*/
void QGraphicsProxyWidgetPrivate::sendWidgetMouseEvent(QGraphicsSceneMouseEvent *event)
{
if (!event || !widget || !widget->isVisible())
return;
Q_Q(QGraphicsProxyWidget);
// Find widget position and receiver.
QPointF pos = event->pos();
QPointer<QWidget> alienWidget = widget->childAt(pos.toPoint());
QPointer<QWidget> receiver = alienWidget ? alienWidget : widget;
if (QWidgetPrivate::nearestGraphicsProxyWidget(receiver) != q)
return; //another proxywidget will handle the events
// Translate QGraphicsSceneMouse events to QMouseEvents.
QEvent::Type type = QEvent::None;
switch (event->type()) {
case QEvent::GraphicsSceneMousePress:
type = QEvent::MouseButtonPress;
if (!embeddedMouseGrabber)
embeddedMouseGrabber = receiver;
else
receiver = embeddedMouseGrabber;
break;
case QEvent::GraphicsSceneMouseRelease:
type = QEvent::MouseButtonRelease;
if (embeddedMouseGrabber)
receiver = embeddedMouseGrabber;
break;
case QEvent::GraphicsSceneMouseDoubleClick:
type = QEvent::MouseButtonDblClick;
if (!embeddedMouseGrabber)
embeddedMouseGrabber = receiver;
else
receiver = embeddedMouseGrabber;
break;
case QEvent::GraphicsSceneMouseMove:
type = QEvent::MouseMove;
if (embeddedMouseGrabber)
receiver = embeddedMouseGrabber;
break;
default:
Q_ASSERT_X(false, "QGraphicsProxyWidget", "internal error");
break;
}
if (!lastWidgetUnderMouse) {
QApplicationPrivate::dispatchEnterLeave(embeddedMouseGrabber ? embeddedMouseGrabber : widget, 0);
lastWidgetUnderMouse = widget;
}
// Map event position from us to the receiver
pos = mapToReceiver(pos, receiver);
// Send mouse event.
QMouseEvent *mouseEvent = QMouseEvent::createExtendedMouseEvent(type, pos,
receiver->mapToGlobal(pos.toPoint()), event->button(),
event->buttons(), event->modifiers());
QWidget *embeddedMouseGrabberPtr = (QWidget *)embeddedMouseGrabber;
QApplicationPrivate::sendMouseEvent(receiver, mouseEvent, alienWidget, widget,
&embeddedMouseGrabberPtr, lastWidgetUnderMouse, event->spontaneous());
embeddedMouseGrabber = embeddedMouseGrabberPtr;
// Handle enter/leave events when last button is released from mouse
// grabber child widget.
if (embeddedMouseGrabber && type == QEvent::MouseButtonRelease && !event->buttons()) {
Q_Q(QGraphicsProxyWidget);
if (q->rect().contains(event->pos()) && q->acceptsHoverEvents())
lastWidgetUnderMouse = alienWidget ? alienWidget : widget;
else // released on the frame our outside the item, or doesn't accept hover events.
lastWidgetUnderMouse = 0;
QApplicationPrivate::dispatchEnterLeave(lastWidgetUnderMouse, embeddedMouseGrabber);
embeddedMouseGrabber = 0;
#ifndef QT_NO_CURSOR
// ### Restore the cursor, don't override it.
if (!lastWidgetUnderMouse)
q->unsetCursor();
#endif
}
event->setAccepted(mouseEvent->isAccepted());
delete mouseEvent;
}