`
emowuyi
  • 浏览: 1482048 次
文章分类
社区版块
存档分类
最新评论

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

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics