src/hbwidgets/itemviews/hbabstractitemview_p.h
changeset 1 f7ac710697a9
parent 0 16d8024aca5e
child 2 06ff229162e9
equal deleted inserted replaced
0:16d8024aca5e 1:f7ac710697a9
    47 
    47 
    48 QT_BEGIN_NAMESPACE
    48 QT_BEGIN_NAMESPACE
    49 class QModelIndex;
    49 class QModelIndex;
    50 class QEvent;
    50 class QEvent;
    51 class QTimer;
    51 class QTimer;
       
    52 class QGestureEvent;
    52 QT_END_NAMESPACE
    53 QT_END_NAMESPACE
    53 
    54 
    54 class HbAbstractItemContainer;
    55 class HbAbstractItemContainer;
    55 class HbAbstractViewItem;
    56 class HbAbstractViewItem;
    56 class HbModelIterator;
    57 class HbModelIterator;
    87     // use ItemPosition as position
    88     // use ItemPosition as position
    88     QPointF pixelsToScroll(const HbAbstractViewItem *item, HbAbstractItemView::ScrollHint hint);
    89     QPointF pixelsToScroll(const HbAbstractViewItem *item, HbAbstractItemView::ScrollHint hint);
    89 
    90 
    90     void saveIndexMadeVisibleAfterMetricsChange();
    91     void saveIndexMadeVisibleAfterMetricsChange();
    91 
    92 
    92     QItemSelectionModel::SelectionFlags  contiguousSelectionCommand(
       
    93             const HbAbstractViewItem *item, const QEvent *event );
       
    94     QItemSelectionModel::SelectionFlags multiSelectionCommand(
    93     QItemSelectionModel::SelectionFlags multiSelectionCommand(
    95             const HbAbstractViewItem *item, const QEvent *event );
    94             const HbAbstractViewItem *item, const QEvent *event );
    96     QItemSelectionModel::SelectionFlags singleSelectionCommand(
    95     QItemSelectionModel::SelectionFlags singleSelectionCommand(
    97             const HbAbstractViewItem *item, const QEvent *event );
    96             const HbAbstractViewItem *item, const QEvent *event );
    98 
    97 
   101     virtual bool visible(HbAbstractViewItem* item, bool fullyVisible = true) const;
   100     virtual bool visible(HbAbstractViewItem* item, bool fullyVisible = true) const;
   102 
   101 
   103     HbAbstractViewItem* currentItem() const;
   102     HbAbstractViewItem* currentItem() const;
   104     
   103     
   105     HbAbstractViewItem* viewItem(QGraphicsItem *item) const;
   104     HbAbstractViewItem* viewItem(QGraphicsItem *item) const;
   106     
       
   107     void updateScrollBar(Qt::Orientation orientation);
       
   108 
   105 
   109     void refreshContainerGeometry();
   106     void refreshContainerGeometry();
   110 
   107 
   111     QRectF itemBoundingRect(const QGraphicsItem *item) const;
   108     QRectF itemBoundingRect(const QGraphicsItem *item) const;
   112 
   109 
   114 
   111 
   115     virtual void scrollTo(const QModelIndex &index, HbAbstractItemView::ScrollHint hint);
   112     virtual void scrollTo(const QModelIndex &index, HbAbstractItemView::ScrollHint hint);
   116     void revealItem(const HbAbstractViewItem *item, HbAbstractItemView::ScrollHint hint);
   113     void revealItem(const HbAbstractViewItem *item, HbAbstractItemView::ScrollHint hint);
   117     void checkBoundaries(QPointF &newPos);
   114     void checkBoundaries(QPointF &newPos);
   118 
   115 
   119     void updateScrollBarForUniformSizedItems();
       
   120     void updateScrollBarForVariableSizedItems();
       
   121     void setScrollBarMetrics(Qt::Orientation orientation);
   116     void setScrollBarMetrics(Qt::Orientation orientation);
   122     bool handleScrollBar(Qt::Orientation orientation);
   117     virtual bool handleScrollBar(Qt::Orientation orientation);
       
   118     void updateScrollBar(Qt::Orientation orientation);
   123 
   119 
   124     void rowsRemoved(const QModelIndex &parent, int start, int end);
   120     void rowsRemoved(const QModelIndex &parent, int start, int end);
   125 
   121 
   126     virtual QItemSelectionModel::SelectionFlags selectionFlags( 
   122     virtual QItemSelectionModel::SelectionFlags selectionFlags( 
   127                                                     const HbAbstractViewItem *item, 
   123                                                     const HbAbstractViewItem *item, 
   128                                                     const QEvent *event);
   124                                                     const QEvent *event);
   129     void resetContainer();
   125     void resetContainer();
   130     void startAppearEffect(const QModelIndex &parent, int start, int end);
   126     void startAppearEffect(const QString &itemType, const QString &effectEvent, const QModelIndex &parent, int start, int end);
       
   127 
       
   128     virtual bool animationEnabled(bool insertOperation);
       
   129 
   131     virtual void ensureVisible(QPointF position, qreal xMargin, qreal yMargin);
   130     virtual void ensureVisible(QPointF position, qreal xMargin, qreal yMargin);
   132 
   131 
   133     void _q_modelDestroyed();
   132     void _q_modelDestroyed();
   134     void _q_layoutChanged();
       
   135     void _q_animationEnabled();
   133     void _q_animationEnabled();
   136     void _q_animationFinished(const HbEffect::EffectStatus &status);
   134     void _q_animationFinished(const HbEffect::EffectStatus &status);
       
   135     void _q_scrolling(QPointF newPosition);
       
   136     void _q_scrollingEnded();
       
   137     void _q_scrollingStarted();
       
   138 
       
   139     void setContentPosition(qreal value, Qt::Orientation orientation, bool animate);
       
   140 
       
   141     virtual bool panTriggered(QGestureEvent *event);
   137 
   142 
   138 public:
   143 public:
   139     QPersistentModelIndex mCurrentIndex;
   144     QPersistentModelIndex mCurrentIndex;
   140 
   145 
   141     HbAbstractItemView::SelectionMode mSelectionMode;
   146     HbAbstractItemView::SelectionMode mSelectionMode;
   142 
   147 
   143     ItemViewOptions mOptions;
   148     ItemViewOptions mOptions;
   144 
   149 
   145     SelectionSettings mSelectionSettings;
   150     SelectionSettings mSelectionSettings;
   146 
   151 
   147     QPointer<HbAbstractViewItem> mHitItem;
       
   148 
       
   149     // mContainer can always be assumed to be valid in the code
   152     // mContainer can always be assumed to be valid in the code
   150     HbAbstractItemContainer *mContainer;
   153     HbAbstractItemContainer *mContainer;
   151 
   154 
   152     QModelIndex mVisibleIndex;
   155     QModelIndex mVisibleIndex;
   153 
   156 
   154     QItemSelectionModel *mSelectionModel;
   157     QItemSelectionModel *mSelectionModel;
   155     QItemSelectionModel::SelectionFlag mContSelectionAction;
   158     QItemSelectionModel::SelectionFlag mContSelectionAction;
   156 
   159 
   157     bool mWasScrolling;
       
   158     QString mLayoutOptionName;
   160     QString mLayoutOptionName;
   159     bool mFilterRemoved;
       
   160     bool mClearingSelection;
   161     bool mClearingSelection;
   161 
   162 
   162     bool mAnimateItems;
   163     bool mAnimateItems;
   163     QList< QGraphicsItem * >mItemsAboutToBeDeleted;
   164     QList< QGraphicsItem * >mItemsAboutToBeDeleted;
   164 
   165 
   165     // introduced to solve scrollto problem when view is not visible
   166     // introduced to solve scrollto problem when view is not visible
   166     QPersistentModelIndex mPostponedScrollIndex;
   167     QPersistentModelIndex mPostponedScrollIndex;
   167     HbAbstractItemView::ScrollHint mPostponedScrollHint;
   168     HbAbstractItemView::ScrollHint mPostponedScrollHint;
   168     QModelIndex mPreviousSelectedIndex;
   169     QModelIndex mPreviousSelectedIndex;
   169     QItemSelectionModel::SelectionFlags mPreviousSelectedCommand;
   170     QItemSelectionModel::SelectionFlags mPreviousSelectedCommand;
   170     Hb::InteractionModifiers mInstantClickedModifiers;
       
   171 
   171 
   172     QTimer *mAnimationTimer;
   172     QTimer *mAnimationTimer;
   173     QList< QPersistentModelIndex > mAppearAnimationIndexes;
   173     QList< QPersistentModelIndex > mAppearAnimationIndexes;
   174 
   174 
   175     HbModelIterator *mModelIterator;
   175     HbModelIterator *mModelIterator;
   176     HbAbstractItemView::ItemAnimations mEnabledAnimations;
   176     HbAbstractItemView::ItemAnimations mEnabledAnimations;
       
   177 
       
   178     bool mLongPressEnabled;
       
   179 
       
   180     bool mOrigFriction;
       
   181     bool mDoingContiguousSelection;
       
   182     QPointF mPositionInContiguousSelection;
   177 
   183 
   178 private:
   184 private:
   179     static HbAbstractItemViewPrivate *d_ptr(HbAbstractItemView *abstractItemView) {
   185     static HbAbstractItemViewPrivate *d_ptr(HbAbstractItemView *abstractItemView) {
   180         Q_ASSERT(abstractItemView);
   186         Q_ASSERT(abstractItemView);
   181         return abstractItemView->d_func();
   187         return abstractItemView->d_func();