Results 1 to 3 of 3

Thread: QSplashScreen with QProgressBar

  1. #1
    Join Date
    Nov 2009
    Posts
    60
    Thanks
    3
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11

    Default QSplashScreen with QProgressBar

    Hi All,


    I want to put a Splash Screen with a progress bar showing the update,I have seen some of the example on Internet they are either incomplete or do not work.


    can any give me a sample code example of implementation ,or links to working example.

    Thanks,
    Ratheendran

  2. #2
    Join Date
    Aug 2009
    Location
    coimbatore,India
    Posts
    314
    Thanks
    37
    Thanked 47 Times in 43 Posts
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QSplashScreen with QProgressBar

    QProgressBar syntax
    Qt Code:
    1. QProgressBar *pbar = new QProgressBar();
    2. pBar->setMinimum(0);
    3. pBar->setMaximum(100);
    To copy to clipboard, switch view to plain text mode 

    hope it helps
    Bala

  3. #3
    Join Date
    Nov 2009
    Posts
    60
    Thanks
    3
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11

    Default Re: QSplashScreen with QProgressBar

    Hi All,

    I tried including progress bar in QSplashScreen with some success.
    However I am not aware on updating the progress bar from the main progamme.

    I am sharing the code below,in this code drawContents() is called only once.

    class customSplashScreen: public QSplashScreen
    {
    QProgressBar *m_pProgressBar;
    public:
    customSplashScreen(const QPixmap& pixmap);
    ~customSplashScreen();

    virtual void drawContents(QPainter *painter);
    };

    customSplashScreen::customSplashScreen(const QPixmap& pixmap):QSplashScreen(pixmap)
    {
    m_pProgressBar = new QProgressBar (this);
    m_pProgressBar->setMinimum(0);
    m_pProgressBar->setMaximum(100);
    m_pProgressBar->show();

    };

    customSplashScreen::~customSplashScreen()
    {
    };

    void customSplashScreen::drawContents(QPainter *painter)
    {
    m_pProgressBar->setValue(24);
    m_pProgressBar->update ();
    };

    2.now in my main.cpp
    main()
    {
    QPixmap pixmap("/home/sky/myimage.png");
    customSplashScreen *splash = new customSplashScreen(pixmap);
    splash->show();
    // do some task and update the progress bar finally calling my main application

    }

    Kindly give your valuable suggestions.

    Thanks and Regards,
    Ratheendran

Similar Threads

  1. display QSplashScreen
    By HelloDan in forum Qt Programming
    Replies: 19
    Last Post: 21st August 2010, 09:19
  2. QSplashScreen transparncy
    By vajindarladdad in forum Newbie
    Replies: 6
    Last Post: 12th October 2009, 13:12
  3. QSplashScreen 4.5.0 vs. 4.3.4
    By hosseinyounesi in forum Qt Programming
    Replies: 0
    Last Post: 23rd September 2009, 11:43
  4. Stylesheets on QSplashScreen
    By GuS in forum Qt Programming
    Replies: 0
    Last Post: 16th July 2008, 14:50
  5. QSplashScreen Weirdness
    By mclark in forum Qt Programming
    Replies: 11
    Last Post: 19th November 2007, 06:49

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.