示例#1
0
def screen_info(widget):
    """Format information on the screens"""
    policy = QGuiApplication.highDpiScaleFactorRoundingPolicy()
    policy_string = str(policy).split('.')[-1]
    result = "<p>High DPI scale factor rounding policy: {}</p><ol>".format(
        policy_string)
    for screen in QGuiApplication.screens():
        current = screen == widget.screen()
        result += "<li>"
        if current:
            result += "<i>"
        result += '"{}" {} {}DPI, DPR={}'.format(
            screen.name(), format_geometry(screen.geometry()),
            int(screen.logicalDotsPerInchX()), screen.devicePixelRatio())
        if current:
            result += "</i>"
        result += "</li>"
    result += "</ol>"
    return result