54 Commits

Author SHA1 Message Date
Patrick Valsecchi
24bde35ce6 Smarter default edit widgets with plugins to pick them
Now the widgets factories can give a score on how good they could handle
a widget.

Additionaly, plugins can be added to choose a widget factory in function
of an external information. One of them uses a table in PostgresQL to
allow specification of the widget type and configuration.

I took the opportunity to remove a few deprecated method in relation to
this.
2016-08-29 07:42:50 +02:00
Matthias Kuhn
5c20f0782a Cleanup QgsEditFormConfig
* It's now implicitly shared, meaning that changes to the config
   can be supervised and a signal is sent from QgsVectorLayer and
   there is no risk of elements suddenly being deleted.
 * Remove a bunch of methods that were in QgsVectorLayer for legacy
   reasons.
2016-08-19 09:03:07 +02:00
Nyall Dawson
4f3564cc7b Avoid potential QgsFields detachments 2016-08-05 06:08:07 +10:00
Nyall Dawson
bd7d913379 Refine QgsFeature geometry getters/setters
All pointer based methods have been removed.

Now we have only:

  void setGeometry( const QgsGeometry& geom )

and

  QgsGeometry geometry() const

Benefits include avoiding a whole lot of tricky pointer lifetime
issues, potential memory leaks, and finally closing #777, which
has survived for over 9 years!...

Impacts on PyQGIS code:
- no more need for the messy
  g = QgsGeometry( feature.geometry() )
  workaround, just use g = feature.geometry() instead
- IMPORTANT: you can no longer test whether a feature has geometry
 using `if f.geometry():`, since QgsFeature::geometry() will
 *always* return an object. Instead, use
 `if not f.geometry().isEmpty():`, or preferably the new method
 `if not f.hasGeometry():`

Fix #777
2016-08-01 16:25:46 +10:00
Nyall Dawson
aceddae65a QgsFeature cleanup, part 1
Deprecate some QgsFeature methods which take or return pointers,
update other classes as required
2016-07-31 21:23:07 +10:00
Nyall Dawson
c628c0f434 Rework includes to forward declare as much as possible
Should speed up recompilation when headers change
2016-07-18 19:10:19 +10:00
Nyall Dawson
23a3a7717e Cleaner API for selecting features in QgsVectorLayer
- add selectByRect( QgsRectangle&, SelectBehaviour) and
selectByIds( QgsFeatureIds, SelectBehaviour) for selecting
by rect and ids respectively, with options to add to selection/
remove from selection/intersect with current selection
- deprecate select( QgsRectangle ) and setSelectedFeatures in
favour of new methods
- add unit tests
2016-05-19 12:30:32 +10:00
Nyall Dawson
0044666486 Correctly handle QVariant::LongLong fields in merge attribute dialog 2016-02-07 20:58:34 +11:00
Nyall Dawson
1566e37a47 Fix merge attribute dialog mangles field values when layer has hidden
fields (fix #14235)
2016-02-07 20:58:34 +11:00
Nyall Dawson
3f94adc82a Make entering manual values in merge attributes dialog more user
friendly (fix #14146)

Previously, if a value was manually entered it would be ignored if
the user forgot to change the combo box from the "skip" value
to some other value (even though that value would not be used).

Now, there's a new "manual" value in the combo box, and manually
entering a value will switch the combo automatically to the
"manual" option.
2016-01-22 08:13:38 +11:00
Nyall Dawson
18614e11e3 Avoid container detachments by using const methods wherever possible
eg QList::at() instead of QList:[], constFind instead of find, ...
2015-12-16 20:15:46 +11:00
Nyall Dawson
576875e998 Followup 320c696 use clang-modernize to replace 0/NULL use with nullptr 2015-12-15 11:24:51 +11:00
Nyall Dawson
b23ddfe2b4 Fix taking attribute values in merge attributes dialog (fix #13971)
Also fix handling of long feature ids in tool.
2015-12-11 08:07:10 +11:00
Nyall Dawson
9cc9d424ce Add extra check for deprecations to documentation test
This check tests that if a function has been declared deprecated
with either Q_DECL_DEPRECATED or has a @deprecated Doxygen note
then it MUST have both the Q_DECL_DEPRECATD and @deprecated note.

It's important that both are used, as Q_DECL_DEPRECATED allows
throwing a warning if that method is used in code, while the
@deprecated doxygen note gives an indication to devs/PyQGIS users
of why it's deprecated and what should be used instead.

Ideally we'd also test for SIP /Deprecated/ tags, but I can't
find any reliable way to do this.
2015-12-07 21:55:36 +11:00
Matthias Kuhn
a50f2d051f Refactor edit form configuration out of QgsVectorLayer 2015-11-19 15:32:28 +01:00
Nyall Dawson
df6c7104e2 Use QgsStatisticalSummary for merge attributes dialog
Adds a bunch of new stats and avoids code duplication
2015-11-12 20:29:07 +11:00
Nyall Dawson
1969e09b6f Also avoid detaching QgsFields and QgsAttributes where possible 2015-10-20 20:36:08 +11:00
Nyall Dawson
23dd501650 Add skip all option to merge attributes dialog (fix #6958) 2015-10-19 17:36:32 +11:00
Nyall Dawson
0bda18b6e0 Fix merge attributes tool sets skipped attributes to null (fix #13231) 2015-10-19 17:36:24 +11:00
Nyall Dawson
0caf944747 Misc optimisations identified by clazy:
- call reserve on container classes where applicable
- make sure Q_FOREACH uses references
- remove dynamic casts to base classes
- fix some implicit bool conversions
2015-10-05 18:43:18 +11:00
Matthias Kuhn
cf2f6b17fa Alias without pending prefix for QgsVectorLayer methods
* pendingAllAttributesList -> attributeList
 * pendingPkAttributesList -> pkAttributeList
 * pendingFeatureCount -> featureCount

featureCount will now always return the features on the layer and NOT the
committed features count as before.
This changes its behavior but this way it is coherent with the other methods
which work on the layer.
2015-08-04 15:13:31 +02:00
Matthias Kuhn
e832b2a28a Add QgsVectorLayer::fields() as alias to pendingFields()
pendingFields() is not very intuitive and leads to confusion for new developers.
2015-08-04 15:13:31 +02:00
Denis Rouzaud
9e3183c63f Revert "sort includes"
This reverts commit 2b7d3d3c73b50ba6dc74abec6dd652ff1b87c0ec.
2015-06-10 14:54:47 +02:00
Denis Rouzaud
2b7d3d3c73 sort includes 2015-06-10 13:59:08 +02:00
Nyall Dawson
d393d268e1 Fix up non-const getters for attributes and geometry in QgsFeature
(preparation for implicit sharing)
2015-05-20 21:46:15 +10:00
Nyall Dawson
2863f20d67 Add a const geometry getter to QgsFeature 2015-05-11 19:46:32 +10:00
Nyall Dawson
a7f774037a More coverity fixes 2015-02-10 17:37:17 +11:00
Nyall Dawson
e4253721c8 Coverity fixes
Including a notable bug causing "mean" to be missing from merge
attributes dialog options.
2015-02-09 16:05:14 +11:00
Nyall Dawson
b60221a375 Coverity fixes (uninitialized members) 2015-02-07 19:56:57 +11:00
Juergen E. Fischer
13178fa6d1 make merge attributes dialog translation agnostic (fixes #10681) 2014-06-23 23:39:49 +02:00
Juergen E. Fischer
0903684314 fix edit widget deprecation warnings and sync sip bindings 2014-05-24 03:52:19 +02:00
Juergen E. Fischer
28fb634876 merge attributes: new vector api can skip attributes - use default value for skipped field (fixes #5758) 2014-02-13 17:45:17 +01:00
Nathan Woodrow
d517461360 Set alpha for rubber bands. Fix #8463 2013-08-13 08:50:41 +10:00
Marco Hugentobler
aab2537eb4 Merge attributes dialog: also skip pk attributes if taking attributes from selection 2013-07-08 09:29:33 +02:00
Matthias Kuhn
e53aa07698 Merge features: Fix "take attributes from selected feature"
Fix #7668
Fix #7922
2013-07-04 21:07:58 +02:00
Matthias Kuhn
e02459cb5d Merge feature attributes: Return NULL if unable to calculate 2013-06-19 15:29:45 +02:00
Matthias Kuhn
7d38eac043 "Merge selected features" leads to data loss (Fix #6902) 2013-06-19 15:11:54 +02:00
Juergen E. Fischer
dc728f6c39 update calls to new api 2013-01-29 01:58:32 +01:00
Martin Dobias
5f304b34a1 Merge remote-tracking branch 'origin/master' into new_vector_api
Conflicts:
	python/core/qgsvectordataprovider.sip
	src/app/legend/qgslegendlayer.cpp
	src/app/qgisapp.cpp
	src/app/qgsmergeattributesdialog.cpp
	src/core/qgsvectordataprovider.cpp
	src/core/qgsvectordataprovider.h
	src/core/qgsvectorlayer.cpp
	src/gui/qgssearchquerybuilder.cpp
	src/providers/postgres/qgspostgresprovider.cpp
	src/providers/wfs/CMakeLists.txt
2013-01-23 23:46:56 +01:00
Juergen E. Fischer
2a002c558e [API] make primary key field indexes available:
- add QgsVectorLayer::pendingPkAttributeList()
- add QgsVectorDataProvider::pkAttributeIndexes()
- skip primary key attribute when pasting features (fixes #6164)
- default to skip primary key attribute in when merging features/attributes
- reset primary key attributes to default value when splitting features (better fix for #6060)
- comment out unused QgsPasteTransformations
2013-01-06 04:48:37 +01:00
Martin Dobias
51122d263a Store attributes and fields in vectors instead of maps 2012-10-20 22:19:55 +02:00
Martin Dobias
8bf959093f QgsFeature: use a vector of attributes instead of a map (for faster access) 2012-10-19 00:31:03 +02:00
Etienne Tourigny
008592b002 move getThemeIcon() and getThemePixmap() to QgsApplication 2012-07-16 15:42:39 -03:00
Juergen E. Fischer
2d722b1a56 fix #5758 2012-06-08 00:51:56 +02:00
Juergen E. Fischer
42c24dac90 save and restore position of merge attribute dialog 2012-01-31 16:41:39 +01:00
Juergen E. Fischer
8905274a12 add support "sum" operation to merge attribute dialog 2011-09-17 22:51:59 +00:00
Juergen E. Fischer
5a3a87fde2 [FEATURE] support 64bit feature ids 2011-06-16 20:30:07 +02:00
jef
c3c979a0f2 [FEATURE] attribute editing improvements:
- refactor attribute dialog calls to QgsFeatureAttribute
- add QgsVectorLayer::featureAdded signal
- improve interactive attribute editing in table (adding/deleting
  features, attribute update)
- allow adding of geometryless features
- fix attribute undo/redo

git-svn-id: http://svn.osgeo.org/qgis/trunk@14729 c8812cc2-4d05-0410-92ff-de0c093fc19c
2010-11-21 20:09:36 +00:00
jef
9cb15629d3 implement #2696
git-svn-id: http://svn.osgeo.org/qgis/trunk@13472 c8812cc2-4d05-0410-92ff-de0c093fc19c
2010-05-12 22:53:01 +00:00
jef
d316cd8752 use qobject_cast instead of dynamic_cast where possible
git-svn-id: http://svn.osgeo.org/qgis/trunk@11790 c8812cc2-4d05-0410-92ff-de0c093fc19c
2009-10-10 14:56:40 +00:00