这个源程序,应该如何修改或编译才能让其支持触摸屏——点击按钮后能响应按钮的点击动作,
触摸屏已经校正过,而且非常准确。
#include <qapplication.h>
#include <qwidget.h>
#include <qlabel.h>
#include <qtextcodec.h>
#include <qfont.h>
#include <stdio.h>
#include <qgbkcodec.h>
#include <qpushbutton.h>
/*
#define QWS_MOUSE_IPAQ
#define QWS_MOUSE_IPAQ_RAW
#define QWS_MOUSE_PROTO="TPanel:/dev/h3600_tsraw"
*/
class MyMainWindow :public QWidget
{
public:
MyMainWindow(QWidget *parent=0, const char *name=0);
~MyMainWindow();
private:
QPushButton *b1;
};
MyMainWindow::~MyMainWindow()
{
}
MyMainWindow::MyMainWindow(QWidget *parent, const char *name)
{
char *string = "中文和English混和字符串!";
printf("mywindow:in\n");
QTextCodec *gbk_codec = QTextCodec::codecForName("GBK");
QString gbk_string = gbk_codec->toUnicode("查询");
QLabel *label = new QLabel(this);
label->setGeometry(0, 0, 800, 600);
label->show();
QPushButton *btn_custom = new QPushButton( this,"btn_custom" );
btn_custom->setGeometry( 200, 200, 100, 50 );
btn_custom->setText(gbk_string);
btn_custom->show();
}
int main(int argc , char **argv)
{
printf("Project Main:in\n");
QApplication app(argc, argv);
QFont font1("st_hwkt",24,50,FALSE);
qApp->setFont(font1);
MyMainWindow *windowmain = new MyMainWindow(0, "Main") ;
app.setMainWidget(windowmain);
windowmain->showFullScreen();
printf("==============\n");
return app.exec();
}
[ 此贴被XChinux在2006-07-27 23:29重新编辑 ]