QText2DEntity disappears when I change the text.



  • HI,
    I have a scene with several QText2DEntity. At the creation, all entities display the text "???". When I click on a given button, the text of one entity is supposed to change. But, in fact, no text is displayed ("???" disappear). When I call text() on the entity, the return value is as expected. If I set the new text as the initial one, it is displayed. If, when I'm creating the scene, I call setText() twice (one with "???", the second eon with another value), the latest value is displayed.

    So, my problem comes from the fact I'm changing the text from an entity that is already displayed. Any idea to force it display the new text?

    @Update: When I replace the string "???" by "??L", the two first '?' are displayed. And the L is missing.



  • @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).