QDesignerFormWindowManagerInterface Class
QDesignerFormWindowManagerInterface 类允许您操作Qt Widgets Designer 中的表单窗口集合,并控制Qt Widgets Designer 的表单编辑操作。更多内容...
| 标题: | #include <QDesignerFormWindowManagerInterface> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS Designer) target_link_libraries(mytarget PRIVATE Qt6::Designer) |
| qmake: | QT += designer |
| 继承自: | QObject |
公共类型
| enum | Action { CutAction, CopyAction, PasteAction, DeleteAction, SelectAllAction, …, FormWindowSettingsDialogAction } |
| enum | ActionGroup { StyledPreviewActionGroup } |
公共函数
| QDesignerFormWindowManagerInterface(QObject *parent = nullptr) | |
| virtual | ~QDesignerFormWindowManagerInterface() override |
| virtual QAction * | action(QDesignerFormWindowManagerInterface::Action action) const = 0 |
| virtual QActionGroup * | actionGroup(QDesignerFormWindowManagerInterface::ActionGroup actionGroup) const = 0 |
| virtual QDesignerFormWindowInterface * | activeFormWindow() const = 0 |
| virtual QDesignerFormEditorInterface * | core() const = 0 |
| virtual QDesignerFormWindowInterface * | createFormWindow(QWidget *parent = nullptr, Qt::WindowFlags flags = Qt::WindowFlags()) = 0 |
| virtual QPixmap | createPreviewPixmap() const = 0 |
| virtual QDesignerFormWindowInterface * | formWindow(int index) const = 0 |
| virtual int | formWindowCount() const = 0 |
公共槽
| virtual void | addFormWindow(QDesignerFormWindowInterface *formWindow) = 0 |
| virtual void | closeAllPreviews() = 0 |
| virtual void | removeFormWindow(QDesignerFormWindowInterface *formWindow) = 0 |
| virtual void | setActiveFormWindow(QDesignerFormWindowInterface *formWindow) = 0 |
| virtual void | showPluginDialog() = 0 |
| virtual void | showPreview() = 0 |
信号
| void | activeFormWindowChanged(QDesignerFormWindowInterface *formWindow) |
| void | formWindowAdded(QDesignerFormWindowInterface *formWindow) |
| void | formWindowRemoved(QDesignerFormWindowInterface *formWindow) |
| void | formWindowSettingsChanged(QDesignerFormWindowInterface *formWindow) |
详细说明
QDesignerFormWindowManagerInterface 不打算被直接实例化。Qt Widgets Designer 使用表单窗口管理器来控制其工作区中的各个表单窗口。您可以使用QDesignerFormEditorInterface::formWindowManager() 函数获取Qt Widgets Designer 的表单窗口管理器的接口。例如:
auto *manager = formEditor->formWindowManager();
auto *formWindow = manager->formWindow(0);
manager->setActiveFormWindow(formWindow);在实现自定义小部件插件时,QDesignerCustomWidgetInterface::initialize() 函数的参数会提供指向Qt Widgets Designer 当前QDesignerFormEditorInterface 对象的指针(如上例中的formEditor )。您必须继承QDesignerCustomWidgetInterface 类,才能将您的插件暴露给Qt Widgets Designer 。
表单窗口管理器接口提供了createFormWindow()函数,该函数允许您创建一个新的表单窗口,并可通过addFormWindow()插槽将其添加到管理器维护的表单窗口集合中。 它还提供了formWindowCount()函数,该函数返回当前由管理器控制的表单窗口数量;formWindow()函数,该函数返回与给定索引关联的表单窗口;以及activeFormWindow()函数,该函数返回当前选中的表单窗口。removeFormWindow() 插槽允许您减少管理器必须维护的表单窗口数量,而setActiveFormWindow() 插槽允许您在Qt Widgets Designer 的工作区中更改表单窗口的焦点。
此外,QDesignerFormWindowManagerInterface 还包含一组函数,可让您介入并控制Qt Widgets Designer 的表单编辑操作。所有这些函数都会返回原始操作,从而在介入后仍可继续传播该函数。
最后,该接口提供了三个信号,分别在添加表单窗口、当前选定的表单窗口发生变化或移除表单窗口时触发。所有信号都将相关表单窗口作为参数传递。
另请参阅 QDesignerFormEditorInterface 和QDesignerFormWindowInterface 。
成员类型文档
enum QDesignerFormWindowManagerInterface::Action
指定Qt Widgets Designer 的操作。
| 常量 | 值 | 描述 |
|---|---|---|
QDesignerFormWindowManagerInterface::CutAction | 100 | 剪贴板剪切 |
QDesignerFormWindowManagerInterface::CopyAction | 101 | 剪贴板剪切 |
QDesignerFormWindowManagerInterface::PasteAction | 102 | 剪贴板粘贴 |
QDesignerFormWindowManagerInterface::DeleteAction | 103 | 剪贴板删除 |
QDesignerFormWindowManagerInterface::SelectAllAction | 104 | 全选 |
QDesignerFormWindowManagerInterface::LowerAction | 200 | 将当前小部件置于底部 |
QDesignerFormWindowManagerInterface::RaiseAction | 201 | 将当前控件上移 |
QDesignerFormWindowManagerInterface::UndoAction | 300 | 撤销 |
QDesignerFormWindowManagerInterface::RedoAction | 301 | 重做 |
QDesignerFormWindowManagerInterface::HorizontalLayoutAction | 400 | 使用以下方式布局QHBoxLayout |
QDesignerFormWindowManagerInterface::VerticalLayoutAction | 401 | 使用以下方式布局QVBoxLayout |
QDesignerFormWindowManagerInterface::SplitHorizontalAction | 402 | 按水平方向布局QSplitter |
QDesignerFormWindowManagerInterface::SplitVerticalAction | 403 | 按纵向排版QSplitter |
QDesignerFormWindowManagerInterface::GridLayoutAction | 404 | 使用以下方式排版QGridLayout |
QDesignerFormWindowManagerInterface::FormLayoutAction | 405 | 使用以下方式排版QFormLayout |
QDesignerFormWindowManagerInterface::BreakLayoutAction | 406 | 拆分现有布局 |
QDesignerFormWindowManagerInterface::AdjustSizeAction | 407 | 调整大小 |
QDesignerFormWindowManagerInterface::SimplifyLayoutAction | 408 | 简化QGridLayout 或QFormLayout |
QDesignerFormWindowManagerInterface::DefaultPreviewAction | 500 | 以默认样式创建预览 |
QDesignerFormWindowManagerInterface::FormWindowSettingsDialogAction | 600 | 显示包含表单设置的对话框 |
另请参阅 action()。
enum QDesignerFormWindowManagerInterface::ActionGroup
指定Qt Widgets Designer 的动作组。
| 常量 | 值 | 描述 |
|---|---|---|
QDesignerFormWindowManagerInterface::StyledPreviewActionGroup | 100 | 包含样式化预览操作的操作组 |
另请参阅 actionGroup()。
成员函数文档
[explicit] QDesignerFormWindowManagerInterface::QDesignerFormWindowManagerInterface(QObject *parent = nullptr)
根据给定的parent ,为表单窗口管理器构建一个接口。
[override virtual noexcept] QDesignerFormWindowManagerInterface::~QDesignerFormWindowManagerInterface()
销毁表单窗口管理器的界面。
[pure virtual] QAction *QDesignerFormWindowManagerInterface::action(QDesignerFormWindowManagerInterface::Action action) const
返回由枚举值action 指定的操作。
该函数已取代 Qt 4.X 中的操作访问器。
[pure virtual] QActionGroup *QDesignerFormWindowManagerInterface::actionGroup(QDesignerFormWindowManagerInterface::ActionGroup actionGroup) const
返回由枚举值actionGroup 指定的操作组。
[pure virtual] QDesignerFormWindowInterface *QDesignerFormWindowManagerInterface::activeFormWindow() const
返回Qt Widgets Designer 工作区中当前处于活动状态的表单窗口。
另请参阅 setActiveFormWindow() 和removeFormWindow()。
[signal] void QDesignerFormWindowManagerInterface::activeFormWindowChanged(QDesignerFormWindowInterface *formWindow)
当Qt Widgets Designer 工作区中当前活动表单窗口的内容发生变化时,会触发此信号。作为参数传递的是指向当前活动formWindow 的指针。
另请参阅 activeFormWindow()。
[pure virtual slot] void QDesignerFormWindowManagerInterface::addFormWindow(QDesignerFormWindowInterface *formWindow)
将给定的formWindow 添加到Qt Widgets Designer 的表单窗口管理器所维护的窗口集合中。
另请参阅 formWindowAdded()。
[pure virtual slot] void QDesignerFormWindowManagerInterface::closeAllPreviews()
关闭所有当前打开的预览窗口。
另请参阅 showPreview()。
[pure virtual] QDesignerFormEditorInterface *QDesignerFormWindowManagerInterface::core() const
返回指向Qt Widgets Designer 当前QDesignerFormEditorInterface 对象的指针。
[pure virtual] QDesignerFormWindowInterface *QDesignerFormWindowManagerInterface::createFormWindow(QWidget *parent = nullptr, Qt::WindowFlags flags = Qt::WindowFlags())
创建一个表单窗口,该窗口具有给定的parent 和给定的窗口flags 。
另请参阅 addFormWindow()。
[pure virtual] QPixmap QDesignerFormWindowManagerInterface::createPreviewPixmap() const
创建一个代表当前活动表单预览的位图。
[pure virtual] QDesignerFormWindowInterface *QDesignerFormWindowManagerInterface::formWindow(int index) const
返回位于指定index 处的表单窗口。
另请参阅 setActiveFormWindow() 和removeFormWindow()。
[signal] void QDesignerFormWindowManagerInterface::formWindowAdded(QDesignerFormWindowInterface *formWindow)
当一个新的表单窗口被添加到Qt Widgets Designer 的表单窗口管理器所维护的窗口集合中时,会发出此信号。此时会将指向新formWindow 的指针作为参数传递。
另请参阅 addFormWindow() 和setActiveFormWindow()。
[pure virtual] int QDesignerFormWindowManagerInterface::formWindowCount() const
返回由Qt Widgets Designer 的表单窗口管理器维护的表单窗口数量。
[signal] void QDesignerFormWindowManagerInterface::formWindowRemoved(QDesignerFormWindowInterface *formWindow)
当表单窗口从Qt Widgets Designer 的表单窗口管理器维护的窗口集合中移除时,会发出此信号。作为参数传递的是被移除的formWindow 的指针。
另请参阅 removeFormWindow()。
[signal] void QDesignerFormWindowManagerInterface::formWindowSettingsChanged(QDesignerFormWindowInterface *formWindow)
当表单窗口的设置发生变化时,会触发此信号。可利用该信号相应地更新窗口标题等内容。作为参数,会传递一个指向formWindow 的指针。
另请参阅 FormWindowSettingsDialogAction 。
[pure virtual slot] void QDesignerFormWindowManagerInterface::removeFormWindow(QDesignerFormWindowInterface *formWindow)
将指定的formWindow 从Qt Widgets Designer 的表单窗口管理器维护的窗口集合中移除。
另请参阅 formWindow() 和formWindowRemoved()。
[pure virtual slot] void QDesignerFormWindowManagerInterface::setActiveFormWindow(QDesignerFormWindowInterface *formWindow)
将指定的formWindow 设置为Qt Widgets Designer 工作区中当前处于活动状态的表单窗口。
另请参阅 activeFormWindow() 和activeFormWindowChanged()。
[pure virtual slot] void QDesignerFormWindowManagerInterface::showPluginDialog()
打开一个对话框,显示Qt Widgets Designer 加载的插件及其加载失败的情况。
[pure virtual slot] void QDesignerFormWindowManagerInterface::showPreview()
使用默认参数显示当前表单的预览。
另请参阅 closeAllPreviews()。
© 2026 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.