mini2440之--hello程序

来源:互联网 发布:cellsens软件下载 编辑:程序博客网 时间:2024/06/10 06:25

  

如上图所示,这个QT程序中有2个组件, pushbutton和textlabel ,点击hello按钮显示相应的字符

hello.h

#ifndef HELLOFORM_H
#define HELLOFORM_H
#include "hello_base.h"
class HelloForm : public HelloBaseForm
{ 
public:
    HelloForm( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
    virtual ~HelloForm();
protected:
    virtual void SayHello();
};
#endif // HELLOFORM_H

hello.cpp

#include "hello.h"
#include <qlabel.h>
HelloForm::HelloForm( QWidget* parent, const char* name, WFlags fl):
HelloBaseForm(parent, name, fl)
{
connect(pushbutton,SIGNAL(clicked()),this,SLOT(SayHello()));
}
HelloForm::~HelloForm()
{
}
void HelloForm::SayHello()
{
MessageLabel->setText("Hello, Qtopid!");
}
只需要写出这个类,并在析构函数中实现其所有的功能


0 0
原创粉丝点击