I have a Basic Component class. Other classes are imposed on him. All functions I implement in class followers. There are children in these classes In my window, I implement the table and in this table I have to write the children of different classes. such as Tsategory's class and he has children. I need to write these children in the table. but when I do it on a date I do not show anything ((
int TableModel::rowCount(const QModelIndex& /*parent*/) const
{
return (int)mCompositeComponent->numChildren();
}
int TableModel::columnCount(const QModelIndex& /*parent*/) const
{
return 3;
}
QVariant TableModel::data(const QModelIndex& index, int role) const
{
int row = index.row();
int col = index.column();
if (role == Qt::DisplayRole)
{
const Component* component = mCompositeComponent->child(row);
if (component != nullptr)
return QString(component->name());
}
return QVariant();
}