How to limit the line numbers of QTextBrowser - qt

I use QTextBrowser to show some execution information. I need to use hyperlinks so I choose QTextBrowser. Sometimes a series of more than 10000 lines will be sent to QTextBrowser per command execution.
.setMaximumBlockCount() is for restrict paragraphs, not for lines.I use one paragraph for a execution.

There is no way to limit html "br"-lines with QTextBrowser functions. You have to implement it yourself, e.g. by count each "br" right before insertHtml() and remove extra lines.

Related

Game Maker Studio writing in exactly in the middle of a GUI

I'd like to make a pause screen.
In the game the view follows the character and when paused I want the text to be exactly in the middle of the screen. I am using a draw GUI event to display text where the user can see it.
I was thinking of halving the length and width of the port but could not find a function which gave those numbers.
If there is one, what it is, and if not how can I achieve this?
I think I have solved this.
In the GUI event, I use view_hport[0] and view_wport[0] in order to obtain the total length of the port then halve this number.

Technology of WinHex

I am going to create Win Hex like application in Qt. I want to know which widget should I use for creating hex display area. I have to open hard disk in it so it would be a very large number of lines for displaying 500 GB of disk.
So, which widget can handle this large number of hexadecimal lines?
I have started to do it in QWidget's paint event but the height of QWidget is in integer so number of lines could not be greater than the range of integer.
So, should I use QTextEdit or QPlainTextEdit?
You use wrong way. Consider to use QAbstractItemModel + QTableView. Your model can use "virtual window". It means that your model holds only small piece of data which will be loaded on demand.

QTreeView: how to be inform of the beginning/end of item expansion?

I have a QtreeView that is displaying file lists (using a model derived from QFileSystemModel). As the building of the file list needs a lot of time (I must read the content of each file to determine if the file is visible or not) I want to display the wait cursor during the analysis process. The wait cursor must starts when the user select an item (directory), and stays as long as all the list is not displayed.
For this I did a lot of tries:
using the expanded signal. But this signal is not related to drawing. Hence it arrves almost immediately,
managing the cursor in data() function of my model. But in this case I have an horrible blinking cursor,
managing the cursor by overridding the painEvent. In this case I have a small blinking, and the cursor appears lately
...
So, none of my "solutions" is perfect. Hence, do you have a way to do what I want?
Thanks a lot.
One more idea, but i did't try it:
Try to check QAbstractItemView::State in a timer after QTreeView::expanded() signal.

QPlainTextEdit for single line of input

I'm using Qt to write a database type program where the majority of inputs will be single lines, not documents of arbitrary length.
Do I understand correctly that QPlainTextEdit is the most appropriate widget for this kind of input?
If so, how do you set parameters for this kind of input? In particular:
Height to the right value to comfortably hold one line of text in the current font, instead of stretching to fill available space.
Enter/cursor-down keys move to next control instead of next line in the document.
Take a look at the QLineEdit class.

What is the maximum number of lines a TextArea control can hold?

I have an app that has text appended to a TextArea (TA). It automatically scrolls to keep the recent line added in view. Over time, this could be a lot. Do I have to worry about this? Is there an upper limit? And, if so, how can I prune the oldest lines of text?
There's nothing in the documentation, but if it gets too big you could run into memory issues. But we're talking collosal here.
It's easy enough to remove oldest lines using the slice() method

Resources