C++ (Qt)#ifndef MAINWINDOW_H#define MAINWINDOW_H #include <QMainWindow> class QPushButton;class QTextBrowser;class QGroupBox;class QWidget;class QObject;class QLabel; class mainWindow : public QMainWindow{ Q_OBJECTpublic: mainWindow();private slots: void crc32slot();private: QMainWindow *mWindow; QWidget *centralwidget; QGroupBox *groupBox; QGroupBox *groupBox_2; QGroupBox *groupBox_3; QPushButton *crc32button; QPushButton *rot13button; QTextBrowser *textBrowser; QTextBrowser *textBrowser_2;};#endif
C++ (Qt)#include <QtGui>#include "mainWindow.h" mainWindow::mainWindow(){ mWindow = new QMainWindow; centralwidget = new QWidget; groupBox = new QGroupBox; crc32button = new QPushButton; rot13button = new QPushButton; groupBox_2 = new QGroupBox; textBrowser_2 = new QTextBrowser; groupBox_3 = new QGroupBox; textBrowser = new QTextBrowser; mWindow->resize(420, 130); mWindow->setFixedSize(420, 130); mWindow->show (); centralwidget = new QWidget(mWindow); centralwidget->show (); groupBox = new QGroupBox(centralwidget); groupBox->setGeometry(QRect(10, 10, 171, 51)); groupBox->setTitle("Chech Sums Algorithme"); groupBox->show (); crc32button = new QPushButton(groupBox); crc32button->setGeometry(QRect(10, 20, 75, 23)); crc32button->setText("crc32"); crc32button->show (); rot13button = new QPushButton(groupBox); rot13button->setGeometry(QRect(90, 20, 75, 23)); rot13button->setText("rot13"); rot13button->show (); groupBox_2 = new QGroupBox(centralwidget); groupBox_2->setGeometry(QRect(190, 10, 221, 111)); groupBox_2->setTitle("Concole"); groupBox_2->show (); textBrowser_2 = new QTextBrowser(groupBox_2); textBrowser_2->setGeometry(QRect(10, 20, 201, 81)); textBrowser_2->show (); groupBox_3 = new QGroupBox(centralwidget); groupBox_3->setGeometry(QRect(10, 70, 171, 51)); groupBox_3->setTitle("Check Sum Value"); groupBox_3->show (); textBrowser = new QTextBrowser(groupBox_3); textBrowser->setGeometry(QRect(10, 20, 151, 21)); textBrowser->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); textBrowser->show (); mWindow->setCentralWidget(centralwidget);
C++ (Qt)#include <QApplication>#include "mainWindow.h"int main(int argc, char *argv[]){ QApplication app(argc, argv); mainWindow mw; return app.exec();}
C++ (Qt)#ifndef WINDOW_H#define WINDOW_H #include <QWidget> class QGroupBox; class Window : public QWidget{ Q_OBJECTpublic: Window(); private slots: void crc32(); private: QGroupBox *console(); QGroupBox *alg(); QGroupBox *value();}; #endif
C++ (Qt)#include <QtGui>#include "Window.h" Window::Window(){ QGridLayout *grid = new QGridLayout; grid->addWidget ( console(), 0, 1 ); grid->addWidget ( value(), 1, 0 ); grid->addWidget ( alg(), 0, 0 ); setLayout ( grid ); setWindowTitle ( tr ( "Check Summer" ) ); setFixedSize ( 570, 140 );} QGroupBox *Window::console(){ QGroupBox *groupBox = new QGroupBox ( tr ( "Concole" ) ); QTextBrowser *text = new QTextBrowser; QVBoxLayout *vbox = new QVBoxLayout; vbox->addWidget ( text ); groupBox->setLayout ( vbox ); return groupBox;} QGroupBox *Window::alg(){ QGroupBox *groupBox = new QGroupBox ( tr ( "Check Sums Algorithme" ) ); QPushButton* button1 = new QPushButton ( tr ( "CRC32" ) ); QPushButton* button2 = new QPushButton ( tr ( "ROT13" ) ); QPushButton* button3 = new QPushButton ( tr ( "MAC3" ) ); QHBoxLayout *hbox = new QHBoxLayout; hbox->addWidget ( button1 ); hbox->addWidget ( button2 ); hbox->addWidget ( button3 ); groupBox->setLayout ( hbox ); connect ( button1, SIGNAL ( clicked() ), this, SLOT ( crc32() ) ); return groupBox;} QGroupBox *Window::value(){ QGroupBox *groupBox = new QGroupBox ( tr ( "Check Sum Value" ) ); QTextBrowser *text = new QTextBrowser; QVBoxLayout *vbox = new QVBoxLayout; vbox->addWidget ( text ); groupBox->setLayout ( vbox ); return groupBox;}
C++ (Qt)#include <QApplication> #include "Window.h" int main ( int argc, char *argv[] ){ QApplication app ( argc, argv ); Window window; window.show(); return app.exec();}