lpostula
lpostula

Reputation: 584

Making a wysiwyg in Qt

What I would like to do is to make a WYSIWYG editor, not a big one, just the common utilities, so bold, italic, underline, size, font, in Qt.

My approach for now is to make it in a QTextEdit, when the user click the button i get the signal and using the cursor index i put html tag, but I don't know if it's a good idea.

Any Advice?

Upvotes: 3

Views: 2058

Answers (3)

SigTerm
SigTerm

Reputation: 26429

Any Advice?

Study "Order form" and "Syntax Highlighter" examples. Also, read QTextCursor and QTextDocument documentation.

Upvotes: 2

felixgaal
felixgaal

Reputation: 2423

You can always use the webkit module and relay on the contentEditable feature.

Upvotes: 3

lupz
lupz

Reputation: 3638

I think you refer to the internal format of a document. You just need a solution to keep the formating information, so the editor/viewer can interpret it. Of cause you can choose HTML or HTML-like tags for this. I'd recommend to check out BBCodes, which are widely used for that.

By the nature of WYSIWYG the internal format should be invisible to a user. I don't know about the capabilities of QTextEdit to achieve that. Perhaps there is a HTML/BBCode extension?

Upvotes: 1

Related Questions