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. Component Destruction
Qt 6.11 is out! See what's new in the release blog

Component Destruction

Scheduled Pinned Locked Moved Solved QML and Qt Quick
3 Posts 2 Posters 1.2k 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.
  • G Offline
    G Offline
    Gabriidc
    wrote on last edited by VRonin
    #1

    Hi,

    When Load a component using Loader I can delete the component when I dont need more in the application changing the value of property source to ""

    Example:

    //Component.qml
    Component
    {
    Rectangke{....}
    }
    
    //Main.qml
    Window
    {
       Button{
              text: "Load"
              onClicked: loader.source = "Component.qml"
        }
       Button{
              text: "Close"
              onClicked: loader.source = ""
        }
       Loader{
             id: loader
       }
    }
    

    My problem occurs when instead of use Loader I use as show bellow:

    //Main.qml
    Window
    {  
           Component
           {
              .....
           }
    } 
    

    Using this option I dont know how can I load and delete the component when I need.

    1 Reply Last reply
    0
    • IntruderExcluderI Offline
      IntruderExcluderI Offline
      IntruderExcluder
      wrote on last edited by
      #2

      You can create it dynamically by calling createObject and destroy when needed via destroy. More info can be found here.

      G 1 Reply Last reply
      0
      • IntruderExcluderI IntruderExcluder

        You can create it dynamically by calling createObject and destroy when needed via destroy. More info can be found here.

        G Offline
        G Offline
        Gabriidc
        wrote on last edited by
        #3

        @IntruderExcluder Thank you so much !

        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