Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Splash Screen
Forum Updated to NodeBB v4.3 + New Features

Splash Screen

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 1.6k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    shirisha
    wrote on last edited by
    #1

    Hi sir...,

              Am unable to display splash screen in Qt 4.8.4, in beagle board...Please help me...here is my code..
    

    @
    #include "mainwindow.h"
    #include <QApplication>
    #include <QSplashScreen>
    #include <QTimer>
    int main(int argc, char *argv[])
    {
    QApplication a(argc, argv);
    QSplashScreen *splash = new QSplashScreen;
    splash->setPixmap(QPixmap("/home/shirisha/Documents/images.jpeg"));
    splash->show();
    MainWindow w;
    QTimer::singleShot(2500,splash,SLOT(close()));
    QTimer::singleShot(2500,&w,SLOT(show()));

    // w.show();

    return a.exec(&#41;;
    

    }
    @

    [edit: added missing coding tags @ SGaist]

    1 Reply Last reply
    0
    • K Offline
      K Offline
      kumararajas
      wrote on last edited by
      #2

      Hi Shirisha,

      I don't see the slot mentioned in
      @QTimer::singleshot()
      @

      For example:
      @
      #include <QApplication>
      #include <QTimer>

      int main(int argc, char *argv[])
      {
      QApplication app(argc, argv);
      QTimer::singleShot(600000, &app, SLOT(quit()));
      ...
      return app.exec();
      }
      @

      "Link to Qt documentation":http://qt-project.org/doc/qt-4.8/qtimer.html#singleShot

      And may I ask, what is the real reason for using QTimer? Are you processing the program or application related files when you want to display splash screen?

      --Kumar

      1 Reply Last reply
      0
      • S Offline
        S Offline
        shirisha
        wrote on last edited by
        #3

        no sir i menstioned ther bt in the post unable to write..the same thing i menstoned like...

        QTimer::singleShot(2500, splash, SLOT(close()));
        QTimer::singleShot(2500, &app, SLOT(show()));

        1 Reply Last reply
        0
        • K Offline
          K Offline
          kumararajas
          wrote on last edited by
          #4

          May be as a quick test, can you try this code?

          @
          #include <QApplication>
          #include <QPixmap>
          #include <QSplashScreen>
          #include <QWidget>
          #include <QMainWindow>
          #include <QTimer>
          #include <QThread>

          class I : public QThread
          {
          public:
          static void sleep(unsigned long secs) {
          QThread::sleep(secs);
          }
          };

          int main(int argc, char *argv[])
          {

          QApplication app(argc, argv);
          // change this file path
          QPixmap pixmap("c://paris.png"); // Insert your splash page image here
          QSplashScreen splash(pixmap);
          splash.show();

          splash.showMessage(QObject::tr("Loading Programs........."),
          Qt::AlignLeft | Qt::AlignTop, Qt::black); //This line represents the alignment of text, color and position

          qApp->processEvents(); //This is used to accept a click on the screen so that user can cancel the screen

          QMainWindow mainWin;
          mainWin.setWindowTitle("Qt Application"); //Set the title of your main Qt Application
          mainWin.resize(600, 500);
          I::sleep(5); // Splash page is shown for 5 seconds

          mainWin.show(); //This will maximize to fullscreen the size of your application window after the splash page displays
          splash.finish(&mainWin);
          return app.exec();
          }
          @

          Please note: Update the image path with yours
          @
          ”/home/shirisha/Documents/images.jpeg”
          @

          And just to sure, what is the file details of the images.jpeg?

          Thanks!

          --Kumar

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved