当前位置: 首页>>代码示例>>Python>>正文


Python QTreeView.dragMoveEvent方法代码示例

本文整理汇总了Python中PyQt4.Qt.QTreeView.dragMoveEvent方法的典型用法代码示例。如果您正苦于以下问题:Python QTreeView.dragMoveEvent方法的具体用法?Python QTreeView.dragMoveEvent怎么用?Python QTreeView.dragMoveEvent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt4.Qt.QTreeView的用法示例。


在下文中一共展示了QTreeView.dragMoveEvent方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: dragMoveEvent

# 需要导入模块: from PyQt4.Qt import QTreeView [as 别名]
# 或者: from PyQt4.Qt.QTreeView import dragMoveEvent [as 别名]
 def dragMoveEvent(self, event):
     QTreeView.dragMoveEvent(self, event)
     self.setDropIndicatorShown(False)
     index = self.indexAt(event.pos())
     if not index.isValid():
         return
     src_is_tb = event.mimeData().hasFormat('application/calibre+from_tag_browser')
     item = index.data(Qt.UserRole).toPyObject()
     if item.type == TagTreeItem.ROOT:
         return
     flags = self._model.flags(index)
     if item.type == TagTreeItem.TAG and flags & Qt.ItemIsDropEnabled:
         self.setDropIndicatorShown(not src_is_tb)
         return
     if item.type == TagTreeItem.CATEGORY and not item.is_gst:
         fm_dest = self.db.metadata_for_field(item.category_key)
         if fm_dest['kind'] == 'user':
             if src_is_tb:
                 if event.dropAction() == Qt.MoveAction:
                     data = str(event.mimeData().data('application/calibre+from_tag_browser'))
                     src = cPickle.loads(data)
                     for s in src:
                         if s[0] == TagTreeItem.TAG and \
                                 (not s[1].startswith('@') or s[2]):
                             return
                 self.setDropIndicatorShown(True)
                 return
             md = event.mimeData()
             if hasattr(md, 'column_name'):
                 fm_src = self.db.metadata_for_field(md.column_name)
                 if md.column_name in ['authors', 'publisher', 'series'] or \
                         (fm_src['is_custom'] and (
                          (fm_src['datatype'] in ['series', 'text', 'enumeration'] and
                           not fm_src['is_multiple']) or
                          (fm_src['datatype'] == 'composite' and
                           fm_src['display'].get('make_category', False)))):
                     self.setDropIndicatorShown(True)
开发者ID:BobPyron,项目名称:calibre,代码行数:39,代码来源:view.py

示例2: dragMoveEvent

# 需要导入模块: from PyQt4.Qt import QTreeView [as 别名]
# 或者: from PyQt4.Qt.QTreeView import dragMoveEvent [as 别名]
 def dragMoveEvent(self, event):
     QTreeView.dragMoveEvent(self, event)
     self.setDropIndicatorShown(False)
     index = self.indexAt(event.pos())
     if not index.isValid():
         return
     src_is_tb = event.mimeData().hasFormat("application/calibre+from_tag_browser")
     item = index.data(Qt.UserRole).toPyObject()
     if item.type == TagTreeItem.ROOT:
         return
     flags = self._model.flags(index)
     if item.type == TagTreeItem.TAG and flags & Qt.ItemIsDropEnabled:
         self.setDropIndicatorShown(not src_is_tb)
         return
     if item.type == TagTreeItem.CATEGORY and not item.is_gst:
         fm_dest = self.db.metadata_for_field(item.category_key)
         if fm_dest["kind"] == "user":
             if src_is_tb:
                 if event.dropAction() == Qt.MoveAction:
                     data = str(event.mimeData().data("application/calibre+from_tag_browser"))
                     src = cPickle.loads(data)
                     for s in src:
                         if s[0] == TagTreeItem.TAG and (not s[1].startswith("@") or s[2]):
                             return
                 self.setDropIndicatorShown(True)
                 return
             md = event.mimeData()
             if hasattr(md, "column_name"):
                 fm_src = self.db.metadata_for_field(md.column_name)
                 if md.column_name in ["authors", "publisher", "series"] or (
                     fm_src["is_custom"]
                     and (
                         (fm_src["datatype"] in ["series", "text", "enumeration"] and not fm_src["is_multiple"])
                         or (fm_src["datatype"] == "composite" and fm_src["display"].get("make_category", False))
                     )
                 ):
                     self.setDropIndicatorShown(True)
开发者ID:hashken,项目名称:calibre,代码行数:39,代码来源:view.py


注:本文中的PyQt4.Qt.QTreeView.dragMoveEvent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。