mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-19 11:54:22 -04:00
correct sorting for "Reputation" in People, patch by Eugene Tooms
This commit is contained in:
parent
a34f66aaee
commit
63b88ecf68
1 changed files with 21 additions and 2 deletions
|
@ -73,7 +73,26 @@
|
||||||
#define RSID_FILTER_ALL 0xffff
|
#define RSID_FILTER_ALL 0xffff
|
||||||
|
|
||||||
#define IMAGE_EDIT ":/images/edit_16.png"
|
#define IMAGE_EDIT ":/images/edit_16.png"
|
||||||
|
// quick solution for RSID_COL_VOTES sorting
|
||||||
|
class TreeWidgetItem : public QTreeWidgetItem {
|
||||||
|
public:
|
||||||
|
TreeWidgetItem(int type=Type): QTreeWidgetItem(type) {}
|
||||||
|
TreeWidgetItem(QTreeWidget *tree): QTreeWidgetItem(tree) {}
|
||||||
|
TreeWidgetItem(const QStringList& strings): QTreeWidgetItem (strings) {}
|
||||||
|
bool operator< (const QTreeWidgetItem& other ) const {
|
||||||
|
int column = treeWidget()->sortColumn();
|
||||||
|
const QVariant v1 = data(column, Qt::DisplayRole);
|
||||||
|
const QVariant v2 = other.data(column, Qt::DisplayRole);
|
||||||
|
double value1 = v1.toDouble();
|
||||||
|
double value2 = v2.toDouble();
|
||||||
|
if (value1 != value2) {
|
||||||
|
return value1 < value2;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return (v1.toString().compare (v2.toString(), Qt::CaseInsensitive) < 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
/** Constructor */
|
/** Constructor */
|
||||||
IdDialog::IdDialog(QWidget *parent) :
|
IdDialog::IdDialog(QWidget *parent) :
|
||||||
RsGxsUpdateBroadcastPage(rsIdentity, parent),
|
RsGxsUpdateBroadcastPage(rsIdentity, parent),
|
||||||
|
@ -368,7 +387,7 @@ bool IdDialog::fillIdListItem(const RsGxsIdGroup& data, QTreeWidgetItem *&item,
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!item)
|
if (!item)
|
||||||
item = new QTreeWidgetItem();
|
item = new TreeWidgetItem();
|
||||||
|
|
||||||
RsReputations::ReputationInfo info ;
|
RsReputations::ReputationInfo info ;
|
||||||
rsReputations->getReputationInfo(RsGxsId(data.mMeta.mGroupId),info) ;
|
rsReputations->getReputationInfo(RsGxsId(data.mMeta.mGroupId),info) ;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue