标题:有高人告诉我QT4.4 如何在屏幕上添加按钮或标签项吗?
作者:oneke
日期:2008-09-03 15:40
内容:
在目标板上运行程序,背景和鼠标都已经显示出来了,但添加的按钮控件和标签控件一直都显示不出来,卡在这已经很久了,有经验的高手帮帮我吧,感激不尽~!
我的代码如下:
#include
#include
#include
#include
#include
#include
int main(int argc, char **argv)
{
QApplication app(argc, argv, QApplication::GuiServer);
QLabel hello("Hello\n");
hello.resize(100,30);
hello.show();
return app.exec();
}
没有出现所期望的标签项,不知道是什么原因,郁闷~
#1 [huangyi111 09-03 15:49]
setMainwindow(&hello)
#2 [oneke 09-03 16:15]
加入了,但编译就报错:
main.cpp: In function int main(int argc, char **argv)
main.cpp:67: error: setMainwindow was not declared in this scope
make: *** [.obj/release-static-emb-mips/main.o] Error 1
后来找到了在 /tools/shared/qttoolbardialog/qttoolbardialog.h 头文件中找到了这个函数,include也不行,还是报错,能告诉我怎么修改吗?
#3 [fanzhichao 09-03 16:35]
晕死,他说的是
app.setMainwindow(&hello)
#4 [radium_sql 09-03 16:43]
哈哈。
#5 [oneke 09-03 16:47]
好像是setMainWindow函数吧,“W ” 是大写
但我加入了还是不行呢,编译报错
main.cpp: In function int main(int, char**);
main.cpp:70: error: class QApplication has no member named setMainWindow
make: *** [.obj/release-static-emb-mips/main.o] Error 1
我的代码片断如下:
QLabel hello("Hello\n");
hello.resize(100,30);
hello.show();
app.setMainWindow(&hello);
不知道哪些地方还需作出修改,望有人再帮帮我~