PDA

View Full Version : Custom-Shaped Widget



[Po]lentino
9th April 2009, 18:28
Hi all,
I need some help on creating a widget shaped with an icon I choosed, and with the same icon displayed.
For the first part, all is simple:


...
QDialog myDialog;
QPixmap myPixmap = QPixmap( QString::fromUTF8(":/img/logo.svg") );
myDialog.setMask( pixmap.mask() );
Now, how can I embed the same .svg icon inside the shaped dialog, in order to display it ??
Or, there is a simpler way to do it ??
Thanks in advance, cheers !

The Storm
9th April 2009, 22:12
Use QLabel as top level window


QLabel myDialog;
QPixmap myPixmap = QPixmap( QString::fromUTF8(":/img/logo.svg") );
myDialog.setMask( pixmap.mask() );
myDialog.setPixmap( pixmap );


Be sure that the objects will be on place where they will not be deleted because of out of scope reason or else make them pointers. :)

[Po]lentino
9th April 2009, 23:41
Omg, I never figured to use a QLabel to reach my goal !!!
Thank you a lot, The Storm !! :D