Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > a6711891ce757817bba854bf3f25205a > files > 2444

qtjambi-doc-4.3.3-3mdv2008.1.i586.rpm

<class name="QValidator" doc="/**
&lt;p&gt;The &lt;a href=&quot;QValidator.html#QValidator(com.trolltech.qt.core.QObject)&quot;&gt;&lt;tt&gt;QValidator&lt;/tt&gt;&lt;/a&gt; class provides validation of input text.&lt;/p&gt;
&lt;p&gt;The class itself is abstract. Two subclasses, &lt;a href=&quot;QIntValidator.html&quot;&gt;&lt;tt&gt;QIntValidator&lt;/tt&gt;&lt;/a&gt; and &lt;a href=&quot;QDoubleValidator.html&quot;&gt;&lt;tt&gt;QDoubleValidator&lt;/tt&gt;&lt;/a&gt;, provide basic numeric-range checking, and &lt;a href=&quot;QRegExpValidator.html&quot;&gt;&lt;tt&gt;QRegExpValidator&lt;/tt&gt;&lt;/a&gt; provides general checking using a custom regular expression.&lt;/p&gt;
&lt;p&gt;If the built-in validators aren't sufficient, you can subclass &lt;a href=&quot;QValidator.html#QValidator(com.trolltech.qt.core.QObject)&quot;&gt;&lt;tt&gt;QValidator&lt;/tt&gt;&lt;/a&gt;. The class has two virtual functions: &lt;a href=&quot;QValidator.html#validate(com.trolltech.qt.gui.QValidator.QValidationData)&quot;&gt;&lt;tt&gt;validate&lt;/tt&gt;&lt;/a&gt; and &lt;a href=&quot;QValidator.html#fixup(java.lang.String)&quot;&gt;&lt;tt&gt;fixup&lt;/tt&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;QValidator.html#validate(com.trolltech.qt.gui.QValidator.QValidationData)&quot;&gt;&lt;tt&gt;validate&lt;/tt&gt;&lt;/a&gt; must be implemented by every subclass. It returns &lt;a href=&quot;QValidator.html#State-enum&quot;&gt;Invalid&lt;/tt&gt;&lt;/a&gt;, &lt;a href=&quot;QValidator.html#State-enum&quot;&gt;Intermediate&lt;/tt&gt;&lt;/a&gt; or &lt;a href=&quot;QValidator.html#State-enum&quot;&gt;Acceptable&lt;/tt&gt;&lt;/a&gt; depending on whether its argument is valid (for the subclass's definition of valid).&lt;/p&gt;
&lt;p&gt;These three states require some explanation. An &lt;a href=&quot;QValidator.html#State-enum&quot;&gt;Invalid&lt;/tt&gt;&lt;/a&gt; string is &lt;i&gt;clearly&lt;/i&gt; invalid. &lt;a href=&quot;QValidator.html#State-enum&quot;&gt;Intermediate&lt;/tt&gt;&lt;/a&gt; is less obvious: the concept of validity is difficult to apply when the string is incomplete (still being edited). &lt;a href=&quot;QValidator.html#QValidator(com.trolltech.qt.core.QObject)&quot;&gt;&lt;tt&gt;QValidator&lt;/tt&gt;&lt;/a&gt; defines &lt;a href=&quot;QValidator.html#State-enum&quot;&gt;Intermediate&lt;/tt&gt;&lt;/a&gt; as the property of a string that is neither clearly invalid nor acceptable as a final result. &lt;a href=&quot;QValidator.html#State-enum&quot;&gt;Acceptable&lt;/tt&gt;&lt;/a&gt; means that the string is acceptable as a final result. One might say that any string that is a plausible intermediate state during entry of an &lt;a href=&quot;QValidator.html#State-enum&quot;&gt;Acceptable&lt;/tt&gt;&lt;/a&gt; string is &lt;a href=&quot;QValidator.html#State-enum&quot;&gt;Intermediate&lt;/tt&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Here are some examples:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;For a line edit that accepts integers from 10 to 999 inclusive, 42 and 123 are &lt;a href=&quot;QValidator.html#State-enum&quot;&gt;Acceptable&lt;/tt&gt;&lt;/a&gt;, the empty string and 5 are &lt;a href=&quot;QValidator.html#State-enum&quot;&gt;Intermediate&lt;/tt&gt;&lt;/a&gt;, and &amp;quot;asdf&amp;quot; and 1114 is &lt;a href=&quot;QValidator.html#State-enum&quot;&gt;Invalid&lt;/tt&gt;&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;For an editable combobox that accepts URLs, any well-formed URL is &lt;a href=&quot;QValidator.html#State-enum&quot;&gt;Acceptable&lt;/tt&gt;&lt;/a&gt;, &amp;quot;http://www.trolltech.com/,&amp;quot; is &lt;a href=&quot;QValidator.html#State-enum&quot;&gt;Intermediate&lt;/tt&gt;&lt;/a&gt; (it might be a cut and paste action that accidentally took in a comma at the end), the empty string is &lt;a href=&quot;QValidator.html#State-enum&quot;&gt;Intermediate&lt;/tt&gt;&lt;/a&gt; (the user might select and delete all of the text in preparation for entering a new URL) and &amp;quot;http:///./&amp;quot; is &lt;a href=&quot;QValidator.html#State-enum&quot;&gt;Invalid&lt;/tt&gt;&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;For a spin box that accepts lengths, &amp;quot;11cm&amp;quot; and &amp;quot;1in&amp;quot; are &lt;a href=&quot;QValidator.html#State-enum&quot;&gt;Acceptable&lt;/tt&gt;&lt;/a&gt;, &amp;quot;11&amp;quot; and the empty string are &lt;a href=&quot;QValidator.html#State-enum&quot;&gt;Intermediate&lt;/tt&gt;&lt;/a&gt;, and &amp;quot;http://www.trolltech.com&amp;quot; and &amp;quot;hour&amp;quot; are &lt;a href=&quot;QValidator.html#State-enum&quot;&gt;Invalid&lt;/tt&gt;&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a href=&quot;QValidator.html#fixup(java.lang.String)&quot;&gt;&lt;tt&gt;fixup&lt;/tt&gt;&lt;/a&gt; is provided for validators that can repair some user errors. The default implementation does nothing. &lt;a href=&quot;QLineEdit.html&quot;&gt;&lt;tt&gt;QLineEdit&lt;/tt&gt;&lt;/a&gt;, for example, will call &lt;a href=&quot;QValidator.html#fixup(java.lang.String)&quot;&gt;&lt;tt&gt;fixup&lt;/tt&gt;&lt;/a&gt; if the user presses Enter (or Return) and the content is not currently valid. This allows the &lt;a href=&quot;QValidator.html#fixup(java.lang.String)&quot;&gt;&lt;tt&gt;fixup&lt;/tt&gt;&lt;/a&gt; function the opportunity of performing some magic to make an &lt;a href=&quot;QValidator.html#State-enum&quot;&gt;Invalid&lt;/tt&gt;&lt;/a&gt; string &lt;a href=&quot;QValidator.html#State-enum&quot;&gt;Acceptable&lt;/tt&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;A validator has a locale, set with &lt;a href=&quot;QValidator.html#setLocale(com.trolltech.qt.core.QLocale)&quot;&gt;&lt;tt&gt;setLocale&lt;/tt&gt;&lt;/a&gt;. It is typically used to parse localized data. For example, &lt;a href=&quot;QIntValidator.html&quot;&gt;&lt;tt&gt;QIntValidator&lt;/tt&gt;&lt;/a&gt; and &lt;a href=&quot;QDoubleValidator.html&quot;&gt;&lt;tt&gt;QDoubleValidator&lt;/tt&gt;&lt;/a&gt; use it to parse localized representations of integers and doubles.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;QValidator.html#QValidator(com.trolltech.qt.core.QObject)&quot;&gt;&lt;tt&gt;QValidator&lt;/tt&gt;&lt;/a&gt; is typically used with &lt;a href=&quot;QLineEdit.html&quot;&gt;&lt;tt&gt;QLineEdit&lt;/tt&gt;&lt;/a&gt;, &lt;a href=&quot;QSpinBox.html&quot;&gt;&lt;tt&gt;QSpinBox&lt;/tt&gt;&lt;/a&gt; and &lt;a href=&quot;QComboBox.html&quot;&gt;&lt;tt&gt;QComboBox&lt;/tt&gt;&lt;/a&gt;.&lt;/p&gt;

@see &lt;a href=&quot;QIntValidator.html&quot;&gt;&lt;tt&gt;QIntValidator&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QDoubleValidator.html&quot;&gt;&lt;tt&gt;QDoubleValidator&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QRegExpValidator.html&quot;&gt;&lt;tt&gt;QRegExpValidator&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;%2E%2E/qtjambi-lineedits.html&quot;&gt;Line Edits Example&lt;/tt&gt;&lt;/a&gt; */">
    <method name="public QValidator(com.trolltech.qt.core.QObject parent)" doc="/**
&lt;p&gt;Sets up the validator. The &lt;tt&gt;parent&lt;/tt&gt; parameter is passed on to the &lt;a href=&quot;%2E%2E/core/%2E%2E/core/QObject.html#QObject(com.trolltech.qt.core.QObject)&quot;&gt;&lt;tt&gt;QObject&lt;/tt&gt;&lt;/a&gt; constructor.&lt;/p&gt;
 */"/>
    <method name="public final com.trolltech.qt.core.QLocale locale()" doc="/**
&lt;p&gt;Returns the locale for the validator. The locale is by default initialized to the same as QLocale().&lt;/p&gt;

@see &lt;a href=&quot;QValidator.html#setLocale(com.trolltech.qt.core.QLocale)&quot;&gt;&lt;tt&gt;setLocale&lt;/tt&gt;&lt;/a&gt;
@see &lt;tt&gt;QLocale::QLocale&lt;/tt&gt; */"/>
    <method name="public final void setLocale(com.trolltech.qt.core.QLocale locale)" doc="/**
&lt;p&gt;Sets the &lt;tt&gt;locale&lt;/tt&gt; that will be used for the validator. Unless &lt;a href=&quot;QValidator.html#setLocale(com.trolltech.qt.core.QLocale)&quot;&gt;&lt;tt&gt;setLocale&lt;/tt&gt;&lt;/a&gt; has been called, the validator will use the default locale set with QLocale::setDefault(). If a default locale has not been set, it is the operating system's locale.&lt;/p&gt;

@see &lt;a href=&quot;QValidator.html#locale()&quot;&gt;&lt;tt&gt;locale&lt;/tt&gt;&lt;/a&gt;
@see &lt;tt&gt;QLocale::setDefault&lt;/tt&gt; */"/>
    <method name="public java.lang.String fixup(java.lang.String arg__1)" doc="/**
&lt;p&gt;This function attempts to change &lt;tt&gt;arg__1&lt;/tt&gt; to be valid according to this validator's rules. It need not result in a valid string: callers of this function must re-test afterwards; the default does nothing.&lt;/p&gt;
&lt;p&gt;Reimplementations of this function can change &lt;tt&gt;arg__1&lt;/tt&gt; even if they do not produce a valid string. For example, an ISBN validator might want to delete every character except digits and &amp;quot;-&amp;quot;, even if the result is still not a valid ISBN; a surname validator might want to remove whitespace from the start and end of the string, even if the resulting string is not in the list of accepted surnames.&lt;/p&gt;
 */"/>
    <method name="public abstract com.trolltech.qt.gui.QValidator.State validate(com.trolltech.qt.gui.QValidator.QValidationData arg__1)" doc="/**
&lt;p&gt;Equivalent to &lt;a href=&quot;QValidator.html#validate(com.trolltech.qt.gui.QValidator.QValidationData)&quot;&gt;validate&lt;/tt&gt;&lt;/a&gt;(&lt;tt&gt;arg__1&lt;/tt&gt;, ). */"/>
    <enum name="State" doc="/**
&lt;p&gt;This enum type defines the states in which a validated string can exist.&lt;/p&gt;
 */">
        <enum-value name="Invalid" doc="/**
&lt;p&gt;The string is &lt;i&gt;clearly&lt;/i&gt; invalid.&lt;/p&gt;
 */"/>
        <enum-value name="Intermediate" doc="/**
&lt;p&gt;The string is a plausible intermediate value during editing.&lt;/p&gt;
 */"/>
        <enum-value name="Acceptable" doc="/**
&lt;p&gt;The string is acceptable as a final result; i.e&amp;#x2e; it is valid.&lt;/p&gt;
 */"/>
</enum>
</class>