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

📄 mainform.ui.h

📁 在Linux底下用QtDesigner开发的一个进程同步例子。基本思想是设计一个缓冲区(循环队列)
💻 H
字号:
/****************************************************************************** ui.h extension file, included from the uic-generated form implementation.**** If you wish to add, delete or rename functions or slots use** Qt Designer which will update this file, preserving your code. Create an** init() function in place of a constructor, and a destroy() function in** place of a destructor.*****************************************************************************/#include"queue.h"#include <qmessagebox.h>#include<qstring.h>HQueue hq;static int in=0;static int out=0;void mainForm::addSlot(){    //HQueue hq;    /*    Circle item;*/    if(!hq.IsFull()&&0==out)    {	Circle item;    item.InitX=lineEdit1->text().toInt();    item.InitY=lineEdit2->text().toInt();    item.InitR=lineEdit3->text().toInt();    hq.EnQueue(item);    in++;    }    else if(in==3)    {    in=0;    QMessageBox::warning(this,"warning","you cannot add item,buffer is full!");    }    else	QMessageBox::warning(this,"warning","Buffer is not empty,you cannot add item!");}void mainForm::GetSlot(){   if(!hq.IsEmpty()&&0==in)     {  Circle item; 	   item=hq.DeQueue();      //item=hq.GetFront();  QString strX;  QString strY;  QString strR;  strX=strX.setNum(item.InitX);  strY=strY.setNum(item.InitY);  strR=strR.setNum(item.InitR);    lineEdit4->setText("x="+strX);//+item.InitX);  lineEdit5->setText("y="+strY);  lineEdit6->setText("r="+strR);  out++; }   else if(out==3)   {  out=0;       QMessageBox::warning(this,"warning","you cannot get item! Buffer is empty");  }   else       QMessageBox::warning(this,"warning","Buffer is not full,you cannot get item!");  //lineEdit1->setText()  }

⌨️ 快捷键说明

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