src/hbwidgets/itemviews/hbtreeviewitem.cpp
changeset 21 4633027730f5
parent 6 c3690ec91ef8
child 23 e6ad4ef83b23
equal deleted inserted replaced
7:923ff622b8b9 21:4633027730f5
    29 #include "hbtreeview.h"
    29 #include "hbtreeview.h"
    30 #include "hbabstractitemview.h"
    30 #include "hbabstractitemview.h"
    31 #include "hbabstractitemcontainer_p.h"
    31 #include "hbabstractitemcontainer_p.h"
    32 
    32 
    33 #include <hbnamespace.h>
    33 #include <hbnamespace.h>
       
    34 #include <hbnamespace_p.h>
    34 #include <hbstyle.h>
    35 #include <hbstyle.h>
    35 #include <hbstyleoptiontreeviewitem_p.h>
    36 #include <hbstyleoptiontreeviewitem_p.h>
    36 #include <hbwidgetfeedback.h>
    37 #include <hbwidgetfeedback.h>
    37 #include <hbtapgesture.h>
    38 #include <hbtapgesture.h>
    38 #include <hbeffect.h>
    39 #include <hbeffect.h>
   113     Q_Q(HbTreeViewItem);
   114     Q_Q(HbTreeViewItem);
   114 
   115 
   115     HbStyleOptionTreeViewItem styleOption;
   116     HbStyleOptionTreeViewItem styleOption;
   116     q->initStyleOption(&styleOption);
   117     q->initStyleOption(&styleOption);
   117 
   118 
   118     q->style()->updatePrimitive(mExpandItem, HbStyle::P_TreeViewItem_expandicon, &styleOption);
   119     HbStylePrivate::updatePrimitive(mExpandItem, HbStylePrivate::P_TreeViewItem_expandicon, &styleOption);
   119 }
   120 }
   120 
   121 
   121 void HbTreeViewItemPrivate::tapTriggered(QGestureEvent *event)
   122 void HbTreeViewItemPrivate::tapTriggered(QGestureEvent *event)
   122 {
   123 {
   123     Q_Q(HbTreeViewItem);
   124     Q_Q(HbTreeViewItem);
   124 
   125 
   125     HbTapGesture *gesture = static_cast<HbTapGesture *>(event->gesture(Qt::TapGesture));
   126     HbTapGesture *gesture = static_cast<HbTapGesture *>(event->gesture(Qt::TapGesture));
   126 
   127 
   127     if (gesture->state() == Qt::GestureFinished 
   128     if (gesture->state() == Qt::GestureFinished 
   128         && gesture->tapStyleHint() == HbTapGesture::Tap) {
   129         && gesture->tapStyleHint() == HbTapGesture::Tap) {
       
   130         q->scene()->setProperty(HbPrivate::OverridingGesture.latin1(),QVariant());
   129 
   131 
   130         QPointF position = event->mapToGraphicsScene(gesture->hotSpot());
   132         QPointF position = event->mapToGraphicsScene(gesture->hotSpot());
   131         position = q->mapFromScene(position);
   133         position = q->mapFromScene(position);
   132 
   134 
   133         bool inSelectionArea = false;
   135         bool inSelectionArea = false;
   236 
   238 
   237     const QAbstractItemModel *model = d->mIndex.model();
   239     const QAbstractItemModel *model = d->mIndex.model();
   238 
   240 
   239     if (model && model->hasChildren(d->mIndex) && sd->mUserExpandable) {
   241     if (model && model->hasChildren(d->mIndex) && sd->mUserExpandable) {
   240         if (!d->mExpandItem) {
   242         if (!d->mExpandItem) {
   241             d->mExpandItem = style()->createPrimitive(HbStyle::P_TreeViewItem_expandicon, this);
   243             d->mExpandItem = HbStylePrivate::createPrimitive(HbStylePrivate::P_TreeViewItem_expandicon, this);
   242             d->mItemsChanged = true;
   244             d->mItemsChanged = true;
   243         }
   245         }
   244     } else {
   246     } else {
   245         if (d->mExpandItem) {
   247         if (d->mExpandItem) {
   246             d->mItemsChanged = true;
   248             d->mItemsChanged = true;
   380 /*!
   382 /*!
   381     \reimp
   383     \reimp
   382     
   384     
   383     In the base class the multiselection mode selection area is the whole item. In HbTreeView this is not
   385     In the base class the multiselection mode selection area is the whole item. In HbTreeView this is not
   384     possible because of the expansion icon. For the HbTreeView the selection area in multiselection mode is 
   386     possible because of the expansion icon. For the HbTreeView the selection area in multiselection mode is 
   385     defined by the primitive HbStyle::P_ItemViewItem_touchmultiselection
   387     defined by the primitive HbStylePrivate::P_ItemViewItem_touchmultiselection
   386 */
   388 */
   387 bool HbTreeViewItem::selectionAreaContains(const QPointF &position, SelectionAreaType selectionAreaType) const
   389 bool HbTreeViewItem::selectionAreaContains(const QPointF &position, SelectionAreaType selectionAreaType) const
   388 {
   390 {
   389     Q_D(const HbTreeViewItem);
   391     Q_D(const HbTreeViewItem);
   390     if (   selectionAreaType == HbAbstractViewItem::MultiSelection 
   392     if (   selectionAreaType == HbAbstractViewItem::MultiSelection