text display starting from bottom up qt - qt

How would I display text in something like QTextEdit starting from bottom up? QTextEdit starts writing at the top filling down to bottom. I want to start from the bottom and then pushing the previous text up as more text is added. I figure I could hack it and simply fill the field with nextlines to reach the bottom then reprinting whatever was written before again when text is to be added, but I wouldn't want to do that unless there isn't any other way.

insertPlainText inserts text at the current text position. You could move the cursor to the start of the docuement using the moveCursor function.
Every time you want to add some text do the following:
textEdit->moveCursor(QTextCursor::Start);
textEdit->insertPlainText(textToBeAdded);

Related

Tooltip overlay over container component

I have a component with tooltip icon when there is an error.
The problem starts when the text for the tooltip includes a one large word (without spaces).
In such case the text inside the tooltip box exceed the borders.
Please see this sandbox:
https://codesandbox.io/s/fragrant-morning-267l5
By default, word breaks on a new line if it is long enough that there is no space left for it to be on the same line. Since you are typing one long word it can't find a new word to break on so it goes over the box.
What you can do is instead breaking on a word you can break on a letter
word-wrap: break-word;
Add that CSS to text. When it runs out of space for new letter it will go to next line.
Read more about it here
Hope this helps :)

Text truncation listener

I want to create a responsive button that has a title and a leading icon. What I want to do is, when the viewport is decreasing, detect when the text starts to get truncated, at which point I would like to remove the title altogether and leave just the icon.
Can this be done with CSS alone?
If not, can this be done with JavaScript?

In Qt - How to see start of text in a narrow combo box?

I have a QComboBox which I have populated with addItem() repeatedly, and then selected an item with setCurrentIndex(). The trouble is that some of the text is wider than the width of the box and it shows the text moved to the left so the right-hand-side is visible. I want the text in the edit box to be positioned the same as the text in the drop-down box (so the start of text is visible on the left-hand-side, and any oversized text unseen on the right).
Some suggested reasoning: I think it may be trying to ensure the cursor is visible, after leaving the cursor at the end. But I have tried using setCursorPosition(1) but there is no such function in QComboBox.

The page scrolls up instead of the caret moving down

I use wysihtml5 editor. I can type a text normally only till it fits the textarea window. After that a scroll bar appears (which is fine) but let's say I want to type new line on the very top of the text area and when I press enter the line which was just typed moves up outside of the top border of text area and cursos stays on the same first line. So in order to see the first line in the document I just typed I need to scroll one line up. All that instead of the text line stays in place and cursor moves one line down.
That is not usual text editing beheavor. Why is that? Is that an CSS issue?
I guess this has to be an attribute of the text area itself.. but I have no idea how.. I'm myself a beginner in this..
try to search for extra attribute of text-area like:
<textarea rows="2" cols="20" wrap="hard">
....
</textarea>
good luck..

move image in text area in flex

alt text http://img31.imageshack.us/img31/1183/tedit.jpg
Hi Guys,
I am trying to make a text editor in Flex.
i can move image on mouse click.
Problem is it moves with the key up or down handler. But it moves out of text area after the last line in textarea. And it also doesn't move with scroll.
Pls give suggestions for these problems.
Thanks.
Regards,
Shivang
You may want to increase the white space of your 'text editor'. Just have numbers up till person entered text. That way when you move to the bottom you are not moving outside of the textArea.
would need more example of what is going wrong with the key up or down handler. What events are you trying to capture? How are you dragging the image?
good luck.

Resources