source: tspsg-svn/trunk/src/tspmodel.h @ 65

Last change on this file since 65 was 65, checked in by laleppa, 15 years ago

More code documentation.

  • Property svn:keywords set to Id URL
File size: 1.8 KB
Line 
1/*!
2 * \class CTSPModel
3 * \author Copyright &copy; 2007-2009 Lёppa <contacts[at]oleksii[dot]name>
4 * \brief This class implements table model for manipulating a task.
5 *
6 *  $Id: tspmodel.h 65 2009-10-20 19:38:01Z laleppa $
7 *  $URL: https://tspsg.svn.sourceforge.net/svnroot/tspsg/trunk/src/tspmodel.h $
8 *
9 *  <b>TSPSG: TSP Solver and Generator</b>
10 *
11 *  This file is part of TSPSG.
12 *
13 *  TSPSG is free software: you can redistribute it and/or modify
14 *  it under the terms of the GNU General Public License as published by
15 *  the Free Software Foundation, either version 3 of the License, or
16 *  (at your option) any later version.
17 *
18 *  TSPSG is distributed in the hope that it will be useful,
19 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
20 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21 *  GNU General Public License for more details.
22 *
23 *  You should have received a copy of the GNU General Public License
24 *  along with TSPSG.  If not, see <http://www.gnu.org/licenses/>.
25 */
26
27#ifndef TSPMODEL_H
28#define TSPMODEL_H
29
30#include "globals.h"
31
32class CTSPModel: public QAbstractTableModel
33{
34        Q_OBJECT
35
36public:
37        CTSPModel(QObject *parent = 0);
38        void clear();
39        int columnCount(const QModelIndex &) const;
40        QVariant data(const QModelIndex &, int) const;
41        Qt::ItemFlags flags(const QModelIndex &) const;
42        QVariant headerData(int, Qt::Orientation, int) const;
43        bool loadTask(QString);
44        quint16 numCities() const;
45        void randomize();
46        int rowCount(const QModelIndex &) const;
47        bool saveTask(QString);
48        bool setData(const QModelIndex &, const QVariant &, int);
49        void setNumCities(int);
50
51signals:
52        void numCitiesChanged(int);
53
54private:
55        QSettings *settings;
56        QVector<QVector<double> > table;
57        quint16 nCities;
58        bool loadError(QDataStream::Status);
59        bool loadTSPT(QDataStream *);
60        bool loadZKT(QDataStream *);
61        int rand(int, int) const;
62};
63
64#endif // TSPMODEL_H
Note: See TracBrowser for help on using the repository browser.