Into

Modules

Documentation

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

(
  • int role
)

Get data associated with role.

QMap< int, QVariant >
( )

Get the full data map.

Qt::ItemFlags
( )

Get the item's flags.

QIcon
( )

A utility function for getting the data associated with the Qt::DecorationRole.

void
( )

Set data associated with role to value.

void
(
  • const Qt::ItemFlags & flags
)

Set the item's flags.

void
(
  • const QIcon & icon
)

A utility function for setting the data associated with the Qt::DecorationRole.

void
( )

A utility function for setting the data associated with the Qt::DisplayRole.

( )

A utility function for getting the data associated with the Qt::DisplayRole.

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::DecorationRole data into the data map.

  • QString text

    [read, write]

    The text of the item.

    Stored as Qt::DisplayRole data 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.

  • QMap< int, QVariant > dataMap

    ()

    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 role to value.

     // 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.

Notes (0)

Add a note

Not a single note added yet. Be the first, add yours.