[netinstall] Restructure model-method data()
This commit is contained in:
parent
df86972ea7
commit
4f22a70b08
@ -117,21 +117,15 @@ PackageModel::data( const QModelIndex& index, int role ) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
PackageTreeItem* item = static_cast< PackageTreeItem* >( index.internalPointer() );
|
PackageTreeItem* item = static_cast< PackageTreeItem* >( index.internalPointer() );
|
||||||
if ( index.column() == NameColumn && role == Qt::CheckStateRole )
|
switch( role )
|
||||||
{
|
{
|
||||||
return item->isSelected();
|
case Qt::CheckStateRole:
|
||||||
|
return index.column() == NameColumn ? item->isSelected() : QVariant();
|
||||||
|
case Qt::DisplayRole:
|
||||||
|
return item->isHidden() ? QVariant() : item->data( index.column() );
|
||||||
|
default:
|
||||||
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( item->isHidden() && role == Qt::DisplayRole ) // Hidden group
|
|
||||||
{
|
|
||||||
return QVariant();
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( role == Qt::DisplayRole )
|
|
||||||
{
|
|
||||||
return item->data( index.column() );
|
|
||||||
}
|
|
||||||
return QVariant();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
Loading…
Reference in New Issue
Block a user