Yesterday I found a thread with "how to shape QPushbutton" and something like
QIcon icon("myicon");
..dontknow...setMask(icon.getMask);
and now I am searching again and find lots of "shapings" and "round widgets", but not the mentioned code
So, can we do it one more time and then put the infos into the wiki? Round Buttons (or similiar)?
In Qt3, it was like
void TGuiObject
::setBitmap(QWidget* w,
const QString
& file) {
if( !file.
isEmpty() && QFile::exists(file) ) { if( QFile::exists(file+fileMask
) ) pix.
setMask(QBitmap(file+fileMask
));
pal.
setBrush(w
->backgroundRole
(),
QBrush(pix
));
w->setPalette(pal);
}
}
void TGuiObject::setBitmap(QWidget* w, const QString& file)
{
if( !file.isEmpty() && QFile::exists(file) ) {
QPixmap pix(file);
if( QFile::exists(file+fileMask) )
pix.setMask(QBitmap(file+fileMask));
QPalette pal;
pal.setBrush(w->backgroundRole(), QBrush(pix));
w->setPalette(pal);
}
}
To copy to clipboard, switch view to plain text mode
wasn'it?
I wanted the Starfleet logo to be the button. When I click it with the above code, it is not really shaped... it is still a rectangle with white corners around the round image...
Bookmarks