Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Exclude build directory from locator results
Forum Updated to NodeBB v4.3 + New Features

Exclude build directory from locator results

Scheduled Pinned Locked Moved Unsolved General and Desktop
11 Posts 4 Posters 3.2k 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.
  • H Offline
    H Offline
    hegemon
    wrote on last edited by
    #1

    Hello,
    I am using Qt Creator 4.6.0 to compile CMake project. The build directory keeps appearing in my searches and makes it very annoying.

    How to exclude build directory from:

    1. Method locator results (Ctrl+K , m )
    2. Usages results (Ctrl+Shift+U)
    3. Go to definition results (F2)

    Thank you in advance.

    1 Reply Last reply
    0
    • P Offline
      P Offline
      plonq
      wrote on last edited by
      #2

      I solved this by going to Options > Environment > Locater, and unchecking "All Included C/C++ Files".
      All source files are still searchable with the "Files in any project" filter, so make sure that's on by default.

      H 1 Reply Last reply
      1
      • P plonq

        I solved this by going to Options > Environment > Locater, and unchecking "All Included C/C++ Files".
        All source files are still searchable with the "Files in any project" filter, so make sure that's on by default.

        H Offline
        H Offline
        hegemon
        wrote on last edited by
        #3

        @plonq
        Thank you for your help.
        In combination with custom "Generic Directory Filter" included by default I've managed to filter out the build directory. This solved problem with file locator (Ctrl+K)
        But still the method locator jumps and searches files that are in build the directory. (F2, Ctrl-k,m and Ctrl+Shift+U)

        aha_1980A 1 Reply Last reply
        0
        • H hegemon

          @plonq
          Thank you for your help.
          In combination with custom "Generic Directory Filter" included by default I've managed to filter out the build directory. This solved problem with file locator (Ctrl+K)
          But still the method locator jumps and searches files that are in build the directory. (F2, Ctrl-k,m and Ctrl+Shift+U)

          aha_1980A Offline
          aha_1980A Offline
          aha_1980
          Lifetime Qt Champion
          wrote on last edited by aha_1980
          #4

          @hegemon there's no way to change this by any configuration.

          as these methods are in generated files and needed for compilation, I don't see why they should not appear in this list. you can't edit them, but they are still needed for the build.

          Qt has to stay free or it will die.

          H 1 Reply Last reply
          1
          • aha_1980A aha_1980

            @hegemon there's no way to change this by any configuration.

            as these methods are in generated files and needed for compilation, I don't see why they should not appear in this list. you can't edit them, but they are still needed for the build.

            H Offline
            H Offline
            hegemon
            wrote on last edited by
            #5

            @aha_1980
            Specifically I have custom files (*.q) with embedded SQL queries and custom precompiler that converts them to *.c files.
            Those C files are byproduct of our compilation process that programmer don't need to see and they are stored in build directory. When I press F2 it jumps to C file in the build directory instead of Q file that I need to edit.
            Is there any way to request a feature of filter in the locator. Even same option like in Generic Directory Filer

            0_1530701135718_gdf.JPG 0_1530701244015_m.JPG

            jsulmJ 1 Reply Last reply
            0
            • H hegemon

              @aha_1980
              Specifically I have custom files (*.q) with embedded SQL queries and custom precompiler that converts them to *.c files.
              Those C files are byproduct of our compilation process that programmer don't need to see and they are stored in build directory. When I press F2 it jumps to C file in the build directory instead of Q file that I need to edit.
              Is there any way to request a feature of filter in the locator. Even same option like in Generic Directory Filer

              0_1530701135718_gdf.JPG 0_1530701244015_m.JPG

              jsulmJ Offline
              jsulmJ Offline
              jsulm
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @hegemon said in Exclude build directory from locator results:

              that programmer don't need to see and they are stored in build directory

              Personally I like the possibility to see the content (or go to variable/function definition/...) of autogenerated files - because you often need to know what was generated to understand how it works or what enum values are available, or ...
              So, I don't see a need to exclude anything.

              https://forum.qt.io/topic/113070/qt-code-of-conduct

              H 1 Reply Last reply
              0
              • jsulmJ jsulm

                @hegemon said in Exclude build directory from locator results:

                that programmer don't need to see and they are stored in build directory

                Personally I like the possibility to see the content (or go to variable/function definition/...) of autogenerated files - because you often need to know what was generated to understand how it works or what enum values are available, or ...
                So, I don't see a need to exclude anything.

                H Offline
                H Offline
                hegemon
                wrote on last edited by
                #7

                @jsulm This is nice to see once in a while the output of precompiler for see what is done there, but in 99% of the cases the accidential jumps to those files are very annoying.
                Because if you don't pay attention to what kind of file you jumped, you write code and in best case you see that it is a wrong file but in the worst case you compile and all your new shiny code just disapear.

                aha_1980A 1 Reply Last reply
                0
                • H hegemon

                  @jsulm This is nice to see once in a while the output of precompiler for see what is done there, but in 99% of the cases the accidential jumps to those files are very annoying.
                  Because if you don't pay attention to what kind of file you jumped, you write code and in best case you see that it is a wrong file but in the worst case you compile and all your new shiny code just disapear.

                  aha_1980A Offline
                  aha_1980A Offline
                  aha_1980
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  Hi @hegemon

                  I don't think this will work out of the box.

                  E.g. the Qt designer files *.ui are also invisible for the code model - understandable because they are no code. Instead, the generated ui_*.h file is visible there and this one is what the compiler sees.

                  If I understand you correctly, you have a simular setup and want to jump into the source *.q file.

                  Now my questions:

                  • is this source file directly compileable?
                  • is this source file included as source in Creators project files list?

                  regards

                  Qt has to stay free or it will die.

                  H 1 Reply Last reply
                  1
                  • aha_1980A aha_1980

                    Hi @hegemon

                    I don't think this will work out of the box.

                    E.g. the Qt designer files *.ui are also invisible for the code model - understandable because they are no code. Instead, the generated ui_*.h file is visible there and this one is what the compiler sees.

                    If I understand you correctly, you have a simular setup and want to jump into the source *.q file.

                    Now my questions:

                    • is this source file directly compileable?
                    • is this source file included as source in Creators project files list?

                    regards

                    H Offline
                    H Offline
                    hegemon
                    wrote on last edited by
                    #9

                    @aha_1980

                    If I understand you correctly, you have a simular setup and want to jump into the source *.q file.

                    Yes I want to jump directly to the *.q file. And it looks like *.ui file problem you've described.

                    is this source file directly compileable?

                    Q files can't be compiled directly by the C compiler.
                    They have embedded sql with custom syntax and custom precompiler converts SQL to function calls in C file.
                    For example:

                    file.q:

                    int par;
                    EXEC SQL SELECT COL1 INTO :par FROM TABLE;
                    

                    converted into file_q.c:

                    int par;
                    run_sql_code_natively("SELECT COL1 INTO :par FROM TABLE;", &par);
                    

                    is this source file included as source in Creators project files list?

                    Yes the *.q files are included in project files list so we can work on them directly from project.
                    They are searchable and sometimes even F2 jumps right into it. But in 50% - 60% of the F2 jumps hits *.c file instead.
                    Also usages shows both files.

                    aha_1980A 1 Reply Last reply
                    0
                    • H hegemon

                      @aha_1980

                      If I understand you correctly, you have a simular setup and want to jump into the source *.q file.

                      Yes I want to jump directly to the *.q file. And it looks like *.ui file problem you've described.

                      is this source file directly compileable?

                      Q files can't be compiled directly by the C compiler.
                      They have embedded sql with custom syntax and custom precompiler converts SQL to function calls in C file.
                      For example:

                      file.q:

                      int par;
                      EXEC SQL SELECT COL1 INTO :par FROM TABLE;
                      

                      converted into file_q.c:

                      int par;
                      run_sql_code_natively("SELECT COL1 INTO :par FROM TABLE;", &par);
                      

                      is this source file included as source in Creators project files list?

                      Yes the *.q files are included in project files list so we can work on them directly from project.
                      They are searchable and sometimes even F2 jumps right into it. But in 50% - 60% of the F2 jumps hits *.c file instead.
                      Also usages shows both files.

                      aha_1980A Offline
                      aha_1980A Offline
                      aha_1980
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      hi @hegemon,

                      last question: how are your .q files included in the .pro file? are they in the SOURCES section?

                      I think your question can be better answered at the QtCreator mailing list which is monitored by the developers. It is a good one anyway :)

                      regards

                      Qt has to stay free or it will die.

                      H 1 Reply Last reply
                      0
                      • aha_1980A aha_1980

                        hi @hegemon,

                        last question: how are your .q files included in the .pro file? are they in the SOURCES section?

                        I think your question can be better answered at the QtCreator mailing list which is monitored by the developers. It is a good one anyway :)

                        regards

                        H Offline
                        H Offline
                        hegemon
                        wrote on last edited by
                        #11

                        @aha_1980 said in Exclude build directory from locator results:

                        file? are they in the SOURCES section?

                        I don't have *.pro file it's a CMake project.

                        For example:

                        # mylib.dll
                        set(mylibQfiles ${CMAKE_CURRENT_SOURCE_DIR}/mycfile.q)
                        preprocess_q(mylibQfilesO ${mylibQfiles})
                        add_library(mylib SHARED ${mylibQfiles} ${mylibQfilesO})
                        

                        the preprocess_q definition is like this:

                        function(preprocess_q out_var)
                           set(result)
                           foreach(in_f ${ARGN})
                                get_filename_component(out_f ${in_f} NAME)
                                set(out_f "${CMAKE_CURRENT_BINARY_DIR}/${out_f}")
                                add_custom_command(OUTPUT ${out_f}_.c
                                    DEPENDS ${in_f}
                                    COMMAND ${CMAKE_SOURCE_DIR}/sqlbin/qc.exe "" -out ${out_f}_.c ${in_f}
                                    #      WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
                                    COMMENT "Creating preprocessed qc file ${in_f}"
                                    VERBATIM
                                    )
                                list(APPEND result ${out_f}_.c)
                           endforeach()
                           set(${out_var} "${result}" PARENT_SCOPE)
                        endfunction()
                        
                        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