I want to design a text editor in QT and planning to implement the following basic features,
1) Basic editing features like cut,paste,formatting,indentation etc.
2) Auto completion based on the context.(Based on some xml input file)
3) Syntax highlighting ( based on some xml input file )
Can you please suggest some approaches for the overall architecture/design?
How about:
Application Example
Completer Example or Custom Completer Example
Syntax Highlighter Example
All this things are stored in one single place, in you Qt SDK examples
This post is in 2015. NO DEAD LINKS
As #mosg mentioned.
In the menu bar. Go to Help > Index:
and in the search field look for:
Application Example
Completer Example
QSyntaxHighlighter
That would help you to begin.
If using Python is an option for you, you might find my Qt Text Editor example on GitHub useful. It uses PyQt5 (but you can also use PySide2) to implement a minimal text editor. Some screenshots:
It doesn't do formating, autocompletion or syntax highlighting but should still be a pretty good starting point. Maybe you can use QTextEdit and QSyntaxHighlighter to get these features.
Related
I am new to Qt in general, and I have been playing with it to get to learn about it since I have to develop a very specific text editor.
I want to know if anyone could help me understand which one is better (or the most indicated) for the development of a rich text editor. I have worked before with C and C++ but Qt Widgets seems like a very step hill for the time being and I am completely new to javascript in general.
Some of the settings that I would need to implement on the text editor for better context are:
Look for the user to be always connected to internet.
Transfer and receive data from another program.
Grant read only to the opened files and then permission to write on them when a button is clicked.
Has to work on linux and windows.
Needs to look great.
My context:
So far I have done a few little applications and even a little rich text editor on Qt Widgets, but since I was having problems with the GUI implementation that I wanted, I started looking for a way to solve it and found that Qt Quick might be the solution.
I have been trying Qt Quick, and for now on looks great, but I do not know if it has the capabilities to do what I have explained before. Or if it is better to use one or another.
I decided to create a new post since the one that I found looking for something similar is from 2014.
Also, the text editor for now only needs to work on desktop, but in a future might be on other devices and embedded systems.
Hi I am trying to learn pyqt by writing my own texteditor, using pyQT one of the things i want to have is intellisense/word suggestions. i.e so that as you type in the text editor it offers you suggestions of words that would be suitable. I have a list of words, and i can already generate a list of suggestions. My difficulty is presenting it, I am unable to bring up a window/dialog at the cursor location which shows a list of possible words. So far I have succesfully got QMenu to work, but it is limited as in it has no scrollbars and can only display a limited number of suggestions.
I tried QListWidget, but this displayed a popup window(complete with max,min buttons) this just isn't right, though it did allow me to have scrollbars.
I would like to know what object I should use to display suggestions to a user at the cursor location just like one sees in any good IDE. This is what I am trying to do
After doing some searching, I found that I was thinking about it all wrong.QListview is not what I needed
Scintilla is great, and probably the most appropriate. Thank you rainer
There is a wonderful example in
Sample using QScintilla with PyQt
But that is not all that I found. There is a class QCompleter, which is also quite good, as I can use it with a QTextedit, after a good amount of searching I found. "A text-edit which would help enter long words"
QTextEdit with autocompletion using pyqt
Plenty of documentation in
QCompleter Class Reference
I want to use a custom widget in the GUI-Designer of Qt-Creator IDE.
So i created a class which inherits from Qt's QWidget. It worked to place
it on a QMainWindow programaticaly, but have to do my work in the desiger
where it does not appear as an option in the kist of components.
I googled to find a solution for problem an found an manual on, who guesses, the
Qt doc page ( https://doc.qt.io/archives/qt-4.7/designer-creating-custom-widgets.html
and https://doc.qt.io/archives/qt-4.7/designer-creating-custom-widgets.html).
I tried to follow it but doesn't work.
Does someone know an other way to do this or can give a hint where i can search
for problems following this tutorial?
Thanks in advance.
Codierknecht
There is a different example in the examples section of the Qt documentation that I think is a lot clearer.
Custom Widget Plugin Example
It was a little unclear to me when reading the tutorial where the Q_EXPORT_PLUGIN2() macro goes, but having full example code and project alleviates that.
If you are like me, the analog clock example didn't do it for you, in which case I found just one better tutorial. It may be on the kde site but I you dont need kde to do it, it just explains how to make the custom widget a plugin so you can add it into Qt Designer, rather than having to code it in, which is the norm when you just add a widget to your project and customize the class. I hope this page helps you like it helped me, get in the right direction of writing a single Qt Designer (or multiple) plugin:
Writing Qt Designer Plugins
If this link ever becomes dead, just do a search for the link itself, usually that will turn up the original page in someone's cache, as they do in the other examples above (the dead links in the above answers that just take you to main area and not to the pages originally intended).
We need to compile to QtHelp (.qch and .qhc). I'm wondering what tool/toolchain would be easiest for this? We'd like a WYSIWYG help authoring tool as our starting point, then run the output from that through whatever we have to to get QtHelp.
We have used Help & Manual in the past, and that's the kind of WYSIWYG interface we're looking for in a help authoring tool. But we need the toolchain to produce simple html pages (one per help topic) that we can use with qhelpgenerator or qcollectiongenerator, as well as create the .qhp's (at least the table of contents and the keywords sections) and .qhcp to generate the .qch's and .qhc. I'm not seeing how Help & Manual can fit into this.
We've looked briefly at Sphynx, but it seems it has extremely limited options for text formatting. For example, it doesn't look like there's any way to change the font, font size, font color, etc. for a section of text. It appears to be actually impossible to have text that is both bold and italic. Looks great for developer documentation, but seems to be missing basic stuff for authoring a user help file. Please correct me if I somehow missed the basic text formatting features!
So, what WYSIWYG help authoring tool do you recommend, and what is the path from that tool to .qch's and a .qhc?
Looks like Help and Manual will work after all! Here's the sequence we're looking at now. If please comment if you see any problems or improvements that can be made.
In Help & Manual (tested with version 5.5.1 Build 1296 professional license), in the Project Explorer, in the Configuration section:
Go HTML Page Templates\Default. In the HTML Source Code tab, comment out the section.
Go to Publishing Options\Web Help.
In Layout, select No frames, no scripts.
In Navigation, we don't need anything checked - although if there is a way to control the format of the value of KEYWORD_INDEX so we could copy and paste directly into our .qhp, that would be great! I haven't found a way to do that, so we plan to maintain keywords directly in the .qhp.
Similarly, Table of Contents is also irrelevant, unless we can control the format we'll have to maintain the toc directly in the .qhp.
In Popup Topics, we are set to HTML encoded topics. Not sure if this is necessary.
That's all the settings we have to change. Create help content in H&M as normal, then to publish Webhelp. This creates a separate .htm file for each topic.
In the same folder as the .htm's, we create our .qhp and .qhcp files, and run qcollectiongenerator to produce our .qhc, which we then display with Qt Assistant. See http://doc.qt.nokia.com/4.7/qthelp-framework.html for help with the Qt side of this toolchain.
Again, it would be great if we could find a way to set up H&M to create the toc and the keywords in the format required for the .qhp and we could just paste them into the .qhp (or for that matter, maintain the .qhp in that template also). Another option would be to write a script to convert from what H&M creates for toc and keywords to what the .qhp requires. If you do that and don't mind sharing, please post the code!
Some benefits we find using H&M to solve this problem:
multiple documenters can work simultaneously, and source is stored as text files in Subversion, so it is versionable and you can compare changes.
easy WYSIWYG creation of help topics
can handle all kinds of text formatting and links. For example, in an end-to-end test of features to see what features of H&M would work in our end product (.qhc viewed in Qt Assistant), I was surprised to see Qt Assistant even handling hotspots in an image linking to other topics/anchors.
the .qhc is integrated into Qt so you have good control of your help from within your Qt app.
Again, if anyone has a better solution or improvements to this one, please post!
use Helpinator 3 Professional it's generat chm qt javahelp word pdf files easly ..
You might consider the HelpNDoc help authoring tool which has a WYSIWYG editor and can generate Qt Help files out of the box. Generated source files can optionally be kept for manual editing and manual compilation.
I let user enter some code in my Flex3 (Flash 10) app and I want to do syntax highlighting.
Is there any open-source library that would help me?
I'll need a Lua syntax support, but I can add it myself if library has a resonable interface to do this.
Update on 21 Jan, 2009:
Check out Anirudh's port of google-code-prettify to ActionScript3, it has a very good example app as well.
I guess this wasn't even feasible till now.
With the new Flash Text Engine, maybe such text-based features will start showing up, and hopefully open source libraries that work like the FlashEff library.
I also wanted to do syntax highlighting, I found a example which works
http://labs.searchcoders.com/text/
You will need to take their actionscript code and when people change the text in your text area then you will need to re-draw the syntax highlighting.
Basically I am doing this as I'm making my own IDE/Language in FLEX.
Try this: http://www.flashtexteditor.com/ftf/
or this:
http://www.matthijskamstra.nl/blog/index.php/2008/06/04/actionscript-syntax-highlighting/