本文整理汇总了Python中AnyQt.QtCore.QObject.parent方法的典型用法代码示例。如果您正苦于以下问题:Python QObject.parent方法的具体用法?Python QObject.parent怎么用?Python QObject.parent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AnyQt.QtCore.QObject
的用法示例。
在下文中一共展示了QObject.parent方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setModel
# 需要导入模块: from AnyQt.QtCore import QObject [as 别名]
# 或者: from AnyQt.QtCore.QObject import parent [as 别名]
def setModel(self, model):
"""
Reimplemented.
Parameters
----------
model : QAbstractItemModel
"""
if model is self.__completerModel:
return
if self.__completerModel is not None:
self.__completerModel.dataChanged.disconnect(
self.__initDynamicModel)
self.__completerModel.rowsInserted.disconnect(
self.__initDynamicModel)
self.__completerModel.rowsRemoved.disconnect(
self.__initDynamicModel)
if QObject.parent(self.__completerModel) is self:
self.__completerModel.deleteLater()
self.__completerModel = None
self.__completerModel = model
if self.__completerModel is not None:
self.__completerModel.dataChanged.connect(
self.__initDynamicModel)
self.__completerModel.rowsInserted.connect(
self.__initDynamicModel)
self.__completerModel.rowsRemoved.connect(
self.__initDynamicModel)
self.__initDynamicModel()
示例2: __add__
# 需要导入模块: from AnyQt.QtCore import QObject [as 别名]
# 或者: from AnyQt.QtCore.QObject import parent [as 别名]
def __add__(self, iterable):
new_list = PyListModel(list(self._list),
# method parent is overloaded in Model
QObject.parent(self),
flags=self._flags,
list_item_role=self.list_item_role,
supportedDropActions=self.supportedDropActions())
# pylint: disable=protected-access
new_list._other_data = list(self._other_data)
new_list.extend(iterable)
return new_list