Making a view from a QPlainTextEdit

  • I'm trying to find some pointers for using a QPlainTextEdit as a view for a QAbstractTableModel. Unfortunately Google seems to only bring me threads that deal with using QPlainTextEdit as an editor inside a QTableView.

    The idea is to have a read-only QPlainTextEdit that is updated with data based on the QAbstractTableModel. For example, a scrollbar would represent size of the model, the actual data displayed would be based on where you are in the model.

    Can anyone say where I should even start from? I'm surprised that using a text-editor is not so common in the model/view scenarios.

  • i'm a bit newbie, but i would try to make a connect(signal/slot) from the scroll valeuChange, to a slot that do something like QPlainTextEdit->setData(index, QAbs->dataThatIWant() ,qt:DisplayRole);

  • Thanks for your idea Brochadinho. I'm not sure still how to proceed with it, but you may have nudged me to some good direction. Or not - we will see.

    Any other input from members is still welcome.

Log in to reply