QDesignerFormWindowInterface¶
The QDesignerFormWindowInterface
class allows you to query and manipulate form windows appearing in Qt Designer’s workspace. More…
Synopsis¶
Functions¶
def
activeResourceFilePaths
()
Virtual functions¶
def
absoluteDir
()def
addResourceFile
(path)def
author
()def
beginCommand
(description)def
checkContents
()def
clearSelection
([changePropertyDisplay=true])def
commandHistory
()def
comment
()def
contents
()def
core
()def
currentTool
()def
editWidgets
()def
emitSelectionChanged
()def
endCommand
()def
ensureUniqueObjectName
(object)def
exportMacro
()def
features
()def
fileName
()def
formContainer
()def
grid
()def
hasFeature
(f)def
includeHints
()def
isDirty
()def
isManaged
(widget)def
layoutDefault
(margin, spacing)def
layoutFunction
(margin, spacing)def
mainContainer
()def
manageWidget
(widget)def
pixmapFunction
()def
registerTool
(tool)def
removeResourceFile
(path)def
resourceFileSaveMode
()def
resourceFiles
()def
selectWidget
(w[, select=true])def
setAuthor
(author)def
setComment
(comment)def
setContents
(contents)def
setContents
(dev[, errorMessage=None])def
setCurrentTool
(index)def
setDirty
(dirty)def
setExportMacro
(exportMacro)def
setFeatures
(f)def
setFileName
(fileName)def
setGrid
(grid)def
setIncludeHints
(includeHints)def
setLayoutDefault
(margin, spacing)def
setLayoutFunction
(margin, spacing)def
setMainContainer
(mainContainer)def
setPixmapFunction
(pixmapFunction)def
setResourceFileSaveMode
(behaviour)def
simplifySelection
(widgets)def
tool
(index)def
toolCount
()def
unmanageWidget
(widget)
Slots¶
def
activateResourceFilePaths
(paths[, errorCount=None[, errorMessages=None]])
Signals¶
def
aboutToUnmanageWidget
(widget)def
activated
(widget)def
changed
()def
featureChanged
(f)def
fileNameChanged
(fileName)def
geometryChanged
()def
mainContainerChanged
(mainContainer)def
objectRemoved
(o)def
resourceFilesChanged
()def
selectionChanged
()def
toolChanged
(toolIndex)def
widgetManaged
(widget)def
widgetRemoved
(w)def
widgetUnmanaged
(widget)
Static functions¶
def
findFormWindow
(obj)def
findFormWindow
(w)
Detailed Description¶
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's form window manager
.
If you are looking for the form window containing a specific widget, you can use the static findFormWindow()
function:
formWindow = QDesignerFormWindowInterface() 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 the formWindow()
function. For example:
*> = QList<QDesignerFormWindowInterface() formWindow = QDesignerFormWindowInterface() manager = formEditor.formWindowManager() for i in range(0, manager.formWindowCount()): formWindow = manager.formWindow(i) forms.append(formWindow)
The pointer to Qt Designer's current QDesignerFormEditorInterface
object (formEditor
in the example above) is provided by the initialize()
function’s parameter. When implementing a custom widget plugin, you must subclass the QDesignerCustomWidgetInterface
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()
and unmanageWidget()
. There is also several associated signals: widgetManaged()
, widgetRemoved()
, aboutToUnmanageWidget()
and widgetUnmanaged()
.
In addition to controlling the management of widgets, you can control the current selection in the form window using the selectWidget()
, clearSelection()
and emitSelectionChanged()
functions, and the selectionChanged()
signal.
You can also retrieve information about where the form is stored using absoluteDir()
, its include files using includeHints()
, and its layout and pixmap functions using layoutDefault()
, layoutFunction()
and pixmapFunction()
. You can find out whether the form window has been modified (but not saved) or not, using the isDirty()
function. You can retrieve its author()
, its contents()
, its fileName()
, associated comment()
and exportMacro()
, its , its features()
, its grid()
and its resourceFiles()
.
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 PySide6.QtDesigner.QDesignerFormWindowInterface([parent=None[, flags={}]])¶
- Parameters
flags –
WindowFlags
parent –
PySide6.QtWidgets.QWidget
Constructs a form window interface with the given parent
and the specified window flags
.
- PySide6.QtDesigner.QDesignerFormWindowInterface.FeatureFlag¶
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
- PySide6.QtDesigner.QDesignerFormWindowInterface.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.
- PySide6.QtDesigner.QDesignerFormWindowInterface.aboutToUnmanageWidget(widget)¶
- Parameters
widget –
PySide6.QtWidgets.QWidget
- PySide6.QtDesigner.QDesignerFormWindowInterface.absoluteDir()¶
- Return type
Returns the absolute location of the directory containing the form shown in the form window.
- PySide6.QtDesigner.QDesignerFormWindowInterface.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 in errorCount
and error message in errorMessages
. 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
activeResourceFilePaths()
QResource
- PySide6.QtDesigner.QDesignerFormWindowInterface.activated(widget)¶
- Parameters
widget –
PySide6.QtWidgets.QWidget
- PySide6.QtDesigner.QDesignerFormWindowInterface.activeResourceFilePaths()¶
- Return type
list of strings
Returns the active resource (.qrc) file paths currently loaded in Qt Designer.
See also
- PySide6.QtDesigner.QDesignerFormWindowInterface.addResourceFile(path)¶
- Parameters
path – str
Adds the resource file at the given path
to those used by the form.
See also
- PySide6.QtDesigner.QDesignerFormWindowInterface.author()¶
- Return type
str
Returns details of the author or creator of the form currently being displayed in the window.
See also
- PySide6.QtDesigner.QDesignerFormWindowInterface.beginCommand(description)¶
- Parameters
description – str
- PySide6.QtDesigner.QDesignerFormWindowInterface.changed()¶
- PySide6.QtDesigner.QDesignerFormWindowInterface.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.
- PySide6.QtDesigner.QDesignerFormWindowInterface.clearSelection([changePropertyDisplay=true])¶
- Parameters
changePropertyDisplay – bool
Clears the current selection in the form window. If update
is true, the emitSelectionChanged()
function is called, emitting the selectionChanged()
signal.
See also
- PySide6.QtDesigner.QDesignerFormWindowInterface.commandHistory()¶
- Return type
- PySide6.QtDesigner.QDesignerFormWindowInterface.comment()¶
- Return type
str
Returns comments about the form currently being displayed in the window.
See also
- PySide6.QtDesigner.QDesignerFormWindowInterface.contents()¶
- Return type
str
Returns details of the contents of the form currently being displayed in the window.
See also
- PySide6.QtDesigner.QDesignerFormWindowInterface.core()¶
- Return type
Returns a pointer to Qt Designer's current QDesignerFormEditorInterface
object.
- PySide6.QtDesigner.QDesignerFormWindowInterface.currentTool()¶
- Return type
int
- PySide6.QtDesigner.QDesignerFormWindowInterface.editWidgets()¶
- PySide6.QtDesigner.QDesignerFormWindowInterface.emitSelectionChanged()¶
Emits the selectionChanged()
signal.
See also
- PySide6.QtDesigner.QDesignerFormWindowInterface.endCommand()¶
- PySide6.QtDesigner.QDesignerFormWindowInterface.ensureUniqueObjectName(object)¶
- Parameters
object –
PySide6.QtCore.QObject
- PySide6.QtDesigner.QDesignerFormWindowInterface.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
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
- PySide6.QtDesigner.QDesignerFormWindowInterface.fileName()¶
- Return type
str
Returns the file name of the UI file that describes the form currently being shown.
See also
- PySide6.QtDesigner.QDesignerFormWindowInterface.fileNameChanged(fileName)¶
- Parameters
fileName – str
- static PySide6.QtDesigner.QDesignerFormWindowInterface.findFormWindow(obj)¶
- Parameters
obj –
PySide6.QtCore.QObject
- Return type
Returns the form window interface for the given object
.
- static PySide6.QtDesigner.QDesignerFormWindowInterface.findFormWindow(w)
- Parameters
- Return type
Returns the form window interface for the given widget
.
- PySide6.QtDesigner.QDesignerFormWindowInterface.formContainer()¶
- Return type
Returns the form the widget containing the main container widget.
- PySide6.QtDesigner.QDesignerFormWindowInterface.geometryChanged()¶
- PySide6.QtDesigner.QDesignerFormWindowInterface.grid()¶
- Return type
Returns the grid spacing used by the form window.
See also
- PySide6.QtDesigner.QDesignerFormWindowInterface.hasFeature(f)¶
- Parameters
f –
Feature
- Return type
bool
Returns true if the form window offers the specified feature
; otherwise returns false.
See also
- PySide6.QtDesigner.QDesignerFormWindowInterface.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
- PySide6.QtDesigner.QDesignerFormWindowInterface.isDirty()¶
- Return type
bool
Returns true if the form window is “dirty” (modified but not saved); otherwise returns false.
See also
- PySide6.QtDesigner.QDesignerFormWindowInterface.isManaged(widget)¶
- Parameters
widget –
PySide6.QtWidgets.QWidget
- Return type
bool
Returns true if the specified widget
is managed by the form window; otherwise returns false.
See also
- PySide6.QtDesigner.QDesignerFormWindowInterface.layoutDefault(margin, spacing)¶
- Parameters
margin – int
spacing – int
Fills in the default margin and spacing for the form’s default layout in the margin
and spacing
variables specified.
See also
- PySide6.QtDesigner.QDesignerFormWindowInterface.layoutFunction(margin, spacing)¶
- Parameters
margin – str
spacing – str
Fills in the current margin and spacing for the form’s layout in the margin
and spacing
variables specified.
See also
- PySide6.QtDesigner.QDesignerFormWindowInterface.mainContainer()¶
- Return type
- PySide6.QtDesigner.QDesignerFormWindowInterface.mainContainerChanged(mainContainer)¶
- Parameters
mainContainer –
PySide6.QtWidgets.QWidget
- PySide6.QtDesigner.QDesignerFormWindowInterface.manageWidget(widget)¶
- Parameters
widget –
PySide6.QtWidgets.QWidget
Instructs the form window to manage the specified widget
.
See also
- PySide6.QtDesigner.QDesignerFormWindowInterface.objectRemoved(o)¶
- Parameters
- PySide6.QtDesigner.QDesignerFormWindowInterface.pixmapFunction()¶
- Return type
str
Returns the name of the function used to load pixmaps into the form window.
See also
- PySide6.QtDesigner.QDesignerFormWindowInterface.registerTool(tool)¶
- Parameters
- PySide6.QtDesigner.QDesignerFormWindowInterface.removeResourceFile(path)¶
- Parameters
path – str
Removes the resource file at the specified path
from the list of those used by the form.
See also
- PySide6.QtDesigner.QDesignerFormWindowInterface.resourceFileSaveMode()¶
- Return type
Returns the resource file save mode behavior.
See also
- PySide6.QtDesigner.QDesignerFormWindowInterface.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
- PySide6.QtDesigner.QDesignerFormWindowInterface.resourceFilesChanged()¶
- PySide6.QtDesigner.QDesignerFormWindowInterface.selectWidget(w[, select=true])¶
- Parameters
select – bool
If select
is true, the given widget
is selected; otherwise the widget
is deselected.
See also
- PySide6.QtDesigner.QDesignerFormWindowInterface.selectionChanged()¶
- PySide6.QtDesigner.QDesignerFormWindowInterface.setAuthor(author)¶
- Parameters
author – str
Sets the details for the author or creator of the form to the author
specified.
See also
- PySide6.QtDesigner.QDesignerFormWindowInterface.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
- PySide6.QtDesigner.QDesignerFormWindowInterface.setContents(dev[, errorMessage=None])¶
- Parameters
dev –
PySide6.QtCore.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 in errorMessage
.
Data can be read from QFile
objects or any other subclass of QIODevice
.
See also
- PySide6.QtDesigner.QDesignerFormWindowInterface.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
- PySide6.QtDesigner.QDesignerFormWindowInterface.setCurrentTool(index)¶
- Parameters
index – int
- PySide6.QtDesigner.QDesignerFormWindowInterface.setDirty(dirty)¶
- Parameters
dirty – bool
If dirty
is true, the form window is marked as dirty, meaning that it is modified but not saved. If dirty
is false, the form window is considered to be unmodified.
See also
- PySide6.QtDesigner.QDesignerFormWindowInterface.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
Enables the specified features
for the form window.
See also
- PySide6.QtDesigner.QDesignerFormWindowInterface.setFileName(fileName)¶
- Parameters
fileName – str
Sets the file name for the form to the given fileName
.
See also
- PySide6.QtDesigner.QDesignerFormWindowInterface.setGrid(grid)¶
- Parameters
grid –
PySide6.QtCore.QPoint
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
- PySide6.QtDesigner.QDesignerFormWindowInterface.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
- PySide6.QtDesigner.QDesignerFormWindowInterface.setLayoutDefault(margin, spacing)¶
- Parameters
margin – int
spacing – int
Sets the default margin
and spacing
for the form’s layout.
See also
- PySide6.QtDesigner.QDesignerFormWindowInterface.setLayoutFunction(margin, spacing)¶
- Parameters
margin – str
spacing – str
Sets the margin
and spacing
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
- PySide6.QtDesigner.QDesignerFormWindowInterface.setMainContainer(mainContainer)¶
- Parameters
mainContainer –
PySide6.QtWidgets.QWidget
Sets the main container widget on the form to the specified mainContainer
.
See also
- PySide6.QtDesigner.QDesignerFormWindowInterface.setPixmapFunction(pixmapFunction)¶
- Parameters
pixmapFunction – str
Sets the function used to load pixmaps into the form window to the given pixmapFunction
.
See also
- PySide6.QtDesigner.QDesignerFormWindowInterface.setResourceFileSaveMode(behaviour)¶
- Parameters
behaviour –
ResourceFileSaveMode
Sets the resource file save mode behavior
.
See also
- PySide6.QtDesigner.QDesignerFormWindowInterface.simplifySelection(widgets)¶
- Parameters
widgets –
QList
- PySide6.QtDesigner.QDesignerFormWindowInterface.tool(index)¶
- Parameters
index – int
- Return type
- PySide6.QtDesigner.QDesignerFormWindowInterface.toolChanged(toolIndex)¶
- Parameters
toolIndex – int
- PySide6.QtDesigner.QDesignerFormWindowInterface.toolCount()¶
- Return type
int
- PySide6.QtDesigner.QDesignerFormWindowInterface.unmanageWidget(widget)¶
- Parameters
widget –
PySide6.QtWidgets.QWidget
Instructs the form window not to manage the specified widget
.
See also
- PySide6.QtDesigner.QDesignerFormWindowInterface.widgetManaged(widget)¶
- Parameters
widget –
PySide6.QtWidgets.QWidget
- PySide6.QtDesigner.QDesignerFormWindowInterface.widgetRemoved(w)¶
- Parameters
- PySide6.QtDesigner.QDesignerFormWindowInterface.widgetUnmanaged(widget)¶
- Parameters
widget –
PySide6.QtWidgets.QWidget
© 2022 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. 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.