Sophie

Sophie

distrib > Mageia > 6 > x86_64 > media > core-updates > by-pkgid > 749fcc421771b410525f39bd88a5732d > files > 345

qttools5-doc-5.9.4-1.mga6.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" />
<!-- designer-custom-widgets.qdoc -->
  <title>Creating and Using Components for Qt Designer | Qt Designer Manual</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="qtdesigner-manual.html">Qt Designer Manual</a></td><td >Creating and Using Components for Qt Designer</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="#creating-custom-widget-plugins">Creating Custom Widget Plugins</a></li>
<li class="level1"><a href="#retrieving-access-to-qt-designer-components">Retrieving Access to <i>Qt Designer</i> Components</a></li>
<li class="level1"><a href="#creating-user-interfaces-at-run-time">Creating User Interfaces at Run-Time</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">Creating and Using Components for Qt Designer</h1>
<span class="subtitle"></span>
<!-- $$$qtdesigner-components.html-description -->
<div class="descr"> <a name="details"></a>
<a name="creating-custom-widget-plugins"></a>
<h2 id="creating-custom-widget-plugins">Creating Custom Widget Plugins</h2>
<p>When implementing a custom widget plugin for <i>Qt Designer</i>, you must subclass <a href="qdesignercustomwidgetinterface.html">QDesignerCustomWidgetInterface</a> to expose your custom widget to <i>Qt Designer</i>. A single custom widget plugin is built as a separate library. If you want to include several custom widget plugins in the same library, you must in addition subclass <a href="qdesignercustomwidgetcollectioninterface.html">QDesignerCustomWidgetCollectionInterface</a>.</p>
<p>To provide your custom widget plugin with the expected behavior and functionality within <i>Qt Designer</i>'s workspace you can subclass the associated extension classes:</p>
<p>The <a href="qdesignercontainerextension.html">QDesignerContainerExtension</a> class allows you to add pages to a custom multi-page container. The <a href="qdesignertaskmenuextension.html">QDesignerTaskMenuExtension</a> class allows you to add custom menu entries to <i>Qt Designer</i>'s task menu. The <a href="qdesignermembersheetextension.html">QDesignerMemberSheetExtension</a> class allows you to manipulate a widget's member functions which is displayed when configuring connections using <i>Qt Designer</i>'s mode for editing signals and slots. And finally, the <a href="qdesignerpropertysheetextension.html">QDesignerPropertySheetExtension</a> class allows you to manipulate a widget's properties which is displayed in <i>Qt Designer</i>'s property editor.</p>
<p class="centerAlign"><img src="images/qtdesignerextensions.png" alt="" /></p><p>In <i>Qt Designer</i> the extensions are not created until they are required. For that reason, when implementing extensions, you must also subclass <a href="qextensionfactory.html">QExtensionFactory</a>, i.e create a class that is able to make instances of your extensions. In addition, you must make <i>Qt Designer</i>'s extension manager register your factory; the extension manager controls the construction of extensions as they are required, and you can access it through <a href="qdesignerformeditorinterface.html">QDesignerFormEditorInterface</a> and <a href="qextensionmanager.html">QExtensionManager</a>.</p>
<p>For a complete example creating a custom widget plugin with an extension, see the <a href="qtdesigner-taskmenuextension-example.html">Task Menu Extension</a> or <a href="qtdesigner-containerextension-example.html">Container Extension</a> examples.</p>
<a name="retrieving-access-to-qt-designer-components"></a>
<h2 id="retrieving-access-to-qt-designer-components">Retrieving Access to <i>Qt Designer</i> Components</h2>
<p>The purpose of the classes mentioned in this section is to provide access to <i>Qt Designer</i>'s components, managers and workspace, and they are not intended to be instantiated directly.</p>
<p><i>Qt Designer</i> is composed by several components. It has an action editor, a property editor, widget box and object inspector which you can view in its workspace.</p>
<p class="centerAlign"><img src="images/qtdesignerscreenshot.png" alt="" /></p><p><i>Qt Designer</i> also has an object that works behind the scene; it contains the logic that integrates all of <i>Qt Designer</i>'s components into a coherent application. You can access this object, using the <a href="qdesignerformeditorinterface.html">QDesignerFormEditorInterface</a>, to retrieve interfaces to <i>Qt Designer</i>'s components:</p>
<ul>
<li><a href="qdesigneractioneditorinterface.html">QDesignerActionEditorInterface</a></li>
<li><a href="qdesignerobjectinspectorinterface.html">QDesignerObjectInspectorInterface</a></li>
<li><a href="qdesignerpropertyeditorinterface.html">QDesignerPropertyEditorInterface</a></li>
<li><a href="qdesignerwidgetboxinterface.html">QDesignerWidgetBoxInterface</a></li>
</ul>
<p>In addition, you can use <a href="qdesignerformeditorinterface.html">QDesignerFormEditorInterface</a> to retrieve interfaces to <i>Qt Designer</i>'s extension manager (<a href="qextensionmanager.html">QExtensionManager</a>) and form window manager (<a href="qdesignerformwindowmanagerinterface.html">QDesignerFormWindowManagerInterface</a>). The extension manager controls the construction of extensions as they are required, while the form window manager controls the form windows appearing in <i>Qt Designer</i>'s workspace.</p>
<p>Once you have an interface to <i>Qt Designer</i>'s form window manager (<a href="qdesignerformwindowmanagerinterface.html">QDesignerFormWindowManagerInterface</a>), you also have access to all the form windows currently appearing in <i>Qt Designer</i>'s workspace: The <a href="qdesignerformwindowinterface.html">QDesignerFormWindowInterface</a> class allows you to query and manipulate the form windows, and it provides an interface to the form windows' cursors. <a href="qdesignerformwindowcursorinterface.html">QDesignerFormWindowCursorInterface</a> is a convenience class allowing you to query and modify a given form window's widget selection, and in addition modify the properties of all the form's widgets.</p>
<a name="creating-user-interfaces-at-run-time"></a>
<h2 id="creating-user-interfaces-at-run-time">Creating User Interfaces at Run-Time</h2>
<p>The <code>QtDesigner</code> module contains the <a href="qformbuilder.html">QFormBuilder</a> class that provides a mechanism for dynamically creating user interfaces at run-time, based on UI files created with <i>Qt Designer</i>. This class is typically used by custom components and applications that embed <i>Qt Designer</i>. Standalone applications that need to dynamically generate user interfaces at run-time use the QUiLoader class, found in the QtUiTools module.</p>
<p>For a complete example using QUiLoader, see the <a href="qtdesigner-calculatorbuilder-example.html">Calculator Builder example</a>.</p>
</div>
<p><b>See also </b><a href="qtdesigner-manual.html">Qt Designer Manual</a> and Qt UI Tools.</p>
<!-- @@@qtdesigner-components.html -->
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</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>