qvbox.h头文件找不到

来源:互联网 发布:网红开的淘宝店的货源 编辑:程序博客网 时间:2024/05/19 06:14
我用的是在windows +vs2005+qt4.3平台 

   在网上按

Qt教程一 —— 第三章:家庭价值  

    学习时遇到如下问题:

#include <qapplication.h>#include <qpushbutton.h>#include <qfont.h>#include <qvbox.h>   //  系统找不到这个头文件经查资料:4.3 已经没有这个类 而是用QVBoxLayout 代替 因此换成#include<QVBoxLayout>就可以了源程序如下:
  1. #include <QtGui/QApplication>
  2. #include <qpushbutton>
  3. #include<qfont>
  4. #include <QVBoxLayout>
  5. using namespace std;
  6. int main(int argc, char *argv[])
  7. {
  8.   QApplication a(argc, argv);
  9.    QWidget window;
  10.    window.resize(200,120);
  11.    QVBoxLayout layout;
  12.    QPushButton quit("Quit",&window);
  13.    quit.setFont(QFont("Times",18,QFont::Bold));
  14.    QObject::connect(&quit,SIGNAL(clicked()),&a,SLOT(quit()));
  15.    layout.addWidget(&quit);
  16.    window.setLayout(&layout);
  17.    window.show();
  18.    return a.exec(); 
  19. }
运行结果如下:
参考资料:http://doc.trolltech.com/4.4/classes.html
0 0
原创粉丝点击