Chinaunix首页 | 论坛 | 博客
  • 博客访问: 204597
  • 博文数量: 36
  • 博客积分: 2501
  • 博客等级: 少校
  • 技术积分: 420
  • 用 户 组: 普通用户
  • 注册时间: 2007-04-18 23:27
个人简介

时间就是一切。

文章分类

全部博文(36)

文章存档

2023年(1)

2017年(2)

2016年(6)

2014年(1)

2009年(1)

2008年(15)

2007年(10)

我的朋友

分类: C/C++

2008-02-09 20:25:20

/*edit.H*/

#ifndef EDIT_H
#define EDIT_H

#include
#include

class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QSpacerItem;
class QLabel;
class QPushButton;
class QLineEdit;

class Edit : public QDialog
{
    Q_OBJECT

public:
    Edit( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
    ~Edit();

    QLabel* Label2;
    QLabel* Label1;
    QPushButton* cancelButton;
    QLineEdit* lineEdit;
    QLineEdit* lineEdit2;
    QPushButton* OkButton;
    QPushButton* pushButton;
    QPushButton* pushButton1;

protected:

protected slots:
    virtual void languageChange();

private slots:
    virtual void out1();

};
#endif //EDIT_H

 

/*edit1.h*/

#include
void Edit::out1()
{
    QString str1,str2;
    str1=lineEdit->text();
    // str2.sprintf("%s",str1);
    lineEdit2->setText(str1);
}


/*edit1.cpp*/

#include "edit.h"
#include
#include
#include
#include "edit1.h"

Edit::Edit( QWidget* parent, const char* name, bool modal, WFlags fl )
    : QDialog( parent, name, modal, fl )
{
    if ( !name )
        setName( "Edit" );
    Label2 = new QLabel( this, "Label2" );
    Label2->setGeometry( QRect( 136, 160, 70, 40 ) );
    QFont Label2_font(  Label2->font() );
    Label2_font.setPointSize( 20 );
    Label2->setFont( Label2_font );
 
    Label1 = new QLabel( this, "Label1" );
    Label1->setGeometry( QRect( 50, 60, 66, 40 ) );
    Label1->setMaximumSize( QSize( 32767, 32767 ) );
    QFont Label1_font(  Label1->font() );
    Label1_font.setPointSize( 22 );
    Label1->setFont( Label1_font );
 
    cancelButton = new QPushButton( this, "cancelButton" );
    cancelButton->setGeometry( QRect( 230, 110, 85, 41 ) );
    QFont cancelButton_font(  cancelButton->font() );
    cancelButton_font.setPointSize( 17 );
    cancelButton->setFont( cancelButton_font );
 
    lineEdit = new QLineEdit( this, "lineEdit" );
    lineEdit->setGeometry( QRect( 123, 60, 140, 40 ) );
 
    lineEdit2 = new QLineEdit( this, "lineEdit2" );
    lineEdit2->setEnabled( TRUE );
    lineEdit2->setGeometry( QRect( 210, 160, 150, 40 ) );
    lineEdit2->setAcceptDrops( TRUE );
    //lineEdit2->setFrameShape( QLineEdit::LineEditPanel );
   // lineEdit2->setFrameShadow( QLineEdit::Sunken );
    lineEdit2->setFrame( TRUE );
    lineEdit2->setEchoMode( QLineEdit::Normal );
    //lineEdit2->setDragEnabled( TRUE );
    lineEdit2->setReadOnly( FALSE );
 
    OkButton = new QPushButton( this, "OkButton" );
    OkButton->setEnabled( TRUE );
    OkButton->setGeometry( QRect( 130, 110, 85, 41 ) );
    QFont OkButton_font(  OkButton->font() );
    OkButton_font.setPointSize( 17 );
    OkButton->setFont( OkButton_font );
    OkButton->setDefault( TRUE );
 
    pushButton = new QPushButton( this, "pushButton" );
    pushButton->setGeometry( QRect( 370, 160, 80, 40 ) );
    QFont pushButton_font(  pushButton->font() );
    pushButton_font.setPointSize( 18 );
    pushButton->setFont( pushButton_font );
 
    pushButton1 = new QPushButton( this, "pushButton1" );
    pushButton1->setGeometry( QRect( 280, 210, 100, 51 ) );
    QFont pushButton1_font(  pushButton1->font() );
    pushButton1_font.setPointSize( 18 );
    pushButton1->setFont( pushButton1_font );
    languageChange();
    resize( QSize(520, 283).expandedTo(minimumSizeHint()) );
    clearWState( WState_Polished );
 
    // signals and slots connections
    connect( OkButton, SIGNAL( clicked() ), this, SLOT( out1() ) );
    connect( cancelButton, SIGNAL( clicked() ), lineEdit, SLOT( clear() ) );
    connect( pushButton, SIGNAL( clicked() ), lineEdit2, SLOT( clear() ) );
    connect( pushButton1, SIGNAL( clicked() ), this, SLOT( close() ) );
 
    // tab order
    setTabOrder( lineEdit, OkButton );
    setTabOrder( OkButton, cancelButton );
    setTabOrder( cancelButton, lineEdit2 );
 
    // buddies
    Label1->setBuddy( lineEdit );
}

/*
 *  Destroys the object and frees any allocated resources
 */
Edit::~Edit()
{
    // no need to delete child widgets, Qt does it all for us
}

void Edit::languageChange()
{
    setCaption( tr( "MYFIRSTPROGRAME" ) );
    Label2->setText( tr( "OUTPUT" ) );
    Label1->setText( tr( "INPUT" ) );
    cancelButton->setText( tr( "CANCEL" ) );
    lineEdit->setText( QString::null );
    lineEdit2->setText( QString::null );
    OkButton->setText( tr( "OK" ) );
    pushButton->setText( tr( "BACK" ) );
    pushButton1->setText( tr( "EXIT" ) );
}

 

/*main.cpp*/

#include "edit.h"
#include

QTOPIA_ADD_APPLICATION("edit", Edit)
QTOPIA_MAIN


阅读(1555) | 评论(0) | 转发(0) |
0

上一篇:qte的配置过程

下一篇:serial

给主人留下些什么吧!~~