QT4Widget QPushButton BoxLayout 图层管理使用实例

    技术2022-05-20  30

     

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


    最新回复(0)