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. How to create global #include from QtDesigner plugin
QtWS25 Last Chance

How to create global #include from QtDesigner plugin

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

    Hello,

    I'm working on QtDesigner plugin for my widgets library. I use following code:

    @QString MyWidgetPlugin::includeFile() const
    {
    return "mywidget.h";
    }@

    It works well, but uic produces local include like this:

    @#include "mywidget.h"@

    But I want to install my widget library into system and use it in number of projects,
    so I need to generate something like:

    @#include <mywidget.h>@

    I found an undocumented feature in the QtDesigner sources - one can return "<mywidget.h>" instead of "mywidget.h" in his includeFile(), and then include recognized as global, and correctly handled by uic.

    The question is simple - can I use this feature, or it's an implementation detail and will be removed in the next versions of Qt?

    1 Reply Last reply
    0
    • L Offline
      L Offline
      lgeyer
      wrote on last edited by
      #2

      It is unlikely to be changed, but if it isn't documented there is most probably no guarantee.

      But one should mention that <code>#include <...></code> and <code>#include "..."</code> behaves exactly the same, except that <code>"..."</code> looks in the current directory first, then in global directories. From the technical point of view there is no need to use the <code><...></code> notation just to include global files.

      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