|
![](static/image/common/ico_lz.png)
楼主 |
发表于 2016-1-26 10:49:43
|
显示全部楼层
myRolling::myRolling(QWidget *parent, Qt::WFlags flags)
: QDialog(parent, flags)
{
ui.setupUi(this);
this->setGeometry(0,0,1080,60);
this->setWindowFlags(Qt::FramelessWindowHint);
this->setWindowFlags(this->windowFlags()|Qt::WindowStaysOnTopHint);
//str = new QString("hello world");
str = new QString("北京欢迎您!");
tmpStr = new QString("");
t = new QTimer();
pos =0;
t->start(150);
QObject::connect(t, SIGNAL(timeout()), this, SLOT(rollText()));
}
myRolling::~myRolling()
{
}
void myRolling::rollText()
{
if(pos < str->size())
{
tmpStr->insert(0, str->at(str->size() - pos -1));
}
else
{
tmpStr->insert(0, " ");
}
ui.label->setText(*tmpStr);
pos++;
if(pos==63)
{
tmpStr->clear();
pos=0;
}
} |
|