def dataCollector( tree, items ):
     data = QMimeData()
     
     actions = []
     for item in items:
         actions.append(nativestring(unwrapVariant(item.data(0, Qt.UserRole))))
     actionstr = ','.join(actions)
     
     data.setData('application/x-actions', QByteArray(actionstr))
     return data
Beispiel #2
0
    def dataCollector(tree, items):
        data = QMimeData()

        actions = []
        for item in items:
            actions.append(
                nativestring(unwrapVariant(item.data(0, Qt.UserRole))))
        actionstr = ','.join(actions)

        data.setData('application/x-actions', QByteArray(actionstr))
        return data
    def startDrag(self, dragData):
        """
        Starts a new drag with the inputed data.
        
        :param      dragData | <dict>
        """
        # create the mime data
        mimeData = QMimeData()
        for key, value in dragData.items():
            mimeData.setData('application/x-%s' % key, wrapVariant(value))

        # create the drag instance
        drag = QDrag(self.scene().chart())
        drag.setMimeData(mimeData)
        drag.exec_()
Beispiel #4
0
 def mimeData( self, items ):
     """
     Creates the mime data for the different items.
     
     :param      items | [<QListWidgetItem>, ..]
     
     :return     <QMimeData>
     """
     text = []
     for item in items:
         text.append(nativestring(item.text()))
     
     data = QMimeData()
     data.setText(','.join(text))
     return data
Beispiel #5
0
    def mimeData(self, items):
        """
        Creates the mime data for the different items.
        
        :param      items | [<QListWidgetItem>, ..]
        
        :return     <QMimeData>
        """
        text = []
        for item in items:
            text.append(nativestring(item.text()))

        data = QMimeData()
        data.setText(','.join(text))
        return data
 def startDrag(self, dragData):
     """
     Starts a new drag with the inputed data.
     
     :param      dragData | <dict>
     """
     # create the mime data
     mimeData = QMimeData()
     for key, value in dragData.items():
         mimeData.setData('application/x-%s' % key, wrapVariant(value))
     
     # create the drag instance
     drag = QDrag(self.scene().chart())
     drag.setMimeData(mimeData)
     drag.exec_()
     
Beispiel #7
0
    def mousePressEvent(self, event):
        btn = event.button()
        mid = btn == Qt.MidButton
        lft = btn == Qt.LeftButton
        shft = event.modifiers() == Qt.ShiftModifier

        if self.windowFlags() & Qt.Dialog and \
           (mid or (lft and shft)):
            pixmap = QPixmap.grabWidget(self)
            drag = QDrag(self)
            data = QMimeData()
            data.setData('x-application/xview/floating_view',\
                         QByteArray(self.objectName()))
            drag.setMimeData(data)
            drag.setPixmap(pixmap)
            self.hide()
            drag.exec_()
            self.show()
        else:
            super(XView, self).mousePressEvent(event)
Beispiel #8
0
 def mousePressEvent(self, event):
     btn  = event.button()
     mid  = btn == Qt.MidButton
     lft  = btn == Qt.LeftButton
     shft = event.modifiers() == Qt.ShiftModifier
     
     if self.windowFlags() & Qt.Dialog and \
        (mid or (lft and shft)):
         pixmap = QPixmap.grabWidget(self)
         drag = QDrag(self)
         data = QMimeData()
         data.setData('x-application/xview/floating_view',\
                      QByteArray(self.objectName()))
         drag.setMimeData(data)
         drag.setPixmap(pixmap)
         self.hide()
         drag.exec_()
         self.show()
     else:
         super(XView, self).mousePressEvent(event)