UserItem class reference
[Model/View module]
Declaration
#include <QtLua/UserItem>
namespace QtLua {
class UserItem;
};
This class is a member of the QtLua namespace.
This class is declared in QtLua/qtluauseritem.hh source file, line 69.
Description
This class together with the UserListItem and UserItemModel 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 UserItemModel class.
UserItem objects can be inserted in and removed from UserListItem objects from the C++ code with the UserItem::insert and UserItem::remove functions.
Each UserItem 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 UserItem::get_name and UserItem::set_name functions.
Each data structure modification by lua script or user view interaction may be allowed or denied by reimplemention of UserItem::is_move_allowed, UserItem::is_rename_allowed, UserItem::is_remove_allowed, and UserItem::is_replace_allowed functions.
See UserItemModel for example.
Members
Inherited members
- 30 members inherited from UserData
Types
Functions
- UserItem(const String &name = [...])
- UserItem(const UserItem &item)
- ~UserItem()
- UserItemModel * get_model() const
- QModelIndex get_model_index(int column = [...]) const
- const String & get_name() const
- UserListItem * get_parent() const
- void insert(const Ref<UserListItem> &parent, int pos = [...])
- void move(const Ref<UserListItem> &parent)
- void remove()
- void set_name(const String &name)
Protected functions
- void data_changed(int column = [...]) const
- virtual QVariant get_data(int column, int role) const
- virtual Qt::ItemFlags get_flags(int column) const
- virtual QIcon & get_icon() const
- int get_row() const
- virtual bool is_move_allowed() const
- virtual bool is_remove_allowed() const
- virtual bool is_rename_allowed() const
- virtual bool is_replace_allowed() const
- virtual bool set_data(int column, int role)
Private functions
- virtual int get_child_count() const
- virtual UserItem * get_child_row(int row) const
- bool in_parent_path(UserItem *item)
- void insert_name()
- const UserItem & operator=(const UserItem &)
- virtual void set_model(UserItemModel *model)
- void set_row(int row)
Private fields
Members detail
UserItem(const String &name = "")
This constructor is declared in QtLua/qtluauseritem.hh source file, line 79.
Create a new UserItem with given name
UserItem(const UserItem &item)
This constructor is declared in QtLua/qtluauseritem.hh source file, line 81.
This destructor is declared in QtLua/qtluauseritem.hh source file, line 82.
UserItemModel *_model
This variable is declared in QtLua/qtluauseritem.hh source file, line 157.
This member access is private.
String _name
This variable is declared in QtLua/qtluauseritem.hh source file, line 155.
This member access is private.
UserListItem *_parent
This variable is declared in QtLua/qtluauseritem.hh source file, line 156.
This member access is private.
This variable is declared in QtLua/qtluauseritem.hh source file, line 158.
This member access is private.
This typedef is declared in QTLUA_REFTYPE function like macro expansion, line 3 in QtLua/qtluauseritem.hh source file, line 76.
Shortcut for Ref smart pointer class to UserItem type provided for convenience
This function is declared in QtLua/qtluauseritem.hh source file, line 112.
This member access is protected.
Make model emit QAbstractItemModel::dataChanged signal for this item
This virtual function is declared in QtLua/qtluauseritem.hh source file, line 153.
This member access is private.
virtual UserItem * get_child_row(int row) const
This virtual function is declared in QtLua/qtluauseritem.hh source file, line 152.
This member access is private.
virtual QVariant get_data(int column, int role) const
This virtual function is declared in QtLua/qtluauseritem.hh source file, line 118.
This member access is protected.
May be reimplemented for column > 0, see QAbstractItemModel::data.
virtual Qt::ItemFlags get_flags(int column) const
This virtual function is declared in QtLua/qtluauseritem.hh source file, line 121.
This member access is protected.
May be reimplemented for column > 0, see QAbstractItemModel::flags.
virtual QIcon & get_icon() const
This virtual function is declared in QtLua/qtluauseritem.hh source file, line 124.
This member access is protected.
Must return icon decoration to use for this node.
UserItemModel * get_model() const
This function is declared in QtLua/qtluauseritem.hh source file, line 104.
Get associated UserItemModel
QModelIndex get_model_index(int column = 0) const
This function is declared in QtLua/qtluauseritem.hh source file, line 107.
Get QModelIndex
const String & get_name() const
This function is declared in QtLua/qtluauseritem.hh source file, line 98.
Get item name
UserListItem * get_parent() const
This function is declared in QtLua/qtluauseritem.hh source file, line 101.
Get pointer to parent container
This function is declared in QtLua/qtluauseritem.hh source file, line 143.
This member access is protected.
Get child position in parent item
bool in_parent_path(UserItem *item)
This function is declared in QtLua/qtluauseritem.hh source file, line 149.
This member access is private.
void insert(const Ref<UserListItem> &parent, int pos = -1)
This function is declared in QtLua/qtluauseritem.hh source file, line 89.
Insert this item in parent container, remove from existing parent if any.
This function is declared in QtLua/qtluauseritem.hh source file, line 150.
This member access is private.
This virtual function is declared in QtLua/qtluauseritem.hh source file, line 128.
This member access is protected.
Must return true if item can change parent containers. (default is true)
This virtual function is declared in QtLua/qtluauseritem.hh source file, line 136.
This member access is protected.
Must return true if item can be removed from container. (default is true)
This virtual function is declared in QtLua/qtluauseritem.hh source file, line 132.
This member access is protected.
Must return true if item can renamed. (default is true)
This virtual function is declared in QtLua/qtluauseritem.hh source file, line 140.
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<UserListItem> &parent)
This function is deprecated.
This function is declared in QtLua/qtluauseritem.hh source file, line 86.
The as UserItem::insert.
This function is declared in QtLua/qtluauseritem.hh source file, line 146.
This member access is private.
This typedef is declared in QTLUA_REFTYPE function like macro expansion, line 5 in QtLua/qtluauseritem.hh source file, line 76.
Shortcut for Ref smart pointer class to UserItem type provided for convenience
This function is declared in QtLua/qtluauseritem.hh source file, line 92.
Remove this item from its container
This virtual function is declared in QtLua/qtluauseritem.hh source file, line 115.
This member access is protected.
May be reimplemented for column > 0, see QAbstractItemModel::setData.
virtual void set_model(UserItemModel *model)
This virtual function is declared in QtLua/qtluauseritem.hh source file, line 148.
This member access is private.
void set_name(const String &name)
This function is declared in QtLua/qtluauseritem.hh source file, line 95.
Set item name. Name may be mangled to be a valid lua identifier.
This function is declared in QtLua/qtluauseritem.hh source file, line 151.
This member access is private.