Fwd: Re: [Qgis-developer] Patch to Remove Qt3 Dependencies

Tim Sutton tim at linfiniti.com
Wed May 7 12:22:33 EDT 2008


Hi Tom

Just a bit of feedback to say that I built under msvc with your patch.
Based on my limited basic testing, all seems ok on that platform, but
I didnt go much beyond opening a couple of files and panning & zooming
around etc.

Regards

Tim

2008/5/7 Marco Hugentobler <marco.hugentobler at karto.baug.ethz.ch>:
> Thanks a lot!
>
>  Additionally I found (and commited) that clearing all existing selections in
>  handleChangedSelections() is always necessary. Because in QTableWidget, it is
>  now also possible to deselect rows while holding the ctrl key.
>
>  Regards,
>  Marco
>
>  Am Mittwoch 07 Mai 2008 08:46:18 schrieb Tom Elwertowski:
>
>
> > Hi Marco,
>  >
>  > I merged your revision and submitted the patch. checkSelectionChanges also
>  > needed the revision for deselection.
>  >
>  > Tom
>  >
>  > Marco Hugentobler wrote:
>  > > Hi Tom,
>  > >
>  > > I think I found the reason for the problem with the ctrl - key.
>  > > Considering all selection ranges in
>  > > QgsAttributeTable::handleChangedSelections solves the problem:
>  > >
>  > > void QgsAttributeTable::handleChangedSelections()
>  > > {
>  > >   if (lockKeyPressed == false)
>  > >   {
>  > >     //clear the list and evaluate the last selection
>  > >     emit selectionRemoved(false);
>  > >   }
>  > >
>  > >   QList<QTableWidgetSelectionRange> selectedItemRanges =
>  > > selectedRanges(); QList<QTableWidgetSelectionRange>::const_iterator
>  > > range_it =
>  > > selectedItemRanges.constBegin();
>  > >   for(; range_it != selectedItemRanges.constEnd(); ++range_it)
>  > >     {
>  > >       for (int index = range_it->topRow(); index <=
>  > > range_it->bottomRow(); index++)
>  > >     {
>  > >       emit selected(item(index, 0)->text().toInt(), false);
>  > >     }
>  > >     }
>  > >
>  > >   emit repaintRequested();
>  > > }
>  > >
>  > >
>  > > Once you changed this, please commit the patch to svn.
>  > >
>  > > Regards,
>  > > Marco
>  > >
>  > >
>  > > ----------  Weitergeleitete Nachricht  ----------
>  > >
>  > > Betreff: Re: [Qgis-developer] Patch to Remove Qt3 Dependencies
>  > > Datum: Freitag 02 Mai 2008
>  > > Von: Marco Hugentobler <marco.hugentobler at karto.baug.ethz.ch>
>  > > An: qgis-developer at lists.osgeo.org
>  > >
>  > > Hi Tom,
>  > >
>  > > I did a bit of testing. In general, things work fine. One problem I
>  > > encountered is that if multiple entries are selected in the attribute
>  > > table with holding the ctrl key down, the corresponsing map features are
>  > > not selected in map view. It works correctly with the shift key.
>  > >
>  > > Regards,
>  > > Marco
>  > >
>  > > 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
>  >
>  > _______________________________________________
>  > 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
>



-- 
Tim Sutton
QGIS Project Steering Committee Member - Release Manager
Visit http://qgis.org for a great open source GIS
openModeller Desktop Developer
Visit http://openModeller.sf.net for a great open source ecological
niche modelling tool
Home Page: http://tim.linfiniti.com
Skype: timlinux
Irc: timlinux on #qgis at freenode.net


More information about the Qgis-developer mailing list