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

ParticleSystem doesn't always show until device interacted with



  • Hi,

    I use QML ParticleSystem to show a little snow effect in my App for winter, but for some reason it's very intermittent when it shows, some App launches it is visible straight away and others I have to interact with the App in some ways (Open a menu or push a page onto the stack for example) which causes it to abruptly show.

    I'm using Qt 5.6 on Sailfish OS (yeah we are still stuck on 5.6 yey)

    This is the code:

     ParticleSystem {
                id: particleSys
                Component.onCompleted: {checkIfAllowed();}
                function startSnow(){emitter.burst(emitter.emitRate)}
                function checkIfAllowed(){var month=Qt.formatDateTime (new Date(), "MM");
          if(appsettings.getSystemSetting("snowEffect", "")==="true"){
            if(month==="11"){startSnow();}
            else if(month==="12"){startSnow();}
            else if(month==="01"){startSnow();}
            else if(month==="02"){startSnow();}
            else{emitter.destroy();imgpart.destroy();particleSys.destroy();} }
                }
                }
    
            Emitter{
                  id: emitter
                  focus:true
                  startTime: 10
                  anchors{top:parent.top;}
                  height:parent.height/1.5; width: parent.width
                  system: particleSys
                  emitRate: 15
                  layer.enabled: true
                  lifeSpan: 3000
                  lifeSpanVariation: 300
                  maximumEmitted: 800
                  size: 4
                  endSize: 30
                  velocity: TargetDirection{
                      targetX: 0; targetY: 0
                      targetVariation: 360
                      magnitude: 150
                      targetItem: pillButton
                  }
              }
    
              ImageParticle{
                  id: imgpart
                  color:lightTheme? "black": "white"
                  source:"images/snowflake.png"
                  system: particleSys
              }
    

    I've shot a tiny video to show what it's doing:

    Qt Particle bug

    If anyone has any ideas please do share them :)


Log in to reply