-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathn_queen.h
More file actions
51 lines (44 loc) · 1.09 KB
/
Copy pathn_queen.h
File metadata and controls
51 lines (44 loc) · 1.09 KB
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
50
51
#ifndef N_QUEEN_H
#define N_QUEEN_H
#include <QWidget>
#include<QVector>
#include<QSet>
#include<QMap>
#include<QPushButton>
#include<QCoreApplication>
#include<QSlider>
#include<QSpinBox>
#include<QLabel>
#include<QThread>
class N_Queen : public QWidget
{
Q_OBJECT
public:
int n;
int width;
int height;
int time_delay;
bool is_paused;
bool is_reseted;
QSlider *speedSlider;
QLabel *speedLabel;
QLabel *sizeLabel;
QSpinBox *sizeSelector;
QSet<int> diagonal1, diagonal2, col;
QVector<QVector<QPair<QRect,int>>> grid;
QMap<int,QPushButton*> buttons;
N_Queen(QWidget *parent,int n,int width,int height);
~N_Queen();
void solve(int idx,bool &res);
void solveNQueens();
void reset();
void paintEvent(QPaintEvent *event);
void set_button(int &start_x,int start_y,int w,int h,int seperation,QString label,int button);
void change_speed(bool fast);
void handle_pause_resume();
signals:
void backToBacktracking(); // Signal to go back
private slots:
void handleBackButton(); // Slot for back button
};
#endif // N_QUEEN_H