classPiiModelItem
#include <PiiModelItem.h>
A class used by PiiTableModel to store item data for table cells and the header.
Inherits QObject
Description
PiiModelItem uses a map of variants to store data associated with different roles. See Qt::ItemDataRole for roles supported by most Qt view classes.
Properties
|
Qt::ItemFlags
|
Item flags. |
|
QIcon
|
The icon of the item. |
|
The text of the item. |
Constructors and destructor
|
Create a new model item with the given user-visible text. |
|
|
( )
Destroy the model item. |
Public member functions
|
(
Get data associated with |
|
|
( )
Get the full data map. |
|
|
Qt::ItemFlags
|
( )
Get the item's flags. |
|
QIcon
|
( )
A utility function for getting the data associated with the
|
|
void
|
Set data associated with |
|
void
|
(
Set the item's flags. |
|
void
|
(
A utility function for setting the data associated with the
|
|
void
|
A utility function for setting the data associated with the
|
|
( )
A utility function for getting the data associated with the
|
Property details
-
Qt::ItemFlags flags
[read, write]Item flags.
The default value is
Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled. -
QIcon icon
[read, write]The icon of the item.
Stored as
Qt::DecorationRoledata into the data map. -
QString text
[read, write]The text of the item.
Stored as
Qt::DisplayRoledata into the data map.
Function details
-
PiiModelItem
Create a new model item with the given user-visible text.
-
~PiiModelItem
()Destroy the model item.
-
QVariant data
(- int role
Get data associated with
role. -
Get the full data map.
The data map stores data associated with all roles.
-
Qt::ItemFlags flags
()Get the item's flags.
-
QIcon icon
()A utility function for getting the data associated with the
Qt::DecorationRole. -
void setData
Set data associated with
roletovalue.// Show "10 %" to the user ... PiiModelItem* pItem = new PiiModelItem("10 %"); // ... but store the percentage as a number pItem->setData(Qt::UserRole, 10);
-
void setFlags
(- const Qt::ItemFlags & flags
Set the item's flags.
-
void setIcon
(- const QIcon & icon
A utility function for setting the data associated with the
Qt::DecorationRole. -
void setText
A utility function for setting the data associated with the
Qt::DisplayRole. -
QString text
()A utility function for getting the data associated with the
Qt::DisplayRole.
Add a note
Not a single note added yet. Be the first, add yours.