當前位置: 首頁>>代碼示例>>Python>>正文


Python QtCore.QPoint方法代碼示例

本文整理匯總了Python中PyQt4.QtCore.QPoint方法的典型用法代碼示例。如果您正苦於以下問題:Python QtCore.QPoint方法的具體用法?Python QtCore.QPoint怎麽用?Python QtCore.QPoint使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PyQt4.QtCore的用法示例。


在下文中一共展示了QtCore.QPoint方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: readSettings

# 需要導入模塊: from PyQt4 import QtCore [as 別名]
# 或者: from PyQt4.QtCore import QPoint [as 別名]
def readSettings(self):
        """ Load settings from previous session """
        rospy.logdebug("Loading previous session settings")
        settings = QSettings("omwdunkley", "reset" if self.options.reset else "flieROS"+str(self.options.radio) )
        self.resize(settings.value("size", QVariant(QSize(300, 500))).toSize())
        self.move(settings.value("pos", QVariant(QPoint(200, 200))).toPoint())

        self.ui.checkBox_reconnect.setChecked(settings.value("autoReconnect", QVariant(self.ui.checkBox_reconnect.isChecked())).toBool())
        self.ui.checkBox_beep.setChecked(settings.value("beepOn", QVariant(self.ui.checkBox_beep.isChecked())).toBool())
        self.ui.checkBox_xmode.setChecked(settings.value("xmodeOn", QVariant(self.ui.checkBox_xmode.isChecked())).toBool())
        self.ui.checkBox_kill.setChecked(settings.value("killOn", QVariant(self.ui.checkBox_kill.isChecked())).toBool())
        self.ui.checkBox_startupConnect.setChecked(settings.value("startConnect", QVariant(self.ui.checkBox_startupConnect)).toBool())

        self.ui.checkBox_pktHZ.setChecked(settings.value("pktHzOn", QVariant(self.ui.checkBox_pktHZ.isChecked())).toBool())
        self.ui.checkBox_logHZ.setChecked(settings.value("logHzOn", QVariant(self.ui.checkBox_logHZ.isChecked())).toBool())
        self.ui.horizontalSlider_pktHZ.setValue(settings.value("pktHzVal", QVariant(self.ui.horizontalSlider_pktHZ.value())).toInt()[0])
        self.ui.horizontalSlider_logHZ.setValue(settings.value("logHzVal", QVariant(self.ui.horizontalSlider_logHZ.value())).toInt()[0])
        self.ui.horizontalSlider_guiHZ.setValue(settings.value("guiHzVal", QVariant(self.ui.horizontalSlider_guiHZ.value())).toInt()[0])
        self.ui.horizontalSlider_AI.setValue(settings.value("aiHzVal", QVariant(self.ui.horizontalSlider_AI.value())).toInt()[0])

        self.logManager.header().restoreState(settings.value("logTreeH", self.logManager.header().saveState()).toByteArray())
        self.paramManager.header().restoreState(settings.value("paramTreeH", self.paramManager.header().saveState()).toByteArray()) 
開發者ID:omwdunkley,項目名稱:crazyflieROS,代碼行數:24,代碼來源:driverWindow.py

示例2: centerScaleRect

# 需要導入模塊: from PyQt4 import QtCore [as 別名]
# 或者: from PyQt4.QtCore import QPoint [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

示例3: __init__

# 需要導入模塊: from PyQt4 import QtCore [as 別名]
# 或者: from PyQt4.QtCore import QPoint [as 別名]
def __init__(self, parent=None, title="", collapsed=False):
            QtGui.QFrame.__init__(self, parent=parent)

            self.setMinimumHeight(24)
            self.move(QtCore.QPoint(24, 0))
            self.setStyleSheet("border:1px solid rgb(41, 41, 41); ")

            self._hlayout = QtGui.QHBoxLayout(self)
            self._hlayout.setContentsMargins(0, 0, 0, 0)
            self._hlayout.setSpacing(0)

            self._arrow = None
            self._title = None

            self._hlayout.addWidget(self.initArrow(collapsed))
            self._hlayout.addWidget(self.initTitle(title)) 
開發者ID:By0ute,項目名稱:pyqt-collapsible-widget,代碼行數:18,代碼來源:FrameLayout.py

示例4: minimizeWindows

# 需要導入模塊: from PyQt4 import QtCore [as 別名]
# 或者: from PyQt4.QtCore import QPoint [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

示例5: findPoint

# 需要導入模塊: from PyQt4 import QtCore [as 別名]
# 或者: from PyQt4.QtCore import QPoint [as 別名]
def findPoint(self, name):
		return self._findPoint(name, QPoint, int) 
開發者ID:blurstudio,項目名稱:cross3d,代碼行數:4,代碼來源:xmlelement.py

示例6: dropEvent

# 需要導入模塊: from PyQt4 import QtCore [as 別名]
# 或者: from PyQt4.QtCore import QPoint [as 別名]
def dropEvent(self, e):
        # get relative position of mouse from mimedata
        mime = e.mimeData().text()
        x, y = map(int, mime.split(','))

        e.source().move(e.pos() - QtCore.QPoint(x, y))
        e.setDropAction(QtCore.Qt.MoveAction)
        e.accept() 
開發者ID:brendan-w,項目名稱:pihud,代碼行數:10,代碼來源:Page.py

示例7: position

# 需要導入模塊: from PyQt4 import QtCore [as 別名]
# 或者: from PyQt4.QtCore import QPoint [as 別名]
def position(self):
        return QtCore.QPoint(self.config['x'], self.config['y']) 
開發者ID:brendan-w,項目名稱:pihud,代碼行數:4,代碼來源:Widget.py

示例8: paintEvent

# 需要導入模塊: from PyQt4 import QtCore [as 別名]
# 或者: from PyQt4.QtCore import QPoint [as 別名]
def paintEvent(self, event):
        '''Rasterize each of the tiles on to the output image display'''
        painter = QtGui.QPainter()
        with self.qttiles_lock:
            painter.begin(self)
            for key in self.qttiles.keys():
                if key[0] != self.level:
                    continue
                image = self.qttiles[key]
                xpos  = key[1] * image.width()  + self.origin_x
                ypos  = key[2] * image.height() + self.origin_y
                painter.drawImage(QtCore.QPoint(xpos, ypos), image)
            painter.end() 
開發者ID:nasa,項目名稱:CrisisMappingToolkit,代碼行數:15,代碼來源:mapclient_qt.py

示例9: initTitle

# 需要導入模塊: from PyQt4 import QtCore [as 別名]
# 或者: from PyQt4.QtCore import QPoint [as 別名]
def initTitle(self, title=None):
            self._title = QtGui.QLabel(title)
            self._title.setMinimumHeight(24)
            self._title.move(QtCore.QPoint(24, 0))
            self._title.setStyleSheet("border:0px")

            return self._title 
開發者ID:By0ute,項目名稱:pyqt-collapsible-widget,代碼行數:9,代碼來源:FrameLayout.py

示例10: _subplot_clicked

# 需要導入模塊: from PyQt4 import QtCore [as 別名]
# 或者: from PyQt4.QtCore import QPoint [as 別名]
def _subplot_clicked(self, event):
        keys = event['key']

        if self._context.indicators and event['button'] == 1 and not keys:
            x = int(event['x'])
            y = int(event['y'])
            slice_model = self._get_slice_view(event).model()
            self._context.update_index_for_direction(slice_model.x_index_direction, x)
            self._context.update_index_for_direction(slice_model.y_index_direction, y)

        elif event['button'] == 3 and (not keys or keys.state(ctrl=True)):
            subplot_index = event['subplot_index']
            context_menu = self._create_slice_view_context_menu(subplot_index)
            context_menu.exec_(self.mapToGlobal(QPoint(event['mx'], self.height() - event['my']))) 
開發者ID:equinor,項目名稱:segyviewer,代碼行數:16,代碼來源:sliceviewwidget.py

示例11: drawDrawRect

# 需要導入模塊: from PyQt4 import QtCore [as 別名]
# 或者: from PyQt4.QtCore import QPoint [as 別名]
def drawDrawRect(self, qp):

        qp.save()
        qp.setBrush(QtGui.QBrush(QtCore.Qt.NoBrush))
        qp.setFont(QtGui.QFont('QFont::AnyStyle', 14))
        thickPen = QtGui.QPen()
        qp.setPen(thickPen)

        for c in self.corrections:
            rect = copy.deepcopy(c.bbox)

            width = rect.width()
            height = rect.height()
            rect.setX(c.bbox.x() * self.scale + self.xoff)
            rect.setY(c.bbox.y() * self.scale + self.yoff)

            rect.setWidth(width * self.scale)
            rect.setHeight(height * self.scale)

            if c.selected:
                thickPen.setColor(QtGui.QColor(0,0,0))
                if c.type == CorrectionBox.types.QUESTION:
                    descr = "QUESTION"
                elif c.type == CorrectionBox.types.RESOLVED:
                    descr = "FIXED"
                else:
                    descr = "ERROR"
                qp.setPen(thickPen)
                qp.drawText(QtCore.QPoint( self.xoff, self.yoff + self.h + 20 ),
                                           "(%s: %s)" % (descr, c.annotation))
                pen_width = 6
            else:
                pen_width = 3

            colour = c.get_colour()
            thickPen.setColor(colour)
            thickPen.setWidth(pen_width)
            qp.setPen(thickPen)
            qp.drawRect(rect)

        if self.in_progress_bbox is not None:
            rect = copy.deepcopy(self.in_progress_bbox)
            width = rect.width()
            height = rect.height()
            rect.setX(self.in_progress_bbox.x() * self.scale + self.xoff)
            rect.setY(self.in_progress_bbox.y() * self.scale + self.yoff)

            rect.setWidth(width * self.scale)
            rect.setHeight(height * self.scale)

            thickPen.setColor(QtGui.QColor(255,0,0))
            thickPen.setWidth(3)
            qp.setPen(thickPen)
            qp.drawRect(rect)


        qp.restore()

    # Draw the polygon that is drawn and edited by the user
    # Usually the polygon must be rescaled properly. However when drawing
    # The polygon within the zoom, this is not needed. Therefore the option transform. 
開發者ID:pierluigiferrari,項目名稱:fcn8s_tensorflow,代碼行數:63,代碼來源:cityscapesLabelTool.py

示例12: drawLabelAtMouse

# 需要導入模塊: from PyQt4 import QtCore [as 別名]
# 或者: from PyQt4.QtCore import QPoint [as 別名]
def drawLabelAtMouse(self, qp):
        # Nothing to do without a highlighted object
        if not self.highlightObjs:
            return
        # Also we do not want to draw the label, if we have a drawn polygon
        if not self.drawPoly.isEmpty():
            return
        # Nothing to without a mouse position
        if not self.mousePos:
            return

        # Save QPainter settings to stack
        qp.save()

        # That is the mouse positiong
        mouse = self.mousePos

        # Will show zoom
        showZoom = self.config.zoom and not self.image.isNull() and self.w and self.h

        # The text that is written next to the mouse
        mouseText = self.highlightObjs[-1].label

        # Where to write the text
        # Depends on the zoom (additional offset to mouse to make space for zoom?)
        # The location in the image (if we are at the top we want to write below of the mouse)
        off = 36
        if showZoom:
            off += self.config.zoomSize/2
        if mouse.y()-off > self.toolbar.height():
            top = mouse.y()-off
            btm = mouse.y()
            vAlign = QtCore.Qt.AlignTop
        else:
            # The height of the cursor
            if not showZoom:
                off += 20
            top = mouse.y()
            btm = mouse.y()+off
            vAlign = QtCore.Qt.AlignBottom

        # Here we can draw
        rect = QtCore.QRect()
        rect.setTopLeft(QtCore.QPoint(mouse.x()-100,top))
        rect.setBottomRight(QtCore.QPoint(mouse.x()+100,btm))

        # The color
        qp.setPen(QtGui.QColor('white'))
        # The font to use
        font = QtGui.QFont("Helvetica",20,QtGui.QFont.Bold)
        qp.setFont(font)
        # Non-transparent
        qp.setOpacity(1)
        # Draw the text, horizontally centered
        qp.drawText(rect,QtCore.Qt.AlignHCenter|vAlign,mouseText)
        # Restore settings
        qp.restore()

    # Draw the zoom 
開發者ID:pierluigiferrari,項目名稱:fcn8s_tensorflow,代碼行數:61,代碼來源:cityscapesLabelTool.py

示例13: drawLabelAtMouse

# 需要導入模塊: from PyQt4 import QtCore [as 別名]
# 或者: from PyQt4.QtCore import QPoint [as 別名]
def drawLabelAtMouse(self, qp):
        # Nothing to do without a highlighted object
        if not self.highlightObj:
            return
        # Nothing to without a mouse position
        if not self.mousePosOrig:
            return

        # Save QPainter settings to stack
        qp.save()

        # That is the mouse positiong
        mouse = self.mousePosOrig

        # Will show zoom
        showZoom = self.zoom and not self.image.isNull() and self.w and self.h

        # The text that is written next to the mouse
        mouseText = self.highlightObj.label

        # Where to write the text
        # Depends on the zoom (additional offset to mouse to make space for zoom?)
        # The location in the image (if we are at the top we want to write below of the mouse)
        off = 36
        if showZoom:
            off += self.zoomSize/2
        if mouse.y()-off > self.toolbar.height():
            top = mouse.y()-off
            btm = mouse.y()
            vAlign = QtCore.Qt.AlignTop
        else:
            # The height of the cursor
            if not showZoom:
                off += 20
            top = mouse.y()
            btm = mouse.y()+off
            vAlign = QtCore.Qt.AlignBottom

        # Here we can draw
        rect = QtCore.QRect()
        rect.setTopLeft(QtCore.QPoint(mouse.x()-200,top))
        rect.setBottomRight(QtCore.QPoint(mouse.x()+200,btm))

        # The color
        qp.setPen(QtGui.QColor('white'))
        # The font to use
        font = QtGui.QFont("Helvetica",20,QtGui.QFont.Bold)
        qp.setFont(font)
        # Non-transparent
        qp.setOpacity(1)
        # Draw the text, horizontally centered
        qp.drawText(rect,QtCore.Qt.AlignHCenter|vAlign,mouseText)
        # Restore settings
        qp.restore()

    # Draw the zoom 
開發者ID:pierluigiferrari,項目名稱:fcn8s_tensorflow,代碼行數:58,代碼來源:cityscapesViewer.py


注:本文中的PyQt4.QtCore.QPoint方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。