When do changes to a QML file not take effect? - qt

I've had a problem happen for the second time over the last week. It seems to happen randomly. I change something in a QML file, save it, run the app, and see that my change has not taken effect. I rerun the app and it still has not taken effect.
The first time this happened to me, it got fixed by itself after I did some git stuff (in this order: git stash save, rollback to an older revision, go back to the newest revision, git stash pop). The second time I didn't do that, but ran qmake from the Qt Creator menu and that fixed it.
What could be the cause of the problem?
I'm using Qt Creator 4.1.0.

Stephan i have seen this happening and from what i have read before is a know bug, more information can be found in:
https://bugreports.qt.io/browse/QTCREATORBUG-1627
The thing is that it seems qtcreator is unable to detect a change of qlm/qrc files being changed, so the makefiles are not being updated due qmake is not being run.
seems they are not going to be solved bug, it has been already for years there, the workaround in qtcreator is to run qmake manually and after rebuild.

I just hit this problem again, this time despite diligently running qmake before every run.
I think I figured out what caused it this time. It's that I was using the small Run button (actually called "Re-run this run configuration") that resides in the "Application output" pane's toolbar. Seems like this button has the treacherous property of running without rebuilding.
The solution is to use Ctrl+R, or, equivalently, the big run button in the vertical toolbar along the left side of the window.
Another time the problem wouldn't go away until I deleted the myproject.pro.user file.

Related

qt creator unwanted disassembly

I had this very annoying problem that while debugging, suddenly it started to show the disassembled code rather than the C++ code, via google I found several with the same problem, and a suggested weird solution here which I'm not sure how to interpret. I tried things similar to that post and found a solution:
Shut down and restart QT Creator
In left-hand tab "Projects", untick then re-tick "Shadow build"
Seems like voodoo right? But I noticed that step 1 clears all breakpoints, and step 2 temporarily changes some paths after which it says "evaluating" for a second in the lower right corner. So perhaps it's not as weird as it sounds, apparently a few things are cleared during this process.
I don't think I'm supposed to write answers to my own problems here but I thought it would be a waste not to post this solution to this very annoying problem that apparently more than I have encountered. The next guy hopefully finds my post.
I cant post links to others with similar problems since I need a higher reputation then.. :-/
It probably helps if you uncheck options to break debugging on Thread creation and Thread exit if you have these options checked for the Debugger. These options will certainly pop the disassembler view up when you start debugging even if you haven't set any Breakpoints in your code. You find these options in menu Tools/Debugger/CDB. If you want to break on C++ exceptions leave that option checked, otherwise uncheck that too.

xib file save doesn't stay saved in Xcode

I made some changes to my MainWindow.xib in Xcode and every time I hit save it appears to indicate success, changing from dimmed to normal in the navigator. Seconds later it goes back to dimmed, as if it has been modified and needs to be saved again. Has anybody seen this before? What do I do to make it stay saved.
I have tried deleting the derived data and reopening the project. The changes do appear to remain as edited, the project compiles and seems to work properly. Only sign of an issue is that the file looks to need saving no matter what I do.
On further analysis I found that it seems to change to modified state whenever I select it, whether I make a change or not. I can't say if this is normal behavior but it does not seem to result in any problems for my project. If I select a different file in the navigator pane, prior to a build, the xib file is saved and stays saved. If I select the xib again after that build, it instantly goes back to modified.
This does not happen with any other xib files in my project.
I have never noticed this behavior prior to now, of course it has been ages since I altered this specific xib.
I am going to conclude that this was a bug in a former XCode build. Since latest, now 4.4, I have not seen this behavior at all.

XCode: The document: "<document name>" could not be saved. The file has been changed by another application"

Since starting to use XCode 4.2 I've more-or-less routinely had the error:
with various substitutions for the filename. This is normally when Xcode is doing an autosave, so it happens seemingly at random. I generally click "Save Anyway" and my recent edits are then preserved, although there is a significant probability that Xcode will then hang. I don't typically lose much when it hangs, other than a minute to shoot it and get it to restart, but still...
I don't open any of these files in any application except XCode. I have not been able to figure out the pattern, although it may have to do with popping back and forth between files. The last time I noticed it, I also noticed that the previous round of edits to that file hadn't taken. So some other editor had not saved the file.
Enough preamble: here's the question:
Are others running into this? Has anyone narrowed down what causes it? Is there a setting I can change to prevent it? Is there something I can change in my behaviour?
You will get this happening when
1) There are locally unsaved modifications (the navigator icon will be shaded)
2) AND something else has changed the file outside of Xcode. For me this occurs when I do an external update from svn on the command line or via Versions
What do you have that is modifying and saving the file outside of Xcode? Anything?
Check your source control (if any) and figure out if something you are doing is causing the conditions to be met.
Well I had the same problem when I was trying to Localize my files. Then I noticed that every time the message was popping up was because the icon of the selected file in the Project Navigator was grey, which means that was not saved. So what I did was to save the file (Cmd+S) before doing the action that made the "changed by another application" message to appear, in my case the Localize button.

Xcode 4 - Analyze issues won't show in editor

Running Analyze in Xcode 4.0.2 shows issues in the Issue Navigator. Clicking on an issue makes the appropriate file appear in the Editor pane, but nowhere does it show where in the code the issue occurs as I am used to from Xcode 3.x. Does anyone know how I can turn on this feature?
A couple of tips:
First, if you're looking for the view where Xcode annotates the project with arrows, bear in mind that you may need to expand the top-level analyser result in Xcode's Issue navigator and click the second-level issue in order to see those - see screenshots.
Screenshot 1: top-level issue selected - no arrows
Screenshot 2: second-level issue selected - arrows!
Second tip: if that stuff isn't working, try cleaning the project's build products folder. Hold down the Option (alt) key and choose Clean Build Folder... from the Product menu. (You need to hold down the Option key, otherwise you won't see that menu option.)
I've seen this happen before sometimes. I believe it's a bug in Xcode. Restart Xcode and try again.
One note. I'm seeing this for files that are referenced outside the current project. I currently have a library in which the files with missing annotations live and simply added them to my current project without copying them. Haven't done the project dependency setup yet, so if you're referring to files outside your project that could be why. (I opened the library project, did an analyze and the annotations showed up.)
Woohoo, I've nailed it! At least for me. I've been struggling with this problem for about 2 hours now, trying out all the things suggested here and more (Xcode 4.0.2, Snow Leopard). Bizarre thing was I had one file where the warning were correctly showing in the editor. Then I noticed the difference to all other files; in the File Inspector pane the location was specified as "Relative to Project" (warnings show correctly in the editor), all the other project files were "Relative to Group" (warnings not showing in the editor).
I took one of the problem files, switched it's location to "Relative to Project", reanalyzed and bingo! I've see it's warnings in the editor.
I guess this ties in a bit with David Goodine's answer refering to files outside the project.

Strange Error in Xcode 4 that persisted across different versions of the same file

I want to preface this question by admitting that I'm still very much a novice, to Xcode 4 and to development in general. But I find I learn the most when I've made mistakes and been able to discover ways to correct my errors.
So I was mucking about in Xcode, following an example in the book I've been studying, in this case trying to determine why the keyboard wouldn't hide when I touched outside a text field. In the process of experimentation, I tried adding an Outlet to the top level View of a View Controller, dragging into the Header file to automagically create it. I knew almost at once this wasn't what I wanted, and I deleted the reference in Interface Builder, and the code it had added to the other files.
And when I did run the program, it threw an exception. Being new to this, I didn't think to check the log files, and when I couldn't work out what the error was, I restored an earlier version of the project from Time Machine, and tried again -- same result. I restored an even earlier version and tried again -- and got the same error!
When I finally did have the good sense to look at the log file, I noticed the reference to the name of the Outlet I had added, but removed! But these were older versions of the code, before I'd even made that change.
I made a thorough search of the code, and my NIB file, looking for any reference to the deleted Outlet. I couldn't find anything.
I eventually replaced the NIB file with a version from the tutorial from the book I was following (it was identical, and easier than rebuilding it from the bottom up), and all was well, everything ran just fine. But now I'm left wondering -- what could I have done to make this error so persistent, across different versions of the file? I'm already kinda uncertain about the way Xcode 4 will automagically add code under certain circumstances (that's probably more dangerous than useful for the novice), and I wonder if this is a bug in Xcode 4, or if I inadvertently tripped over a useful feature.
Xcode loves to play tricks on you. I've several times gotten an XIB mysteriously hosed up to the point where I had to delete it and start over. No matter what I'd do to the XIB some elements wouldn't display correctly (or at all).
In a recent case I had an XIB with a label with the text "Start date:". I changed that label text to "Treatment date:", but it still kept coming out "Start date:". I opened the XIB as text and scanned for "Start date:" and it wasn't there. So I tried dragging the label off to one side. Then it displayed the correct words. Dragged the label back to the correct place -- back to "Start date:". I finally deleted the label and recreated it and then the text came out correctly.

Resources