<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!-- qevent.cpp --> <title>QFocusEvent Class | Qt GUI 5.9</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.9</td><td ><a href="qtgui-index.html">Qt GUI</a></td><td ><a href="qtgui-module.html">C++ Classes</a></td><td >QFocusEvent</td></tr></table><table class="buildversion"><tr> <td id="buildversion" width="100%" align="right">Qt 5.9.4 Reference Documentation</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-functions">Public Functions</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">QFocusEvent Class</h1> <!-- $$$QFocusEvent-brief --> <p>The <a href="qfocusevent.html">QFocusEvent</a> class contains event parameters for widget focus events. <a href="#details">More...</a></p> <!-- @@@QFocusEvent --> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign"> <span class="preprocessor">#include <QFocusEvent></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/qevent.html">QEvent</a></td></tr></table></div><ul> <li><a href="qfocusevent-members.html">List of all members, including inherited members</a></li> </ul> <a name="public-functions"></a> <h2 id="public-functions">Public Functions</h2> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qfocusevent.html#QFocusEvent">QFocusEvent</a></b>(Type <i>type</i>, Qt::FocusReason <i>reason</i> = Qt::OtherFocusReason)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qfocusevent.html#gotFocus">gotFocus</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qfocusevent.html#lostFocus">lostFocus</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> Qt::FocusReason </td><td class="memItemRight bottomAlign"><b><a href="qfocusevent.html#reason">reason</a></b>() const</td></tr> </table></div> <ul> <li class="fn">6 public functions inherited from <a href="../qtcore/qevent.html#public-functions">QEvent</a></li> </ul> <h3>Additional Inherited Members</h3> <ul> <li class="fn">1 property inherited from <a href="../qtcore/qevent.html#properties">QEvent</a></li> <li class="fn">1 static public member inherited from <a href="../qtcore/qevent.html#static-public-members">QEvent</a></li> <li class="fn">2 protected variables inherited from <a href="../qtcore/qevent.html#protected-variables">QEvent</a></li> </ul> <a name="details"></a> <!-- $$$QFocusEvent-description --> <div class="descr"> <h2 id="details">Detailed Description</h2> <p>The <a href="qfocusevent.html">QFocusEvent</a> class contains event parameters for widget focus events.</p> <p>Focus events are sent to widgets when the keyboard input focus changes. Focus events occur due to mouse actions, key presses (such as <b>Tab</b> or <b>Backtab</b>), the window system, popup menus, keyboard shortcuts, or other application-specific reasons. The reason for a particular focus event is returned by <a href="qfocusevent.html#reason">reason</a>() in the appropriate event handler.</p> <p>The event handlers <a href="../qtwidgets/qwidget.html#focusInEvent">QWidget::focusInEvent</a>(), <a href="../qtwidgets/qwidget.html#focusOutEvent">QWidget::focusOutEvent</a>(), <a href="../qtwidgets/qgraphicsitem.html#focusInEvent">QGraphicsItem::focusInEvent</a> and <a href="../qtwidgets/qgraphicsitem.html#focusOutEvent">QGraphicsItem::focusOutEvent</a>() receive focus events.</p> </div> <p><b>See also </b><a href="../qtwidgets/qwidget.html#setFocus-1">QWidget::setFocus</a>(), <a href="../qtwidgets/qwidget.html#focusPolicy-prop">QWidget::setFocusPolicy</a>(), and <a href="../qtwidgets/focus.html">Keyboard Focus in Widgets</a>.</p> <!-- @@@QFocusEvent --> <div class="func"> <h2>Member Function Documentation</h2> <!-- $$$QFocusEvent[overload1]$$$QFocusEventTypeQt::FocusReason --> <h3 class="fn" id="QFocusEvent"><a name="QFocusEvent"></a>QFocusEvent::<span class="name">QFocusEvent</span>(<span class="type"><a href="../qtcore/qevent.html#Type-enum">Type</a></span> <i>type</i>, <span class="type"><a href="../qtcore/qt.html#FocusReason-enum">Qt::FocusReason</a></span> <i>reason</i> = Qt::OtherFocusReason)</h3> <p>Constructs a focus event object.</p> <p>The <i>type</i> parameter must be either <a href="../qtcore/qevent.html#Type-enum">QEvent::FocusIn</a> or <a href="../qtcore/qevent.html#Type-enum">QEvent::FocusOut</a>. The <i>reason</i> describes the cause of the change in focus.</p> <!-- @@@QFocusEvent --> <!-- $$$gotFocus[overload1]$$$gotFocus --> <h3 class="fn" id="gotFocus"><a name="gotFocus"></a><span class="type">bool</span> QFocusEvent::<span class="name">gotFocus</span>() const</h3> <p>Returns <code>true</code> if <a href="../qtcore/qevent.html#type">type</a>() is <a href="../qtcore/qevent.html#Type-enum">QEvent::FocusIn</a>; otherwise returns false.</p> <!-- @@@gotFocus --> <!-- $$$lostFocus[overload1]$$$lostFocus --> <h3 class="fn" id="lostFocus"><a name="lostFocus"></a><span class="type">bool</span> QFocusEvent::<span class="name">lostFocus</span>() const</h3> <p>Returns <code>true</code> if <a href="../qtcore/qevent.html#type">type</a>() is <a href="../qtcore/qevent.html#Type-enum">QEvent::FocusOut</a>; otherwise returns false.</p> <!-- @@@lostFocus --> <!-- $$$reason[overload1]$$$reason --> <h3 class="fn" id="reason"><a name="reason"></a><span class="type"><a href="../qtcore/qt.html#FocusReason-enum">Qt::FocusReason</a></span> QFocusEvent::<span class="name">reason</span>() const</h3> <p>Returns the reason for this focus event.</p> <!-- @@@reason --> </div> </div> </div> </div> </div> </div> <div class="footer"> <p> <acronym title="Copyright">©</acronym> 2017 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>