#include "hello.h"
#include <qlabel.h>
#include <qtextstream.h>
#include <qfile.h>
#include <qstring.h>
HelloForm::HelloForm( QWidget* parent, const char* name, WFlags fl):
HelloBaseForm(parent, name, fl)
{
k=0;
PushButton2=new QPushButton(this,"PushButton1");
PushButton2->setGeometry(QRect(50,50,50,50));
PushButton2->setText(tr("p2"));
connect(PushButton2,SIGNAL(clicked()),this,SLOT(text()));
Label1=new QLabel(this,"textLabel");
Label1->setGeometry(QRect(100,200,100,100));
buttons_fd=open("/etc/kk",O_RDWR | O_NDELAY,0);
QSocketNotifier *sockerNotifier= new QSocketNotifier(buttons_fd,QSocketNotifier::Write,this);
connect(sockerNotifier,SIGNAL(activated(int)),this,SLOT(text()));
}
HelloForm::~HelloForm()
{
}
void HelloForm::text()
{
QString str2;
str2=QString::number(k);
Label1->setText(tr(str2));
k++;
}
void HelloForm::SayHello()
{
QString calFile="/etc/kk";
QFile file(calFile);
if(file.open(IO_WriteOnly | IO_Append))
{
QTextStream t(&file);
t << "888";
file.flush();
}
}
SayHello() 是 改 文件資料 一個按鈕連結