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
    Felgo Team

    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.

Voted #1 for:

  • Easiest to learn
  • Most time saving
  • Best support

Develop Cross-Platform Apps and Games 50% Faster!

  • Voted the best supported, most time-saving and easiest to learn cross-platform development tool
  • Based on the Qt framework, with native performance and appearance on all platforms including iOS and Android
  • Offers a variety of plugins to monetize, analyze and engage users
FREE!
create apps
create games
cross platform
native performance
3rd party services
game network
multiplayer
level editor
easiest to learn
biggest time saving
best support