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;
	}


 


posted @ 2011-12-07 18:33  sinian  阅读(432)  评论(0编辑  收藏  举报