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

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                # QSessionManager Class Reference ## [[QtGui](index.htm) module] 該QSessionManager類提供了訪問會話管理器。[More...](#details) 繼承[QObject](qobject.html)。 ### Types * `enum RestartHint { RestartIfRunning, RestartAnyway, RestartImmediately, RestartNever }` ### Methods * `bool allowsErrorInteraction (self)` * `bool allowsInteraction (self)` * `cancel (self)` * `QStringList discardCommand (self)` * `bool isPhase2 (self)` * `release (self)` * `requestPhase2 (self)` * `QStringList restartCommand (self)` * `RestartHint restartHint (self)` * `QString sessionId (self)` * `QString sessionKey (self)` * `setDiscardCommand (self, QStringList)` * `setManagerProperty (self, QString?name, QString?value)` * `setManagerProperty (self, QString?name, QStringList?value)` * `setRestartCommand (self, QStringList)` * `setRestartHint (self, RestartHint)` * * * ## Detailed Description 該QSessionManager類提供了訪問會話管理器。 在桌面環境中(其中Qt的GUI應用程序實時)的會話管理器會跟蹤會話,這是一組運行的應用程序,每個都有一個特定的狀態。應用程序的狀態包含(最顯著的)的應用程序所打開的文件和位置,它的窗口大小。 會話管理器是用來保存會話,例如,當機器關閉,并恢復會話,例如,當機器啟動。我們建議您使用[QSettings](qsettings.html)保存應用程序的設置,例如,窗口位置,最近使用的文件等。當申請是由會話管理器重新啟動,就可以恢復設置。 QSessionManager提供了應用程序和會話管理器之間的接口,使程序可以與會話管理工作。在Qt中,行動會話管理請求由兩個虛函數來處理[QApplication.commitData](qapplication.html#commitData)()和[QApplication.saveState](qapplication.html#saveState)( ) 。兩者都提供一個參考的會話管理器對象作為參數,以允許應用程序與會話管理器通信。會話管理器只能通過這些函數來訪問。 無需用戶交互是可能的_unless_該應用程序從會話管理器得到明確的許可。你可以通過調用請求許可[allowsInteraction](qsessionmanager.html#allowsInteraction)( )或者,如果它是真的急了,[allowsErrorInteraction](qsessionmanager.html#allowsErrorInteraction)( ) 。 Qt不執行這一點,但會話管理器可以。 您可以嘗試通過調用中止關機程序[cancel](qsessionmanager.html#cancel)( ) 。默認commitData ( )函數的作用這一點,如果某些頂層窗口拒絕了的closeEvent ( ) 。 對于提供的UNIX/X11復雜的會話管理器, QSessionManager提供了進一步的可能性,以微調應用程序的會話管理的行為:[setRestartCommand](qsessionmanager.html#setRestartCommand)( )[setDiscardCommand](qsessionmanager.html#setDiscardCommand)( )[setRestartHint](qsessionmanager.html#setRestartHint)( )[setProperty](qobject.html#setProperty)( )[requestPhase2](qsessionmanager.html#requestPhase2)( ) 。進一步詳情請參閱相應的功能說明。 * * * ## Type Documentation ``` QSessionManager.RestartHint ``` 這個枚舉類型定義下,這項應用程序要由會話管理器重新啟動的情況。該電流值是: | Constant | Value | Description | | --- | --- | --- | | `QSessionManager.RestartIfRunning` | `0` | 如果在會話關閉該應用程序仍在運行,它希望在下屆會議上開始重新啟動。 | | `QSessionManager.RestartAnyway` | `1` | 應用程序希望在下屆會議開始時啟動,不管是什么。 (這對于剛剛啟動后,然后退出運行實用程序非常有用。 ) | | `QSessionManager.RestartImmediately` | `2` | 該應用程序要立即啟動時,它沒有運行。 | | `QSessionManager.RestartNever` | `3` | 應用程序不希望被自動重新啟動。 | 默認提示是`RestartIfRunning`。 * * * ## Method Documentation ``` bool QSessionManager.allowsErrorInteraction (self) ``` 返回True如果錯誤的交互是允許的,否則返回False 。 這類似于[allowsInteraction](qsessionmanager.html#allowsInteraction)( ) ,而且還使應用程序能夠講述發生的任何錯誤的用戶。會話管理器可發出錯誤交互請求更高的優先級,這意味著它更可能是錯誤的相互作用是允許的。但是,你仍然不能保證會話管理器將允許交互。 **See also** [allowsInteraction](qsessionmanager.html#allowsInteraction)( )[release](qsessionmanager.html#release)()和[cancel](qsessionmanager.html#cancel)( ) 。 ``` bool QSessionManager.allowsInteraction (self) ``` 要求權限與用戶交互的會話管理器。返回True如果互動是允許的,否則返回False 。 這背后的機制的基本原理是使人們有可能停機期間同步的用戶交互。高級會話管理器可能會問,所有的應用程序同時提交他們的數據,從而導致更快的關機。 當交互完成后,我們強烈建議釋放用戶交互信號通過調用[release](qsessionmanager.html#release)( ) 。這樣一來,其他應用程序可能得到機會與用戶進行交互,而你的應用程序仍然忙于保存數據。 (該信號量,當應用程序退出隱含釋放。 ) 如果用戶決定在互動階段取消關機的過程中,你必須告訴會話管理器得知此事致電[cancel](qsessionmanager.html#cancel)( ) 。 下面是一個應用程序是如何的一個例子[QApplication.commitData](qapplication.html#commitData)( )可能會實施: ``` void MyApplication.commitData([QSessionManager](qsessionmanager.html)& manager) { if (manager.allowsInteraction()) { int ret = [QMessageBox](qmessagebox.html).warning( mainWindow, tr("My Application"), tr("Save changes to document?"), [QMessageBox](qmessagebox.html).Save | [QMessageBox](qmessagebox.html).Discard | [QMessageBox](qmessagebox.html).Cancel); switch (ret) { case [QMessageBox](qmessagebox.html).Save: manager.release(); if (!saveDocument()) manager.cancel(); break; case [QMessageBox](qmessagebox.html).Discard: break; case [QMessageBox](qmessagebox.html).Cancel: default: manager.cancel(); } } else { // we did not get permission to interact, then // do something reasonable instead } } ``` 如果在保存其數據的應用程序中發生了錯誤,你可能需要嘗試[allowsErrorInteraction](qsessionmanager.html#allowsErrorInteraction)( )來代替。 **See also** [QApplication.commitData](qapplication.html#commitData)( )[release](qsessionmanager.html#release)()和[cancel](qsessionmanager.html#cancel)( ) 。 ``` QSessionManager.cancel (self) ``` 告訴會話管理器來取消關機過程。應用程序不應在沒有先詢問用戶調用這個函數。 **See also** [allowsInteraction](qsessionmanager.html#allowsInteraction)()和[allowsErrorInteraction](qsessionmanager.html#allowsErrorInteraction)( ) 。 ``` QStringList QSessionManager.discardCommand (self) ``` 返回當前設置的丟棄命令。 遍歷列表中,您可以使用[foreach](index.htm#foreach)偽關鍵字: ``` foreach (const [QString](qstring.html) &command, mySession.discardCommand()) do_something(command); ``` **See also** [setDiscardCommand](qsessionmanager.html#setDiscardCommand)( )[restartCommand](qsessionmanager.html#restartCommand)()和[setRestartCommand](qsessionmanager.html#setRestartCommand)( ) 。 ``` bool QSessionManager.isPhase2 (self) ``` 返回True如果會話管理器目前正在進行第二階段管理階段,否則返回False 。 **See also** [requestPhase2](qsessionmanager.html#requestPhase2)( ) 。 ``` QSessionManager.release (self) ``` 交互階段后釋放會話管理器的交互信號。 **See also** [allowsInteraction](qsessionmanager.html#allowsInteraction)()和[allowsErrorInteraction](qsessionmanager.html#allowsErrorInteraction)( ) 。 ``` QSessionManager.requestPhase2 (self) ``` 請求第二次會議管理階段應用程序。該應用程序然后可從立即返回[QApplication.commitData](qapplication.html#commitData)()或[QApplication.saveState](qapplication.html#saveState)( )函數,它們將被再次調用一次大部分或所有其他應用程序已經完成了他們的會話管理。 這兩個階段是應用,如X11窗口管理器,需要存儲有關其他應用程序的窗口的信息很有用,所以一定要等到這些申請都完成各自的會話管理任務。 **Note:**如果另一個應用程序已經請求了第二階段它可能會調用之前,同時或應用程序的第二階段之后。 **See also** [isPhase2](qsessionmanager.html#isPhase2)( ) 。 ``` QStringList QSessionManager.restartCommand (self) ``` 返回當前設置的重新啟動命令。 遍歷列表中,您可以使用[foreach](index.htm#foreach)偽關鍵字: ``` foreach (const [QString](qstring.html) &command, mySession.restartCommand()) do_something(command); ``` **See also** [setRestartCommand](qsessionmanager.html#setRestartCommand)()和[restartHint](qsessionmanager.html#restartHint)( ) 。 ``` RestartHint QSessionManager.restartHint (self) ``` [ 返回應用程序的當前重啟提示。默認值是`RestartIfRunning`。 ](qsessionmanager.html#RestartHint-enum) [**See also**](qsessionmanager.html#RestartHint-enum) [setRestartHint](qsessionmanager.html#setRestartHint)( ) 。 ``` QString QSessionManager.sessionId (self) ``` 返回當前會話的標識符。 如果應用程序已恢復從以前的會話,這個標識符是因為它是在早期階段相同。 **See also** [sessionKey](qsessionmanager.html#sessionKey)()和[QApplication.sessionId](qapplication.html#sessionId)( ) 。 ``` QString QSessionManager.sessionKey (self) ``` 返回在當前會話的會話密鑰。 如果應用程序已恢復從以前的會話,這個鍵是一樣的,當前一交易日結束它。 與commitData的每次調用( )或saveState和( )的會話密鑰的變化。 **See also** [sessionId](qsessionmanager.html#sessionId)()和[QApplication.sessionKey](qapplication.html#sessionKey)( ) 。 ``` QSessionManager.setDiscardCommand (self, QStringList) ``` 設置丟棄命令給定的_list_。 **See also** [discardCommand](qsessionmanager.html#discardCommand)()和[setRestartCommand](qsessionmanager.html#setRestartCommand)( ) 。 ``` QSessionManager.setManagerProperty (self, QString?name, QString?value) ``` 低級別的寫訪問應用程序的識別和狀態記錄都保存在會話管理器。 所謂的財產_name_已經將其值設置為字符串列表_value_。 ``` QSessionManager.setManagerProperty (self, QString?name, QStringList?value) ``` 這是一個重載函數。 低級別的寫訪問應用程序的識別和狀態記錄保存在會話管理器。 所謂的財產_name_已經將其值設置為字符串_value_。 ``` QSessionManager.setRestartCommand (self, QStringList) ``` 如果會話管理器能夠恢復會話將執行的_command_為了恢復應用程序。該命令默認為 ``` appname -session id ``` 該`-session`選項是必需的,否則[QApplication](qapplication.html)無法分辨它是否已經恢復或者什么當前會話標識符。看[QApplication.isSessionRestored](qapplication.html#isSessionRestored)()和[QApplication.sessionId](qapplication.html#sessionId)( )了解詳情。 如果你的應用程序是非常簡單的,它可能會存儲在額外的命令行選項整個應用程序的狀態。這通常是一個非常糟糕的主意,因為命令行往往局限于幾百個字節。相反,使用[QSettings](qsettings.html),臨時文件,或用于此目的的數據庫。通過用獨特的標記數據[sessionId](qsessionmanager.html#sessionId)( ) ,你就可以恢復應用程序在今后的會議。 **See also** [restartCommand](qsessionmanager.html#restartCommand)( )[setDiscardCommand](qsessionmanager.html#setDiscardCommand)()和[setRestartHint](qsessionmanager.html#setRestartHint)( ) 。 ``` QSessionManager.setRestartHint (self, RestartHint) ``` 設置應用程序的重啟提示_hint_。在應用程序啟動時,提示設置為`RestartIfRunning`。 **Note:**這些標志只是提示,一個會話管理器可能會或可能不會尊重他們。 我們建議設置重啟的提示[QApplication.saveState](qapplication.html#saveState)( ),因為一個應用程序的啟動后不久,大多數會話管理器執行檢查點。 **See also** [restartHint](qsessionmanager.html#restartHint)( ) 。
                  <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>

                              哎呀哎呀视频在线观看