2

I have added several items to the QToolBar using addAction method. Is there a way to control a spacing inside item? I mean spacing between item text (or icon) and item borderenter image description here

Mikhail Zimka
  • 694
  • 1
  • 9
  • 20

1 Answers1

4

You can use style sheets. Example:

myToolbar->setStyleSheet("QToolButton { padding-left: 20px; padding-right: 40px; }");

See Qt Style Sheets Reference and Customizing QToolButton

Fabio
  • 2,522
  • 1
  • 15
  • 25
  • This works only to increase padding - if I set padding-left: 40px the spacing really grows up. But if I set padding-left: 0px nothing changes - it seems that there is something like minimum padding level. – Mikhail Zimka Sep 28 '16 at 09:29
  • 2
    It seems that you can decrease the space setting a negative padding (I've tried with Qt 5.5, Windows style (Win 10)) – Fabio Sep 28 '16 at 12:17