- 论坛徽章:
- 0
|
Qt4 的一个问题??弄了几天还是解决不了
老兄,我实在想不出来你的程序是怎么编译出这个结果的.
这一句是错的QPushButton * hello = new QPushButton( "Hello world!", this);
你的this指针是从哪里来的,在一个全局函数中怎么会出现this指针.
改成这样,
QPushButton* hello = new QPushButton("Hello World!", 0);
explicit QWidget: Widget ( QWidget * parent = 0, const char * name = 0, WFlags f = 0 )
Constructs a widget which is a child of parent, with the name name and widget flags set to f.
If parent is 0, the new widget becomes a top-level window. If parent is another widget, this widget becomes a child window inside parent. The new widget is deleted when its parent is deleted. |
|