42 #ifndef QSTANDARDITEMMODEL_H 43 #define QSTANDARDITEMMODEL_H 45 #include <QtCore/qabstractitemmodel.h> 46 #include <QtGui/qbrush.h> 47 #include <QtGui/qfont.h> 48 #include <QtGui/qicon.h> 49 #ifndef QT_NO_DATASTREAM 50 #include <QtCore/qdatastream.h> 59 #ifndef QT_NO_STANDARDITEMMODEL 61 template <
class T>
class QList;
81 inline void setText(
const QString &text);
86 inline void setIcon(
const QIcon &icon);
92 inline void setToolTip(
const QString &toolTip);
95 #ifndef QT_NO_STATUSTIP 99 inline void setStatusTip(
const QString &statusTip);
102 #ifndef QT_NO_WHATSTHIS 106 inline void setWhatsThis(
const QString &whatsThis);
112 inline void setSizeHint(
const QSize &sizeHint);
117 inline void setFont(
const QFont &font);
122 inline void setTextAlignment(Qt::Alignment textAlignment);
127 inline void setBackground(
const QBrush &brush);
132 inline void setForeground(
const QBrush &brush);
142 inline void setAccessibleText(
const QString &accessibleText);
147 inline void setAccessibleDescription(
const QString &accessibleDescription);
149 Qt::ItemFlags flags()
const;
150 void setFlags(Qt::ItemFlags flags);
160 void setEditable(
bool editable);
165 void setSelectable(
bool selectable);
170 void setCheckable(
bool checkable);
175 void setTristate(
bool tristate);
177 #ifndef QT_NO_DRAGANDDROP 181 void setDragEnabled(
bool dragEnabled);
186 void setDropEnabled(
bool dropEnabled);
187 #endif // QT_NO_DRAGANDDROP 195 int rowCount()
const;
196 void setRowCount(
int rows);
197 int columnCount()
const;
198 void setColumnCount(
int columns);
200 bool hasChildren()
const;
208 void insertRows(
int row,
int count);
209 void insertColumns(
int column,
int count);
211 void removeRow(
int row);
212 void removeColumn(
int column);
213 void removeRows(
int row,
int count);
214 void removeColumns(
int column,
int count);
231 virtual int type()
const;
233 #ifndef QT_NO_DATASTREAM 245 void emitDataChanged();
259 #ifndef QT_NO_TOOLTIP 264 #ifndef QT_NO_STATUSTIP 269 #ifndef QT_NO_WHATSTHIS 299 { setChild(arow, 0, aitem); }
302 { insertRow(rowCount(), aitems); }
305 { insertRows(rowCount(), aitems); }
308 { insertColumn(columnCount(), aitems); }
314 { insertRow(rowCount(), aitem); }
356 #ifdef Q_NO_USING_KEYWORD 373 void setHorizontalHeaderItem(
int column,
QStandardItem *item);
377 void setHorizontalHeaderLabels(
const QStringList &labels);
378 void setVerticalHeaderLabels(
const QStringList &labels);
380 void setRowCount(
int rows);
381 void setColumnCount(
int columns);
406 int column = 0)
const;
408 int sortRole()
const;
409 void setSortRole(
int role);
432 { setItem(arow, 0, aitem); }
445 #ifndef QT_NO_DATASTREAM 450 #endif // QT_NO_STANDARDITEMMODEL 456 #endif //QSTANDARDITEMMODEL_H The QVariant class acts like a union for the most common Qt data types.
virtual int columnCount(const QModelIndex &parent=QModelIndex()) const =0
Returns the number of columns for the children of the given parent.
bool isCheckable() const
Returns whether the item is user-checkable.
void setWhatsThis(const QString &whatsThis)
Sets the item's "What's This?" help to the string specified by whatsThis.
void appendRow(const QList< QStandardItem *> &items)
Appends a row containing items.
virtual bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent)
Handles the data supplied by a drag and drop operation that ended with the given action.
#define QT_END_NAMESPACE
This macro expands to.
virtual QMap< int, QVariant > itemData(const QModelIndex &index) const
Returns a map with values for all predefined roles in the model for the item at the given index...
QIcon icon() const
Returns the item's icon.
virtual int rowCount(const QModelIndex &parent=QModelIndex()) const =0
Returns the number of rows under the given parent.
void setAccessibleDescription(const QString &accessibleDescription)
Sets the item's accessible description to the string specified by accessibleDescription.
Q_GUI_EXPORT QDataStream & operator>>(QDataStream &in, QStandardItem &item)
static void clear(QVariant::Private *d)
virtual bool setItemData(const QModelIndex &index, const QMap< int, QVariant > &roles)
Sets the role data for the item at index to the associated value in roles, for every Qt::ItemDataRole...
virtual bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole)
Sets the role data for the item at index to value.
virtual QStringList mimeTypes() const
Returns a list of MIME types that can be used to describe a list of model indexes.
#define Q_DISABLE_COPY(Class)
Disables the use of copy constructors and assignment operators for the given Class.
#define Q_PRIVATE_SLOT(d, signature)
virtual Qt::DropActions supportedDropActions() const
Returns the drop actions supported by this model.
void setBackground(const QBrush &brush)
Sets the item's background brush to the specified brush.
The QStandardItemModel class provides a generic model for storing custom data.
void insertRow(int row, const QList< QStandardItem *> &items)
Inserts a row at row containing items.
void insertRow(int row, const QList< QStandardItem *> &items)
Inserts a row at row containing items.
The QString class provides a Unicode character string.
bool isEditable() const
Returns whether the item can be edited by the user.
void setSizeHint(const QSize &sizeHint)
Sets the size hint for the item to be size.
void setChild(int row, int column, QStandardItem *item)
Sets the child item at (row, column) to item.
bool isDragEnabled() const
Returns whether the item is drag enabled.
QString toolTip() const
Returns the item's tooltip.
The QObject class is the base class of all Qt objects.
bool operator<(int priority, const QPair< QRunnable *, int > &p)
void setIcon(const QIcon &icon)
Sets the item's icon to the icon specified.
virtual QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const
Returns the data for the given role and section in the header with the specified orientation.
QBrush background() const
Returns the brush used to render the item's background.
virtual void sort(int column, Qt::SortOrder order=Qt::AscendingOrder)
Sorts the model by column in the given order.
QBrush foreground() const
Returns the brush used to render the item's foreground (e.
virtual Qt::ItemFlags flags(const QModelIndex &index) const
Returns the item flags for the given index.
virtual QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const =0
Returns the index of the item in the model specified by the given row, column and parent index...
QString statusTip() const
Returns the item's status tip.
void setItem(int row, int column, QStandardItem *item)
Sets the item for the given row and column to item.
Qt::CheckState checkState() const
Returns the checked state of the item.
#define QT_BEGIN_NAMESPACE
This macro expands to.
virtual bool hasChildren(const QModelIndex &parent=QModelIndex()) const
Returns true if parent has any children; otherwise returns false.
bool insertRow(int row, const QModelIndex &parent=QModelIndex())
Inserts a single row before the given row in the child items of the parent specified.
void setFont(const QFont &font)
Sets the font used to display the item's text to the given font.
Q_GUI_EXPORT QDataStream & operator<<(QDataStream &out, const QStandardItem &item)
static bool setData(const QByteArray &data, STGMEDIUM *pmedium)
int sortRole
the item role that is used to query the model's data when sorting items
The QStringList class provides a list of strings.
QString text() const
Returns the item's text.
virtual bool removeRows(int row, int count, const QModelIndex &parent=QModelIndex())
On models that support this, removes count rows starting with the given row under parent parent from ...
static const char * data(const QByteArray &arr)
QFont font() const
Returns the font used to render the item's text.
QString accessibleText() const
Returns the item's accessible text.
Qt::Alignment textAlignment() const
Returns the text alignment for the item's text.
virtual QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const =0
Returns the data stored under the given role for the item referred to by the index.
The QMimeData class provides a container for data that records information about its MIME type...
virtual bool insertRows(int row, int count, const QModelIndex &parent=QModelIndex())
On models that support this, inserts count rows into the model before the given row.
The QAbstractItemModel class provides the abstract interface for item model classes.
virtual bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role=Qt::EditRole)
Sets the data for the given role and section in the header with the specified orientation to the valu...
void appendRow(const QList< QStandardItem *> &items)
Appends a row containing items.
bool isTristate() const
Returns whether the item is tristate; that is, if it's checkable with three separate states...
bool isDropEnabled() const
Returns whether the item is drop enabled.
void appendRows(const QList< QStandardItem *> &items)
Appends rows containing items.
The QBrush class defines the fill pattern of shapes drawn by QPainter.
bool insertColumn(int column, const QModelIndex &parent=QModelIndex())
Inserts a single column before the given column in the child items of the parent specified.
void appendColumn(const QList< QStandardItem *> &items)
Appends a column containing items.
The QFont class specifies a font used for drawing text.
QObject * parent() const
Returns a pointer to the parent object.
The QModelIndex class is used to locate data in a data model.
bool isSelectable() const
Returns whether the item is selectable by the user.
bool isEnabled() const
Returns whether the item is enabled.
QString accessibleDescription() const
Returns the item's accessible description.
virtual bool insertColumns(int column, int count, const QModelIndex &parent=QModelIndex())
On models that support this, inserts count new columns into the model before the given column...
T qvariant_cast(const QVariant &)
The QSize class defines the size of a two-dimensional object using integer point precision.
void setAccessibleText(const QString &accessibleText)
Sets the item's accessible text to the string specified by accessibleText.
#define Q_DECLARE_PRIVATE(Class)
QString whatsThis() const
Returns the item's "What's This?" help.
The QDataStream class provides serialization of binary data to a QIODevice.
QSize sizeHint() const
Returns the size hint set for the item, or an invalid QSize if no size hint has been set...
The QStandardItem class provides an item for use with the QStandardItemModel class.
void setToolTip(const QString &toolTip)
Sets the item's tooltip to the string specified by toolTip.
void setCheckState(Qt::CheckState checkState)
Sets the check state of the item to be state.
void setTextAlignment(Qt::Alignment textAlignment)
Sets the text alignment for the item's text to the alignment specified.
void insertColumn(int column, const QList< QStandardItem *> &items)
Inserts a column at column containing items.
ItemType
This enum describes the types that are used to describe standard items.
QScopedPointer< QStandardItemPrivate > d_ptr
virtual bool removeColumns(int column, int count, const QModelIndex &parent=QModelIndex())
On models that support this, removes count columns starting with the given column under parent parent...
void setStatusTip(const QString &statusTip)
Sets the item's status tip to the string specified by statusTip.
void setForeground(const QBrush &brush)
Sets the brush used to display the item's foreground (e.
The QMap class is a template class that provides a skip-list-based dictionary.
virtual QMimeData * mimeData(const QModelIndexList &indexes) const
Returns an object that contains serialized items of data corresponding to the list of indexes specifi...
The QList class is a template class that provides lists.
The QIcon class provides scalable icons in different modes and states.