QPainter::drawText() issues with bb10



  • Hi,

    lets try if this forum has some life ;)

    I noticed that on my Z10 (version 10.0.690) the usage of QFont in any form or shape causes a crash.
    Does anyone know what the proper way is to draw text ? I need quite advanced way of drawing where the individual characters are positioned on a curve. Qt has support for this and it would be next to impossible (multi-man-year project) to write that again for bb10.

    I'm sure I'm not the only one that has noticed the font support missing in Qt, does anyone have a solution?



  • I guess you are using Cascades...The problem with Cascades is, that the QPA plugin is not instantiated and the font database not loaded. What you could try is creating a QGuiApplication or QApplication before creating the Cascades one...



  • Hi, thanks for the reply!

    I did a bit more testing and included your suggestion.
    The addition of the QApplication before the cascades Application causes the screen to be black...
    Adding QApplication after the cascades one make stuff crash..

    Since the crash seems to originate in the QFontDatabase, and I use threads, I printed the output supportsThreadedFontRendering(), which was true. So my current going scenario is that RIM never tested this.

    ps. you mentioned QGuiApplication, which you no doubt know is a Qt5 class. Its good to point out that BB10 does not currently ship with Qt5. I was a bit surprised when I received my Z10, as there was conflicting info. So to be clear;
    the current released BB10 do not ship Qt5.



  • Hi,

    The problem should be the same in Qt4 and Qt5. The font database is created by the QPA plugin. Cascades does not use the QPA plugin, because a Cascades application is basically a QCoreApplication.
    Did you test your code with a pure Qt application (just using QtGui for rendering)?

    And yes, Qt5 is not on BB10 yet. What made you think that BB10 would ship Qt5? All the documentation on the BlackBerry developer page is for Qt4?

    Cheers,
    Fabian



  • bq.
    Did you test your code with a pure Qt application (just using QtGui for rendering)?

    The application was developed on the desktop, where it works properly.
    When I ported it to bb10, I failed to find the way to use a QWidget based app. I tried to convince their eclipse based IDE but failed.
    Their developer pages are not the same quality as the Qt ones; many of the tutorials are outdated and refer to stuff that is not actually present in the gold release so most stuff you have to take with a big pinch of salt. I found at least one example that fails to startup...

    But you make a very good point, when I got app ported and showing on the cacades app framework, I was so happy that when the texts rendering didn't work, I failed to step back and rethink my initial approach.

    Maybe the proper way to attack this issue is to do a QWidget based app. Thanks!

    bq.
    And yes, Qt5 is not on BB10 yet. What made you think that BB10 would ship Qt5?
    All the documentation on the BlackBerry developer page is for Qt4?

    I've been asking myself this too, and I think it was a conclusion based on info from outside of the blackberry website and press-releases. Not sure right now.
    I think the developer website is suffering from a lack of entry-point for Qt developers trying out the platform. It took me days before I realized what 'cascades' is and what 'native' is, and this all being shared on the same site with things like 'adobe air' just made it quite scary to start.
    You need a full day just to get the basics from that site. And all I had was an hour per evening or so ;)
    It was in my 4th day of full coding that I finally found the page that states which QtQuick elements are actually supported.



  • You know that you can also use QtCreator for developing on BB10?
    QWidget based apps are supposed to work. Just make sure to switch on the BB10 style. Otherwise the ui might look a bit ugly ;)



  • I've been attempting to use QtCreator. The tutorial on BBs site didn't mention which version of creator it was talking about and the ones I tried didn't have the screens they were talking about. After using the latest which has a nice wizard, it fails as soon as creator calls the commands. Looked to me like the command like options changed in the ndk, without creator getting updated.



  • I managed to get QtCreator working with the latest bb10.1 NDK, there was a bug in the mkspecs for cascades10 which caused the issue. Fixed that and now it works :)



  • So it is not possible to draw text using the Momentics??? That'd be bummer I think my stuff is almost good to go if I could just draw some text on my graphics. I'm drawing on QImage via QPainter it was looking so good until I tried to add some Text, BB10 documentation is pretty poor. SIGSEGV when I tried to call drawText


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.