本文整理汇总了Python中PyQt4.QtCore.QDataStream.writeQString方法的典型用法代码示例。如果您正苦于以下问题:Python QDataStream.writeQString方法的具体用法?Python QDataStream.writeQString怎么用?Python QDataStream.writeQString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtCore.QDataStream
的用法示例。
在下文中一共展示了QDataStream.writeQString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: mimeData
# 需要导入模块: from PyQt4.QtCore import QDataStream [as 别名]
# 或者: from PyQt4.QtCore.QDataStream import writeQString [as 别名]
def mimeData(self, indexes):
mime_data = QMimeData()
encoded_data = QByteArray()
stream = QDataStream(encoded_data, QIODevice.WriteOnly)
ref = self.get_current_branch() or self.get_remote_ref()
for index in indexes:
if index.isValid() and index.column() == 0:
text = QString(ref.name + " ")
text += QString(str(index.row()))
stream.writeQString(text)
mime_data.setData("application/vnd.text.list", encoded_data)
return mime_data
示例2: mimeData
# 需要导入模块: from PyQt4.QtCore import QDataStream [as 别名]
# 或者: from PyQt4.QtCore.QDataStream import writeQString [as 别名]
def mimeData(self, indexes):
mimeData = QMimeData()
encodedData = QByteArray()
stream = QDataStream(encodedData, QIODevice.WriteOnly)
for index in indexes:
if not index.isValid():
continue
if not isinstance(index.internalPointer(), TableItem):
continue
table = self.getItem(index)
stream.writeQString(table.mimeUri())
mimeData.setData(self.QGIS_URI_MIME, encodedData)
return mimeData
示例3: startDrag
# 需要导入模块: from PyQt4.QtCore import QDataStream [as 别名]
# 或者: from PyQt4.QtCore.QDataStream import writeQString [as 别名]
def startDrag(self, drop_actions):
selected_doc_items = self.selectedItems()
data = QByteArray()
stream = QDataStream(data, QIODevice.WriteOnly)
for doc_item in selected_doc_items:
stream.writeQString(doc_item.text() + ":" + doc_item.get_full_name())
mimeData = QMimeData()
mimeData.setData("application/x-doc-list", data)
drag = QDrag(self)
drag.setMimeData(mimeData)
drag.setHotSpot(QPoint(0, 0))
if drag.start(Qt.MoveAction) == Qt.MoveAction:
docs = []
for doc_item in selected_doc_items:
# self.takeItem(self.row(doc_item))
docs.append(doc_item.text())
self.emit(SIGNAL("removeDocs"), docs)
示例4: mouseMoveEvent
# 需要导入模块: from PyQt4.QtCore import QDataStream [as 别名]
# 或者: from PyQt4.QtCore.QDataStream import writeQString [as 别名]
def mouseMoveEvent(self, event):
if not (event.buttons() and Qt.LeftButton):
return
currentItem = self.currentItem()
if(currentItem.isFile()):
if(currentItem.isPic()):
currentItemName = self.currentItem().getPath()
data = QByteArray()
stream = QDataStream(data, QIODevice.WriteOnly)
stream.writeQString(currentItemName)
icon = Icons.image
pixmap = icon.pixmap(64, 64)
mimeData = QMimeData()
mimeData.setText(currentItemName)
mimeData.setData('application/x-item', data)
drag = QDrag(self)
drag.setPixmap(pixmap)
drag.setHotSpot(QPoint(pixmap.width()/2, pixmap.height()/2))
drag.setMimeData(mimeData)
dropAction = drag.start(Qt.CopyAction)