Results 1 to 7 of 7

Thread: change font size and button size of QMessageBox

  1. #1
    Join Date
    Jul 2006
    Posts
    79
    Qt products
    Qt3 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default change font size and button size of QMessageBox

    Hello everyone,
    i am wondering if there is an easy way to change the size of fonts and of QMessageBox button. I am gonna be running the GUI in a rather small screen and need to make these bigger. Is it possible in an easy wawy or the only way is to make a msgBox class on my own?
    thank you nass

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: change font size and button size of QMessageBox

    You could try QApplication::setFont().

  3. #3
    Join Date
    Jul 2006
    Posts
    79
    Qt products
    Qt3 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: change font size and button size of QMessageBox

    no that wouldn't do it... the rest of the application has set font's and stuff... i only want to change the messageBox's font and button sizes...

  4. #4
    Join Date
    Jul 2006
    Posts
    79
    Qt products
    Qt3 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: change font size and button size of QMessageBox

    someone mentioned smth about
    using html tags in my message..
    but didn't go into detail... what is it i could do?

  5. #5
    Join Date
    Jan 2006
    Location
    Kerala
    Posts
    371
    Thanks
    76
    Thanked 37 Times in 32 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: change font size and button size of QMessageBox

    Exactly

    Try this
    Qt Code:
    1. QMessabeBox::information( 0, "Title" , "<font size = 10 color = red > Hello World </font> " );
    To copy to clipboard, switch view to plain text mode 
    We can't solve problems by using the same kind of thinking we used when we created them

  6. #6
    Join Date
    Jan 2006
    Location
    Mountain View, CA
    Posts
    279
    Thanked 42 Times in 37 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: change font size and button size of QMessageBox

    Quote Originally Posted by sunil.thaha
    Exactly

    Try this
    Qt Code:
    1. QMessabeBox::information( 0, "Title" , "<font size = 10 color = red > Hello World </font> " );
    To copy to clipboard, switch view to plain text mode 
    That will work for the message text, but you will have to either subclass QMessageBox in order to change the button font size, or call setFont() on a QMessageBox widget.
    Save yourself some pain. Learn C++ before learning Qt.

  7. #7
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: change font size and button size of QMessageBox

    One option to access the buttons (to modify their sizes) is to create an instance of QMessageBox (instead of using convenient static methods) and then use QObject::findChildren() to find the buttons.
    J-P Nurmi

  8. The following user says thank you to jpn for this useful post:

    gfunk (10th March 2007)

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.