[Development] Quick note on the deprecations to be fixed

Thiago Macieira thiago.macieira at intel.com
Fri May 4 10:30:55 CEST 2012

In the process of porting away from fromAscii / toAscii (all modules have 
changes, please review), I fixed a lot of other deprecation issues. This is a 
summary of what I've found:

1) every now and then, you run into a random deprecated function. They're 
often replaced by another function with a similar name, quickly fixed. You'll 
find what you need to replace with by following the deprecated function: its 
body is usually the solution.

2) you may get a warning about QAbstractItemModel::reset, or a more weird 
error about reset(QTextStream&). That's easily fixed by a pair of functions: 
beginResetModel() and endResetModel(). The end function is usually where the 
reset() call was, the begin one should be before the model started changing.

3) by far, the most annoying one to fix is QAbstractItemModel::setRoleNames. 
Most implementations set the role names in the constructor and leave it at 
that. The fix is to copy & paste those role names into a new virtual override 
called roleNames() const. It's annoying because it's manual work, involving 
two copy & paste, though straight-forward.

There is one non-straight-forward change, however, which I didn't propose a fix 
for: the role names are changed in one particular model in a slot. So the role 
names must persist somewhere and the code needs to be adapted to such.

That was it. There aren't many other deprecation things left.
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/20120504/3fe54144/attachment.sig>

More information about the Development mailing list