PDA

View Full Version : Trouble creating a QSGTexture



qtlearning
20th December 2013, 04:59
I am trying to create a QSGTexture so I can use it on a simple texture node in a QQuickItem:



QSGTexture*tex= view.createTextureFromImage(QImage("qrc:/testfont.png"));
qDebug()<<"texture size at creation: "<<tex->textureSize().width();


This crashes the system every time it runs. I also tried putting just the file name in the QImage constructor, and while that didn't crash, the qDebug statement causes a crash when trying to test if it has a width attached.

Can anyone point out the error or point to an example of how to properly create a texture?

hghgi
6th April 2015, 18:50
I was having the same problem... uh...
"qrc" should be ommitted from the path.
so:
QImage(":/testfont.png")
works.