Solved How to set background of QToolBar's Dockarea in QMainWindow Mac OS?
-
I used below QSS to my app.
QWidget { background:white; } QToolBar { spacing: 0px; } QToolBar::handle { background: white; } QDockWidget { background: white; }
I want to set the whole toolbar's background white. But, has failed. like :
Thank u.
-
hi
image is not showing :)
-
i upload my image again.
-
Hi
Do you have other stylesheets active ?
Seems to color all of it on default gui project -
This QToolBar in Mac OS. I also test it in Win, it is Ok.
But, It has failed, In Mac. In Mac, The gray area is toolbar dock area in mainwindow.
All the QSS at here
QWidget { background:white; } QToolBar { spacing: 0px; } QToolBar::handle { background: white; } QDockWidget { background: white; }
-
Ah
so it does so on mac only.
You are using the normal toolbar and not QMacToolBar ?
sorry have no mac to test with. Its a bit odd its not affected by "Qwidget" -
@mrjj oh,
QMacToolBar
? Ok, I know where i wrong. Thank u.I will modify my code to use
QMacToolBar
. -
About this question. Because I used
QToolBar
in Mac. It was not good way.In Mac, should using
QMacToolBar
. But, In Windows, you need to useQToolBar
.So,In the one Qt project, You should use
Q_OS_Mac
andQ_OS_Win
macro to write code in different OS. I think it's not one good way.It just one
ToolBar
, include someToolButtons
. That's all. So, The best way is to usingQWidget
asToolBar
, add someToolButtons
inQWidget
. and do not forget to removemainToolBar
fromQMainWindow
.