Results 1 to 8 of 8

Thread: Vertical QProgressBar Text Direction

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Vertical QProgressBar Text Direction

    Just consider the situation that sometimes you may need to draw the text twice with clipping -- when the value of the progress bar is such that the bar ends intersecting the text. Then you need to draw part of the text with inverted (or otherwise changed) colours, just like the default bar does.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  2. #2
    Join Date
    Jan 2016
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Vertical QProgressBar Text Direction

    I'm faced with the problem described in the initial question: call setTextDirection(QProgressBar::BottomToTop) makes no visual difference on the progress bar. The code is:
    Qt Code:
    1.  
    2. pb2->setOrientation(Qt::Vertical);
    3. pb2->setTextDirection(QProgressBar::BottomToTop);
    4. pb2->setRange(0, 100);
    5. pb2->setValue(20);
    6.  
    7. current_layout->insertWidget(current_index++,pb2);
    To copy to clipboard, switch view to plain text mode 
    The text on the resulting progress bar is stil oriented top-to-bottom...
    progressbar.png
    Question is how to get the text oriented bottom-to-top?

    Thank you in advance!

    UPDATE:
    This issue is caused by GTK+ style. The documentation says that some styles do not draw the text. This style seems to ignore the text direction option. From what I was able to test:
    - Motif, CDE and Plastique styles draw the text correctly;
    - Windows and Cleanlooks do not draw the text at all;
    - GTK+ is buggy - draws the text but ignores the text direction option.

    Hope this is helpful...
    Last edited by martynets; 22nd January 2016 at 20:25.

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

    Default Re: Vertical QProgressBar Text Direction

    So does this part of the QProgressBar::setTextDirection() documentation apply to you?

    Note that whether or not the text is drawn is dependent on the style. Currently CleanLooks and Plastique draw the text. Mac, Windows and WindowsXP style do not.

  4. #4
    Join Date
    Jan 2016
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Vertical QProgressBar Text Direction

    Hi, thanks. Right, the root cause is in the style. I've just updated my question. Problem is with GTK+ style which is the default for my environment. Actually I use Qt 4.8 which set of styles differs from the Qt 5 but it doesn't matter...
    Thank you. Regards.

Similar Threads

  1. QProgressBar with custom text
    By smoon in forum Qt Programming
    Replies: 2
    Last Post: 10th May 2012, 15:44
  2. QProgressbar text format
    By jothy in forum Qt Programming
    Replies: 3
    Last Post: 4th August 2010, 18:02
  3. Replies: 2
    Last Post: 30th December 2008, 21:35
  4. Vertical text in a QTextDocument
    By Angelo Moriconi in forum Qt Programming
    Replies: 6
    Last Post: 7th February 2008, 05:30
  5. Vertical Orientation of Text.
    By ashukla in forum Qt Programming
    Replies: 9
    Last Post: 28th January 2008, 12:40

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.