just use QTableView & subclass QAbstractTableModel as your model.
Look here how to do exactly.
inside your model you can use any kind of datastructure you want:
{
if (!index.isValid())
if (role == Qt::TextAlignmentRole)
{
return int(Qt::AlignRight | Qt::AlignVCenter);
}
else if(role == Qt::ToolTipRole)
{
return "hello"; // for example
}
else if (role == Qt::DisplayRole)
{
return myData[index.row()][index.column()]; // for example
}
}
QVariant MyTableModel::data(const QModelIndex &index, int role) const
{
if (!index.isValid())
return QVariant();
if (role == Qt::TextAlignmentRole)
{
return int(Qt::AlignRight | Qt::AlignVCenter);
}
else if(role == Qt::ToolTipRole)
{
return "hello"; // for example
}
else if (role == Qt::DisplayRole)
{
return myData[index.row()][index.column()]; // for example
}
return QVariant();
}
To copy to clipboard, switch view to plain text mode
Bookmarks