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 self destruction
Forum Updated to NodeBB v4.3 + New Features

Component self destruction

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 2 Posters 1.4k 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.
  • L Offline
    L Offline
    lotin
    wrote on last edited by
    #1

    Hello,
    I want to make the notification handling component.
    I want to make component for one notification (one row notification) which seems like this: (i removed some properties to make it smaller)

    NotificationForm.ui.qml

    Item {
        RowLayout {
            Text {
                id: notifID
            }
            Text {
            }
            Image {
                MouseArea {
                    id: ok_b
                }
            }
        }
    }
    

    and

    Notification.qml

    NotificationForm {
        ok_b.onClicked: {
            notifClass.notifyDone(notifID.text);
           //Here I need something like self destructor
      }
    }
    

    Then I want to add it into some listview where will be dynamicaly created these notifications components.
    And my question is:
    Is any posibility to make something like self destructor, that on "ok_b" is clicked that it will destroy itself and the listview automaticaly recognize that it is destroyed and remove it from listview

    Thanks for every response.

    1 Reply Last reply
    0
    • timdayT Offline
      timdayT Offline
      timday
      wrote on last edited by timday
      #2

      I think you need to read this section of the documentation: http://doc.qt.io/qt-5/qtqml-javascript-dynamicobjectcreation.html (see the "Deleting Objects Dynamically" section in particular).

      It certainly is possible to destroy objects by invoking .destroy() on the id or object var (but they need to have been created dynamically). Note also the "SelfDestroyingRect" example there of an object destroying itself.

      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