Results 1 to 4 of 4

Thread: Vertical label text

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Default Vertical label text

    Hi all,
    I searched the forum, but couldn't find a similar post on this topic.

    What I need is a way to orient the text of a label in vertical, i.e. up towards down or vice versa.
    I guess I won't be using a layout, since the label must be precisely positioned by the user over a background bitmap (I can use setGeometry()).

    Any hints will be appreciated.

    Massimo

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Vertical label text

    A QLabel widget supports only horizontal text. If you can use QGraphicsScene to compose your bitmap + label, then you could use QGraphicsPixmapItem to contain the image, and a QGraphicsTextItem (with rotation) for the text. If the letters have to be stacked:

    M
    y
    L
    a
    b
    e
    l

    instead of simply rotated, then you can derive from QGraphicsTextItem and override the paint(), boundingRect(), and other methods as required.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  3. #3

    Default Re: Vertical label text

    Thanks for your reply, but why are you asking if I CAN use QGraphicsScene?
    Can you point me to a sample showing these QGraphics classes?

    Thanks

  4. #4
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Vertical label text

    Can you point me to a sample showing these QGraphics classes?
    Qt comes with a huge variety of example projects and tutorials, including many for the Graphics / View framework. I'd suggest you start there and let Google be your friend.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. vertical pushbutton text
    By eric in forum Qt Programming
    Replies: 11
    Last Post: 18th April 2019, 20:17
  2. Vertical label on table horizontal header
    By ipkiss in forum Qt Programming
    Replies: 1
    Last Post: 11th February 2014, 20:03
  3. vertical text in a QTextTable
    By sipahi in forum Newbie
    Replies: 2
    Last Post: 6th February 2013, 22:40
  4. Vertical text in a QTextDocument
    By Angelo Moriconi in forum Qt Programming
    Replies: 6
    Last Post: 7th February 2008, 06:30
  5. Vertical Orientation of Text.
    By ashukla in forum Qt Programming
    Replies: 9
    Last Post: 28th January 2008, 13:40

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.