[英]how to add a custom widget to Qt 4.8.6
I'm trying to figure out how to add a custom widget to Qt Designer. 我试图弄清楚如何向Qt Designer添加自定义窗口小部件。 So far I've been unsuccessful.
到目前为止,我一直没有成功。 Very new to Qt.
Qt的新手。 I'm running Qt 4.8.6.
我正在运行Qt 4.8.6。 I know there is a newer version but due to project constraints I have to stick with this one.
我知道有一个更新的版本,但是由于项目的限制,我不得不坚持使用这个版本。 Essentially I'm need to add a hex spin box, ie a spinbox that counts in hex rather than in decimals.
本质上,我需要添加一个十六进制旋转框,即一个以十六进制而不是十进制计数的旋转框。 I even found code that implements it .
我什至找到实现它的代码 。 It does explain how to integrate it into Qt Designer , however it is explained for version 3. Can someone offer assistance?
它确实说明了如何将其集成到Qt Designer中 ,但是针对版本3进行了说明。有人可以提供帮助吗?
Any help is greatly appreciated 任何帮助是极大的赞赏
Read about creating designer widgets and using them , but briefly: 阅读有关创建设计器小部件并使用它们的信息 ,但简要介绍一下:
QDesignerCustomWidgetInterface
to create your custom designer plugin for your custom widget QDesignerCustomWidgetInterface
为您的自定义小部件创建自定义设计器插件 $QTDIR/plugins/designer
$QTDIR/plugins/designer
There's also an example to follow. 还有一个示例可以遵循。
To add a custom widget to Qt designer simply follow the steps: 要将自定义窗口小部件添加到Qt设计器,只需执行以下步骤:
In your MainWindow/Dialog wherever you want to display this widget add a "Widget" from the "Containers" section of the designer. 在要显示此小部件的任何位置的MainWindow / Dialog中,从设计器的“容器”部分添加“小部件”。
Now right-click the "Widget" container you just added and click "Promote to..." 现在,右键单击刚刚添加的“窗口小部件”容器,然后单击“升级为...”
Cheers !!! 干杯!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.