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

 

#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();
}

你可能感兴趣的:(QT4 Widget QPushButton BoxLayout 图层管理使用实例)