Qt 4.8
|
The QStandardItem class provides an item for use with the QStandardItemModel class. More...
#include <qstandarditemmodel.h>
Public Types | |
enum | ItemType { Type = 0, UserType = 1000 } |
This enum describes the types that are used to describe standard items. More... | |
Public Functions | |
QString | accessibleDescription () const |
Returns the item's accessible description. More... | |
QString | accessibleText () const |
Returns the item's accessible text. More... | |
void | appendColumn (const QList< QStandardItem *> &items) |
Appends a column containing items. More... | |
void | appendRow (const QList< QStandardItem *> &items) |
Appends a row containing items. More... | |
void | appendRow (QStandardItem *item) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Appends a row containing item. More... | |
void | appendRows (const QList< QStandardItem *> &items) |
Appends rows containing items. More... | |
QBrush | background () const |
Returns the brush used to render the item's background. More... | |
Qt::CheckState | checkState () const |
Returns the checked state of the item. More... | |
QStandardItem * | child (int row, int column=0) const |
Returns the child item at (row, column) if one has been set; otherwise returns 0. More... | |
virtual QStandardItem * | clone () const |
Returns a copy of this item. More... | |
int | column () const |
Returns the column where the item is located in its parent's child table, or -1 if the item has no parent. More... | |
int | columnCount () const |
Returns the number of child item columns that the item has. More... | |
virtual QVariant | data (int role=Qt::UserRole+1) const |
Returns the item's data for the given role, or an invalid QVariant if there is no data for the role. More... | |
Qt::ItemFlags | flags () const |
Returns the item flags for the item. More... | |
QFont | font () const |
Returns the font used to render the item's text. More... | |
QBrush | foreground () const |
Returns the brush used to render the item's foreground (e. More... | |
bool | hasChildren () const |
Returns true if this item has any children; otherwise returns false. More... | |
QIcon | icon () const |
Returns the item's icon. More... | |
QModelIndex | index () const |
Returns the QModelIndex associated with this item. More... | |
void | insertColumn (int column, const QList< QStandardItem *> &items) |
Inserts a column at column containing items. More... | |
void | insertColumns (int column, int count) |
Inserts count columns of child items at column column. More... | |
void | insertRow (int row, const QList< QStandardItem *> &items) |
Inserts a row at row containing items. More... | |
void | insertRow (int row, QStandardItem *item) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Inserts a row at row containing item. More... | |
void | insertRows (int row, const QList< QStandardItem *> &items) |
Inserts items at row. More... | |
void | insertRows (int row, int count) |
Inserts count rows of child items at row row. More... | |
bool | isCheckable () const |
Returns whether the item is user-checkable. More... | |
bool | isDragEnabled () const |
Returns whether the item is drag enabled. More... | |
bool | isDropEnabled () const |
Returns whether the item is drop enabled. More... | |
bool | isEditable () const |
Returns whether the item can be edited by the user. More... | |
bool | isEnabled () const |
Returns whether the item is enabled. More... | |
bool | isSelectable () const |
Returns whether the item is selectable by the user. More... | |
bool | isTristate () const |
Returns whether the item is tristate; that is, if it's checkable with three separate states. More... | |
QStandardItemModel * | model () const |
Returns the QStandardItemModel that this item belongs to. More... | |
virtual bool | operator< (const QStandardItem &other) const |
Returns true if this item is less than other; otherwise returns false. More... | |
QStandardItem * | parent () const |
Returns the item's parent item, or 0 if the item has no parent. More... | |
QStandardItem () | |
Constructs an item. More... | |
QStandardItem (const QString &text) | |
Constructs an item with the given text. More... | |
QStandardItem (const QIcon &icon, const QString &text) | |
Constructs an item with the given icon and text. More... | |
QStandardItem (int rows, int columns=1) | |
Constructs an item with rows rows and columns columns of child items. More... | |
virtual void | read (QDataStream &in) |
Reads the item from stream in. More... | |
void | removeColumn (int column) |
Removes the given column. More... | |
void | removeColumns (int column, int count) |
Removes count columns at column column. More... | |
void | removeRow (int row) |
Removes the given row. More... | |
void | removeRows (int row, int count) |
Removes count rows at row row. More... | |
int | row () const |
Returns the row where the item is located in its parent's child table, or -1 if the item has no parent. More... | |
int | rowCount () const |
Returns the number of child item rows that the item has. More... | |
void | setAccessibleDescription (const QString &accessibleDescription) |
Sets the item's accessible description to the string specified by accessibleDescription. More... | |
void | setAccessibleText (const QString &accessibleText) |
Sets the item's accessible text to the string specified by accessibleText. More... | |
void | setBackground (const QBrush &brush) |
Sets the item's background brush to the specified brush. More... | |
void | setCheckable (bool checkable) |
Sets whether the item is user-checkable. More... | |
void | setCheckState (Qt::CheckState checkState) |
Sets the check state of the item to be state. More... | |
void | setChild (int row, int column, QStandardItem *item) |
Sets the child item at (row, column) to item. More... | |
void | setChild (int row, QStandardItem *item) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the child at row to item. More... | |
void | setColumnCount (int columns) |
Sets the number of child item columns to columns. More... | |
virtual void | setData (const QVariant &value, int role=Qt::UserRole+1) |
Sets the item's data for the given role to the specified value. More... | |
void | setDragEnabled (bool dragEnabled) |
Sets whether the item is drag enabled. More... | |
void | setDropEnabled (bool dropEnabled) |
Sets whether the item is drop enabled. More... | |
void | setEditable (bool editable) |
Sets whether the item is editable. More... | |
void | setEnabled (bool enabled) |
Sets whether the item is enabled. More... | |
void | setFlags (Qt::ItemFlags flags) |
Sets the item flags for the item to flags. More... | |
void | setFont (const QFont &font) |
Sets the font used to display the item's text to the given font. More... | |
void | setForeground (const QBrush &brush) |
Sets the brush used to display the item's foreground (e. More... | |
void | setIcon (const QIcon &icon) |
Sets the item's icon to the icon specified. More... | |
void | setRowCount (int rows) |
Sets the number of child item rows to rows. More... | |
void | setSelectable (bool selectable) |
Sets whether the item is selectable. More... | |
void | setSizeHint (const QSize &sizeHint) |
Sets the size hint for the item to be size. More... | |
void | setStatusTip (const QString &statusTip) |
Sets the item's status tip to the string specified by statusTip. More... | |
void | setText (const QString &text) |
Sets the item's text to the text specified. More... | |
void | setTextAlignment (Qt::Alignment textAlignment) |
Sets the text alignment for the item's text to the alignment specified. More... | |
void | setToolTip (const QString &toolTip) |
Sets the item's tooltip to the string specified by toolTip. More... | |
void | setTristate (bool tristate) |
Sets whether the item is tristate. More... | |
void | setWhatsThis (const QString &whatsThis) |
Sets the item's "What's This?" help to the string specified by whatsThis. More... | |
QSize | sizeHint () const |
Returns the size hint set for the item, or an invalid QSize if no size hint has been set. More... | |
void | sortChildren (int column, Qt::SortOrder order=Qt::AscendingOrder) |
Sorts the children of the item using the given order, by the values in the given column. More... | |
QString | statusTip () const |
Returns the item's status tip. More... | |
QStandardItem * | takeChild (int row, int column=0) |
Removes the child item at (row, column) without deleting it, and returns a pointer to the item. More... | |
QList< QStandardItem * > | takeColumn (int column) |
Removes column without deleting the column items, and returns a list of pointers to the removed items. More... | |
QList< QStandardItem * > | takeRow (int row) |
Removes row without deleting the row items, and returns a list of pointers to the removed items. More... | |
QString | text () const |
Returns the item's text. More... | |
Qt::Alignment | textAlignment () const |
Returns the text alignment for the item's text. More... | |
QString | toolTip () const |
Returns the item's tooltip. More... | |
virtual int | type () const |
Returns the type of this item. More... | |
QString | whatsThis () const |
Returns the item's "What's This?" help. More... | |
virtual void | write (QDataStream &out) const |
Writes the item to stream out. More... | |
virtual | ~QStandardItem () |
Destructs the item. More... | |
Protected Functions | |
void | emitDataChanged () |
Causes the model associated with this item to emit a dataChanged() signal for this item. More... | |
QStandardItem & | operator= (const QStandardItem &other) |
Assigns other's data and flags to this item. More... | |
QStandardItem (const QStandardItem &other) | |
Constructs a copy of other. More... | |
QStandardItem (QStandardItemPrivate &dd) | |
Protected Variables | |
QScopedPointer< QStandardItemPrivate > | d_ptr |
Friends | |
class | QStandardItemModel |
class | QStandardItemModelPrivate |
Related Functions | |
(Note that these are not member functions.) | |
QDataStream & | operator<< (QDataStream &out, const QStandardItem &item) |
Writes the QStandardItem item to stream out. More... | |
QDataStream & | operator>> (QDataStream &in, QStandardItem &item) |
Reads a QStandardItem from stream in into item. More... | |
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().
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().
Definition at line 66 of file qstandarditemmodel.h.
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.
Enumerator | |
---|---|
Type | |
UserType |
Definition at line 230 of file qstandarditemmodel.h.
QStandardItem::QStandardItem | ( | ) |
Constructs an item.
Definition at line 701 of file qstandarditemmodel.cpp.
Referenced by clone().
QStandardItem::QStandardItem | ( | const QString & | text | ) |
Constructs an item with the given text.
Definition at line 711 of file qstandarditemmodel.cpp.
Constructs an item with the given icon and text.
Definition at line 722 of file qstandarditemmodel.cpp.
|
explicit |
Constructs an item with rows rows and columns columns of child items.
Definition at line 734 of file qstandarditemmodel.cpp.
|
virtual |
Destructs the item.
This causes the item's children to be destructed as well.
Definition at line 784 of file qstandarditemmodel.cpp.
|
protected |
Constructs a copy of other.
Note that model() is not copied.
This function is useful when reimplementing clone().
Definition at line 759 of file qstandarditemmodel.cpp.
|
protected |
Definition at line 746 of file qstandarditemmodel.cpp.
|
inline |
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).
Definition at line 144 of file qstandarditemmodel.h.
|
inline |
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).
Definition at line 139 of file qstandarditemmodel.h.
|
inline |
Appends a column containing items.
If necessary, the row count is increased to the size of items.
Definition at line 307 of file qstandarditemmodel.h.
Referenced by QStandardItemModel::appendColumn().
|
inline |
Appends a row containing items.
If necessary, the column count is increased to the size of items.
Definition at line 301 of file qstandarditemmodel.h.
Referenced by QStandardItemModel::appendRow().
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.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.
Definition at line 313 of file qstandarditemmodel.h.
|
inline |
Appends rows containing items.
The column count will not change.
Definition at line 304 of file qstandarditemmodel.h.
|
inline |
Returns the brush used to render the item's background.
Definition at line 124 of file qstandarditemmodel.h.
|
inline |
Returns the checked state of the item.
Definition at line 134 of file qstandarditemmodel.h.
QStandardItem * QStandardItem::child | ( | int | row, |
int | column = 0 |
||
) | const |
Returns the child item at (row, column) if one has been set; otherwise returns 0.
Definition at line 1811 of file qstandarditemmodel.cpp.
Referenced by QStandardItemModelPrivate::itemFromIndex(), QStandardItemModel::itemFromIndex(), and QStandardItemPrivate::sortChildren().
|
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.
Definition at line 1982 of file qstandarditemmodel.cpp.
Referenced by QStandardItemModelPrivate::createItem().
int QStandardItem::column | ( | ) | const |
Returns the column where the item is located in its parent's child table, or -1 if the item has no parent.
Definition at line 1457 of file qstandarditemmodel.cpp.
Referenced by QStandardItemModel::mimeData(), and takeRow().
int QStandardItem::columnCount | ( | ) | const |
Returns the number of child item columns that the item has.
Definition at line 1546 of file qstandarditemmodel.cpp.
Referenced by QStandardItemModel::columnCount(), hasChildren(), QStandardItemModel::index(), insertColumns(), insertRow(), QStandardItemModel::mimeData(), removeColumns(), QStandardItemModel::removeColumns(), setColumnCount(), and takeColumn().
|
virtual |
Returns the item's data for the given role, or an invalid QVariant if there is no data for the role.
Definition at line 845 of file qstandarditemmodel.cpp.
Referenced by QStandardItemModel::data(), flags(), QStandardItemModel::headerData(), operator<(), and setCheckable().
|
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().
Definition at line 872 of file qstandarditemmodel.cpp.
Qt::ItemFlags QStandardItem::flags | ( | ) | const |
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.
Definition at line 902 of file qstandarditemmodel.cpp.
Referenced by QStandardItemModel::flags(), read(), and write().
|
inline |
Returns the font used to render the item's text.
Definition at line 114 of file qstandarditemmodel.h.
|
inline |
Returns the brush used to render the item's foreground (e.
g. text).
\sa setForeground() background()
Definition at line 129 of file qstandarditemmodel.h.
bool QStandardItem::hasChildren | ( | ) | const |
Returns true if this item has any children; otherwise returns false.
Definition at line 1780 of file qstandarditemmodel.cpp.
Referenced by QStandardItemModel::hasChildren().
|
inline |
Returns the item's icon.
Definition at line 83 of file qstandarditemmodel.h.
QModelIndex QStandardItem::index | ( | ) | const |
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.
Definition at line 1476 of file qstandarditemmodel.cpp.
Referenced by child(), QStandardItemModel::dropMimeData(), takeChild(), takeColumn(), and takeRow().
void QStandardItem::insertColumn | ( | int | column, |
const QList< QStandardItem *> & | items | ||
) |
Inserts a column at column containing items.
If necessary, the row count is increased to the size of items.
Definition at line 1587 of file qstandarditemmodel.cpp.
Referenced by QStandardItemModel::insertColumn().
void QStandardItem::insertColumns | ( | int | column, |
int | count | ||
) |
Inserts count columns of child items at column column.
Definition at line 1617 of file qstandarditemmodel.cpp.
Referenced by QStandardItemModel::insertColumns(), and setColumnCount().
void QStandardItem::insertRow | ( | int | row, |
const QList< QStandardItem *> & | items | ||
) |
Inserts a row at row containing items.
If necessary, the column count is increased to the size of items.
Definition at line 1558 of file qstandarditemmodel.cpp.
Referenced by QStandardItemModel::insertRow().
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.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.
Definition at line 310 of file qstandarditemmodel.h.
void QStandardItem::insertRows | ( | int | row, |
const QList< QStandardItem *> & | items | ||
) |
Inserts items at row.
The column count wont be changed.
Definition at line 1573 of file qstandarditemmodel.cpp.
Referenced by QComboBox::insertItems(), QStandardItemModel::insertRows(), and setRowCount().
void QStandardItem::insertRows | ( | int | row, |
int | count | ||
) |
Inserts count rows of child items at row row.
Definition at line 1602 of file qstandarditemmodel.cpp.
|
inline |
Returns whether the item is user-checkable.
The default value is false.
Definition at line 167 of file qstandarditemmodel.h.
Referenced by setCheckable().
|
inline |
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.
Definition at line 178 of file qstandarditemmodel.h.
|
inline |
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.
Definition at line 183 of file qstandarditemmodel.h.
|
inline |
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.
Definition at line 157 of file qstandarditemmodel.h.
|
inline |
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.
Definition at line 152 of file qstandarditemmodel.h.
|
inline |
Returns whether the item is selectable by the user.
The default value is true.
Definition at line 162 of file qstandarditemmodel.h.
|
inline |
Returns whether the item is tristate; that is, if it's checkable with three separate states.
The default value is false.
Definition at line 172 of file qstandarditemmodel.h.
QStandardItemModel * QStandardItem::model | ( | ) | const |
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.
Definition at line 1490 of file qstandarditemmodel.cpp.
Referenced by QStandardItemPrivate::insertRows(), operator<(), QStandardItemModel::setHorizontalHeaderItem(), QStandardItemPrivate::setModel(), and QStandardItemModel::setVerticalHeaderItem().
|
virtual |
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.
Definition at line 1918 of file qstandarditemmodel.cpp.
|
protected |
Assigns other's data and flags to this item.
Note that type() and model() are not copied.
This function is useful when reimplementing clone().
Definition at line 773 of file qstandarditemmodel.cpp.
Referenced by QStandardItem().
QStandardItem * QStandardItem::parent | ( | ) | const |
Returns the item's parent item, or 0 if the item has no parent.
Definition at line 793 of file qstandarditemmodel.cpp.
Referenced by QStandardItemModel::indexFromItem(), QStandardItemPrivate::insertColumns(), QStandardItemPrivate::insertRows(), QStandardItemModelPrivate::itemChanged(), and QStandardItemPrivate::setChild().
|
virtual |
Reads the item from stream in.
Only the data and flags of the item are read, not the child items.
Definition at line 2008 of file qstandarditemmodel.cpp.
Referenced by operator>>().
void QStandardItem::removeColumn | ( | int | column | ) |
Removes the given column.
The items that were in the column are deleted.
Definition at line 1715 of file qstandarditemmodel.cpp.
void QStandardItem::removeColumns | ( | int | column, |
int | count | ||
) |
Removes count columns at column column.
The items that were in those columns are deleted.
Definition at line 1753 of file qstandarditemmodel.cpp.
Referenced by removeColumn(), QStandardItemModel::removeColumns(), and setColumnCount().
void QStandardItem::removeRow | ( | int | row | ) |
Removes the given row.
The items that were in the row are deleted.
Definition at line 1704 of file qstandarditemmodel.cpp.
void QStandardItem::removeRows | ( | int | row, |
int | count | ||
) |
Removes count rows at row row.
The items that were in those rows are deleted.
Definition at line 1726 of file qstandarditemmodel.cpp.
Referenced by removeRow(), QStandardItemModel::removeRows(), and setRowCount().
int QStandardItem::row | ( | ) | const |
Returns the row where the item is located in its parent's child table, or -1 if the item has no parent.
Definition at line 1444 of file qstandarditemmodel.cpp.
Referenced by QStandardItemModel::mimeData(), removeColumns(), and takeColumn().
int QStandardItem::rowCount | ( | ) | const |
Returns the number of child item rows that the item has.
Definition at line 1518 of file qstandarditemmodel.cpp.
Referenced by hasChildren(), QStandardItemModel::index(), insertColumn(), insertRows(), removeRows(), QStandardItemModel::removeRows(), QStandardItemModel::rowCount(), setRowCount(), sortChildren(), and takeRow().
|
inline |
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).
Definition at line 295 of file qstandarditemmodel.h.
|
inline |
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).
Definition at line 292 of file qstandarditemmodel.h.
|
inline |
Sets the item's background brush to the specified brush.
Definition at line 283 of file qstandarditemmodel.h.
void 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.
Definition at line 1320 of file qstandarditemmodel.cpp.
|
inline |
Sets the check state of the item to be state.
Definition at line 289 of file qstandarditemmodel.h.
void 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.
Definition at line 1792 of file qstandarditemmodel.cpp.
Referenced by QStandardItemModel::dropMimeData(), and QStandardItemModel::itemFromIndex().
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the child at row to item.
Definition at line 298 of file qstandarditemmodel.h.
void QStandardItem::setColumnCount | ( | int | columns | ) |
Sets the number of child item columns to columns.
If this is less than columnCount(), the data in the unwanted columns is discarded.
Definition at line 1530 of file qstandarditemmodel.cpp.
Referenced by insertRow(), and QStandardItem().
|
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.
Definition at line 814 of file qstandarditemmodel.cpp.
Referenced by QComboBox::insertItem(), setCheckable(), QStandardItemModel::setData(), setFlags(), and QStandardItemModel::setHeaderData().
void 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.
Definition at line 1383 of file qstandarditemmodel.cpp.
void 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().
Definition at line 1416 of file qstandarditemmodel.cpp.
void 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.
Definition at line 1258 of file qstandarditemmodel.cpp.
void 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.
Definition at line 1226 of file qstandarditemmodel.cpp.
void QStandardItem::setFlags | ( | Qt::ItemFlags | flags | ) |
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.
Definition at line 887 of file qstandarditemmodel.cpp.
Referenced by QStandardItemModelPrivate::QStandardItemModelPrivate(), and read().
|
inline |
Sets the font used to display the item's text to the given font.
Definition at line 277 of file qstandarditemmodel.h.
|
inline |
Sets the brush used to display the item's foreground (e.
g. text) to the given brush.
Definition at line 286 of file qstandarditemmodel.h.
|
inline |
Sets the item's icon to the icon specified.
Definition at line 256 of file qstandarditemmodel.h.
Referenced by QStandardItem().
void QStandardItem::setRowCount | ( | int | rows | ) |
Sets the number of child item rows to rows.
If this is less than rowCount(), the data in the unwanted rows is discarded.
Definition at line 1502 of file qstandarditemmodel.cpp.
Referenced by insertColumn(), and QStandardItem().
void 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.
Definition at line 1291 of file qstandarditemmodel.cpp.
|
inline |
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.
Definition at line 274 of file qstandarditemmodel.h.
|
inline |
Sets the item's status tip to the string specified by statusTip.
Definition at line 265 of file qstandarditemmodel.h.
|
inline |
Sets the item's text to the text specified.
Definition at line 253 of file qstandarditemmodel.h.
Referenced by QStandardItem(), QStandardItemModel::setHorizontalHeaderLabels(), and QStandardItemModel::setVerticalHeaderLabels().
|
inline |
Sets the text alignment for the item's text to the alignment specified.
Definition at line 280 of file qstandarditemmodel.h.
|
inline |
Sets the item's tooltip to the string specified by toolTip.
Definition at line 260 of file qstandarditemmodel.h.
void 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().)
Definition at line 1352 of file qstandarditemmodel.cpp.
|
inline |
Sets the item's "What's This?" help to the string specified by whatsThis.
Definition at line 270 of file qstandarditemmodel.h.
|
inline |
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.
Definition at line 109 of file qstandarditemmodel.h.
void QStandardItem::sortChildren | ( | int | column, |
Qt::SortOrder | order = Qt::AscendingOrder |
||
) |
Sorts the children of the item using the given order, by the values in the given column.
Definition at line 1961 of file qstandarditemmodel.cpp.
|
inline |
Returns the item's status tip.
Definition at line 96 of file qstandarditemmodel.h.
QStandardItem * 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.
Definition at line 1830 of file qstandarditemmodel.cpp.
QList< QStandardItem * > 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.
Definition at line 1883 of file qstandarditemmodel.cpp.
QList< QStandardItem * > 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.
Definition at line 1851 of file qstandarditemmodel.cpp.
|
inline |
Returns the item's text.
This is the text that's presented to the user in a view.
Definition at line 78 of file qstandarditemmodel.h.
|
inline |
Returns the text alignment for the item's text.
Definition at line 119 of file qstandarditemmodel.h.
|
inline |
Returns the item's tooltip.
Definition at line 89 of file qstandarditemmodel.h.
|
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 .
Definition at line 1995 of file qstandarditemmodel.cpp.
|
inline |
Returns the item's "What's This?" help.
Definition at line 103 of file qstandarditemmodel.h.
|
virtual |
Writes the item to stream out.
Only the data and flags of the item are written, not the child items.
Definition at line 2023 of file qstandarditemmodel.cpp.
Referenced by operator<<().
|
related |
Writes the QStandardItem item to stream out.
This operator uses QStandardItem::write().
Definition at line 2062 of file qstandarditemmodel.cpp.
|
related |
Reads a QStandardItem from stream in into item.
This operator uses QStandardItem::read().
Definition at line 2043 of file qstandarditemmodel.cpp.
|
friend |
Definition at line 250 of file qstandarditemmodel.h.
|
friend |
Definition at line 249 of file qstandarditemmodel.h.
|
protected |
Definition at line 243 of file qstandarditemmodel.h.
Referenced by QStandardItemModel::mimeData().