PDA

View Full Version : QTransform method is private within this context error



planetLars
14th February 2012, 14:37
Hello,

I have

phone = new QGraphicsPixmapItem(QPixmap(":/icons/Telefonhoerer.png"));
perspectiveMatrix->reset();
perspectiveMatrix->scale(0,45);
phone->setTransform(perspectiveMatrix);
I get an error for line 4:

'QTransform::QTransform(bool)' is private within this context
Reading other discussions about this problem I figured the error is referring to the copy constructor of QTransform being used.

I use Nokia SDK 1.2 on Mac OS X Lion.

Is this probably an error in Qt itself or what's a solution?

The variables are pointers of their used type (i.e.. phone is a QGraphicsPixmapItem pointer).


There being more than one Qt resource on the web, what's the best place to ask such questions? Is the developer.nokia.com Forum now recommended?

wysota
14th February 2012, 14:52
setTransform() expects an object and not a pointer. Allocate your QTransform object on the stack (aka not using "new") and all will be fine.

planetLars
14th February 2012, 15:37
This solved it. The documentation writes an & before the argument thus I thought it requires a pointer but wait & is the reference operator in arguments in C++, thus an object was expected. & only yields an address. Oh my C++ is rusty.

Thank you.