void CandidateWindowProxy::candidateActivate(int nr, int displayLimit) { #ifdef UIM_QT_USE_DELAY m_delayTimer->stop(); #endif /* !UIM_QT_USE_DELAY */ QList<uim_candidate> list; #if !UIM_QT_USE_NEW_PAGE_HANDLING activateCandwin(displayLimit); // set candidates for (int i = 0; i < nr; i++) { cand = uim_get_candidate(ic->uimContext(), i, displayLimit ? i % displayLimit : i); list.append(cand); } setCandidates(displayLimit, list); #else /* !UIM_QT_USE_NEW_PAGE_HANDLING */ nrPages = displayLimit ? (nr - 1) / displayLimit + 1 : 1; pageFilled.clear(); for (int i = 0; i < nrPages; i++) pageFilled.append(false); setNrCandidates(nr, displayLimit); // set page candidates preparePageCandidates(0); setPage(0); #endif /* !UIM_QT_USE_NEW_PAGE_HANDLING */ execute("candidate_activate"); }
int SolveSudoku(int grid[N][N]) { int row, col; if (!FindUnassignedLocation(grid, &row, &col)) return true; long num[N] = {0,0,0,0,0,0,0,0,0}; setCandidates(&num); for (int i = 0; i <= 8; i++) { if (isSafe(grid, row, col, num[i])) { grid[row][col] = num[i]; if (SolveSudoku(grid)) return true; grid[row][col] = UNASSIGNED; } } return false; }