PDA

View Full Version : Qt3 - Multiple transparent widgets



bythesea
8th July 2007, 14:54
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?

rajesh
9th July 2007, 13:58
you can use QLineEdit for display text with transparent background.

bythesea
10th July 2007, 17:13
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

rajesh
11th July 2007, 06:14
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.



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

emrares
11th September 2009, 11:24
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.



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



10x alot!!:D