Qt6 topics merged with General

Ui classes and export/import

  • Moderators

    I have some user interface put into a dynamic library. It does contain some widgets that I don't want exported, so I've given them the Q_DECL_HIDDEN specifier. Then I have a form that employs one of those widgets, so the uic is generating a class for me. The problem is I get the following warning:

    "'SomeUiGeneratedClass' declared with greater visibility than the type of its field SomeUiGeneratedClass::notExportedClassMember".

    I know that g++ is trying to export the Ui generated class because no explicit visibility was specified (since it's generated). Is there any way to tell qmake/uic that I don't want my Ui classes generated in the global namespace, but instead for example in an anonymous one? I realize I could pass g++ the relevant flag, but since I'm going to compile on different platforms, and probably want to support other compilers beside g++ I'm looking for a somewhat portable solution. Any suggestions are greatly appreciated.

    (I'm currently developing with Qt 5.6 on Linux with g++)

    Kind regards.