SystemSettingsView
MenuModel Class Reference
Provides a menu of the MenuItem objects. More...
#include <MenuModel.h>

Public Member Functions | |
| MenuModel (MenuItem *menuRoot, QObject *parent=0) | |
| ~MenuModel () | |
| void | addException (MenuItem *exception) |
| int | columnCount (const QModelIndex &parent=QModelIndex()) const |
| QVariant | data (const QModelIndex &index, int role) const |
| Qt::ItemFlags | flags (const QModelIndex &index) const |
| QModelIndex | index (int row, int column, const QModelIndex &parent=QModelIndex()) const |
| QModelIndex | parent (const QModelIndex &index) const |
| void | removeException (MenuItem *exception) |
| int | rowCount (const QModelIndex &parent=QModelIndex()) const |
Static Public Attributes | |
| static const int | UserFilterRole = 0x015D1AE6 |
| static const int | UserSortRole = 0x03A8CC00 |
Protected Member Functions | |
| QList< MenuItem * > | childrenList (MenuItem *parent) const |
| MenuItem * | parentItem (MenuItem *child) const |
| MenuItem * | rootItem () const |
Detailed Description
Provides a menu of the MenuItem objects.
Provides a standardised model to be used with views to display the list of modules in a variety of ways.
It is recommended to also use this with the MenuProxyModel to provide searching and correct ordering of modules.
Definition at line 39 of file MenuModel.h.
Constructor & Destructor Documentation
Creates a MenuModel using the MenuItem specified.
The MenuItem must always be valid throughout the life of the MenuModel, otherwise it will cause crashes.
- Parameters:
-
menuRoot The MenuItem to use as the basis for providing information. parent The QObject to use as a parent of the MenuModel.
Definition at line 39 of file MenuModel.cpp.
| MenuModel::~MenuModel | ( | ) |
Destroys the MenuModel.
The menuRoot will not be destroyed.
Definition at line 46 of file MenuModel.cpp.
Member Function Documentation
| void MenuModel::addException | ( | MenuItem * | exception | ) |
Makes the MenuItem specified be hidden from the list, while still showing its children.
Children of exceptions consider their grand parents as their parent. Parents of exceptions consider the exceptions children as theirs.
- Parameters:
-
exception The MenuItem to give an exception to.
Definition at line 191 of file MenuModel.cpp.
Provides a list of children of an item which has been altered by the exceptions list.
- Parameters:
-
parent The parent of the children desired
- Returns:
- The list of children for the item specified
Definition at line 165 of file MenuModel.cpp.
| int MenuModel::columnCount | ( | const QModelIndex & | parent = QModelIndex() |
) | const |
Please see Qt QAbstractItemModel documentation for more details.
Returns 1, the number of columns of information about a row.
- Parameters:
-
parent This is ignored, as the count is always 1.
- Returns:
- The number of columns ( 1 ) in the parent.
Definition at line 52 of file MenuModel.cpp.
| QVariant MenuModel::data | ( | const QModelIndex & | index, | |
| int | role | |||
| ) | const |
Please see Qt QAbstractItemModel documentation for more details.
Provides the name, tooltip, icon, category, keywords and the internal MenuItem to views.
- Parameters:
-
index The QModelIndex you want information about. role The information role you want information about.
- Returns:
- The data requested for the role provided from the QModelIndex provided.
Definition at line 70 of file MenuModel.cpp.
| Qt::ItemFlags MenuModel::flags | ( | const QModelIndex & | index | ) | const |
Please see Qt QAbstractItemModel documentation for more details.
Provides the status flags for the QModelIndex specified. The item always has selectable and enabled for its status unless invalid.
- Returns:
- The flags for the QModelIndex provided.
Definition at line 114 of file MenuModel.cpp.
| QModelIndex MenuModel::index | ( | int | row, | |
| int | column, | |||
| const QModelIndex & | parent = QModelIndex() | |||
| ) | const |
Please see Qt QAbstractItemModel documentation for more details.
Provides a QModelIndex at the row and column specified who belongs to the parent specified.
- Parameters:
-
row Vertical position in the grid of children. column Horizontal position in the grid of children. parent The parent of the requested child.
- Returns:
- The QModelIndex for the item requested.
Definition at line 123 of file MenuModel.cpp.
| QModelIndex MenuModel::parent | ( | const QModelIndex & | index | ) | const |
Please see Qt QAbstractItemModel documentation for more details.
Provides the parent QModelIndex for the child specified.
- Parameters:
-
index The child of the parent.
- Returns:
- A QModelIndex for the parent.
Definition at line 144 of file MenuModel.cpp.
Provides the parent of the child specified altered by the exceptions list.
- Parameters:
-
child The child of the parent
- Returns:
- The exceptions list affected parent of the child
Definition at line 177 of file MenuModel.cpp.
| void MenuModel::removeException | ( | MenuItem * | exception | ) |
Revokes the exception granted above.
After this, the MenuItem's parents will return their children as normal and the grand children will return their true parents, restoring normal operation. It has no effect if the MenuItem does not have an exception.
- Parameters:
-
exception The MenuItem to revoke an exception from.
Definition at line 199 of file MenuModel.cpp.
| MenuItem * MenuModel::rootItem | ( | ) | const [protected] |
Provides the MenuItem which is used internally to provide information.
- Returns:
- The MenuItem used internally.
Definition at line 186 of file MenuModel.cpp.
| int MenuModel::rowCount | ( | const QModelIndex & | parent = QModelIndex() |
) | const |
Please see Qt QAbstractItemModel documentation for more details.
Provides the number of MenuItems ( categories or modules ) that the specified parent has.
- Parameters:
-
parent The QModelIndex the count is performed on.
- Returns:
- The number of rows ( children ) in the parent.
Definition at line 58 of file MenuModel.cpp.
Member Data Documentation
const int MenuModel::UserFilterRole = 0x015D1AE6 [static] |
Role used to request the keywords to filter the items when searching.
Definition at line 136 of file MenuModel.h.
const int MenuModel::UserSortRole = 0x03A8CC00 [static] |
Role used to request the weight of a module, used to sort the items.
Definition at line 141 of file MenuModel.h.
The documentation for this class was generated from the following files:
KDE 4.4 API Reference