【问题标题】:Pyside: Drag & Drop into empty List?Pyside:拖放到空列表中?
【发布时间】:2016-12-06 07:00:12
【问题描述】:

我有两个 QTableView,一个充满了一些条目,一个是空的。我想选择一个条目并将其拖放到空列表中。但我只是让 Drop 在一个项目上工作。这在 PySide/QT 中是否可行?它是用 Python 编写的,但我也可以处理 Qt 的 C++ 答案。提前致谢!

这是我的 DropClass 代码:

class dropListView(QtGui.QTableView):
    dropped = QtCore.Signal(int)
    released = QtCore.Signal(int)

    def __init__(self):
        super(dropListView,self).__init__()
        #self.setStyleSheet(StyleSheet().style())

    def dropEvent(self,event):
        index = self.indexAt(event.pos())
        self.dropped.emit(index)

【问题讨论】:

    标签: qt user-interface drag-and-drop pyside


    【解决方案1】:

    对不起,我自己发现的:

    将此行添加到 DropClass 解决了这个问题:

        def dragMoveEvent(self, event):
            event.acceptProposedAction()   
    

    【讨论】:

      猜你喜欢
      • 2014-10-25
      • 1970-01-01
      • 2014-01-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-03-25
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多