File: mainwindow.h

package info (click to toggle)
sudoku-solver 1.0.1-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 232 kB
  • sloc: cpp: 520; xml: 20; makefile: 6
file content (49 lines) | stat: -rw-r--r-- 1,041 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QVector>
#include <QLabel>
#include <QKeyEvent>
#include <QEvent>

namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow {
    Q_OBJECT

    public:
        explicit MainWindow(QWidget *parent = nullptr);
        ~MainWindow();

    private:
        Ui::MainWindow *ui;

        QVector<QLabel*> listSquares;
        QVector<QLabel*> emptySquares;
        QLabel *selectedSquares;
        QVector<QLabel*> listButtons;

        bool isRunSolve;
        bool manuallyStopFindSolution;

        void repaintSquares();
        bool isPossiblePutDigit(int indexSquares,int digit);    
        void trySolve(int startIndex);
        bool isSolveComplete();
        void repaintButtons();

    private slots:
        void clearTable();
        void solve();
        void showFormAbout();

    protected:
        bool eventFilter(QObject *obj, QEvent *event) override;
        void keyPressEvent(QKeyEvent* event) override;

};

#endif // MAINWINDOW_H