Skip to content
  • 0 Votes
    2 Posts
    474 Views
    A

    @Alain38-0 OK. Now I have found a way to always have a displayed text. For this, in the initial setText (when scene is not yet rendered) I'm putting all the characters that can appear in the strings that will be displayed. Then, I have something displayed. But it is often wrong. To be more explicit I'm doing this:

    void createScene() { ... myTextEntity->setText("?CLRT0123456789"); ... } void pageDisplayed() { ... myTextEntity->setText("???"); ... } void onButtonCLicked() { myTextEntity->setText("C23"); }

    setText("C23") displays another string of three characters (like "2R7"). But, at least strings have a coherency (all 'L' are replaced by '0', and so on).

  • 1 Votes
    4 Posts
    2k Views
    P

    @Cute3d, yes, it finally works. Idk what was wrong. Example project:https://github.com/Nonmant/Qt3DExtras-QText2DEntity-Example
    And due to god-knows-what reasons it doesn't work in debug mode. Hope, that project can help someone.

  • 0 Votes
    7 Posts
    5k Views
    V

    I've got the same issue with Qt3DExtras::QText2DEntity. But I found the workaround.
    Look like there is a bug? in implementation of Qt3DExtras::QText2DEntity that prevents internal initialization (QText2DEntityPrivate::setScene is never called). This happens when scene is already visible and Qt3DExtras::QText2DEntity is created with parent entity passed to constructor. The workaround I used to make it work is to pass nullptr (which is default) as parent in constructor and call ->setParent(parentEntity) in separate call.

    m_text2dLabel = new Qt3DExtras::QText2DEntity(); m_text2dLabel->setParent(parentNode);