Re:在头文件 public 一个QLabel ,在cpp里设置它的text,提示Signal name : SIGS ..
头文件
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
....
QLabel *lbShowText;
private:
....
private slots:
void TimeOut();
......
};
cpp
void MainWindow::on_fullScreen_clicked()
{
lbShowText->setWindowFlags(Qt::FramelessWindowHint);
lbShowText->move(0,600);
lbShowText->resize(600,60);
lbShowText->show();
QString txt=ReadText("/home/text/news.txt");
//int a=txt.length();
timer=new QTimer(this);
QObject::connect(timer,SIGNAL(timeout()),this,SLOT(TimeOut()));
timer->start(300);
temp_str=txt;
pos=0;
}
void MainWindow::TimeOut()
{
if(pos>temp_str.length())
{
pos=0;
}
lbShowText->setText(temp_str.mid(pos,120));
pos++;
}
麻烦看看。我对指针确实不熟
[ 此帖被zzxap在2011-03-22 15:41重新编辑 ]