src/hbwidgets/itemviews/hbabstractitemview_p.cpp
changeset 28 b7da29130b0e
parent 23 e6ad4ef83b23
child 30 80e4d18b72f5
equal deleted inserted replaced
23:e6ad4ef83b23 28:b7da29130b0e
    68 {
    68 {
    69 }
    69 }
    70 
    70 
    71 HbAbstractItemViewPrivate::~HbAbstractItemViewPrivate()
    71 HbAbstractItemViewPrivate::~HbAbstractItemViewPrivate()
    72 {
    72 {
    73     if (mModelIterator) {
    73     delete mModelIterator;
    74         delete mModelIterator;
       
    75         mModelIterator = 0;
       
    76     }
       
    77 }
    74 }
    78 
    75 
    79 /*!
    76 /*!
    80 
    77 
    81 */
    78 */
    82 void HbAbstractItemViewPrivate::init(HbAbstractItemContainer *container, HbModelIterator *modelIterator)
    79 void HbAbstractItemViewPrivate::init(HbAbstractItemContainer *container, HbModelIterator *modelIterator)
    83 {
    80 {
    84     Q_Q(HbAbstractItemView);
    81     Q_Q(HbAbstractItemView);
    85 
    82 
    86     q->setLongPressEnabled(true);
       
    87     q->setFlag(QGraphicsItem::ItemIsFocusable, true);
    83     q->setFlag(QGraphicsItem::ItemIsFocusable, true);
    88     q->setFocusPolicy(Qt::StrongFocus);
    84     q->setFocusPolicy(Qt::StrongFocus);
    89     
    85     
    90     q->setContentWidget(container);
    86     q->setContentWidget(container);
    91 
    87 
    92     q->grabGesture(Qt::PanGesture);
       
    93 
       
    94     //mAlignment = 0; // no alignment - there is no sense with recycling
       
    95 
       
    96     mContainer = container;
    88     mContainer = container;
    97     mContainer->setItemView(q);
    89     mContainer->setItemView(q);
    98 
    90 
    99     mModelIterator = modelIterator;
    91     mModelIterator = modelIterator;
   100 
    92 
   101     q->connect(mContainer, SIGNAL(itemCreated(HbAbstractViewItem *)),
    93     q->connect(mContainer, SIGNAL(itemCreated(HbAbstractViewItem *)),
   102             q, SLOT(itemCreated(HbAbstractViewItem *)));
    94             q, SLOT(itemCreated(HbAbstractViewItem *)));
   103 
    95 
   104     HbMainWindow *window = q->mainWindow();
    96     HbMainWindow *window = q->mainWindow();
   105     if (window
    97     if (window && q->scene()) { // added to scene
   106         && q->scene()) { // added to scene
       
   107         q->connect(window, SIGNAL(aboutToChangeOrientation()),
    98         q->connect(window, SIGNAL(aboutToChangeOrientation()),
   108                    q, SLOT(orientationAboutToBeChanged()));
    99                    q, SLOT(orientationAboutToBeChanged()));
   109 
   100 
   110         q->connect(window, SIGNAL(orientationChanged(Qt::Orientation)),
   101         q->connect(window, SIGNAL(orientationChanged(Qt::Orientation)),
   111                    q, SLOT(orientationChanged(Qt::Orientation)));
   102                    q, SLOT(orientationChanged(Qt::Orientation)));
   747 {
   738 {
   748     Q_Q(const HbAbstractItemView);
   739     Q_Q(const HbAbstractItemView);
   749     bool visible = false;
   740     bool visible = false;
   750     if (item) {
   741     if (item) {
   751         QRectF itemRect(itemBoundingRect(item));
   742         QRectF itemRect(itemBoundingRect(item));
       
   743         // 0.5 tolerance otherwise it fail - for instance if pos.y = -5.68434e-14 then item will be not fullyVisible
       
   744         itemRect.adjust(0.5, 0.5, -0.5, -0.5);
   752         QRectF abstractViewRect(itemBoundingRect(q));
   745         QRectF abstractViewRect(itemBoundingRect(q));
   753         if (fullyVisible) {
   746         if (fullyVisible) {
   754             if (abstractViewRect.contains(itemRect)) {
   747             if (abstractViewRect.contains(itemRect)) {
   755                 visible = true;
   748                 visible = true;
   756             }
   749             }