Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Call for Presentations - Qt World Summit

    Search and replace across source and ui files

    Tools
    5
    9
    2783
    Loading More Posts
    • 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
      Asperamanca 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?

      1 Reply Last reply Reply Quote 0
      • F
        Franzk 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.

        "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 Reply Quote 0
        • A
          Asperamanca last edited by

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

          1 Reply Last reply Reply Quote 0
          • F
            Franzk 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.

            "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 Reply Quote 0
            • T
              tobias.hunger last edited by

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

              1 Reply Last reply Reply Quote 0
              • A
                andre 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...

                1 Reply Last reply Reply Quote 0
                • G
                  goetz 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.

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

                  1 Reply Last reply Reply Quote 0
                  • A
                    andre 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!

                    1 Reply Last reply Reply Quote 0
                    • A
                      Asperamanca 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 Reply Last reply Reply Quote 0
                      • First post
                        Last post