Graphical effect Glow increases startup time



  • Hi there,

    I am working on a Qml application that contains many text fields that are supposed to show sensor values. In order to highlight the numbers in case the user clicks on them I implemented a "text glow" using the Glow effect of the QGraphicalEffects module. However, I noticed now that this causes a significant increase (+3 seconds) in the application's startup time and I was wondering why (the visibility property of the effect is set to false by default i.e. on startup) and if there is a way to improve it?

    Thanks in advance for any input!



  • hi @markugra ;
    Could you please show your code ?



  • Thanks for your response. Below you find the code of the component (i.e. a separate qml file) that I am using to display the numbers. This is used all over the place in my application (I cannot provide all code but I hope this is sufficient).

    import QtQuick 2.0
    import QtGraphicalEffects 1.0
    import "."
    
    Item{
        id: root
        property real number: 0.0
        property string prefix:""
        property string suffix:""
        property int precision: 2
        property alias font: numberText.font
        property alias color: numberText.color
        property alias horizontalAlignment: numberText.horizontalAlignment
        property bool glowOn: false
        implicitHeight: numberText.implicitHeight
        implicitWidth: numberText.implicitWidth
    
        Text{
            id: numberText
            anchors.fill: parent
            text: root.prefix + Number(root.number).toLocaleString(Qt.locale(),"f",root.precision) + root.suffix
        }
        Glow {
            id: textGlow
            anchors.fill: numberText
            radius: 8
            samples: 1 + radius * 2
            color: numberText.color 
            spread :0.2
            source: numberText
            visible: root.glowOn
            transparentBorder: true 
            fast: true 
            antialiasing: true
        }
    }
    


  • Im not sure but maybe try enabled:visible

    You may be interested
    http://doc.qt.io/qt-5/qquickitem.html
    http://doc.qt.io/qt-5/qtquick-performance.html



  • @LeLev: Thanks for your answer. Unfortunately, setting enabled to false does not have an effect on the startup time either.

    What I did do now is to create an additional separate Component that contains both the Text and Glow. Using a Loader, that Component is then loaded only when the glowOn property is set to true otherwise my file above just contains the Text component. It's not that elegant since I have to replace the Text with the same Text (+Glow), but it does the trick.


Log in to reply
 

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