⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 interface.cpp

📁 很好的 QT 学习源码
💻 CPP
📖 第 1 页 / 共 2 页
字号:
    table1->setNumRows( table1->numRows() + 1 );
    table1->verticalHeader()->setLabel( table1->numRows() - 1, tr( "7" ) );
    table1->setNumRows( table1->numRows() + 1 );
    table1->verticalHeader()->setLabel( table1->numRows() - 1, tr( "8" ) );
    table1->setNumRows( table1->numRows() + 1 );
    table1->verticalHeader()->setLabel( table1->numRows() - 1, tr( "9" ) );
    table1->setNumRows( table1->numRows() + 1 );
    table1->verticalHeader()->setLabel( table1->numRows() - 1, tr( "10" ) );
    table1->setGeometry( QRect( 5, 0, 230, 221 ) );

    textLabel1 = new QLabel("total",this, "textLabel1" );
    textLabel1->setGeometry( QRect( 5, 225, 40, 20 ) );
    textLabel1->setFont(QFont("Times",9));  
    lineEdit1 = new QLineEdit( this, "lineEdit1" );
    lineEdit1->setGeometry( QRect( 45, 225, 120, 20 ) );

    textLabel2 = new QLabel("disk",this, "textLabel2" );
    textLabel2->setGeometry( QRect( 165, 225,30, 20 ) );
    textLabel2->setFont(QFont("Times",9));  
    lineEdit2 = new QLineEdit( this, "lineEdit2" );
    lineEdit2->setGeometry( QRect( 195, 225, 40, 20 ) );

    pushButton1 = new QPushButton("up",this, "pushButton1" );
    pushButton1->setGeometry( QRect( 8, 250, 50, 25 ) );
    pushButton1->setFont(QFont("Times",9)); 

    pushButton2 = new QPushButton("down",this, "pushButton2" );
    pushButton2->setGeometry( QRect( 66, 250, 50, 25 ) );
    pushButton2->setFont(QFont("Times",9)); 

    pushButton3 = new QPushButton("order",this, "pushButton3" );
    pushButton3->setGeometry( QRect(124, 250, 50, 25 ) );
   pushButton3->setFont(QFont("Times",9)); 

    pushButton4 = new QPushButton( "send" ,this, "pushButton4" );
    pushButton4->setGeometry( QRect( 182, 250, 50, 25 ) );
   pushButton4->setFont(QFont("Times",9)); 
 

    
    //用pushButton3实现继续点菜的功能
//    Order *order2_order = new Order;
    connect(pushButton3,SIGNAL(clicked()),SLOT(sendto_order()));
    connect(pushButton3,SIGNAL(clicked()),this,SLOT(close()));
    
/*    //用pushButton4实现数据的发送,send将数据发送到服务端
   
  */  
    
 
}


/*==========================查台部分主界面代码实现========================*/
Search::Search()
{
	setGeometry(0,0,240,320);
	setCaption("Search");
    setPaletteBackgroundColor( QColor( 233, 239, 190 ) );

    textLabel1 = new QLabel( "desk",this, "textLabel1" );
    textLabel1->setGeometry( QRect( 55, 40, 40, 25 ) );
    textLabel1->setFont(QFont("Times",9));  

    lineEdit2 = new QLineEdit( this, "lineEdit2" );
    lineEdit2->setGeometry( QRect( 95, 40, 90, 20 ) );
    
    //查台主界面中的功能按键
    pushButton1 = new QPushButton("ok",this, "pushButton1" );
    pushButton1->setGeometry( QRect( 20, 90, 50, 25 ) );
    pushButton1->setFont(QFont("Times",9)); 

    pushButton2 = new QPushButton("clear",this, "pushButton2" );
    pushButton2->setGeometry( QRect( 95, 90, 50, 25 ) );
    pushButton2->setFont(QFont("Times",9)); 

    pushButton3 = new QPushButton( "back",this, "pushButton3" );
    pushButton3->setGeometry( QRect( 170, 90, 50, 25 ) );
    pushButton3->setFont(QFont("Times",9));
    
    //确定按钮和槽函数的连接
//    Search2 *p = new Search2;
    connect(pushButton1,SIGNAL(clicked()),SLOT(sendto_search2()));
    connect(pushButton1,SIGNAL(clicked()),this,SLOT(close()));
    
    //清空按钮和槽函数的连接
    connect( pushButton2,SIGNAL(clicked()),lineEdit2,SLOT(clear()));
    
   //返回按钮和主界面函数相连 
//    Major *q = new Major;
    connect( pushButton3,SIGNAL(clicked()),SLOT(sendto_major()));
    connect( pushButton3,SIGNAL(clicked()),this,SLOT(close()));
   
}


//==========================某台的点菜信息界面的实现==============================
/*
 *  Constructs a Sea2 as a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'.
 */
Search2::Search2()
{
	setGeometry(0,0,240,320);
	setCaption("Search");
    setPaletteBackgroundColor( QColor( 233, 239, 190 ) );

/*    textLabel1 = new QLabel( this, "textLabel1" );
    textLabel1->setGeometry( QRect( 0, 0, 240, 30 ) );
 //   textLabel1->setFont(QFont("Times",13,QFont::Bold));  */

    table1 = new QTable( this, "table1" );
    table1->setFont(QFont("Times",9));
    table1->setNumCols( table1->numCols() + 1 );
    table1->horizontalHeader()->setLabel( table1->numCols() - 1, tr( "dish" ) );
    table1->setNumCols( table1->numCols() + 1 );
    table1->horizontalHeader()->setLabel( table1->numCols() - 1, tr( "price" ) );
    table1->setNumCols( table1->numCols() + 1 );
    table1->horizontalHeader()->setLabel( table1->numCols() - 1, tr( "count" ) );
    table1->setNumCols( table1->numCols() + 1 );
    table1->horizontalHeader()->setLabel( table1->numCols() - 1, tr( "total" ) );
    table1->setNumCols( table1->numCols() + 1 );
    table1->horizontalHeader()->setLabel( table1->numCols() - 1, tr( "mark" ) );
    table1->setNumRows( table1->numRows() + 1 );
    table1->verticalHeader()->setLabel( table1->numRows() - 1, tr( "1" ) );
    table1->setNumRows( table1->numRows() + 1 );
    table1->verticalHeader()->setLabel( table1->numRows() - 1, tr( "2" ) );
    table1->setNumRows( table1->numRows() + 1 );
    table1->verticalHeader()->setLabel( table1->numRows() - 1, tr( "3" ) );
    table1->setNumRows( table1->numRows() + 1 );
    table1->verticalHeader()->setLabel( table1->numRows() - 1, tr( "4" ) );
    table1->setNumRows( table1->numRows() + 1 );
    table1->verticalHeader()->setLabel( table1->numRows() - 1, tr( "5" ) );
    table1->setNumRows( table1->numRows() + 1 );
    table1->verticalHeader()->setLabel( table1->numRows() - 1, tr( "6" ) );
    table1->setNumRows( table1->numRows() + 1 );
    table1->verticalHeader()->setLabel( table1->numRows() - 1, tr( "7" ) );
    table1->setNumRows( table1->numRows() + 1 );
    table1->verticalHeader()->setLabel( table1->numRows() - 1, tr( "8" ) );
    table1->setNumRows( table1->numRows() + 1 );
    table1->verticalHeader()->setLabel( table1->numRows() - 1, tr( "9" ) );
    table1->setNumRows( table1->numRows() + 1 );
    table1->verticalHeader()->setLabel( table1->numRows() - 1, tr( "10" ) );
    table1->setGeometry( QRect( 0, 0, 240, 221 ) );
    table1->setNumRows( 10 );
    table1->setNumCols( 5 );
 
    textLabel2 = new QLabel("sum",this, "textLabel2" );
    textLabel2->setGeometry( QRect( 0, 225, 30, 20 ) );
    textLabel2->setFont(QFont("Times",9));
    lineEdit2 = new QLineEdit( this, "lineEdit2" );
    lineEdit2->setGeometry( QRect( 30, 225, 70, 20 ) );

    textLabel3 = new QLabel("desk",this, "textLabel3" );
    textLabel3->setGeometry( QRect( 105, 225, 30, 20 ) ); 
    textLabel3->setFont(QFont("Times",9));    
    lineEdit1 = new QLineEdit( this, "lineEdit1" );
    lineEdit1->setGeometry( QRect( 135, 225, 20, 20 ) );

    
    textLabel4 = new QLabel( "times",this, "textLabel4" );
    textLabel4->setGeometry( QRect( 160, 225, 40, 20 ) );
    textLabel4->setFont(QFont("Times",9));
    spinBox1 = new QSpinBox( this, "spinBox1" );
    spinBox1->setFont(QFont("Times",9));
    spinBox1->setGeometry( QRect( 200, 225, 40, 20 ) );
    

    pushButton1 = new QPushButton("order",this, "pushButton1" );
    pushButton1->setGeometry( QRect( 0, 250, 48, 25 ) ); 
    pushButton1->setFont(QFont("Times",9)); 
 
    pushButton2 = new QPushButton("modify",this, "pushButton2" );
    pushButton2->setGeometry( QRect( 48, 250, 48, 25 ) );
    pushButton2->setFont(QFont("Times",9)); 
 
    pushButton3 = new QPushButton("cancel",this, "pushButton3" );
    pushButton3->setGeometry( QRect( 96, 250, 48, 25 ) );
    pushButton3->setFont(QFont("Times",9));

    pushButton4 = new QPushButton("check",this, "pushButton4" );
    pushButton4->setGeometry( QRect( 144, 250, 48, 25 ) ); 
    pushButton4->setFont(QFont("Times",9));

    pushButton5 = new QPushButton("back",this, "pushButton5" );
    pushButton5->setGeometry( QRect( 192, 250, 48, 25 ) );
    pushButton5->setFont(QFont("Times",9));

    connect(pushButton3,SIGNAL(clicked()),SLOT(sendto_search3()));
    connect(pushButton3,SIGNAL(clicked()),this,SLOT(close()));
    
     //建立ret和退菜界面的连接 
  //  Order *search_ok_order = new Order;
    connect(pushButton1,SIGNAL(clicked()),SLOT(sendto_order()));
    connect(pushButton1,SIGNAL(clicked()),this,SLOT(close()));
    
     //建立back和上一级界面的连接
  //  Search *search_back = new Search;    
    connect(pushButton5,SIGNAL(clicked()),SLOT(sendto_search()));
    connect(pushButton5,SIGNAL(clicked()),this,SLOT(close()));
}

//--------------------------退菜界面的实现-----------------------------
/*
 *  Constructs a Search3 as a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'.
 */
Search3::Search3()
{
	setGeometry(0,0,240,320);
	setCaption("Search");
    setPaletteBackgroundColor( QColor( 233, 239, 190 ) );
   
    textLabel1 = new QLabel( this, "textLabel1" );
    textLabel1->setGeometry( QRect( 0, 0, 240, 30) );
	textLabel1->setFont(QFont("Times",9)); 

    textLabel2 = new QLabel( this, "textLabel2" );
    textLabel2->setGeometry( QRect( 40, 50, 50, 20 ) );
    textLabel2->setFont(QFont("Times",9)); 
    lineEdit1 = new QLineEdit( this, "lineEdit1" );
    lineEdit1->setGeometry( QRect( 90, 50, 110, 20  ) );

    textLabel3 = new QLabel( this, "textLabel3" );
    textLabel3->setGeometry( QRect( 40, 90, 50, 20 ) );
    textLabel3->setFont(QFont("Times",9)); 
    lineEdit2 = new QLineEdit( this, "lineEdit2" );
    lineEdit2->setGeometry( QRect( 90, 90, 110, 20 ) );

    textLabel4 = new QLabel( this, "textLabel4" );
    textLabel4->setGeometry( QRect( 40, 130, 50, 20 ) );
    textLabel4->setFont(QFont("Times",9)); 
    comboBox1 = new QComboBox( this, "comboBox1" );
    comboBox1->setGeometry( QRect( 90, 130, 110, 20 ) );

    pushButton1 = new QPushButton( this, "pushButton1" );
    pushButton1->setGeometry( QRect( 40, 190, 70, 25 ) );
    pushButton1->setFont(QFont("Times",9)); 
    
    pushButton2 = new QPushButton( this, "pushButton2" );
    pushButton2->setGeometry( QRect( 120, 190, 70, 25 ) );
    pushButton2->setFont(QFont("Times",9)); 
    
    languageChange();

    connect(pushButton2,SIGNAL(clicked()),SLOT(sendto_search2()));
    connect(pushButton2,SIGNAL(clicked()),this,SLOT(close()));
}

/*
 *  Sets the strings of the subwidgets using the current
 *  language.
 */
void Search3::languageChange()
{
    textLabel1->setText( "Cancel" );    
    textLabel2->setText( "desk" );
    textLabel3->setText( "dish"  );
    textLabel4->setText( "reason" ); 
    comboBox1->clear();
    comboBox1->setFont(QFont("Times",9));
    comboBox1->insertItem( tr( "0" ) );
    comboBox1->insertItem( tr( "1" ) );
    comboBox1->insertItem( tr( "2" ) );
    comboBox1->insertItem( tr( "3" ) );  
    pushButton1->setText( "ok" );
    pushButton2->setText( "back" );

}
/*------------------------------------------------------------------
*Function:to accomplish the interface of landing
*Makedate:20090312
-------------------------------------------------------------------*/
Show_out::Show_out()
{
	/* to create interfaces */
	Major *major_face = new Major;
	Order *order_one = new Order;
	Order2 *order_two = new Order2;
	Search *search_one = new Search;
	Search2 *search_two = new Search2;
	Search3 *search_three = new Search3;
	Land_main *main_show = new Land_main;
	Wrong_message *wrong_mess = new Wrong_message;
	Set_up *setup_show = new Set_up;
	Setup_account *set_acount = new Setup_account; 
	Setup_ip *set_ip = new Setup_ip;  
	Success_register *regist = new Success_register;
	Land_in *in_show = new Land_in;

	/*	create connection	*/
	connect(major_face,SIGNAL(send1()),order_one,SLOT(show()));
	connect(major_face,SIGNAL(send2()),search_one,SLOT(show()));
	connect(major_face,SIGNAL(sendto_land()),main_show,SLOT(show()));
	connect(order_one,SIGNAL(send3()),order_two,SLOT(show()));
	connect(order_one,SIGNAL(send4()),major_face,SLOT(show()));
	connect(order_two,SIGNAL(send5()),order_one,SLOT(show()));
	connect(search_one,SIGNAL(send6()),major_face,SLOT(show()));
	connect(search_one,SIGNAL(send_search2()),search_two,SLOT(show()));
	connect(search_two,SIGNAL(send7()),search_one,SLOT(show()));
	connect(search_two,SIGNAL(send8()),order_one,SLOT(show()));
	connect(search_two,SIGNAL(send9()),search_three,SLOT(show()));
	connect(search_three,SIGNAL(send()),search_two,SLOT(show()));
	connect(main_show,SIGNAL(send_yes()),setup_show,SLOT(show()));
								//connect main_show to 	setup_show		
	connect(main_show,SIGNAL(send_no()),wrong_mess,SLOT(show()));
								//connect main_show to wrong_mess
	connect(main_show,SIGNAL(to_turn()),major_face,SLOT(show()));							
	connect(setup_show,SIGNAL(upsend()),in_show,SLOT(show()));
								//connect setup_show to in_show
	connect(setup_show,SIGNAL(ip_send()),set_ip,SLOT(show()));
								//connect setup_show to set_ip
	connect(setup_show,SIGNAL(code_send()),set_acount,SLOT(show()));
								//connect setup_show to set_acount
	connect(set_ip,SIGNAL(to_next()),regist,SLOT(show()));
								//connect set_ip to regist
	connect(set_acount,SIGNAL(next_up()),regist,SLOT(show()));
								//connect set_acount to regist

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -