removing use of qt names which are removed in qt5

Treeve Jelbert treeve at scarlet.be
Wed Dec 12 08:54:21 UTC 2012


Qt5 has now removed some functions which were previously deprecated.

the attached script will scan an entire git branch and fix any use of 
the following cases:

{To,From}Ascii

Qt::WFlags

I have used this script locally an all my kde repos, applying it to 
4.9/master/4.10/frameworks branches as appropriate.

Everything builds and runs using qt-4.8.4

It also reduces the number of errors when compiling kdelibs/frameworks 
using qt-5.0

My latest attempt to build frameworks got as far as

[2666/3860] Building CXX object 
kfile/tests/CMakeFiles/kurlnavigatortest.dir/kurlnaviga
tortest_automoc.cpp.o


I would suggest applying it to KDE/4.9 branch and then forward porting 
to master, KDE/4.10 , frameworks.


#!/bin/bash
# replace s1 by s2 in all files
function replace() {
  local FF F
  FF=`git grep $1 | cut -d: -f1 | uniq`
  for F in $FF;do
   sed -i "s/$1/$2/" $F
   git add $F
  done
}


# scan a repo branch
function changes() {
echo processing $PWD
#already done
replace 'Qt::WFlags' 'Qt::WindowFlags'
git commit -m'replace obsolete Qt::WFlags (removed in qt5)'

replace toAscii toLatin1
replace fromAscii fromLatin1
git commit -m'replace {to,from}Ascii by {to,from}Latin1 (qt5 uses 
unicode)'

#replace qRealloc realloc
#replace qAlloc malloc
#replace qFree  free
#git commit -m'replace qAlloc/qRealloc/qFree (not in qt5)'
}

changes

_________________
Regards, Treeve




More information about the Kde-frameworks-devel mailing list