void TileContentBaseModel::setRootItem(BaseItem * rootItem)
{
if (RootItem != rootItem)
{
beginResetModel();
if (RootItem)
{
disconnect(RootItem, SIGNAL(changedValue(BaseItem*)), this, SLOT(updateValue(BaseItem*)));
}
RootItem = rootItem;
if (RootItem)
{
connect(RootItem, SIGNAL(changedValue(BaseItem*)), this, SLOT(updateValue(BaseItem*)));
}
endResetModel();
emit dataChanged(index1,
index2,
QVector<int>()
<< Qt::DisplayRole
<< Qt::TextColorRole);
}
}
void TileContentBaseModel::setRootItem(BaseItem * rootItem)
{
if (RootItem != rootItem)
{
beginResetModel();
if (RootItem)
{
disconnect(RootItem, SIGNAL(changedValue(BaseItem*)), this, SLOT(updateValue(BaseItem*)));
}
RootItem = rootItem;
if (RootItem)
{
connect(RootItem, SIGNAL(changedValue(BaseItem*)), this, SLOT(updateValue(BaseItem*)));
}
endResetModel();
QModelIndex index1 = index(0,0, QModelIndex());
QModelIndex index2 = index(rowCount()-1,columnCount()-1, QModelIndex());
emit dataChanged(index1,
index2,
QVector<int>()
<< Qt::DisplayRole
<< Qt::TextColorRole);
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks