[Development] QDocument

Иван Комиссаров abbapoh at gmail.com
Tue Jul 10 09:55:00 CEST 2012


Hello everybody. I was looking at Cocoa framework and QtCreator's code and
i was interested in document-based application architecture. I think that
we can add something like QDocument (QAbstractDocument) class with
following features - isModified, isReadOnly, open/save from/to
QIODevice/QUrl, undo/redo, etc... This class should be the base class for
other documents in document-based apps. For example, we can inherit
QTextDocument from QDocument. Over QDocument, we can implement
QDocumentWindow - a class, inherited from MainWidnow that provides standard
slots/actions for manipulating with files in applications -
open/save/close, etc. Note, that no widgets are used here (except for
window), just only document, so you can build any UI on top of that window
- all you need is call "QDocumentWindow::setDocument" when document is
changed (for example, tab is switched).
I would like to hear pros and cons about that idea (not new one, hehe)
Unfirtunately, as long, as Qt5 is frozen and we can't add QDocument. But we
can add an empty QDocument class (QTextDocument->QDocument->QObject) and
add new functionality to it in Qt5.1/5.2 As far as i know, adding new
virtual functions to the end of vtable doesn't break BC. Am i right?
If it is not possible, maybe we can add pointer in a QTextDocument,
containing pointer to QDocument.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20120710/df971b0f/attachment.html>


More information about the Development mailing list