QT5 Creator 'follow symbol under cursor' not referencing correct file - qt5

I have two sets of files in my project, one of them a modified version with a different name. When I select 'Follow Symbol Under Cursor', it jumps to the object definitions in the modified file set even though it's not supposed to. The folders for both files are in the same directory. Is there any way to manually set a different file reference or correct this?

Related

Folder property of File Search Launch Condition: how to specify custom folder under [TARGETDIR]?

I'm trying to set a file search launch condition for my installer. I need it to search for a specified file in a subfolder of my [TARGETDIR] folder.
I tried setting the Folder property to:
[TARGETDIR]/Subfolder
[TARGETDIR]Subfolder
[TARGETDIR]Subfolder/
[TARGETDIR]/Subfolder/
[TARGETDIR]/"Subfolder"
None of the above solutions worked. The file located in subfolder never gets found. It works if I only specify [TARGETDIR] with the Depth property set to 1, but I would rather specify directly the directory to search.
I found a similar question here, but there is no answer.
What is the correct way to set the Folder property to work with a custom folder ?
The difficulty here is that TARGETDIR is not set until later than the search is done, so it has no value yet. Even if if it did have a value, it's what is changed by the browse dialog that can change where the user installs thet app (see the property window of Application Folder in File System on Target Machine).
This means you must use standard folder properties in your search. If you want to search what you think may be where the file is installed, then use:
[ProgramFilesFolder]SomeFolder\SomeOtherFolder
or something similar if your assumed value of TARGETDIR is in Program Files x86.

Ignore a folder in search results

I'm searching for a string and getting matches in a source folder, and a build folder (file in source gets copied to build during build).
I do not need the build folder result.
Vim has wildignore which helps filter out results.
Is there something similar in intelij?
Mark your build folder as excluded:
File > Project Structure > Modules > Sources > Mark as Excluded (red icon)
You can also just right click on your folder and select Mark Directory As > Excluded.
Excluded folders (shown as rootExcluded) are ones that IntelliJ IDEA "partially ignores". Very limited coding assistance is provided for files in excluded folders. Classes contained in excluded folders don't appear in code completion suggestion lists, references to such classes are shown in the editor as unresolved. When searching, IntelliJ IDEA doesn't look in excluded folders, etc.
Source
Note: See the answer by Nader Hadji Ghanbari for another approach using Scopes.
Short Answer
By defining a Scope when searching, you can include/exclude arbitrary files/folders from that scope.
Detailed Answer
One way to achieve your requirement (excluding files and folders from a search) is to define a custom scope. This is specifically useful because sometimes you just want to exclude a folder from your search and not from the whole project.
Follow these steps:
Edit -> Find -> Find in path or press Ctrl+Shift+F.
Choose Custom in the Scope section and then choose <unknown scope>
Now click on the + button to add a new local custom scope
Give the scope a name and save it.
Now you can include and exclude directories from this scope. You can first add everything by choosing the include recursively and then exclude one by one by choosing exclude or exclude recursively.
Note that you can even include or exclude libraries your project is dependent on.
When searching you can choose the effective scope by in Scope section in Find in Path dialog.
More info
You can check the JetBrains docs on Scopes for more info. Scopes can be used not only when searching but also in a bunch of other use cases in IntelliJ IDEA.
Patterns
You can use Patterns to define a scope which makes them even more powerful and future proof.
using patterns is another way to exclude files and folders. For instance
file:src/main/java//*&&!file:src/main/java/my//* will exclude all files in my folder.
In Intellij 15, to exclude a folder just do this:
in the Project window, select the folder then right click and choose "Mark Directory As" > "Excluded"
IntelliJ IDEA 2021.3.3 (Ultimate Edition)
In my case, all the generated files in .tox and _build kept showing up in my Find results. It may be a blunt instrument but I added these two folder types to the Preferences -> Editor -> File Types -> Ignored Files and Folders: .tox, _build. For whatever reason, adding _build will not be accepted as part of the ignored set.
Caveat, you will not see these files and folders in your Project navigator. However, it’s a small price to pay for not having them show up consistently in my search results.
A number of answers work well for older versions of IntelliJ, but in 2020.2, and possibly other recent versions, I keep seeing excluded folders in my search results. In my case: node_modules.
I found something that does work, though. For javascript projects, at least. There might be something similar available for other languages.
First, of course, exclude the directory from your project.
Hopefully this works, but if it doesn't, and you're using Javascript, continue:
Go to Settings -> Languages & Frameworks -> Javascript -> Libraries
There, uncheck all the directories you don't want included in your search.
Whether this is a good idea remains to be seen; IntelliJ doesn't merely exclude them from your search, but from all its code parsing, which means it might not recognise imports from that directory either. For me it seems to work fine at the moment, but I give no guarantees. Try it, but remember how to revert this.
It's an ugly work around. IntelliJ clearly needs a better way to exclude directories from searches.
As some have mentioned, simply setting a folder to 'Excluded' doesn't work in many versions. A combination of the following does for me:
Set the offending folder to 'Excluded' as suggested.
Use the pre-defined Scope 'Project Files'
Profit
Excluding files and folders from projects
Article last modified: 08 June 2020
Mark a file as plain text
In the Project tool window, select the desired file.
From the context menu of the selection, choose Mark as plain text:
Exclude files and folders by name patterns
In the Settings/Preferences dialog Ctrl+Alt+S, click Directories .
In the Exclude files field, type the masks that define the names of files and folders to be excluded, for example, *.min.js or lib. Use semicolons as separators.
If the name of a file matches any of these patterns, the file is treated as excluded.
If the name of a folder matches a pattern, all the files in this folder and in its subfolders are excluded.
Source: https://www.jetbrains.com/help/phpstorm/excluding-files-from-project.html
This one the only thing that works for me on IntelliJ 2022.3.1, even when marking directory as excluded didn't work (it only change the icon as red, but still shows up).
File > Preferences > Editor > Ignored Files and Folders
I can ignore the generated bla.html with this.
If you are searching for usages, open the "Find Usages Settings..." , by default Ctrl+Alt+Shift+F7, to narrow down the scope from "All files" to "Project files".

Two output file names resolved to the same output after changing form icon?

So I know the usual fix for this error is to delete the extra .resx file that was created when you renamed a form or something else on your application.. But I haven't created/renamed any forms, and I don't see any obvious double .resx files.. This all happened after choosing an.ico file for the icon, that's it.
EDIT:
Well I had 2 .resx files that maybe have been about the same form fDesigner.resx and fMain.resx, the last one which was created an hour ago, I deleted it, but I'm STILL getting the same error, isn't there a file that references the .resx files?
Oh well I found it, might as well answer it myself as well.. There should be a .vbproj file on your application directory, for VB.NET, I'm sure other languages have it different. But you have to edit this, whether you deleted your extra .resx or not:
<EmbeddedResource Include="yourMmainForm.resx">
<DependentUpon>yourMainForm.vb</DependentUpon>
</EmbeddedResource>
In my case Designer.resx was already dependent upon my Main form so even after I deleted the file the duplicate was still there, ok now it's fixed.

Embedding an image as a resource in a FireBreath plugin

While using VS (2010), I used to be able to add an image as a resource simply by going to the Resource view and then: Right click project > Add > Resource > Import.
I even asked a question about how to then load it: Loading an image from a resource embedded in a dll, but that changed for some reason.
Now when I try the same thing and save the .rc file, I get this message:
"The resource script FILE_PATH.rc was not created using Microsoft
Visual Studio. Comments, macros, preprocessor directives, and
conditionally included information may be modified and/or removed from
this file during the build process. Replace existing file?"
Even if I click "yes" (in order to just test things) then I get all kind of error messages at compile time:
ResourceCompile:
gen\firebreathWin.rc(8): error RC2144: PRIMARY
LANGUAGE ID not a number
gen\firebreathWin.rc(16): error RC2135: file not found VS_VERSION_INFO
etc...
I have two questions:
What is the correct way to add an image resource which will be added to the compiled plugin using CMake? I searched about it and couldn't find any helping information.
What can be the cause for this change in behavior? since I was able to use the same exact steps before and it worked.
Thanks.
First of all, I wouldn't do this; instead, I'd just put the file in the same directory as your DLL and use the path of DLL to find it.
That said, the "correct" way to do this would be to see what changes are made to the .rc file when you add it in the IDE, copy the .rc file from gen_templates/ in the root of the firebreath directory into your project, and then make those changes to your copy of the file. Any changes you make to the generated file will be overridden any time cmake is run again, which can happen any time your cmake files (CMakeLists.txt, *.cmake) change.

How to stop huge Prefix.pch.gch file from being copied into application bundle

For some reason, XCode has decided to start copying a huge Prefix.pch.gch file into my application's resources folder when building. This file is not in the Copy Bundle Resources build phase, nor can I find any other project setting that should tell XCode to do this. Has anyone seen this before and know what's going on?
I had a problem with the same symptoms today, it turned out that it was due to one of my objective C files being included in the Copy Bundle Resources files phase of the target (either due to a drag and drop accident, or the xcodeproj file getting corrupted at some point). GCC was then helpfully including the precompiled headers for the prefix header in the target as there is a dependency from the source file.
Doing a Get Info on the source file in question didn't show all the tabs on the file info dialog, even though the file type was set to sourcecode.c.objc.
Removing the file from the project and re-adding it cured the problem.
You could try doing "Show Package Contents" on your xcode project file in the finder, then opening the project.pbxproj file in a text editor (not xcode).
If you search for ".pch" and/or ".gch", you might spot something.
Are there any Copy Files phases?
Is the Prefix.pch.gch file in your project's group tree? The easiest way to check this would be to select the project object, then search for “gch” in the Detail view.
I solved this problem in a different way. Firstly I like to make use of the prefix file so I have lots of includes for standard logging, colours etc.
For every include to the prefix file ensure that each include is only processed once! This can be done by putting:
#ifndef __<Classname>__
#define __<Classname>__
< your original header file here >
#endif
If you select the "Project" item of the "Project menu and then the "Detail" tab view and then select the project in the "Groups & Files" list on the left is the files listed on the right view have a checkbox? and is that checkbox checked? if so then un-check it.