diff -r c3690ec91ef8 -r 923ff622b8b9 src/hbwidgets/itemviews/hbradiobuttonlist.cpp --- a/src/hbwidgets/itemviews/hbradiobuttonlist.cpp Wed Jun 23 18:33:25 2010 +0300 +++ b/src/hbwidgets/itemviews/hbradiobuttonlist.cpp Tue Jul 06 14:36:53 2010 +0300 @@ -37,8 +37,6 @@ const int HB_RADIOBUTTONLIST_ITEM_ACTIVATION_TIMER = 150; const int HB_RADIOBUTTONLIST_PREVIEW_TIMER = 500; -const int HB_RADIOBUTTONLIST_MINIMUM_ITEM_COUNT_IN_SIZE_HINT = 4; - /*! \class HbRadioButtonList \brief HbRadioButtonList provides a widget for a string list with radio buttons @@ -130,15 +128,13 @@ HbRadioButtonList::PreviewMode mPreviewMode; bool mPreviewGoingOn; bool mStartUp; - qreal mHeight; }; HbRadioButtonListPrivate::HbRadioButtonListPrivate() : HbListViewPrivate(), mPreviewMode(HbRadioButtonList::NoPreview), mPreviewGoingOn(false), - mStartUp(true), - mHeight(0) + mStartUp(true) { } @@ -173,26 +169,6 @@ q->setPreviewMode(previewMode); q->setLongPressEnabled(false); q->setUniformItemSizes(true); - calculateItemHeight(); -} - -void HbRadioButtonListPrivate::calculateItemHeight() -{ - Q_Q(HbRadioButtonList); - if (!q->items().isEmpty()) { - //Let's create a temporary item and take the height for the size hint - HbAbstractViewItem *tempItem = q->itemPrototypes().first()->createItem(); - tempItem->setModelIndex(mModelIterator->nextIndex(QModelIndex())); - - qreal oldHeight = mHeight; - mHeight = tempItem->effectiveSizeHint(Qt::PreferredSize).height(); - - delete tempItem; - - if (mHeight != oldHeight) { - q->updateGeometry(); - } - } } void HbRadioButtonListPrivate::emitStartPreview(int row) @@ -252,10 +228,6 @@ QStringListModel *stringListModel = qobject_cast(d->mModelIterator->model()); if (stringListModel) { stringListModel->setStringList(list); - //Calculate the item height only if needed - if(d->mHeight==0){ - d->calculateItemHeight(); - } updateGeometry(); } else { //TODO: set the item here using the base model class @@ -410,21 +382,7 @@ */ QSizeF HbRadioButtonList::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const { - Q_D(const HbRadioButtonList); - if (which == Qt::PreferredSize) { - QSizeF defaultSize = HbListView::sizeHint(which,constraint); - qreal minHeight = (d->mHeight) * HB_RADIOBUTTONLIST_MINIMUM_ITEM_COUNT_IN_SIZE_HINT; - defaultSize.setHeight(qMax(defaultSize.height(), minHeight)); - - qreal height = (d->mHeight) * (d->mModelIterator->indexCount()); - if( height <= defaultSize.height()) { - return QSizeF(defaultSize.width(), height); - } else { - return defaultSize; - } - } else { - return HbListView::sizeHint(which, constraint); - } + return HbListView::sizeHint(which, constraint); } /*! @@ -432,13 +390,7 @@ */ void HbRadioButtonList::rowsInserted(const QModelIndex &parent, int start, int end) { - Q_D(HbRadioButtonList); HbListView::rowsInserted(parent,start,end); - //Calculate the item height only if needed - if(d->mHeight==0){ - d->calculateItemHeight(); - } - updateGeometry(); } /*! @@ -447,7 +399,6 @@ void HbRadioButtonList::rowsRemoved(const QModelIndex &parent, int start, int end) { HbListView::rowsRemoved(parent,start,end); - updateGeometry(); } /*! @@ -456,7 +407,6 @@ void HbRadioButtonList::reset() { HbListView::reset(); - updateGeometry(); } #include "moc_hbradiobuttonlist.cpp"