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. Code Folding?
Forum Updated to NodeBB v4.3 + New Features

Code Folding?

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 6.4k Views 1 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.
  • S Offline
    S Offline
    soroush
    wrote on 31 May 2011, 17:12 last edited by
    #1

    Hello again :)

    I need something like code folding feature of Qt Creator for my widget. Its a subclass of QPlainTextEdit with some additional syntax highlighting and line numbering. It should hide text between some environment declaration statement and when user requests show them again. Line numbering should not be affected. For example the text between .begin[signal] and .end[signal]. should be hidden when user clicks on the small ▼ placed on the thin vertical bar beside number lines, then clicking again on the ▶ will show text. (like Qt Creator, Eclipse and most of other IDEs)

    Update: the problem is that I can't hide lines and find a way to manage line numbering display to avoid pitfall. Any suggestion?

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andre
      wrote on 31 May 2011, 20:04 last edited by
      #2

      Qt Creator is open source, that means that it is open for you to study how it works...

      1 Reply Last reply
      0
      • D Offline
        D Offline
        diegosarmentero
        wrote on 31 May 2011, 20:27 last edited by
        #3

        I've implemented a Code Folding functionality for an IDE that I made... but it is in Python using Qt...
        The code is pretty clear, and you can easily identify the Qt Classes involved.
        The Editor extends from QPlainTextEdit, and you can see the implementation of the Code Folding here:

        http://code.google.com/p/ninja-ide/source/browse/ninja_ide/gui/qt/main_panel/editor/editor.py?repo=kunai

        Regards!

        Diego Sarmentero
        Blog: http://diegosarmentero.com.ar
        Twitter: http://twitter.com/diegosarmentero

        1 Reply Last reply
        0
        • S Offline
          S Offline
          soroush
          wrote on 31 May 2011, 20:59 last edited by
          #4

          Thanks Diego!
          Looks good... probably I'll use your code instead of writing from scratch :)

          1 Reply Last reply
          0
          • D Offline
            D Offline
            diegosarmentero
            wrote on 1 Jun 2011, 14:12 last edited by
            #5

            Hi, I have modified my class where I implemented Code Folding, and now is not mixed with the Editor and works just as a Sidebar Widget where the Line Number and Folds are displayed... also now support code folding for {}.

            You can take a look at:

            http://code.google.com/p/ninja-ide/source/browse/ninja_ide/gui/editor/sidebar_widget.py

            Regards!

            Diego Sarmentero
            Blog: http://diegosarmentero.com.ar
            Twitter: http://twitter.com/diegosarmentero

            1 Reply Last reply
            0

            1/5

            31 May 2011, 17:12

            • Login

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