I don't know what you are trying to do (not a very straightforward thing, I presume), but you should probably set the geometry of the floating label. In both cases.
I don't know what you are trying to do (not a very straightforward thing, I presume), but you should probably set the geometry of the floating label. In both cases.
ht1 (21st November 2007)
Thanks, Wysota, for your suggestion. That did it!
Hi,
It seems like 99% of the problems are solved. Even with geometry set and sizes exactly the same, the two pixmaps that I'm trying to align won't align perfectly. It's very close but not perfect. It seems that when a pixmap is loaded from a file as opposed to when it's drawn by my Qt program, the image is 1 pixel taller (despite the fact that they were made exactly the same with "scaled()" command). I wonder if this has something to do with pixmap margins?? Or maybe someone has some other ideas.
Notice that greenLabel's position is relative to its parent, pixmapLabel.
J-P Nurmi
This might be a stupid question, but why don't you compose a single pixmap out of the two pixmaps and set it to one label, so that you can get rid of the other?
All of your comments are very relevant (thanks wysota and jpn).
I have to use two pixmaps because I use a checkbox to turn different pixmaps on/off. Everything works really well except for the fact that two pixmaps of the same size won't align perfectly. I guess I could try converting both of them to files and then reload from the file. Problem is that that would slow things down and it wouldn't be as elegant.
Another thing I'm suspecting is that the scaled() function may work a bit differently when the background is transparent (as is the case the child label here). Anyway, I keep pushing because I'm very close to what I want to achieve. If any of you have some other ideas, I'm of course all eyes and ears!
ht1 (21st November 2007)
Wysota, this is a great idea!
I didn't know you could automatically put two existing bitmaps together like that. How do you do it?
ht1 (21st November 2007)
Bookmarks