24 ****************************************************************************/ |
24 ****************************************************************************/ |
25 |
25 |
26 #include "hbabstractitemview_p.h" |
26 #include "hbabstractitemview_p.h" |
27 #include "hbabstractitemview.h" |
27 #include "hbabstractitemview.h" |
28 #include "hbabstractviewitem.h" |
28 #include "hbabstractviewitem.h" |
29 #include "hbabstractitemcontainer.h" |
29 #include "hbabstractitemcontainer_p.h" |
30 #include "hbmodeliterator.h" |
30 #include "hbmodeliterator.h" |
31 |
31 |
32 #include <hbinstance.h> |
32 #include <hbinstance.h> |
33 #include <hbscrollbar.h> |
33 #include <hbscrollbar.h> |
34 #include <hbapplication.h> |
34 #include <hbapplication.h> |
35 #include <hbeffect.h> |
35 #include <hbeffect.h> |
36 #include <hbpangesture.h> |
36 #include <hbpangesture.h> |
|
37 #include <hbwidgetfeedback.h> |
37 |
38 |
38 #include <QGraphicsSceneMouseEvent> |
39 #include <QGraphicsSceneMouseEvent> |
39 #include <QEvent> |
40 #include <QEvent> |
40 #include <QItemSelectionModel> |
41 #include <QItemSelectionModel> |
41 #include <QGraphicsScene> |
42 #include <QGraphicsScene> |
425 break; |
426 break; |
426 } |
427 } |
427 } |
428 } |
428 return retVal; |
429 return retVal; |
429 } |
430 } |
|
431 else if (!mDoingContiguousSelection){ |
|
432 HbWidgetFeedback::continuousTriggered(q, Hb::ContinuousScrolled); |
|
433 } |
430 break; |
434 break; |
431 } |
435 } |
432 case Qt::GestureFinished: |
436 case Qt::GestureFinished: |
433 case Qt::GestureCanceled: { |
437 case Qt::GestureCanceled: { |
434 mOptions &= ~PanningActive; |
438 mOptions &= ~PanningActive; |
435 if (mDoingContiguousSelection) { |
439 if (mDoingContiguousSelection) { |
436 stopAnimating(); |
440 stopAnimating(); |
437 mDoingContiguousSelection = false; |
441 mDoingContiguousSelection = false; |
438 return true; |
442 return true; |
439 } |
443 } |
|
444 else { |
|
445 HbWidgetFeedback::continuousStopped(q, Hb::ContinuousScrolled); |
|
446 } |
440 break; |
447 break; |
441 } |
448 } |
442 default: |
449 default: |
443 break; |
450 break; |
444 } |
451 } |
525 Q_Q(HbAbstractItemView); |
532 Q_Q(HbAbstractItemView); |
526 |
533 |
527 QPointF result(0,0); |
534 QPointF result(0,0); |
528 |
535 |
529 if (item) { |
536 if (item) { |
530 refreshContainerGeometry(); |
537 mContainer->resizeContainer(); |
531 |
538 |
532 QRectF itemRect = itemBoundingRect(item); |
539 QRectF itemRect = itemBoundingRect(item); |
533 QRectF viewRect = q->boundingRect(); |
540 QRectF viewRect = q->boundingRect(); |
534 |
541 |
535 if (!viewRect.isValid()) { |
542 if (!viewRect.isValid()) { |
722 return hitItem; |
729 return hitItem; |
723 } |
730 } |
724 return hitItem; |
731 return hitItem; |
725 } |
732 } |
726 |
733 |
727 /*! |
|
728 |
|
729 */ |
|
730 void HbAbstractItemViewPrivate::refreshContainerGeometry() |
|
731 { |
|
732 Q_Q(const HbAbstractItemView); |
|
733 |
|
734 if (mContainer->layout()) { |
|
735 if (!mContainer->layout()->isActivated()) { |
|
736 // Make sure that the layout process has stopped. |
|
737 mContainer->layout()->activate(); |
|
738 } |
|
739 } |
|
740 |
|
741 QSizeF newSize = mContainer->effectiveSizeHint(Qt::PreferredSize); |
|
742 |
|
743 if (!mScrollDirections.testFlag(Qt::Vertical)) { |
|
744 newSize.setHeight(q->size().height()); |
|
745 } |
|
746 |
|
747 if (!mScrollDirections.testFlag(Qt::Horizontal)) { |
|
748 newSize.setWidth(q->size().width()); |
|
749 } |
|
750 |
|
751 mContainer->resize( newSize ); |
|
752 } |
|
753 |
|
754 |
734 |
755 QRectF HbAbstractItemViewPrivate::itemBoundingRect(const QGraphicsItem *item) const |
735 QRectF HbAbstractItemViewPrivate::itemBoundingRect(const QGraphicsItem *item) const |
756 { |
736 { |
757 Q_Q(const HbAbstractItemView); |
737 Q_Q(const HbAbstractItemView); |
758 |
738 |
999 if (item && event){ |
979 if (item && event){ |
1000 switch (mSelectionMode) { |
980 switch (mSelectionMode) { |
1001 case HbAbstractItemView::SingleSelection: |
981 case HbAbstractItemView::SingleSelection: |
1002 flags = singleSelectionCommand(item, event); |
982 flags = singleSelectionCommand(item, event); |
1003 break; |
983 break; |
1004 case HbAbstractItemView::MultiSelection: |
984 case HbAbstractItemView::MultiSelection: { |
1005 case HbAbstractItemView::ContiguousSelection: { |
|
1006 flags = multiSelectionCommand(item, event); |
985 flags = multiSelectionCommand(item, event); |
1007 break; |
986 break; |
1008 } |
987 } |
1009 case HbAbstractItemView::NoSelection: // Never update selection model |
988 case HbAbstractItemView::NoSelection: // Never update selection model |
1010 break; |
989 break; |
1036 |
1015 |
1037 mAppearAnimationIndexes.append(index); |
1016 mAppearAnimationIndexes.append(index); |
1038 } |
1017 } |
1039 } |
1018 } |
1040 |
1019 |
1041 refreshContainerGeometry(); |
1020 |
|
1021 if (mContainer->layout()) { |
|
1022 mContainer->layout()->activate(); |
|
1023 } |
1042 |
1024 |
1043 HbEffect::start(items, itemType, effectEvent, q, "_q_animationFinished"); |
1025 HbEffect::start(items, itemType, effectEvent, q, "_q_animationFinished"); |
1044 } |
1026 } |
1045 |
1027 |
1046 void HbAbstractItemViewPrivate::ensureVisible(QPointF position, qreal xMargin, qreal yMargin) |
1028 void HbAbstractItemViewPrivate::ensureVisible(QPointF position, qreal xMargin, qreal yMargin) |