ryanmelt/qtbindings — Issue #24: Styling problem on top-level widget
Author: Krap
Created: 2011-10-30 16:30:15+00:00
State: open

Hi,

I'm writing a little utility based on a frameless toolbar as top-level widget.
My problem occurs when trying to apply a stylesheet to this toolbar : i can't set its background color. It always appears with default background color.

Here's the code to reproduce the problem :

```ruby
require 'Qt4'

class TestToolbar < Qt::ToolBar
def initialize(parent=nil)
super parent
setWindowFlags Qt::FramelessWindowHint|Qt::WindowStaysOnTopHint
addAction 'Test'
addAction style.standardIcon(Qt::Style.SP_DirIcon),'Icon'
end
end

a=Qt::Application.new ARGV
a.setStyleSheet("QToolBar { background: red; }")
t=TestToolbar.new
t.show
a.exec
```

This problem seems to be relative to binding, since i tried the exact same sample with python and in native c++ (could provide the samples if it helps), both work as expected, with a "nice" red background.

The problem appears only if the toolbar is used as top-level widget ; if included in a main window for example, all works as expected.

My setup :
- windows 7 64
- ruby 1.9.2p290 (i386-mingw32)
- Qt 4.7.4 OpenSource mingw version
- qtbindings (4.6.3.4 x86-mingw32) gem

The only thing i see that could be a problem is the qt version mismatch between qtbindings and the sdk installed. But i have (right now) no other problem with this setup, having used quite a bunch of Qt functions in my app (file system watchers, process monitoring, ...)

Thanks a lot for your great work !