33 #include <QAbstractTableModel>
34 #include <QDataStream>
51 QVariant headerData(
int section, Qt::Orientation orientation,
int role = Qt::DisplayRole)
const;
72 bool loadError(QDataStream::Status);
75 double rand(
int,
int)
const;
bool saveTask(const QString &fname)
Saves current task to fname.
Definition: tspmodel.cpp:238
void numCitiesChanged(int)
This signal is emitted whenever the number of cities in the task changes.
virtual QModelIndex index(int row, int column, const QModelIndex &parent) const
void clear()
Resets the table, setting all its elements to 0.
Definition: tspmodel.cpp:47
bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole)
Sets the role data for the item at index to value.
Definition: tspmodel.cpp:329
Contains TSPSG global defines.
void setNumCities(int n)
Sets number of cities in the current task to n.
Definition: tspmodel.cpp:360
int rowCount(const QModelIndex &parent=QModelIndex()) const
Returns the row count in the table.
Definition: tspmodel.cpp:226
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const
Returns the data for the given role and section in the header with the specified orientation.
Definition: tspmodel.cpp:123
quint16 numCities() const
Returns the number of cities.
Definition: tspmodel.cpp:189
int columnCount(const QModelIndex &parent=QModelIndex()) const
Returns the column count in the table.
Definition: tspmodel.cpp:64
bool loadTask(const QString &fname)
Loads a task from fname.
Definition: tspmodel.cpp:141
CTSPModel(QObject *parent=0)
Class constructor.
Definition: tspmodel.cpp:39
void randomize()
Randomizes the table by setting all its values to random ones.
Definition: tspmodel.cpp:201
Qt::ItemFlags flags(const QModelIndex &index) const
Returns the item flags for the given index.
Definition: tspmodel.cpp:106
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const
Returns the data stored under the given role for the item referred to by the index.
Definition: tspmodel.cpp:77
This class implements table model for manipulating a task.
Definition: tspmodel.h:41