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. Qt Creator Search and Replace
QtWS25 Last Chance

Qt Creator Search and Replace

Scheduled Pinned Locked Moved Solved Qt Creator and other tools
21 Posts 5 Posters 2.7k 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.
  • Patrick FrombergP Offline
    Patrick FrombergP Offline
    Patrick Fromberg
    wrote on last edited by
    #1

    Dont get me wrong, I am very fond of Qt Creator. But advanced search and replace is just broken beyond repair hence filing bug reports makes no sense.

    Another reason for not filing bug reports for this is that each time I use this dialogue, I have a different issue. Today it is limiting the scope to "selected text" which barely worked before, which is bad enough, but today there is no way to do it (currently on QtCreator 4.11.0).

    The documentation for this feature is also broken in the sense that it looks more like a workarround than a howto (the help says something alog the lines: "first select the text and then hope the scope will be limited to that regardless the scope set in the dialog box"). Furthermore I cannot get the help via F1 ( error message: "is blocked, request to server have been blocked by an extension. Try disabling your extension. ERROR_BLOCKED_BY_CLIENT")

    By the way, even today, without restarting qtcreator, I had different behaviours. Sometimes the visual representation of the selection changes to some serach-and-replace selection and sometimes not.

    I always get the message "this cannot be undone" but this message is only randomly true. If the search scope is limited to a file, I can undo regardless.

    And so it goes on and on and on. I have no problems using find and replace in Notepad++, vim or Visual Studio hence I do not believe the problem is with me.

    I am just wondering, have people just totally given up on this feature or am I the only one who believes this needs a complete rewrite? Usually I just use sed-command instead but this does not know about selected text of course.

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      I don't have any issues with search and replace in Qt Creator. "Find usages" (which I often combine with search and replace) has recently got worse. But the replace part works fine.

      I know it's not a very constructive feedback :D Just wanted to chime in an mention that it's not bad for everybody.

      Btw. "Try disabling your extension" have you tried disabling some extensions? Do you use any non-standard ones?

      (Z(:^

      1 Reply Last reply
      2
      • Patrick FrombergP Offline
        Patrick FrombergP Offline
        Patrick Fromberg
        wrote on last edited by
        #3

        I am using > 30 extensions and I do not know which ones are standard and which ones not.

        I do not have find usages. I have find references.
        find usages is Visual Studio as far as I remember.

        But this is interesting. I did not know I can do Find References and then proceed to replace. Do you mean Refactor -> Rename Symbol under cursor? If you mean that, this does not work because I do not have the patched clang version hence some clang plugins do not work.

        So, how do you replace in selection? Previously I just selected and then proceeded to Ctrl+Shift+F and it would do its thing. But today it replaces everything inside and outside the selection.

        JonBJ 2 Replies Last reply
        0
        • Patrick FrombergP Patrick Fromberg

          I am using > 30 extensions and I do not know which ones are standard and which ones not.

          I do not have find usages. I have find references.
          find usages is Visual Studio as far as I remember.

          But this is interesting. I did not know I can do Find References and then proceed to replace. Do you mean Refactor -> Rename Symbol under cursor? If you mean that, this does not work because I do not have the patched clang version hence some clang plugins do not work.

          So, how do you replace in selection? Previously I just selected and then proceeded to Ctrl+Shift+F and it would do its thing. But today it replaces everything inside and outside the selection.

          JonBJ Online
          JonBJ Online
          JonB
          wrote on last edited by JonB
          #4

          @Patrick-Fromberg
          I don't use Qt Creator, so please don't shout if I'm talking rubbish!

          But I thought Creator, like other IDEs, uses Ctrl+Shift+F for "find in all files", and doesn't do selection only? Isn't it Ctrl+F for "find in (current) file" (or Ctrl+H for "replace in current file") , and that would then work with a selection there?

          1 Reply Last reply
          0
          • Patrick FrombergP Offline
            Patrick FrombergP Offline
            Patrick Fromberg
            wrote on last edited by
            #5

            @JonB, you are not correct, and this is a further concern I have with QtCreator's way of doing search and replace. The UI of this feature does everything differently than everyone else. Ctrl+Shift+F opens the "advanced search" and there you can choose the scope (except scope=selection).

            JonBJ 1 Reply Last reply
            0
            • Patrick FrombergP Patrick Fromberg

              @JonB, you are not correct, and this is a further concern I have with QtCreator's way of doing search and replace. The UI of this feature does everything differently than everyone else. Ctrl+Shift+F opens the "advanced search" and there you can choose the scope (except scope=selection).

              JonBJ Online
              JonBJ Online
              JonB
              wrote on last edited by JonB
              #6

              @Patrick-Fromberg
              OK, I have gone and had a look. Are you perchance falling foul of https://forum.qt.io/topic/33369/solved-search-and-replace-within-selection. Are you aware that it seems you must select at least one "newline" in your selection before replace in selection seems to work?? If I select multiple lines replace works in selection scope, if I have only one line selected (and not its terminating newline) then the Replace All does the whole file. ?

              When it is going to work in selection only you get to see the selected section outlined with a box, and that's where Replace All does its stuff.

              1 Reply Last reply
              0
              • Patrick FrombergP Offline
                Patrick FrombergP Offline
                Patrick Fromberg
                wrote on last edited by
                #7

                @JonB , no this is not my problem but further proof that search&replace is cursed in creator.

                1 Reply Last reply
                0
                • Patrick FrombergP Offline
                  Patrick FrombergP Offline
                  Patrick Fromberg
                  wrote on last edited by
                  #8

                  Unexpectedly nobody has a problem. So one very simple last question.
                  Shift+Ctrl+F3 works for me but Ctrl+F3 "Find next selected" never did. I work with Linux/KDE. Both shortcuts are not configured in KDE and both work in other applications. Can anyone reproduce?

                  aha_1980A 1 Reply Last reply
                  0
                  • Patrick FrombergP Patrick Fromberg

                    Unexpectedly nobody has a problem. So one very simple last question.
                    Shift+Ctrl+F3 works for me but Ctrl+F3 "Find next selected" never did. I work with Linux/KDE. Both shortcuts are not configured in KDE and both work in other applications. Can anyone reproduce?

                    aha_1980A Offline
                    aha_1980A Offline
                    aha_1980
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    @Patrick-Fromberg

                    Shift+Ctrl+F3 works for me but Ctrl+F3 "Find next selected" never did.

                    Both work for me (Windows+Ubuntu/Unity).

                    Regards

                    Qt has to stay free or it will die.

                    1 Reply Last reply
                    0
                    • Patrick FrombergP Patrick Fromberg

                      I am using > 30 extensions and I do not know which ones are standard and which ones not.

                      I do not have find usages. I have find references.
                      find usages is Visual Studio as far as I remember.

                      But this is interesting. I did not know I can do Find References and then proceed to replace. Do you mean Refactor -> Rename Symbol under cursor? If you mean that, this does not work because I do not have the patched clang version hence some clang plugins do not work.

                      So, how do you replace in selection? Previously I just selected and then proceeded to Ctrl+Shift+F and it would do its thing. But today it replaces everything inside and outside the selection.

                      JonBJ Online
                      JonBJ Online
                      JonB
                      wrote on last edited by
                      #10

                      @Patrick-Fromberg said in Qt Creator Search and Replace:

                      I am using > 30 extensions and I do not know which ones are standard and which ones not.

                      The obvious thought is: is there a simple way to try disabling all these extensions in one go, and see if it makes any difference to your issues?

                      1 Reply Last reply
                      2
                      • Patrick FrombergP Offline
                        Patrick FrombergP Offline
                        Patrick Fromberg
                        wrote on last edited by
                        #11

                        @JonB , good point. Do you know by any chance where they are stored so I can restore my previous state?

                        JonBJ 1 Reply Last reply
                        0
                        • Patrick FrombergP Patrick Fromberg

                          @JonB , good point. Do you know by any chance where they are stored so I can restore my previous state?

                          JonBJ Online
                          JonBJ Online
                          JonB
                          wrote on last edited by JonB
                          #12

                          @Patrick-Fromberg
                          Unfortunately not, because as I said I don't really use QtCreator, and if I do I don't have any plugins! However a quick Google gives, say, https://doc.qt.io/qtcreator/creator-faq.html

                          You can disable the Qt Creator plugins, at the expense of losing functionality:

                          Launch Qt Creator from command line, with the -noload QmlProfiler -noload QuickDesigner arguments.

                          Disable the plugins permanently by selecting Help > About Plugins.

                          or https://doc.qt.io/qtcreator/creator-cli.html, ah ha there I see:

                          -noload all Disables all plugins.

                          ? So you don't have to move them, you can just run up a session without loading any?

                          1 Reply Last reply
                          2
                          • Patrick FrombergP Offline
                            Patrick FrombergP Offline
                            Patrick Fromberg
                            wrote on last edited by
                            #13

                            @JonB , thanks, I did not know qtcreator -noload all -load Core -load CppEditor . Unfortunately it did not solve the problem but it was worth a try.

                            But I believe I know a bit more now about the Help problem. "Blocked by extension" probably refers not to a QtCreator extension but to a browser extension hence not really anything to do with QtCreator.

                            1 Reply Last reply
                            0
                            • Patrick FrombergP Offline
                              Patrick FrombergP Offline
                              Patrick Fromberg
                              wrote on last edited by
                              #14

                              @aha_1980 , are you using KDE or something else?

                              aha_1980A 1 Reply Last reply
                              0
                              • Patrick FrombergP Patrick Fromberg

                                @aha_1980 , are you using KDE or something else?

                                aha_1980A Offline
                                aha_1980A Offline
                                aha_1980
                                Lifetime Qt Champion
                                wrote on last edited by
                                #15

                                Hi @Patrick-Fromberg,

                                As I wrote, Ubuntu Unity.

                                Regards

                                Qt has to stay free or it will die.

                                1 Reply Last reply
                                0
                                • Patrick FrombergP Offline
                                  Patrick FrombergP Offline
                                  Patrick Fromberg
                                  wrote on last edited by
                                  #16

                                  Ok, QtCreator passes Ctrl+F3 to KDE for desktop selection while other applications capture that shortcut for themselves (Kate for e.g.). When I disable the shortcut in KDE, then it works in QtCreator

                                  Regarding Search&Replace with selection scope, it is sadly not supported for Advanced Search. I probably remembered wrongly that it once worked. This is really strange because search and replace in a selection is a really common task.

                                  aha_1980A 1 Reply Last reply
                                  0
                                  • Patrick FrombergP Patrick Fromberg

                                    Ok, QtCreator passes Ctrl+F3 to KDE for desktop selection while other applications capture that shortcut for themselves (Kate for e.g.). When I disable the shortcut in KDE, then it works in QtCreator

                                    Regarding Search&Replace with selection scope, it is sadly not supported for Advanced Search. I probably remembered wrongly that it once worked. This is really strange because search and replace in a selection is a really common task.

                                    aha_1980A Offline
                                    aha_1980A Offline
                                    aha_1980
                                    Lifetime Qt Champion
                                    wrote on last edited by
                                    #17

                                    Hi @Patrick-Fromberg,

                                    Regarding Search&Replace with selection scope, it is sadly not supported for Advanced Search. I probably remembered wrongly that it once worked. This is really strange because search and replace in a selection is a really common task.

                                    I'm not sure why you need the advaced find for that if it works with normal search&replace? Symmetry?

                                    Otherwise, creating a suggestion for that is easy to do ;) - please post a link here if you do so.

                                    Regards

                                    Qt has to stay free or it will die.

                                    Patrick FrombergP 1 Reply Last reply
                                    0
                                    • aha_1980A aha_1980

                                      Hi @Patrick-Fromberg,

                                      Regarding Search&Replace with selection scope, it is sadly not supported for Advanced Search. I probably remembered wrongly that it once worked. This is really strange because search and replace in a selection is a really common task.

                                      I'm not sure why you need the advaced find for that if it works with normal search&replace? Symmetry?

                                      Otherwise, creating a suggestion for that is easy to do ;) - please post a link here if you do so.

                                      Regards

                                      Patrick FrombergP Offline
                                      Patrick FrombergP Offline
                                      Patrick Fromberg
                                      wrote on last edited by
                                      #18

                                      @aha_1980 No, normal search&replace does not work with regular expressions. But I can actually do search and replace with regex limited to selection scope if I use FakeVim.

                                      aha_1980A 1 Reply Last reply
                                      0
                                      • Patrick FrombergP Patrick Fromberg

                                        @aha_1980 No, normal search&replace does not work with regular expressions. But I can actually do search and replace with regex limited to selection scope if I use FakeVim.

                                        aha_1980A Offline
                                        aha_1980A Offline
                                        aha_1980
                                        Lifetime Qt Champion
                                        wrote on last edited by
                                        #19

                                        @Patrick-Fromberg

                                        No, normal search&replace does not work with regular expressions.

                                        It does. Hint: the small icon in the left corner of the search text.

                                        Regards

                                        Qt has to stay free or it will die.

                                        Patrick FrombergP 1 Reply Last reply
                                        5
                                        • aha_1980A aha_1980

                                          @Patrick-Fromberg

                                          No, normal search&replace does not work with regular expressions.

                                          It does. Hint: the small icon in the left corner of the search text.

                                          Regards

                                          Patrick FrombergP Offline
                                          Patrick FrombergP Offline
                                          Patrick Fromberg
                                          wrote on last edited by
                                          #20

                                          @aha_1980 Oh yes indeed. Clicking the mini-magnifier gives me regex. Great!

                                          1 Reply Last reply
                                          1

                                          • Login

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • Users
                                          • Groups
                                          • Search
                                          • Get Qt Extensions
                                          • Unsolved