}
QVariant
-FileTreeItem :: data( int column ) const
+FileTreeItem :: data (int column, int role) const
{
- QVariant value;
+ QVariant value;
- switch( column ) {
- case COL_NAME: value.setValue( fileSizeName( ) ); break;
- case COL_PROGRESS: value.setValue( progress( ) ); break;
- case COL_WANTED: value.setValue( isSubtreeWanted( ) ); break;
- case COL_PRIORITY: value.setValue( priorityString( ) ); break;
+ if (role == Qt::EditRole)
+ {
+ if (column == 0)
+ value.setValue (name());
+ }
+ else if (role == Qt::DisplayRole)
+ {
+ switch( column )
+ {
+ case COL_NAME:
+ value.setValue (fileSizeName());
+ break;
+
+ case COL_PROGRESS:
+ value.setValue (progress());
+ break;
+
+ case COL_WANTED:
+ value.setValue (isSubtreeWanted());
+ break;
+
+ case COL_PRIORITY:
+ value.setValue (priorityString());
+ break;
+ }
}
- return value;
+ return value;
}
void
{
QVariant value;
- if( index.isValid() && role==Qt::DisplayRole )
- {
- FileTreeItem *item = static_cast<FileTreeItem*>(index.internalPointer());
- value = item->data( index.column( ) );
- }
+ if (index.isValid())
+ {
+ FileTreeItem * i = static_cast<FileTreeItem*>(index.internalPointer());
+ value = i->data (index.column(), role);
+ }
return value;
}
const FileTreeItem * parent( ) const { return myParent; }
int row( ) const;
const QString& name( ) const { return myName; }
- QVariant data( int column ) const;
+ QVariant data( int column, int role ) const;
bool update( int index, bool want, int priority, uint64_t total, uint64_t have, bool torrentChanged );
void twiddleWanted( QSet<int>& fileIds, bool& );
void twiddlePriority( QSet<int>& fileIds, int& );