equal
deleted
inserted
replaced
215 d->q_ptr = this; |
215 d->q_ptr = this; |
216 d->init(container, modelIterator); |
216 d->init(container, modelIterator); |
217 } |
217 } |
218 |
218 |
219 /*! |
219 /*! |
|
220 Constructs a new HbAbstractItemView with \a parent. |
|
221 */ |
|
222 HbAbstractItemView::HbAbstractItemView(HbAbstractItemContainer *container, |
|
223 HbModelIterator *modelIterator, |
|
224 QGraphicsItem *parent) |
|
225 : HbScrollArea(*new HbAbstractItemViewPrivate, parent) |
|
226 { |
|
227 Q_D(HbAbstractItemView); |
|
228 Q_ASSERT_X(container, "HbAbstractItemView constructor", "Container is null"); |
|
229 |
|
230 d->q_ptr = this; |
|
231 d->init(container, modelIterator); |
|
232 } |
|
233 |
|
234 /*! |
220 Destructs the abstract item view. |
235 Destructs the abstract item view. |
221 */ |
236 */ |
222 HbAbstractItemView::~HbAbstractItemView() |
237 HbAbstractItemView::~HbAbstractItemView() |
223 { |
238 { |
224 |
239 |
348 Selects all items in the view. |
363 Selects all items in the view. |
349 */ |
364 */ |
350 void HbAbstractItemView::selectAll() |
365 void HbAbstractItemView::selectAll() |
351 { |
366 { |
352 Q_D(HbAbstractItemView); |
367 Q_D(HbAbstractItemView); |
353 if (d->mModelIterator->model() |
368 QAbstractItemModel *model = d->mModelIterator->model(); |
354 && d->mSelectionModel |
369 if ( model |
355 && d->mSelectionMode == MultiSelection) { |
370 && d->mSelectionModel |
356 QModelIndex firstIndex = d->mModelIterator->nextIndex(QModelIndex()); |
371 && d->mSelectionMode == MultiSelection) { |
357 QModelIndex lastIndex = d->mModelIterator->previousIndex(QModelIndex()); |
372 QModelIndex rootIndex = d->mModelIterator->rootIndex(); |
|
373 QModelIndex firstIndex = model->index(0, 0, rootIndex); |
|
374 QModelIndex lastIndex = model->index(model->rowCount(rootIndex)-1, 0, rootIndex); |
358 d->mSelectionModel->select(QItemSelection(firstIndex, lastIndex), QItemSelectionModel::Select); |
375 d->mSelectionModel->select(QItemSelection(firstIndex, lastIndex), QItemSelectionModel::Select); |
359 } |
376 } |
360 } |
377 } |
361 |
378 |
362 /*! |
379 /*! |
736 int count = selectedIndexes.count(); |
753 int count = selectedIndexes.count(); |
737 for (int i = 0; i < count; ++i) { |
754 for (int i = 0; i < count; ++i) { |
738 HbAbstractViewItem *item = d->mContainer->itemByIndex(selectedIndexes.at(i)); |
755 HbAbstractViewItem *item = d->mContainer->itemByIndex(selectedIndexes.at(i)); |
739 if (item) { |
756 if (item) { |
740 item->setCheckState(Qt::Checked); |
757 item->setCheckState(Qt::Checked); |
741 if (!d->mClearingSelection) { |
758 if (!d->mClearingSelection && !d->mDoingContiguousSelection) { |
742 HbWidgetFeedback::triggered(item, Hb::InstantSelectionChanged); |
759 HbWidgetFeedback::triggered(item, Hb::InstantSelectionChanged); |
743 } |
760 } |
744 } |
761 } |
745 d->mContainer->setItemTransientStateValue(selectedIndexes.at(i), |
762 d->mContainer->setItemTransientStateValue(selectedIndexes.at(i), |
746 "checkState", |
763 "checkState", |
751 count = deselectedIndexes.count(); |
768 count = deselectedIndexes.count(); |
752 for (int i = 0; i < count; ++i) { |
769 for (int i = 0; i < count; ++i) { |
753 HbAbstractViewItem *item = d->mContainer->itemByIndex(deselectedIndexes.at(i)); |
770 HbAbstractViewItem *item = d->mContainer->itemByIndex(deselectedIndexes.at(i)); |
754 if (item) { |
771 if (item) { |
755 item->setCheckState(Qt::Unchecked); |
772 item->setCheckState(Qt::Unchecked); |
756 if (!d->mClearingSelection) { |
773 if (!d->mClearingSelection && !d->mDoingContiguousSelection) { |
757 HbWidgetFeedback::triggered(item, Hb::InstantSelectionChanged); |
774 HbWidgetFeedback::triggered(item, Hb::InstantSelectionChanged); |
758 } |
775 } |
759 } |
776 } |
760 d->mContainer->setItemTransientStateValue(deselectedIndexes.at(i), |
777 d->mContainer->setItemTransientStateValue(deselectedIndexes.at(i), |
761 "checkState", |
778 "checkState", |
1005 |
1022 |
1006 This property should only be set to true if it is guaranteed that all items in the view have |
1023 This property should only be set to true if it is guaranteed that all items in the view have |
1007 the same size. This enables the view to do some optimizations for performance purposes. |
1024 the same size. This enables the view to do some optimizations for performance purposes. |
1008 |
1025 |
1009 By default, this property is false. |
1026 By default, this property is false. |
|
1027 |
|
1028 \sa uniformItemSizes |
1010 */ |
1029 */ |
1011 void HbAbstractItemView::setUniformItemSizes(bool enable) |
1030 void HbAbstractItemView::setUniformItemSizes(bool enable) |
1012 { |
1031 { |
1013 Q_D(HbAbstractItemView); |
1032 Q_D(HbAbstractItemView); |
1014 d->mContainer->setUniformItemSizes(enable); |
1033 d->mContainer->setUniformItemSizes(enable); |
1015 } |
1034 } |
1016 |
1035 |
1017 /*! |
1036 /*! |
1018 Returns the current value of the uniformItemsSizes property |
1037 Returns the current value of the uniformItemsSizes property |
|
1038 |
|
1039 By default, this property is false. |
1019 */ |
1040 */ |
1020 bool HbAbstractItemView::uniformItemSizes() const |
1041 bool HbAbstractItemView::uniformItemSizes() const |
1021 { |
1042 { |
1022 Q_D(const HbAbstractItemView); |
1043 Q_D(const HbAbstractItemView); |
1023 return d->mContainer->uniformItemSizes(); |
1044 return d->mContainer->uniformItemSizes(); |