Results 1 to 3 of 3

Thread: Left aligning QToolButtons in a QToolBar

  1. #1

    Default Left aligning QToolButtons in a QToolBar

    Hi everyone,
    I have seen many old topics with that question but no answer.
    I'm still working with Qt4 and I've tried with stylesheet but did not find a way to left align my QToolButton icon and text. They are always shown centered.
    Anyone has a tip?

    Thanks in advance

  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: Left aligning QToolButtons in a QToolBar

    Seems odd, but there is apparently no way to do this without a lot of difficulty. All of the painting methods for QToolButton (in Qt 5.5 at least) use monolithic drawing methods (e.g. drawComplexControl()), so even if you derived from QToolButton and overrode the paintEvent(), you'd still have to pretty much draw it by hand.

  3. #3

    Default Re: Left aligning QToolButtons in a QToolBar

    Thanks for looking at this.
    I was digging in drawComplexControl() too but I could not find where the rect/position of the QToolButton is defined.

Similar Threads

  1. Replies: 6
    Last Post: 16th April 2013, 16:13
  2. Tab focus on QToolBar QToolButtons
    By bmn in forum Qt Programming
    Replies: 1
    Last Post: 1st December 2011, 02:38
  3. how align some buttons in QToolbar from right to left?
    By davi_all4one in forum Qt Programming
    Replies: 3
    Last Post: 7th September 2009, 11:15
  4. QWidget containing two QToolButtons
    By momesana in forum Qt Programming
    Replies: 2
    Last Post: 1st October 2007, 23:25
  5. Various icon sizes for QToolButtons on QToolbar
    By Erlendhg in forum Qt Programming
    Replies: 4
    Last Post: 30th June 2007, 18:35

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.