Home · All Classes · Main Classes · Deprecated |
MPopupList implements a popup list for the MeegoTouch Framework. More...
Inherits MDialog.
Public Slots | |
void | click (const QModelIndex &index) |
void | setCurrentIndex (const QModelIndex &index) |
Signals | |
void | clicked (const QModelIndex &index) |
void | currentIndexChanged (const QModelIndex &index) |
void | scrollToIndex (const QModelIndex &index) |
Public Member Functions | |
MPopupList () | |
virtual | ~MPopupList () |
virtual void | setItemModel (QAbstractItemModel *itemModel) |
QAbstractItemModel * | itemModel () const |
virtual void | setSelectionModel (QItemSelectionModel *selectionModel) |
QItemSelectionModel * | selectionModel () const |
virtual void | scrollTo (const QModelIndex &index) |
QModelIndex | currentIndex () const |
MPopupList implements a popup list for the MeegoTouch Framework.
MPopupList is providing limited number and predefined/system-defined set of values to the user, among which the user can choose one option, the selected option is displayed to the user. The alternatives in Popup list are mutually exclusive.
MPopupList derived from MDialog.
It makes heavy use of Qt's Interview Framework to move most code out of the view into in a model to be implemented by the user.
Use one of the various Qt convenience models if subclassing a model is not necessary.
Currently, we expect the model to have only one level of depth, e.g. a table or list and not a tree model. Qt's QComboBox can handle trees to by setting a root index but because writing tree models is more complex and showing a sublist is a rather rare use case, API is kept simple and expects simple models.
If you just want the user to pick from a list of strings, use QStringListModel like:
MPopupList *popuplist = new MPopupList(); QStringListModel *model = new QStringListModel(this); QStringList stringList; stringList << "Item 1" << "Item 2"; model->setStringList(stringList); popuplist->setItemModel(model); popuplist->appear();
MPopupList::MPopupList | ( | ) |
Constructs a new popuplist with no content.
MPopupList::~MPopupList | ( | ) | [virtual] |
Destroys the popuplist.
void MPopupList::click | ( | const QModelIndex & | index | ) | [slot] |
Performs a click All the usual signals associated with a click are emitted as appropriate.
void MPopupList::clicked | ( | const QModelIndex & | index | ) | [signal] |
This signal is emitted when the item is clicked.
QModelIndex MPopupList::currentIndex | ( | ) | const |
Return the model index of the item that is currently being shown as the selected item.
void MPopupList::currentIndexChanged | ( | const QModelIndex & | index | ) | [signal] |
This signal is emitted when the current selected item is changed.
QAbstractItemModel * MPopupList::itemModel | ( | ) | const |
Returns the model that this PopupList is presenting.
void MPopupList::scrollTo | ( | const QModelIndex & | index | ) | [virtual] |
Scrolls the view if necessary to ensure that the item at index is visible.
void MPopupList::scrollToIndex | ( | const QModelIndex & | index | ) | [signal] |
This signal is emitted when scrollTo(index) is called to tell the view to scroll to the given item index.
QItemSelectionModel * MPopupList::selectionModel | ( | ) | const |
Returns the current selection model.
void MPopupList::setCurrentIndex | ( | const QModelIndex & | index | ) | [slot] |
Select the given item, deselecting all others.
This is equivalent to:
selectionModel()->select(index, QItemSelectionModel::ClearAndSelect)
If index is not valid, the current selection is cleared
void MPopupList::setItemModel | ( | QAbstractItemModel * | itemModel | ) | [virtual] |
Sets the item model model as the new datasource for the PopupList.
If you do not want to write your own model, use QStringList model as a convenience adapter
MPopupList does not take ownership of the model. It is up the caller to ensure that it will be deleted. If the model is replaced, it is up to the caller to ensure the previous model is not leaked
void MPopupList::setSelectionModel | ( | QItemSelectionModel * | selectionModel | ) | [virtual] |
Sets the current selection model to the given selectionModel.
Note that, if you call setItemModel() after this function, the given selectionModel will be replaced by one created by the view.
Copyright © 2010 Nokia Corporation | MeeGo Touch |