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. Issue on add cpp definition from header
Forum Updated to NodeBB v4.3 + New Features

Issue on add cpp definition from header

Scheduled Pinned Locked Moved Qt Creator and other tools
3 Posts 2 Posters 976 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.
  • F Offline
    F Offline
    firebird
    wrote on last edited by
    #1

    I have a case where refactoring and the helper to create the cpp definition from the header is wrong.
    Here a case :

    @ template <typename T>
    struct EvtType {

    //! Result type.
    typedef T const & R;
    };@

    @void foo(EvtType<int>::R var);@

    When I want to create the definition or use the refactoring helper, I’ve :

    @void foo(EvtType::R var)
    {

    }
    @

    in my cpp file. It miss the template paramater.

    Another point concerning the helper to create the cpp definition,
    I really want a keyboard shortcut for that ;)

    Thanks for this nice IDE,
    Firebird

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

      Hi and welcome to devnet,

      template functions must have their body in the same file as their declaration. So you have to keep it in the header

      What shortcut do you mean ? Depending on it you can fill a feature request "here":http://bugreports.qt-project.org but check first if somebody already did

      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
      • F Offline
        F Offline
        firebird
        wrote on last edited by
        #3

        Hi SGaist, and thank-you.

        In my case its a template struct, not a function. And I relate an issue of qt creator code assistance.

        For the shortcut I request, it is for the action on the contextual menu of the text editor, "Refactor" -> "Add definition to xxxx.cpp".

        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