双电梯调度程序


一、什么是双电梯调度程序?

多电梯是在单电梯的基础上进行修改,在调度器分配请求时通过某种方式将请求分给不同的电梯,然后每台电梯按照单电梯的调度算法进行运行即可。

二、双电梯调度程序的需求

1.基本需求

首先分析的是:单个电梯的需求,首先要满足基本的上和下,接着需要满足捎带的需求(就是如果电梯在6楼上升的过程,收到了13层的向上的需求,电梯就应该响应这个需求)

接着就应该分析两个电梯的情况,就是两个电梯在当前的状态下,收到了外部的需求,一个楼层的一个请求(上或者下)。

因为我是自己一个人分析,就是将问题不断的简单化,将双电梯调度程序根据两个电梯的运行状态分解为大致5类情况:
1.两个电梯都空闲状态。
2.两个电梯都上升状态。
3.两个电梯都下降状态。
4.一个电梯上升,一个空闲。
5.一个电梯下降,一个空闲。

所以以下给出我设计的程序的黑盒测试:

请添加图片描述

请添加图片描述
在这里插入图片描述
在这里插入图片描述

注:以上的黑盒测试只是大部分的,因为我们老师只是要求做一个电梯调度程序,所以并不知道具体的用户需求,所以可能出现一些和实际不想符合的小问题,希望可以谅解。

2.代码

我是采用的qt进行的编程,代码具体如下:

elevator.h

#ifndef ELEVATOR_H
#define ELEVATOR_H
#include<qmenubar.h>
#include<qpainter.h>
#include<qmessagebox.h>
#include<qdebug.h>
#include<iomanip>
#include<qfont.h>
#include<qlabel.h>

using namespace std;

class elevator
{
public:
    elevator();
    int ele = 1;           //两个电梯的位置
    int uOd = 0;           //上还是下,1上   -1下


    int need1[7] = {-1,0,0,0,0,0,0};           //ele1有需求的楼层      1为有人按


    //int need[7] = {-1,-1,-1,-1,-1,-1,-1};             //外面有人按电梯
    bool daoda = false;

    void control();           //控制




    void getneed(int m);         //得到需求

    void flag();
    void merge();


    void ceshi();           //测试用
    void chongzhi();        //重置方法

    void print();           //输出方法
    int getele();          //输出ele1
    //int getele2();          //输出ele2
    bool isopen();          //是否开门
};

#endif // ELEVATOR_H

MainWindow.h

#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include "elevator.h"
namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    int floor;

    int up[7] = {0,0,0,0,0,0,0};             //0说明没需求   1有需求
    int down[7] = {0,0,0,0,0,0,0};

    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();

    void merge(elevator &a,elevator &b,int *up,int *down);      //调度函数

    void xiakong(elevator &a,elevator &b,int *up,int *down);
    void shangkong(elevator &a,elevator &b,int *up,int *down);
    void kongkong(elevator &a,elevator &b,int *up,int *down);
    void shangshang(elevator &a,elevator &b,int *up);
    void xiaxia(elevator &a,elevator &b,int *down);
    void shangxia(elevator &a,elevator &b,int *up,int *down);


private:
    Ui::MainWindow *ui;
};

#endif // MAINWINDOW_H

elevator.cpp

#include "elevator.h"

#include<qmenubar.h>
#include<qpainter.h>
#include<qmessagebox.h>
#include<qdebug.h>
#include<iomanip>
#include<qfont.h>
#include<qlabel.h>
#include<iostream>
using namespace std;


elevator::elevator()            //初始化
{

    ele = 1;
    //uOd = 1;           //默认是上
    for(int i = 1 ; i < 7 ; i++){       //有需求的楼层      1为有人按
        need1[i] = 0;
    }

}
void elevator::control(){                 //控制
    int i,j;
    flag();                             //上还是下
    daoda = false;
    switch (uOd) {                     //对1电梯来说,是上还是下


    case -1:                             //-1  下
        if(need1[ele] == 0) ele--;
        else{
            need1[ele] = 0;daoda = true;
        }
        break;

    case 1:                             //1  上
        if(need1[ele] == 0){
            ele++;
        }
        else{
            need1[ele] = 0;daoda = true;
        }
        break;
    default:
        break;
    }
}
void elevator::flag(){                      //向上还是向下
    int flag = 0;
    bool up = false,down = false;

    for(int i = ele ; i < 7 ; i++){       //上有需求?
        if(need1[i] == 1){
            up = true;
        }
    }
    for(int i = ele ; i > 0 ; i--){       //下有需求?
        if(need1[i] == 1){
            down = true;
        }
    }
    if(up == false && down == false){     //上下都没需求
        uOd =0;
    }
    else if(up == false && down == true){     //下有需求
        uOd = -1;
    }
    else if(up&down == true && uOd == -1){      //上下都有,并且向下,,就直接向下
        uOd = -1;
    }else{                  //if(up = true && down = false){     //上有需求  //上下都有
        uOd = 1;
    }
}
void elevator::merge(){                 //need  need1  need2 合并

}



void elevator::getneed(int m){                   //得到需求
    if(uOd != 1){       //上升按下面不能响应
        need1[m] = 1;
    }
    else{
        if(m >= ele){
            need1[m] = 1;
        }
    }

}




int elevator::getele(){            //输出ele1
    return ele;
}


void elevator::ceshi(){                 //测试用
    cout << "111111" << endl;

}

void elevator::chongzhi(){              //重置方法
    ele = 0;

    for(int i = 1 ; i < 7 ; i++){       //有需求的楼层      1为有人按
        need1[i] = 0;
    }
}

void elevator::print(){                 //输出方法
    cout << "ele is " << ele << endl;

    /*for(int i = 1 ; i < 7 ; i++){       //有需求的楼层      1为有人按
        cout << need[i] << "  ";
    }
    cout << endl;*/
}

bool elevator::isopen(){                 //是否开门
    if(daoda == true ){
        //cout << "daoda      "  <<endl;
        //uOd = 0;
        return true;
    }
}

mainwindow.cpp

#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "elevator.h"
#include<qdebug.h>
#include<iostream>
#include<string>
using namespace std;

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    //窗口大小
    resize(1000,600);

    //菜单栏的创建
    QMenuBar *bar = menuBar();
    setMenuBar(bar);



    elevator *aaa = new elevator();     //电梯1
    elevator *bbb = new elevator();     //电梯2

    //槽函数
        //按下楼层1
    connect(ui->pushButton,&QPushButton::clicked,[=](){
        aaa->getneed(1);
        ui->pushButton->setStyleSheet("background-color:red");
    });
    connect(ui->pushButton_2,&QPushButton::clicked,[=](){
        aaa->getneed(2);
        ui->pushButton_2->setStyleSheet("background-color:red");
    });
    connect(ui->pushButton_3,&QPushButton::clicked,[=](){
        aaa->getneed(3);
        ui->pushButton_3->setStyleSheet("background-color:red");//
    });
    connect(ui->pushButton_4,&QPushButton::clicked,[=](){
        aaa->getneed(4);
        ui->pushButton_4->setStyleSheet("background-color:red");
    });
    connect(ui->pushButton_5,&QPushButton::clicked,[=](){
        aaa->getneed(5);
        ui->pushButton_5->setStyleSheet("background-color:red");
    });
    connect(ui->pushButton_6,&QPushButton::clicked,[=](){
        aaa->getneed(6);
        ui->pushButton_6->setStyleSheet("background-color:red");
    });


    connect(ui->pushButton_9,&QPushButton::clicked,[=](){
        bbb->getneed(1);
        ui->pushButton_9->setStyleSheet("background-color:red");
    });
    connect(ui->pushButton_10,&QPushButton::clicked,[=](){
        bbb->getneed(2);
        ui->pushButton_10->setStyleSheet("background-color:red");
    });
    connect(ui->pushButton_11,&QPushButton::clicked,[=](){
        bbb->getneed(3);
        ui->pushButton_11->setStyleSheet("background-color:red");//
    });
    connect(ui->pushButton_12,&QPushButton::clicked,[=](){
        bbb->getneed(4);
        ui->pushButton_12->setStyleSheet("background-color:red");
    });
    connect(ui->pushButton_13,&QPushButton::clicked,[=](){
        bbb->getneed(5);
        ui->pushButton_13->setStyleSheet("background-color:red");
    });
    connect(ui->pushButton_14,&QPushButton::clicked,[=](){
        bbb->getneed(6);
        ui->pushButton_14->setStyleSheet("background-color:red");
    });


    //  //外部按键
    connect(ui->pushButton_7,&QPushButton::clicked,[=](){           //几楼?shang
        floor = ui->comboBox->currentIndex() + 1;
        if(floor == 6){
            QMessageBox::critical(this,"警告","已到顶层!!");
        }
        else{
            cout << "floor is " << floor << endl;
            up[floor] = 1;
        }
    });

    connect(ui->pushButton_8,&QPushButton::clicked,[=](){
        floor = ui->comboBox->currentIndex() + 1;
        if(floor == 1){
            QMessageBox::critical(this,"警告","已到一楼!!");
        }
        else{
            cout << "floor is " << floor << endl;
            down[floor] = 1;

        }

    });

    connect(ui->actionbbb,&QAction::triggered,[=](){             //重置
        aaa->chongzhi();
        bbb->chongzhi();
    });
    connect(ui->next,&QPushButton::clicked,[=](){             //下一步

        merge(*aaa,*bbb,up,down);
        aaa->control();
        bbb->control();


        ui->lcdNumber->display(aaa->getele());
        ui->lcdNumber_2->display(bbb->getele());

        if(aaa->isopen()){
            ui->label_4->setText("开");
        }
        else ui->label_4->setText("关");

        if(bbb->isopen()){
            ui->label_5->setText("开");
        }
        else ui->label_5->setText("关");

        //到达颜色回复
        for(int i = 1 ; i < 7 ; i++){
            if(aaa->need1[i]  == 0){
                switch(i){
                    case 1:ui->pushButton->setStyleSheet("background-color:rgb(255,255,255),sev(0,0,240)");break;
                    case 2:ui->pushButton_2->setStyleSheet("background-color:rgb(255,255,255),sev(0,0,240)");break;
                    case 3:ui->pushButton_3->setStyleSheet("background-color:rgb(255,255,255),sev(0,0,240)");break;
                    case 4:ui->pushButton_4->setStyleSheet("background-color:rgb(255,255,255),sev(0,0,240)");break;
                    case 5:ui->pushButton_5->setStyleSheet("background-color:rgb(255,255,255),sev(0,0,240)");break;
                    case 6:ui->pushButton_6->setStyleSheet("background-color:rgb(255,255,255),sev(0,0,240)");break;
                }
             }
            if(bbb->need1[i]  == 0){
                switch(i){
                    case 1:ui->pushButton_9->setStyleSheet("background-color:rgb(255,255,255),sev(0,0,240)");break;
                    case 2:ui->pushButton_10->setStyleSheet("background-color:rgb(255,255,255),sev(0,0,240)");break;
                    case 3:ui->pushButton_11->setStyleSheet("background-color:rgb(255,255,255),sev(0,0,240)");break;
                    case 4:ui->pushButton_12->setStyleSheet("background-color:rgb(255,255,255),sev(0,0,240)");break;
                    case 5:ui->pushButton_13->setStyleSheet("background-color:rgb(255,255,255),sev(0,0,240)");break;
                    case 6:ui->pushButton_14->setStyleSheet("background-color:rgb(255,255,255),sev(0,0,240)");break;
                }
             }
        }
    });
}


void MainWindow::merge(elevator &a,elevator &b,int *up,int *down){          //合并函数
    //分情况       uOd         -1下   0不走   1上
    //string flag = a.uOd + b.uOd;
    //上空,下空,空空,上上,下下,下上

    //下上    能捎带就捎带,不能就不管
    //上空,下空    能捎带就捎带,不能空闲的去
    //空空    比较最近的去
    //上上,下下     都能捎带,更上的捎带,     不都可捎带,不更上的捎带

    switch ((a.uOd + b.uOd)) {
    cout << a.uOd + b.uOd << endl;
    case 1://上空
        if(a.uOd == 1){                             //a上,b空闲
            shangkong(a,b,up,down);
        }else{
            shangkong(b,a,up,down);
        }

        break;

    case -1://下空
        if(a.uOd == -1){                             //a下,b空闲
            xiakong(a,b,up,down);
        }
        else{
            xiakong(b,a,up,down);                   //b下,a空闲
        }
    case 0: //空空,上下
        if(a.uOd == b.uOd){     //空空        计算离需求最近的电梯
            kongkong(a,b,up,down);
        }else{                  //上下        能捎带,就捎带
            if(a.uOd == 1){         //a上
                shangxia(a,b,up,down);
            }else{
                shangxia(b,a,up,down);
            }
        }

        break;
    case 2: //上上        都能捎带,更上的捎带,     不都可捎带,不更上的捎带(捎带只捎带向上的)
        shangshang(a,b,up);
        break;
    case -2: //下下
        xiaxia(a,b,down);
        break;
    default:
        break;
    }
}




void MainWindow::shangkong(elevator &a,elevator &b,int *up,int *down){
    for(int i = a.ele ; i < 7 ; i++){       //需求在       a上
        a.need1[i] = a.need1[i] + up[i];    //向上就捎带 向下就不管
        if(up[i] == 1) up[i] = 0;

        b.need1[i] = b.need1[i] + down[i];
        if(down[i] == 1) down[i] = 0;
    }
    for(int i = a.ele ; i > 0 ; i--){       //需求在       a下
        b.need1[i] = b.need1[i] + up[i];    //向上就捎带 向下也捎带
        if(up[i] == 1) up[i] = 0;

        b.need1[i] = b.need1[i] + down[i];    //向上就捎带 向下也捎带
        if(down[i] == 1) down[i] = 0;
    }
}

void MainWindow::xiakong(elevator &a,elevator &b,int *up,int *down){      //下空
    for(int i = a.ele ; i > 0 ; i--){       //需求在       a下
        a.need1[i] = a.need1[i] + down[i];    //向下就捎带 向就不管
        if(down[i] == 1) down[i] = 0;

        b.need1[i] = b.need1[i] + up[i];    //下方有向上的需求  b去响应
        if(up[i] == 1) up[i] = 0;
    }
    for(int i = a.ele ; i < 7 ; i++){       //需求在       a上
        b.need1[i] = b.need1[i] + up[i];    //向下就捎带 向上也捎带
        if(up[i] == 1) up[i] = 0;

        b.need1[i] = b.need1[i] + down[i];    //向下就捎带 向上也捎带
        if(down[i] == 1) down[i] = 0;
    }
}
void MainWindow::kongkong(elevator &a,elevator &b,int *up,int *down){
    for(int i = 1 ; i < 7 ; i++){       //找需求       优先a
        if(up[i] == 1 || down[i] == 1){                 //不管需求的方向
            if(abs(a.ele-i) <= abs(b.ele-i)) {//a更近
                a.need1[i] = a.need1[i] + up[i];    //a响应
                if(up[i] == 1) up[i] = 0;

                a.need1[i] = a.need1[i] + down[i];
                if(down[i] == 1) down[i] = 0;
        }else{
                b.need1[i] = b.need1[i] + up[i];    //b响应
                if(up[i] == 1) up[i] = 0;

                b.need1[i] = b.need1[i] + down[i];
                if(down[i] == 1) down[i] = 0;
            }
        }
    }
}
void MainWindow::shangshang(elevator &a,elevator &b,int *up){
    for(int i = 1 ; i < 7 ; i++){       //找需求
        if(up[i] == 1){  //需求是i
            if(a.ele <= i && b.ele <= i){       //都在上方小的去
                if(a.ele >= b.ele){
                    a.need1[i] = a.need1[i] + up[i];    //a更上
                    if(up[i] == 1) up[i] = 0;
                }else{
                    b.need1[i] = b.need1[i] + up[i];    //b更上
                    if(up[i] == 1) up[i] = 0;
                }
            }else if(a.ele <= i){
                a.need1[i] = a.need1[i] + up[i];    //a
                if(up[i] == 1) up[i] = 0;
            }else if(b.ele <= i){
                b.need1[i] = b.need1[i] + up[i];    //b
                if(up[i] == 1) up[i] = 0;
            }
        }
    }
}
void MainWindow::xiaxia(elevator &a,elevator &b,int *down){
    for(int i = 1 ; i < 7 ; i++){       //找需求
        if(down[i] == 1){  //需求是i
            if(a.ele >= i && b.ele >= i){       //都在上方小的去
                if(a.ele <= b.ele){
                    a.need1[i] = a.need1[i] + down[i];    //a更上
                    if(down[i] == 1) down[i] = 0;
                }else{
                    b.need1[i] = b.need1[i] + down[i];    //b更上
                    if(down[i] == 1) down[i] = 0;
                }
            }else if(a.ele >= i){
                a.need1[i] = a.need1[i] + down[i];    //a
                if(down[i] == 1) down[i] = 0;
            }else if(b.ele >= i){
                b.need1[i] = b.need1[i] + down[i];    //b
                if(down[i] == 1) down[i] = 0;
            }
        }
    }
}
void MainWindow::shangxia(elevator &a,elevator &b,int *up,int *down){
    for(int i = a.ele ; i < 7 ; i++){       //需求在       a上
        a.need1[i] = a.need1[i] + up[i];
        if(up[i] == 1) up[i] = 0;
    }
    for(int i = b.ele ; i > 0 ; i--){       //需求在       b下
        b.need1[i] = b.need1[i] + down[i];
        if(down[i] == 1) down[i] = 0;
    }
}



MainWindow::~MainWindow()
{
    delete ui;
}

main.cpp

#include "mainwindow.h"
#include <QApplication>
#include "elevator.h"

using namespace std;

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    MainWindow w;
    w.show();
    return a.exec();
}

ui界面

<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
 <class>MainWindow</class>
 <widget class="QMainWindow" name="MainWindow">
  <property name="geometry">
   <rect>
    <x>0</x>
    <y>0</y>
    <width>1108</width>
    <height>640</height>
   </rect>
  </property>
  <property name="windowTitle">
   <string>MainWindow</string>
  </property>
  <widget class="QWidget" name="centralWidget">
   <widget class="QWidget" name="layoutWidget">
    <property name="geometry">
     <rect>
      <x>20</x>
      <y>20</y>
      <width>441</width>
      <height>421</height>
     </rect>
    </property>
    <layout class="QVBoxLayout" name="verticalLayout_3">
     <item>
      <widget class="QGroupBox" name="groupBox">
       <property name="title">
        <string>电梯内部</string>
       </property>
       <widget class="QPushButton" name="next">
        <property name="geometry">
         <rect>
          <x>120</x>
          <y>320</y>
          <width>155</width>
          <height>28</height>
         </rect>
        </property>
        <property name="text">
         <string>next</string>
        </property>
       </widget>
       <widget class="QWidget" name="layoutWidget">
        <property name="geometry">
         <rect>
          <x>10</x>
          <y>27</y>
          <width>411</width>
          <height>271</height>
         </rect>
        </property>
        <layout class="QVBoxLayout" name="verticalLayout_6">
         <item>
          <layout class="QVBoxLayout" name="verticalLayout_2">
           <item>
            <layout class="QHBoxLayout" name="horizontalLayout">
             <item>
              <widget class="QLabel" name="label">
               <property name="text">
                <string>电梯     #      1</string>
               </property>
              </widget>
             </item>
            </layout>
           </item>
           <item>
            <layout class="QVBoxLayout" name="verticalLayout">
             <item>
              <layout class="QHBoxLayout" name="horizontalLayout_3">
               <item>
                <widget class="QPushButton" name="pushButton">
                 <property name="text">
                  <string>1</string>
                 </property>
                </widget>
               </item>
               <item>
                <widget class="QPushButton" name="pushButton_2">
                 <property name="text">
                  <string>2</string>
                 </property>
                </widget>
               </item>
               <item>
                <widget class="QPushButton" name="pushButton_3">
                 <property name="text">
                  <string>3</string>
                 </property>
                </widget>
               </item>
              </layout>
             </item>
             <item>
              <layout class="QHBoxLayout" name="horizontalLayout_2">
               <item>
                <widget class="QPushButton" name="pushButton_4">
                 <property name="text">
                  <string>4</string>
                 </property>
                </widget>
               </item>
               <item>
                <widget class="QPushButton" name="pushButton_5">
                 <property name="text">
                  <string>5</string>
                 </property>
                </widget>
               </item>
               <item>
                <widget class="QPushButton" name="pushButton_6">
                 <property name="text">
                  <string>6</string>
                 </property>
                </widget>
               </item>
              </layout>
             </item>
            </layout>
           </item>
          </layout>
         </item>
         <item>
          <layout class="QVBoxLayout" name="verticalLayout_4">
           <item>
            <layout class="QHBoxLayout" name="horizontalLayout_4">
             <item>
              <widget class="QLabel" name="label_3">
               <property name="text">
                <string>电梯     #      2</string>
               </property>
              </widget>
             </item>
            </layout>
           </item>
           <item>
            <layout class="QVBoxLayout" name="verticalLayout_5">
             <item>
              <layout class="QHBoxLayout" name="horizontalLayout_9">
               <item>
                <widget class="QPushButton" name="pushButton_9">
                 <property name="text">
                  <string>1</string>
                 </property>
                </widget>
               </item>
               <item>
                <widget class="QPushButton" name="pushButton_10">
                 <property name="text">
                  <string>2</string>
                 </property>
                </widget>
               </item>
               <item>
                <widget class="QPushButton" name="pushButton_11">
                 <property name="styleSheet">
                  <string notr="true">gridline-color: rgb(225, 225, 225);</string>
                 </property>
                 <property name="text">
                  <string>3</string>
                 </property>
                </widget>
               </item>
              </layout>
             </item>
             <item>
              <layout class="QHBoxLayout" name="horizontalLayout_10">
               <item>
                <widget class="QPushButton" name="pushButton_12">
                 <property name="text">
                  <string>4</string>
                 </property>
                </widget>
               </item>
               <item>
                <widget class="QPushButton" name="pushButton_13">
                 <property name="text">
                  <string>5</string>
                 </property>
                </widget>
               </item>
               <item>
                <widget class="QPushButton" name="pushButton_14">
                 <property name="text">
                  <string>6</string>
                 </property>
                </widget>
               </item>
              </layout>
             </item>
            </layout>
           </item>
          </layout>
         </item>
        </layout>
       </widget>
      </widget>
     </item>
    </layout>
   </widget>
   <widget class="QGroupBox" name="groupBox_2">
    <property name="geometry">
     <rect>
      <x>510</x>
      <y>30</y>
      <width>441</width>
      <height>211</height>
     </rect>
    </property>
    <property name="title">
     <string>电梯外部</string>
    </property>
    <widget class="QWidget" name="layoutWidget">
     <property name="geometry">
      <rect>
       <x>80</x>
       <y>40</y>
       <width>118</width>
       <height>23</height>
      </rect>
     </property>
     <layout class="QHBoxLayout" name="horizontalLayout_7">
      <item>
       <widget class="QLabel" name="label_2">
        <property name="text">
         <string>楼层    #</string>
        </property>
       </widget>
      </item>
      <item>
       <widget class="QComboBox" name="comboBox">
        <item>
         <property name="text">
          <string>1</string>
         </property>
        </item>
        <item>
         <property name="text">
          <string>2</string>
         </property>
        </item>
        <item>
         <property name="text">
          <string>3</string>
         </property>
        </item>
        <item>
         <property name="text">
          <string>4</string>
         </property>
        </item>
        <item>
         <property name="text">
          <string>5</string>
         </property>
        </item>
        <item>
         <property name="text">
          <string>6</string>
         </property>
        </item>
       </widget>
      </item>
     </layout>
    </widget>
    <widget class="QWidget" name="layoutWidget">
     <property name="geometry">
      <rect>
       <x>50</x>
       <y>110</y>
       <width>195</width>
       <height>30</height>
      </rect>
     </property>
     <layout class="QHBoxLayout" name="horizontalLayout_5">
      <item>
       <widget class="QPushButton" name="pushButton_7">
        <property name="text">
         <string></string>
        </property>
       </widget>
      </item>
     </layout>
    </widget>
    <widget class="QWidget" name="layoutWidget">
     <property name="geometry">
      <rect>
       <x>50</x>
       <y>150</y>
       <width>195</width>
       <height>30</height>
      </rect>
     </property>
     <layout class="QHBoxLayout" name="horizontalLayout_6">
      <item>
       <widget class="QPushButton" name="pushButton_8">
        <property name="text">
         <string></string>
        </property>
       </widget>
      </item>
     </layout>
    </widget>
    <widget class="QWidget" name="layoutWidget">
     <property name="geometry">
      <rect>
       <x>280</x>
       <y>50</y>
       <width>151</width>
       <height>81</height>
      </rect>
     </property>
     <layout class="QHBoxLayout" name="horizontalLayout_8">
      <item>
       <widget class="QLCDNumber" name="lcdNumber">
        <property name="lineWidth">
         <number>1</number>
        </property>
        <property name="digitCount">
         <number>2</number>
        </property>
        <property name="value" stdset="0">
         <double>1.000000000000000</double>
        </property>
       </widget>
      </item>
      <item>
       <widget class="QLCDNumber" name="lcdNumber_2">
        <property name="frameShadow">
         <enum>QFrame::Plain</enum>
        </property>
        <property name="lineWidth">
         <number>1</number>
        </property>
        <property name="digitCount">
         <number>2</number>
        </property>
        <property name="value" stdset="0">
         <double>1.000000000000000</double>
        </property>
       </widget>
      </item>
     </layout>
    </widget>
    <widget class="QLabel" name="label_4">
     <property name="geometry">
      <rect>
       <x>310</x>
       <y>150</y>
       <width>72</width>
       <height>15</height>
      </rect>
     </property>
     <property name="text">
      <string></string>
     </property>
    </widget>
    <widget class="QLabel" name="label_5">
     <property name="geometry">
      <rect>
       <x>380</x>
       <y>150</y>
       <width>72</width>
       <height>15</height>
      </rect>
     </property>
     <property name="text">
      <string></string>
     </property>
    </widget>
   </widget>
  </widget>
  <widget class="QMenuBar" name="menuBar">
   <property name="geometry">
    <rect>
     <x>0</x>
     <y>0</y>
     <width>1108</width>
     <height>26</height>
    </rect>
   </property>
   <widget class="QMenu" name="menusdas">
    <property name="title">
     <string>测试</string>
    </property>
    <addaction name="actionaaa"/>
    <addaction name="actionbbb"/>
   </widget>
   <addaction name="menusdas"/>
  </widget>
  <widget class="QToolBar" name="mainToolBar">
   <attribute name="toolBarArea">
    <enum>TopToolBarArea</enum>
   </attribute>
   <attribute name="toolBarBreak">
    <bool>false</bool>
   </attribute>
  </widget>
  <widget class="QStatusBar" name="statusBar"/>
  <action name="actionaaa">
   <property name="text">
    <string>print</string>
   </property>
  </action>
  <action name="actionbbb">
   <property name="text">
    <string>重置</string>
   </property>
  </action>
 </widget>
 <layoutdefault spacing="6" margin="11"/>
 <resources/>
 <connections/>
</ui>


最终结果图:
在这里插入图片描述

总结

1.需要每次按下next键

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值