qvbox.h”: No such file or directory

再QT4的编译环境中编Qt3的教程家庭价值时候,出现qvbox.h”: No such file or directory

The QVBox class is now only available as Q3VBox in Qt 4. You can achieve the same result as QVBox by creating a QWidget with a vertical layout:

网上是这样解决的:

#include <qapplication.h>
#include
<qpushbutton.h>
#include
<qfont.h>
#include
<qboxlayout.h>

int main( int argc, char **argv )
{
    QApplication a( argc, argv );

    QWidget window;               //定义一窗口
    window.resize(
200,120);    //窗口大小

    QVBoxLayout layout;         //竖着排设计类


    QPushButton quit(
"Quit", &window );                                                //退出按钮
    quit.setFont( QFont(
"Times", 18, QFont::Bold ) );                             //字体
    QObject::connect(
&quit, SIGNAL(clicked()), &a, SLOT(quit()) );      // 按钮按下既是退出信号

    layout.addWidget(
&quit);                          //
    
    window.setLayout(
&layout);                      //
    window.show();

   
return a.exec();
}


你可能感兴趣的:(QT)