将 QLCDNumber 连接到 QSpinBox
我正在编写一个程序,该程序从 spinBox 获取数字,并通过单击我创建的“转换”按钮将其转换为二进制。 我一直在尝试让 QLCDNumber 从 QSpinBox 读取数字。 这是我输入的代码:
connect(convert, SIGNAL(clicked()), this, SLOT(pushButtonClicked()));
我已经实现了pushButtonClicked() 函数,如下所示:
void myClass::pushButtonClicked()
{
m_LCD1->setBinMode();
m_LCD1->display(input->value());
}
但由于某种原因,当我运行程序并单击“转换”按钮时,没有任何反应!请有人帮忙!
I am writing a program that gets a number from a spinBox and converts it into Binary by clicking the "convert" button that I have created.
I have been trying to get the QLCDNumber to read the number in from the QSpinBox.
This is the code I entered:
connect(convert, SIGNAL(clicked()), this, SLOT(pushButtonClicked()));
I have implemented the pushButtonClicked() function as follows:
void myClass::pushButtonClicked()
{
m_LCD1->setBinMode();
m_LCD1->display(input->value());
}
But for some reason when I run the program and click on the "convert" button nothing happens! Please someone help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
可能会发生一些事情。但我的猜测是,您在 .h 文件中省略了“槽”:
没有它,代码将编译并运行,但该函数不是槽。所以“连接”命令将会失败。
There could be a couple things happening. But my guess is that you've omitted 'slots' in your .h file:
Without that, the code will compile and run, but the function isn't a slot. So the 'connect' command will fail.