Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Is it possible to visualize indentation levels on QtCreator?
Forum Updated to NodeBB v4.3 + New Features

Is it possible to visualize indentation levels on QtCreator?

Scheduled Pinned Locked Moved Solved General and Desktop
10 Posts 6 Posters 1.8k Views 2 Watching
  • 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.
  • H Offline
    H Offline
    Hayk 0
    wrote on last edited by
    #1

    I would like to see vertical lines that show the indentation levels, which makes code easier to read for me. Is there a way to enable this on QtCreator? It seems impossible with built-in options, but maybe there are some tricks to achieve that? Thanks in advance.

    1 Reply Last reply
    0
    • jeremy_kJ Offline
      jeremy_kJ Offline
      jeremy_k
      wrote on last edited by
      #2

      Preferences -> Text Editor -> Display -> Visualize whitespace will show a dot for spaces and tabs. I don't see an option to turn the dots into vertical lines. Perhaps a style sheet or font could do that.

      Asking a question about code? http://eel.is/iso-c++/testcase/

      1 Reply Last reply
      1
      • H Offline
        H Offline
        Hayk 0
        wrote on last edited by Hayk 0
        #3

        dfb4be01-ad1f-4118-ad80-9eaadc049bd4-image.png

        @jeremy_k here is an example of what I'm asking about (this image is from CLion). I think Highlight Blocks is meant to do this task, but it looks horrible to my eyes and I get tired very quickly because instead of highlighting the block it highlights everything else but the block which actually makes it harder to code, so I was wondering if there is a workaround.

        S 1 Reply Last reply
        0
        • jeremy_kJ Offline
          jeremy_kJ Offline
          jeremy_k
          wrote on last edited by jeremy_k
          #4

          Can you clarify which portion of the screen capture is the feature of interest, by circling it or otherwise differentiating from the other features?

          edit: I think I understand now. There are vertical lines at the level of the struct BoundFlagRef declaration, and at setFlag().

          This might be possible using custom syntax highlighting. In the generic highlighter tab, there's a link to KSyntaxHighlighting that in turn suggests looking at the kate syntax highlighting format.

          Asking a question about code? http://eel.is/iso-c++/testcase/

          1 Reply Last reply
          0
          • H Hayk 0

            dfb4be01-ad1f-4118-ad80-9eaadc049bd4-image.png

            @jeremy_k here is an example of what I'm asking about (this image is from CLion). I think Highlight Blocks is meant to do this task, but it looks horrible to my eyes and I get tired very quickly because instead of highlighting the block it highlights everything else but the block which actually makes it harder to code, so I was wondering if there is a workaround.

            S Offline
            S Offline
            stretchthebits
            wrote on last edited by
            #5

            @Hayk-0 Are you talking about those up and down arrow things that appear on the left side? It looks like they are for expanding or contracting sections inside { }.
            Visual Studio does the same thing.

            1 Reply Last reply
            0
            • H Offline
              H Offline
              Hayk 0
              wrote on last edited by
              #6

              As @jeremy_k said, I'm talking about those vertical lines. They are useful to just visually identify the blocks.

              mrjjM 1 Reply Last reply
              0
              • H Hayk 0

                As @jeremy_k said, I'm talking about those vertical lines. They are useful to just visually identify the blocks.

                mrjjM Offline
                mrjjM Offline
                mrjj
                Lifetime Qt Champion
                wrote on last edited by
                #7

                @Hayk-0

                Hi
                While it cant show such lines (normal in many python editors due to its invisible blocks)
                You can click on a scope to see where it ends.
                alt text

                1 Reply Last reply
                2
                • J.HilkJ Online
                  J.HilkJ Online
                  J.Hilk
                  Moderators
                  wrote on last edited by
                  #8

                  you can also hover over the arrow besides the line number to highlight the scope:

                  7a11d881-18e3-463c-8154-14ae4ab2a808-image.png


                  Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                  Q: What's that?
                  A: It's blue light.
                  Q: What does it do?
                  A: It turns blue.

                  1 Reply Last reply
                  2
                  • H Offline
                    H Offline
                    Hayk 0
                    wrote on last edited by
                    #9

                    @mrjj @J-Hilk thanks. I just realized that those lines are just the tabs, and tabs in qt creator are highlighted with arrows, so it's highlighter dependent (as stated by @jeremy_k ). But yes, highlighting the blocks by just hovering is useful and solves the general problem. Also, usually I click on the curly braces to find their pairs, but I thought there could be quicker ways. Thanks to all :)

                    1 Reply Last reply
                    1
                    • S Offline
                      S Offline
                      SherifOmran
                      wrote on last edited by
                      #10

                      as you see there is a setting in display visualize whitespace

                      c0e3af4b-4c6b-40b2-98ff-44f419c50302-image.png

                      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