I have been able to remove the unwanted header values from the rows (0-15) in the tree view. Unforunately those rows remain empty instead of being filled with the filtered values.
I have also found that the data() function can get both the header values AND data values.
QVariant PropInspectProxyModel
::data( const QModelIndex
& index,
int role
) const {
if ( index.isValid() && !source_index.isValid() )
///////////////////////////////////////////////////////////////////////////
// How do I know when to get the header data vs. getting the data values???
// Get the Property header string
QVariant vHdr
= sourceModel
()->headerData
( index.
row(), Qt
::Horizontal, role
);
// Get the data values
QVariant v
= sourceModel
()->data
( source_index, role
);
return v;
}
QVariant PropInspectProxyModel::data( const QModelIndex& index, int role ) const
{
QModelIndex source_index = mapToSource( index );
if ( index.isValid() && !source_index.isValid() )
return QVariant();
///////////////////////////////////////////////////////////////////////////
// How do I know when to get the header data vs. getting the data values???
// Get the Property header string
QVariant vHdr = sourceModel()->headerData( index.row(), Qt::Horizontal, role );
// Get the data values
QVariant v = sourceModel()->data( source_index, role );
return v;
}
To copy to clipboard, switch view to plain text mode
Two unresolved issues remain:
- How can I get my headers to fill rows 0-9 instead of 16-25?
- How do I know when to get header values or data values in the data() override function?
Examples
- HeadersHeadersOnly..JPG
- DataDataOnly..JPG
Bookmarks