当前位置: 首页>>代码示例>>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;未经允许,请勿转载。