MCPcopy Create free account
hub / github.com/bupticybee/TexasSolver / BoardSelectorTableModel

Method BoardSelectorTableModel

src/ui/boardselectortablemodel.cpp:3–21  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1#include "include/ui/boardselectortablemodel.h"
2
3BoardSelectorTableModel::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
23float BoardSelectorTableModel::getBoardAt(int i, int j){
24 if(i < 0 || i >= this->ranklist.size()){

Callers

nothing calls this directly

Calls 3

get_ij_textMethod · 0.95
setBoardTextMethod · 0.95
sizeMethod · 0.80

Tested by

no test coverage detected