Summary of Methods needed to achieve read-write support

Registered by whatnick

This blueprint lists all the methods required to achieve read/write support to the buffer holding the document in TocModel.

Blueprint information

Not started
Rob Oakes
Needs approval
Series goal:
Informational Informational
Milestone target:



The current implemented methods include - in Text3.cpp:

1) dragMove (move paragraph to a certain segment in the document tree)

2) setData(see, An Editable Model). When a title is updated in a particular view (corkboard or outline pane or document map [existing]), setData is used to call relevant methods in the buffer that then modify the existing title. Must make sure that the index is valid, the item is of the correct type, and the role is supported. By default, QStandardItemModel uses EditRole. However, in the existing TocModel this includes both a label (Chapter, Item, etc.) and the information that needs to be edited (Title, etc.). The EditRole needs to be subclassed so that it only manipulates the title, and not any associated labels. [ Where is the necessary EditRole defined ? EditRole is a Qt enum indicating that all data is editable it does not perform any filtering].

3) flags( see, An Editable Model). Prior to making changes, a delegate checks to see whether an item is editable before creating an editor. The model must let the delegate know that its item are editable. This is done by returning the correct flags for each item in the mode; in this case, we enable all items and make them both selectable and editable ...

4) dataChanged(see Signal emitted when the underlying data of the model has been changed. This causes all all other views to update.
See notes on using function dispatch mechanism to deal with change of data content -

Text Manipulation Methods:

1) Locate beginning and end of relevant text in the buffer of title.
2) Substitute updated text from view into buffer.
3) Remove old text from buffer (may be incorporated into item 2)

[ Use find and replace technique to locate in context matches in the buffer - regexp]

Relevant Qt Reference:

1) Simple Tree Model (Subclass of QAbstractItemView, see Example describes how to read data from an underlying data store and translate that information into model that can be used by the model/view architecture.
2) Model Subclassing Reference (see


Work Items

This blueprint contains Public information 
Everyone can see this information.


No subscribers.