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. Creating a tabbed, tree-view text-editor using Qt
Forum Updated to NodeBB v4.3 + New Features

Creating a tabbed, tree-view text-editor using Qt

Scheduled Pinned Locked Moved General and Desktop
17 Posts 7 Posters 18.1k 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.
  • A Offline
    A Offline
    AlecTaylor
    wrote on last edited by
    #1

    Greetings!

    Before I create an IDE using Qt, I thought I'd create a much simpler project, a text-editor. Most of the features from this I'll port over to my IDE.

    !http://i51.tinypic.com/zyhllk.png(Mockup)!

    A few notes on the mockup, there will be close buttons on the tabs, and clicking the folder in the filesystem-tree will open all *.txt in that directory, and show all *.txt in the sidebar.

    Any tips on how to get started with this?

    Thank you,

    Alec Taylor

    NOTE: Yesterday I found a good text-editor tutorial (http://doc.qt.nokia.com/latest/gettingstartedqml.html), so maybe just a tutorial for the other features?

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

      If this is a desktop application you may have better luck using C++/Qt (not QML).
      You will find Widgets ready to use for most of your ui.

      Look in the wiki for the list of books on qt. There is one that you can download for free that should be very helpful.

      Certified Specialist & Qt Ambassador <a href="http://www.crochik.com">Maemo, Meego, Symbian, Playbook, RaspberryPi, Desktop... Qt everywhere!</a>

      1 Reply Last reply
      0
      • F Offline
        F Offline
        fcrochik
        wrote on last edited by
        #3

        couple links for you to get started:

        http://developer.qt.nokia.com/wiki/Books_and_Links_for_learning_C_and_advanced_topics

        http://www.qtrac.eu/C++-GUI-Programming-with-Qt-4-1st-ed.zip

        http://doc.qt.nokia.com/4.7/qtreewidget.html
        http://doc.qt.nokia.com/4.7/qtabbar.html

        Certified Specialist & Qt Ambassador <a href="http://www.crochik.com">Maemo, Meego, Symbian, Playbook, RaspberryPi, Desktop... Qt everywhere!</a>

        1 Reply Last reply
        0
        • V Offline
          V Offline
          vcsala
          wrote on last edited by
          #4

          [quote author="fcrochik" date="1293158931"]http://www.qtrac.eu/C++-GUI-Programming-with-Qt-4-1st-ed.zip[/quote]

          You can also download the examples of this book from the net (I do not remember the address just google it and you will find the site of the second edition) which practically contains all building block you need for this text editor (and even for the IDE).

          1 Reply Last reply
          0
          • A Offline
            A Offline
            AlecTaylor
            wrote on last edited by
            #5

            Hmm, thanks for the book/tutorial suggestions.

            I downloaded the 2nd edition and am scanning through it as we speak, if it has enough useful things, I'll purchase it.

            In the meantime, and with your help, I'll be collating the major classes/keywords I'll be using for my project.

            Current list;

            • QTextStream
            • QTextEdit
            • QTreeWidget
            • QTabBar ⊕ CLTab
            • QDockWidget
            • QTreeView
            • QDirModel
            1 Reply Last reply
            0
            • V Offline
              V Offline
              vcsala
              wrote on last edited by
              #6

              If you want syntax highlighting you also need QSyntaxHighlighter

              1 Reply Last reply
              0
              • V Offline
                V Offline
                vcsala
                wrote on last edited by
                #7

                [quote author="AlecTaylor" date="1293191717"]I downloaded the 2nd edition and am scanning through it as we speak, if it has enough useful things, I'll purchase it.[/quote]

                I have read it through it was really useful, but keep in mind (as it is mentioned "here":http://developer.qt.nokia.com/wiki/Books_and_Links_for_learning_C_and_advanced_topics too) it was written for 4.3 and it is a bit outdated (not too much, so it is still very good for learning)

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

                  I do want Syntax Highlighting, but I thought writing that myself would be best. - Also, not including it in my text-editor version, only in my IDE version.

                  If that's the case, then what's a good tutorial/book for learning how to create text-editors with Qt?

                  1 Reply Last reply
                  0
                  • V Offline
                    V Offline
                    vcsala
                    wrote on last edited by
                    #9

                    [quote author="AlecTaylor" date="1293195803"]I do want Syntax Highlighting, but I thought writing that myself would be best. - Also, not including it in my text-editor version, only in my IDE version.[/quote]

                    Qt use Scintilla based highlighter which is really good. I am not sure it is worth to write a new one (except want to have something different from the current mainstream solutions)

                    1 Reply Last reply
                    0
                    • A Offline
                      A Offline
                      AlecTaylor
                      wrote on last edited by
                      #10

                      Okay, well I like the colour scheme used in Notepad2, which I plan to steal for my own rendition, however I also plan to add a new colour which will highlight user made/included classes.

                      1 Reply Last reply
                      0
                      • M Offline
                        M Offline
                        maciej
                        wrote on last edited by
                        #11

                        [quote author="AlecTaylor" date="1293191717"]
                        Current list;
                        [...]

                        • QTreeWidget
                          [...]
                        • QTreeView
                        • QDirModel[/quote]
                          You shouldn't use "QDirModel":http://doc.qt.nokia.com/4.7/qdirmodel.html (it's obsolete) - you should use "QFileSystemModel":http://doc.qt.nokia.com/4.7/qfilesystemmodel.html instead. Also you've put down QTreeView and QTreeWidget. You probably won't need them both. Read more about "model/view concept":http://doc.qt.nokia.com/4.7/model-view-programming.html in Qt.

                        Earth is a beta site.

                        1 Reply Last reply
                        0
                        • A Offline
                          A Offline
                          AlecTaylor
                          wrote on last edited by
                          #12

                          When should QML be used, and why isn't my project a good platform for QML?

                          Updated list;

                          • QTextStream
                          • QTextEdit
                          • QTreeWidget
                          • QTabBar ⊕ CLTab
                          • QDockWidget
                          • QTreeView
                          • QFileSystemModel
                          • QTreeWidget
                          1 Reply Last reply
                          0
                          • Q Offline
                            Q Offline
                            qtrahul
                            wrote on last edited by
                            #13

                            [quote author="AlecTaylor" date="1293201122"]When should QML be used, and why isn't my project a good platform for QML?

                            Updated list;

                            • QTextStream
                            • QTextEdit
                            • QTreeWidget
                            • QTabBar ⊕ CLTab
                            • QDockWidget
                            • QTreeView
                            • QFileSystemModel
                            • QTreeWidget[/quote]

                            In the link of your first thread,
                            here : http://doc.qt.nokia.com/latest/gettingstartedqml.html

                            There is one topic ,extending QML code using C++ , means you can add and take the advantage of C++ feature in QML code.

                            1 Reply Last reply
                            0
                            • V Offline
                              V Offline
                              vcsala
                              wrote on last edited by
                              #14

                              [quote author="AlecTaylor" date="1293201122"]Updated list;

                              [...]

                              • QTreeWidget
                                [...]
                              • QTreeView
                                [...][/quote]

                              As maciek wrote above, these two are usually not required together as they provide almost the same functionality, but you can use your own model with QTreeView. As you want to use it for directory listing from which you can easily create a model I beleive QTreeView is better for you

                              1 Reply Last reply
                              0
                              • V Offline
                                V Offline
                                vsorokin
                                wrote on last edited by
                                #15

                                As VCsala say you can use QScintilla for syntax highlight, it is very good convenient tool for text-editor creation. You can know more "here":http://www.riverbankcomputing.co.uk/static/Docs/QScintilla2/index.html

                                --
                                Vasiliy

                                1 Reply Last reply
                                0
                                • A Offline
                                  A Offline
                                  AlecTaylor
                                  wrote on last edited by
                                  #16

                                  Thanks, I'll see what I can put together.

                                  I've already got the base application working; just need to add my custom features. I've followed your suggestion and am using QScintilla2 instead of TextEdit.

                                  Please continue to help me gain the information necessary to complete this project.

                                  Best regards,

                                  Alec Taylor

                                  BTW: The latest thread is — http://developer.qt.nokia.com/forums/viewthread/2924/

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

                                    As the new thread is the continuation of this one, it will be closed now.

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

                                    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