mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-02-13 13:31:26 -05: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())
|
if (!index.isValid())
|
||||||
return QVariant();
|
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 */
|
/* get the data from the index */
|
||||||
void *ref = index.internalPointer();
|
void *ref = index.internalPointer();
|
||||||
int coln = index.column();
|
|
||||||
|
|
||||||
DirDetails details ;
|
DirDetails details ;
|
||||||
|
|
||||||
@ -674,20 +694,6 @@ QVariant RetroshareDirModel::data(const QModelIndex &index, int role) const
|
|||||||
Qt::SizeHintRole
|
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)
|
if (role == Qt::DisplayRole)
|
||||||
return displayRole(details,coln) ;
|
return displayRole(details,coln) ;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user