當前位置: 首頁>>代碼示例>>Python>>正文


Python QDrag.start方法代碼示例

本文整理匯總了Python中PyQt4.QtGui.QDrag.start方法的典型用法代碼示例。如果您正苦於以下問題:Python QDrag.start方法的具體用法?Python QDrag.start怎麽用?Python QDrag.start使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PyQt4.QtGui.QDrag的用法示例。


在下文中一共展示了QDrag.start方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: startDrag

# 需要導入模塊: from PyQt4.QtGui import QDrag [as 別名]
# 或者: from PyQt4.QtGui.QDrag import start [as 別名]
 def startDrag(self, dropAction):
     # create mime data object
     mime = QMimeData()
     mime.setData('text/xml', '???')
     # start drag 
     drag = QDrag(self)
     drag.setMimeData(mime)        
     drag.start(Qt.CopyAction | Qt.CopyAction)
開發者ID:dreadpiratepj,項目名稱:Sabel,代碼行數:10,代碼來源:tree.py

示例2: startDrag

# 需要導入模塊: from PyQt4.QtGui import QDrag [as 別名]
# 或者: from PyQt4.QtGui.QDrag import start [as 別名]
 def startDrag(self, mainwin, ev):
     d = mainwin.currentDocument()
     if not d:
         return
     url = d.url()
     if url.isEmpty():
         return
     drag = QDrag(mainwin)
     data = QMimeData()
     data.setUrls([url])
     drag.setMimeData(data)
     pixmap = mainwin.style().standardPixmap(QStyle.SP_FileIcon, 0, mainwin)
     hotspot = QPoint(pixmap.width() - 5, 5)
     drag.setPixmap(pixmap)
     drag.setHotSpot(hotspot)
     drag.start(Qt.LinkAction | Qt.CopyAction)
開發者ID:arnaldorusso,項目名稱:frescobaldi,代碼行數:18,代碼來源:icon_drag_eventhandler.py

示例3: startDrag

# 需要導入模塊: from PyQt4.QtGui import QDrag [as 別名]
# 或者: from PyQt4.QtGui.QDrag import start [as 別名]
 def startDrag(self, supportedActions):
     drag = QDrag(self)
     mimeData = self.model().mimeData(self.selectedIndexes())
     # mimeData.setText(str(t))
     drag.setMimeData(mimeData)
     if drag.start(Qt.MoveAction) == Qt.MoveAction:
         for item in self.selectedItems():
             self.takeItem(self.row(item))
開發者ID:gkudos,項目名稱:qgis-cartodb,代碼行數:10,代碼來源:ListWidgets.py

示例4: startDrag

# 需要導入模塊: from PyQt4.QtGui import QDrag [as 別名]
# 或者: from PyQt4.QtGui.QDrag import start [as 別名]
 def startDrag(self,event):
     drag = QDrag(event.widget())
     mimedata = QMimeData()
     liste = []
     liste.append(QUrl( "veromix://source_output_index:"+str(int(self.index)) ))
     mimedata.setUrls(liste)
     drag.setMimeData(mimedata)
     #drag.setHotSpot(event.pos() - self.rect().topLeft())
     dropAction = drag.start(Qt.MoveAction)
開發者ID:florianjacob,項目名稱:veromix-plasmoid,代碼行數:11,代碼來源:SourceOutputUI.py

示例5: startDrag

# 需要導入模塊: from PyQt4.QtGui import QDrag [as 別名]
# 或者: from PyQt4.QtGui.QDrag import start [as 別名]
 def startDrag(self,event):
     drag = QDrag(event.widget())
     drag.setPixmap(self.mute.icon().pixmap(self.size().height(),self.size().height()))
     mimedata = QMimeData()
     liste = []
     liste.append(QUrl( "veromix://sink_index:"+str(int(self.index)) ))
     mimedata.setUrls(liste)
     drag.setMimeData(mimedata)
     #drag.setHotSpot(event.pos() - self.rect().topLeft())
     dropAction = drag.start(Qt.MoveAction)
開發者ID:florianjacob,項目名稱:veromix-plasmoid,代碼行數:12,代碼來源:SinkUI.py

示例6: mouseMoveEvent

# 需要導入模塊: from PyQt4.QtGui import QDrag [as 別名]
# 或者: from PyQt4.QtGui.QDrag import start [as 別名]
 def mouseMoveEvent(self,event):
     #if the left mouse button is used
     if event.buttons() == Qt.LeftButton:
         data = QByteArray()
         mime_data = QMimeData()
         mime_data.setData(self.mimetext,data)
         drag = QDrag(self)
         drag.setMimeData(mime_data)
         drag.setHotSpot(self.rect().topLeft()) #where do we drag from
         drop_action = drag.start(Qt.MoveAction) #drag starts
開發者ID:34693,項目名稱:GraphicalFieldSimulation,代碼行數:12,代碼來源:graphic_drag_label_class.py

示例7: mouseMoveEvent

# 需要導入模塊: from PyQt4.QtGui import QDrag [as 別名]
# 或者: from PyQt4.QtGui.QDrag import start [as 別名]
 def mouseMoveEvent(self, event):
     if event.buttons() != Qt.RightButton:
         return
     mimeData = QMimeData()
     drag = QDrag(self)
     drag.setMimeData(mimeData)
     drag.setHotSpot(event.pos() - self.rect().topLeft())
     dropAction = drag.start(Qt.MoveAction)
     if dropAction == Qt.MoveAction:
         self.close()
開發者ID:calpe20,項目名稱:PYTHONIZANDO,代碼行數:12,代碼來源:tab_central_widget.py

示例8: mouseMoveEvent

# 需要導入模塊: from PyQt4.QtGui import QDrag [as 別名]
# 或者: from PyQt4.QtGui.QDrag import start [as 別名]
    def mouseMoveEvent(self, e):
        if self.drag_start is None:
            pass
        x = e.x() - self.drag_start.x()
        y = e.y() - self.drag_start.y()
        dist = QApplication.startDragDistance()
        if not self.draggable or x > dist or y > dist:
            return

        drag = QDrag(self)
        mime = QMimeData()
        mime.setText(self.__class__.__name__)
        mime.part = self
        drag.setMimeData(mime)
        pixmap = QPixmap.grabWidget(self)
        pixmap.setAlphaChannel(pixmap)
        drag.setPixmap(pixmap)
        drag.setHotSpot(QPoint(drag.pixmap().width() / 2,
                               drag.pixmap().height()))
        drag.start(Qt.CopyAction)
開發者ID:patrickkidd,項目名稱:pksampler,代碼行數:22,代碼來源:parts.py

示例9: _enter_move_object

# 需要導入模塊: from PyQt4.QtGui import QDrag [as 別名]
# 或者: from PyQt4.QtGui.QDrag import start [as 別名]
    def _enter_move_object(self,event):            
        p =  event.scenePos()
        print "enter move object scene %s " % p
        self.current_op_stat['start_point'] = p
        self.current_op_stat['position'] = p
        
        for it in self.home_map_scene.items(p):                    
            if HMItem.type(it) == self.current_op_stat['type'] :          
                HMItem.repr(it)
                self.current_op_stat['item'] = it
#                 if HMItem.type(it) == HMItem.MAP_AREA:
#                     it.setAcceptDrops(True)                               
#                     HMItem.repr(it)
        
        if not  self.current_op_stat['item'] is None:
            print "enter move object item %s "  %  self.current_op_stat['item'].scenePos()
            drag_obj = QDrag(self)        
            drag_obj.setMimeData(QMimeData())
            self.current_op_stat['drag'] = drag_obj
            drag_obj.start(Qt.MoveAction)
開發者ID:juanchitot,項目名稱:domo,代碼行數:22,代碼來源:home_module.py

示例10: mouseMoveEvent

# 需要導入模塊: from PyQt4.QtGui import QDrag [as 別名]
# 或者: from PyQt4.QtGui.QDrag import start [as 別名]
    def mouseMoveEvent(self, e):
        if self.drag_start is None:
            pass
        x = e.x() - self.drag_start[0]
        y = e.y() - self.drag_start[1]
        dist = QApplication.startDragDistance()
        if (self.draggable is False) or (abs(x) < dist and abs(y) < dist):
            return

        drag = QDrag(self)
        mime = QMimeData()
        mime.setText(self.__class__.__name__)
        mime.part = self
        drag.setMimeData(mime)
        pixmap = QPixmap.grabWidget(self)
        pixmap.setAlphaChannel(pixmap)
        drag.setPixmap(pixmap)
        drag.setHotSpot(QPoint(drag.pixmap().width() / 2,
                               drag.pixmap().height()))
        self.dragging = True
        drag.start(Qt.CopyAction)
開發者ID:RikVerschueren,項目名稱:AccordionMega,代碼行數:23,代碼來源:parts.py

示例11: mouseMoveEvent

# 需要導入模塊: from PyQt4.QtGui import QDrag [as 別名]
# 或者: from PyQt4.QtGui.QDrag import start [as 別名]
    def mouseMoveEvent(self, event):
        drag = QDrag(event.widget())
        data = QMimeData()
        data.setText(self.commit.name())

        drag.setMimeData(data)

        #data.setColorData(GREEN)
        pixmap = QPixmap(COMMIT_WIDTH, COMMIT_HEIGHT)
        pixmap.fill(WHITE)
        painter = QPainter(pixmap)
        painter.translate(0, 0)
        painter.setRenderHint(QPainter.Antialiasing)
        painter.setPen(Qt.NoPen)
        painter.setBrush(QBrush(self.color))
        painter.drawPath(self.setup_display(0, 0))
        painter.end()

        pixmap.setMask(pixmap.createHeuristicMask())
        drag.setPixmap(pixmap)
        drag.setHotSpot(QPoint(0, 0))
        drag.start()
開發者ID:mike-perdide,項目名稱:gitbuster,代碼行數:24,代碼來源:graphics.py

示例12: start_drag

# 需要導入模塊: from PyQt4.QtGui import QDrag [as 別名]
# 或者: from PyQt4.QtGui.QDrag import start [as 別名]
    def start_drag(self, info_id):
        _logger.info( "started dragging" )
        mimeData = QMimeData()
        mimeData.data =("/" + info_id.partition("/")[2].partition("/")[0], moose.element(info_id))
        mimeData.setText(info_id)
        drag = QDrag(self)
        drag.setMimeData(mimeData)
        pixmap = QPixmap("")

        drag.setPixmap(pixmap)
        # drag.setHotSpot(e.pos() - self.rect().topLeft())
        dropAction = drag.start(QtCore.Qt.MoveAction)
        print((" => ", dropAction))
        self.select_info.set_event_type(0)
        self._timer.start(0)
        return
開發者ID:dilawar,項目名稱:moose-gui,代碼行數:18,代碼來源:NeuroKitVisualizer.py

示例13: mouseMoveEvent

# 需要導入模塊: from PyQt4.QtGui import QDrag [as 別名]
# 或者: from PyQt4.QtGui.QDrag import start [as 別名]
    def mouseMoveEvent(self, event):
        if event.buttons() != Qt.LeftButton:
            return

        mimeData = QMimeData()
        if self.pos == -1:
            return
        mimeData.setData("splitter/fragment", QByteArray.number(self.pos))
        drag = QDrag(self)
        drag.setMimeData(mimeData)
        drag.setHotSpot(event.pos() - self.rect().topLeft())

        dropAction = drag.start(Qt.MoveAction)

        if dropAction == Qt.MoveAction:
            self.close()
開發者ID:maximerobin,項目名稱:Ufwi,代碼行數:18,代碼來源:fragment_frame.py

示例14: startDrag

# 需要導入模塊: from PyQt4.QtGui import QDrag [as 別名]
# 或者: from PyQt4.QtGui.QDrag import start [as 別名]
 def startDrag(self, event):
     index = self.indexAt(event.pos())
     if not index.isValid():
         return
     drag = QDrag(self)
     mimeData = QtCore.QMimeData()
     el = self.model().listdata[index.row()]
     print("dragging device with id: " + str(el['deviceid']))
     mimeData.setData("application/x-xinputdevice", pickle.dumps(el))
     drag.setMimeData(mimeData)
     pixmap = QtGui.QPixmap()
     pixmap = pixmap.grabWidget(self, self.rectForIndex(index))
     drag.setPixmap(pixmap)
     #drag.setHotSpot(QtCore.QPoint(pixmap.width()/2, pixmap.height()/2))
     result = drag.start(QtCore.Qt.MoveAction)
     if result == 1:
         self.model().listdata.remove(el)
開發者ID:ChristophHaag,項目名稱:mpxgui,代碼行數:19,代碼來源:mpxgui.py

示例15: start_drag

# 需要導入模塊: from PyQt4.QtGui import QDrag [as 別名]
# 或者: from PyQt4.QtGui.QDrag import start [as 別名]
    def start_drag(self, info_id):
        # pixmap = QPixmap()
        # painter = QPainter( pixmap )
        # painter.setFont( QFont("Arial") );
        # painter.drawText( QPoint(100, 100), info_id );
        mimeData = QMimeData()
        mimeData.data =("/" + info_id.partition("/")[2].partition("/")[0], moose.element(info_id))
        mimeData.setText(info_id)
        drag = QDrag(self)
        drag.setMimeData(mimeData)
        pixmap = QPixmap("")

        drag.setPixmap(pixmap)
        # drag.setHotSpot(e.pos() - self.rect().topLeft())
        dropAction = drag.start(QtCore.Qt.MoveAction)
        print(" => ", dropAction)
        self.select_info.set_event_type(0)
        self._timer.start(0)
        return
開發者ID:NeuroArchive,項目名稱:moose,代碼行數:21,代碼來源:NeuroKitVisualizer.py


注:本文中的PyQt4.QtGui.QDrag.start方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。