Search and replace across source and ui files
-
wrote on 5 Mar 2012, 11:31 last edited by
I noticed some widgets in a ui file are not named correctly, and wanted to correct that. Since the current names are already used in source files, the safest way seemed to be the Advanced Search & Replace feature of Qt Creator (2.4.1)
However, it seems that while the .ui file is displayed in the list of search results, the replace does not affect the ui file.
How can I make the Search & Replace affect the ui file also?
-
wrote on 5 Mar 2012, 15:25 last edited by
The ui file is officially only editable through the designer. If you want to change strings in those as well, you'll have to either rename the files for this purpose, or do the replace using sed or awk or any other program that doesn't care about the actual contents of the file.
-
wrote on 5 Mar 2012, 16:05 last edited by
Then I guess "Rename symbol under cursor" won't work, either.
-
wrote on 5 Mar 2012, 16:10 last edited by
I haven't but you can try and see what happens. Worst thing that can happen is that you have to undo it.
-
wrote on 6 Mar 2012, 09:33 last edited by
Please consider "filing a bug report":http://bugreports.qt-project.org/ .
-
wrote on 6 Mar 2012, 09:40 last edited by
Sometimes it is annoying that the files are only editable through designer, as some things are easier to do directly in the file. And of course because Designer creates files that cause warnings by uic during compilation...
-
wrote on 6 Mar 2012, 11:42 last edited by
[quote author="Andre" date="1331026838"]Sometimes it is annoying that the files are only editable through designer, as some things are easier to do directly in the file. And of course because Designer creates files that cause warnings by uic during compilation...[/quote]
Just right-click on the ui file in the project tree and select "Open with..." and then "Plain Text Editor".
PS:
If you double click on a .ui file it opens in designer mode by default. If you don't close it with ctrl-w, but just hit ESC, you're in a plain text editor with the XML too. -
wrote on 6 Mar 2012, 12:44 last edited by
The editor you get when pressing ESC is read-only for me, but the right-click approach gives me an editable XML representation. It does not work for already open files in the open files list, but it works for the project tree. Thanks for the tip!
-
wrote on 6 Mar 2012, 12:49 last edited by
Posted a bug report:
https://bugreports.qt-project.org/browse/QTCREATORBUG-7044
PS:
bq. If you double click on a .ui file it opens in designer mode by default. If you don’t close it with ctrl-w, but just hit ESC, you’re in a plain text editor with the XML too.
Not an editor. Just a viewer. I can't change anything there.
1/9