equal
deleted
inserted
replaced
51 \ingroup graphicsview-api |
51 \ingroup graphicsview-api |
52 |
52 |
53 |
53 |
54 QGraphicsView visualizes the contents of a QGraphicsScene in a scrollable |
54 QGraphicsView visualizes the contents of a QGraphicsScene in a scrollable |
55 viewport. To create a scene with geometrical items, see QGraphicsScene's |
55 viewport. To create a scene with geometrical items, see QGraphicsScene's |
56 documentation. QGraphicsView is part of \l{The Graphics View Framework}. |
56 documentation. QGraphicsView is part of the \l{Graphics View Framework}. |
57 |
57 |
58 To visualize a scene, you start by constructing a QGraphicsView object, |
58 To visualize a scene, you start by constructing a QGraphicsView object, |
59 passing the address of the scene you want to visualize to QGraphicsView's |
59 passing the address of the scene you want to visualize to QGraphicsView's |
60 constructor. Alternatively, you can call setScene() to set the scene at a |
60 constructor. Alternatively, you can call setScene() to set the scene at a |
61 later point. After you call show(), the view will by default scroll to the |
61 later point. After you call show(), the view will by default scroll to the |
2686 |
2686 |
2687 // enable touch events if any items is interested in them |
2687 // enable touch events if any items is interested in them |
2688 if (d->scene && !d->scene->d_func()->allItemsIgnoreTouchEvents) |
2688 if (d->scene && !d->scene->d_func()->allItemsIgnoreTouchEvents) |
2689 widget->setAttribute(Qt::WA_AcceptTouchEvents); |
2689 widget->setAttribute(Qt::WA_AcceptTouchEvents); |
2690 |
2690 |
|
2691 #ifndef QT_NO_GESTURES |
2691 if (d->scene) { |
2692 if (d->scene) { |
2692 foreach (Qt::GestureType gesture, d->scene->d_func()->grabbedGestures.keys()) |
2693 foreach (Qt::GestureType gesture, d->scene->d_func()->grabbedGestures.keys()) |
2693 widget->grabGesture(gesture); |
2694 widget->grabGesture(gesture); |
2694 } |
2695 } |
|
2696 #endif |
2695 |
2697 |
2696 widget->setAcceptDrops(acceptDrops()); |
2698 widget->setAcceptDrops(acceptDrops()); |
2697 } |
2699 } |
2698 |
2700 |
2699 /*! |
2701 /*! |
2836 (void) QApplication::sendEvent(d->scene, touchEvent); |
2838 (void) QApplication::sendEvent(d->scene, touchEvent); |
2837 } |
2839 } |
2838 |
2840 |
2839 return true; |
2841 return true; |
2840 } |
2842 } |
|
2843 #ifndef QT_NO_GESTURES |
2841 case QEvent::Gesture: |
2844 case QEvent::Gesture: |
2842 case QEvent::GestureOverride: |
2845 case QEvent::GestureOverride: |
2843 { |
2846 { |
2844 if (!isEnabled()) |
2847 if (!isEnabled()) |
2845 return false; |
2848 return false; |
2849 gestureEvent->setWidget(viewport()); |
2852 gestureEvent->setWidget(viewport()); |
2850 (void) QApplication::sendEvent(d->scene, gestureEvent); |
2853 (void) QApplication::sendEvent(d->scene, gestureEvent); |
2851 } |
2854 } |
2852 return true; |
2855 return true; |
2853 } |
2856 } |
|
2857 #endif // QT_NO_GESTURES |
2854 default: |
2858 default: |
2855 break; |
2859 break; |
2856 } |
2860 } |
2857 |
2861 |
2858 return QAbstractScrollArea::viewportEvent(event); |
2862 return QAbstractScrollArea::viewportEvent(event); |