當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。