QDesignerFormWindowManagerInterface Class
QDesignerFormWindowManagerInterface 类允许您操作Qt Widgets Designer 中的表单窗口集合,并控制Qt Widgets Designer 的表单编辑操作。更多
Header: | #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() |
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) |
详细说明
Qt Widgets Designer 使用窗体窗口管理器来控制其工作区中的各种窗体窗口。您可以使用QDesignerFormEditorInterface::formWindowManager() 函数获取Qt Widgets Designer 的窗体窗口管理器接口。例如
auto *manager = formEditor->formWindowManager(); auto *formWindow = manager->formWindow(0); manager->setActiveFormWindow(formWindow);
在实现自定义 widget 插件时,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 。
[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)
从Qt Widgets Designer 的表单窗口管理器维护的窗口集合中删除给定的formWindow 。
另请参阅 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's 加载的插件及其加载失败的插件。
[pure virtual slot]
void QDesignerFormWindowManagerInterface::showPreview()
使用默认参数显示当前表格的预览。
另请参见 closeAllPreviews()。
© 2025 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.