本文整理汇总了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)
示例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)
示例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))
示例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)
示例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)
示例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
示例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()
示例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)
示例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)
示例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)
示例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()
示例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
示例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()
示例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)
示例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