Results 1 to 3 of 3

Thread: Splash screen with multiple lines of custom text.

  1. #1
    Join Date
    Jan 2013
    Posts
    8
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Splash screen with multiple lines of custom text.

    I am using Qt 4.7. At the start of my application I display a splash screen with general information about the program and related project. The information I want to display will occasionally need to change (version numbers and such). I would like to find a simple way of updating this text.

    I started with just displaying the splash screen graphic without any version number information. This works fine. I then followed this example (http://qt-project.org/wiki/Custom_sp...reen_with_text) to display the screen with custom text at a certain position on top of the graphic. This also worked fine. The issue is when I want to have multiple sets of custom text. I am pretty sure that every time the screen is updated with a new line of text the previous line of text is lost in the update. (For example I try to display three different sets of text and I only see the third set of text.)

    Any thoughts?

    Thanks.

  2. #2
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: Splash screen with multiple lines of custom text.

    The issue is when I want to have multiple sets of custom text.
    It is not possible to have multiple line with that example.

    Try this work around, set a message with all three line as a single string with line breaks "\n".
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

  3. #3
    Join Date
    Jan 2013
    Posts
    8
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Splash screen with multiple lines of custom text.

    Good thought on the use of \n. I had tried that previously and it works okay though it limits your positioning choices.

    The only workaround I have come up with so far is to modify the "drawContents" function used in the example. Instead of calling "drawText" once, I call it three times:

    void cCustomGraphics::drawContents(QPainter* pPainter)
    {
    QPixmap textPix = QSplashScreen:ixmap();
    pPainter->setPen(this->color);
    pPainter->drawText(this->rect, this->alignment, this->message);
    pPainter->drawText(QRect::QRect(75,337,400, 30), this->alignment, "0.1");
    pPainter->drawText(QRect::QRect(128,372,400, 30), this->alignment, "May 29, 2013");
    }

    This seems to work okay.

Similar Threads

  1. Problem with Splash Screen ?
    By vinod in forum Qt Programming
    Replies: 13
    Last Post: 11th April 2020, 18:15
  2. splash screen problem
    By wizarda in forum Qt Programming
    Replies: 9
    Last Post: 15th January 2011, 03:05
  3. QTreeView Custom column with an icon, and 2 lines of text
    By mromanuk in forum Qt Programming
    Replies: 2
    Last Post: 5th July 2010, 19:37
  4. How to Keep Splash Screen and App on Same Display
    By ajb_advance in forum Qt Programming
    Replies: 2
    Last Post: 4th March 2009, 12:49
  5. Splash Screen
    By Salazaar in forum Newbie
    Replies: 27
    Last Post: 4th June 2007, 18:31

Tags for this Thread

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.