Results 1 to 3 of 3

Thread: Error: Cannot assign QJSValue to QObject*

  1. #1
    Join Date
    Aug 2008
    Location
    Algarve, Portugal
    Posts
    286
    Thanks
    23
    Thanked 31 Times in 27 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60

    Default Error: Cannot assign QJSValue to QObject*

    I have a NumberAnimation where the target is a dynamic qml Item object, created with Qt.createComponent().
    The code works fine but I always get a error in QtCreator Aplication Output window, I don't know how to remove that annoying error.

    Qt Code:
    1. property var badJoeObj: ({})
    2.  
    3. NumberAnimation {
    4. id: moveBadJoeToAnotherScreen
    5. duration: 1000
    6. }
    7.  
    8. function moveBadJoe2AnotherScreen(){
    9. moveBadJoeToAnotherScreen.target = badJoeObj // <- Error: Cannot assign QJSValue to QObject*
    10. ...
    11. }
    To copy to clipboard, switch view to plain text mode 
    _______________________________________________
    Math Graphica - scientific calculator with graphs 2D / 3D / 4D, user defined functions, system of equations, formulas and integrals
    Qt Ambassador

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,355
    Thanks
    3
    Thanked 5,009 Times in 4,788 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Blog Entries
    4
    Wiki edits
    10

    Default Re: Error: Cannot assign QJSValue to QObject*

    How about:

    javascript Code:
    1. property Item badJoeObj: null
    2.  
    3. NumberAnimation {
    4. target: badJoeObj
    5.  
    6. // ...
    7. }
    To copy to clipboard, switch view to plain text mode 
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. The following user says thank you to wysota for this useful post:

    john_god (21st August 2018)

  4. #3
    Join Date
    Aug 2008
    Location
    Algarve, Portugal
    Posts
    286
    Thanks
    23
    Thanked 31 Times in 27 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60

    Default Re: Error: Cannot assign QJSValue to QObject*

    Thanks Wysota, that works.
    _______________________________________________
    Math Graphica - scientific calculator with graphs 2D / 3D / 4D, user defined functions, system of equations, formulas and integrals
    Qt Ambassador

Similar Threads

  1. Error: Cannot assign to non-existent property
    By ustulation in forum Qt Quick
    Replies: 8
    Last Post: 3rd July 2013, 14:54
  2. [SOLVED]Weird compile error QObject, QVector
    By Alir3z4 in forum Qt Programming
    Replies: 2
    Last Post: 30th January 2012, 17:07
  3. QObject::connect error with simple typedef types
    By brcain in forum Qt Programming
    Replies: 0
    Last Post: 19th April 2010, 21:01
  4. Compiler error when calling QObject::connect. What am I missing?
    By themanwiththequestion in forum Qt Programming
    Replies: 4
    Last Post: 2nd February 2010, 15:33
  5. py2app-deployed PyQt app -- throws QObject threading error
    By tory108 in forum Installation and Deployment
    Replies: 4
    Last Post: 20th January 2009, 21:16

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.