qnanopainter
qnanopainter copied to clipboard
drawText is not working - building through cmake
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?
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?
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.
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.