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. How to implement c-code editor
Forum Updated to NodeBB v4.3 + New Features

How to implement c-code editor

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 560 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.
  • M Offline
    M Offline
    moyin
    wrote on last edited by
    #1

    Actually i have design a "notepad" editor, but now i need this editor should aware of c-syntax and while going through Qt documentations i found syntax_highlighter example, but it is for c++ and that itself an codeEditor. I want just a piece of code that differentiate and identify the c-syntax so that i can include in my project. could any one please help in this regard.

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi
      But since c being a subset of c++ in many regards
      what is wrong with the highlighting ?
      Cant you just add any missing keywords and it works overall?

      1 Reply Last reply
      3
      • Pablo J. RoginaP Offline
        Pablo J. RoginaP Offline
        Pablo J. Rogina
        wrote on last edited by
        #3

        @moyin are you referring to this example? If so, you can see that it uses a Highlighter object, which is subclassing the QSyntaxHighlighter class. That's the component you may need, as it defines and applies the highlighting rules. I guess the example is well documented, as it guides you step by step on what's needed to provide, specially regarding the highlighting part: regular expressions, formatting, etc.

        Upvote the answer(s) that helped you solve the issue
        Use "Topic Tools" button to mark your post as Solved
        Add screenshots via postimage.org
        Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

        1 Reply Last reply
        4

        • Login

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