#include <QtGui/QApplication>#include "widget.h"#include <QPushButton>#include <QTextCodec>#include <QHBoxLayout>int main(int argc, char *argv[]){ QApplication a(argc, argv); Widget w; QTextCodec::setCodecForCStrings(QTextCodec::codecForName("Windows-1251")); QPushButton* sozdat = new QPushButton ("Создать...");sozdat->setGeometry(10, 40, 180, 40); QPushButton* ydalit = new QPushButton ("Удалить объекты... / Очистить память"); QPushButton* close = new QPushButton ("Закрыть"); QHBoxLayout* phbxLayout = new QHBoxLayout; phbxLayout->setMargin(10); phbxLayout->setSpacing(20); phbxLayout->addWidget(sozdat); phbxLayout->addWidget(ydalit); phbxLayout->addWidget(close); w.setLayout(phbxLayout); w.setWindowFlags(Qt::Window|Qt::WindowMinimizeButtonHint); w.setWindowTitle("Задача 2 - Вариант 10"); w.resize(700,400); w.show(); return a.exec();}
phbxLayout->addWidget(sozdat,0,Qt::AlignBottom=0x0040);
QObject::connect(&close_wid,SIGNAL(cliked()),&a,SLOT(quit()));
class Widget : public QWidget{ Q_OBJECTpublic: Widget(QWidget *parent = 0); ~Widget();public slots: void quit();signals: void cliked();};
void Widget::quit()//Закрытие программы{ emit quit();}