{
Q_OBJECT
public:
virtual ~QMyModel();
enum Columns
{
COLUMN_NAME,
COLUMN_CUSTOM,
NUM_COLUMNS
};
};
{
{
setData(Name, Qt::DisplayRole);
// TODO: Put Description beside Name and make editable in TreeView.
setChild(0, QMyModel::COLUMN_NAME, "First:");
setChild(0, QMyModel::COLUMN_CUSTOM, First);
setChild(1, QMyModel::COLUMN_NAME, "Second:");
setChild(1, QMyModel::COLUMN_CUSTOM, Second);
}
}
class QMyModel : public QStandardItemModel
{
Q_OBJECT
public:
QMyModel(QObject *parent) : QStandardItemModel(parent) {};
virtual ~QMyModel();
enum Columns
{
COLUMN_NAME,
COLUMN_CUSTOM,
NUM_COLUMNS
};
};
class QMyItem : public QStandardItem
{
QMyItem(QString Name, QString Description, QString First, QString Second)
: QStandardItem()
{
setData(Name, Qt::DisplayRole);
// TODO: Put Description beside Name and make editable in TreeView.
setChild(0, QMyModel::COLUMN_NAME, "First:");
setChild(0, QMyModel::COLUMN_CUSTOM, First);
setChild(1, QMyModel::COLUMN_NAME, "Second:");
setChild(1, QMyModel::COLUMN_CUSTOM, Second);
}
}
To copy to clipboard, switch view to plain text mode
This results in the following for the
Bookmarks