[Interest] QGraphicsView widgets have transparent background

Calogero Mauceri mauceri at actgate.com
Thu Oct 3 12:00:40 CEST 2013


Hi all,

I'm creating a widget having as parent a QGraphicsView. When the widget 
is shown it is drawn with a transparent background, as you can see in 
the following link

http://tinypic.com/r/2ildg7r/5

Here is the code I use to create the widget

....
     // initialize the view
     scene = new QGraphicsScene(this);
     scene->setBackgroundBrush(Qt::green);
     gvView = new QGraphicsView(parent);
     gvView->setScene(scene);
     ....

     ....
     // initialize the widget
     MyWidget *myWidget = new MyWidget(gvView);
     myWidget->setLabelText("Test Widget");
     myWidget->show();
     ....


MyWidget is a simple widget with a label and a button.

creating the widget with the Qt:Dialog flag, I have this result (the 
background is visible)

http://tinypic.com/r/2ylwg7r/5


What am I doing wrong? How can I force the widget to have a background 
color?
Thanks in advance for your help,
     Calogero

-- 
Calogero Mauceri
Software Engineer

Applied Coherent Technology Corporation (ACT)
www.actgate.com





More information about the Interest mailing list