src/hbwidgets/itemviews/hbabstractitemview.cpp
changeset 30 80e4d18b72f5
parent 28 b7da29130b0e
equal deleted inserted replaced
28:b7da29130b0e 30:80e4d18b72f5
    26 #include "hbabstractitemview.h"
    26 #include "hbabstractitemview.h"
    27 #include "hbabstractitemview_p.h"
    27 #include "hbabstractitemview_p.h"
    28 #include "hbabstractitemcontainer_p_p.h"
    28 #include "hbabstractitemcontainer_p_p.h"
    29 
    29 
    30 #include <hbabstractviewitem.h>
    30 #include <hbabstractviewitem.h>
       
    31 #include <hbabstractviewitem_p.h>
    31 #include <hbevent.h>
    32 #include <hbevent.h>
    32 #include <hbabstractitemcontainer_p.h>
    33 #include <hbabstractitemcontainer_p.h>
    33 #include <hbwidgetfeedback.h>
    34 #include <hbwidgetfeedback.h>
    34 #include <hbinstance.h>
    35 #include <hbinstance.h>
    35 #include <hbscrollbar.h>
    36 #include <hbscrollbar.h>
   220 
   221 
   221 /*!
   222 /*!
   222     \var HbAbstractItemView::All
   223     \var HbAbstractItemView::All
   223 
   224 
   224     Every animation is applied. 
   225     Every animation is applied. 
       
   226 */
       
   227 
       
   228 /*!
       
   229     \enum HbAbstractItemView::IconLoadPolicy
       
   230 
       
   231     Icon load policies that can be used to control how icon data is loaded to items.
       
   232 */
       
   233 
       
   234 /*!
       
   235     \var HbAbstractItemView::LoadSynchronously
       
   236 
       
   237     Icon items data is loaded always synchronously. In this mode the icon items data fetch will block the processing.
       
   238     This can lead to longer item creation and data update times and poor performance while scrolling when fetching data 
       
   239     takes long time. 
       
   240     
       
   241     But on the other hand icon content is guaranteed to be painted immediately and no empty areas caused
       
   242     by asynchronous data fetch are visible.
       
   243 */
       
   244 
       
   245 /*!
       
   246     \var HbAbstractItemView::LoadAsynchronouslyWhenScrolling
       
   247 
       
   248     Icon data is loaded asynchronously while scrolling but otherwise it will be fetched synchronously. 
       
   249 */
       
   250 
       
   251 /*!
       
   252     \var HbAbstractItemView::LoadAsynchronouslyAlways
       
   253 
       
   254     Icon data is loaded always asynchronously. In this mode the icon data fetch will not block the processing 
       
   255     so it will not cause delays to item creation or data updated times. This can also lead to better scrolling 
       
   256     performance when item recycling delay will be shared between different frames. 
       
   257 
       
   258     But on the other hand icon content is not guaranteed to be painted immediately and this can cause empty areas 
       
   259     to be painted while asynchronous data is being fetched.
       
   260 
       
   261     This is the default mode.
   225 */
   262 */
   226 
   263 
   227 /*!
   264 /*!
   228     Here are the main properties of the class:
   265     Here are the main properties of the class:
   229 
   266 
  1043     
  1080     
  1044     d->mLayoutOptionName = layoutName;
  1081     d->mLayoutOptionName = layoutName;
  1045     
  1082     
  1046     QList<HbAbstractViewItem *> items = d->mContainer->items();
  1083     QList<HbAbstractViewItem *> items = d->mContainer->items();
  1047     foreach (HbAbstractViewItem *item, items) {
  1084     foreach (HbAbstractViewItem *item, items) {
  1048         QEvent* polishEvent = new QEvent( QEvent::Polish );
  1085         HbAbstractViewItemPrivate::d_ptr(item)->repolishItem();
  1049         QCoreApplication::postEvent(item, polishEvent);
       
  1050     }
  1086     }
  1051 } 
  1087 } 
  1052 
  1088 
  1053 /*!
  1089 /*!
  1054     Sets the property informing whether all items in the item view have the same size.
  1090     Sets the property informing whether all items in the item view have the same size.
  1309     Q_D(const HbAbstractItemView);
  1345     Q_D(const HbAbstractItemView);
  1310     return d->mItemPixmapCacheEnabled;
  1346     return d->mItemPixmapCacheEnabled;
  1311 }
  1347 }
  1312 
  1348 
  1313 /*!
  1349 /*!
       
  1350     Sets the value of the iconLoadPolicy property.
       
  1351 
       
  1352     The default value is HbAbstractItemView::LoadAsynchronouslyAlways.
       
  1353 
       
  1354     \sa HbAbstractItemView::iconLoadPolicy(), HbAbstractItemView::IconLoadPolicy
       
  1355 */
       
  1356 void HbAbstractItemView::setIconLoadPolicy(IconLoadPolicy policy)
       
  1357 {
       
  1358     Q_D(HbAbstractItemView);
       
  1359     if (d->mIconLoadPolicy != policy) {
       
  1360         d->mIconLoadPolicy = policy;
       
  1361         
       
  1362         foreach (HbAbstractViewItem *prototype, itemPrototypes()) {
       
  1363             HbAbstractViewItemPrivate::d_ptr(prototype)->mSharedData->updateIconItemsAsyncMode();
       
  1364         }
       
  1365     }
       
  1366 }
       
  1367 
       
  1368 /*!
       
  1369     Returns current icon load policy used by view.
       
  1370 
       
  1371     \sa HbAbstractItemView::setIconLoadPolicy()
       
  1372 */
       
  1373 HbAbstractItemView::IconLoadPolicy HbAbstractItemView::iconLoadPolicy() const
       
  1374 {
       
  1375     Q_D(const HbAbstractItemView);
       
  1376     return d->mIconLoadPolicy;
       
  1377 }
       
  1378 
       
  1379 /*!
  1314     Slot handles QAbstractItemModel::layoutChanged() signal. 
  1380     Slot handles QAbstractItemModel::layoutChanged() signal. 
  1315     Default implementation sets first model item visible as first view item if the 
  1381     Default implementation sets first model item visible as first view item if the 
  1316     buffer items needed to be modified. QSortFilterProxyModel sends layoutChanged 
  1382     buffer items needed to be modified. QSortFilterProxyModel sends layoutChanged 
  1317     signal whenever there is a dataChange in the model but in that case the container should
  1383     signal whenever there is a dataChange in the model but in that case the container should
  1318     not be scrolled. 
  1384     not be scrolled.