当前位置: 首页>>代码示例>>Python>>正文


Python QMimeData.setUrls方法代码示例

本文整理汇总了Python中PyQt4.QtCore.QMimeData.setUrls方法的典型用法代码示例。如果您正苦于以下问题:Python QMimeData.setUrls方法的具体用法?Python QMimeData.setUrls怎么用?Python QMimeData.setUrls使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt4.QtCore.QMimeData的用法示例。


在下文中一共展示了QMimeData.setUrls方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: startDrag

# 需要导入模块: from PyQt4.QtCore import QMimeData [as 别名]
# 或者: from PyQt4.QtCore.QMimeData import setUrls [as 别名]
 def startDrag(self, dropActions):
     """Reimplement Qt Method - handle drag event"""
     data = QMimeData()
     data.setUrls([QUrl(fname) for fname in self.get_selected_filenames()])
     drag = QDrag(self)
     drag.setMimeData(data)
     drag.exec_()
开发者ID:koll00,项目名称:Gui_SM,代码行数:9,代码来源:explorer.py

示例2: startDrag

# 需要导入模块: from PyQt4.QtCore import QMimeData [as 别名]
# 或者: from PyQt4.QtCore.QMimeData import setUrls [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

示例3: startDrag

# 需要导入模块: from PyQt4.QtCore import QMimeData [as 别名]
# 或者: from PyQt4.QtCore.QMimeData import setUrls [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

示例4: dragFile

# 需要导入模块: from PyQt4.QtCore import QMimeData [as 别名]
# 或者: from PyQt4.QtCore.QMimeData import setUrls [as 别名]
def dragFile(widget, filename, icon=None, dropactions=Qt.CopyAction):
    """Starts dragging the given local file from the widget."""
    if icon is None or icon.isNull():
        icon = QFileIconProvider().icon(QFileInfo(filename))
    drag = QDrag(widget)
    data = QMimeData()
    data.setUrls([QUrl.fromLocalFile(filename)])
    drag.setMimeData(data)
    drag.setPixmap(icon.pixmap(32))
    drag.exec_(dropactions)
开发者ID:EdwardBetts,项目名称:frescobaldi,代码行数:12,代码来源:drag.py

示例5: mimeData

# 需要导入模块: from PyQt4.QtCore import QMimeData [as 别名]
# 或者: from PyQt4.QtCore.QMimeData import setUrls [as 别名]
 def mimeData(self, indexes):
     lst = QgsMimeDataUtils.UriList
     for index in indexes:
         if index.isValid():
             if index.type() == QgsDataItem.Project:
                 mimeData = QMimeData()
                 url = QUrl.fromLocalFile(index.path())
                 mimeData.setUrls([url])
                 return mimeData
             if index.type() == QgsDataItem.Layer:
                 lst.append(QgsMimeDataUtils.Uri(index))
     return QgsMimeDataUtils.encodeUriList(lst)
开发者ID:lparchaeology,项目名称:ArkPlan,代码行数:14,代码来源:project_model.py

示例6: mousePressEvent

# 需要导入模块: from PyQt4.QtCore import QMimeData [as 别名]
# 或者: from PyQt4.QtCore.QMimeData import setUrls [as 别名]
	def mousePressEvent(self, e):

		"""
		Start a drag operation

		Arguments:
		e -- a QMouseEvent
		"""

		if e.button() == Qt.RightButton:
			item = self.itemAt(e.pos())
			if item == None:
				return
			note = item.zoteroItem.get_note()
			if note != None:
				self.qnotero.previewNote(note)
			return

		QListWidget.mousePressEvent(self, e)
		qnoteroItem = self.currentItem()
		if qnoteroItem == None:
			return
		if not hasattr(qnoteroItem, "zoteroItem"):
			return
		zoteroItem = qnoteroItem.zoteroItem
		if zoteroItem.fulltext == None:
			return
		
		path = zoteroItem.fulltext.encode("latin-1")
		tmpName = '%s.pdf' % zoteroItem.filename_format()
		tmpFile = os.path.join(tempfile.gettempdir(), tmpName)
		suffix = 1
		while os.path.exists(tmpFile):
			tmpName = '%s-%d.pdf' % (zoteroItem.filename_format(), suffix)
			tmpFile = os.path.join(tempfile.gettempdir(), tmpName)			
			suffix += 1
		try:
			shutil.copy(path, tmpFile)
		except:
			print "qnoteroResults.mousePressEvent(): failed to copy file, sorry..."
			return
			
		print "qnoteroResults.mousePressEvent(): prepare to copy %s" % path
		print "qnoteroResults.mousePressEvent(): prepare to copy (tmp) %s" \
			% tmpFile
		mimeData = QMimeData()
		mimeData.setUrls([QUrl.fromLocalFile(tmpFile)])
		mimeData.setData("text/plain", tmpFile)
		drag = QDrag(self)
		drag.setMimeData(mimeData)
		drag.exec_(Qt.CopyAction)
开发者ID:arne-cl,项目名称:qnotero,代码行数:53,代码来源:qnoteroResults.py

示例7: mousePressEvent

# 需要导入模块: from PyQt4.QtCore import QMimeData [as 别名]
# 或者: from PyQt4.QtCore.QMimeData import setUrls [as 别名]
    def mousePressEvent(self, event):

        if event.button() == Qt.LeftButton:

            drag = QDrag(self)
            data = QMimeData()
            data.setData("text/plain", str(self.text()))

            path = QDir.tempPath() + "/hello.txt"
            f = open(path, "w")
            f.write("Hello world!")
            f.close()
            data.setUrls([QUrl.fromLocalFile(path)])
            drag.setMimeData(data)
            drag.exec_()
开发者ID:notmikeb,项目名称:workspace,代码行数:17,代码来源:qt6.py

示例8: startDrag

# 需要导入模块: from PyQt4.QtCore import QMimeData [as 别名]
# 或者: from PyQt4.QtCore.QMimeData import setUrls [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

示例9: _drag_urls

# 需要导入模块: from PyQt4.QtCore import QMimeData [as 别名]
# 或者: from PyQt4.QtCore.QMimeData import setUrls [as 别名]
    def _drag_urls ( self, urls ):
        mime_data = QMimeData()
        mime_data.setUrls( urls )

        return mime_data
开发者ID:davidmorrill,项目名称:facets,代码行数:7,代码来源:control.py

示例10: _drag_files

# 需要导入模块: from PyQt4.QtCore import QMimeData [as 别名]
# 或者: from PyQt4.QtCore.QMimeData import setUrls [as 别名]
    def _drag_files ( self, files ):
        mime_data = QMimeData()
        mime_data.setUrls( [ QUrl( file ) for file in files ] )

        return mime_data
开发者ID:davidmorrill,项目名称:facets,代码行数:7,代码来源:control.py


注:本文中的PyQt4.QtCore.QMimeData.setUrls方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。