--- /dev/null
+/*******************************************************************************
+
+ This file is part of mDictionary.
+
+ mDictionary is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ mDictionary is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with mDictionary. If not, see <http://www.gnu.org/licenses/>.
+
+ Copyright 2010 Comarch S.A.
+
+*******************************************************************************/
+
+/*! \file ComboBoxModel.h
+ \brief Contains data for ComboBox QML component
+
+ \author Marcin Kaźmierczak <marcin.kazmierczak@comarch.pl>
+*/
+
+
+#ifndef COMBOBOXMODEL_H
+#define COMBOBOXMODEL_H
+
+#include <QAbstractListModel>
+#include <QList>
+#include <QHash>
+
+/*!
+ Contains a list of string values.
+ Data source for qml ComboBox
+*/
+class ComboBoxModel : public QAbstractListModel
+{
+ Q_OBJECT
+public:
+ enum ComboBoxRoles
+ {
+ ContentRole = Qt::UserRole + 1,
+ NumberRole
+ };
+
+ //! Constructor
+ /*!
+ \param contents list of elements for ComboBox
+ \param parent parent of this class.
+ */
+ explicit ComboBoxModel(QList<QString> contents, QObject *parent = 0);
+
+ int rowCount(const QModelIndex & parent = QModelIndex()) const;
+
+ QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const;
+
+ QString selectedItem();
+ int selectedIndex();
+ void setSelectedItem(QString item);
+ void setSelectedIndex(int index);
+
+private:
+ void setContents(QList<QString> contents);
+ void addItem(QString item);
+ QList<QString> _contents;
+ QString _selectedItem;
+ int _selectedIndex;
+
+};
+
+#endif // COMBOBOXMODEL_H