Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. MOC don't generate slots that inside #if-#endif directives

MOC don't generate slots that inside #if-#endif directives

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 784 Views 1 Watching
  • 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.
  • X Offline
    X Offline
    XelaG
    wrote on last edited by
    #1

    Hi,

    I'm writing an app that runs on Windows and Android. Some functions are not available on Windows so I encapsulated them between #if..#endif directives.
    @#if defined( Q_OS_ANDROID ) || defined( Q_OS_LINUX )
    // Some code
    #endif@

    Some of my slots are encapsulated between those, and if use the following code to connect those slots, it doesn't work.
    @connect( emitter, SIGNAL(signalToEmit(), receiver, SLOT(slotToConnect() )@

    Qt says that the slot doesn't exist. Which is true, I checked the file generated by MOC and the slots are missing. I know I can use the following code but it doesn't work when there are some overloaded signals or slots.
    @connect( emitter, &EmitterClass::signalToEmit, receiver, &ReceiverClass::slotToConnect )@

    I tried to add DEFINES += Q_OS_ANDROID in the pro file but this generates errors at compilation time.
    So what must I do to make sure MOC will see the code encapsulated between #if .. #endif directives.

    Thanks.
    Alex.

    "Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." - Martin Golding

    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