Commit 63b940a6 authored by Adriaan de Groot's avatar Adriaan de Groot

[netinstall] Implement immutable groups

- An immutable group doesn't show a checkbox at all
parent 7a42a4d7
......@@ -119,7 +119,7 @@ PackageModel::data( const QModelIndex& index, int role ) const
switch ( role )
{
case Qt::CheckStateRole:
return index.column() == NameColumn ? item->isSelected() : QVariant();
return index.column() == NameColumn ? ( item->isImmutable() ? QVariant() : item->isSelected() ) : QVariant();
case Qt::DisplayRole:
return item->isHidden() ? QVariant() : item->data( index.column() );
case MetaExpandRole:
......@@ -158,6 +158,11 @@ PackageModel::flags( const QModelIndex& index ) const
}
if ( index.column() == NameColumn )
{
PackageTreeItem* item = static_cast< PackageTreeItem* >( index.internalPointer() );
if ( item->isImmutable() )
{
return QAbstractItemModel::flags( index ); //Qt::NoItemFlags;
}
return Qt::ItemIsUserCheckable | QAbstractItemModel::flags( index );
}
return QAbstractItemModel::flags( index );
......
......@@ -41,6 +41,7 @@ PackageTreeItem::PackageTreeItem( const QString& packageName, PackageTreeItem* p
, m_packageName( packageName )
, m_selected( parentCheckState( parent ) )
, m_isGroup( false )
, m_showReadOnly( parent ? parent->isImmutable() : false )
{
}
......
......@@ -97,6 +97,13 @@ public:
*/
bool expandOnStart() const { return m_startExpanded; }
/** @brief Is this an immutable item?
*
* Groups can be immutable: then you can't toggle the selected
* state of any of its items.
*/
bool isImmutable() const { return m_showReadOnly; }
/** @brief is this item selected?
*
* Groups may be partially selected; packages are only on or off.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment