Mercurial > retraceit
changeset 17:73efe717b944
Fix bug in csv model to allow changing headerdata
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Tue, 14 Apr 2015 18:55:55 +0200 |
parents | 6d5dd3ae2ad3 |
children | e12284a222ba |
files | src/filterwidget.cpp src/libqxt/qxtcsvmodel.cpp src/metadataview.cpp |
diffstat | 3 files changed, 4 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/filterwidget.cpp Tue Apr 14 17:25:44 2015 +0200 +++ b/src/filterwidget.cpp Tue Apr 14 18:55:55 2015 +0200 @@ -36,9 +36,9 @@ mCombo->addItem(entry); mColFilterMap.insert(addedItems++, i); } else { - QString shortended = entry.remove(0,1); - // TODO this does not work as expected - newSource->setHeaderData(i, Qt::Horizontal, shortended); + if (!newSource->setHeaderData(i, Qt::Horizontal, entry.remove(0,1), Qt::DisplayRole)) { + qDebug() << "Setting header data failed."; + } } } }
--- a/src/libqxt/qxtcsvmodel.cpp Tue Apr 14 17:25:44 2015 +0200 +++ b/src/libqxt/qxtcsvmodel.cpp Tue Apr 14 18:55:55 2015 +0200 @@ -265,7 +265,7 @@ bool QxtCsvModel::setHeaderData(int section, Qt::Orientation orientation, const QVariant& value, int role) { if(orientation != Qt::Horizontal) return false; // We don't support the vertical header - if(role != Qt::DisplayRole || role != Qt::EditRole) return false; // We don't support any other roles + if(role != Qt::DisplayRole && role != Qt::EditRole) return false; // We don't support any other roles if(section < 0) return false; // Bogus input while(section > qxt_d().header.size()) { qxt_d().header << QString();