内容表

上一话题

QDesktopServices

下一话题

QDrag

QDoubleValidator

QDoubleValidator class provides range checking of floating-point numbers. 更多

Inheritance diagram of PySide2.QtGui.QDoubleValidator

概要

函数

虚函数

信号

详细描述

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 fixup() 函数。

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

QDoubleValidator uses its 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, QDoubleValidator will accept Arabic digits.

注意

NumberOptions set on the locale() also affect the way the number is interpreted. For example, since RejectGroupSeparator is not set by default, the validator will accept group separators. It is thus recommended to use toDouble() to obtain the numeric value.

class QDoubleValidator ( [ parent=None ] )

QDoubleValidator(bottom, top, decimals[, parent=None])

param parent

QObject

param bottom

double

param top

double

param decimals

int

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.

PySide2.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).

PySide2.QtGui.QDoubleValidator. bottom ( )
返回类型

double

另请参阅

setBottom()

PySide2.QtGui.QDoubleValidator. bottomChanged ( bottom )
参数

bottom double

PySide2.QtGui.QDoubleValidator. decimals ( )
返回类型

int

另请参阅

setDecimals()

PySide2.QtGui.QDoubleValidator. decimalsChanged ( decimals )
参数

decimals int

PySide2.QtGui.QDoubleValidator. notation ( )
返回类型

Notation

另请参阅

setNotation()

PySide2.QtGui.QDoubleValidator. notationChanged ( notation )
参数

notation Notation

PySide2.QtGui.QDoubleValidator. setBottom ( arg__1 )
参数

arg__1 double

另请参阅

bottom()

PySide2.QtGui.QDoubleValidator. setDecimals ( arg__1 )
参数

arg__1 int

另请参阅

decimals()

PySide2.QtGui.QDoubleValidator. setNotation ( arg__1 )
参数

arg__1 Notation

另请参阅

notation()

PySide2.QtGui.QDoubleValidator. setRange ( bottom , top [ , decimals=0 ] )
参数
  • bottom double

  • top double

  • decimals int

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

PySide2.QtGui.QDoubleValidator. setTop ( arg__1 )
参数

arg__1 double

另请参阅

top()

PySide2.QtGui.QDoubleValidator. top ( )
返回类型

double

另请参阅

setTop()

PySide2.QtGui.QDoubleValidator. topChanged ( top )
参数

top double