Qt滚动效果
m_scrollBar=ui->textEdit->horizontalScrollBar(); timer=new QTimer(this); timer->start(1000); connect(timer,SIGNAL(timeout()),this,SLOT(slotUpdateTime()));
定时器:实现滚动效果
void Lable::slotUpdateTime() { m_scrollBar->setMinimum( 0 ); m_scrollBar->setMaximum( ui->textEdit->height() ); int max=ui->textEdit->height(); m_scrollBar->setValue(row ); qDebug()<<row<<"*************"<<max; if(row>=max)row=0; else row+=20; }