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. Can't use C++ property in QML if using preprocessor condition
QtWS25 Last Chance

Can't use C++ property in QML if using preprocessor condition

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
qmlc++preprocessoriosqtquick
2 Posts 2 Posters 963 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.
  • shavS Offline
    shavS Offline
    shav
    wrote on last edited by
    #1

    Hi everyone!

    I have a question how I can enable/disable proper in my class for one platform. In my case I need hide a few properties for desktop OS and show this properties for mobile OS. I use this code to check:

        //...
        #if defined(Q_OS_IOS)
                Q_PROPERTY(RedmineMobileHelper* mobile READ getMobile)
        #endif
        //....
        #if defined(Q_OS_IOS)
                inline RedmineMobileHelper* getMobile(){return m_mobile;}
        #endif
    

    When I build my plugin for iOS this code works for C++. But in QML project where I'm using plugin I can't get property value (it's always receive 'undefined').

    What I do wrong?

    Mac OS and iOS Developer

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      I might be wrong but I wonder if you're not entering a corner case here. I'd recommend posting this to the interest mailing list. You'l find there Qt's developers/maintainers (this forum is more user oriented)

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      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