Quantcast
Channel: Qt DevNet forums: Qt Quick 1283365070**
Viewing all articles
Browse latest Browse all 4972

Issues with using object.destroy()

$
0
0
Hello, I am trying to implement a Reset button such that when the user clicks ‘Reset’, I dynamically create a QML file using the method shown here: Dynamic Object Management [qt-project.org] This object I make is a simple confirmation box that says: “Are you sure?” and has two buttons Yes or No. The Yes Button works fine, but when I click No, I want to remove the box and so I run container.destroy(). The following is the QML file I create for the confirmation box import QtQuick 2.0 import QtQuick.Controls 1.0 import "../SetUp/SetUp.js" as SetUp     Rectangle {     id: container     width: parent.width*0.1; height: parent.height*0.1     anchors.centerIn: parent     color: "black"; radius: 5;     Column {         anchors.centerIn: parent         id: col         spacing: 5         Item {             width: ask.width; height: ask.height             Text {                 id: ask                 text: "Are you sure?"                 color: "white"                 font.pixelSize: container.height*0.25             }         }         Item {             width: row.width; height: row.height             Row {                 id: row                 spacing: 2                 Button {                     text: "Yes"                     onClicked: {                         SetUp.pageNum = 1;                         SetUp.menuOn = 0;                         SetUp.createSpriteObjects("SetUp.qml")                       }                 }                 Button {                     text: "No"                     onClicked: {                         SetUp.menuOn = 0;                         container.destroy()                     }                 }             }         }     } } After selecting No, I can’t click any other buttons on my screen to enable other menu options. I can’t even click the Reset Button anymore…. Can someone explain why this happens and if I can fix it?

Viewing all articles
Browse latest Browse all 4972

Trending Articles