Exemple #1
0
 def startDrag(self, dropActions):
     """Reimplement Qt Method - handle drag event"""
     data = QMimeData()
     data.setUrls([QUrl(fname) for fname in self.get_selected_filenames()])
     drag = QDrag(self)
     drag.setMimeData(data)
     drag.exec_()
Exemple #2
0
 def mouseMoveEvent(self, event):
     """Override Qt method"""
     if event.buttons() == Qt.MouseButtons(Qt.LeftButton) and \
        (event.pos() - self.__drag_start_pos).manhattanLength() > \
             QApplication.startDragDistance():
         drag = QDrag(self)
         mimeData = QMimeData()
         # Converting id's to long to avoid an OverflowError with PySide
         if PY2:
             ancestor_id = long(id(self.ancestor))
             parent_widget_id = long(id(self.parentWidget()))
             self_id = long(id(self))
         else:
             ancestor_id = id(self.ancestor)
             parent_widget_id = id(self.parentWidget())
             self_id = id(self)
         mimeData.setData("parent-id", QByteArray.number(ancestor_id))
         mimeData.setData("tabwidget-id",
                          QByteArray.number(parent_widget_id))
         mimeData.setData("tabbar-id", QByteArray.number(self_id))
         mimeData.setData("source-index", 
                      QByteArray.number(self.tabAt(self.__drag_start_pos)))
         drag.setMimeData(mimeData)
         drag.exec_()
     QTabBar.mouseMoveEvent(self, event)
Exemple #3
0
 def mouseMoveEvent(self, event):
     """Override Qt method"""
     if event.buttons() == Qt.MouseButtons(Qt.LeftButton) and \
        (event.pos() - self.__drag_start_pos).manhattanLength() > \
             QApplication.startDragDistance():
         drag = QDrag(self)
         mimeData = QMimeData()
         mimeData.setData("parent-id", QByteArray.number(id(self.ancestor)))
         mimeData.setData("tabwidget-id",
                          QByteArray.number(id(self.parentWidget())))
         mimeData.setData("tabbar-id", QByteArray.number(id(self)))
         mimeData.setData("source-index", 
                      QByteArray.number(self.tabAt(self.__drag_start_pos)))
         drag.setMimeData(mimeData)
         drag.exec_()
     QTabBar.mouseMoveEvent(self, event)
Exemple #4
0
 def startDrag(self, dropActions):
     """Reimplement Qt Method - handle drag event"""
     data = QMimeData()
     data.setUrls([QUrl(fname) for fname in self.get_selected_filenames()])
     drag = QDrag(self)
     drag.setMimeData(data)
     drag.exec_()
Exemple #5
0
 def mouseMoveEvent(self, event):
     """Override Qt method"""
     if event.buttons() == Qt.MouseButtons(Qt.LeftButton) and \
        (event.pos() - self.__drag_start_pos).manhattanLength() > \
             QApplication.startDragDistance():
         drag = QDrag(self)
         mimeData = QMimeData()
         # Converting id's to long to avoid an OverflowError with PySide
         if PY2:
             ancestor_id = long(id(self.ancestor))
             parent_widget_id = long(id(self.parentWidget()))
             self_id = long(id(self))
         else:
             ancestor_id = id(self.ancestor)
             parent_widget_id = id(self.parentWidget())
             self_id = id(self)
         mimeData.setData("parent-id", QByteArray.number(ancestor_id))
         mimeData.setData("tabwidget-id",
                          QByteArray.number(parent_widget_id))
         mimeData.setData("tabbar-id", QByteArray.number(self_id))
         mimeData.setData(
             "source-index",
             QByteArray.number(self.tabAt(self.__drag_start_pos)))
         drag.setMimeData(mimeData)
         drag.exec_()
     QTabBar.mouseMoveEvent(self, event)