EffectFilterModel::findImage should always return a QString

Also translate the rowIndex from the EffectFilterModel to the EffectModel
This commit is contained in:
Antonis Tsiapaliokas 2013-08-28 10:31:57 +03:00 committed by Martin Gräßlin
parent 1f509b7c30
commit 4534cd03b9
2 changed files with 8 additions and 8 deletions

View file

@ -238,9 +238,8 @@ void EffectModel::reload() {
loadEffects();
}
void EffectModel::effectStatus(int rowIndex, bool effectState) {
QModelIndex currentIndex = createIndex(rowIndex, 0);
setData(currentIndex, effectState, EffectModel::EffectStatusRole);
void EffectModel::effectStatus(const QModelIndex &rowIndex, bool effectState) {
setData(rowIndex, effectState, EffectModel::EffectStatusRole);
}
void EffectModel::syncConfig() {
@ -276,9 +275,8 @@ void EffectModel::enableWidnowManagement(bool enabled) {
EffectFilterModel::EffectFilterModel(QObject *parent)
:QSortFilterProxyModel(parent),
m_effectModel(0)
m_effectModel( new EffectModel(this))
{
m_effectModel = new EffectModel(this);
setSourceModel(m_effectModel);
}
@ -338,11 +336,13 @@ bool EffectFilterModel::filterAcceptsRow(int source_row, const QModelIndex &sour
}
void EffectFilterModel::effectStatus(int rowIndex, bool effectState) {
m_effectModel->effectStatus(rowIndex, effectState);
const QModelIndex sourceIndex = mapToSource(index(rowIndex, 0));
m_effectModel->effectStatus(sourceIndex, effectState);
}
QString EffectFilterModel::findImage(const QString &imagePath, int size) {
m_effectModel->findImage(imagePath, size);
return m_effectModel->findImage(imagePath, size);
}
void EffectFilterModel::reload() {

View file

@ -74,7 +74,7 @@ public:
virtual QHash< int, QByteArray > roleNames() const override;
void effectStatus(int rowIndex, bool effectState);
void effectStatus(const QModelIndex &rowIndex, bool effectState);
QString findImage(const QString &imagePath, int size = 128);
void reload();
void syncConfig();