mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
small optimization of RemoteDirModel::data()
This commit is contained in:
parent
5339e99127
commit
deadb1fcf1
@ -622,9 +622,29 @@ QVariant RetroshareDirModel::data(const QModelIndex &index, int role) const
|
||||
if (!index.isValid())
|
||||
return QVariant();
|
||||
|
||||
// First we take care of the cases that do not require requestDirDetails()
|
||||
|
||||
int coln = index.column();
|
||||
|
||||
if (role == Qt::SizeHintRole)
|
||||
return QVariant();
|
||||
|
||||
if (role == Qt::TextAlignmentRole)
|
||||
{
|
||||
if(coln == 1)
|
||||
return int( Qt::AlignRight | Qt::AlignVCenter);
|
||||
else
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
// This makes sorting a bit arbitrary, but prevents calling requestDirDetails(). The number of calls to sortRole is
|
||||
// indeed sometimes very high and somewhat kills the GUI responsivness.
|
||||
//
|
||||
//if (role == SortRole)
|
||||
// return QVariant(index.row()) ;
|
||||
|
||||
/* get the data from the index */
|
||||
void *ref = index.internalPointer();
|
||||
int coln = index.column();
|
||||
|
||||
DirDetails details ;
|
||||
|
||||
@ -674,20 +694,6 @@ QVariant RetroshareDirModel::data(const QModelIndex &index, int role) const
|
||||
Qt::SizeHintRole
|
||||
****************/
|
||||
|
||||
if (role == Qt::SizeHintRole)
|
||||
{
|
||||
return QVariant(); // Use standard
|
||||
} /* end of SizeHintRole */
|
||||
|
||||
if (role == Qt::TextAlignmentRole)
|
||||
{
|
||||
if(coln == 1)
|
||||
{
|
||||
return int( Qt::AlignRight | Qt::AlignVCenter);
|
||||
}
|
||||
return QVariant();
|
||||
} /* end of TextAlignmentRole */
|
||||
|
||||
if (role == Qt::DisplayRole)
|
||||
return displayRole(details,coln) ;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user