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


Python QtCore.QRect方法代码示例

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


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

示例1: drawDisp

# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QRect [as 别名]
def drawDisp( self , qp ):
        if not self.dispOverlay:
            return

        # Save QPainter settings to stack
        qp.save()
        # Define transparency
        qp.setOpacity(self.transp)
        # Draw the overlay image
        qp.drawImage(QtCore.QRect( self.xoff, self.yoff, self.w, self.h ),self.dispOverlay)
        # Restore settings
        qp.restore()

        return self.dispOverlay



    #############################
    ## Mouse/keyboard events
    #############################

    # Mouse moved
    # Need to save the mouse position
    # Need to drag a polygon point
    # Need to update the mouse selected object 
开发者ID:pierluigiferrari,项目名称:fcn8s_tensorflow,代码行数:27,代码来源:cityscapesViewer.py

示例2: doLayout

# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QRect [as 别名]
def doLayout(self, rect, testOnly):
        x = rect.x()
        y = rect.y()
        lineHeight = 0

        for item in self.itemList:
            wid = item.widget()
            spaceX = self.spacing() + wid.style().layoutSpacing(QtGui.QSizePolicy.PushButton,
                                                                QtGui.QSizePolicy.PushButton, QtCore.Qt.Horizontal)
            spaceY = self.spacing() + wid.style().layoutSpacing(QtGui.QSizePolicy.PushButton,
                                                                QtGui.QSizePolicy.PushButton, QtCore.Qt.Vertical)
            nextX = x + item.sizeHint().width() + spaceX
            if nextX - spaceX > rect.right() and lineHeight > 0:
                x = rect.x()
                y = y + lineHeight + spaceY
                nextX = x + item.sizeHint().width() + spaceX
                lineHeight = 0

            if not testOnly:
                item.setGeometry(QtCore.QRect(QtCore.QPoint(x, y), item.sizeHint()))

            x = nextX
            lineHeight = max(lineHeight, item.sizeHint().height())

        return y + lineHeight - rect.y() 
开发者ID:doctorguile,项目名称:pyqtggpo,代码行数:27,代码来源:emoticonsdialog.py

示例3: drawDisp

# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QRect [as 别名]
def drawDisp( self , qp ):
        if not self.dispOverlay:
            return 

        # Save QPainter settings to stack
        qp.save()
        # Define transparency
        qp.setOpacity(self.transp)
        # Draw the overlay image
        qp.drawImage(QtCore.QRect( self.xoff, self.yoff, self.w, self.h ),self.dispOverlay)
        # Restore settings
        qp.restore()

        return self.dispOverlay



    #############################
    ## Mouse/keyboard events
    #############################

    # Mouse moved
    # Need to save the mouse position
    # Need to drag a polygon point
    # Need to update the mouse selected object 
开发者ID:renmengye,项目名称:rec-attend-public,代码行数:27,代码来源:cityscapesViewer.py

示例4: registerCmap

# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QRect [as 别名]
def registerCmap(self):
        """ Add matplotlib cmaps to the GradientEditors context menu"""
        self.gradientEditorItem.menu.addSeparator()
        savedLength = self.gradientEditorItem.length
        self.gradientEditorItem.length = 100
        
        
        for name in self.mplColorMaps:
            px = QPixmap(100, 15)
            p = QPainter(px)
            self.gradientEditorItem.restoreState(self.mplColorMaps[name])
            grad = self.gradientEditorItem.getGradient()
            brush = QBrush(grad)
            p.fillRect(QtCore.QRect(0, 0, 100, 15), brush)
            p.end()
            label = QLabel()
            label.setPixmap(px)
            label.setContentsMargins(1, 1, 1, 1)
            act =QWidgetAction(self.gradientEditorItem)
            act.setDefaultWidget(label)
            act.triggered.connect(self.cmapClicked)
            act.name = name
            self.gradientEditorItem.menu.addAction(act)
        self.gradientEditorItem.length = savedLength 
开发者ID:qkitgroup,项目名称:qkit,代码行数:26,代码来源:PlotWindow.py

示例5: centerScaleRect

# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QRect [as 别名]
def centerScaleRect(rect, scale):
        """
        centerScaleRect(QRect rect, float scale) -> QRect scaled

        Takes a QRect and a float scale value, and returns a copy 
        of the rect that has been scaled around the center point. 
        """
        scaledRect = QtCore.QRect(rect)

        size    = scaledRect.size()
        pos     = scaledRect.center()
        
        offset  = QtCore.QPoint(
                        pos.x() - (size.width()*.5), 
                        pos.y() - (size.height()*.5))

        scaledRect.moveCenter(offset)
        scaledRect.setSize(size * scale)
        scaledRect.moveCenter(pos)

        return scaledRect 
开发者ID:justinfx,项目名称:tutorials,代码行数:23,代码来源:gauge.py

示例6: doLayout

# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QRect [as 别名]
def doLayout(self, rect, testOnly):
        x = rect.x()
        y = rect.y()
        lineHeight = 0

        for item in self.itemList:
            wid = item.widget()
            spaceX = self.spacing() + wid.style().layoutSpacing(QtGui.QSizePolicy.PushButton, QtGui.QSizePolicy.PushButton, QtCore.Qt.Horizontal)
            spaceY = self.spacing() + wid.style().layoutSpacing(QtGui.QSizePolicy.PushButton, QtGui.QSizePolicy.PushButton, QtCore.Qt.Vertical)
            nextX = x + item.sizeHint().width() + spaceX
            if nextX - spaceX > rect.right() and lineHeight > 0:
                x = rect.x()
                y = y + lineHeight + spaceY
                nextX = x + item.sizeHint().width() + spaceX
                lineHeight = 0

            if not testOnly:
                item.setGeometry(QtCore.QRect(QtCore.QPoint(x, y), item.sizeHint()))

            x = nextX
            lineHeight = max(lineHeight, item.sizeHint().height())

        return y + lineHeight - rect.y() 
开发者ID:justinfx,项目名称:tutorials,代码行数:25,代码来源:flowlayout.py

示例7: setupUi

# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QRect [as 别名]
def setupUi(self, Dialog):
        Dialog.setObjectName(_fromUtf8("Dialog"))
        Dialog.resize(400, 300)
        self.pushButton = QtGui.QPushButton(Dialog)
        self.pushButton.setGeometry(QtCore.QRect(250, 140, 75, 23))
        self.pushButton.setObjectName(_fromUtf8("pushButton"))
        self.lineEdit = QtGui.QLineEdit(Dialog)
        self.lineEdit.setGeometry(QtCore.QRect(50, 140, 191, 20))
        self.lineEdit.setObjectName(_fromUtf8("lineEdit"))
        self.label = QtGui.QLabel(Dialog)
        self.label.setGeometry(QtCore.QRect(100, 180, 201, 51))
        font = QtGui.QFont()
        font.setPointSize(20)
        self.label.setFont(font)
        self.label.setObjectName(_fromUtf8("label"))

        self.retranslateUi(Dialog)
        QtCore.QMetaObject.connectSlotsByName(Dialog) 
开发者ID:reza-arjmandi,项目名称:rpi-course,代码行数:20,代码来源:gui.py

示例8: setupUi

# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QRect [as 别名]
def setupUi(self, MainWindow):
        MainWindow.setObjectName(_fromUtf8("MainWindow"))
        MainWindow.resize(400, 240)
        self.centralwidget = QtGui.QWidget(MainWindow)
        self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
        self.checkBox = QtGui.QCheckBox(self.centralwidget)
        self.checkBox.setGeometry(QtCore.QRect(130, 80, 151, 41))
        font = QtGui.QFont()
        font.setPointSize(32)
        self.checkBox.setFont(font)
        self.checkBox.setObjectName(_fromUtf8("checkBox"))
        #MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtGui.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 400, 21))
        self.menubar.setObjectName(_fromUtf8("menubar"))
        #MainWindow.setMenuBar(self.menubar)
        self.statusbar = QtGui.QStatusBar(MainWindow)
        self.statusbar.setObjectName(_fromUtf8("statusbar"))
        #MainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow) 
开发者ID:reza-arjmandi,项目名称:rpi-course,代码行数:24,代码来源:gui_switch.py

示例9: showCode

# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QRect [as 别名]
def showCode(self):
        pixmap = QtGui.QPixmap()
        pixmap.load("api/code.jpg")
        pixmap.scaledToHeight(60)
        pixmap.scaledToWidth(120)
        self.scene_code = QtGui.QGraphicsScene(self)
        item = QtGui.QGraphicsPixmapItem(pixmap)
        self.scene_code.addItem(item)
        self.ui.img_code.setScene(self.scene_code)
        self.resize(257, 235)
        self.ui.lbl_code.setGeometry(QtCore.QRect(20, 110, 63, 18))
        self.ui.text_code.setGeometry(QtCore.QRect(70, 100, 113, 28))
        self.ui.img_code.setGeometry(QtCore.QRect(60, 130, 120, 50))
        self.ui.btn_login.setGeometry(QtCore.QRect(20, 190, 93, 27))
        self.ui.btn_cancel.setGeometry(QtCore.QRect(140, 190, 93, 27))
        self.ui.lbl_code.show()
        self.ui.text_code.show()
        self.ui.img_code.show()

# chat 
开发者ID:younfor,项目名称:PyLinuxQQ,代码行数:22,代码来源:run.py

示例10: createWidget_recent

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

示例11: drawImage

# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QRect [as 别名]
def drawImage(self, qp):
        # Return if no image available
        if self.image.isNull():
            return

        # Save the painters current setting to a stack
        qp.save()
        # Draw the image
        qp.drawImage(QtCore.QRect( self.xoff, self.yoff, self.w, self.h ), self.image)
        # Restore the saved setting from the stack
        qp.restore() 
开发者ID:pierluigiferrari,项目名称:fcn8s_tensorflow,代码行数:13,代码来源:cityscapesLabelTool.py

示例12: setupUi

# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QRect [as 别名]
def setupUi(self, Form):
        Form.setObjectName(_fromUtf8("Form"))
        Form.resize(529, 329)
        self.selInfoWidget = QtGui.QWidget(Form)
        self.selInfoWidget.setGeometry(QtCore.QRect(260, 10, 264, 222))
        self.selInfoWidget.setObjectName(_fromUtf8("selInfoWidget"))
        self.gridLayout = QtGui.QGridLayout(self.selInfoWidget)
        self.gridLayout.setMargin(0)
        self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
        self.selDescLabel = QtGui.QLabel(self.selInfoWidget)
        self.selDescLabel.setText(_fromUtf8(""))
        self.selDescLabel.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop)
        self.selDescLabel.setWordWrap(True)
        self.selDescLabel.setObjectName(_fromUtf8("selDescLabel"))
        self.gridLayout.addWidget(self.selDescLabel, 0, 0, 1, 1)
        self.selNameLabel = QtGui.QLabel(self.selInfoWidget)
        font = QtGui.QFont()
        font.setBold(True)
        font.setWeight(75)
        self.selNameLabel.setFont(font)
        self.selNameLabel.setText(_fromUtf8(""))
        self.selNameLabel.setObjectName(_fromUtf8("selNameLabel"))
        self.gridLayout.addWidget(self.selNameLabel, 0, 1, 1, 1)
        self.selectedTree = DataTreeWidget(self.selInfoWidget)
        self.selectedTree.setObjectName(_fromUtf8("selectedTree"))
        self.selectedTree.headerItem().setText(0, _fromUtf8("1"))
        self.gridLayout.addWidget(self.selectedTree, 1, 0, 1, 2)
        self.hoverText = QtGui.QTextEdit(Form)
        self.hoverText.setGeometry(QtCore.QRect(0, 240, 521, 81))
        self.hoverText.setObjectName(_fromUtf8("hoverText"))
        self.view = FlowchartGraphicsView(Form)
        self.view.setGeometry(QtCore.QRect(0, 0, 256, 192))
        self.view.setObjectName(_fromUtf8("view"))

        self.retranslateUi(Form)
        QtCore.QMetaObject.connectSlotsByName(Form) 
开发者ID:SrikanthVelpuri,项目名称:tf-pose,代码行数:38,代码来源:FlowchartTemplate_pyqt.py

示例13: heightForWidth

# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QRect [as 别名]
def heightForWidth(self, width):
        height = self.doLayout(QtCore.QRect(0, 0, width, 0), True)
        return height 
开发者ID:doctorguile,项目名称:pyqtggpo,代码行数:5,代码来源:emoticonsdialog.py

示例14: minimizeWindows

# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QRect [as 别名]
def minimizeWindows(self, id):
		hwnds = []
		maxHwnd = GetWindowHandle()
		threadID = GetCurrentThreadId()
		EnumThreadWindows( threadID, self.EnumWindowsProc, hwnds)
		pnt = ClientToScreen(id,(5,5))
		pnt = QPoint(pnt[0], pnt[1])
		for hwnd in hwnds:
			if hwnd != maxHwnd:
				rect = GetWindowRect(hwnd)
				if QRect(QPoint(rect[0], rect[1]), QPoint(rect[2], rect[3])).contains(pnt) and IsWindowVisible(hwnd):
#					print hwnd, GetWindowRect(hwnd), GetWindowText(hwnd), GetClassName(hwnd), IsWindowVisible(hwnd)
					self.minimzedWindows.append(hwnd)
					ShowWindow( hwnd, win32con.SW_MINIMIZE ) 
开发者ID:blurstudio,项目名称:cross3d,代码行数:16,代码来源:rescaletime.py

示例15: findRect

# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QRect [as 别名]
def findRect( self, name ):
		from PyQt4.QtCore import QRect
		return self._findRect( name, QRect, int ) 
开发者ID:blurstudio,项目名称:cross3d,代码行数:5,代码来源:xmlelement.py


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