qnanopainter icon indicating copy to clipboard operation
qnanopainter copied to clipboard

drawText is not working - building through cmake

Open jayanthas opened this issue 8 years ago • 3 comments

Hi, I am trying to use qnanopainter built using cmakelists.txt. The function call drawText is not able to draw the string on to UI screen. Instead of using the source code directly I am creating a static library and using it. All other calls like Rect, circle, ellipse, line etc are working. Am i missing anything?

jayanthas avatar Mar 03 '16 04:03 jayanthas

My first guess is that Qt qrc bundling of fonts doesn’t work with static library. Maybe it works if you add ”Q_INIT_RESOURCE(libqnanopainterdata);” into beginning of your main?

QUItCoding avatar Mar 03 '16 07:03 QUItCoding

I tried that in my main and also in the constructor of qnanopainter (2 different attempts). Both did not help. Before using this command it was printing a message

Could not open font file: ":/qnanopainter/data/Roboto-Bold.ttf"

But after using Q_INIT_RESOURCE that was gone, but it still did not draw anything on the UI.

jayanthas avatar Mar 03 '16 09:03 jayanthas

Please note : i only have a text element and nothing else to be displayed. So it is not hidden under any other item. Also i have given x and y co-ordinates correctly. though the width (4th param for drawtext) is not mandatory i tried giving that value as well. But still no luck.

jayanthas avatar Mar 03 '16 09:03 jayanthas