I have started to play a little with Qt 4. And then I have come across a problem with the Qt Designer.
In the Signal/Slots editor I can only setup the connections that are listed there, and not all the slots are listed.
我已经开始用Qt 4玩了一点。然后我遇到了Qt Designer的问题。在信号/插槽编辑器中,我只能设置其中列出的连接,而不是列出所有插槽。
If I try to add it manualy in the .ui file, the connection would not work.
If I add it in the ui_*.h file it works fine, but then the connection is deleted when I change the design.
如果我尝试在.ui文件中手动添加它,连接将无法正常工作。如果我将它添加到ui _ * .h文件中,它可以正常工作,但是当我更改设计时会删除连接。
Does anyone have any good tips to how I can get around this bug? Or to ask another way:
How can I make the Qt Designer list all the available slots?
有没有人有任何关于如何解决这个bug的好建议?或者换一种方式:如何让Qt Designer列出所有可用的插槽?
2 个解决方案
#1
2
By default not all signals/slots are shown. You could try checking the "show signals and slots inheritied from ...." checkbox in the lower left hand corder of the "Configure Connection" dialog that comes up when you try to create a signal.
默认情况下,不会显示所有信号/插槽。您可以尝试检查尝试创建信号时出现的“配置连接”对话框左下角的“显示信号和从......继承的插槽”复选框。
Beyond that, you can either do what Marcin said and use auto-connections, or manually write connect statements in the constructor of the object that uses the ui.
除此之外,你可以做Marcin所说的并使用自动连接,或者在使用ui的对象的构造函数中手动编写connect语句。
#2
0
You might try to use uic's autoconnecting feature.
您可以尝试使用uic的自动连接功能。
However you won't be able to see all available slots but if you use the same name in both Designer and code - they should automatically be connected.
但是,您将无法看到所有可用的插槽,但如果在Designer和代码中使用相同的名称 - 它们应自动连接。
#1
2
By default not all signals/slots are shown. You could try checking the "show signals and slots inheritied from ...." checkbox in the lower left hand corder of the "Configure Connection" dialog that comes up when you try to create a signal.
默认情况下,不会显示所有信号/插槽。您可以尝试检查尝试创建信号时出现的“配置连接”对话框左下角的“显示信号和从......继承的插槽”复选框。
Beyond that, you can either do what Marcin said and use auto-connections, or manually write connect statements in the constructor of the object that uses the ui.
除此之外,你可以做Marcin所说的并使用自动连接,或者在使用ui的对象的构造函数中手动编写connect语句。
#2
0
You might try to use uic's autoconnecting feature.
您可以尝试使用uic的自动连接功能。
However you won't be able to see all available slots but if you use the same name in both Designer and code - they should automatically be connected.
但是,您将无法看到所有可用的插槽,但如果在Designer和代码中使用相同的名称 - 它们应自动连接。