现在的位置: 首页 > 综合 > 正文

Qt滚动效果

2013年01月20日 ⁄ 综合 ⁄ 共 388字 ⁄ 字号 评论关闭
 	 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;
	}

 

抱歉!评论已关闭.