C++ (Qt)#include <QApplication>#include <QLabel>#include <QPushButton>int main(int argc, char *argv[]) { QApplication app(argc, argv); QLabel *label = new QLabel("Text"); label->show(); QPushButton *butt = new QPushButtob("Text"); butt->show(); return app.exec();}
int main(int argc, char *argv[]) { QApplication app(argc, argv); QWidget w; //QLabel ( const QString & text, QWidget * parent = 0, Qt::WindowFlags f = 0 ) QLabel *label = new QLabel("Text", w); //QPushButton ( const QString & text, QWidget * parent = 0 ) QPushButton *butt = new QPushButtob("Text", w); w.show() return app.exec();}
// widget - объект типа QWidgetQLabel *lala = new QLabel("txt", widget)
C++ (Qt)#include <QApplication>#include <QLabel>#include <QPushButton>int main(int argc, char *argv[]) { QApplication app(argc, argv); QWidget w; QLabel *label = new QLabel("Text", w); QPushButton *butt = new QPushButtob("Text", w); w.show(); return app.exec();}
C++ (Qt)#include <QApplication>#include <QLabel>#include <QPushButton>#include <QVBoxLayout>int main(int argc, char *argv[]) { QApplication app(argc, argv); QWidget w; QLabel *label = new QLabel("Text", w); QPushButton *button = new QPushButtob("Text", w); QVBoxLayout *layout = new QVBoxLayout(&w); layout->addWidget(label); layout->addWidget(button); w.show(); return app.exec();}
C++ (Qt)#include <QApplication>#include <QDialog>#include <QLabel>#include <QPushButton>#include <QVBoxLayout> int main(int argc, char *argv[]){ QApplication a(argc, argv); QDialog dlg; QVBoxLayout *layout = new QVBoxLayout(); QLabel *label = new QLabel("Label"); QPushButton *button = new QPushButton("Button"); layout->addWidget(label); layout->addWidget(button); dlg.setLayout(layout); dlg.show(); return a.exec();}
C++ (Qt)while(!asleep()) sheep++;