QT4 Widget QPushButton BoxLayout 图层管理使用实例

来源:互联网 发布:如何在淘宝上买军刺 编辑:程序博客网 时间:2024/06/17 01:58

 

#include <qapplication.h>
#include <qpushbutton.h>
#include <qfont.h>
#include <QVBoxLayout>s
int main( int argc, char **argv )
{
    QApplication a( argc, argv );
    QWidget box;
    QVBoxLayout testLayout;
    box.setLayout(&testLayout);
    QPushButton quit( "&Quit", &box );
    QPushButton Open( "&Open", &box );
    testLayout.addWidget(&quit);
    testLayout.addWidget(&Open);
    quit.setFont( QFont( "Times", 12, QFont::Bold ) );
    Open.setFont( QFont( "Times", 12, QFont::Bold ) );
    QObject::connect( &quit, SIGNAL(clicked()), &a, SLOT(quit()) );
    box.show();
    return a.exec();
}

原创粉丝点击