QtCreator: Use clang code model for refactoring



  • In qtcreator, is there a way to use clang code model for code refactoring? For example in the following minimal example, I want to change the variable CarData::year to CarData::year1 using the qtcreator refactor so that all_car_data[0].year in the main function also changes to all_car_data[0].year1. But since, std::vector is not recognized by the internal code model of qtcreator, it cannot apply this automatic change as well.

    #include <iostream>
    #include <memory>
    #include <vector>
    
    using namespace std;
    
    struct CarData
    {
      CarData() : year(0), month(0) {}
      CarData(unsigned year_, unsigned month_)
       : year(year_), month(month_) {}
      unsigned year;
      unsigned month;
    };
    
    int main(int argc, char *argv[])
    {
      vector<CarData> all_car_data;
      all_car_data.push_back(CarData(2010, 1));
      std::cout << all_car_data[0].year;
      return 0;
    }
    

    So, does clang code model also supports refactoring?



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