Results 1 to 2 of 2

Thread: QtoolButton stylesheet styling

  1. #1
    Join Date
    Jan 2012
    Posts
    15
    Thanks
    4
    Qt products
    Qt4

    Default QtoolButton stylesheet styling

    Hi what im trying to do is aligning the text and icon in a ToolButton to the left.
    What i have is a vertical Toolbar configured like this:
    mtoolBar->setOrientation( Qt::Vertical );
    mtoolBar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon );
    mtoolBar->setStyleSheet("QToolBar { border: 0px } QToolButton { text-align:left}");

    I want to have Icons and Text in the tool buttons so i use Qt::ToolButtonTextBesideIcon, but this also has the effect that the content of the toolbuttons gets centered. This looks realy ugly when i have toolbutton texts with different lengths. How can i achive what i am trying to do with the stylesheet ( align the content to the left) ?

    Thanks

    *edit*
    I fixed it this way:
    mtoolBar->setStyleSheet("QToolBar { border: 0px } QToolButton { width: 100%}");
    Last edited by conti; 21st September 2012 at 12:13.

  2. #2
    Join Date
    Jun 2013
    Posts
    1
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11

    Thumbs up Re: QtoolButton stylesheet styling

    Thanks. I was having the exact same problem, and the obviously the same solution worked

Similar Threads

  1. Problems when styling QMenu with Qt Stylesheet
    By NoRulez in forum Qt Programming
    Replies: 0
    Last Post: 14th May 2011, 14:34
  2. Replies: 0
    Last Post: 23rd March 2011, 05:07
  3. Styling QComoBox using CSS Stylesheet
    By bjoernbg in forum Qt Programming
    Replies: 1
    Last Post: 6th October 2010, 23:12
  4. Stylesheet is not working for QToolButton
    By sudhansu in forum Qt Programming
    Replies: 10
    Last Post: 24th March 2010, 08:30
  5. Problem styling QComBox using stylesheet
    By sjagtap in forum Newbie
    Replies: 4
    Last Post: 22nd March 2010, 13:18

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.