<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                # QDeclarativeExpression Class Reference ## [[QtDeclarative](index.htm) module] 該QDeclarativeExpression類評估的JavaScript在QML上下文。[More...](#details) 繼承[QObject](qobject.html)。 ### Methods * `__init__ (self)` * `__init__ (self, QDeclarativeContext, QObject, QString, QObject?parent?=?None)` * `clearError (self)` * `QDeclarativeContext context (self)` * `QDeclarativeEngine engine (self)` * `QDeclarativeError error (self)` * `(QVariant, bool?valueIsUndefined) evaluate (self)` * `QString expression (self)` * `bool hasError (self)` * `int lineNumber (self)` * `bool notifyOnValueChanged (self)` * `QObject scopeObject (self)` * `setExpression (self, QString)` * `setNotifyOnValueChanged (self, bool)` * `setSourceLocation (self, QString?fileName, int?line)` * `QString sourceFile (self)` ### Qt Signals * `void valueChanged ()` * * * ## Detailed Description 該QDeclarativeExpression類評估的JavaScript在QML上下文。 例如,給定一個文件`main.qml`像這樣: ``` import QtQuick 1.0 [Item](index.htm) { width: 200; height: 200 } ``` 下面的代碼在評估上述QML上下文JavaScript表達式: ``` [QDeclarativeEngine](qdeclarativeengine.html) *engine = new [QDeclarativeEngine](qdeclarativeengine.html); [QDeclarativeComponent](qdeclarativecomponent.html) component(engine, [QUrl](qurl.html).fromLocalFile("main.qml")); [QObject](qobject.html) *myObject = component.create(); QDeclarativeExpression *expr = new QDeclarativeExpression(engine->rootContext(), myObject, "width * 2"); int result = expr->evaluate().toInt(); // result = 400 ``` * * * ## Method Documentation ``` QDeclarativeExpression.__init__ (self) ``` 創建一個無效的[QDeclarativeExpression](qdeclarativeexpression.html)。 作為表達不會有一個關聯的[QDeclarativeContext](qdeclarativecontext.html),這將是一個空表達式對象,它的值將永遠是無效的[QVariant](qvariant.html)。 ``` QDeclarativeExpression.__init__ (self, QDeclarativeContext, QObject, QString, QObject?parent?=?None) ``` 該_parent_的說法,如果不是沒有,原因_self_通過Qt的,而不是PyQt的擁有。 創建[QDeclarativeExpression](qdeclarativeexpression.html)對象,該對象是一個子_parent_。 該_expression_JavaScript的將在被執行_ctxt_ [QDeclarativeContext](qdeclarativecontext.html)。如果指定,_scope_對象的屬性也將在范圍表達式的執行過程中。 ``` QDeclarativeExpression.clearError (self) ``` 清除任何表達錯誤。調用[hasError](qdeclarativeexpression.html#hasError)( )以下,這將返回False 。 **See also** [hasError](qdeclarativeexpression.html#hasError)()和[error](qdeclarativeexpression.html#error)( ) 。 ``` QDeclarativeContext QDeclarativeExpression.context (self) ``` [](qdeclarativecontext.html) [返回](qdeclarativecontext.html)[QDeclarativeContext](qdeclarativecontext.html)這種表達是與,或0相關的,如果沒有關聯關系或[QDeclarativeContext](qdeclarativecontext.html)已被摧毀。 ``` QDeclarativeEngine QDeclarativeExpression.engine (self) ``` [](qdeclarativeengine.html) [返回](qdeclarativeengine.html)[QDeclarativeEngine](qdeclarativeengine.html)這種表達是與,或0相關的,如果沒有關聯關系或[QDeclarativeEngine](qdeclarativeengine.html)已被摧毀。 ``` QDeclarativeError QDeclarativeExpression.error (self) ``` [](qdeclarativeerror.html) [返回從最后一次調用的任何錯誤](qdeclarativeerror.html)[evaluate](qdeclarativeexpression.html#evaluate)( ) 。如果沒有錯誤,將返回一個無效的[QDeclarativeError](qdeclarativeerror.html)實例。 **See also** [hasError](qdeclarativeexpression.html#hasError)()和[clearError](qdeclarativeexpression.html#clearError)( ) 。 ``` (QVariant, bool?valueIsUndefined) QDeclarativeExpression.evaluate (self) ``` Evaulates表達式,返回了評價的結果,或無效[QVariant](qvariant.html)如果表達式是無效的或有錯誤。 _valueIsUndefined_被設置為True,如果表達導致一個未定義的值。 **See also** [hasError](qdeclarativeexpression.html#hasError)()和[error](qdeclarativeexpression.html#error)( ) 。 ``` QString QDeclarativeExpression.expression (self) ``` 返回表達式的字符串。 **See also** [setExpression](qdeclarativeexpression.html#setExpression)( ) 。 ``` bool QDeclarativeExpression.hasError (self) ``` 返回True如果到最后通話[evaluate](qdeclarativeexpression.html#evaluate)( )導致錯誤,否則為False 。 **See also** [error](qdeclarativeexpression.html#error)()和[clearError](qdeclarativeexpression.html#clearError)( ) 。 ``` int QDeclarativeExpression.lineNumber (self) ``` 返回此表達式的源文件中的行號。源位置必須通過調用預先設置[setSourceLocation](qdeclarativeexpression.html#setSourceLocation)( ) 。 ``` bool QDeclarativeExpression.notifyOnValueChanged (self) ``` 返回True如果[valueChanged](qdeclarativeexpression.html#valueChanged)( )信號被發射時,表達式的評估值的變化。 **See also** [setNotifyOnValueChanged](qdeclarativeexpression.html#setNotifyOnValueChanged)( ) 。 ``` QObject QDeclarativeExpression.scopeObject (self) ``` [ 返回表達式的范圍對象,如果提供的話,否則為0 。 ](qobject.html) [除了由表達式的提供數據](qobject.html)[QDeclarativeContext](qdeclarativecontext.html),范圍對象的屬性也在范圍內表達的評價。 ``` QDeclarativeExpression.setExpression (self, QString) ``` 表達式設置為_expression_。 **See also** [expression](qdeclarativeexpression.html#expression)( ) 。 ``` QDeclarativeExpression.setNotifyOnValueChanged (self, bool) ``` 設置是否[valueChanged](qdeclarativeexpression.html#valueChanged)( )信號被發射時,表達式的評估值的變化。 If _notifyOnChange_是真的,[QDeclarativeExpression](qdeclarativeexpression.html)將監測參與式的評估性能,并放出[QDeclarativeExpression.valueChanged](qdeclarativeexpression.html#valueChanged)( ),如果他們已經改變。這使得應用程序,以確保與表達式的結果相關聯的任何值保持在最新狀態。 If _notifyOnChange_為假(默認),[QDeclarativeExpression](qdeclarativeexpression.html)不會montitor涉及的表達式的求值的屬性,并[QDeclarativeExpression.valueChanged](qdeclarativeexpression.html#valueChanged)()將永遠不會被發射。這是更有效的,如果應用程序想表達的是“一次性”的評價。 **See also** [notifyOnValueChanged](qdeclarativeexpression.html#notifyOnValueChanged)( ) 。 ``` QDeclarativeExpression.setSourceLocation (self, QString?fileName, int?line) ``` 設置這個表達式的位置_line_的_url_。此信息被用于由腳本引擎。 ``` QString QDeclarativeExpression.sourceFile (self) ``` 返回此表達式的源文件的URL 。源位置必須通過調用預先設置[setSourceLocation](qdeclarativeexpression.html#setSourceLocation)( ) 。 * * * ## Qt Signal Documentation ``` void valueChanged () ``` 這是該信號的默認超載。 每次發射從最后一次被計算的表達式值的變化。表達式必須被評估至少一次(通過調用[QDeclarativeExpression.evaluate](qdeclarativeexpression.html#evaluate)())這個信號之前將被發射。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看