PDA

View Full Version : QWidget::setMask() does not work on OS X side?



Dreamerzz
26th July 2011, 17:37
I am creating a custom triangular button from a push button, using PNG/svgs as pictures.(alphas are set). However, when I attempt to set a mask( so you can only click on the triangle rather than the encompassing rectangle), it would not work in the MAC side, but it works perfectly fine in the windows side. Does anyone know what the issue is?

here is a snippet of my code




#include <QPixmap>
#include <QBitmap>
#include <QDebug>
...

ui->setupUi(this);
QPixmap pixmap(":/Button1/triangle.svg");
ui->pushButton->setMask(pixmap.mask());

high_flyer
27th July 2011, 15:06
Did you check the bug tracker?
I found this on a quick look:
https://bugreports.qt.nokia.com//browse/QTBUG-16406

Dreamerzz
27th July 2011, 16:49
i tried adding it without luck. :(

Perhaps theres a difference when it comes to pushbuttons and labels?

Also im not giving the pushbutton a pixmap but editing its style sheets

high_flyer
27th July 2011, 17:26
Also im not giving the pushbutton a pixmap but editing its style sheets
That is not the code you posted.... ?

Dreamerzz
27th July 2011, 19:09
what i showed you was the masking part of the button.

how the button looks was done with style sheets


QPushButton#sampleButton:enabled{
border-image: url(:/images/triangle.png);
}

QPushButton#sampleButton:hover{
border-image: url(:/images/triangle2.png);
}

QPushButton#sampleButton:pressed {
border-image: url(:/images/triangle3.png);
}


sorry for the confusion!

high_flyer
28th July 2011, 09:04
Masking should not be effect by the stylesheet AFAIK.
Comment out the stylesheet to make sure.
I would also try using a png with alpha channel or even create a simple binary mask in code and try it.

Dreamerzz
28th July 2011, 17:36
PNG alphamasks didn't work either

hm..