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


Python QRect.intersected方法代码示例

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


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

示例1: dropdown_popup_geometry

# 需要导入模块: from AnyQt.QtCore import QRect [as 别名]
# 或者: from AnyQt.QtCore.QRect import intersected [as 别名]
def dropdown_popup_geometry(geometry, origin, screen):
    # type: (QRect, QRect, QRect) -> QRect
    """
    Move/constrain the geometry for a drop down popup.

    Parameters
    ----------
    geometry : QRect
        The base popup geometry if not constrained.
    origin : QRect
        The origin rect from which the popup extends.
    screen : QRect
        The available screen geometry into which the popup must fit.

    Returns
    -------
    geometry: QRect
        Constrained drop down list geometry to fit into  screen
    """
    # if the popup  geometry extends bellow the screen and there is more room
    # above the popup origin ...
    geometry = QRect(geometry)
    geometry.moveTopLeft(origin.bottomLeft() + QPoint(0, 1))

    if geometry.bottom() > screen.bottom() \
            and origin.center().y() > screen.center().y():
        # ...flip the rect about the origin so it extends upwards
        geometry.moveBottom(origin.top() - 1)

    # fixup horizontal position if it extends outside the screen
    if geometry.left() < screen.left():
        geometry.moveLeft(screen.left())
    if geometry.right() > screen.right():
        geometry.moveRight(screen.right())

    # bounded by screen geometry
    return geometry.intersected(screen)
开发者ID:PrimozGodec,项目名称:orange3,代码行数:39,代码来源:combobox.py


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