-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwelcome.cpp
More file actions
executable file
·71 lines (51 loc) · 1.56 KB
/
welcome.cpp
File metadata and controls
executable file
·71 lines (51 loc) · 1.56 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
52
53
54
55
56
57
58
#include "welcome.h"
#include "ui_welcome.h"
#include "substring_window/mainwindow2.h"
#include "copies_window/mainwindow.h"
#include <memory>
#include <QCommonStyle>
#include <QDesktopWidget>
#include <QGraphicsScene>
#include <QGraphicsView>
#include <QGraphicsPixmapItem>
#include <QGuiApplication>
#include <QScreen>
welcome_window::welcome_window(QWidget *parent) :
QWidget(parent),
ui(new Ui::welcomeWindow) {
ui->setupUi(this);
setWindowTitle("Welcome");
setGeometry(
QStyle::alignedRect(
Qt::LeftToRight,
Qt::AlignCenter,
this->size(),
qApp->desktop()->availableGeometry()
)
);
setFocusPolicy(Qt::ClickFocus);
QPixmap bkgnd(":/images/welcome.jpg");
bkgnd = bkgnd.scaled(this->size(), Qt::IgnoreAspectRatio);
QPalette palette;
palette.setBrush(QPalette::Background, bkgnd);
this->setPalette(palette);
this->setFixedSize(this->width(), this->height());
connect(ui->pushButton, &QPushButton::clicked, this, &welcome_window::go);
connect(this, SIGNAL(enter_pressed()), this, SLOT(go()));
}
welcome_window::~welcome_window() = default;
void welcome_window::keyPressEvent(QKeyEvent *event) {
if (event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter) {
emit enter_pressed();
}
}
void welcome_window::go() {
int curIndex = ui->comboBox->currentIndex();
if (curIndex == 0) {
auto *w = new main_window();
w->show();
} else {
auto *f = new subStringFinder();
f->show();
}
}