Results 1 to 5 of 5

Thread: Qt3 - Multiple transparent widgets

  1. #1
    Join Date
    Jul 2007
    Posts
    2
    Qt products
    Qt3
    Platforms
    Windows

    Default Qt3 - Multiple transparent widgets

    In Qt3, I guess the only way to create transparent widgets is to perform masking on the widget itself. However what is the best way to handle in the following scenario?

    Take for a example that I have a map as my parent widget.
    I would like to display text or small pixmap as widgets on top of the map. These widgets must be transparent(ie. I must still be able to see parts of the map beneath the widgets) and these widgets may be created or destroyed at random. The quantity of these widgets is also not known beforehand.

    What is the best approach to handle the above scenario? Is masking still the way to go, esp when the small of these widgets are not known?

  2. #2
    Join Date
    May 2006
    Location
    Bangalore,India
    Posts
    235
    Thanks
    7
    Thanked 25 Times in 24 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: Qt3 - Multiple transparent widgets

    you can use QLineEdit for display text with transparent background.

  3. #3
    Join Date
    Jul 2007
    Posts
    2
    Qt products
    Qt3
    Platforms
    Windows

    Default Re: Qt3 - Multiple transparent widgets

    Quote Originally Posted by rajesh View Post
    you can use QLineEdit for display text with transparent background.
    thanks for the reply

    which member functions of QLineEdit can be used to change into a transparent background?
    as far as i know, it is not really possible to have transparent widgets in qt3

  4. #4
    Join Date
    May 2006
    Location
    Bangalore,India
    Posts
    235
    Thanks
    7
    Thanked 25 Times in 24 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: Qt3 - Multiple transparent widgets

    the following code is working for me in Qt4. if it doesn't work in Qt3 then look for QPalette or backgroundRole in Qt3 assistant.

    [html]
    m_timeLabel1 = new QLineEdit;
    QPalette palette;
    palette.setColor(m_timeLabel1->backgroundRole(), Qt::transparent);
    m_timeLabel1->setPalette(palette);
    [/html]

  5. The following user says thank you to rajesh for this useful post:

    emrares (11th September 2009)

  6. #5
    Join Date
    Aug 2009
    Posts
    33
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qt3 - Multiple transparent widgets

    Quote Originally Posted by rajesh View Post
    the following code is working for me in Qt4. if it doesn't work in Qt3 then look for QPalette or backgroundRole in Qt3 assistant.

    [html]
    m_timeLabel1 = new QLineEdit;
    QPalette palette;
    palette.setColor(m_timeLabel1->backgroundRole(), Qt::transparent);
    m_timeLabel1->setPalette(palette);
    [/html]

    10x alot!!

Similar Threads

  1. Transparent widgets on top of QGLWidget
    By tseval in forum Qt Programming
    Replies: 1
    Last Post: 12th May 2007, 22:03
  2. Performance in hiding/showing widgets
    By Paalrammer in forum Newbie
    Replies: 12
    Last Post: 14th February 2007, 19:57
  3. How to paint across/over multiple widgets?
    By richy in forum Qt Programming
    Replies: 3
    Last Post: 31st August 2006, 11:57
  4. Replies: 11
    Last Post: 7th July 2006, 14:09
  5. Transparent widgets
    By incapacitant in forum Newbie
    Replies: 10
    Last Post: 21st March 2006, 19:01

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.