*******************************************************************************/
-//Created by Mateusz Półrola
+/*!
+ \file DictsProxyModel.h
+ \author Mateusz Półrola <mateusz.polrola@gmail.com>
+ */
#ifndef DICTSPROXYMODEL_H
#define DICTSPROXYMODEL_H
#include <QSortFilterProxyModel>
#include <QDebug>
+
+/*!
+ Proxy model used for filtering and sorting informations about xdxf dictionaries.
+It allow to filter dictionaries based on their langages
+*/
class DictsProxyModel : public QSortFilterProxyModel
{
Q_OBJECT
}
+ /*! Returns currently setted language used to filter dictionaries based on dictionarie's language from*/
QString from() { return _from;}
+
+ /*! Returns currently setted language used to filter dictionaries based on dictionarie's language to*/
QString to() {return _to;}
+
+ /*! Sets currently setted language used to filter dictionaries based on dictionarie's language from*/
void setFrom(QString from) { _from = from; invalidateFilter(); }
+
+ /*! Sets currently setted language used to filter dictionaries based on dictionarie's language to*/
void setTo(QString to) {_to = to; invalidateFilter();}
protected:
+ /*! Filtering passed row*/
bool filterAcceptsRow(int source_row, const QModelIndex&) const {
QString sourceFrom = sourceModel()->data(
sourceModel()->index(source_row, 0)).toString();
(_to.isEmpty() || sourceTo == _to));
}
+ /*! Sorting, if sort column is set to column containing size of dictionary, string containing size of it is converted to fload and compared to other dict size*/
bool lessThan(const QModelIndex &left, const QModelIndex &right) const {
if(sortColumn() == 3) {
QString l = left.model()->data(left).toString();