[Qgis-developer] Patch to Remove Qt3 Dependencies

Marco Hugentobler marco.hugentobler at karto.baug.ethz.ch
Mon Apr 28 02:50:57 EDT 2008

Hi Tom,

Many thanks for this patch.
I tried to apply it and ran into the following problem with r8383 from trunk. 
Then the compile fails (probably because of the patching problem?).


marco at ikapc2:~/src/qgis$ patch -p0 < /home/marco/tmp/qgisqt4_r8378.diff
patching file python/core/qgsmaplayerregistry.sip
patching file src/app/qgsdelattrdialog.h
patching file src/app/qgsbookmarks.cpp
patching file src/app/qgsserversourceselect.h
patching file src/app/legend/qgslegendlayerfile.cpp
patching file src/app/legend/qgslegend.cpp
patching file src/app/qgsattributetable.cpp
Hunk #1 FAILED at 16.
1 out of 27 hunks FAILED -- saving rejects to file 
patching file src/app/qgsoptions.cpp
patching file src/app/qgssearchquerybuilder.cpp
patching file src/app/qgsrasterlayerproperties.cpp
patching file src/app/qgsattributetable.h
patching file src/app/qgsattributeactiondialog.cpp
patching file src/app/qgsmeasuredialog.cpp
patching file src/app/qgspastetransformations.cpp
patching file src/app/composer/qgscomposermap.cpp
patching file src/app/composer/qgscomposerlabel.cpp
patching file src/app/composer/qgscomposer.cpp
patching file src/app/composer/qgscomposervectorlegend.cpp
patching file src/app/composer/qgscomposerscalebar.h
patching file src/app/composer/qgscomposervectorlegend.h
patching file src/app/composer/qgscomposeritem.h
patching file src/app/qgsattributetabledisplay.cpp
patching file src/app/qgspgquerybuilder.cpp
Hunk #1 FAILED at 13.
1 out of 5 hunks FAILED -- saving rejects to file 
patching file src/app/qgsabout.cpp
patching file src/app/qgisapp.h
patching file src/app/qgspythondialog.cpp
patching file src/app/qgspythonutils.cpp
patching file src/app/qgsgeomtypedialog.cpp
patching file src/app/qgsvectorlayerproperties.cpp
patching file src/app/qgsnumericsortlistviewitem.h
patching file src/app/qgsgraduatedsymboldialog.cpp
patching file src/app/qgsdbsourceselect.cpp
patching file src/app/main.cpp
patching file src/app/qgsdelattrdialog.cpp
patching file src/app/qgsnumericsortlistviewitem.cpp
patching file src/app/CMakeLists.txt
patch: **** malformed patch at line 2869:

Am Freitag 25 April 2008 04:43:54 schrieb Tom Elwertowski:
> Hello all,
> Here is a patch which removes use of Qt3 routines for all of QGIS except
> the GRASS plugin:
> http://telwertowski.home.comcast.net/qgisqt4_r8378.diff
> Please test it and send comments. After resolving any issues, I would like
> to submit it to svn trunk.
> The GRASS plugin, which probably contains about half of the Qt3
> dependencies, will be done later. The patch was done to build with the
> Qt/Mac/64bit alpha1 release; Qt3 features are not being ported to
> Mac/64bit.
> Three categories of changes have be made:
> 1. Remove use of qt3support library (Q3 classes).
> 2. Remove use of qt3 compatibility routines in qt4 classes.
> 3. Remove automatic cast of QString to char*.
> Classes and places with non-trivial changes are:
> Q3Table to QtableWidget (qgsattributeactiondialog, qgsattributetable,
> qgsmeasure) Q3ListView to QTreeWidget (qgsbookmarks,
> qgsrasterlayerproperties, qgsgeomtypedialog, qgsserversourceselect) Q3Dict
> to QHash (qgsprojectproperty)
> Q3Process to QProcess (qgsgpsplugin)
> The most complex change involved handling selections in the item view
> classes (tables, trees and lists) so this should be tested the most.
> In spite of its name, QTreeWidget also handles multicolumn lists which are
> not trees; just set rootIsDecoated to false. Qt4 QListWidget is for lists
> with one column and no header.
> Qt4 has two classes for each item view: QTable/Tree/ListWidget and
> QTable/Tree/ListView. The Widget classes contain a backing store and the
> View classes don't. The Widget classes correspond more closely to the Q3
> classes.
> qgsattributetable, which can take a while to load large tables, should
> probably be rewritten as a QTableView with an QAbstractTableModel subclass
> to pull individual cells directly for the provider as needed. It has been
> ported as a QTableWidget to keep the port straightforward and not introduce
> additional refactoring into this edit.
> Removing automatic casts of QString to char* also uncovered some odd code.
> Defining QT_NO_CAST_TO_ASCII will produce a compile error whenever an
> implicit QString cast occurs. Based on these two examples, this macro
> serves as 'lint' for QStrings.
> QString str; delete str; // compiles due to cast of str.
> tr("abc" + def + tr("ghi")) // ought to be tr("abc") + def + tr("ghi")
> In most cases, I have used toUtf8() to eliminate implicit casts. If a file
> already used toAscii(), toLatin1() or toLocal8Bit(), I also used it to keep
> the file consistent. Implicit casts have also been removed from the GRASS
> plugin so that QT_NO_CAST_TO_ASCII can be defined for all future builds.
> The patch has been tested using Qt4.2, 4.3 and 4.4RC1 as well as
> Qt4.4-Cocoa-alpha1.
> Tom
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer

Dr. Marco Hugentobler
Institute of Cartography
ETH Zurich
Technical Advisor QGIS Project Steering Committee

More information about the Qgis-developer mailing list