Learn what Felgo offers to help your business succeed. Start your free evaluation today! Felgo for Your Business

Forums

OverviewFelgo 2 Support (Qt 5) › Dialog causes console error and app crash.

Tagged: ,

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #22220

    Edward

    Hey!

    I am trying to use a popup dialog in my app, but for some reason it’s causing a crash when either the cancelled or accepted button is pressed, the code is;

     

        Dialog {
          id: customDialog
          anchors.centerIn: parent
          outsideTouchable: false
          title: "Add a note for admins?"
          positiveActionLabel: "Yes"
          negativeActionLabel: "No"
          onCanceled: {
              note = "null"
              close()
          }
          onAccepted: {
              note = textEdit.text
              close()
          }
          AppTextField {
            id: textEdit
            width: dp(200)
            placeholderText: "type here..."
            anchors.centerIn: parent
          }
        }

     

    and the error code in my log is:

     

    qrc:/qml/VPlayApps/controls/Dialog.qml:311: Error: Cannot assign QObject* to Dialog_QMLTYPE_18*

    #22224

    Alex
    Felgo Team

    Hi Edward,

    this error in the log output is a known issue, but you can ignore it, it will not have any effect. The crash should not be related to the dialog itself but rather your own logic. You can test the dialog alone like this:

    import QtQuick 2.0
    import Felgo 3.0
    
    App {
    
      property string note
      onNoteChanged: console.debug("Note " + note)
    
      Page {
    
        AppButton {
          anchors.centerIn: parent
          text: "Open"
          onClicked: customDialog.open()
        }
    
        Dialog {
          id: customDialog
          anchors.centerIn: parent
          outsideTouchable: false
          title: "Add a note for admins?"
          positiveActionLabel: "Yes"
          negativeActionLabel: "No"
          onCanceled: {
              note = "null"
              close()
          }
          onAccepted: {
              note = textEdit.text
              close()
          }
          AppTextField {
            id: textEdit
            width: dp(200)
            placeholderText: "type here..."
            anchors.centerIn: parent
          }
        }
      }
    }

    Cheers,
    Alex

    #22225

    Edward

    Hi Alex,

     

    When you mention my logic, would it be to do with the ‘note = ….’ section? ‘Note’ is a property vat set in the root of my app!

    #22226

    Thomas

    Hi Edward,
    That should not be the problem. The code snippet provided by Alex has the declaration of the “note” variable in the root element as well. Maybe it has something to do with what you do after the “note” variable is set via the dialog.

    Could you provide a bigger code snippet so we can have a closer look?

    Cheers,
    Thomas

    #22227

    Edward

    Hi Thomas – I am happy to give access to my project on Git if it would help? The code above is part of a calendar which occurs when storing a date to my firebase database!

     

    Thanks,

    Edd

    #22230

    Alex
    Felgo Team

    Hi Edward,

    although we would love to dig into your full project code, we cannot provide this extend of support with the Indie license. If you can provide a smaller example that reproduces the issue it would help us to give it a quick look. What platform does the issue appear on? For Android, you can inspect the full device log output using Android Studio, which also gives you a stack trace that could point to the root of the issue.

    Also did you try to remove your functions step by step to narrow down the exact code that produces the issue?

    Best,
    Alex

Viewing 6 posts - 1 through 6 (of 6 total)

RSS feed for this thread

You must be logged in to reply to this topic.

Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded