Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Qt plugin does not handle class with same name and different folders/namespaces
Qt 6.11 is out! See what's new in the release blog

Qt plugin does not handle class with same name and different folders/namespaces

Scheduled Pinned Locked Moved Qt Creator and other tools
4 Posts 2 Posters 2.5k 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.
  • J Offline
    J Offline
    jepessen
    wrote on last edited by
    #1

    I'm creating in Visual Studio a Qt project with the Qt plugin version 1.2.4.

    This is my folder structure:

    @ src
    |
    |-Class.h -- It defines Class
    |-Class.cpp
    |
    |-Private
    |-Class.h -- It defines Private::Class
    |-Class.cpp@

    In src/Class.h I use the pimpl idion in order to use Private::Class and putting here logic.

    Both Class and Private::Class are qobjects, so I declare Q_OBJECT in both headers. But the plugin creates only one moc header. It creates moc_Class.cpp in both cases and mocs overwrite each other.

    I there a way to handle with the qt plugin different classes in different folders and namespace but with the same name, or I must be forced to use unique names for all classes of my project?

    1 Reply Last reply
    0
    • JKSHJ Online
      JKSHJ Online
      JKSH
      Moderators
      wrote on last edited by
      #2

      Hi,

      Unfortunately the meta-object compiler doesn't handle namespaces.

      This has been discussed before, and some workarounds proposed: http://www.qtcentre.org/threads/6753-moc-with-same-file-names

      Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

      1 Reply Last reply
      0
      • J Offline
        J Offline
        jepessen
        wrote on last edited by
        #3

        I understand. Then I'll check filenames in order to avoid collisions. If I want to study this feature and try to find a way for moc to handle namespaces and/or folders, which file I should check in Qt source? moc.cpp or another one?

        1 Reply Last reply
        0
        • JKSHJ Online
          JKSHJ Online
          JKSH
          Moderators
          wrote on last edited by
          #4

          [quote author="jepessen" date="1422779586"]If I want to study this feature and try to find a way for moc to handle namespaces and/or folders, which file I should check in Qt source? moc.cpp or another one?[/quote]I'm not completely sure myself, but I'm guessing you'd need to look at a few different files in the moc folder: https://qt.gitorious.org/qt/qtbase/source/src/tools/moc/

          If you'd like to talk to the Qt engineers about this (e.g. to show them your proposal and/or ask for advice), subscribe and post to the "Development mailing list":http://lists.qt-project.org/mailman/listinfo/development

          Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

          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