[go: up one dir, main page]

CN118819523A - QT monitoring interface generation, instruction generation and information refresh method based on JSON text - Google Patents

QT monitoring interface generation, instruction generation and information refresh method based on JSON text Download PDF

Info

Publication number
CN118819523A
CN118819523A CN202410954890.3A CN202410954890A CN118819523A CN 118819523 A CN118819523 A CN 118819523A CN 202410954890 A CN202410954890 A CN 202410954890A CN 118819523 A CN118819523 A CN 118819523A
Authority
CN
China
Prior art keywords
monitoring interface
parameter
page
json
values
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202410954890.3A
Other languages
Chinese (zh)
Inventor
邢旭东
段汉卿
王延
霍志勇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
CETC 54 Research Institute
Original Assignee
CETC 54 Research Institute
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by CETC 54 Research Institute filed Critical CETC 54 Research Institute
Priority to CN202410954890.3A priority Critical patent/CN118819523A/en
Publication of CN118819523A publication Critical patent/CN118819523A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/38Creation or generation of source code for implementing user interfaces
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/20Software design
    • G06F8/24Object-oriented

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention belongs to the technical field of computer processing, and relates to a method for generating a QT monitoring interface, generating instructions and refreshing information based on JSON text. Meanwhile, refreshing of equipment state monitoring information and generation of equipment control instructions can be completed, development efficiency is improved, and development complexity is reduced.

Description

基于JSON文本的QT监控界面产生、指令生成及信息刷新方法QT monitoring interface generation, instruction generation and information refresh method based on JSON text

技术领域Technical Field

本发明属于计算机处理技术领域,涉及一种基于JSON文本的QT监控界面产生、指令生成及信息刷新方法。The present invention belongs to the technical field of computer processing, and relates to a method for generating a QT monitoring interface, generating instructions and refreshing information based on JSON text.

背景技术Background Art

通常情况下,监控软件对于设备的状态通过图形界面展示给用户,用户通过图形界面下发控制指令至设备。由于设备的型号种类千差万别,监控参数的数量及内容也完全不同。监控界面一般采用开发环境提供的UI设计工具、硬编码或者两者结合的手段实现。采用UI设计工具设计监控界面,开发者需要根据设备监控参数的数量及内容,将所需要的控件在设计窗口一一实现。此方法方便直观,适合初级开发者开发设备监控参数数量少、内容简单的监控界面,但是不利于控件功能扩展和复用,监控参数数量变化时会增加软件开发和调试周期。采用硬编码途径实现的监控界面具备一定的可扩展和维护性,但是不够方便直观,同时界面布局难度较大。Normally, the monitoring software displays the status of the device to the user through a graphical interface, and the user issues control instructions to the device through the graphical interface. Due to the wide variety of device models, the number and content of monitoring parameters are also completely different. The monitoring interface is generally implemented using the UI design tools provided by the development environment, hard coding, or a combination of the two. When designing the monitoring interface using the UI design tool, the developer needs to implement the required controls one by one in the design window according to the number and content of the device monitoring parameters. This method is convenient and intuitive, and is suitable for junior developers to develop monitoring interfaces with a small number of device monitoring parameters and simple content, but it is not conducive to the expansion and reuse of control functions, and the software development and debugging cycle will increase when the number of monitoring parameters changes. The monitoring interface implemented using hard coding has certain scalability and maintainability, but it is not convenient and intuitive enough, and the interface layout is difficult.

在实际应用中,对于不同种类的设备的监视和控制指令在软件研制阶段经常发生变动,开发者需要花费大量的时间在实现监控界面控件更改,以及编写控件对应的功能,工作量大且容易出错,效率低下。In actual applications, the monitoring and control instructions for different types of equipment often change during the software development stage. Developers need to spend a lot of time implementing changes to monitoring interface controls and writing corresponding functions for the controls. This is a large workload, prone to errors, and inefficient.

发明内容Summary of the invention

针对当前监控软件设备监控界面及指令开发中存在的不足之处,本发明提供了一种基于JSON文本的QT监控界面产生、指令生成及信息刷新方法,基于JSON结构化文本内容,实现在QT框架下通用监控界面的动态产生,不再需要开发者进行定制化的代码编写。同时,能够完成设备状态监视信息的刷新和设备控制指令的生成,提高开发效率,降低开发复杂度。Aiming at the shortcomings in the development of current monitoring software equipment monitoring interface and instructions, the present invention provides a QT monitoring interface generation, instruction generation and information refresh method based on JSON text. Based on JSON structured text content, the dynamic generation of a universal monitoring interface under the QT framework is realized, and developers are no longer required to write customized codes. At the same time, the refreshing of equipment status monitoring information and the generation of equipment control instructions can be completed, which improves development efficiency and reduces development complexity.

本发明采用的技术方案是:The technical solution adopted by the present invention is:

一种基于JSON文本的QT监控界面产生方法,包括以下步骤:A method for generating a QT monitoring interface based on JSON text, comprising the following steps:

步骤1、使用硬编码方式,创建并初始化监控界面窗口,包括尺寸位置的设定、布局方式的设定和样式表的设定;Step 1: Use hard coding to create and initialize the monitoring interface window, including the setting of size and position, layout and style sheet;

步骤2、读取并解析JSON文本,判断读取内容是否规范;若是,则实例化一个初始的JSON对象,并存储JSON文本内容,否则结束;Step 2: Read and parse the JSON text to determine whether the read content is standard; if so, instantiate an initial JSON object and store the JSON text content, otherwise end;

步骤3、使用硬编码方式,创建标签页的多页面容器组件并加入至监控界面窗口,并基于JSON对象的页面数量及名称,针对每个页面创建表格控件,并设定表格样式表加入至标签页的多页面容器组件;Step 3: Use hard coding to create a multi-page container component for the tab page and add it to the monitoring interface window. Based on the number and name of the pages in the JSON object, create a table control for each page and set the table style sheet to add it to the multi-page container component for the tab page.

步骤4、基于JSON对象遍历键值对,并分别将键值赋值表格项;其中,表格项分为参数项和参数值,表格行数对应键值数,参数项对应对象键名,参数值对应对象值;并根据值内容分别创建不同类型的表格控件,包括编辑框、下拉框、选择框、选择开关和滑动条,叠加到表格单元格中;Step 4: Traverse the key-value pairs based on the JSON object, and assign the key values to table items respectively; the table items are divided into parameter items and parameter values, the number of table rows corresponds to the number of key values, the parameter items correspond to the object key names, and the parameter values correspond to the object values; and create different types of table controls according to the value content, including edit boxes, drop-down boxes, selection boxes, selection switches, and sliders, and overlay them in the table cells;

步骤5、使用硬编码方式,创建按钮控件并加入至监控界面窗口,与标签页的多页面容器组件使用同一布局,并为各个按钮控件分别添加相应槽函数,用于设备控制指令的生成下发、监控界面参数的动态增删和保存功能实现。Step 5. Use hard coding to create a button control and add it to the monitoring interface window. Use the same layout as the multi-page container component of the tab page, and add corresponding slot functions to each button control to generate and issue device control instructions, and dynamically add, delete, and save monitoring interface parameters.

一种指令生成方法,包括以下过程:A method for generating an instruction includes the following steps:

遍历当前监控界面窗口表格控件中的所有参数项并获取参数值,并基于实例化的JSON对象一一赋值,然后根据参数属性转换为十六进制值后完成指令生成。Traverse all parameter items in the table control of the current monitoring interface window and obtain parameter values, assign values one by one based on the instantiated JSON object, and then complete the instruction generation after converting the parameter attributes into hexadecimal values.

一种状态信息刷新方法,包括以下过程:A state information refreshing method includes the following steps:

接收到状态信息数据后,基于QT监控界面生成时存储的容器,根据命令字类型获取到相应值的状态信息界面;然后遍历监控界面窗口中表格所有行,并结合监控界面窗口实例化的JSON对象,依次更新每行的参数值,完成状态信息刷新。After receiving the status information data, based on the container stored when the QT monitoring interface is generated, the status information interface of the corresponding value is obtained according to the command word type; then all rows of the table in the monitoring interface window are traversed, and combined with the JSON object instantiated in the monitoring interface window, the parameter value of each row is updated in turn to complete the status information refresh.

本发明相比背景技术的优点在于:The advantages of the present invention compared to the background technology are:

1、高效的开发效率:提供了模版化的重构代码,使得开发人员无需进行定制化开发,提高代码复用率,减小开发人员工作量,有效地提高了工作效率;1. High development efficiency: It provides templated refactoring code, which eliminates the need for developers to carry out customized development, improves code reuse rate, reduces developer workload, and effectively improves work efficiency;

2、可读性、易修改:JSON文本为格式化文本,其结构内容清晰简洁具有较高的可读性,适于非软件开发人员进行读取与修改;2. Readability and easy modification: JSON text is formatted text with clear and concise structure and content, and high readability, which is suitable for non-software developers to read and modify;

3、通用性、广泛适用性;监控界面生成、状态信息刷新和控制指令生成方法可应用在多种平台、多种系统、多种场景下,具备较高的通用性和广泛地适用性。3. Versatility and wide applicability: The monitoring interface generation, status information refresh and control instruction generation methods can be applied to multiple platforms, multiple systems and multiple scenarios, and have high versatility and wide applicability.

附图说明BRIEF DESCRIPTION OF THE DRAWINGS

图1是本发明的基于JSON文本的QT监控界面动态产生方法的流程图。FIG1 is a flow chart of a method for dynamically generating a QT monitoring interface based on JSON text according to the present invention.

图2是本发明的设备控制指令生成方法的流程图。FIG. 2 is a flow chart of a method for generating device control instructions according to the present invention.

图3是本发明的设备状态信息刷新方法流程图。FIG3 is a flow chart of a method for refreshing device status information according to the present invention.

具体实施方式DETAILED DESCRIPTION

下面结合附图和具体实施方式对本发明进行详细说明。The present invention is described in detail below with reference to the accompanying drawings and specific embodiments.

如图1所示,本发明实施例所述的一种基于JSON文本的QT监控界面产生方法,方法包括以下步骤:As shown in FIG. 1 , a method for generating a QT monitoring interface based on JSON text according to an embodiment of the present invention comprises the following steps:

步骤1、使用硬编码方式,创建并初始化监控界面窗口,包括尺寸位置的设定,布局方式的设定,样式表的设定;具体包括:Step 1: Use hard coding to create and initialize the monitoring interface window, including the size and position settings, layout settings, and style sheet settings; specifically:

1)使用代码新创建并初始化监控界面窗口m_GeneralWindow,窗口派生于QWidget类;1) Use the code to create and initialize the monitoring interface window m_GeneralWindow, which is derived from the QWidget class;

2)设定窗口尺寸位置,此处窗口位于显示中心,大小设定为Qsize(600,800);2) Set the window size and position. Here the window is located in the display center and the size is set to Qsize(600, 800);

3)设定窗口的布局方式为水平布局方式;3) Set the window layout mode to horizontal layout mode;

4)设定窗口样式表,使用setWindowFlags()函数设置窗口多标志方式,设置窗口透明比例为0.95。4) Set the window style sheet, use the setWindowFlags() function to set the window multi-flag mode, and set the window transparency ratio to 0.95.

步骤2、读取并解析JSON文本,判断读取内容是否规范;若是,则实例化一个初始的JSON对象,存储JSON文本内容;具体包括:Step 2: Read and parse the JSON text to determine whether the read content is standard; if so, instantiate an initial JSON object to store the JSON text content; specifically include:

1)采用QJsonDocument实例化对象读取JSON文本,判断读取内容是否规范;1) Use QJsonDocument to instantiate the object to read the JSON text and determine whether the read content is standard;

2)若是,则实例化一个初始的QJsonObject对象m_InitObj存储JSON文本内容。2) If so, instantiate an initial QJsonObject object m_InitObj to store the JSON text content.

步骤3、使用硬编码方式,创建标签页的多页面容器组件并将其加入至窗口,基于JSON对象初始化容器的页面数量及名称。针对每个页面创建表格控件,设定表格样式表并将其加入至标签页容器组件;具体包括:Step 3: Use hard coding to create a multi-page container component for the tab page and add it to the window. Initialize the number and name of the container pages based on the JSON object. Create a table control for each page, set the table style sheet and add it to the tab page container component; specifically:

1)则使用硬编码方式,创建派生于QTabWidget类的组件对象m_TabWidget并将其加入至窗口;1) Use hard coding to create a component object m_TabWidget derived from the QTabWidget class and add it to the window;

2)基于步骤2的m_InitObj对象初始化m_TabWidget容器,获取m_InitObj对象中的指令数量对应创建相应数量的页面,页面标题设置为指令名称;2) Initialize the m_TabWidget container based on the m_InitObj object in step 2, obtain the number of instructions in the m_InitObj object and create a corresponding number of pages, and set the page title to the instruction name;

3)在步骤2)的每个页面中,创建派生于QTableWidget类的表格控件,设置表格的样式表方式。表格包含两列,第一列表头设置为参数项,第二列表头设置为参数值;3) In each page of step 2), create a table control derived from the QTableWidget class and set the style sheet mode of the table. The table contains two columns, the first column header is set to the parameter item, and the second column header is set to the parameter value;

4)实例化一个QMap<QString,QPair<int,QTableWidget*>>类型的对象m_tablemap用于存储当前创建的页面表格及其名称,方便遍历查询使用。其中,QString为页面表格名称,Qpair<int,QTableWidget*>>中int表示命令字用于区别指令类型,QTableWidget*为表格实例化对象指针。4) Instantiate an object m_tablemap of QMap<QString,QPair<int,QTableWidget*>> type to store the currently created page table and its name for easy traversal and query. Among them, QString is the page table name, int in Qpair<int,QTableWidget*>> represents the command word used to distinguish the instruction type, and QTableWidget* is the table instantiation object pointer.

步骤4、基于JSON对象,遍历其键值对分别将键值赋值表格项。表格项分为参数项和参数值,表格行数对应键值数,参数项对应对象键名,参数值对应对象值;根据其值内容分别创建不同类型的控件(包括编辑框、下拉框、选择框、选择开关、滑动条等),叠加到表格单元格中;具体包括:Step 4: Based on the JSON object, traverse its key-value pairs and assign key values to table items. Table items are divided into parameter items and parameter values. The number of table rows corresponds to the number of key values, the parameter items correspond to the object key names, and the parameter values correspond to the object values. Different types of controls (including edit boxes, drop-down boxes, selection boxes, selection switches, sliders, etc.) are created according to their value contents and superimposed on the table cells. Specifically, they include:

1)基于JSON对象,遍历其键值对分别将键值赋值表格项。键值对的数量由参数数量键决定;1) Based on the JSON object, traverse its key-value pairs and assign key values to table items respectively. The number of key-value pairs is determined by the parameter number key;

2)表格项分为参数项和参数值,表格行数对应键值数,参数项对应对象键名,参数值对应对象值。具体来讲,表格第一行的参数项内容为参数1的名称,参数值为参数1的值。依次类推,表格第N行的参数项内容为参数N的名称,参数值为参数N的值;2) Table items are divided into parameter items and parameter values. The number of table rows corresponds to the number of key values, the parameter items correspond to the object key names, and the parameter values correspond to the object values. Specifically, the parameter item content of the first row of the table is the name of parameter 1, and the parameter value is the value of parameter 1. Similarly, the parameter item content of the Nth row of the table is the name of parameter N, and the parameter value is the value of parameter N;

3)根据其值内容分别创建不同类型的控件(包括编辑框、下拉框、选择框、选择开关、滑动条等)。具体来讲,参数N的属性包含了该参数的数据类型、展示名称、控件类型、参数关联值、值内容、比例、正则校验式、是否展示和提示信息等九项;下面分别进行详细地介绍:3) Create different types of controls (including edit boxes, drop-down boxes, selection boxes, selection switches, sliders, etc.) according to their value contents. Specifically, the properties of parameter N include nine items: data type, display name, control type, parameter associated value, value content, ratio, regular check formula, display or not, and prompt information. The following are detailed introductions:

数据类型用于区分不同类型的数据,包含了char、uchar、int、uint、short、ushort、float、double、byte、string和file等十一种类型。其中,string表明为字符串类型,byte用于保留位的实现,file表明此类型为文件型;对于file类型具体内容为,文件内容为m*n的数字矩阵,中间以空格间隔。The data type is used to distinguish different types of data, including 11 types such as char, uchar, int, uint, short, ushort, float, double, byte, string and file. Among them, string indicates a string type, byte is used to implement reserved bits, and file indicates that this type is a file type; for the file type, the specific content is that the file content is an m*n digital matrix separated by spaces.

展示名称用于界面展示给用户的内容,内容为QString字符串;The display name is used to display the content to the user on the interface. The content is a QString string.

控件类型用于区分不同类型的控件,包含了lineedit编辑框、combox下拉选择框、label选择框、switch选择开关、slider滑动条等。所有控件的实例化均分别派生于自定义控件类,自定义控件派生于原生控件,实现了特有的功能和效果;The control type is used to distinguish different types of controls, including lineedit edit boxes, combox drop-down selection boxes, label selection boxes, switch selection switches, slider sliders, etc. All control instances are derived from custom control classes, which are derived from native controls to achieve unique functions and effects.

参数关联值用于描述参数值的实际值和界面展示内容的关联性。对于下拉选择框控件,实际值和界面展示内容一一对应;此外,当数据类型为file时值内容表示该数据表示理论上m*n的矩阵,实际文本内容只取m1*n1的矩阵值,矩阵类型为char、short、float或double等;对于其它控件,该参数可忽略;The parameter association value is used to describe the correlation between the actual value of the parameter value and the content displayed on the interface. For the drop-down selection box control, the actual value and the content displayed on the interface correspond one to one; in addition, when the data type is file, the value content indicates that the data represents a theoretical m*n matrix, and the actual text content only takes the m1*n1 matrix value, and the matrix type is char, short, float or double, etc.; for other controls, this parameter can be ignored;

值内容为用于生成指令时的内容,对于编辑框和选择框控件,值内容与展示内容相同;对于选择开关控件,控件状态为开时值为1,控件状态为关时值为0;对于滑动条控件,值内容取滑动条的实际值;The value content is the content used to generate instructions. For edit box and selection box controls, the value content is the same as the display content. For selector switch controls, the value is 1 when the control state is on, and the value is 0 when the control state is off. For slider controls, the value content is the actual value of the slider.

比例用于表示当前值内容的比例系数,具体来讲真实下发值等于当前值内容乘以比例系数;The ratio is used to indicate the ratio coefficient of the current value content. Specifically, the actual delivered value is equal to the current value content multiplied by the ratio coefficient;

正则校验式用于实时校验编辑框控件输入的内容是否满足要求,正则校验式采用正则表达式方式;The regular validation formula is used to verify in real time whether the content entered into the edit box control meets the requirements. The regular validation formula adopts the regular expression method.

是否展示用于控制该参数是否展示在界面中。需要注意的是,该参数仅仅控制参数项在界面的显示和隐藏,并不代表该参数需要跳过。具体地当值为1时显示,反之为0时隐藏;Whether to display is used to control whether the parameter is displayed in the interface. It should be noted that this parameter only controls the display and hiding of the parameter item in the interface, and does not mean that the parameter needs to be skipped. Specifically, it is displayed when the value is 1, and hidden when it is 0;

提示信息用于提示用户该参数的相关信息;The prompt information is used to prompt the user with relevant information of the parameter;

4)基于步骤3)创建的控件叠加至表格相应的单元格中。表格的第N行用于展示第N个参数,第N行的第一列赋值参数N的展示名称,第二列使用setCellWidget()函数叠加控件展示参数值。4) Based on the control created in step 3), overlay it in the corresponding cell of the table. The Nth row of the table is used to display the Nth parameter. The first column of the Nth row is assigned the display name of parameter N, and the second column uses the setCellWidget() function to overlay the control to display the parameter value.

步骤5、使用硬编码方式,创建按钮控件并将其加入至窗口容器,与标签页容器使用同一布局,用于设备控制指令的生成下发、监控界面参数的动态增删和保存等功能实现;具体包括:Step 5: Use hard coding to create a button control and add it to the window container, using the same layout as the tab container to achieve functions such as the generation and issuance of device control instructions, dynamic addition, deletion and saving of monitoring interface parameters, etc.; specifically:

1)使用编码方式,创建两个按钮控件分别是设置按钮、保存按钮。1) Use coding to create two button controls: the set button and the save button.

2)将控件加入至窗口容器,与标签页容器使用同一布局;2) Add the control to the window container and use the same layout as the tab container;

3)基于信号槽机制为各个按钮控件分别添加相应槽函数。设置按钮槽函数实现当前界面内容自动生成控制指令发送至相应设备;保存按钮槽函数实现在当前界面内容保存至相应的JSON文本中。3) Based on the signal slot mechanism, add corresponding slot functions for each button control. Set the button slot function to automatically generate control instructions from the current interface content and send them to the corresponding device; save the button slot function to save the current interface content to the corresponding JSON text.

如图2所示,本发明实施例所述的一种指令生成方法,方法包括以下步骤:As shown in FIG. 2 , an instruction generation method according to an embodiment of the present invention comprises the following steps:

步骤1、获取当前界面的表格控件;表格控件的获取基于界面生成时的QMap容器。通过当前界面的名称作为键,其值等于表格控件QtableWidget*指针;Step 1. Get the table control of the current interface. The table control is obtained based on the QMap container when the interface is generated. The name of the current interface is used as the key, and its value is equal to the table control QtableWidget* pointer;

步骤2、遍历当前表格控件的所有行,针对每一行获取到该行的参数名称和参数值;Step 2: Traverse all rows of the current table control and obtain the parameter name and parameter value of each row;

步骤3、基于JSON文本对象,对参数值依据数据类型进行十六进制转换后,生成控制指令。Step 3: Based on the JSON text object, perform hexadecimal conversion on the parameter value according to the data type and generate a control instruction.

参数值的具体转换方法如下:The specific conversion method of parameter values is as follows:

1)对于编辑框控件,获取参数值后直接转换为十六进制值;1) For the edit box control, directly convert the parameter value into a hexadecimal value after obtaining it;

2)对于下拉框控件,获取参数值后遍历JSON对象的值内容,最终得到真实值,根据参数数据类型转换为十六进制值;2) For the drop-down box control, after obtaining the parameter value, traverse the value content of the JSON object, finally get the real value, and convert it into a hexadecimal value according to the parameter data type;

3)对于选择框控件,获取参数值后基于JSON对象的得到参数关联值,利用QFile打开文本后按行读取,对读取字符串使用spilt()函数进行分割;然后,基于参数数据类型进行十六进制转换;最后判断读取行数是否超过理论值,若超过则关闭文件,否则继续进行读取;3) For the selection box control, after obtaining the parameter value, the parameter associated value is obtained based on the JSON object, and the text is opened by QFile and read line by line. The read string is split using the spilt() function; then, hexadecimal conversion is performed based on the parameter data type; finally, it is determined whether the number of read lines exceeds the theoretical value. If so, the file is closed, otherwise, the reading continues;

4)对于选择开关控件,当开关有效时值为1,无效时为0,随后依据数据类型进行十六进制转换;4) For the selection switch control, the value is 1 when the switch is valid and 0 when it is invalid, and then the hexadecimal conversion is performed according to the data type;

5)对于滑动条控件,获取其控件值后根据数据类型进行十六进制转换。5) For the slider control, after obtaining its control value, perform hexadecimal conversion according to the data type.

如图3所示,本发明实施例所述的一种状态信息刷新方法,方法包括以下步骤:As shown in FIG3 , a method for refreshing status information according to an embodiment of the present invention includes the following steps:

步骤1、接收并解析状态信息数据,获取状态信息命令字;Step 1: Receive and parse status information data to obtain status information command words;

步骤2、基于界面生成时存储的QMap容器,根据命令字类型的键作为索引获取到相应值的状态信息界面;Step 2: Based on the QMap container stored when the interface is generated, the status information interface of the corresponding value is obtained according to the key of the command word type as an index;

步骤3、遍历页面表格所有行,结合界面实例化的JSON对象,依次更新每行的参数值,完成状态信息刷新。Step 3: Traverse all rows in the page table, combine the JSON object instantiated by the interface, update the parameter value of each row in turn, and complete the status information refresh.

本发明所实现的监控界面生成方法、指令生成方法和状态信息刷新方法,本实施例基于JSON格式化文本,实现了QT的监控界面动态产生、指令生成及信息刷新方法。非开发人员可通过直接修改JSON文本,完成监控界面及指令的生成,无需额外进行培训和学习软件配置说明;开发人员无需进行软件代码修改和重复发布软件,提高了开发效率,降低了开发成本。The monitoring interface generation method, instruction generation method and status information refresh method implemented by the present invention are based on JSON formatted text, and realize the QT monitoring interface dynamic generation, instruction generation and information refresh method. Non-developers can complete the generation of monitoring interface and instructions by directly modifying JSON text, without additional training and learning software configuration instructions; developers do not need to modify software code and repeatedly release software, which improves development efficiency and reduces development costs.

以上,仅为本发明的具体实施方式,但本发明的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本发明揭露的技术范围内,可轻易想到各种等效的修改或替换,这些修改或替换都应涵盖在本发明的保护范围之内。因此,本发明的保护范围应以权利要求的保护范围为准。The above are only specific embodiments of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed by the present invention, and these modifications or replacements should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.

Claims (3)

1. A QT monitoring interface generation method based on JSON text is characterized by comprising the following steps:
Step 1, creating and initializing a monitoring interface window by using a hard coding mode, wherein the monitoring interface window comprises setting of size and position, setting of a layout mode and setting of a style sheet;
Step 2, reading and analyzing the JSON text, and judging whether the read content is standard or not; if yes, instantiating an initial JSON object, storing JSON text content, and otherwise, ending;
Step 3, creating a multi-page container assembly of the tag page by using a hard coding mode, adding the multi-page container assembly of the tag page into a monitoring interface window, creating a form control for each page based on the page number and the name of the JSON object, and setting a form style sheet to be added into the multi-page container assembly of the tag page;
Step 4, traversing key value pairs based on the JSON object, and respectively assigning the key values with table items; the table items are divided into parameter items and parameter values, the number of the table rows corresponds to the number of the key values, the parameter items correspond to the key names of the objects, and the parameter values correspond to the object values; respectively creating different types of form controls according to the value content, wherein the form controls comprise an editing frame, a drop-down frame, a selection switch and a sliding bar, and the form controls are overlapped into form cells;
And 5, creating button controls by using a hard coding mode, adding the button controls into a monitoring interface window, using the same layout with the multi-page container assembly of the label page, and respectively adding corresponding slot functions for each button control for realizing the generation and issuing of equipment control instructions, and the dynamic addition and deletion and storage functions of monitoring interface parameters.
2. A method of instruction generation, characterized in that it is based on QT monitoring interface implementation produced in claim 1, comprising the following processes:
Traversing all parameter items in the window form control of the current monitoring interface, acquiring parameter values, assigning values one by one based on the instantiated JSON objects, and completing instruction generation after converting the values into hexadecimal values according to the parameter attributes.
3. A state information refreshing method, which is characterized by being realized based on the QT monitoring interface generated in claim 1, and comprising the following procedures:
After receiving the state information data, acquiring a state information interface of a corresponding value according to the type of the command word based on a container stored when the QT monitoring interface is generated; and traversing all rows of the table in the monitoring interface window, and sequentially updating the parameter value of each row by combining with the JSON object instantiated by the monitoring interface window to finish the state information refreshing.
CN202410954890.3A 2024-07-17 2024-07-17 QT monitoring interface generation, instruction generation and information refresh method based on JSON text Pending CN118819523A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410954890.3A CN118819523A (en) 2024-07-17 2024-07-17 QT monitoring interface generation, instruction generation and information refresh method based on JSON text

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410954890.3A CN118819523A (en) 2024-07-17 2024-07-17 QT monitoring interface generation, instruction generation and information refresh method based on JSON text

Publications (1)

Publication Number Publication Date
CN118819523A true CN118819523A (en) 2024-10-22

Family

ID=93074240

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410954890.3A Pending CN118819523A (en) 2024-07-17 2024-07-17 QT monitoring interface generation, instruction generation and information refresh method based on JSON text

Country Status (1)

Country Link
CN (1) CN118819523A (en)

Similar Documents

Publication Publication Date Title
CA1306548C (en) Method of operating a computer system to provide customized i/o information including language translation
US6466240B1 (en) Method for visually writing programs or scripts that transform structured text presented as a tree
US7610545B2 (en) Annotations for tracking provenance
KR20080043792A (en) Autocompletion through query to database
CN101291253B (en) Man-machine command interaction method for network management terminal based on graphical interface
KR20060092041A (en) Method and system for using existing content to create an active content wizard executable file for execution of a task
CN111625226B (en) Prototype-based man-machine interaction design implementation method and system
CN110968294B (en) Business domain model establishing system and method
JP7339628B2 (en) Online report creation system using Excel tools
CN115237415B (en) Method for realizing situation duplication under GIS platform
CN105653255A (en) Method arranging report template to automatically generate report files in office frame
CN113296759A (en) User interface processing method, user interface processing system, user interface processing device, and storage medium
CN101211262A (en) Software architecture description language quick construction and support method
US6070006A (en) Object oriented software development tool for creation of new class(es)
CN112631585B (en) XML-based rapid parameter interface configuration method
CN114116475A (en) Software debugging method based on log
CN103593188A (en) System and method for managing what-you-see-is-what-you-get menus of instrument
CN103325360B (en) A kind of field type LCD display method
CN118819523A (en) QT monitoring interface generation, instruction generation and information refresh method based on JSON text
CN101887087B (en) Automatic test system and its operation method, instrument control device
Djukić et al. Handling complex representations in visual modeling tools for MDSD/DSM by means of code generator languages
CN112817585A (en) Cocos2dx UI interface building method based on Unity editor
CN114911466B (en) Data quality control system of acquisition terminal
CN117390745A (en) Standardized generation method and system for general instructions for foundation pit support construction design
CN115774549A (en) Page character code editing system and editing method of airborne display device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination