Results 1 to 3 of 3

Thread: Is it possible to use a #define within the text area of a QMessageBox::about()?

  1. #1
    Join Date
    Aug 2015
    Posts
    15
    Thanks
    3
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Is it possible to use a #define within the text area of a QMessageBox::about()?

    Given that VERSION is defined like so, is there some way to expand that #define within the text area of a QMessageBox::about() along with other text?

    Qt Code:
    1. #define VERSION_MAJOR 0
    2. #define VERSION_MINOR 1
    3. #define VERSION_MICRO 0
    4. #define VERSION_SPECIAL ".alpha-1"
    5.  
    6. #define STRINGIFY0(s) # s
    7. #define STRINGIFY(s) STRINGIFY0(s)
    8. #define VERSION STRINGIFY(VERSION_MAJOR) "." STRINGIFY(VERSION_MINOR) "." STRINGIFY(VERSION_MICRO) "" VERSION_SPECIAL
    9.  
    10.  
    11. QMessageBox::about(this, tr("About Menu"),
    12. tr("<center><small>VERSION</small></center>"
    13. "<p>Copyright (c) 2015, Bla Bla Bla...</p>"));
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Dec 2009
    Location
    New Orleans, Louisiana
    Posts
    791
    Thanks
    13
    Thanked 153 Times in 150 Posts
    Qt products
    Qt5
    Platforms
    MacOS X

    Default Re: Is it possible to use a #define within the text area of a QMessageBox::about()?

    Quote Originally Posted by rwhartzell View Post
    Qt Code:
    1. QMessageBox::about(this, tr("About Menu"),
    2. tr("<center><small>VERSION</small></center>"
    3. "<p>Copyright (c) 2015, Bla Bla Bla...</p>"));
    To copy to clipboard, switch view to plain text mode 
    Are you looking for something like:
    Qt Code:
    1. QMessageBox::about(this, tr("About Menu"),
    2. tr("<center><small>%1</small></center>"
    3. "<p>Copyright (c) 2015, Bla Bla Bla...</p>").arg(VERSION));
    To copy to clipboard, switch view to plain text mode 
    I write the best type of code possible, code that I want to write, not code that someone tells me to write!

  3. The following user says thank you to jefftee for this useful post:

    rwhartzell (22nd September 2015)

  4. #3
    Join Date
    Aug 2015
    Posts
    15
    Thanks
    3
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Is it possible to use a #define within the text area of a QMessageBox::about()?

    Yes thats exactly what I needed, Thanks!

Similar Threads

  1. QMessageBox - Text in the buttons
    By graciano in forum Qt Programming
    Replies: 4
    Last Post: 20th June 2015, 23:51
  2. How to tranlaste #define and text from file
    By stevocz in forum Qt Programming
    Replies: 24
    Last Post: 18th December 2013, 08:06
  3. Replies: 5
    Last Post: 20th August 2012, 20:58
  4. Select text in QMessageBox
    By mpi in forum Qt Programming
    Replies: 0
    Last Post: 1st July 2010, 08:55
  5. Qt class showing text area/text edit
    By maverick_pol in forum Qt Programming
    Replies: 4
    Last Post: 21st August 2008, 12:15

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.