How to set the spacing of toolbar's actions?
-
QAction* playAction = new ... QAction* pauseAction = new ... QAction* replayAction = new ... QMenuBar* menuBar = new ... menuBar->addAction(playAction...); menuBar->addAction(pauseAction...); menuBar->addAction(replayAction...);
I want to set the spacing of these actions to 10px, so I wrote the code as below:
menuBar->setStyleSheet("QToolBar::item{spacing: 10px;}");
But it didn't work, so I went on to try to use qss code
QToolBar::item{margin: 0px 10px;}
andQToolBar::item{padding: 10px;}
, all failed.e,,,,What should I do if I want to set the spacing of these actions?
-
QAction* playAction = new ... QAction* pauseAction = new ... QAction* replayAction = new ... QMenuBar* menuBar = new ... menuBar->addAction(playAction...); menuBar->addAction(pauseAction...); menuBar->addAction(replayAction...);
I want to set the spacing of these actions to 10px, so I wrote the code as below:
menuBar->setStyleSheet("QToolBar::item{spacing: 10px;}");
But it didn't work, so I went on to try to use qss code
QToolBar::item{margin: 0px 10px;}
andQToolBar::item{padding: 10px;}
, all failed.e,,,,What should I do if I want to set the spacing of these actions?
-
Hi
Did you try
setStyleSheet('QToolBar{spacing:10px;}' -
@Limer
I don't know what the correct answer is, but I do know that::item()
is for e.g.QMenuBar
but not forQToolBar
.... Other people seem to useQToolButton
to address the buttons?