×

Discussion Board

Results 1 to 7 of 7
  1. #1
    Super Contributor
    Join Date
    Nov 2009
    Location
    Minnesota, USA
    Posts
    3,209

    Formatting text on a button

    I'd like to have two rows of text, in two different fonts, on a single button. How might one go about this?

  2. #2
    Super Contributor
    Join Date
    Oct 2008
    Location
    INDIA
    Posts
    2,326

    Re: Formatting text on a button

    Quote Originally Posted by danhicksbyron View Post
    I'd like to have two rows of text, in two different fonts, on a single button. How might one go about this?
    For that first you need need to increase the size of button and then you have to enter after one line...

    try this...
    best regards,

  3. #3
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: Formatting text on a button

    I think QPushButton doesn't support rich text formatting.

  4. #4
    Super Contributor
    Join Date
    Nov 2009
    Location
    Minnesota, USA
    Posts
    3,209

    Re: Formatting text on a button

    Quote Originally Posted by divanov View Post
    I think QPushButton doesn't support rich text formatting.
    I didn't ask if it could be done, I asked how you could do it.

    One way I can think of is to create a blank button with the appropriate size and color, position above that one or two labels with the desired text, and then position over that a transparent button whose "pressed" signal is routed to the "clicked" slot on the "real" button.

    But that seems kind of convoluted.

  5. #5
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: Formatting text on a button

    I think the idea is to subclass QPushButton to enable rich text formatting in the button text like QLabel does.

  6. #6
    Super Contributor
    Join Date
    Nov 2009
    Location
    Minnesota, USA
    Posts
    3,209

    Re: Formatting text on a button

    Quote Originally Posted by divanov View Post
    I think the idea is to subclass QPushButton to enable rich text formatting in the button text like QLabel does.
    Yeah, if I had a hundred of them to do. I only have maybe ten total. (Even then it would be easier to write a subclass that does it the way I describe vs cracking the text-writing rewrite of paint.)

  7. #7
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: Formatting text on a button

    QMaemo5ValueButton does almost the same what you want, you can modify its implementation:
    http://qt.gitorious.org/+qt-develope...aluebutton.cpp

Similar Threads

  1. make textbox in canvas
    By mahdi68 in forum Mobile Java General
    Replies: 7
    Last Post: 2009-09-20, 11:46
  2. formatting text in a listbox
    By ajaykapur in forum Symbian User Interface
    Replies: 9
    Last Post: 2007-10-18, 17:43
  3. Rendering text in multiple languages
    By TheLittleBird in forum Symbian
    Replies: 0
    Last Post: 2007-06-05, 12:52
  4. OK Button Disappears on clearing text
    By jainybhai in forum Symbian
    Replies: 0
    Last Post: 2005-12-19, 16:12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×