• PySide 模块
  • PySide.QtGui
  • 内容表

    上一话题

    QRegExpValidator

    下一话题

    QIntValidator

    QDoubleValidator

    概要

    函数

    虚函数

    详细描述

    PySide.QtGui.QDoubleValidator class provides range checking of floating-point numbers.

    PySide.QtGui.QDoubleValidator provides an upper bound, a lower bound, and a limit on the number of digits after the decimal point. It does not provide a PySide.QtGui.QValidator.fixup() 函数。

    You can set the acceptable range in one call with PySide.QtGui.QDoubleValidator.setRange() , or with PySide.QtGui.QDoubleValidator.setBottom() and PySide.QtGui.QDoubleValidator.setTop() . Set the number of decimal places with PySide.QtGui.QDoubleValidator.setDecimals() PySide.QtGui.QDoubleValidator.validate() function returns the validation state.

    PySide.QtGui.QDoubleValidator uses its PySide.QtGui.QValidator.locale() to interpret the number. For example, in the German locale, “1,234” will be accepted as the fractional number 1.234. In Arabic locales, PySide.QtGui.QDoubleValidator will accept Arabic digits.

    此外, PySide.QtGui.QDoubleValidator is always guaranteed to accept a number formatted according to the “C” locale. PySide.QtGui.QDoubleValidator will not accept numbers with thousand-separators.

    class PySide.QtGui. QDoubleValidator ( [ parent=None ] )
    class PySide.QtGui. QDoubleValidator ( bottom , top , decimals [ , parent=None ] )
    参数:
    • decimals PySide.QtCore.int
    • bottom PySide.QtCore.double
    • parent PySide.QtCore.QObject
    • top PySide.QtCore.double

    Constructs a validator object with a parent object that accepts any double.

    Constructs a validator object with a parent object. This validator will accept doubles from bottom to top inclusive, with up to decimals digits after the decimal point.

    PySide.QtGui.QDoubleValidator. Notation

    This enum defines the allowed notations for entering a double.

    常量 描述
    QDoubleValidator.StandardNotation The string is written as a standard number (i.e. 0.015).
    QDoubleValidator.ScientificNotation The string is written in scientific form. It may have an exponent part(i.e. 1.5E-2).
    PySide.QtGui.QDoubleValidator. bottom ( )
    返回类型: PySide.QtCore.double

    This property holds the validator's minimum acceptable value.

    By default, this property contains a value of -infinity.

    PySide.QtGui.QDoubleValidator. decimals ( )
    返回类型: PySide.QtCore.int

    This property holds the validator's maximum number of digits after the decimal point.

    By default, this property contains a value of 1000.

    PySide.QtGui.QDoubleValidator. notation ( )
    返回类型: PySide.QtGui.QDoubleValidator.Notation

    This property holds the notation of how a string can describe a number.

    默认情况下,此特性被设为 ScientificNotation .

    另请参阅

    QDoubleValidator.Notation

    PySide.QtGui.QDoubleValidator. setBottom ( arg__1 )
    参数: arg__1 PySide.QtCore.double

    This property holds the validator's minimum acceptable value.

    By default, this property contains a value of -infinity.

    PySide.QtGui.QDoubleValidator. setDecimals ( arg__1 )
    参数: arg__1 PySide.QtCore.int

    This property holds the validator's maximum number of digits after the decimal point.

    By default, this property contains a value of 1000.

    PySide.QtGui.QDoubleValidator. setNotation ( arg__1 )
    参数: arg__1 PySide.QtGui.QDoubleValidator.Notation

    This property holds the notation of how a string can describe a number.

    默认情况下,此特性被设为 ScientificNotation .

    另请参阅

    QDoubleValidator.Notation

    PySide.QtGui.QDoubleValidator. setRange ( bottom , top [ , decimals=0 ] )
    参数:
    • bottom PySide.QtCore.double
    • top PySide.QtCore.double
    • decimals PySide.QtCore.int

    Sets the validator to accept doubles from minimum to maximum inclusive, with at most decimals digits after the decimal point.

    PySide.QtGui.QDoubleValidator. setTop ( arg__1 )
    参数: arg__1 PySide.QtCore.double

    This property holds the validator's maximum acceptable value.

    By default, this property contains a value of infinity.

    PySide.QtGui.QDoubleValidator. top ( )
    返回类型: PySide.QtCore.double

    This property holds the validator's maximum acceptable value.

    By default, this property contains a value of infinity.