Advertisement
RybaSG

QtSplashScreen

Sep 17th, 2019
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. #include "mainwindow.h"
  2. #include <QSplashScreen>
  3. #include <QTimer>
  4. #include <QApplication>
  5. #include <QThread>
  6. #include <QMovie>
  7. #include <QLabel>
  8. #include <unistd.h>
  9.  
  10. int main(int argc, char *argv[])
  11. {
  12. QApplication a(argc, argv);
  13. QMovie *movie = new QMovie("/home/ubuntu/Pictures/giphy.gif");
  14. QLabel *processLabel = new QLabel(NULL);
  15. processLabel->setMovie(movie);
  16. movie->start();
  17. processLabel->setWindowFlags(Qt::FramelessWindowHint);
  18. processLabel->setAlignment(Qt::AlignCenter);
  19. processLabel->show();
  20. // QPixmap pixmap("/home/ubuntu/Pictures/giphy.gif");
  21. // QSplashScreen splash(pixmap, Qt::WindowStaysOnTopHint);
  22. // splash.setCursor(Qt::BusyCursor);
  23. // splash.show();
  24. // QTimer::singleShot(5000, &splash, &QWidget::close); // keep displayed for 5 seconds
  25. // MainWindow w;
  26. // w.show();
  27. MainWindow w;
  28. // w.show();
  29. QTimer::singleShot(2500,processLabel,SLOT(close()));
  30. QTimer::singleShot(2500,&w,SLOT(show()));
  31.  
  32.  
  33. return a.exec();
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement