Skip to content

Commit bed90d9

Browse files
committed
QwtPlot.detachItems: removed unnecessary "autoDelete" arg, initialiazing rtti to None (remove all items)
1 parent a149f0e commit bed90d9

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
# PythonQwt Releases #
22

33

4+
### Version 0.X.X ###
5+
6+
- Changed QwtPlotItem.detachItems signature: removed unnecessary "autoDelete" argument,
7+
initialiazing "rtti" argument to None (remove all items)
8+
49
### Version 0.7.0 ###
510

611
- Added convenience functions for creating usual objects (curve, grid, marker, ...):

qwt/plot.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -160,18 +160,16 @@ def removeItem(self, item):
160160
"""
161161
self.__data.itemList.removeItem(item)
162162

163-
def detachItems(self, rtti, autoDelete):
163+
def detachItems(self, rtti=None):
164164
"""
165165
Detach items from the dictionary
166166
167-
:param int rtti: In case of `QwtPlotItem.Rtti_PlotItem` detach all items otherwise only those items of the type rtti.
168-
:param bool autoDelete: If true, delete all detached items
167+
:param rtti: In case of `QwtPlotItem.Rtti_PlotItem` or None (default) detach all items otherwise only those items of the type rtti.
168+
:type rtti: int or None
169169
"""
170170
for item in self.__data.itemList[:]:
171-
if rtti == QwtPlotItem.Rtti_PlotItem and item.rtti() == rtti:
171+
if rtti in (None, QwtPlotItem.Rtti_PlotItem) or item.rtti() == rtti:
172172
item.attach(None)
173-
if self.autoDelete:
174-
self.__data.itemList.remove(item)
175173

176174
def itemList(self, rtti=None):
177175
"""

0 commit comments

Comments
 (0)