Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. QML behaviour different on Windows and Android !

QML behaviour different on Windows and Android !

Scheduled Pinned Locked Moved Solved Mobile and Embedded
3 Posts 1 Posters 480 Views
  • 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.
  • S Offline
    S Offline
    Soda31
    wrote on last edited by Soda31
    #1

    Hello,

    I'm facing to a strange problem with Qt and Android

    I have a class MyClass which is used in my QML code
    In QML code I get some instance and make assignements

    class MyClass : public QObject {
    Q_OBJECT

    Q_PROPERTY(a::b::c::Test* selectedTest READ selectedTest WRITE
                   setSelectedTest NOTIFY selectedTestChanged)
    

    ....

    class Test : public QObject {
    Q_OBJECT
    ....

    I used
    qmlRegisterUncreatableType<Test>("a.b.c", 1, 0, "Test",
    "object Test is not instanciable");

    to be able to use Test objects in QML and ENUMs from Test

    Well following code gives different results on Windows and Android

    I have in my c++ code a function that can returns a Test* (or other things)

    QObject * xxx::searchItem(...)
    ... if (...) return a Test* else return other things

    in QML I have
    var myVar = xxx.searchItem(...)

    and in other QML file myclass.selectedTest = myVar (using signals)

    On Windows all is working fine,
    on Android I have following error message:

    Error: Cannot assign QObject* to a::b::c::Test*

    I checked that myVar has the good type but I do not understand why it does not work on Android

    I can get similar error messages for example with
    myclass.otherproperty = myVar where otherproperty is an int for example

    I use Qt 5.10.1 and compile for windows 64 bits / android armv7

    Any Idea ?

    1 Reply Last reply
    0
    • S Offline
      S Offline
      Soda31
      wrote on last edited by
      #2

      I created a more simple projet and it works ;(

      Well how can I debug myclass.selectedTest = myVar in QML ?
      Error message
      Error: Cannot assign xxxx to yyyy is in Qt source code ?

      1 Reply Last reply
      0
      • S Offline
        S Offline
        Soda31
        wrote on last edited by
        #3

        finally I found the problem !

        above code is compiled in a lib but at deployement I let the same lib with a different name and older (however with same functionnalities)
        So there were two libs with same package, functionnalities, ...
        Well it strange that it worked at 90% but that there was a problem in the QML code
        I close the topic

        1 Reply Last reply
        1

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved