You are not logged in.

Dear visitor, welcome to QtForum.org. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

1

Thursday, May 24th 2012, 8:31am

Cannot style the background of a QToolBar on Mac OSX

Hi all!

I have a problem styling the background of a QToolBar on Mac
OSX. I'm using Qt 4.8.1 and Mac OS X 10.7

I set a global qss stylesheet for my application and
everything works just fine. The only thing that does not
have any effect is the background part of the QToolBar. I
can still set the padding or height or anything but the
background...

Here's the part of my stylesheet responsible for the
toolbar:

Source code

1
2
3
4
5
6
QWidget#toolBarMainView{
padding-top:0px;
min-height:42px;
background-image:url(:/images/recources/img/assets/toolbar/background_img.png);
background-repeat: repeat-xy;
}



By the way: Im also using the same stylesheet and code for
the application in windows. And in windows this problem does
not occur.

I have already googled for this problem and i found a
bugreport for this issue
(https://bugreports.qt-project.org/browse/QTBUG-12717).

Does anyone know if this bug has been resolved and the
problem is in my code or if the bug is still in qt?


Thanks in advance for any hints or tips,

Urchulak

This post has been edited 1 times, last edit by "urchulak" (May 24th 2012, 3:16pm)


2

Monday, June 4th 2012, 10:18am

Okay....

I've made a workaround for this: First I create an empty widget for my toolbar. Then I create a subclass of QToolBar and make the toolbar I want. Afterwards I just add the toolbar to the layout of my empty widget and I can style the background of that toolbar.

The issue seems to occur when a toolbar is added to a QMainWindow... On any other widget the toolbar is fully stylable.

Does anyone know if Qt has reloved this issue or is at least working on it?

Greetings
Urchulak