onClicked doesn't work

• Jun 29, 2017 - 10:45

I made my first GUI in MuseScore2, but the onClicked event doesn't work.

I attach the plugin. Test.qml

Please look at cancelButton at the end. It doesn't quit.

Tanks for any help.


Comments

It can't quit something that has already been quit.

Your onRun function calls Qt.quit() which means that as soon as your plugin is called and runs, it closes itself. You still see your create window object, but it now lives in an orphaned land of maybes.

If you comment out that line from the onRun function you will end up in the onClicked handler of your button.

It probably still won't do what you're hoping for though. As calling Qt.quit there will leave your window just as open as it is now. You'll also have to explicitly close the window yourself.
This should do the trick

onClicked: {
      mainWindow.close();
      Qt.quit();
}

Do you still have an unanswered question? Please log in first to post your question.