Selectable Text from QListView

Hey could someone pls point me as to what are all the things we need to handle to be able to select text off a QListView which uses a CustomDelegate.

QListView item contains Text from a QTextDocument and couple other text and image fields.

Is there any examples or references to use for this requirement.

If we were to handle mousepress, mousemove and mouserelease, to know the selection area, how do we handle selecting different parts of a QlistView item (changing background color)

Shld this be done via the delegate's editorEvent and then repainting selected text with different color and sorts.

Also how would we be able to select Text whose mouse selection spans multiple items of the model or say if we need to scroll the view to show more items since the current mouse selection has reached the bottom of the view's viewport.

Cant seem to find any answers through google since all posts lead me to "Selecting Entire Items in a ListView" via its index or something and im not looking for that.

Just looking to get functionality of say something like a chat client modelled with a ReadOnly QListView and have Highlight and Selectable Areas.

This I found in the QT Apps actually. seems it is possible just cant seem to figure out how it is done even in this application. Tried going through the source but not able to find exactly what allows his items painted via delegates to be selectable.

Would probably need the editor of the delegate to draw a textEdit for each item where the text can be selected and use mousePositions from the View->Viewport to indicate to the delegate if the mouse was already selected when entering the current item to continue selection.

Just seems like a really long winded and not proper way to achieve what would be needed

Went with a QWebView and using the DOM model as a substitute for the QListModel, I could generate QWebElements as desired and you can have interactive buttons and sorts as well via html / javascript and style them using CSS

As a QWebPage getting content selected is a dolly and this got my requirement satisfied.

If anyone has a similar requirement. Do Not Go With QListView.

Main Issue with QListView was even if you design editor widgets that would allow text selection and open these as persistentIndexes,

we still have problems when the selection goes from one widget to another as the first widget has mouseGrabbed and the second QModelIndex does not receive a MouseEnter event (while the left mouse button is pressed)

If you manage to release mouse based on the cusor position and on leaving widget, you still got to track which direction mouse enters the new widget to simulate a text selection on its child widgets.

On the whole, getting this sort of functionality could be possible from a QListView but not something that can be done without subclassing the entire world and managing every action which is not very efficient at all.

Just pick QWebView or something else that can give this functionality easier :)