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


Python QtGui.QGraphicsView方法代码示例

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


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

示例1: createWidget_recent

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QGraphicsView [as 别名]
def createWidget_recent(self,listWidget,uin,flag):
        self.listWidgetItem = QtGui.QListWidgetItem(listWidget)
        self.listWidgetItem.setSizeHint(QtCore.QSize(0, 48))
        self.widget = QtGui.QWidget()
        self.widget.setProperty('uin',str(uin)+':'+str(flag))
        self.widget.setGeometry(QtCore.QRect(0, 0, 238, 51))
        self.graphicsView_recent[uin] = QtGui.QGraphicsView(self.widget)
        self.graphicsView_recent[uin].setGeometry(QtCore.QRect(1, 1, 60, 60))
        if flag==0:
            self.graphicsView_recent[uin].setScene(self.createImg('user',uin))
            title=self.userdict[uin]['nickname']
        if flag==1:
            title=self.groupdict[uin]['name']
            self.graphicsView_recent[uin].setScene(self.createImg('group',uin))
        if flag==2:
            title=self.discussdict[uin]['name']
            self.graphicsView_recent[uin].setScene(self.createImg('discuss',uin))
        self.graphicsView_recent[uin].resize(50,50)
        self.lbl_title = QtGui.QLabel(self.widget)
        self.lbl_title.setGeometry(QtCore.QRect(60, 10, 181, 18))
        self.lbl_title.setFont(self.font2)
        self.lbl_title.setText(_translate("Main", title, None))
        return self.listWidgetItem, self.widget 
开发者ID:younfor,项目名称:PyLinuxQQ,代码行数:25,代码来源:guiMainQQ.py

示例2: createWidget

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QGraphicsView [as 别名]
def createWidget(self,listWidget, title,markname,uin):
        self.listWidgetItem = QtGui.QListWidgetItem(listWidget)
        self.listWidgetItem.setSizeHint(QtCore.QSize(0, 48))
        self.widget = QtGui.QWidget()
        self.widget.setProperty('uin',uin)
        self.widget.setGeometry(QtCore.QRect(0, 0, 238, 51))
        self.graphicsView[uin] = QtGui.QGraphicsView(self.widget)
        self.graphicsView[uin].setGeometry(QtCore.QRect(1, 1, 38, 38))
        self.lbl_title = QtGui.QLabel(self.widget)
        self.lbl_title.setGeometry(QtCore.QRect(60, 10, 181, 18))
        self.lbl_title.setFont(self.font2)
        if markname != 'None':
            title=markname+'('+title+')'
        self.lbl_title.setText(_translate("Main", title, None))
        self.lbl_comment = QtGui.QLabel(self.widget)
        self.lbl_comment.setGeometry(QtCore.QRect(60, 30, 181, 18))
        info=self.userdict.get(uin)
        if info['online']:
            self.lbl_comment.setText(_translate("Main", '[在线]', None))
        else:
            self.lbl_comment.setText(_translate("Main", '[离线]', None))
        self.lbl_comment.setFont(self.font3)
        return self.listWidgetItem, self.widget 
开发者ID:younfor,项目名称:PyLinuxQQ,代码行数:25,代码来源:guiMainQQ.py

示例3: createWidget_group

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QGraphicsView [as 别名]
def createWidget_group(self,listWidget,title,guin,flag):
        self.listWidgetItem = QtGui.QListWidgetItem(listWidget)
        self.listWidgetItem.setSizeHint(QtCore.QSize(0, 48))
        self.widget = QtGui.QWidget()
        self.widget.setProperty('uin',guin)
        self.widget.setGeometry(QtCore.QRect(0, 0, 238, 51))
        self.graphicsView_group[guin] = QtGui.QGraphicsView(self.widget)
        self.graphicsView_group[guin].setGeometry(QtCore.QRect(1, 1, 60, 60))
        self.graphicsView_group[guin].setScene(self.createImg(flag,guin))
        self.graphicsView_group[guin].resize(50,50)
        self.lbl_title = QtGui.QLabel(self.widget)
        self.lbl_title.setGeometry(QtCore.QRect(60, 10, 181, 18))
        self.lbl_title.setFont(self.font2)
        self.lbl_title.setText(_translate("Main", title, None))
        return self.listWidgetItem, self.widget 
开发者ID:younfor,项目名称:PyLinuxQQ,代码行数:17,代码来源:guiMainQQ.py

示例4: __init__

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QGraphicsView [as 别名]
def __init__(self, tabletName, parent=None):
        QtGui.QWidget.__init__(self, parent)
        self.setFixedSize(250, 300)
        self.scene = QtGui.QGraphicsScene()
        self.scene.setBspTreeDepth(1)
        self.view = QtGui.QGraphicsView(self.scene)
        self.view.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
        self.view.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
        self.tabletName = tabletName
        self.info = pressureInfo(self.tabletName)

        splitter = QtGui.QSplitter(QtCore.Qt.Vertical)
        splitter.addWidget(self.view)
        splitter.addWidget(self.info)
        splitter.setSizes([200, 50])
        splitter.handle(0).setEnabled(False)
        splitter.handle(1).setEnabled(False)
        #print splitter.count()

        testLayout = QtGui.QVBoxLayout()
        testLayout.setAlignment(QtCore.Qt.AlignBottom)
        testLayout.addWidget(splitter)
        self.setLayout(testLayout)
        self.blank = QtGui.QPixmap(250,250)
        self.blank.fill(QtCore.Qt.white)
        self.pixmap_item = QtGui.QGraphicsPixmapItem(self.blank, None, self.scene) 
开发者ID:tb2097,项目名称:wacom-gui,代码行数:28,代码来源:pressure.py

示例5: setupUi

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QGraphicsView [as 别名]
def setupUi(self, login):
        login.setObjectName(_fromUtf8("login"))
        login.setEnabled(True)
        login.resize(257, 235)
        login.setSizeIncrement(QtCore.QSize(0, 0))
        login.setWindowOpacity(1.0)
        self.text_user = QtGui.QLineEdit(login)
        self.text_user.setGeometry(QtCore.QRect(70, 20, 113, 28))
        self.text_user.setObjectName(_fromUtf8("text_user"))
        self.text_pwd = QtGui.QLineEdit(login)
        self.text_pwd.setGeometry(QtCore.QRect(70, 60, 113, 28))
        self.text_pwd.setObjectName(_fromUtf8("text_pwd"))
        self.text_code = QtGui.QLineEdit(login)
        self.text_code.setGeometry(QtCore.QRect(70, 100, 113, 28))
        self.text_code.setObjectName(_fromUtf8("text_code"))
        self.btn_login = QtGui.QPushButton(login)
        self.btn_login.setGeometry(QtCore.QRect(20, 190, 93, 27))
        self.btn_login.setObjectName(_fromUtf8("btn_login"))
        self.btn_cancel = QtGui.QPushButton(login)
        self.btn_cancel.setGeometry(QtCore.QRect(140, 190, 93, 27))
        self.btn_cancel.setObjectName(_fromUtf8("btn_cancel"))
        self.lbl_user = QtGui.QLabel(login)
        self.lbl_user.setGeometry(QtCore.QRect(30, 30, 51, 21))
        self.lbl_user.setObjectName(_fromUtf8("lbl_user"))
        self.lbl_pwd = QtGui.QLabel(login)
        self.lbl_pwd.setGeometry(QtCore.QRect(30, 70, 63, 18))
        self.lbl_pwd.setObjectName(_fromUtf8("lbl_pwd"))
        
        self.lbl_code = QtGui.QLabel(login)
        self.lbl_code.setGeometry(QtCore.QRect(20, 110, 63, 18))
        self.lbl_code.setObjectName(_fromUtf8("lbl_code"))
        
        self.img_code = QtGui.QGraphicsView(login)
        self.img_code.setEnabled(True)
        self.img_code.setGeometry(QtCore.QRect(60, 130, 120, 50))
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(1)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.img_code.sizePolicy().hasHeightForWidth())
        self.img_code.setSizePolicy(sizePolicy)
        self.img_code.setMaximumSize(QtCore.QSize(120, 50))
        self.img_code.setAutoFillBackground(True)
        self.img_code.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
        self.img_code.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
        self.img_code.setObjectName(_fromUtf8("img_code"))

        self.retranslateUi(login)
        QtCore.QObject.connect(self.text_user, QtCore.SIGNAL(_fromUtf8("editingFinished()")), login.loadCode)
        QtCore.QObject.connect(self.btn_login, QtCore.SIGNAL(_fromUtf8("clicked()")), login.checkLogin)
        QtCore.QObject.connect(self.btn_cancel, QtCore.SIGNAL(_fromUtf8("clicked()")), login.close)
        QtCore.QMetaObject.connectSlotsByName(login) 
开发者ID:younfor,项目名称:PyLinuxQQ,代码行数:53,代码来源:guiQQ.py

示例6: createWidget

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QGraphicsView [as 别名]
def createWidget(self, style, listWidget, chat_msg,uin,flag=0,g_sender=None):
        self.listWidgetItem = QtGui.QListWidgetItem(listWidget)
        self.listWidgetItem.setSizeHint(QtCore.QSize(0, 50))
        self.widget = QtGui.QWidget()
        self.graphicsView = QtGui.QGraphicsView(self.widget)
        self.label = QtGui.QTextBrowser(self.widget)
        self.label.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
        orient=''
        if flag==0:
            ruin=uin
        else:
            ruin=g_sender
            print 'img senderuin:',ruin
        if style == 0:
            self.widget.setGeometry(QtCore.QRect(0, 10, 455, 50))
            self.graphicsView.setGeometry(QtCore.QRect(5, 5, 60, 60))
            self.graphicsView.setScene(self.createImg(ruin,flag,g_sender))
            self.graphicsView.resize(50,50)
            self.label.setGeometry(QtCore.QRect(50, 5, 390, 50))
            orient='left'
        elif style == 1:
            self.widget.setGeometry(QtCore.QRect(0, 10, 455, 50))
            self.graphicsView.setGeometry(QtCore.QRect(392, 5, 60, 60))
            self.graphicsView.setScene(self.createImg(ruin,flag,g_sender))
            self.graphicsView.resize(50,50)
            self.label.setGeometry(QtCore.QRect(10, 5, 390, 50))
            orient='right'
        # msg edit
        if flag==1:
            nick=self.groupInfo[uin][g_sender]['nick']
        if flag==2:
            nick=self.discussInfo[uin][g_sender]['nick']
        if flag==1 or flag==2:
            chat_msg=u'<p><b>'+nick+'</b></p><p>'+chat_msg+'</p>'
        content = u'''
<html><body><p align="'''+orient+'''"> ''' + chat_msg + '''</p></body></html>
        '''
        doc = QtGui.QTextDocument(self.label)
        doc.setHtml(content)
        self.label.setDocument(doc)
        # resize
        size = max(self.label.document().size().height() + 5, 50)
        self.listWidgetItem.setSizeHint(QtCore.QSize(445, size))
        self.widget.resize(455, size)
        self.label.resize(380, size)
        return self.listWidgetItem, self.widget 
开发者ID:younfor,项目名称:PyLinuxQQ,代码行数:48,代码来源:guiChatQQ.py


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