[Qt-interest] Generating icons at runtime
Robert Hairgrove
evorgriahr at hispeed.ch
Wed Feb 4 22:50:34 CET 2009
I have a list of students which sign up for varying lesson times
depending on their enrollment status. What I would like to do is add a
colored icon to the list displaying a text abbreviation over a square
solid-color background. The users should be able to pick any colors they
want for the different backgrounds, and different two- or three-letter
text abbreviations (in black) for the enrollment status depending on the
users' needs.
What would be the best way to go about this with QPixmap, QIcon et al.?
I assume one would need to create a new QPixmap object for the
background with an appropriate fill color (e.g. 32x32 pixels), then call
setMask() with a 1-color (indexed) bitmap having a transparent background.
Is it that simple? I've never worked much with QPixmap before, although
i do have some experience using Windows API functions such as BitBlt().
But it should be a Qt solution at the end of the day.
Thanks!
More information about the Qt-interest-old
mailing list