Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Graphical effect Glow increases startup time

Graphical effect Glow increases startup time

Scheduled Pinned Locked Moved Solved QML and Qt Quick
5 Posts 2 Posters 783 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    markugra
    wrote on last edited by
    #1

    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!

    1 Reply Last reply
    0
    • ODБOïO Offline
      ODБOïO Offline
      ODБOï
      wrote on last edited by
      #2

      hi @markugra ;
      Could you please show your code ?

      1 Reply Last reply
      0
      • M Offline
        M Offline
        markugra
        wrote on last edited by
        #3

        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
            }
        }
        
        1 Reply Last reply
        0
        • ODБOïO Offline
          ODБOïO Offline
          ODБOï
          wrote on last edited by
          #4

          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

          1 Reply Last reply
          0
          • M Offline
            M Offline
            markugra
            wrote on last edited by
            #5

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

            1 Reply Last reply
            1

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved