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. ParticleSystem doesn't always show until device interacted with
Forum Update on Monday, May 27th 2025

ParticleSystem doesn't always show until device interacted with

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 129 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.
  • A Offline
    A Offline
    Allstar12345
    wrote on last edited by
    #1

    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 :)

    1 Reply Last reply
    0

    • Login

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