Qyoto  4.0.5
Qyoto is a C# language binding for Qt
 All Classes Namespaces Functions Variables Typedefs Enumerations Properties
QtGui.QStandardItem Class Reference

The QStandardItem class provides an item for use with the QStandardItemModel class. More...

Inheritance diagram for QtGui.QStandardItem:
Collaboration diagram for QtGui.QStandardItem:

Public Types

enum  ItemType { Type = 0, UserType = 1000 }
  More...
 

Public Member Functions

 QStandardItem ()
 
 
 QStandardItem (QIcon icon, string text)
 
 
 QStandardItem (string text)
 
 
 QStandardItem (int rows, int columns=1)
 
 
virtual void CreateProxy ()
 
new void AppendColumn (System.Collections.Generic.List< QStandardItem > items)
 
 
new void AppendRow (QStandardItem item)
 
 
new void AppendRow (System.Collections.Generic.List< QStandardItem > items)
 
 
new void AppendRows (System.Collections.Generic.List< QStandardItem > items)
 
 
new QStandardItem Child (int row, int column=0)
 
 
virtual QStandardItem Clone ()
 
 
new int Column ()
 
 
virtual object Data (int role=(int) Qt.ItemDataRole.UserRole+1)
 
 
new bool HasChildren ()
 
 
new QModelIndex Index ()
 
 
new void InsertColumn (int column, System.Collections.Generic.List< QStandardItem > items)
 
 
new void InsertColumns (int column, int count)
 
 
new void InsertRow (int row, QStandardItem item)
 
 
new void InsertRow (int row, System.Collections.Generic.List< QStandardItem > items)
 
 
new void InsertRows (int row, int count)
 
 
new void InsertRows (int row, System.Collections.Generic.List< QStandardItem > items)
 
 
new bool IsCheckable ()
 
 
new bool IsDragEnabled ()
 
 
new bool IsDropEnabled ()
 
 
new bool IsEditable ()
 
 
new bool IsEnabled ()
 
 
new bool IsSelectable ()
 
 
new bool IsTristate ()
 
 
new QStandardItemModel Model ()
 
 
new QStandardItem Parent ()
 
 
virtual void Read (QDataStream @in)
 
 
new void RemoveColumn (int column)
 
 
new void RemoveColumns (int column, int count)
 
 
new void RemoveRow (int row)
 
 
new void RemoveRows (int row, int count)
 
 
new int Row ()
 
 
new void SetCheckable (bool checkable)
 
 
new void SetChild (int row, QStandardItem item)
 
 
new void SetChild (int row, int column, QStandardItem item)
 
 
virtual void SetData (object value, int role=(int) Qt.ItemDataRole.UserRole+1)
 
 
new void SetDragEnabled (bool dragEnabled)
 
 
new void SetDropEnabled (bool dropEnabled)
 
 
new void SetEditable (bool editable)
 
 
new void SetEnabled (bool enabled)
 
 
new void SetSelectable (bool selectable)
 
 
new void SetTristate (bool tristate)
 
 
new void SortChildren (int column, Qt.SortOrder order=Qt.SortOrder.AscendingOrder)
 
 
new QStandardItem TakeChild (int row, int column=0)
 
 
new
System.Collections.Generic.List
< QStandardItem
TakeColumn (int column)
 
 
new
System.Collections.Generic.List
< QStandardItem
TakeRow (int row)
 
 
virtual int Type ()
 
 
virtual void Write (QDataStream @out)
 
 
new void Dispose ()
 

Static Public Member Functions

static bool operator< (QStandardItem arg1, QStandardItem arg2)
 
 
static bool operator> (QStandardItem arg1, QStandardItem arg2)
 

Protected Member Functions

 QStandardItem (System.Type dummy)
 
 QStandardItem (QStandardItem other)
 
 
new void EmitDataChanged ()
 
 

Protected Attributes

SmokeInvocation interceptor
 

Properties

new string AccessibleDescription [get, set]
 
 
new string AccessibleText [get, set]
 
 
new QBrush Background [get, set]
 
 
new Qt.CheckState CheckState [get, set]
 
 
new int ColumnCount [get, set]
 
 
new Qt.ItemFlag Flags [get, set]
 
 
new QFont Font [get, set]
 
 
new QBrush Foreground [get, set]
 
 
new QIcon Icon [get, set]
 
 
new int RowCount [get, set]
 
 
new QSize SizeHint [get, set]
 
 
new string StatusTip [get, set]
 
 
new string Text [get, set]
 
 
new Qt.AlignmentFlag TextAlignment [get, set]
 
 
new string ToolTip [get, set]
 
 
new string WhatsThis [get, set]
 
 
virtual System.IntPtr SmokeObject [get, set]
 

Detailed Description

The QStandardItem class provides an item for use with the QStandardItemModel class.

Items usually contain text, icons, or checkboxes.

Each item can have its own background brush which is set with the setBackground() function. The current background brush can be found with background(). The text label for each item can be rendered with its own font and brush. These are specified with the setFont() and setForeground() functions, and read with font() and foreground().

By default, items are enabled, editable, selectable, checkable, and can be used both as the source of a drag and drop operation and as a drop target. Each item's flags can be changed by calling setFlags(). Checkable items can be checked and unchecked with the setCheckState() function. The corresponding checkState() function indicates whether the item is currently checked.

You can store application-specific data in an item by calling setData().

Each item can have a two-dimensional table of child items. This makes it possible to build hierarchies of items. The typical hierarchy is the tree, in which case the child table is a table with a single column (a list).

The dimensions of the child table can be set with setRowCount() and setColumnCount(). Items can be positioned in the child table with setChild(). Get a pointer to a child item with child(). New rows and columns of children can also be inserted with insertRow() and insertColumn(), or appended with appendRow() and appendColumn(). When using the append and insert functions, the dimensions of the child table will grow as needed.

An existing row of children can be removed with removeRow() or takeRow(); correspondingly, a column can be removed with removeColumn() or takeColumn().

An item's children can be sorted by calling sortChildren().

Subclassing

When subclassing QStandardItem to provide custom items, it is possible to define new types for them so that they can be distinguished from the base class. The type() function should be reimplemented to return a new type value equal to or greater than UserType.

Reimplement data() and setData() if you want to perform custom handling of data queries and/or control how an item's data is represented.

Reimplement clone() if you want QStandardItemModel to be able to create instances of your custom item class on demand (see QStandardItemModel::setItemPrototype()).

Reimplement read() and write() if you want to control how items are represented in their serialized form.

Reimplement operator<() if you want to control the semantics of item comparison. operator<() determines the sorted order when sorting items with sortChildren() or with QStandardItemModel::sort().

See also QStandardItemModel, Item View Convenience Classes, and Model/View Programming.

Member Enumeration Documentation

This enum describes the types that are used to describe standard items.

You can define new user types in QStandardItem subclasses to ensure that custom items are treated specially; for example, when items are sorted.

See also type().

Enumerator:
Type 

The default type for standard items.

UserType 

The minimum value for custom types. Values below UserType are reserved by Qt.

Constructor & Destructor Documentation

QtGui.QStandardItem.QStandardItem ( System.Type  dummy)
protected
QtGui.QStandardItem.QStandardItem ( )

Constructs an item.

QtGui.QStandardItem.QStandardItem ( QStandardItem  other)
protected

Constructs a copy of other. Note that model() is not copied.

This function is useful when reimplementing clone().

QtGui.QStandardItem.QStandardItem ( QIcon  icon,
string  text 
)

Constructs an item with the given icon and text.

QtGui.QStandardItem.QStandardItem ( string  text)

Constructs an item with the given text.

QtGui.QStandardItem.QStandardItem ( int  rows,
int  columns = 1 
)

Constructs an item with rows rows and columns columns of child items.

Member Function Documentation

new void QtGui.QStandardItem.AppendColumn ( System.Collections.Generic.List< QStandardItem items)

Appends a column containing items. If necessary, the row count is increased to the size of items.

See also insertColumn().

new void QtGui.QStandardItem.AppendRow ( QStandardItem  item)

This is an overloaded function.

Appends a row containing item.

When building a list or a tree that has only one column, this function provides a convenient way to append a single new item.

new void QtGui.QStandardItem.AppendRow ( System.Collections.Generic.List< QStandardItem items)

Appends a row containing items. If necessary, the column count is increased to the size of items.

See also insertRow().

new void QtGui.QStandardItem.AppendRows ( System.Collections.Generic.List< QStandardItem items)

Appends rows containing items. The column count will not change.

See also insertRow().

new QStandardItem QtGui.QStandardItem.Child ( int  row,
int  column = 0 
)

Returns the child item at (row, column) if one has been set; otherwise returns 0.

See also setChild(), takeChild(), and parent().

virtual QStandardItem QtGui.QStandardItem.Clone ( )
virtual

Returns a copy of this item. The item's children are not copied.

When subclassing QStandardItem, you can reimplement this function to provide QStandardItemModel with a factory that it can use to create new items on demand.

See also QStandardItemModel::setItemPrototype() and operator=().

new int QtGui.QStandardItem.Column ( )

Returns the column where the item is located in its parent's child table, or -1 if the item has no parent.

See also row() and parent().

virtual void QtGui.QStandardItem.CreateProxy ( )
virtual
virtual object QtGui.QStandardItem.Data ( int  role = (int) Qt.ItemDataRole.UserRole+1)
virtual

Returns the item's data for the given role, or an invalid QVariant if there is no data for the role.

Note: The default implementation treats Qt::EditRole and Qt::DisplayRole as referring to the same data.

See also setData().

new void QtGui.QStandardItem.Dispose ( )
new void QtGui.QStandardItem.EmitDataChanged ( )
protected

Causes the model associated with this item to emit a dataChanged() signal for this item.

You normally only need to call this function if you have subclassed QStandardItem and reimplemented data() and/or setData().

This function was introduced in Qt 4.4.

See also setData().

new bool QtGui.QStandardItem.HasChildren ( )

Returns true if this item has any children; otherwise returns false.

See also rowCount(), columnCount(), and child().

new QModelIndex QtGui.QStandardItem.Index ( )

Returns the QModelIndex associated with this item.

When you need to invoke item functionality in a QModelIndex-based API (e.g. QAbstractItemView), you can call this function to obtain an index that corresponds to the item's location in the model.

If the item is not associated with a model, an invalid QModelIndex is returned.

See also model() and QStandardItemModel::itemFromIndex().

new void QtGui.QStandardItem.InsertColumn ( int  column,
System.Collections.Generic.List< QStandardItem items 
)

Inserts a column at column containing items. If necessary, the row count is increased to the size of items.

See also insertColumns() and insertRow().

new void QtGui.QStandardItem.InsertColumns ( int  column,
int  count 
)

Inserts count columns of child items at column column.

See also insertColumn() and insertRows().

new void QtGui.QStandardItem.InsertRow ( int  row,
QStandardItem  item 
)

This is an overloaded function.

Inserts a row at row containing item.

When building a list or a tree that has only one column, this function provides a convenient way to insert a single new item.

new void QtGui.QStandardItem.InsertRow ( int  row,
System.Collections.Generic.List< QStandardItem items 
)

Inserts a row at row containing items. If necessary, the column count is increased to the size of items.

See also insertRows() and insertColumn().

new void QtGui.QStandardItem.InsertRows ( int  row,
int  count 
)

Inserts count rows of child items at row row.

See also insertRow() and insertColumns().

new void QtGui.QStandardItem.InsertRows ( int  row,
System.Collections.Generic.List< QStandardItem items 
)

Inserts items at row. The column count wont be changed.

See also insertRow() and insertColumn().

new bool QtGui.QStandardItem.IsCheckable ( )

Returns whether the item is user-checkable.

The default value is false.

See also setCheckable(), checkState(), and isTristate().

new bool QtGui.QStandardItem.IsDragEnabled ( )

Returns whether the item is drag enabled. An item that is drag enabled can be dragged by the user.

The default value is true.

Note that item dragging must be enabled in the view for dragging to work; see QAbstractItemView::dragEnabled.

See also setDragEnabled(), isDropEnabled(), and flags().

new bool QtGui.QStandardItem.IsDropEnabled ( )

Returns whether the item is drop enabled. When an item is drop enabled, it can be used as a drop target.

The default value is true.

See also setDropEnabled(), isDragEnabled(), and flags().

new bool QtGui.QStandardItem.IsEditable ( )

Returns whether the item can be edited by the user.

When an item is editable (and enabled), the user can edit the item by invoking one of the view's edit triggers; see QAbstractItemView::editTriggers.

The default value is true.

See also setEditable() and flags().

new bool QtGui.QStandardItem.IsEnabled ( )

Returns whether the item is enabled.

When an item is enabled, the user can interact with it. The possible types of interaction are specified by the other item flags, such as isEditable() and isSelectable().

The default value is true.

See also setEnabled() and flags().

new bool QtGui.QStandardItem.IsSelectable ( )

Returns whether the item is selectable by the user.

The default value is true.

See also setSelectable() and flags().

new bool QtGui.QStandardItem.IsTristate ( )

Returns whether the item is tristate; that is, if it's checkable with three separate states.

The default value is false.

See also setTristate(), isCheckable(), and checkState().

new QStandardItemModel QtGui.QStandardItem.Model ( )

Returns the QStandardItemModel that this item belongs to.

If the item is not a child of another item that belongs to the model, this function returns 0.

See also index().

static bool QtGui.QStandardItem.operator< ( QStandardItem  arg1,
QStandardItem  arg2 
)
static

Returns true if this item is less than other; otherwise returns false.

The default implementation uses the data for the item's sort role (see QStandardItemModel::sortRole) to perform the comparison if the item belongs to a model; otherwise, the data for the item's Qt::DisplayRole (text()) is used to perform the comparison.

sortChildren() and QStandardItemModel::sort() use this function when sorting items. If you want custom sorting, you can subclass QStandardItem and reimplement this function.

static bool QtGui.QStandardItem.operator> ( QStandardItem  arg1,
QStandardItem  arg2 
)
static
new QStandardItem QtGui.QStandardItem.Parent ( )

Returns the item's parent item, or 0 if the item has no parent.

See also child().

virtual void QtGui.QStandardItem.Read ( QDataStream in)
virtual

Reads the item from stream in. Only the data and flags of the item are read, not the child items.

See also write().

new void QtGui.QStandardItem.RemoveColumn ( int  column)

Removes the given column. The items that were in the column are deleted.

See also takeColumn(), removeColumns(), and removeRow().

new void QtGui.QStandardItem.RemoveColumns ( int  column,
int  count 
)

Removes count columns at column column. The items that were in those columns are deleted.

See also removeColumn() and removeRows().

new void QtGui.QStandardItem.RemoveRow ( int  row)

Removes the given row. The items that were in the row are deleted.

See also takeRow(), removeRows(), and removeColumn().

new void QtGui.QStandardItem.RemoveRows ( int  row,
int  count 
)

Removes count rows at row row. The items that were in those rows are deleted.

See also removeRow() and removeColumn().

new int QtGui.QStandardItem.Row ( )

Returns the row where the item is located in its parent's child table, or -1 if the item has no parent.

See also column() and parent().

new void QtGui.QStandardItem.SetCheckable ( bool  checkable)

Sets whether the item is user-checkable. If checkable is true, the item can be checked by the user; otherwise, the user cannot check the item.

The item delegate will render a checkable item with a check box next to the item's text.

See also isCheckable(), setCheckState(), and setTristate().

new void QtGui.QStandardItem.SetChild ( int  row,
QStandardItem  item 
)

This is an overloaded function.

Sets the child at row to item.

new void QtGui.QStandardItem.SetChild ( int  row,
int  column,
QStandardItem  item 
)

Sets the child item at (row, column) to item. This item (the parent item) takes ownership of item. If necessary, the row count and column count are increased to fit the item.

See also child().

virtual void QtGui.QStandardItem.SetData ( object  value,
int  role = (int) Qt.ItemDataRole.UserRole+1 
)
virtual

Sets the item's data for the given role to the specified value.

If you subclass QStandardItem and reimplement this function, your reimplementation should call emitDataChanged() if you do not call the base implementation of setData(). This will ensure that e.g. views using the model are notified of the changes.

Note: The default implementation treats Qt::EditRole and Qt::DisplayRole as referring to the same data.

See also Qt::ItemDataRole, data(), and setFlags().

new void QtGui.QStandardItem.SetDragEnabled ( bool  dragEnabled)

Sets whether the item is drag enabled. If dragEnabled is true, the item can be dragged by the user; otherwise, the user cannot drag the item.

Note that you also need to ensure that item dragging is enabled in the view; see QAbstractItemView::dragEnabled.

See also isDragEnabled(), setDropEnabled(), and setFlags().

new void QtGui.QStandardItem.SetDropEnabled ( bool  dropEnabled)

Sets whether the item is drop enabled. If dropEnabled is true, the item can be used as a drop target; otherwise, it cannot.

Note that you also need to ensure that drops are enabled in the view; see QWidget::acceptDrops(); and that the model supports the desired drop actions; see QAbstractItemModel::supportedDropActions().

See also isDropEnabled(), setDragEnabled(), and setFlags().

new void QtGui.QStandardItem.SetEditable ( bool  editable)

Sets whether the item is editable. If editable is true, the item can be edited by the user; otherwise, the user cannot edit the item.

How the user can edit items in a view is determined by the view's edit triggers; see QAbstractItemView::editTriggers.

See also isEditable() and setFlags().

new void QtGui.QStandardItem.SetEnabled ( bool  enabled)

Sets whether the item is enabled. If enabled is true, the item is enabled, meaning that the user can interact with the item; if enabled is false, the user cannot interact with the item.

This flag takes precedence over the other item flags; e.g. if an item is not enabled, it cannot be selected by the user, even if the Qt::ItemIsSelectable flag has been set.

See also isEnabled(), Qt::ItemIsEnabled, and setFlags().

new void QtGui.QStandardItem.SetSelectable ( bool  selectable)

Sets whether the item is selectable. If selectable is true, the item can be selected by the user; otherwise, the user cannot select the item.

You can control the selection behavior and mode by manipulating their view properties; see QAbstractItemView::selectionMode and QAbstractItemView::selectionBehavior.

See also isSelectable() and setFlags().

new void QtGui.QStandardItem.SetTristate ( bool  tristate)

Sets whether the item is tristate. If tristate is true, the item is checkable with three separate states; otherwise, the item is checkable with two states. (Note that this also requires that the item is checkable; see isCheckable().)

See also isTristate(), setCheckable(), and setCheckState().

new void QtGui.QStandardItem.SortChildren ( int  column,
Qt.SortOrder  order = Qt.SortOrder.AscendingOrder 
)

Sorts the children of the item using the given order, by the values in the given column.

Note: This function is recursive, therefore it sorts the children of the item, its grandchildren, etc.

See also operator<().

new QStandardItem QtGui.QStandardItem.TakeChild ( int  row,
int  column = 0 
)

Removes the child item at (row, column) without deleting it, and returns a pointer to the item. If there was no child at the given location, then this function returns 0.

Note that this function, unlike takeRow() and takeColumn(), does not affect the dimensions of the child table.

See also child(), takeRow(), and takeColumn().

new System.Collections.Generic.List<QStandardItem> QtGui.QStandardItem.TakeColumn ( int  column)

Removes column without deleting the column items, and returns a list of pointers to the removed items. For items in the column that have not been set, the corresponding pointers in the list will be 0.

See also removeColumn(), insertColumn(), and takeRow().

new System.Collections.Generic.List<QStandardItem> QtGui.QStandardItem.TakeRow ( int  row)

Removes row without deleting the row items, and returns a list of pointers to the removed items. For items in the row that have not been set, the corresponding pointers in the list will be 0.

See also removeRow(), insertRow(), and takeColumn().

virtual int QtGui.QStandardItem.Type ( )
virtual

Returns the type of this item. The type is used to distinguish custom items from the base class. When subclassing QStandardItem, you should reimplement this function and return a new value greater than or equal to UserType.

See also QStandardItem::Type.

virtual void QtGui.QStandardItem.Write ( QDataStream out)
virtual

Writes the item to stream out. Only the data and flags of the item are written, not the child items.

See also read().

Member Data Documentation

SmokeInvocation QtGui.QStandardItem.interceptor
protected

Property Documentation

new string QtGui.QStandardItem.AccessibleDescription
getset

Returns the item's accessible description.

The accessible description is used by assistive technologies (i.e. for users who cannot use conventional means of interaction).

Sets the item's accessible description to the string specified by accessibleDescription.

The accessible description is used by assistive technologies (i.e. for users who cannot use conventional means of interaction).

new string QtGui.QStandardItem.AccessibleText
getset

Returns the item's accessible text.

The accessible text is used by assistive technologies (i.e. for users who cannot use conventional means of interaction).

Sets the item's accessible text to the string specified by accessibleText.

The accessible text is used by assistive technologies (i.e. for users who cannot use conventional means of interaction).

new QBrush QtGui.QStandardItem.Background
getset

Returns the brush used to render the item's background.

Sets the item's background brush to the specified brush.

new Qt.CheckState QtGui.QStandardItem.CheckState
getset

Returns the checked state of the item.

Sets the check state of the item to be state.

new int QtGui.QStandardItem.ColumnCount
getset

Returns the number of child item columns that the item has.

Sets the number of child item columns to columns. If this is less than columnCount(), the data in the unwanted columns is discarded.

new Qt.ItemFlag QtGui.QStandardItem.Flags
getset

Returns the item flags for the item.

The item flags determine how the user can interact with the item.

By default, items are enabled, editable, selectable, checkable, and can be used both as the source of a drag and drop operation and as a drop target.

Sets the item flags for the item to flags.

The item flags determine how the user can interact with the item. This is often used to disable an item.

new QFont QtGui.QStandardItem.Font
getset

Returns the font used to render the item's text.

Sets the font used to display the item's text to the given font.

new QBrush QtGui.QStandardItem.Foreground
getset

Returns the brush used to render the item's foreground (e.g. text).

Sets the brush used to display the item's foreground (e.g. text) to the given brush.

new QIcon QtGui.QStandardItem.Icon
getset

Returns the item's icon.

Sets the item's icon to the icon specified.

new int QtGui.QStandardItem.RowCount
getset

Returns the number of child item rows that the item has.

Sets the number of child item rows to rows. If this is less than rowCount(), the data in the unwanted rows is discarded.

new QSize QtGui.QStandardItem.SizeHint
getset

Returns the size hint set for the item, or an invalid QSize if no size hint has been set.

If no size hint has been set, the item delegate will compute the size hint based on the item data.

Sets the size hint for the item to be size. If no size hint is set, the item delegate will compute the size hint based on the item data.

virtual System.IntPtr QtGui.QStandardItem.SmokeObject
getset
new string QtGui.QStandardItem.StatusTip
getset

Returns the item's status tip.

Sets the item's status tip to the string specified by statusTip.

new string QtGui.QStandardItem.Text
getset

Returns the item's text. This is the text that's presented to the user in a view.

Sets the item's text to the text specified.

new Qt.AlignmentFlag QtGui.QStandardItem.TextAlignment
getset

Returns the text alignment for the item's text.

Sets the text alignment for the item's text to the alignment specified.

new string QtGui.QStandardItem.ToolTip
getset

Returns the item's tooltip.

Sets the item's tooltip to the string specified by toolTip.

new string QtGui.QStandardItem.WhatsThis
getset

Returns the item's "What's This?" help.

Sets the item's "What's This?" help to the string specified by whatsThis.