Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Search and replace across source and ui files

Search and replace across source and ui files

Scheduled Pinned Locked Moved Qt Creator and other tools
9 Posts 5 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.
  • A Offline
    A Offline
    Asperamanca
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0
    • F Offline
      F Offline
      Franzk
      wrote on last edited by
      #2

      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.

      "Horse sense is the thing a horse has which keeps it from betting on people." -- W.C. Fields

      http://www.catb.org/~esr/faqs/smart-questions.html

      1 Reply Last reply
      0
      • A Offline
        A Offline
        Asperamanca
        wrote on last edited by
        #3

        Then I guess "Rename symbol under cursor" won't work, either.

        1 Reply Last reply
        0
        • F Offline
          F Offline
          Franzk
          wrote on last edited by
          #4

          I haven't but you can try and see what happens. Worst thing that can happen is that you have to undo it.

          "Horse sense is the thing a horse has which keeps it from betting on people." -- W.C. Fields

          http://www.catb.org/~esr/faqs/smart-questions.html

          1 Reply Last reply
          0
          • T Offline
            T Offline
            tobias.hunger
            wrote on last edited by
            #5

            Please consider "filing a bug report":http://bugreports.qt-project.org/ .

            1 Reply Last reply
            0
            • A Offline
              A Offline
              andre
              wrote on last edited by
              #6

              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...

              1 Reply Last reply
              0
              • G Offline
                G Offline
                goetz
                wrote on last edited by
                #7

                [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.

                http://www.catb.org/~esr/faqs/smart-questions.html

                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  andre
                  wrote on last edited by
                  #8

                  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!

                  1 Reply Last reply
                  0
                  • A Offline
                    A Offline
                    Asperamanca
                    wrote on last edited by
                    #9

                    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 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