helloform.cpp
| Код | /**************************************************************************** ** Form implementation generated from reading ui file 'helloform.ui' ** ** Created by: The User Interface Compiler ($Id: qt/main.cpp 3.3.6 edited Aug 31 2005 $) ** ** WARNING! All changes made in this file will be lost! ****************************************************************************/
#include "helloform.h"
#include <qvariant.h> #include <qpushbutton.h> #include <qlayout.h> #include <qtooltip.h> #include <qwhatsthis.h> #include <qimage.h> #include <qpixmap.h>
#include "helloform.ui.h" /* * Constructs a HelloForm as a child of 'parent', with the * name 'name' and widget flags set to 'f'. * * The dialog will by default be modeless, unless you set 'modal' to * TRUE to construct a modal dialog. */ HelloForm::HelloForm( QWidget* parent, const char* name, bool modal, WFlags fl ) : QDialog( parent, name, modal, fl ) { if ( !name ) setName( "HelloForm" ); setAcceptDrops( FALSE );
QWidget* privateLayoutWidget = new QWidget( this, "layout2" ); privateLayoutWidget->setGeometry( QRect( 20, 10, 217, 85 ) ); layout2 = new QGridLayout( privateLayoutWidget, 1, 1, 11, 6, "layout2"); spacer1 = new QSpacerItem( 91, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); layout2->addMultiCell( spacer1, 0, 1, 1, 2 );
pushButton = new QPushButton( privateLayoutWidget, "pushButton" ); pushButton->setAutoRepeat( TRUE );
layout2->addMultiCellWidget( pushButton, 0, 1, 0, 0 ); spacer2 = new QSpacerItem( 20, 41, QSizePolicy::Minimum, QSizePolicy::Expanding ); layout2->addItem( spacer2, 1, 2 );
ExitButton = new QPushButton( privateLayoutWidget, "ExitButton" );
layout2->addMultiCellWidget( ExitButton, 2, 2, 1, 2 ); languageChange(); resize( QSize(257, 105).expandedTo(minimumSizeHint()) ); clearWState( WState_Polished );
// signals and slots connections connect( pushButton, SIGNAL( clicked() ), this, SLOT( text_call() ) ); connect( ExitButton, SIGNAL( clicked() ), this, SLOT( close() ) ); }
/* * Destroys the object and frees any allocated resources */ HelloForm::~HelloForm() { // no need to delete child widgets, Qt does it all for us }
/* * Sets the strings of the subwidgets using the current * language. */ void HelloForm::languageChange() { setCaption( tr( "hello" ) ); pushButton->setText( tr( "pushButton here" ) ); ExitButton->setText( tr( "exit" ) ); }
|
helloform.h
| Код | /**************************************************************************** ** Form interface generated from reading ui file 'helloform.ui' ** ** Created by: The User Interface Compiler ($Id: qt/main.cpp 3.3.6 edited Aug 31 2005 $) ** ** WARNING! All changes made in this file will be lost! ****************************************************************************/
#ifndef HELLOFORM_H #define HELLOFORM_H
#include <qvariant.h> #include <qdialog.h>
class QVBoxLayout; class QHBoxLayout; class QGridLayout; class QSpacerItem; class QPushButton;
class HelloForm : public QDialog { Q_OBJECT
public: HelloForm( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); ~HelloForm();
QPushButton* pushButton; QPushButton* ExitButton;
public slots: virtual void text_call();
protected: QGridLayout* layout2; QSpacerItem* spacer1; QSpacerItem* spacer2;
protected slots: virtual void languageChange();
};
#endif // HELLOFORM_H
|
textform.cpp
| Код | /**************************************************************************** ** Form implementation generated from reading ui file 'textform.ui' ** ** Created by: The User Interface Compiler ($Id: qt/main.cpp 3.3.6 edited Aug 31 2005 $) ** ** WARNING! All changes made in this file will be lost! ****************************************************************************/
#include "textform.h"
#include <qvariant.h> #include <qlabel.h> #include <qlayout.h> #include <qtooltip.h> #include <qwhatsthis.h> #include <qimage.h> #include <qpixmap.h>
/* * Constructs a textForm as a child of 'parent', with the * name 'name' and widget flags set to 'f'. * * The dialog will by default be modeless, unless you set 'modal' to * TRUE to construct a modal dialog. */ textForm::textForm( QWidget* parent, const char* name, bool modal, WFlags fl ) : QDialog( parent, name, modal, fl ) { if ( !name ) setName( "textForm" ); textFormLayout = new QHBoxLayout( this, 11, 6, "textFormLayout");
textLabel1 = new QLabel( this, "textLabel1" ); textFormLayout->addWidget( textLabel1 ); languageChange(); resize( QSize(124, 97).expandedTo(minimumSizeHint()) ); clearWState( WState_Polished ); }
/* * Destroys the object and frees any allocated resources */ textForm::~textForm() { // no need to delete child widgets, Qt does it all for us }
/* * Sets the strings of the subwidgets using the current * language. */ void textForm::languageChange() { setCaption( tr( "text" ) ); textLabel1->setText( tr( "<h3>\n" "<i>\n" "<body>\n" "<p align=center>\n" "<font color=red> Hello </font></i> <h1>\n" "<p align=center>\n" "<font color=blue>QT</font ></h1></p>\n" "</body>\n" "</h3>" ) ); }
|
textform.h
| Код | /**************************************************************************** ** Form implementation generated from reading ui file 'textform.ui' ** ** Created by: The User Interface Compiler ($Id: qt/main.cpp 3.3.6 edited Aug 31 2005 $) ** ** WARNING! All changes made in this file will be lost! ****************************************************************************/
#include "textform.h"
#include <qvariant.h> #include <qlabel.h> #include <qlayout.h> #include <qtooltip.h> #include <qwhatsthis.h> #include <qimage.h> #include <qpixmap.h>
/* * Constructs a textForm as a child of 'parent', with the * name 'name' and widget flags set to 'f'. * * The dialog will by default be modeless, unless you set 'modal' to * TRUE to construct a modal dialog. */ textForm::textForm( QWidget* parent, const char* name, bool modal, WFlags fl ) : QDialog( parent, name, modal, fl ) { if ( !name ) setName( "textForm" ); textFormLayout = new QHBoxLayout( this, 11, 6, "textFormLayout");
textLabel1 = new QLabel( this, "textLabel1" ); textFormLayout->addWidget( textLabel1 ); languageChange(); resize( QSize(124, 97).expandedTo(minimumSizeHint()) ); clearWState( WState_Polished ); }
/* * Destroys the object and frees any allocated resources */ textForm::~textForm() { // no need to delete child widgets, Qt does it all for us }
/* * Sets the strings of the subwidgets using the current * language. */ void textForm::languageChange() { setCaption( tr( "text" ) ); textLabel1->setText( tr( "<h3>\n" "<i>\n" "<body>\n" "<p align=center>\n" "<font color=red> Hello </font></i> <h1>\n" "<p align=center>\n" "<font color=blue>QT</font ></h1></p>\n" "</body>\n" "</h3>" ) ); }
|
ну все |