[Development] QDocument

Thiago Macieira thiago.macieira at intel.com
Tue Jul 10 10:11:57 CEST 2012


On terça-feira, 10 de julho de 2012 11.55.00, Иван Комиссаров wrote:
> 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?

No, you're not. You can never add a virtual function to an existing class 
without breaking BC. That is very clearly stated in the BC guidelines page:

"You cannot:
 - For existing classes:
   * change the class hierarchy in any way (add, remove, or reorder base 
classes)
 - For virtual member functions:
   * add new virtual functions to non-leaf classes"

It's not impossible to add an intermediate base class, as it was shown with 
QGraphicsItem -> QGraphicsObject -> QGraphicsWidget when QGraphicsObject was 
inserted. But in that class you can only have virtuals that are already in the 
derived class -- you can't add new ones. That technique is not in the BC page 
because it's extremely dangerous.

This will limit what you can do in QDocument, so it looks to me like you're 
proposing a Qt 6 functionality. If you want this to go in the 5.x series, 
you'll need to redesign and offer something that is BC.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center
     Intel Sweden AB - Registration Number: 556189-6027
     Knarrarnäsgatan 15, 164 40 Kista, Stockholm, Sweden
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/development/attachments/20120710/9be1a88f/attachment.sig>


More information about the Development mailing list