[Qgis-developer] Patch to Remove Qt3 Dependencies

Tom Elwertowski telwertowski at comcast.net
Mon Apr 28 12:01:44 EDT 2008


Hi Marco and Tim,

To get around the .diff problems, I have added a tarball of modified files:

http://telwertowski.home.comcast.net/qgisqt4_r8378.tar.gz

Some of the files in svn are not tagged svn:eol-style=native and they result in double-spacing in the .diff file. Sometimes 'patch' will ignore this and sometimes it will fail.

The error "malformed patch at line 2869" is in one of the pc eol cmake files.

The "Hunk #1 FAILED at 16" may have something to do with reordering lines to alphabetize #include statements. 'Patch' seems to be trying to match file content and getting confused when it should just swap the old and new content.

Qt3 dependencies are still present in the GRASS plugin. The modified cmake files should remove qt3support references from everywhere else but keep it for GRASS alone. The GRASS plugin is about half the work. Since I don't use GRASS, I wanted to make changes in code where I would be more likely to notice the effects of changes myself. Perhaps a few weeks after this set of changes is in general use, the GRASS plugin can be upgrading with more confidence because the types of modifications are known to work.

Are there settings to make more reliable patch files (I am using 'svn diff > file') or do all of the files in svn need to be consistently tagged?

Tom


Tim Sutton wrote:
> Hi
> 
> I also had problems with applying the patch - seems to be diffs of
> various of the CMakeLists.txt files.  I did a bit of hacky workarounds
> and was able to mostly compile under windows and mac with the
> exception of some qt3isms remaining in:
> 
> src/plugins/grass/qgsgrassregion.cpp
> 
> Though I'm unsure if this is simply a symptom of me not tweaking the
> patch properly.
> 
> Regards
> 
> Tim
> 
> 2008/4/28 Marco Hugentobler <marco.hugentobler at karto.baug.ethz.ch>:
>> 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?).
>>
>>  Regards,
>>  Marco
>>
>>  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
>>  src/app/qgsattributetable.cpp.rej
>>  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
>>  src/app/qgspgquerybuilder.cpp.rej
>>  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
>>
>>
>> _______________________________________________
>>  Qgis-developer mailing list
>>  Qgis-developer at lists.osgeo.org
>>  http://lists.osgeo.org/mailman/listinfo/qgis-developer
>>
> 
> 
> 



More information about the Qgis-developer mailing list