V
V
Vladimir Martyanov2015-03-17 18:55:17
Programming
Vladimir Martyanov, 2015-03-17 18:55:17

How to cross QPlainTextEdit with Model-View?

The model contains several hundred thousand elements, all presented as text with markup (color, style). I want to make a View that will display this data. From Model-View, the indexAt() functionality is absolutely necessary - getting the index in the model by the coordinates on the screen, so that the user double-clicks on a line of text to cause, for example, data modification in the model. From QPlainTextEdit you need character-by-character selection of text and display of text in different colors.
QPlainTextEdit in its purest form holds hundreds of thousands of lines, but does not have all the functionality.
Inheritance from QAbstractItemView turns out crooked for me: scrolling slows down already on 10K elements, plus there are no examples for displaying text.
Googled as best I could - I did not find examples of this with the source code.
Tell me how to do what you want?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vladimir Martyanov, 2015-05-07
@vilgeforce

In general, the project https://code.google.com/p/qhexedit2/ contains a suitable rendering of text in paintEvent, which can be taken as a basis.

A
Armenian Radio, 2015-03-17
@gbg

Either put it in a QTableView with a custom design, or create your own widget. What is the nature of the data in the model? Any log?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question