-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
64 lines (47 loc) · 1.76 KB
/
main.cpp
File metadata and controls
64 lines (47 loc) · 1.76 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
59
60
61
62
63
64
#include "gui/simplewindow.h"
#include <QtWidgets>
using namespace cv;
using namespace std;
// void CallbackMouse (int event, int x, int y, int flags, void* userdata);
int main(int argc, char *argv[])
{
// Check if the image is created
// successfully or not
// if (!canvas.getImage().data) {
// cout << "Could not open or "
// << "find the image\n";
// return 0;
// }
//Q Apllication
QApplication app(argc, argv);
// Load the splash screen image
QPixmap loadImage(":/SlashScreen/phoe_load4.png"); // Use a resource file or absolute path
// QPixmap splashImage = loadImage.scaled(600, 600);
QSplashScreen splash(loadImage.scaled(512, 512));
splash.setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
// splash.resize(QSize(600, 600));
// Create a progress bar
QProgressBar progressBar(&splash);
progressBar.setGeometry(10, splash.height() - 30, splash.width() - 20, 20);
progressBar.setRange(0, 100);
progressBar.show();
// splash.move(splash.screen()->availableGeometry().center());
QRect screenGeometry = QGuiApplication::primaryScreen()->geometry();
int x = (screenGeometry.width() - splash.width()) / 2;
int y = (screenGeometry.height() - splash.height()) / 2;
splash.move(x, y);
// splash.move(screen()->availableGeometry().center());
splash.show();
SimpleWindow window;//(canvas.getImage());
// Simulate loading steps
for (int i = 0; i <= 100; i += 10) {
progressBar.setValue(i);
app.processEvents(); // Keep UI responsive
QThread::msleep(200);
}
QTimer::singleShot(1000, [&]() { // 1-second delay
splash.close();
window.showMaximized();
});
return app.exec();
}