PDA

View Full Version : Qwidget Depth



augusbas
28th June 2011, 13:18
Hi ,

When i checked the widget depth by this call.

widget.depth()

it results as 24 bit depth ....Is there any way we can have a widget of 32 bit depth ...

I have some X code where a widget is created and using "xtVaSetValues" function call they set the depth to 32 or 24 ( XtNdepth)...

Something like this is possible in Qt ...

mvuori
28th June 2011, 22:55
Something having 32 bits is not a value as such. 3 x 8 bits in RGB is a depth of 24 bits. The real question, in my mind, is what would you want to achieve with the extra bits and is that something possible in Qt. Extraneous bits without a purpose are just waste.

SixDegrees
28th June 2011, 23:42
If you're asking about color, Qt widgets support full 24-bit color plus 8 bits of transparency.

augusbas
29th June 2011, 06:37
Hi ,

I have some x code where the X window is created with 24 or 32 bit depth ..In the xwindow underlays and overlays are drawn .....When the Xwindow id is passed to a 3rd party library it will place some graphics into it.....In the program argument, if i pass 24 bit depth underlays and overlays will go below the graphics ........if i pass 32 as depth overlays will be drawn above the graphics.....

The same one i am trying to replicate in Qt ......but in qt widgets depth are 24 bit ....I am confused whether this will have an impact ....

SixDegrees
29th June 2011, 08:46
Why don't you just try it and see?

Qt widgets, as already noted, support full 32-bit color and transparency. If X is using those bitplanes for another purpose, however, I wouldn't expect results to be the same.

wysota
29th June 2011, 09:25
See if it changes anything if you set the Qt::WA_TranslucentBackground attribute on the widget.

augusbas
29th June 2011, 10:53
See if it changes anything if you set the Qt::WA_TranslucentBackground attribute on the widget.



Thank you Wysota.....Its great .....Its working .......Had a tough time almost a week for this problem.......Thank you !!!!:)

augusbas
1st July 2011, 08:01
Hi ,

I have used Qt::WA_TranslucentBackground and i could able to see overlays & underlays ,only if i use painter as below on the object i am drawing....

By setting the Alpha channel , i can able to move the image from underlay to overlay or vice versa




// This code is working fine for underlay and overlay with a third party graphics in middle layer as i am passing window id

QPainter paint(this);

/************Underlay **********************/
paint.setPen(QColor(255,255,0,100));

paint.setBrush(QColor(255,255,0,100));

paint.drawEllipse(100,150,200,200);

/************Overlay **********************/

paint.setPen(QColor(255,0,0,255));

paint.setBrush(QColor(255,0,0,255));

paint.drawEllipse(200,150,200,200);

Now i need to put a image(png , jpg or bmp) as underlay .....Because Qt::WA_TranslucentBackground is set , so the Image comes in front of the graphics ...so the third party graphics is invisible ...how do i make a Image as underlay and graphics as the next layer to it ....and above that overlay