How do I draw Control Characters in a QTextEdit? - qt

Is there a way to draw control characters with or in a QTextEdit, similar to the way Sublime Text 3 and Notepad++ do.
Example Control Character Display
I am not sure if they are using a font that has these control characters in them or if they are drawing a rectangle with text in place of these characters.

Related

How can I replace a part of pre-written text via officer/r in Powerpoint

Is there a way to read the text of a slide from Powerpoint and then replace a part of the text with a value from R. See image 1, the black text is added by an user, and the red text is written by the R notebook.
I want to do the writing part in Powerpoint, I don't want to add the whole text in R. Otherwise it is impossible for people without R to add text to the Powerpoint.
If there is a way to define a variable in Powerpoint (that can be placed inside a textbox), that would also solve the problem. :)
Example text

How to draw underlined text in a JavaFX Canvas

I'm trying to draw underlined text in a JavaFX 8 canvas. I need to draw directly to the canvas instead of using a Text node since I will then export the canvas to image and use it elsewhere.
I haven't found a way to configure the GraphicsContext to make it draw underlined text.
So far I've discovered:
The Font Constructor takes a font family, a font weight (bold, regular, etc) and a font posture (whether it is italic or not) but there is no sign of a underlined property.
To format text as underlined in a Text element you set the setUnderline property but the Text element is a Node and I'm trying to draw directly into the Canvas not placing a Node on top of it.
Is there a way to draw underlined text directly on a GraphicsContext? If not, Is there a workaround that would let me export it to an image?

QML TextArea colored text with selection

i am trying to accomplish the following behavior with a QML TextArea:
I want single Words in the Text to be colored differently
I want the "select"-functions to be working for automated scrolling (user interaction is disabled)
There is a stream of text in the TextArea where one Word needs to be selected(highlighted). The user is requested to input some text elsewhere and press enter to proceed (not part of the question). After that the selection jumps to the next word and the last selected word is either colored green or red. There is only a small portion of the text visible (a few lines, managed by the TextArea height – not part of the question) and i need the text to scroll if the next word is out of that visible range .. therefore the selection is quite helpful because all interaction from the user – to scroll or select or whatever – is disabled (disabling is not part of the question)
my main problem is: if i use textFormat: TextEdit.RichText i can easily color the text how i like it to be (<font color=\"green\">{}</font>) but i cannot use the "select"-functions anymore because – as i would guess – the selection works on the "plaintext" and cannot correspond to the "richtext"-selection? Anyway selectWord() etc. does not work QTextCursor::setPosition: Position '-1' out of range is the result. But if i disable the RichText i don't know how to color the text. Maybe i could live without the selection if i could detect the current word – which would be colored blue etc. – and scroll if its out of the visible area to "fake" the selection behavior, but that's just a third option.
I would really either know how to color non-Rich Text or how to select Rich Text in a TextArea.
You can use QSyntaxHighlighter to highlight the words independent of the selection. See QQuickTextDocument and How to implement rich text logic on QML TextEdit with QSyntaxHighlighter class in Qt for more details.

Arabic/English text being shuffled

I have been stocked in a strange problem
I have a text box and i am trying to read the text. But when the text box contains both arabic and english text it seems that the text is shuffled . This is how i read my text from text box:
string temp = input.Text;
This is text that i am inserting in text box:
باهم and englishمتن فارسی
And this is the text that i get from textbox:
متن فارسی and english باهم
Add RLE char at the beginning of the text.
const char RightToLeftEmbedding = (char)0x202B;
Arabic is a right to left language. English is left to right. So that actually is correct- the arabic on screen will be in opposite order (string position 0 will be on the far right).
It's probably not a problem with ASP.NET, but with the HTML that it outputs.
Inspect the HTML elements in the browser and check the "direction" property in the computed style. If the main language of your input box is Arabic or Persian, it should be "rtl", and if it's English, then it should be "ltr". If it's the other way, you need to adjust it by using the appropriate dir attribute on the HTML elements.
This only adjusts it for the user interface. The text is probably saved into your database not with the correct direction, but that may be fine, because the database is internal and usually not seen by users.

Is it possible to put different colors for text in multiple line textbox

I have one text box with multiple line option. Now i want type the words inside the text box with different font-size and different colors. Is it possible?
it's not possble.. you can use a WYSWYG editor, like http://nicedit.com/

Resources