I have this code, I want it to show the screen saver, because it will be larger by making a kind of timer so that you can see that the screen saver is working. The problem is that I do not see the splash screen, but the code will work until the splash screen appears, sending me directly to the main window without showing the splas screen. Here is my code.
main.cpp
#include <iostream>
#include <QApplication>
#include <quazip/quazip.h>
#include "splashwindow.h"
#include "mainwindow.h"
#include "database.h"
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
SplashWindow splashW;
splashW.show();
Downloader db;
db.doDownload();
for(int i = 0; i < 1000000; i++)
{
cout << i << endl;
}
splashW.hide();
splashW.close();
MainWindow mainW;
mainW.showMaximized();
return app.exec();
}
splashwindow.cpp
#include <iostream>
#include <QStyle>
#include <QDesktopWidget>
#include "splashwindow.h"
#include "ui_splashwindow.h"
#include "database.h"
SplashWindow::SplashWindow (QWidget *parent) :
QMainWindow(parent), ui(new Ui::SplashWindow)
{
ui->setupUi(this);
this->setWindowFlags(Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint | Qt::SplashScreen);
}
SplashWindow::~SplashWindow()
{
delete ui;
}
splashwindow.h
#ifndef SPLASHWINDOW_H
#define SPLASHWINDOW_H
#include <QMainWindow>
namespace Ui {
class SplashWindow;
}
class SplashWindow : public QMainWindow
{
Q_OBJECT
public:
explicit SplashWindow(QWidget *parent = 0);
~SplashWindow();
private:
Ui::SplashWindow *ui;
};
#endif
The commands are launched in such a way that the splash screen will not be displayed before they are launched, and not shown, which I cannot find a way to fix.
[EDIT] The part of the code corresponding to the closure was inappropriate, although it still does not work after a proper installation.