Sophie

Sophie

distrib > Mageia > 7 > armv7hl > media > core-updates > by-pkgid > d5e62c01ae8d1e579463c6a871dd44bf > files > 1718

qtbase5-doc-5.12.6-2.mga7.noarch.rpm

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qsessionmanager.cpp -->
  <title>QSessionManager Class | Qt GUI 5.12.6</title>
  <link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
  <script type="text/javascript">
    document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
    // loading style sheet breaks anchors that were jumped to before
    // so force jumping to anchor again
    setTimeout(function() {
        var anchor = location.hash;
        // need to jump to different anchor first (e.g. none)
        location.hash = "#";
        setTimeout(function() {
            location.hash = anchor;
        }, 0);
    }, 0);
  </script>
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="main">
    <div class="main-rounded">
      <div class="navigationbar">
        <table><tr>
<td >Qt 5.12</td><td ><a href="qtgui-index.html">Qt GUI</a></td><td ><a href="qtgui-module.html">C++ Classes</a></td><td >QSessionManager</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right"><a href="qtgui-index.html">Qt 5.12.6 Reference Documentation</a></td>
        </tr></table>
      </div>
    </div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="sidebar">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#public-types">Public Types</a></li>
<li class="level1"><a href="#public-functions">Public Functions</a></li>
<li class="level1"><a href="#static-public-members">Static Public Members</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">QSessionManager Class</h1>
<!-- $$$QSessionManager-brief -->
<p>The <a href="qsessionmanager.html">QSessionManager</a> class provides access to the session manager. <a href="#details">More...</a></p>
<!-- @@@QSessionManager -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign">   <span class="preprocessor">#include &lt;QSessionManager&gt;</span>
</td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> QT += gui</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Inherits:</td><td class="memItemRight bottomAlign"> <a href="../qtcore/qobject.html">QObject</a></td></tr></table></div><ul>
<li><a href="qsessionmanager-members.html">List of all members, including inherited members</a></li>
<li><a href="qsessionmanager-obsolete.html">Obsolete members</a></li>
</ul>
<a name="public-types"></a>
<h2 id="public-types">Public Types</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qsessionmanager.html#RestartHint-enum">RestartHint</a></b> { RestartIfRunning, RestartAnyway, RestartImmediately, RestartNever }</td></tr>
</table></div>
<a name="public-functions"></a>
<h2 id="public-functions">Public Functions</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qsessionmanager.html#allowsErrorInteraction">allowsErrorInteraction</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qsessionmanager.html#allowsInteraction">allowsInteraction</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsessionmanager.html#cancel">cancel</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QStringList </td><td class="memItemRight bottomAlign"><b><a href="qsessionmanager.html#discardCommand">discardCommand</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qsessionmanager.html#isPhase2">isPhase2</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsessionmanager.html#release">release</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsessionmanager.html#requestPhase2">requestPhase2</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QStringList </td><td class="memItemRight bottomAlign"><b><a href="qsessionmanager.html#restartCommand">restartCommand</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QSessionManager::RestartHint </td><td class="memItemRight bottomAlign"><b><a href="qsessionmanager.html#restartHint">restartHint</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qsessionmanager.html#sessionId">sessionId</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qsessionmanager.html#sessionKey">sessionKey</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsessionmanager.html#setDiscardCommand">setDiscardCommand</a></b>(const QStringList &amp;<i>command</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsessionmanager.html#setManagerProperty">setManagerProperty</a></b>(const QString &amp;<i>name</i>, const QStringList &amp;<i>value</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsessionmanager.html#setManagerProperty-1">setManagerProperty</a></b>(const QString &amp;<i>name</i>, const QString &amp;<i>value</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsessionmanager.html#setRestartCommand">setRestartCommand</a></b>(const QStringList &amp;<i>command</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsessionmanager.html#setRestartHint">setRestartHint</a></b>(QSessionManager::RestartHint <i>hint</i>)</td></tr>
</table></div>
<ul>
<li class="fn">31 public functions inherited from <a href="../qtcore/qobject.html#public-functions">QObject</a></li>
</ul>
<a name="static-public-members"></a>
<h2 id="static-public-members">Static Public Members</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> const QMetaObject </td><td class="memItemRight bottomAlign"><b><a href="qsessionmanager.html#staticMetaObject-var">staticMetaObject</a></b></td></tr>
</table></div>
<ul>
<li class="fn">9 static public members inherited from <a href="../qtcore/qobject.html#static-public-members">QObject</a></li>
</ul>
<h3>Additional Inherited Members</h3>
<ul>
<li class="fn">1 property inherited from <a href="../qtcore/qobject.html#properties">QObject</a></li>
<li class="fn">1 public slot inherited from <a href="../qtcore/qobject.html#public-slots">QObject</a></li>
<li class="fn">2 signals inherited from <a href="../qtcore/qobject.html#signals">QObject</a></li>
<li class="fn">9 protected functions inherited from <a href="../qtcore/qobject.html#protected-functions">QObject</a></li>
</ul>
<a name="details"></a>
<!-- $$$QSessionManager-description -->
<div class="descr">
<h2 id="details">Detailed Description</h2>
<p>The <a href="qsessionmanager.html">QSessionManager</a> class provides access to the session manager.</p>
<p>A session manager in a desktop environment (in which Qt GUI applications live) keeps track of a session, which is a group of running applications, each of which has a particular state. The state of an application contains (most notably) the documents the application has open and the position and size of its windows.</p>
<p>The session manager is used to save the session, e.g&#x2e;, when the machine is shut down, and to restore a session, e.g&#x2e;, when the machine is started up. We recommend that you use <a href="../qtcore/qsettings.html">QSettings</a> to save an application's settings, for example, window positions, recently used files, etc. When the application is restarted by the session manager, you can restore the settings.</p>
<p><a href="qsessionmanager.html">QSessionManager</a> provides an interface between the application and the platform's session manager. In Qt, session management requests for action are handled by the two signals <a href="qguiapplication.html#commitDataRequest">QGuiApplication::commitDataRequest</a>() and <a href="qguiapplication.html#saveStateRequest">QGuiApplication::saveStateRequest</a>(). Both provide a reference to a <a href="qsessionmanager.html">QSessionManager</a> object as argument. The session manager can only be accessed in slots invoked by these signals.</p>
<p><b>Warning:</b> If you use <a href="qsessionmanager.html">QSessionManager</a>, you should disable fallback session management: <a href="qguiapplication.html#setFallbackSessionManagementEnabled">QGuiApplication::setFallbackSessionManagementEnabled</a>().</p>
<p>No user interaction is possible <i>unless</i> the application gets explicit permission from the session manager. You ask for permission by calling <a href="qsessionmanager.html#allowsInteraction">allowsInteraction</a>() or, if it is really urgent, <a href="qsessionmanager.html#allowsErrorInteraction">allowsErrorInteraction</a>(). Qt does not enforce this, but the session manager may.</p>
<p>You can try to abort the shutdown process by calling <a href="qsessionmanager.html#cancel">cancel</a>().</p>
<p>For sophisticated session managers provided on Unix/X11, <a href="qsessionmanager.html">QSessionManager</a> offers further possibilities to fine-tune an application's session management behavior: <a href="qsessionmanager.html#setRestartCommand">setRestartCommand</a>(), <a href="qsessionmanager.html#setDiscardCommand">setDiscardCommand</a>(), <a href="qsessionmanager.html#setRestartHint">setRestartHint</a>(), <a href="../qtcore/qobject.html#setProperty">setProperty</a>(), <a href="qsessionmanager.html#requestPhase2">requestPhase2</a>(). See the respective function descriptions for further details.</p>
</div>
<p><b>See also </b><a href="qguiapplication.html">QGuiApplication</a> and Session Management.</p>
<!-- @@@QSessionManager -->
<div class="types">
<h2>Member Type Documentation</h2>
<!-- $$$RestartHint$$$RestartIfRunning$$$RestartAnyway$$$RestartImmediately$$$RestartNever -->
<h3 class="fn" id="RestartHint-enum"><a name="RestartHint-enum"></a>enum QSessionManager::<span class="name">RestartHint</span></h3>
<p>This enum type defines the circumstances under which this application wants to be restarted by the session manager. The current values are:</p>
<div class="table"><table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><code>QSessionManager::RestartIfRunning</code></td><td class="topAlign tblval"><code>0</code></td><td class="topAlign">If the application is still running when the session is shut down, it wants to be restarted at the start of the next session.</td></tr>
<tr><td class="topAlign"><code>QSessionManager::RestartAnyway</code></td><td class="topAlign tblval"><code>1</code></td><td class="topAlign">The application wants to be started at the start of the next session, no matter what. (This is useful for utilities that run just after startup and then quit.)</td></tr>
<tr><td class="topAlign"><code>QSessionManager::RestartImmediately</code></td><td class="topAlign tblval"><code>2</code></td><td class="topAlign">The application wants to be started immediately whenever it is not running.</td></tr>
<tr><td class="topAlign"><code>QSessionManager::RestartNever</code></td><td class="topAlign tblval"><code>3</code></td><td class="topAlign">The application does not want to be restarted automatically.</td></tr>
</table></div>
<p>The default hint is <code>RestartIfRunning</code>.</p>
<!-- @@@RestartHint -->
</div>
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$allowsErrorInteraction[overload1]$$$allowsErrorInteraction -->
<h3 class="fn" id="allowsErrorInteraction"><a name="allowsErrorInteraction"></a><span class="type">bool</span> QSessionManager::<span class="name">allowsErrorInteraction</span>()</h3>
<p>Returns <code>true</code> if error interaction is permitted; otherwise returns <code>false</code>.</p>
<p>This is similar to <a href="qsessionmanager.html#allowsInteraction">allowsInteraction</a>(), but also enables the application to tell the user about any errors that occur. Session managers may give error interaction requests higher priority, which means that it is more likely that an error interaction is permitted. However, you are still not guaranteed that the session manager will allow interaction.</p>
<p><b>See also </b><a href="qsessionmanager.html#allowsInteraction">allowsInteraction</a>(), <a href="qsessionmanager.html#release">release</a>(), and <a href="qsessionmanager.html#cancel">cancel</a>().</p>
<!-- @@@allowsErrorInteraction -->
<!-- $$$allowsInteraction[overload1]$$$allowsInteraction -->
<h3 class="fn" id="allowsInteraction"><a name="allowsInteraction"></a><span class="type">bool</span> QSessionManager::<span class="name">allowsInteraction</span>()</h3>
<p>Asks the session manager for permission to interact with the user. Returns true if interaction is permitted; otherwise returns <code>false</code>.</p>
<p>The rationale behind this mechanism is to make it possible to synchronize user interaction during a shutdown. Advanced session managers may ask all applications simultaneously to commit their data, resulting in a much faster shutdown.</p>
<p>When the interaction is completed we strongly recommend releasing the user interaction semaphore with a call to <a href="qsessionmanager.html#release">release</a>(). This way, other applications may get the chance to interact with the user while your application is still busy saving data. (The semaphore is implicitly released when the application exits.)</p>
<p>If the user decides to cancel the shutdown process during the interaction phase, you must tell the session manager that this has happened by calling <a href="qsessionmanager.html#cancel">cancel</a>().</p>
<p>Here's an example of how an application's <a href="qguiapplication.html#commitDataRequest">QGuiApplication::commitDataRequest</a>() might be implemented:</p>
<pre class="cpp">

  MyMainWidget<span class="operator">::</span>MyMainWidget(<span class="type"><a href="../qtwidgets/qwidget.html">QWidget</a></span> <span class="operator">*</span>parent)
      :<span class="type"><a href="../qtwidgets/qwidget.html">QWidget</a></span>(parent)
  {
      <span class="type"><a href="qguiapplication.html">QGuiApplication</a></span><span class="operator">::</span>setFallbackSessionManagementEnabled(<span class="keyword">false</span>);
      connect(<a href="../qtwidgets/qapplication.html#qApp">qApp</a><span class="operator">,</span> SIGNAL(commitDataRequest(<span class="type">QSessionManager</span>))<span class="operator">,</span> SLOT(commitData(<span class="type">QSessionManager</span>)));
  }

  <span class="type">void</span> MyMainWidget<span class="operator">::</span>commitData(<span class="type">QSessionManager</span><span class="operator">&amp;</span> manager)
  {
      <span class="keyword">if</span> (manager<span class="operator">.</span>allowsInteraction()) {
          <span class="type">int</span> ret <span class="operator">=</span> <span class="type"><a href="../qtwidgets/qmessagebox.html">QMessageBox</a></span><span class="operator">::</span>warning(
                      mainWindow<span class="operator">,</span>
                      tr(<span class="string">&quot;My Application&quot;</span>)<span class="operator">,</span>
                      tr(<span class="string">&quot;Save changes to document?&quot;</span>)<span class="operator">,</span>
                      <span class="type"><a href="../qtwidgets/qmessagebox.html">QMessageBox</a></span><span class="operator">::</span>Save <span class="operator">|</span> <span class="type"><a href="../qtwidgets/qmessagebox.html">QMessageBox</a></span><span class="operator">::</span>Discard <span class="operator">|</span> <span class="type"><a href="../qtwidgets/qmessagebox.html">QMessageBox</a></span><span class="operator">::</span>Cancel);

          <span class="keyword">switch</span> (ret) {
          <span class="keyword">case</span> <span class="type"><a href="../qtwidgets/qmessagebox.html">QMessageBox</a></span><span class="operator">::</span>Save:
              manager<span class="operator">.</span>release();
              <span class="keyword">if</span> (<span class="operator">!</span>saveDocument())
                  manager<span class="operator">.</span>cancel();
              <span class="keyword">break</span>;
          <span class="keyword">case</span> <span class="type"><a href="../qtwidgets/qmessagebox.html">QMessageBox</a></span><span class="operator">::</span>Discard:
              <span class="keyword">break</span>;
          <span class="keyword">case</span> <span class="type"><a href="../qtwidgets/qmessagebox.html">QMessageBox</a></span><span class="operator">::</span>Cancel:
          <span class="keyword">default</span>:
              manager<span class="operator">.</span>cancel();
          }
      } <span class="keyword">else</span> {
          <span class="comment">// we did not get permission to interact, then</span>
          <span class="comment">// do something reasonable instead</span>
      }
  }

</pre>
<p>If an error occurred within the application while saving its data, you may want to try <a href="qsessionmanager.html#allowsErrorInteraction">allowsErrorInteraction</a>() instead.</p>
<p><b>See also </b><a href="qguiapplication.html#commitDataRequest">QGuiApplication::commitDataRequest</a>(), <a href="qsessionmanager.html#release">release</a>(), and <a href="qsessionmanager.html#cancel">cancel</a>().</p>
<!-- @@@allowsInteraction -->
<!-- $$$cancel[overload1]$$$cancel -->
<h3 class="fn" id="cancel"><a name="cancel"></a><span class="type">void</span> QSessionManager::<span class="name">cancel</span>()</h3>
<p>Tells the session manager to cancel the shutdown process. Applications should not call this function without asking the user first.</p>
<p><b>See also </b><a href="qsessionmanager.html#allowsInteraction">allowsInteraction</a>() and <a href="qsessionmanager.html#allowsErrorInteraction">allowsErrorInteraction</a>().</p>
<!-- @@@cancel -->
<!-- $$$discardCommand[overload1]$$$discardCommand -->
<h3 class="fn" id="discardCommand"><a name="discardCommand"></a><span class="type"><a href="../qtcore/qstringlist.html">QStringList</a></span> QSessionManager::<span class="name">discardCommand</span>() const</h3>
<p>Returns the currently set discard command.</p>
<p>To iterate over the list, you can use the <a href="../qtcore/containers.html#foreach">foreach</a> pseudo-keyword:</p>
<pre class="cpp">

  foreach (<span class="keyword">const</span> <span class="type"><a href="../qtcore/qstring.html">QString</a></span> <span class="operator">&amp;</span>command<span class="operator">,</span> mySession<span class="operator">.</span>discardCommand())
      do_something(command);

</pre>
<p><b>See also </b><a href="qsessionmanager.html#setDiscardCommand">setDiscardCommand</a>(), <a href="qsessionmanager.html#restartCommand">restartCommand</a>(), and <a href="qsessionmanager.html#setRestartCommand">setRestartCommand</a>().</p>
<!-- @@@discardCommand -->
<!-- $$$isPhase2[overload1]$$$isPhase2 -->
<h3 class="fn" id="isPhase2"><a name="isPhase2"></a><span class="type">bool</span> QSessionManager::<span class="name">isPhase2</span>() const</h3>
<p>Returns <code>true</code> if the session manager is currently performing a second session management phase; otherwise returns <code>false</code>.</p>
<p><b>See also </b><a href="qsessionmanager.html#requestPhase2">requestPhase2</a>().</p>
<!-- @@@isPhase2 -->
<!-- $$$release[overload1]$$$release -->
<h3 class="fn" id="release"><a name="release"></a><span class="type">void</span> QSessionManager::<span class="name">release</span>()</h3>
<p>Releases the session manager's interaction semaphore after an interaction phase.</p>
<p><b>See also </b><a href="qsessionmanager.html#allowsInteraction">allowsInteraction</a>() and <a href="qsessionmanager.html#allowsErrorInteraction">allowsErrorInteraction</a>().</p>
<!-- @@@release -->
<!-- $$$requestPhase2[overload1]$$$requestPhase2 -->
<h3 class="fn" id="requestPhase2"><a name="requestPhase2"></a><span class="type">void</span> QSessionManager::<span class="name">requestPhase2</span>()</h3>
<p>Requests a second session management phase for the application. The application may then return immediately from the <a href="qguiapplication.html#commitDataRequest">QGuiApplication::commitDataRequest</a>() or QApplication::saveStateRequest() function, and they will be called again once most or all other applications have finished their session management.</p>
<p>The two phases are useful for applications such as the X11 window manager that need to store information about another application's windows and therefore have to wait until these applications have completed their respective session management tasks.</p>
<p><b>Note: </b>If another application has requested a second phase it may get called before, simultaneously with, or after your application's second phase.</p><p><b>See also </b><a href="qsessionmanager.html#isPhase2">isPhase2</a>().</p>
<!-- @@@requestPhase2 -->
<!-- $$$restartCommand[overload1]$$$restartCommand -->
<h3 class="fn" id="restartCommand"><a name="restartCommand"></a><span class="type"><a href="../qtcore/qstringlist.html">QStringList</a></span> QSessionManager::<span class="name">restartCommand</span>() const</h3>
<p>Returns the currently set restart command.</p>
<p>To iterate over the list, you can use the <a href="../qtcore/containers.html#foreach">foreach</a> pseudo-keyword:</p>
<pre class="cpp">

  foreach (<span class="keyword">const</span> <span class="type"><a href="../qtcore/qstring.html">QString</a></span> <span class="operator">&amp;</span>command<span class="operator">,</span> mySession<span class="operator">.</span>restartCommand())
      do_something(command);

</pre>
<p><b>See also </b><a href="qsessionmanager.html#setRestartCommand">setRestartCommand</a>() and <a href="qsessionmanager.html#restartHint">restartHint</a>().</p>
<!-- @@@restartCommand -->
<!-- $$$restartHint[overload1]$$$restartHint -->
<h3 class="fn" id="restartHint"><a name="restartHint"></a><span class="type"><a href="qsessionmanager.html#RestartHint-enum">QSessionManager::RestartHint</a></span> QSessionManager::<span class="name">restartHint</span>() const</h3>
<p>Returns the application's current restart hint. The default is <code>RestartIfRunning</code>.</p>
<p><b>See also </b><a href="qsessionmanager.html#setRestartHint">setRestartHint</a>().</p>
<!-- @@@restartHint -->
<!-- $$$sessionId[overload1]$$$sessionId -->
<h3 class="fn" id="sessionId"><a name="sessionId"></a><span class="type"><a href="../qtcore/qstring.html">QString</a></span> QSessionManager::<span class="name">sessionId</span>() const</h3>
<p>Returns the identifier of the current session.</p>
<p>If the application has been restored from an earlier session, this identifier is the same as it was in the earlier session.</p>
<p><b>See also </b><a href="qsessionmanager.html#sessionKey">sessionKey</a>() and <a href="qguiapplication.html#sessionId">QGuiApplication::sessionId</a>().</p>
<!-- @@@sessionId -->
<!-- $$$sessionKey[overload1]$$$sessionKey -->
<h3 class="fn" id="sessionKey"><a name="sessionKey"></a><span class="type"><a href="../qtcore/qstring.html">QString</a></span> QSessionManager::<span class="name">sessionKey</span>() const</h3>
<p>Returns the session key in the current session.</p>
<p>If the application has been restored from an earlier session, this key is the same as it was when the previous session ended.</p>
<p>The session key changes with every call of commitData() or saveState().</p>
<p><b>See also </b><a href="qsessionmanager.html#sessionId">sessionId</a>() and <a href="qguiapplication.html#sessionKey">QGuiApplication::sessionKey</a>().</p>
<!-- @@@sessionKey -->
<!-- $$$setDiscardCommand[overload1]$$$setDiscardCommandconstQStringList& -->
<h3 class="fn" id="setDiscardCommand"><a name="setDiscardCommand"></a><span class="type">void</span> QSessionManager::<span class="name">setDiscardCommand</span>(const <span class="type"><a href="../qtcore/qstringlist.html">QStringList</a></span> &amp;<i>command</i>)</h3>
<p>Sets the discard command to the given <i>command</i>.</p>
<p><b>See also </b><a href="qsessionmanager.html#discardCommand">discardCommand</a>() and <a href="qsessionmanager.html#setRestartCommand">setRestartCommand</a>().</p>
<!-- @@@setDiscardCommand -->
<!-- $$$setManagerProperty[overload1]$$$setManagerPropertyconstQString&constQStringList& -->
<h3 class="fn" id="setManagerProperty"><a name="setManagerProperty"></a><span class="type">void</span> QSessionManager::<span class="name">setManagerProperty</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>name</i>, const <span class="type"><a href="../qtcore/qstringlist.html">QStringList</a></span> &amp;<i>value</i>)</h3>
<p>Low-level write access to the application's identification and state record are kept in the session manager.</p>
<p>The property called <i>name</i> has its value set to the string list <i>value</i>.</p>
<!-- @@@setManagerProperty -->
<!-- $$$setManagerProperty$$$setManagerPropertyconstQString&constQString& -->
<h3 class="fn" id="setManagerProperty-1"><a name="setManagerProperty-1"></a><span class="type">void</span> QSessionManager::<span class="name">setManagerProperty</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>name</i>, const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>value</i>)</h3>
<p>This is an overloaded function.</p>
<p>Low-level write access to the application's identification and state records are kept in the session manager.</p>
<p>The property called <i>name</i> has its value set to the string <i>value</i>.</p>
<!-- @@@setManagerProperty -->
<!-- $$$setRestartCommand[overload1]$$$setRestartCommandconstQStringList& -->
<h3 class="fn" id="setRestartCommand"><a name="setRestartCommand"></a><span class="type">void</span> QSessionManager::<span class="name">setRestartCommand</span>(const <span class="type"><a href="../qtcore/qstringlist.html">QStringList</a></span> &amp;<i>command</i>)</h3>
<p>If the session manager is capable of restoring sessions it will execute <i>command</i> in order to restore the application. The command defaults to</p>
<pre class="cpp">

  appname <span class="operator">-</span>session id

</pre>
<p>The <code>-session</code> option is mandatory; otherwise <a href="qguiapplication.html">QGuiApplication</a> cannot tell whether it has been restored or what the current session identifier is. See <a href="qguiapplication.html#isSessionRestored">QGuiApplication::isSessionRestored</a>() and <a href="qguiapplication.html#sessionId">QGuiApplication::sessionId</a>() for details.</p>
<p>If your application is very simple, it may be possible to store the entire application state in additional command line options. This is usually a very bad idea because command lines are often limited to a few hundred bytes. Instead, use <a href="../qtcore/qsettings.html">QSettings</a>, temporary files, or a database for this purpose. By marking the data with the unique <a href="qsessionmanager.html#sessionId">sessionId</a>(), you will be able to restore the application in a future session.</p>
<p><b>See also </b><a href="qsessionmanager.html#restartCommand">restartCommand</a>(), <a href="qsessionmanager.html#setDiscardCommand">setDiscardCommand</a>(), and <a href="qsessionmanager.html#setRestartHint">setRestartHint</a>().</p>
<!-- @@@setRestartCommand -->
<!-- $$$setRestartHint[overload1]$$$setRestartHintQSessionManager::RestartHint -->
<h3 class="fn" id="setRestartHint"><a name="setRestartHint"></a><span class="type">void</span> QSessionManager::<span class="name">setRestartHint</span>(<span class="type"><a href="qsessionmanager.html#RestartHint-enum">QSessionManager::RestartHint</a></span> <i>hint</i>)</h3>
<p>Sets the application's restart hint to <i>hint</i>. On application startup, the hint is set to <code>RestartIfRunning</code>.</p>
<p><b>Note: </b>These flags are only hints, a session manager may or may not respect them.</p><p>We recommend setting the restart hint in <a href="qguiapplication.html#saveStateRequest">QGuiApplication::saveStateRequest</a>() because most session managers perform a checkpoint shortly after an application's startup.</p>
<p><b>See also </b><a href="qsessionmanager.html#restartHint">restartHint</a>().</p>
<!-- @@@setRestartHint -->
</div>
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2019 The Qt Company Ltd.
   Documentation contributions included herein are the copyrights of
   their respective owners.<br/>    The documentation provided herein is licensed under the terms of the    <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation    License version 1.3</a> as published by the Free Software Foundation.<br/>    Qt and respective logos are trademarks of The Qt Company Ltd.     in Finland and/or other countries worldwide. All other trademarks are property
   of their respective owners. </p>
</div>
</body>
</html>