[calligra] kexi/widget/fields: Fixed KexiFieldListModel

Christoph Feck christoph at maxiom.de
Mon Nov 26 22:59:30 GMT 2012


On Monday 26 November 2012 21:33:19 Oleg Kukharchuk wrote:
> Git commit 175e0957fdb9ad56c5665a23b3c8c39fff5ad703 by Oleg
> Kukharchuk. Committed on 26/11/2012 at 21:30.
> Pushed by okukharchuk into branch 'master'.
> 
> Fixed KexiFieldListModel
> 
>     Added caption for a second section of the header
> 
> REVIEW: 107481
> 
> M  +8    -4    kexi/widget/fields/KexiFieldListModel.cpp
> 
> http://commits.kde.org/calligra/175e0957fdb9ad56c5665a23b3c8c39fff5
> ad703
> 
> diff --git a/kexi/widget/fields/KexiFieldListModel.cpp
> b/kexi/widget/fields/KexiFieldListModel.cpp index 91ed791..1b9d184
> 100644
> --- a/kexi/widget/fields/KexiFieldListModel.cpp
> +++ b/kexi/widget/fields/KexiFieldListModel.cpp
> @@ -127,15 +127,19 @@ int KexiFieldListModel::rowCount(const
> QModelIndex& /*parent*/) const return d->items.count();
>  }
> 
> -QVariant KexiFieldListModel::headerData(int /*section*/,
> Qt::Orientation orientation, int role) const +QVariant
> KexiFieldListModel::headerData(int section, Qt::Orientation
> orientation, int role) const {
>      if (role != Qt::DisplayRole)
>          return QVariant();
> 
> -    if (orientation == Qt::Horizontal)
> -        return i18n("Field Name");
> -    else
> +    if (orientation == Qt::Horizontal) {
> +        if (section == 0) {
> +            return i18n("Field Name");
> +        } else if (section == 1) {
> +            return i18n("Data Type");
> +        }
>          return QVariant();
> +    }
>  }
> 
>  QStringList KexiFieldListModel::mimeTypes() const

This commit fails to compile, because if orientation != Horizontal, no 
value is returned.

Christoph Feck (kdepepo)
KDE Quality Team



More information about the calligra-devel mailing list