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. QML MessageBox onYes called two times after click
Forum Updated to NodeBB v4.3 + New Features

QML MessageBox onYes called two times after click

Scheduled Pinned Locked Moved QML and Qt Quick
3 Posts 2 Posters 1.9k Views 1 Watching
  • 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.
  • K Offline
    K Offline
    kornfan
    wrote on last edited by
    #1

    When I run project on PC any other than mine, onYes function from MessageBox executes twice. I have only made some text changes to the DefaultMessageBox.qml but even when I copied it from my PC the issue persists. I can't recall any other changes that I could have made to the Qt files, yet it must be somewhere there. I execute project on both iOS and Mac desktop with the same result. I've checked if there is only one MessageBox or Button, also the onClick from the DefaultMessageBox is called only once. Please help

    Krystian

    1 Reply Last reply
    0
    • dheerendraD Offline
      dheerendraD Offline
      dheerendra
      Qt Champions 2022
      wrote on last edited by
      #2

      It should not be like that. I have used on MAC and android. It is called handler only once. Can you paste your sample code here ? Here is what I have tried.

      @ MessageDialog {
      title: "Overwrite?"
      icon: StandardIcon.Question
      text: "file.txt already exists. Replace?"
      standardButtons: StandardButton.Yes | StandardButton.YesToAll |
      StandardButton.No | StandardButton.NoToAll | StandardButton.Abort
      Component.onCompleted: visible = true
      onYes: console.log("Cal me - yes")
      onNo: console.log("Call me - NO")
      onRejected: console.log("aborted")
      }
      @

      Dheerendra
      @Community Service
      Certified Qt Specialist
      http://www.pthinks.com

      1 Reply Last reply
      0
      • K Offline
        K Offline
        kornfan
        wrote on last edited by
        #3

        @ MessageDialog {
        id: messageDialog
        text: "Czy chcesz pobrać ten wiersz?"
        onYes: {
        console.log("MessageDialog onYes")
        }
        standardButtons: StandardButton.Yes | StandardButton.No
        Component.onCompleted: visible = false
        }@

        and this gives me such log
        @DefaultMessageBox onClicked
        MessageDialog onYes
        MessageDialog onYes@

        I added debug message in the DefaultMessageDialog.qml to be sure that there is only one MessageDialog and only one Button.

        As I said before, the dialog works correct on my Mac that I started the project, but whenever I clone repo to any other computer the issue exists. I tried to update Qt, Qt Creator but with no effect.

        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