Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Font resetting in Creator



  • Say you have two labels (A and B) on a widget. Change the font on label A but not on label B. Save/Build/Run so that label A loses all knowledge of the original widget font. Change the widget font; label B will change its font ('font family' will be bold but 'font' will not; label A won't change ('font' will be bold as well as 'font family'). The revert button for label A won't restore you back to the widget font, neither its new or old version. In fact the widget's .ui file now contains a lump of XML for label A explicitly for the font. Creator has no mechanism for deleting it and the only way I've found is to edit the .ui file with Creator closed down. Have I missed a trick here; does Creator have a mechanism for deleting this chunk of XML?


  • Lifetime Qt Champion

    There is a reset button in the designer (and therefore also in Qt-Creator): https://doc.qt.io/qt-5/designer-widget-mode.html#the-property-editor



  • @Christian-Ehrlicher Thanks but that's what I meant doesn't work in this case. I called it the revert button but I meant what you called it. It is the fact that that does not work in these circumstances that is the problem. It does work if the label has not had a sufficient change to destroy its knowledge of the widget font. Once the label gets its bit of XML in the .ui file it won't clear.


  • Lifetime Qt Champion

    Hi
    I tried what you said but for me, it resets to the new Parent font.

    alt text

    1. add 2 labels
    2. change font of label 1
    3. run project
    4. change widget font. only label 2 will get as 1 as own font
    5. run the project
    6. Reset font properties for label 1.
    7. I here get the new widget font when i reset the font properties.

    Qt5.15 win 10. vs compiler



  • @mrjj I believe you! However, please check the .ui file to see if at any time your label one gains a extra property like this:

        <property name="font">
         <font>
          <family>Calibri</family>
          <pointsize>12</pointsize>
         </font>
        </property>
    
    

    If it doesn't then you're not seeing what I'm seeing. If it does then I'm at a loss!


  • Lifetime Qt Champion

    What QtCreator version do you use?



  • @Christian-Ehrlicher
    Qt Creator 4.14.2, Based on Qt 5.15.2 (MSVC 2019, 64 bit), Built Mar 19 2021.


  • Lifetime Qt Champion

    Works also fine for me here with 5.15.0 on linux and 4.11.0 on Windows 7



  • OK. Telling me it all works fine just means you're not seeing the same as the problem I'm having. I presume you are seeing the boldening of the Properties in the properties editor that I outlined. I presume you are seeing the addition to the .ui file that I'm seeing. Given that that is the case I still don't have a solution. However, I thank you for your time and especially the speed that you responded.


  • Lifetime Qt Champion

    @BrianE
    Hi
    I also tried at work to see if I could reproduce it.
    There is no trace of the old font info in the UX file.
    When i reset the properties. it goes back to the new "widget font"
    and the label no longer has the font property.

    So the issue you are seeing is that it get stuck at this reset and the font is not the new
    one it should be but still the old one, the manually set one ?


Log in to reply