Results 1 to 8 of 8

Thread: Qwidget Depth

  1. #1
    Join Date
    Jun 2009
    Location
    India
    Posts
    143
    Thanks
    16
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Qwidget Depth

    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 ...

  2. #2
    Join Date
    May 2011
    Posts
    239
    Thanks
    4
    Thanked 35 Times in 35 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Symbian S60

    Default Re: Qwidget Depth

    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.

  3. #3
    Join Date
    Apr 2010
    Posts
    769
    Thanks
    1
    Thanked 94 Times in 86 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: Qwidget Depth

    If you're asking about color, Qt widgets support full 24-bit color plus 8 bits of transparency.

  4. #4
    Join Date
    Jun 2009
    Location
    India
    Posts
    143
    Thanks
    16
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Qwidget Depth

    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 ....

  5. #5
    Join Date
    Apr 2010
    Posts
    769
    Thanks
    1
    Thanked 94 Times in 86 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: Qwidget Depth

    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.

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Qwidget Depth

    See if it changes anything if you set the Qt::WA_TranslucentBackground attribute on the widget.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  7. The following user says thank you to wysota for this useful post:

    augusbas (29th June 2011)

  8. #7
    Join Date
    Jun 2009
    Location
    India
    Posts
    143
    Thanks
    16
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Qwidget Depth

    Quote Originally Posted by wysota View Post
    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 !!!!

  9. #8
    Join Date
    Jun 2009
    Location
    India
    Posts
    143
    Thanks
    16
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Qwidget Depth

    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

    Qt Code:
    1. // This code is working fine for underlay and overlay with a third party graphics in middle layer as i am passing window id
    2.  
    3. QPainter paint(this);
    4.  
    5. /************Underlay **********************/
    6. paint.setPen(QColor(255,255,0,100));
    7.  
    8. paint.setBrush(QColor(255,255,0,100));
    9.  
    10. paint.drawEllipse(100,150,200,200);
    11.  
    12. /************Overlay **********************/
    13.  
    14. paint.setPen(QColor(255,0,0,255));
    15.  
    16. paint.setBrush(QColor(255,0,0,255));
    17.  
    18. paint.drawEllipse(200,150,200,200);
    To copy to clipboard, switch view to plain text mode 

    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

Similar Threads

  1. Qpixmap of 32 bit Depth
    By augusbas in forum Qt Programming
    Replies: 4
    Last Post: 19th May 2011, 12:03
  2. Image 32 bit depth to 8 bit depth
    By ^NyAw^ in forum Qt Programming
    Replies: 2
    Last Post: 2nd September 2008, 09:35
  3. depth of QTreeWidgetItem
    By stefan in forum Newbie
    Replies: 3
    Last Post: 29th June 2008, 11:58
  4. Qtopia depth problem
    By paralyze in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 11th May 2007, 18:35

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.