... No one even replied here. But I finally solved it using:
//label_2->setAttribute(Qt::WA_ContentsPropagated );
QPixmap pixmap
(":/new/prefix1/stand.png");
label_2->setPixmap(pixmap);
label_2->setMask(pixmap.mask());
reg+=childrenRegion();
setMask(reg);
}
void resizeEvent(QResizeEvent *e){
QDialog::resizeEvent(e);
//label_2->setAttribute(Qt::WA_ContentsPropagated );
QPixmap pixmap(":/new/prefix1/stand.png");
label_2->setPixmap(pixmap);
label_2->setMask(pixmap.mask());
QRegion reg(frameGeometry());
reg-=QRegion(geometry());
reg+=childrenRegion();
setMask(reg);
}
To copy to clipboard, switch view to plain text mode
Also, I used 2 horizontal spacers to center my object in the widget. Otherwise the Mask would cover the wrong part of the widget. But I have a question. My widget is a rectangle with 4 "fixed" size corners and then "expanding" size spacers, which resize depending on the window. When I resize it it seems to flicker a lot, maybe because it's an irregular shape. (There is this "stand" on the bottom which makes it look like commonly used electronic gadget) So basically it's not exactly a rectangle. And how do I make a size grip on the irregular object? Thanks for all the helpful people like wysota and marcel who helped me with my previous problems.
Bookmarks