QtCreator Substitute macro call



  • Hello everyone,

    I just wonder if QtCreator has something like replacing macro automatically with code or any extension out there?

    Say we have the following macro:
    #define LOG(x) std::cout << x << std::endl

    I use an extension in Visual Studio to basically take a code like this for example:
    LOG("Very cool string");

    And then I would click on that macro and ask to "Substitute macro call" and it will generate the code for me automatically like this:
    std::cout << "Very cool string" << std::endl;

    I could also take for example code like this:
    auto myMap = std::map<int, int>();

    And right click on the auto keyword and say "Replace 'auto' with explicit type declaration" and it would do automatically this code:
    std::map<int, int> myMap = std::map<int, int>();

    I'm trying to kind of getting used to QtCreator instead of using Visual Studio, so if there is a way doing this in QtCreator, I would be extremely happy to hear!
    Thanks in advance!


  • Lifetime Qt Champion

    Hi
    I have not seen such features in Creator sadly.
    The auto replacement seems pretty cool!



  • @mrjj said in QtCreator Substitute macro call:

    Hi
    I have not seen such features in Creator sadly.
    The auto replacement seems pretty cool!

    Thanks for the reply!
    To be honest, this is one of the most useful features I very often use in Visual Studio. Especially when it comes to very complex macro calls, it gives you the ability to see if your macro does what it needs and to see how it generated the code from that.
    I wish this concept will reach into the Qt-Team in mind and will be implemented in the next QtCreator release.


  • Lifetime Qt Champion

    @Gilad-Reich
    Hi
    yes it seems ultra nice feature.
    You could go to
    https://bugreports.qt.io/
    and add a feature request. and post link here.
    People can vote on it then.



  • So we have a new ticket! :) Please vote for this so it gets attention:
    https://bugreports.qt.io/browse/QTCREATORBUG-20932


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.