开发者

Connecting QLCDNumber to a QSpinBox

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 cr开发者_Go百科eated. 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!


There could be a couple things happening. But my guess is that you've omitted 'slots' in your .h file:

public slots:
    void pushButtonClicked();

Without that, the code will compile and run, but the function isn't a slot. So the 'connect' command will fail.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜