Creating round QIcon from string
Solved
General and Desktop
-
Hi all,
just another question from me :)
I have a QListWidget that contains several items. Each item should get an icon that displays the a state (color code) and text (numbering). What i already have is the QIcon with text and color code.
QString lfnr; //<some more code here> QPixmap *px = new QPixmap(40,40); QPainter *painter(px); px->fill(state); painter->drawText(px->rect(),Qt::AlignCenter,lfnr); QIcon *icon = new QIcon; icon->setPixmap(px);
My question is now, what is the easiest way to create a round icon (which in my opinion looks much more fancy than a square :) )
Thanks for help
-
@the_
use QPainter::setBrush() before the drawEllipse() call -
@raven-worx said:
@the_
use QPainter::setBrush() before the drawEllipse() callThanks, that draws a nice colored circle :)