QT LCDNumber使用

新建一个QT工程

然后在cpp文件中写入代码

#include "hello.h"
#include <qthread.h>
#include <QVariant>
#include <qstring.h>

Hello::Hello(QWidget *parent)
    : QDialog(parent)
{
    
    ui.setupUi(this);
    
    ui.slider->setRange(0,1000);
    connect(ui.slider,SIGNAL(valueChanged(int)),ui.lcd,SLOT(display(int)));
}

Hello::~Hello()
{

}
View Code

拉动滑块就可以改变lcdnumber中的数值。

原文地址:https://www.cnblogs.com/ZJ199012/p/3412809.html