Esempio n. 1
0
File: accd.py Progetto: Sugz/Python
    def mousePressEvent( self, event ):
        # handle an internal move

        # start a drag event
        if event.button() == Qt.LeftButton and self.dragDropRect().contains(event.pos()):
            # create the pixmap
            pixmap = QPixmap.grabWidget(self, self.rect())

            # create the mimedata
            mimeData = QMimeData()
            mimeData.setText('ItemTitle::%s' % (self.title()))

            # create the drag
            drag = QDrag(self)
            drag.setMimeData(mimeData)
            drag.setPixmap(pixmap)
            drag.setHotSpot(event.pos())

            if not drag.exec_():
                self._accordianWidget.emitItemDragFailed(self)

            event.accept()

        # determine if the expand/collapse should occur
        elif event.button() == Qt.LeftButton and self.expandCollapseRect().contains(event.pos()):
            self._clicked = True
            event.accept()

        else:
            event.ignore()
Esempio n. 2
0
 def copy(self):
     """Copy to the clipboard"""
     data = QMimeData()
     text = '\n'.join([cursor.selectedText() \
                         for cursor in self.cursors()])
     data.setText(text)
     data.setData(self.MIME_TYPE, text.encode('utf8'))
     QApplication.clipboard().setMimeData(data)
 def mouseMoveEvent(self, mme):
   if mme.button() == Qt.NoButton and self._drag_start: # for some reason, the left button is being mapped to NoButton
     drag_distance = mme.pos() - self._drag_start
     drag_distance = drag_distance.manhattanLength()
     if drag_distance > QApplication.startDragDistance():
       drag = QDrag(self)
       mime_data = QMimeData()
       mime_data.setText(self.label_spidername.text())
       drag.setMimeData(mime_data)
       drag.exec_(Qt.CopyAction | Qt.MoveAction)
   super(SpiderToolButton, self).mouseMoveEvent(mme)
Esempio n. 4
0
 def mouseMoveEvent(self, mme):
     if mme.button(
     ) == Qt.NoButton and self._drag_start:  # for some reason, the left button is being mapped to NoButton
         drag_distance = mme.pos() - self._drag_start
         drag_distance = drag_distance.manhattanLength()
         if drag_distance > QApplication.startDragDistance():
             drag = QDrag(self)
             mime_data = QMimeData()
             mime_data.setText(self.label_spidername.text())
             drag.setMimeData(mime_data)
             drag.exec_(Qt.CopyAction | Qt.MoveAction)
     super(SpiderToolButton, self).mouseMoveEvent(mme)
Esempio n. 5
0
    def _drag_text ( self, text ):
        mime_data = QMimeData()
        mime_data.setText( text )

        return mime_data
Esempio n. 6
-1
    def set_clipboard_html(self):
        """Place the HTML displayed in the HTML view widget into the
        system clipboard.

        """
        data = QMimeData()
        data.setText(self.plain)
        data.setHtml(self.html)
        QApplication.clipboard().setMimeData(data)