- class QDesignerFormWindowInterface#
The
QDesignerFormWindowInterface
class allows you to query and manipulate form windows appearing in Qt Designer's workspace. More…Synopsis#
Methods#
def
__init__()
Virtual methods#
def
absoluteDir()
def
author()
def
beginCommand()
def
checkContents()
def
clearSelection()
def
commandHistory()
def
comment()
def
contents()
def
core()
def
currentTool()
def
editWidgets()
def
endCommand()
def
exportMacro()
def
features()
def
fileName()
def
formContainer()
def
grid()
def
hasFeature()
def
includeHints()
def
isDirty()
def
isManaged()
def
layoutDefault()
def
layoutFunction()
def
mainContainer()
def
manageWidget()
def
pixmapFunction()
def
registerTool()
def
resourceFiles()
def
selectWidget()
def
setAuthor()
def
setComment()
def
setContents()
def
setCurrentTool()
def
setDirty()
def
setExportMacro()
def
setFeatures()
def
setFileName()
def
setGrid()
def
tool()
def
toolCount()
def
unmanageWidget()
Slots#
Signals#
def
activated()
def
changed()
def
featureChanged()
def
objectRemoved()
def
toolChanged()
def
widgetManaged()
def
widgetRemoved()
Static functions#
def
findFormWindow()
Note
This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE
Detailed Description#
Warning
This section contains snippets that were automatically translated from C++ to Python and may contain errors.
QDesignerFormWindowInterface
provides information about the associated form window as well as allowing its properties to be altered. The interface is not intended to be instantiated directly, but to provide access to Qt Designer's current form windows controlled by Qt Designer'sform window manager
.If you are looking for the form window containing a specific widget, you can use the static
findFormWindow()
function:formWindow = QDesignerFormWindowInterface.findFormWindow(myWidget)
But in addition, you can access any of the current form windows through Qt Designer's form window manager: Use the
formWindowManager()
function to retrieve an interface to the manager. Once you have this interface, you have access to all of Qt Designer's current form windows through theformWindow()
function. For example:*> = QList<QDesignerFormWindowInterface() manager = formEditor.formWindowManager() for i in range(0, manager.formWindowCount()): forms.append(manager.formWindow(i))
The pointer to Qt Designer's current
QDesignerFormEditorInterface
object (formEditor
in the example above) is provided by theinitialize()
function’s parameter. When implementing a custom widget plugin, you must subclass theQDesignerCustomWidgetInterface
class to expose your plugin to Qt Designer.Once you have the form window, you can query its properties. For example, a plain custom widget plugin is managed by Qt Designer only at its top level, i.e. none of its child widgets can be resized in Qt Designer's workspace. But
QDesignerFormWindowInterface
provides you with functions that enables you to control whether a widget should be managed by Qt Designer, or not:if formWindow.isManaged(myWidget): formWindow.manageWidget(myWidget.childWidget)
The complete list of functions concerning widget management is:
isManaged()
,manageWidget()
andunmanageWidget()
. There is also several associated signals:widgetManaged()
,widgetRemoved()
,aboutToUnmanageWidget()
andwidgetUnmanaged()
.In addition to controlling the management of widgets, you can control the current selection in the form window using the
selectWidget()
,clearSelection()
andemitSelectionChanged()
functions, and theselectionChanged()
signal.You can also retrieve information about where the form is stored using
absoluteDir()
, its include files usingincludeHints()
, and its layout and pixmap functions usinglayoutDefault()
,layoutFunction()
andpixmapFunction()
. You can find out whether the form window has been modified (but not saved) or not, using theisDirty()
function. You can retrieve itsauthor()
, itscontents()
, itsfileName()
, associatedcomment()
andexportMacro()
, its mainContainer(), itsfeatures()
, itsgrid()
and itsresourceFiles()
.The interface provides you with functions and slots allowing you to alter most of this information as well. The exception is the directory storing the form window. Finally, there is several signals associated with changes to the information mentioned above and to the form window in general.
- class FeatureFlag#
(inherits
enum.Flag
) This enum describes the features that are available and can be controlled by the form window interface. These values are used when querying the form window to determine which features it supports:Constant
Description
QDesignerFormWindowInterface.EditFeature
Form editing
QDesignerFormWindowInterface.GridFeature
Grid display and snap-to-grid facilities for editing
QDesignerFormWindowInterface.TabOrderFeature
Tab order management
QDesignerFormWindowInterface.DefaultFeature
Support for default features (form editing and grid)
See also
- class ResourceFileSaveMode#
This enum describes how resource files are saved.
Constant
Description
QDesignerFormWindowInterface.SaveAllResourceFiles
Save all resource files.
QDesignerFormWindowInterface.SaveOnlyUsedResourceFiles
Save resource files used by form.
QDesignerFormWindowInterface.DontSaveResourceFiles
Do not save resource files.
- __init__([parent=None[, flags={}]])#
- Parameters:
parent –
QWidget
flags – Combination of
WindowType
Constructs a form window interface with the given
parent
and the specified windowflags
.This signal is emitted whenever a widget on the form is about to become unmanaged. When this signal is emitted, the specified
widget
is still managed, and awidgetUnmanaged()
signal will follow, indicating when it is no longer managed.See also
Returns the absolute location of the directory containing the form shown in the form window.
- activateResourceFilePaths(paths[, errorCount=None[, errorMessages=None]])#
- Parameters:
paths – list of strings
errorCount – int
errorMessages – str
Activates the resource (.qrc) file paths
paths
, returning the count of errors inerrorCount
and error message inerrorMessages
. Qt Designer loads the resources using the QResource class, making them available for form editing.In IDE integrations, a list of the project’s resource (.qrc) file can be activated, making them available to Qt Designer.
See also
This signal is emitted whenever a widget is activated on the form. The activated widget is specified by
widget
.- activeResourceFilePaths()#
- Return type:
list of strings
Returns the active resource (.qrc) file paths currently loaded in Qt Designer.
See also
- abstract addResourceFile(path)#
- Parameters:
path – str
Adds the resource file at the given
path
to those used by the form.See also
- abstract author()#
- Return type:
str
Returns details of the author or creator of the form currently being displayed in the window.
See also
- abstract beginCommand(description)#
- Parameters:
description – str
- changed()#
This signal is emitted whenever a form is changed.
- abstract checkContents()#
- Return type:
list of strings
Performs checks on the current form and returns a list of richtext warnings about potential issues (for example, top level spacers on unlaid-out forms).
IDE integrations can call this before handling starting a save operation.
- abstract clearSelection([changePropertyDisplay=true])#
- Parameters:
changePropertyDisplay – bool
Clears the current selection in the form window. If
update
is true, theemitSelectionChanged()
function is called, emitting theselectionChanged()
signal.See also
- abstract commandHistory()#
- Return type:
- abstract comment()#
- Return type:
str
Returns comments about the form currently being displayed in the window.
See also
- abstract contents()#
- Return type:
str
Returns details of the contents of the form currently being displayed in the window.
See also
- core()#
- Return type:
Returns a pointer to Qt Designer's current
QDesignerFormEditorInterface
object.- abstract currentTool()#
- Return type:
int
- abstract editWidgets()#
- abstract emitSelectionChanged()#
Emits the
selectionChanged()
signal.See also
- abstract endCommand()#
- abstract exportMacro()#
- Return type:
str
Returns the export macro associated with the form currently being displayed in the window. The export macro is used when the form is compiled to create a widget plugin.
See also
setExportMacro()
Creating Custom Widgets for Qt Designer- featureChanged(f)#
- Parameters:
f – Combination of
FeatureFlag
This signal is emitted whenever a feature changes in the form. The new feature is specified by
feature
.See also
- abstract features()#
- Return type:
Combination of
FeatureFlag
Returns a combination of the features provided by the form window associated with the interface. The value returned can be tested against the
Feature
enum values to determine which features are supported by the window.See also
- abstract fileName()#
- Return type:
str
Returns the file name of the UI file that describes the form currently being shown.
See also
- fileNameChanged(fileName)#
- Parameters:
fileName – str
This signal is emitted whenever the file name of the form changes. The new file name is specified by
fileName
.See also
Returns the form window interface for the given
object
.- static findFormWindow(w)
- Parameters:
w –
QWidget
- Return type:
Returns the form window interface for the given
widget
.Returns the form the widget containing the main container widget.
- geometryChanged()#
This signal is emitted whenever the form’s geometry changes.
Returns the grid spacing used by the form window.
See also
- abstract hasFeature(f)#
- Parameters:
f – Combination of
FeatureFlag
- Return type:
bool
Returns true if the form window offers the specified
feature
; otherwise returns false.See also
- abstract includeHints()#
- Return type:
list of strings
Returns a list of the header files that will be included in the form window’s associated UI file.
Header files may be local, i.e. relative to the project’s directory,
"mywidget.h"
, or global, i.e. part of Qt or the compilers standard libraries:<QtGui/QWidget>
.See also
- abstract isDirty()#
- Return type:
bool
Returns true if the form window is “dirty” (modified but not saved); otherwise returns false.
See also
Returns true if the specified
widget
is managed by the form window; otherwise returns false.See also
- abstract layoutDefault(margin, spacing)#
- Parameters:
margin – int
spacing – int
Fills in the default margin and spacing for the form’s default layout in the
margin
andspacing
variables specified.See also
- abstract layoutFunction(margin, spacing)#
- Parameters:
margin – str
spacing – str
Fills in the current margin and spacing for the form’s layout in the
margin
andspacing
variables specified.See also
This signal is emitted whenever the main container changes. The new container is specified by
mainContainer
.See also
Instructs the form window to manage the specified
widget
.See also
This signal is emitted whenever an object (such as an action or a QButtonGroup) is removed from the form. The object that was removed is specified by
object
.- abstract pixmapFunction()#
- Return type:
str
Returns the name of the function used to load pixmaps into the form window.
See also
- abstract registerTool(tool)#
- Parameters:
- abstract removeResourceFile(path)#
- Parameters:
path – str
Removes the resource file at the specified
path
from the list of those used by the form.See also
- abstract resourceFileSaveMode()#
- Return type:
Returns the resource file save mode behavior.
See also
- abstract resourceFiles()#
- Return type:
list of strings
Returns a list of paths to resource files that are currently being used by the form window.
See also
- resourceFilesChanged()#
This signal is emitted whenever the list of resource files used by the form changes.
See also
If
select
is true, the givenwidget
is selected; otherwise thewidget
is deselected.See also
- selectionChanged()#
This signal is emitted whenever the selection in the form changes.
See also
- abstract setAuthor(author)#
- Parameters:
author – str
Sets the details for the author or creator of the form to the
author
specified.See also
- abstract setComment(comment)#
- Parameters:
comment – str
Sets the information about the form to the
comment
specified. This information should be a human-readable comment about the form.See also
- abstract setContents(dev[, errorMessage=None])#
- Parameters:
dev –
QIODevice
errorMessage – str
- Return type:
bool
Sets the form’s contents using data obtained from the given
device
and returns whether loading succeeded. If it fails, the error message is returned inerrorMessage
.Data can be read from QFile objects or any other subclass of QIODevice.
See also
- abstract setContents(contents)
- Parameters:
contents – str
- Return type:
bool
Sets the contents of the form using data read from the specified
contents
string and returns whether the operation succeeded.See also
- abstract setCurrentTool(index)#
- Parameters:
index – int
- abstract setDirty(dirty)#
- Parameters:
dirty – bool
If
dirty
is true, the form window is marked as dirty, meaning that it is modified but not saved. Ifdirty
is false, the form window is considered to be unmodified.See also
- abstract setExportMacro(exportMacro)#
- Parameters:
exportMacro – str
Sets the form window’s export macro to
exportMacro
. The export macro is used when building a widget plugin to export the form’s interface to other components.See also
- abstract setFeatures(f)#
- Parameters:
f – Combination of
FeatureFlag
Enables the specified
features
for the form window.See also
- abstract setFileName(fileName)#
- Parameters:
fileName – str
Sets the file name for the form to the given
fileName
.See also
Sets the grid size for the form window to the point specified by
grid
. In this function, the coordinates in the QPoint are used to specify the dimensions of a rectangle in the grid.See also
- abstract setIncludeHints(includeHints)#
- Parameters:
includeHints – list of strings
Sets the header files that will be included in the form window’s associated UI file to the specified
includeHints
.Header files may be local, i.e. relative to the project’s directory,
"mywidget.h"
, or global, i.e. part of Qt or the compilers standard libraries:<QtGui/QWidget>
.See also
- abstract setLayoutDefault(margin, spacing)#
- Parameters:
margin – int
spacing – int
Sets the default
margin
andspacing
for the form’s layout.See also
- abstract setLayoutFunction(margin, spacing)#
- Parameters:
margin – str
spacing – str
Sets the
margin
andspacing
for the form’s layout.The default layout properties will be replaced by the corresponding layout functions when
uic
generates code for the form, that is, if the functions are specified. This is useful when different environments requires different layouts for the same form.See also
Sets the main container widget on the form to the specified
mainContainer
.See also
- abstract setPixmapFunction(pixmapFunction)#
- Parameters:
pixmapFunction – str
Sets the function used to load pixmaps into the form window to the given
pixmapFunction
.See also
- abstract setResourceFileSaveMode(behaviour)#
- Parameters:
behaviour –
ResourceFileSaveMode
Sets the resource file save mode
behavior
.See also
- abstract simplifySelection(widgets)#
- Parameters:
widgets –
QList
- abstract tool(index)#
- Parameters:
index – int
- Return type:
- toolChanged(toolIndex)#
- Parameters:
toolIndex – int
- abstract toolCount()#
- Return type:
int
Instructs the form window not to manage the specified
widget
.See also
This signal is emitted whenever a widget on the form becomes managed. The newly managed widget is specified by
widget
.See also
This signal is emitted whenever a widget is removed from the form. The widget that was removed is specified by
widget
.This signal is emitted whenever a widget on the form becomes unmanaged. The newly released widget is specified by
widget
.See also