Item class reference
[Model/View module]


 
 

 
 


Declaration  

#include <QtLua/Item>

namespace QtLua {
class Item;
};

This class is a member of the QtLua namespace.

Description  

This class together with the ListItem and ItemModel classes enable easy use of list or hierarchical data structures that can be viewed and modified from lua script, Qt view widgets and C++ code.

This class implement the generic hierarchical data structure leaf node. It must be used as a base class for objects which may be exposed to Qt views via the ItemModel class.

Item objects can be inserted in and removed from ListItem objects from the C++ code with the Item::insert and Item::remove functions.

Each Item object have a node name used for display in Qt views and access from lua script. This name can be accessed from C++ code with the Item::get_name and Item::set_name functions.

Each data structure modification by lua script or user view interaction may be allowed or denied by reimplemention of Item::is_move_allowed, Item::is_rename_allowed, Item::is_remove_allowed, and Item::is_replace_allowed functions.

See ItemModel for example.

Members  

Inherited members  

Types  

Functions  

Protected functions  

Members detail  

Item(const String &name = "")  

Create a new Item with given name

Item(const Item &item)  

No documentation available

~Item()  

No documentation available

typedef Ref<const Item, Item> const_ptr  

Shortcut for Ref smart pointer class to Item type provided for convenience

void data_changed(int column = 0) const  

This member access is protected.

Make model emit QAbstractItemModel::dataChanged signal for this item

virtual QVariant get_data(int column, int role) const  

This member access is protected.

May be reimplemented for column > 0, see QAbstractItemModel::data.

virtual Qt::ItemFlags get_flags(int column) const  

This member access is protected.

May be reimplemented for column > 0, see QAbstractItemModel::flags.

virtual QIcon & get_icon() const  

This member access is protected.

Must return icon decoration to use for this node.

const String & get_name() const  

Get item name

ListItem * get_parent() const  

Get pointer to parent container

int get_row() const  

This member access is protected.

Get child position in parent item

void insert(const Ref<ListItem> &parent)  

Insert this item in parent container

virtual bool is_move_allowed() const  

This member access is protected.

Must return true if item can change parent containers. (default is true)

virtual bool is_remove_allowed() const  

This member access is protected.

Must return true if item can be removed from container. (default is true)

virtual bool is_rename_allowed() const  

This member access is protected.

Must return true if item can renamed. (default is true)

virtual bool is_replace_allowed() const  

This member access is protected.

Must return true if item can be removed by replacement by an other item (default is is_remove_allowed())

void move(const Ref<ListItem> &parent)  

Insert this item in parent container, remove from existing parent if any

typedef Ref<Item, Item> ptr  

Shortcut for Ref smart pointer class to Item type provided for convenience

void remove()  

Remove this item from its container

virtual bool set_data(int column, int role)  

This member access is protected.

May be reimplemented for column > 0, see QAbstractItemModel::setData.

void set_name(const String &name)  

Set item name. Name may be mangled to be a valid lua identifier.

Valid XHTML 1.0 StrictGenerated by diaxen on Sun Jan 8 22:46:02 2012 using MkDoc