本文整理汇总了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())
示例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
示例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))
示例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 )
示例5: findPoint
# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QPoint [as 别名]
def findPoint(self, name):
return self._findPoint(name, QPoint, int)
示例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()
示例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'])
示例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()
示例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
示例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'])))
示例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.
示例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
示例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