无法访问QPushButton神秘 [英] Inaccessible QPushButton mystery

查看:539
本文介绍了无法访问QPushButton神秘的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个QT应用程序。它有功能QPushButtons连接到我的程序中的插槽。我现在尝试添加一个新按钮 myNewButton ,但在某处,不知何故它没有被注册。

I have a QT application. It has functioning QPushButtons that are connected to slots in my program. I am now trying to add a new button myNewButton, but somewhere, somehow it is not being registered.

一个现有的工作按钮 myExistingButton 我有以下行:

For an existing, working button myExistingButton I have the line:

connect(ui->myExistingButton, SIGNAL(clicked()), this, SLOT(Foo()));

我不能简单地添加行:

connect(ui->myNewButton, SIGNAL(clicked()), this, SLOT(Foo()));

编译错误是:

class UI::Viewer has no member named 'myNewButton'

QT Creator没有将该按钮列为 ui-> 的自动填充选项(即我没有简单地拼写名称)。除了ui文件中的坐标和命名外, myExistingButton myNewButton 的记录相同。

And QT Creator does not list the button as an autocomplete option for ui-> (i.e. I haven't simply mis-spelled the name). The records for myExistingButton and myNewButton are identical apart from coordinates and naming in the ui file. What could be causing this problem?

推荐答案

我通过删除生成的文件来修复这个问题 ui_viewer.h 然后重建。

I fixed this by deleting the generated file ui_viewer.h and then rebuilding.

这篇关于无法访问QPushButton神秘的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆