// ------------------------------------------------------------- void pushQueue( Queue s, T x ) { if (s->tail == NULL) { s->head = s->tail = newCell( x, NULL ); } else { s->tail->next = newCell( x, NULL ); s->tail = s->tail->next; } s->size++; }
void tableTemplateWidget::insRow(void) { int tr, rc; int i, j; selectionRange = selectedRanges(); for (i = 0; i < selectionRange.count(); i++) { tr = selectionRange[i].topRow(); rc = selectionRange[i].rowCount(); for (j = 0; j < rc; j++) insertRow(tr); } for (i = 0; i < rc; i++) { for (j = 0; j < numCol; j++) newCell(tr+i, j, 0); } numRow = rowCount(); isDirty = true; }
void tableTemplateWidget::insColumn(void) { int lc, cc; int i, j; selectionRange = selectedRanges(); for (i = 0; i < selectionRange.count(); i++) { lc = selectionRange[i].leftColumn(); cc = selectionRange[i].columnCount(); for (j = 0; j < cc; j++) insertColumn(lc); } for (i = 0; i < numRow; i++) { for (j = 0; j < cc; j++) newCell(i, lc+j, 0); } numCol = columnCount(); isDirty = true; }
void fileInput(char argv[1], char board[41][41], char tempBoard[41][41]) { FILE *fp; char input; int coordinate1, coordinate2; int value = 1; fp = fopen(argv, "r"); // open file with commands blankBoard(board, tempBoard); while(value != 0) { fscanf(fp, "%c", &input); switch(input) { case 'a': // create new cell fscanf(fp, "%i%i", &coordinate1, &coordinate2); newCell(coordinate1, coordinate2, board); break; case 'r': // remove cell fscanf(fp, "%i%i", &coordinate1, &coordinate2); removeCell(coordinate1, coordinate2, board); break; case 'n': // next iteration advance(board, tempBoard); break; case 'q': // quit value = 0; break; case 'p': // run forever while(1) { advance(board, tempBoard); usleep(100000); } break; } } }
main(){ struct cell_m* c1 = newCell(23); struct cell_m* c2 = newCell(34); struct cell_m* c3 = newCell(45); struct cell_m* c4 = newCell(56); //struct cell_m* c4_2 = newCell(4); //Decommenter ici pour tester. //struct cell_m* faux = newCell(99); //Decommenter ici pour tester. struct cell_m* c5 = newCell(45); struct cell_m* c6 = newCell(34); struct cell_m* c7 = newCell(23); struct cell_m* list = NULL; push(c1, &list); push(c2, &list); push(c3, &list); push(c4, &list); //push(c4_2, &list); //Decommenter ici pour tester. //push(faux, &list); //Decommenter ici pour tester. push(c5, &list); push(c6, &list); push(c7, &list); print(list); printf("--------\n"); printf("Is palindrome: %d\n", palindrome(list)); printf("Rnverse and add: %d\n", inverseAdd(list)); }
/* * adfGetDelEnt * */ struct List* adfGetDelEnt(struct Volume *vol) { struct GenBlock *block; long i; struct List *list, *head; BOOL delEnt; list = head = NULL; block = NULL; delEnt = TRUE; for(i=vol->firstBlock; i<=vol->lastBlock; i++) { if (adfIsBlockFree(vol, i)) { if (delEnt) { block = (struct GenBlock*)malloc(sizeof(struct GenBlock)); if (!block) return NULL; //printf("%p\n",block); } adfReadGenBlock(vol, i, block); delEnt = (block->type==T_HEADER && (block->secType==ST_DIR || block->secType==ST_FILE) ); if (delEnt) { if (head==NULL) list = head = newCell(NULL, (void*)block); else list = newCell(list, (void*)block); } } } if (block!=NULL && list!=NULL && block!=list->content) { free(block); // printf("%p\n",block); } return head; }
int userInput(char board[41][41], char tempBoard[41][41]) { char input; int coordinate1, coordinate2; int value; printf("\nPlease select an option.\na: Create a new cell\nr: Remove a cell\nn: Advance to the next iteration\nq: Quit\np: Play the game continuously\n"); scanf("%c", &input); while(getchar() != '\n'); switch(input) { case 'a': printf("Enter coordinates (row, column) for a new live cell: "); scanf("%i%i", &coordinate1, &coordinate2); while(getchar() != '\n'); newCell(coordinate1, coordinate2, board); value = 1; break; case 'r': printf("Enter coordinates (row, column) to remove a cell: "); scanf("%i%i", &coordinate1, &coordinate2); while(getchar() != '\n'); removeCell(coordinate1, coordinate2, board); value = 1; break; case 'n': // advance to next iteration advance(board, tempBoard); value = 1; break; case 'q': // to quit value = 0; break; case 'p': // run game forever while(1) { advance(board, tempBoard); usleep(100000); } value = 1; break; default: printf("This is not a valid option. Try again.\n"); value = 1; break; } return value; }
/* * Створюємо новий пустий шаблон кросворду */ void tableTemplateWidget::createNew(void) { QDialog *dialog = new QDialog(); sizeOfTemplate = new Ui::SizeOfTemplate(); sizeOfTemplate->setupUi(dialog); dialog->setModal(true); dialog->exec(); if (dialog->result() == QDialog::Accepted) { numRow = sizeOfTemplate->spinRows->value(); numCol = sizeOfTemplate->spinColumns->value(); QSqlQuery query; query.prepare("INSERT INTO crossword.templates (_rows, _columns) VALUES (?, ?);"); query.addBindValue(QVariant(numRow)); query.addBindValue(QVariant(numCol)); query.exec(); QSqlError le = query.lastError(); if (le.type() == QSqlError::NoError) templateId = query.lastInsertId().toInt(); else qDebug() << "createNew: " << le.text(); wi.clear(); setRowCount(numRow); setColumnCount(numCol); for (int i = 0; i < numRow; i++) for (int j = 0; j < numCol; j++) newCell(i, j, 0); isDirty = true; } delete dialog; }
void AbstractGrid::initializeGrid(uint width, uint height, Wrapping wrapping) { if ((width * height) != (m_width * m_height)) { qDeleteAll(m_cells); m_cells.clear(); for (uint index = 0; index < width*height; ++index) { m_cells.append(newCell(index)); } } m_width = width; m_height = height; m_isWrapped = wrapping; createGrid(); while(hasUnneededCables() || solutionCount() != 1) { // the grid is invalid: create a new one createGrid(); } m_minimumMoves = 0; const int shuffleLimit = cellCount() * minCellRatio; QList<int> notShuffledCells; for (int i = 0; i < cellCount(); ++i) notShuffledCells.append(i); // select a random cell that is not yet shuffled // rotate such that initial and final states are not same // repeat above two steps until minimum moves equal to shuffle limit while(m_minimumMoves < shuffleLimit) { // selecting a random index int index = qrand() % notShuffledCells.count(); int cellNo = notShuffledCells[index]; // removing the selected index so that it must not be used again notShuffledCells.removeAt(index); AbstractCell *cell = m_cells[cellNo]; Directions dir = cell->cables(); // excludes None(Empty cell) if (dir == None) { continue; } // if straight line rotate once // cant rotate twice(it will be back on its initial state) else if ((dir == (Up | Down)) || (dir == (Left | Right))) { m_minimumMoves += 1; cell->rotateClockwise(); } // for every other case rotate 1..3 times else { int rotation = qrand() % 3 + 1; // 1..3 // cant rotate twice when m_minimumMoves == shuffleLimit - 1 if (m_minimumMoves == shuffleLimit - 1 && rotation == 2){ rotation = (qrand() % 2)? 1 : 3; // 1 or 3 } m_minimumMoves += (rotation == 3) ? 1 : rotation; while(rotation--) { cell->rotateClockwise(); } } } updateConnections(); }
/* * adfGetDirEntCache * * replace 'adfGetDirEnt'. returns a the dir contents based on the dircache list */ struct List* adfGetDirEntCache(struct Volume *vol, SECTNUM dir, BOOL recurs) { struct bEntryBlock parent; struct bDirCacheBlock dirc; int offset, n; struct List *cell, *head; struct CacheEntry caEntry; struct Entry *entry; SECTNUM nSect; if (adfReadEntryBlock(vol,dir,&parent)!=RC_OK) return NULL; nSect = parent.extension; cell = head = NULL; do { /* one loop per cache block */ n = offset = 0; if (adfReadDirCBlock(vol, nSect, &dirc)!=RC_OK) return NULL; while (n<dirc.recordsNb) { /* one loop per record */ entry = (struct Entry*)calloc(1,sizeof(struct Entry)); if (!entry) { adfFreeDirList(head); return NULL; } adfGetCacheEntry(&dirc, &offset, &caEntry); /* converts a cache entry into a dir entry */ entry->type = (int)caEntry.type; #if defined (WIN32) entry->name = _strdup(caEntry.name); #else entry->name = strdup(caEntry.name); #endif if (entry->name==NULL) { free(entry); adfFreeDirList(head); return NULL; } entry->sector = caEntry.header; #if defined (WIN32) entry->comment = _strdup(caEntry.comm); #else entry->comment = strdup(caEntry.comm); #endif if (entry->comment==NULL) { free(entry->name); adfFreeDirList(head); return NULL; } entry->size = caEntry.size; entry->access = caEntry.protect; adfDays2Date( caEntry.days, &(entry->year), &(entry->month), &(entry->days) ); entry->hour = caEntry.mins/60; entry->mins = caEntry.mins%60; entry->secs = caEntry.ticks/50; /* add it into the linked list */ if (head==NULL) head = cell = newCell(NULL, (void*)entry); else cell = newCell(cell, (void*)entry); if (cell==NULL) { adfFreeEntry(entry); adfFreeDirList(head); return NULL; } if (recurs && entry->type==ST_DIR) cell->subdir = adfGetDirEntCache(vol,entry->sector,recurs); n++; } nSect = dirc.nextDirC; }while (nSect!=0); return head; }
void Grid::generatePuzzle(unsigned short cells) { for (int row = 0; row < 9; row++) { for (int col = 0; col < 9; col++) { if (row == 7) { row = 7; } grid[row][col] = Cell(); } } // display(); srand(time(NULL)); //set the time for srand to NULL. int col, row, val; for (int i = 0; i < cells; i++) { bool invalid = true; //To signal a good value has been found set<unsigned short> triedVals; //To not repeat ourselves. bool RESET = false; //Helps us get out of ruts while (invalid) { RESET = false; col = (rand() % 9); row = (rand() % 9); //If it's empty, start trying to put new values in if (grid[row][col].isEmpty()) { if (RESET) break; val = (rand() % 9) + 1; Cell newCell(val, true); Coordinate c(col, row); //While it's not valid, generate new values and try again. while (!cellIsValid(c, newCell)) { if (RESET) break; triedVals.insert(val); //Put it in the set //Generate a new value until we get one we haven't tried. while (triedVals.find(val) != triedVals.end()) { if (RESET) break; if (triedVals.size() == 9) { RESET = true; break; } val = (rand() % 9) + 1; } newCell = Cell(val, true); } //After a valid cell has been found, set it and set the invalid flag to false grid[row][col] = newCell; invalid = false; } } } display(); }
/** * Seta o valor de uma célula da matriz. Se já existir apenas altera o valor. */ void setCell(SparseMatrix* matrix, long x, long y, long value) { Cell* cell = getCell(matrix, x, y); // Se existir, a célula troca o valor if (cell != NULL) { cell->_value = value; return; } // Verifica os índices máximos da matriz, e os troca se preciso if (x > matrix->_maximumX) { matrix->_maximumX = x; } if (y > matrix->_maximumY) { matrix->_maximumY = y; } // Cria uma nova célula cell = newCell(x, y, value); // Verifica se o índice (linha) atual existe Index* index = matrix->_firstIndex; Index* cellIndex = NULL; while (index != NULL) { // Se a linha for igual, existe if (index->_value == y) { cellIndex = index; break; } index = index->_nextIndex; } // Se o índice não existir, cria um novo if (cellIndex == NULL) { cellIndex = newIndex(y); } // Adiciona o índice a matriz // Se o primeiro for vazio, tá certo if (matrix->_firstIndex == NULL) { matrix->_firstIndex = cellIndex; } // Senão insere o novo índice na ordem else { Index* currentIndex = matrix->_firstIndex; Index* previousIndex = matrix->_firstIndex; while (true) { // Se for maior, vai para frente, senão insere if (currentIndex == NULL || cellIndex->_value < currentIndex->_value) { previousIndex->_nextIndex = cellIndex; cellIndex->_nextIndex = currentIndex; break; } else { previousIndex = currentIndex; currentIndex = currentIndex->_nextIndex; } } } // Insere a célula if (cellIndex->_cell == NULL) { cellIndex->_cell = cell; } else { Cell* currentCell = cellIndex->_cell; Cell* previousCell = currentCell; while (true) { // Se o índice x for maior, vai para frente, senão insere if (currentCell == NULL || cell->_x < currentCell->_x) { previousCell->_nextCell = cell; cell->_nextCell = currentCell; break; } else { previousCell = currentCell; currentCell = currentCell->_nextCell; } } } }
int main(int argc, char* argv[]) { int i, j; BOOL rflag, lflag, xflag, cflag, vflag, sflag, dflag, pflag, qflag; struct List* files, *rtfiles; char *devname, *dirname; char strbuf[80]; unsigned char *extbuf; int vInd, dInd, fInd, aInd; BOOL nextArg; struct Device *dev; struct Volume *vol; struct List *list, *cell; int volNum; BOOL true = TRUE; if (argc<2) { help(); exit(0); } rflag = lflag = cflag = vflag = sflag = dflag = pflag = qflag = FALSE; vInd = dInd = fInd = aInd = -1; xflag = TRUE; dirname = NULL; devname = NULL; files = rtfiles = NULL; volNum = 0; fprintf(stderr,"unADF v%s : a unzip like for .ADF files, powered by ADFlib (v%s - %s)\n\n", UNADF_VERSION, adfGetVersionNumber(),adfGetVersionDate()); /* parse options */ i=1; while(i<argc) { if (argv[i][0]=='-') { j=1; nextArg = FALSE; while(j<(int)strlen(argv[i]) && !nextArg) { switch(argv[i][j]) { case 'v': vflag = TRUE; if ((i+1)<(argc-1)) { i++; nextArg = TRUE; errno = 0; volNum = atoi(argv[i]); if (errno!=0 || volNum<0) { fprintf(stderr,"invalid volume number, aborting.\n"); exit(1); } } else fprintf(stderr,"no volume number, -v option ignored.\n"); break; case 'l': lflag = TRUE; xflag = FALSE; break; case 's': sflag = TRUE; break; case 'c': cflag = TRUE; break; case 'r': rflag = TRUE; break; case 'd': if (devname!=NULL && xflag && (i+1)==(argc-1)) { i++; dirname = argv[i]; if (dirname[strlen(dirname)-1]==DIRSEP) dirname[strlen(dirname)-1]='\0'; nextArg = TRUE; dflag = TRUE; } break; case 'p': if (xflag) { fprintf(stderr,"sending files to pipe.\n"); pflag = TRUE; qflag = TRUE; } else fprintf(stderr,"-p option must be used with extraction, ignored.\n"); break; case 'h': default: help(); exit(0); } /* switch */ j++; } /* while */ } /* if */ else { /* the last non option string is taken as a filename */ if (devname==NULL) /* if the device name has been already given */ devname = argv[i]; else { if (xflag) { if (rtfiles==NULL) rtfiles = files = newCell(NULL, (void*)argv[i]); else files = newCell(files, (void*)argv[i]); } else fprintf(stderr,"Must be used with extraction, ignored.\n"); } } i++; } /* while */ extbuf =(unsigned char*)malloc(EXTBUFL*sizeof(char)); if (!extbuf) { fprintf(stderr,"malloc error\n"); exit(1); } /* initialize the library */ adfEnvInitDefault(); dev = adfMountDev( devname,TRUE ); if (!dev) { sprintf(strbuf,"Can't mount the dump device '%s'.\n", devname); fprintf(stderr, strbuf); adfEnvCleanUp(); exit(1); } if (!qflag) printDev(dev); if (volNum>=dev->nVol) { fprintf(stderr,"This device has only %d volume(s), aborting.\n",dev->nVol); exit(1); } vol = adfMount(dev, volNum, TRUE); if (!vol) { adfUnMountDev(dev); fprintf(stderr, "Can't mount the volume\n"); adfEnvCleanUp(); exit(1); } if (!qflag) { printVol(vol, volNum); putchar('\n'); } if (cflag && isDIRCACHE(vol->dosType) && lflag) { adfChgEnvProp(PR_USEDIRC,&true); if (!qflag) puts("Using dir cache blocks."); } if (lflag) { if (!rflag) { cell = list = adfGetDirEnt(vol,vol->curDirPtr); while(cell) { printEnt(vol,cell->content,"", sflag); cell = cell->next; } adfFreeDirList(list); } else { cell = list = adfGetRDirEnt(vol,vol->curDirPtr,TRUE); printTree(vol,cell,"", sflag); adfFreeDirList(list); } }else if (xflag) { if (rtfiles!=NULL) { files = rtfiles; while(files!=NULL) { if (dirname!=NULL) processFile(vol, (char*)files->content, dirname, extbuf, pflag, qflag); else processFile(vol, (char*)files->content, "", extbuf, pflag, qflag); files = files->next; } freeList(rtfiles); } else { cell = list = adfGetRDirEnt(vol,vol->curDirPtr,TRUE); if (dirname==NULL) extractTree(vol, cell, "", extbuf, pflag, qflag); else extractTree(vol, cell, dirname, extbuf, pflag, qflag); adfFreeDirList(list); } } else help(); free(extbuf); adfUnMount(vol); adfUnMountDev(dev); adfEnvCleanUp(); return(0); }
/* * adfMountHd * * normal not used directly : called by adfMount() * * fills geometry fields and volumes list (dev->nVol and dev->volList[]) */ RETCODE adfMountHd(struct Device *dev) { struct bRDSKblock rdsk; struct bPARTblock part; struct bFSHDblock fshd; struct bLSEGblock lseg; int32_t next; struct List *vList, *listRoot; int i; struct Volume* vol; int len; if (adfReadRDSKblock( dev, &rdsk )!=RC_OK) return RC_ERROR; dev->cylinders = rdsk.cylinders; dev->heads = rdsk.heads; dev->sectors = rdsk.sectors; /* PART blocks */ listRoot = NULL; next = rdsk.partitionList; dev->nVol=0; vList = NULL; while( next!=-1 ) { if (adfReadPARTblock( dev, next, &part )!=RC_OK) { adfFreeTmpVolList(listRoot); (*adfEnv.eFct)("adfMountHd : malloc"); return RC_ERROR; } vol=(struct Volume*)malloc(sizeof(struct Volume)); if (!vol) { adfFreeTmpVolList(listRoot); (*adfEnv.eFct)("adfMountHd : malloc"); return RC_ERROR; } vol->volName=NULL; dev->nVol++; vol->firstBlock = rdsk.cylBlocks * part.lowCyl; vol->lastBlock = (part.highCyl+1)*rdsk.cylBlocks -1 ; vol->rootBlock = (vol->lastBlock - vol->firstBlock+1)/2; vol->blockSize = part.blockSize*4; len = min(31, part.nameLen); vol->volName = (char*)malloc(len+1); if (!vol->volName) { adfFreeTmpVolList(listRoot); (*adfEnv.eFct)("adfMount : malloc"); return RC_ERROR; } memcpy(vol->volName,part.name,len); vol->volName[len] = '\0'; vol->mounted = FALSE; /* stores temporaly the volumes in a linked list */ if (listRoot==NULL) vList = listRoot = newCell(NULL, (void*)vol); else vList = newCell(vList, (void*)vol); if (vList==NULL) { adfFreeTmpVolList(listRoot); (*adfEnv.eFct)("adfMount : newCell() malloc"); return RC_ERROR; } next = part.next; } /* stores the list in an array */ dev->volList = (struct Volume**)malloc(sizeof(struct Volume*) * dev->nVol); if (!dev->volList) { adfFreeTmpVolList(listRoot); (*adfEnv.eFct)("adfMount : unknown device type"); return RC_ERROR; } vList = listRoot; for(i=0; i<dev->nVol; i++) { dev->volList[i]=(struct Volume*)vList->content; vList = vList->next; } freeList(listRoot); next = rdsk.fileSysHdrList; while( next!=-1 ) { if (adfReadFSHDblock( dev, next, &fshd )!=RC_OK) { for(i=0;i<dev->nVol;i++) free(dev->volList[i]); free(dev->volList); (*adfEnv.eFct)("adfMount : adfReadFSHDblock"); return RC_ERROR; } next = fshd.next; } next = fshd.segListBlock; while( next!=-1 ) { if (adfReadLSEGblock( dev, next, &lseg )!=RC_OK) { (*adfEnv.wFct)("adfMount : adfReadLSEGblock"); } next = lseg.next; } return RC_OK; }
/* * adfGetRDirEnt * */ struct List* adfGetRDirEnt(struct Volume* vol, SECTNUM nSect, BOOL recurs ) { struct bEntryBlock entryBlk; struct List *cell, *head; int i; struct Entry *entry; SECTNUM nextSector; int32_t *hashTable; struct bEntryBlock parent; if (adfEnv.useDirCache && isDIRCACHE(vol->dosType)) return (adfGetDirEntCache(vol, nSect, recurs )); if (adfReadEntryBlock(vol,nSect,&parent)!=RC_OK) return NULL; hashTable = parent.hashTable; cell = head = NULL; for(i=0; i<HT_SIZE; i++) { if (hashTable[i]!=0) { entry = (struct Entry *)calloc(1,sizeof(struct Entry)); if (!entry) { adfFreeDirList(head); (*adfEnv.eFct)("adfGetDirEnt : malloc"); return NULL; } if (adfReadEntryBlock(vol, hashTable[i], &entryBlk)!=RC_OK) { adfFreeDirList(head); return NULL; } if (adfEntBlock2Entry(&entryBlk, entry)!=RC_OK) { adfFreeDirList(head); return NULL; } entry->sector = hashTable[i]; if (head==NULL) head = cell = newCell(0, (void*)entry); else cell = newCell(cell, (void*)entry); if (cell==NULL) { adfFreeDirList(head); return NULL; } if (recurs && entry->type==ST_DIR) cell->subdir = adfGetRDirEnt(vol,entry->sector,recurs); /* same hashcode linked list */ nextSector = entryBlk.nextSameHash; while( nextSector!=0 ) { entry = (struct Entry *)calloc(1,sizeof(struct Entry)); if (!entry) { adfFreeDirList(head); (*adfEnv.eFct)("adfGetDirEnt : malloc"); return NULL; } if (adfReadEntryBlock(vol, nextSector, &entryBlk)!=RC_OK) { adfFreeDirList(head); return NULL; } if (adfEntBlock2Entry(&entryBlk, entry)!=RC_OK) { adfFreeDirList(head); return NULL; } entry->sector = nextSector; cell = newCell(cell, (void*)entry); if (cell==NULL) { adfFreeDirList(head); return NULL; } if (recurs && entry->type==ST_DIR) cell->subdir = adfGetRDirEnt(vol,entry->sector,recurs); nextSector = entryBlk.nextSameHash; } } } /* if (parent.extension && isDIRCACHE(vol->dosType) ) adfReadDirCache(vol,parent.extension); */ return head; }
/* * Завантажуємо шаблон кросворду з БД */ void tableTemplateWidget::loadFromDB() { if (templateId == 0) return; isMaked = false; int countRecord = -1; int rowNo, colNo, valNo, countWordsNo; int row, col, val; QSqlQuery query; query.prepare("SELECT _rows, _columns, _count_words FROM crossword.templates WHERE _id = ?;"); query.addBindValue(QVariant(templateId)); query.exec(); QSqlError le = query.lastError(); if (le.type() == QSqlError::NoError) { if (query.isActive() && query.isSelect()) countRecord = query.size(); else countRecord = -1; if (countRecord > 0) { query.first(); rowNo = query.record().indexOf("_rows"); colNo = query.record().indexOf("_columns"); countWordsNo = query.record().indexOf("_count_words"); numRow = query.value(rowNo).toInt(); numCol = query.value(colNo).toInt(); countWords = query.value(countWordsNo).toInt(); setRowCount(numRow); setColumnCount(numCol); } query.finish(); } else qDebug() << "loadFromDB: " << le.text(); query.prepare("SELECT _row, _column, _value FROM crossword.grids WHERE _template = ?;"); query.addBindValue(QVariant(templateId)); query.exec(); le = query.lastError(); if (le.type() == QSqlError::NoError) { if (query.isActive() && query.isSelect()) countRecord = query.size(); else countRecord = -1; if (countRecord > 0 && countRecord == numRow*numCol) { rowNo = query.record().indexOf("_row"); colNo = query.record().indexOf("_column"); valNo = query.record().indexOf("_value"); while (query.next()) { row = query.value(rowNo).toInt(); col = query.value(colNo).toInt(); val = query.value(valNo).toInt(); newCell(row, col, val); } query.finish(); } } else qDebug() << "loadFromDB: " << le.text(); loadPrivateData(); }