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


Python QDataStream.writeQString方法代码示例

本文整理汇总了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
开发者ID:mike-perdide,项目名称:gitbuster,代码行数:17,代码来源:q_git_model.py

示例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
开发者ID:Br1ndavoine,项目名称:QGIS,代码行数:18,代码来源:db_model.py

示例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)
开发者ID:FlyBoy8869,项目名称:AssemblyDocTracker,代码行数:23,代码来源:document_list_widget.py

示例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)
开发者ID:pyros2097,项目名称:SabelIDE,代码行数:25,代码来源:tree.py


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