| 1 | #include "include/ui/boardselectortablemodel.h" |
| 2 | |
| 3 | BoardSelectorTableModel::BoardSelectorTableModel(QStringList ranks,QString initial_board,QObject *parent):QAbstractItemModel(parent){ |
| 4 | this->ranklist = ranks; |
| 5 | this->suitlist = QString("c,d,h,s").split(","); |
| 6 | |
| 7 | this->grids_string = vector<vector<QString>>(this->suitlist.size()); |
| 8 | for(int i = 0;i < this->suitlist.size();i ++){ |
| 9 | this->grids_string[i] = vector<QString>(this->ranklist.size()); |
| 10 | for(int j = 0;j < this->ranklist.size();j ++){ |
| 11 | this->grids_string[i][j] = this->get_ij_text(i,j); |
| 12 | this->string2ij[this->get_ij_text(i,j)] = pair<int,int>(i,j); |
| 13 | } |
| 14 | } |
| 15 | |
| 16 | this->grids_float = vector<vector<float>>(this->suitlist.size()); |
| 17 | for(int i = 0;i < this->suitlist.size();i ++){ |
| 18 | this->grids_float[i] = vector<float>(this->ranklist.size(),0.0); |
| 19 | } |
| 20 | this->setBoardText(initial_board); |
| 21 | } |
| 22 | |
| 23 | float BoardSelectorTableModel::getBoardAt(int i, int j){ |
| 24 | if(i < 0 || i >= this->ranklist.size()){ |
nothing calls this directly
no test coverage detected