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


Python QtCore.QPoint方法代码示例

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


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

示例1: saveScreenshot

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QPoint [as 别名]
def saveScreenshot(self, clipboard=False, fileName='screenshot.png', picType='png'):
        fullWindow = QRect(0, 0, self.width() - 1, self.height() - 1)
        selected = QRect(self.selected_area)
        if selected.left() < 0:
            selected.setLeft(0)
        if selected.right() >= self.width():
            selected.setRight(self.width() - 1)
        if selected.top() < 0:
            selected.setTop(0)
        if selected.bottom() >= self.height():
            selected.setBottom(self.height() - 1)

        source = (fullWindow & selected)
        source.setTopLeft(QPoint(source.topLeft().x() * self.scale, source.topLeft().y() * self.scale))
        source.setBottomRight(QPoint(source.bottomRight().x() * self.scale, source.bottomRight().y() * self.scale))
        image = self.screenPixel.copy(source)

        if clipboard:
            QGuiApplication.clipboard().setImage(QImage(image), QClipboard.Clipboard)
        else:
            image.save(fileName, picType, 10)
        self.target_img = image
        self.screen_shot_grabed.emit(QImage(image)) 
开发者ID:SeptemberHX,项目名称:screenshot,代码行数:25,代码来源:screenshot.py

示例2: drawSizeInfo

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QPoint [as 别名]
def drawSizeInfo(self):
        sizeInfoAreaWidth = 200
        sizeInfoAreaHeight = 30
        spacing = 5
        rect = self.selected_area.normalized()
        sizeInfoArea = QRect(rect.left(), rect.top() - spacing - sizeInfoAreaHeight,
                             sizeInfoAreaWidth, sizeInfoAreaHeight)

        if sizeInfoArea.top() < 0:
            sizeInfoArea.moveTopLeft(rect.topLeft() + QPoint(spacing, spacing))
        if sizeInfoArea.right() >= self.screenPixel.width():
            sizeInfoArea.moveTopLeft(rect.topLeft() - QPoint(spacing, spacing) - QPoint(sizeInfoAreaWidth, 0))
        if sizeInfoArea.left() < spacing:
            sizeInfoArea.moveLeft(spacing)
        if sizeInfoArea.top() < spacing:
            sizeInfoArea.moveTop(spacing)

        self.items_to_remove.append(self.graphics_scene.addRect(QRectF(sizeInfoArea), Qt.white, QBrush(Qt.black)))

        sizeInfo = self.graphics_scene.addSimpleText(
            '  {0} x {1}'.format(rect.width() * self.scale, rect.height() * self.scale))
        sizeInfo.setPos(sizeInfoArea.topLeft() + QPoint(0, 2))
        sizeInfo.setPen(QPen(QColor(255, 255, 255), 2))
        self.items_to_remove.append(sizeInfo) 
开发者ID:SeptemberHX,项目名称:screenshot,代码行数:26,代码来源:screenshot.py

示例3: __init__

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QPoint [as 别名]
def __init__(self, parent=None):
        super(GLElectrode, self).__init__(parent)

        self.electrode_object = 0
        self.plug_object = 0
        self.center_dir = 0

        self.xRot = 3160
        self.yRot = 5536
        self.zRot = 0
        self.zoom = 1.0

        self.electrode_placeholder = sim_struct.ELECTRODE()
        self.electrode_placeholder.dimensions = [0.0, 0.0]
        self.electrode_placeholder.thickness = [0.0]

        self.lastPos = QtCore.QPoint() 
开发者ID:simnibs,项目名称:simnibs,代码行数:19,代码来源:electrodeGUI.py

示例4: mouseDoubleClickEvent

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QPoint [as 别名]
def mouseDoubleClickEvent(self, event):
        if isinstance(self.skin_surf,  surface.Surface):
            self.lastPos = QtCore.QPoint(event.pos())
            x = float(self.lastPos.x())
            y = float(self.view[3] - self.lastPos.y())
            Near = GLU.gluUnProject(
                x, y, 0.,
                self.model_matrix, self.projection_matrix, self.view)
            Far = GLU.gluUnProject(
                x, y, 1.,
                self.model_matrix, self.projection_matrix, self.view)
            self.intersect_point, self.intersect_normal = self.skin_surf.interceptRay(Near, Far)
            if self.intersect_point is not None:
                self.indicator = self.drawIndicator(self.intersect_point, self.intersect_normal)
                self.update()
            self.windowClicked.emit(1) 
开发者ID:simnibs,项目名称:simnibs,代码行数:18,代码来源:head_model_OGL.py

示例5: __init__

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QPoint [as 别名]
def __init__(self, geometry=None, *, scroll=None, plaintext=None,
                 html=None, parent=None, zoom=1.0):
        """Constructor.

        Args:
            geometry: The geometry of the frame as QRect.
            scroll: The scroll position as QPoint.
            plaintext: Return value of toPlainText
            html: Return value of tohtml.
            zoom: The zoom factor.
            parent: The parent frame.
        """
        if scroll is None:
            scroll = QPoint(0, 0)
        self.geometry = mock.Mock(return_value=geometry)
        self.scrollPosition = mock.Mock(return_value=scroll)
        self.parentFrame = mock.Mock(return_value=parent)
        self.toPlainText = mock.Mock(return_value=plaintext)
        self.toHtml = mock.Mock(return_value=html)
        self.zoomFactor = mock.Mock(return_value=zoom) 
开发者ID:qutebrowser,项目名称:qutebrowser,代码行数:22,代码来源:stubs.py

示例6: load_items

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QPoint [as 别名]
def load_items(self, items):
        if items:
            self._tab.before_load_started.emit(items[-1].url)

        stream, _data, user_data = tabhistory.serialize(items)
        qtutils.deserialize_stream(stream, self._history)
        for i, data in enumerate(user_data):
            self._history.itemAt(i).setUserData(data)
        cur_data = self._history.currentItem().userData()
        if cur_data is not None:
            if 'zoom' in cur_data:
                self._tab.zoom.set_factor(cur_data['zoom'])
            if ('scroll-pos' in cur_data and
                    self._tab.scroller.pos_px() == QPoint(0, 0)):
                QTimer.singleShot(0, functools.partial(
                    self._tab.scroller.to_point, cur_data['scroll-pos'])) 
开发者ID:qutebrowser,项目名称:qutebrowser,代码行数:18,代码来源:webkittab.py

示例7: __init__

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QPoint [as 别名]
def __init__(self, persepolis_setting):
        super().__init__(persepolis_setting)

        self.persepolis_setting = persepolis_setting

        # setting window size and position
        size = self.persepolis_setting.value(
            'AboutWindow/size', QSize(545, 375))
        position = self.persepolis_setting.value(
            'AboutWindow/position', QPoint(300, 300))

        # read translators.txt files.
        # this file contains all translators.
        f = QFile(':/translators.txt')

        f.open(QIODevice.ReadOnly | QFile.Text)
        f_text = QTextStream(f).readAll()
        f.close()

        self.translators_textEdit.insertPlainText(f_text)



        self.resize(size)
        self.move(position) 
开发者ID:persepolisdm,项目名称:persepolis,代码行数:27,代码来源:about.py

示例8: __init__

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QPoint [as 别名]
def __init__(self, parent=None):
        super(QWidget, self).__init__(parent)
        self.ui = Ui_FeatureExtraction()
        self._source_path = ''
        self._cur_pattern_item = 0

        self.logger = eclog(os.path.split(__file__)[-1]).GetLogger()
        folder, _ = os.path.split(os.path.abspath(sys.argv[0]))
        self.radiomics_config_path = folder + '/RadiomicsParams.yaml'

        self.ui.setupUi(self)
        self.ui.buttonBrowseSourceFolder.clicked.connect(self.BrowseSourceFolder)
        self.ui.buttonBrowseRoiFile.clicked.connect(self.BrowseRoiFile)
        self.ui.buttonAdd.clicked.connect(self.onButtonAddClicked)
        self.ui.listWidgetImageFiles.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
        self.ui.listWidgetImageFiles.customContextMenuRequested[QtCore.QPoint].connect(
            self.onListImageFilesContextMenuRequested)
        self.ui.buttonBrowseFile.clicked.connect(self.BrowsePatternFile)
        self.ui.buttonBrowseOutputFile.clicked.connect(self.BrowseOutputFile)
        self.radiomics_params = RadiomicsParamsConfig(self.radiomics_config_path)
        self.ui.buttonGo.clicked.connect(self.Go)
        self.InitUi()
        self.check_background_color = "background-color:rgba(255,0,0,64)"
        self.raw_background_color = "background-color:rgba(25,35,45,255)" 
开发者ID:salan668,项目名称:FAE,代码行数:26,代码来源:FeatureExtractionForm.py

示例9: __init__

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QPoint [as 别名]
def __init__(self, parent=None):
        super(DragButton, self).__init__(parent)

    # def mouseMoveEvent(self, event):
        # self.startDrag()
        # QtWidgets.QToolButton.mouseMoveEvent(self, event)

    # def startDrag(self):
        # if self.icon().isNull():
        #     return
        # data = QtCore.QByteArray()
        # stream = QtCore.QDataStream(data, QtCore.QIODevice.WriteOnly)
        # stream << self.icon()
        # mimeData = QtCore.QMimeData()
        # mimeData.setData("application/x-equipment", data)
        # drag = QtGui.QDrag(self)
        # drag.setMimeData(mimeData)
        # pixmap = self.icon().pixmap(24, 24)
        # drag.setHotSpot(QtCore.QPoint(12, 12))
        # drag.setPixmap(pixmap)
        # drag.exec_(QtCore.Qt.CopyAction) 
开发者ID:jjgomera,项目名称:pychemqt,代码行数:23,代码来源:widgets.py

示例10: __init__

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QPoint [as 别名]
def __init__(self, parent = None):
        super().__init__(parent)

        self.setFlag(QQuickItem.ItemHasContents)

        self._arrow_size = 0
        self._color = QColor(255, 255, 255, 255)
        self._target = QPoint(0,0)
        self._border_width = 0
        self._border_color = QColor(0, 0, 0, 255)

        self._geometry = None
        self._material = None
        self._node = None
        self._border_geometry = None
        self._border_material = None
        self._border_node = None 
开发者ID:Ultimaker,项目名称:Uranium,代码行数:19,代码来源:PointingRectangle.py

示例11: drawChart

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QPoint [as 别名]
def drawChart(self, qp: QtGui.QPainter):
        centerX = int(self.width()/2)
        centerY = int(self.height()/2)
        qp.setPen(QtGui.QPen(self.textColor))
        qp.drawText(3, 15, self.name)
        qp.setPen(QtGui.QPen(self.foregroundColor))
        qp.drawEllipse(QtCore.QPoint(centerX, centerY),
                       int(self.chartWidth / 2),
                       int(self.chartHeight / 2))
        qp.drawEllipse(QtCore.QPoint(centerX, centerY),
                       int(self.chartWidth / 4),
                       int(self.chartHeight / 4))
        qp.drawLine(centerX - int(self.chartWidth / 2), centerY,
                    centerX + int(self.chartWidth / 2), centerY)
        qp.drawLine(centerX, centerY - int(self.chartHeight / 2),
                    centerX, centerY + int(self.chartHeight / 2))
        qp.drawLine(centerX + int(self.chartHeight / 2 * math.sin(math.pi / 4)),
                    centerY + int(self.chartHeight / 2 * math.sin(math.pi / 4)),
                    centerX - int(self.chartHeight / 2 * math.sin(math.pi / 4)),
                    centerY - int(self.chartHeight / 2 * math.sin(math.pi / 4)))
        qp.drawLine(centerX + int(self.chartHeight / 2 * math.sin(math.pi / 4)),
                    centerY - int(self.chartHeight / 2 * math.sin(math.pi / 4)),
                    centerX - int(self.chartHeight / 2 * math.sin(math.pi / 4)),
                    centerY + int(self.chartHeight / 2 * math.sin(math.pi / 4)))
        self.drawTitle(qp) 
开发者ID:NanoVNA-Saver,项目名称:nanovna-saver,代码行数:27,代码来源:Polar.py

示例12: load_settings

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QPoint [as 别名]
def load_settings(self):
        self.settings = AppSettings()
        with self.settings.main_window() as group:
            size = group.get("size", QSize(1000, 800))
            position = group.get("position", QPoint(300, 300))
        with self.settings.application() as group:
            chunk_directory = group.get("chunk_directory", None)
            mod_directory = group.get("mod_directory", None)
            lang = group.get("lang", None)
        with self.settings.import_export() as group:
            self.import_export_default_attrs = {
                key: group.get(key, "").split(";")
                for key in group.childKeys()
            }
        # apply settings
        self.resize(size)
        self.move(position)
        if chunk_directory:
            self.chunk_directory.set_path(chunk_directory)
        if mod_directory:
            self.mod_directory.set_path(mod_directory)
        if lang:
            self.handle_set_lang_action(lang) 
开发者ID:fre-sch,项目名称:mhw_armor_edit,代码行数:25,代码来源:suite.py

示例13: animationOut

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QPoint [as 别名]
def animationOut(self):
        """离开动画
        """
        self.animIn.stop()  # 停止进入动画
        geometry = self.widget.geometry()
        if self.direction == self.LEFT:
            # 左侧抽屉
            self.animOut.setStartValue(geometry.topLeft())
            self.animOut.setEndValue(QPoint(-self.widget.width(), 0))
            self.animOut.start()
        elif self.direction == self.TOP:
            # 上方抽屉
            self.animOut.setStartValue(QPoint(0, geometry.y()))
            self.animOut.setEndValue(QPoint(0, -self.widget.height()))
            self.animOut.start()
        elif self.direction == self.RIGHT:
            # 右侧抽屉
            self.animOut.setStartValue(QPoint(geometry.x(), 0))
            self.animOut.setEndValue(QPoint(self.width(), 0))
            self.animOut.start()
        elif self.direction == self.BOTTOM:
            # 下方抽屉
            self.animOut.setStartValue(QPoint(0, geometry.y()))
            self.animOut.setEndValue(QPoint(0, self.height()))
            self.animOut.start() 
开发者ID:PyQt5,项目名称:CustomWidgets,代码行数:27,代码来源:CDrawer.py

示例14: mousePressEvent

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QPoint [as 别名]
def mousePressEvent(self, event):
        self.lastPos = QtCore.QPoint(event.pos()) 
开发者ID:simnibs,项目名称:simnibs,代码行数:4,代码来源:electrodeGUI.py

示例15: mouseMoveEvent

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QPoint [as 别名]
def mouseMoveEvent(self, event):
        dx = event.x() - self.lastPos.x()
        dy = event.y() - self.lastPos.y()

        if event.buttons() & QtCore.Qt.LeftButton:
            self.setXRotation(self.xRot - 8 * dy)
            self.setYRotation(self.yRot - 8 * dx)
        elif event.buttons() & QtCore.Qt.RightButton:
            self.setXRotation(self.xRot - 8 * dy)
            self.setZRotation(self.zRot - 8 * dx)

        self.lastPos = QtCore.QPoint(event.pos()) 
开发者ID:simnibs,项目名称:simnibs,代码行数:14,代码来源:electrodeGUI.py


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