<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>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                # QDBusPendingReply Class Reference ## [[QtDBus](index.htm) module] 該QDBusPendingReply類包含的答復異步方法調用[More...](#details) 繼承[QDBusPendingCall](qdbuspendingcall.html)。 ### Methods * `__init__ (self)` * `__init__ (self, QDBusPendingReply?other)` * `__init__ (self, QDBusPendingCall?call)` * `__init__ (self, QDBusMessage?reply)` * `QVariant argumentAt (self, int?index)` * `QDBusError error (self)` * `bool isError (self)` * `bool isFinished (self)` * `bool isValid (self)` * `QDBusMessage reply (self)` * `object value (self, object?type?=?None)` * `waitForFinished (self)` * * * ## Detailed Description 該QDBusPendingReply類包含的答復異步方法調用 該QDBusPendingReply是一個模板類,多達8個模板參數。這些參數是將被用于提取的答復的數據的內容的類型。 這個類是類似的功能,[QDBusReply](qdbusreply.html),但有兩個重要的區別: * [QDBusReply](qdbusreply.html) accepts exactly one return type, whereas QDBusPendingReply can have from 1 to 8 types * [QDBusReply](qdbusreply.html) only works on already completed replies, whereas QDBusPendingReply allows one to wait for replies from pending calls 用在哪里[QDBusReply](qdbusreply.html)你可以這樣寫: ``` [QDBusReply](qdbusreply.html)<[QString](qstring.html)> reply = interface->call("RemoteMethod"); if (reply.isValid()) // use the returned value useValue(reply.value()); else // call failed. Show an error condition. showError(reply.error()); ``` 與QDBusPendingReply ,等效代碼(包括您的答復阻塞等待)將是: ``` QDBusPendingReply<[QString](qstring.html)> reply = interface->asyncCall("RemoteMethod"); reply.waitForFinished(); if (reply.isError()) // call failed. Show an error condition. showError(reply.error()); else // use the returned value useValue(reply.value()); ``` 對于方法調用具有多個輸出參數,用[QDBusReply](qdbusreply.html),你可以這樣寫: ``` [QString](qstring.html) reply = interface->call("RemoteMethod"); ``` 而與QDBusPendingReply ,所有的輸出參數應該是模板參數: ``` QDBusPendingReply<bool, [QString](qstring.html)> reply = interface->asyncCall("RemoteMethod"); reply.waitForFinished(); if (!reply.isError()) { if (reply.argumentAt<0>()) showSuccess(reply.argumentAt<1>()); else showFailure(reply.argumentAt<1>()); } ``` QDBusPendingReply對象可以關聯[QDBusPendingCallWatcher](qdbuspendingcallwatcher.html)對象,它發出的信號,當回復到達。 * * * ## Method Documentation ``` QDBusPendingReply.__init__ (self) ``` 創建一個空的[QDBusPendingReply](qdbuspendingreply.html)對象。而不設定[QDBusPendingCall](qdbuspendingcall.html)反對此回復,[QDBusPendingReply](qdbuspendingreply.html)什么都做不了。所有的函數都返回自己的失敗值。 ``` QDBusPendingReply.__init__ (self, QDBusPendingReply?other) ``` 創建的副本_other_ [QDBusPendingReply](qdbuspendingreply.html)對象。一樣[QDBusPendingCall](qdbuspendingcall.html)和[QDBusPendingCallWatcher](qdbuspendingcallwatcher.html),這[QDBusPendingReply](qdbuspendingreply.html)對象將共享同一個懸而未決的呼叫參考。所有副本共享相同的返回值。 ``` QDBusPendingReply.__init__ (self, QDBusPendingCall?call) ``` 創建[QDBusPendingReply](qdbuspendingreply.html)對象,將采取它的內容從_call_掛起的異步調用。這[QDBusPendingReply](qdbuspendingreply.html)對象將共享相同的未決調用作為參考_call_。 ``` QDBusPendingReply.__init__ (self, QDBusMessage?reply) ``` 創建[QDBusPendingReply](qdbuspendingreply.html)對象,將采取它的內容從消息_message_。在這種情況下,該對象將是已經在其成品狀態和回復的內容將是可訪問的。 **See also** [isFinished](qdbuspendingreply.html#isFinished)( ) 。 ``` QVariant QDBusPendingReply.argumentAt (self, int?index) ``` 返回參數的位置_index_在回復的內容。如果答復不具有的許多元素,這個函數的返回值是不確定的(可能會導致一個斷言失敗) ,所以要確認處理完畢,并答復是否有效是很重要的。 ``` QDBusError QDBusPendingReply.error (self) ``` [](qdbuserror.html) [檢索應答消息的錯誤內容,如果它已完成處理。如果回復郵件尚未完成處理,或者如果它包含一個正常的回復訊息(非錯誤) ,這個函數返回一個無效的](qdbuserror.html)[QDBusError](qdbuserror.html)。 ``` bool QDBusPendingReply.isError (self) ``` 返回True如果應答包含一個錯誤信息,如果其包含一個正常的方法答復。 如果掛起調用還沒有完成處理,該函數也返回True 。 ``` bool QDBusPendingReply.isFinished (self) ``` 返回True,如果待處理的呼叫完成處理和回復已經收到。如果這個函數返回True,則[isError](qdbuspendingreply.html#isError)( )[error](qdbuspendingreply.html#error)()和[reply](qdbuspendingreply.html#reply)( )方法應該返回有效信息。 注意,這個函數只有改變狀態,如果你調用[waitForFinished](qdbuspendingreply.html#waitForFinished)( ),或者如果外部D-Bus的事件發生,這在一般如果返回到事件循環執行只發生。 **See also** [QDBusPendingCallWatcher.isFinished](qdbuspendingcallwatcher.html#isFinished)( ) 。 ``` bool QDBusPendingReply.isValid (self) ``` 返回True如果應答包含一個正常的應答消息,如果其包含別的。 如果掛起調用還沒有完成處理,這個函數返回False 。 ``` QDBusMessage QDBusPendingReply.reply (self) ``` [](qdbusmessage.html) [檢索收到的異步調用的回復消息被發送,如果它已經完成處理。如果掛起調用還沒有完成,這個函數返回一個](qdbusmessage.html)[QDBusMessage](qdbusmessage.html)類型[QDBusMessage.InvalidMessage](qdbusmessage.html#MessageType-enum)。 之后,它已經完成處理,消息類型要么是一個錯誤消息或一個正常的方法回復消息。 ``` object QDBusPendingReply.value (self, object?type?=?None) ``` 返回此答復的第一個參數,強制轉換為類型`T1`(這個類的第一個模板參數) 。這等效于調用argumentAt \u003c0\u003e () 。 這個功能是為了方便,配套[QDBusReply.value](qdbusreply.html#value)()函數。 需要注意的是,如果回答沒有到達,這個函數會導致調用線程阻塞,直到答復處理。 ``` QDBusPendingReply.waitForFinished (self) ``` 掛起調用線程,直到收到回復和處理的執行。在此之后函數返回,[isFinished](qdbuspendingreply.html#isFinished)( )應該返回True,表示該回復的內容是準備進行處理。 **See also** [QDBusPendingCallWatcher.waitForFinished](qdbuspendingcallwatcher.html#waitForFinished)( ) 。
                  <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>

                              哎呀哎呀视频在线观看