refs #655, Change signature (order) of setProperty/compareProperty

This commit is contained in:
Klaus Basan
2016-05-09 23:15:39 +02:00
committed by Roland Winklmeier
parent 49094115b1
commit 0f5d2a29a8
114 changed files with 324 additions and 331 deletions

View File

@@ -282,7 +282,7 @@ namespace BlackGui
ObjectType obj = this->m_container[index.row()];
ObjectType currentObject(obj);
BlackMisc::CPropertyIndex propertyIndex = this->columnToPropertyIndex(index.column());
obj.setPropertyByIndex(value, propertyIndex);
obj.setPropertyByIndex(propertyIndex, value);
if (obj != currentObject)
{

View File

@@ -298,7 +298,7 @@ namespace BlackGui
template<class ObjectType>
bool compareForModelSort(const ObjectType &a, const ObjectType &b, Qt::SortOrder order, const BlackMisc::CPropertyIndex &index, std::true_type)
{
int c = a.comparePropertyByIndex(b, index);
int c = a.comparePropertyByIndex(index, b);
if (c == 0) { return false; }
return (order == Qt::AscendingOrder) ? (c < 0) : (c > 0);
}

View File

@@ -786,10 +786,10 @@ namespace BlackGui
if (!hasSelection()) { return 0; }
int c = 0;
QModelIndexList indexes = this->selectedRows();
int lastUpdatedRow = -1;
int firstUpdatedRow = -1;
const CPropertyIndexList pis(vm.indexes());
const CPropertyIndexList propertyIndexes(vm.indexes());
const QModelIndexList indexes = this->selectedRows();
for (const QModelIndex &i : indexes)
{
@@ -799,9 +799,9 @@ namespace BlackGui
ObjectType obj(this->at(i));
// update all properties in map
for (const CPropertyIndex &pi : pis)
for (const CPropertyIndex &pi : propertyIndexes)
{
obj.setPropertyByIndex(vm.value(pi), pi);
obj.setPropertyByIndex(pi, vm.value(pi));
}
// and update container