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

Marco Hugentobler marco.hugentobler at karto.baug.ethz.ch
Mon May 5 02:59:46 EDT 2008


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



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

-------------------------------------------------------

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


More information about the Qgis-developer mailing list