Low-intrusive User Operation Behavior Acquisition System and Method under the QT Framework
Through the low-invasive user operation behavior acquisition system under the QT framework, the top-level event filter and dynamic library are used to achieve accurate collection of user operations without modifying the software code, solving the problems of high accuracy and cost in the existing technology, and improving the universality and ease of use of the acquisition system.
Patent Information
- Application Number
- CN202510522490.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-24
- Publication Date
- 2025-07-11
- Estimated Expiration
- 2045-04-24
AI Technical Summary
In the prior art, it is difficult to accurately collect user operation behavior without obtaining functional software code, and the existing methods have problems such as loss of information or high development costs.
The low-invasive user operation behavior acquisition system under the QT framework is adopted, and the top-level event filter and operation behavior acquisition dynamic library is used to use event notification mechanism and recursive analysis to automatically assign unique identifiers to each control and bind event processing functions to achieve accurate event capture.
Without modifying the core logic of the software, the accuracy and versatility of operational behavior acquisition are improved, the development cost and coupling are reduced, and it is suitable for all QT-based software development.
Smart Images

Figure CN120029872B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the fields of Internet technology and communication, and particularly relates to a low-invasive user operation behavior acquisition system and method under the QT framework. Background Art
[0002] As a cross-platform C++ graphical user interface application development framework, QT is widely used in the development of GUI programs and also in the development of non-GUI programs. QT provides rich application programming interfaces (APIs), enabling developers to conveniently build modern interfaces and provide a good user experience. The QT framework supports multiple operating systems, including Linux, which makes QT highly favored in the field of cross-platform application development. Therefore, in the Linux operating system environment, the user interfaces of many applications are developed based on the QT library.
[0003] The acquisition of user operation behavior involves recording various operations performed by users on the interface, such as button clicks, dropdown box selections, checkbox state changes, etc. The acquisition of user operation behavior plays a crucial role in aspects such as personnel training, software testing, user experience optimization, and function improvement. Currently, operation behavior acquisition methods are mainly divided into two categories:
[0004] The first category of methods is achieved through code instrumentation technology under the condition that the software code is completely known and controllable, that is, inserting log printing code at key operation points, recording operation behaviors in a log file, and obtaining the actual operation behaviors of users by analyzing the log file. The advantage of this method is that the recorded operation behaviors are highly accurate. However, its limitation is that usually due to confidentiality and trade secret considerations, the software code cannot be provided to the acquisition personnel, let alone modifying these source codes; in addition, the module for acquiring operation behaviors has a high coupling degree with the software, which is not conducive to maintenance and generalization.
[0005] The second category of methods is to use image recognition technology to obtain user behaviors when the software code is unknown. The advantage of this method is that it is completely independent of the understanding of the software source code. However, its disadvantage is that image recognition essentially compresses multi-dimensional space information into two-dimensional space, which inevitably leads to information loss, thus affecting the accuracy of operation behavior acquisition. At the same time, developing such software requires analyzing each acquisition requirement to obtain precise sub-events, and the analysis process is very complex, resulting in a huge amount of coding, relatively high development costs, and low accuracy.
[0006] Generally speaking, the difficulties in solving the problem lie in two points. First, without obtaining the functional software code, it is impossible to accurately know the controls included in the software. Second, even if the control information is obtained, it is difficult to accurately perform data embedding without affecting the software operation, so as to accurately capture the user operations. Summary of the Invention
[0007] The purpose of the present invention is to overcome the defects of the prior art and propose a low-intrusive user operation behavior acquisition system and method under the QT framework.
[0008] In view of this, the present invention proposes a low-intrusive user operation behavior acquisition system under the QT framework, which is deployed in the human-computer interaction function software developed based on QT. The system includes: a top-level event filter and an operation behavior acquisition dynamic library. Among them,
[0009] The top-level event filter is used to capture the events generated by the user's operation behavior of using the human-computer interaction function software and transmit them to the operation behavior acquisition dynamic library;
[0010] The operation behavior acquisition dynamic library is used to recursively analyze the attributes of the events based on the object tree, determine the user operation behavior and generate an operation record.
[0011] Preferably, the top-level event filter is deployed in the main function of the human-computer interaction function software.
[0012] Preferably, the operation behavior acquisition dynamic library is linked to the human-computer interaction function software.
[0013] Preferably, the operation behavior acquisition dynamic library includes:
[0014] A control dynamic identification module, which is used to deeply traverse the QT top-level object, obtain all sub-controls in its object tree, and uniquely identify the sub-controls;
[0015] An event handling function binding module, which is used to traverse all sub-controls of the same type for different sub-control types, set unique attributes respectively, and bind corresponding event handling functions to each sub-control; and
[0016] An event handling function module, which is used to provide event handling functions for various sub-control types. The event handling function is used to extract operation information from the event and generate an operation record.
[0017] Preferably, the processing process of the control dynamic identification module includes:
[0018] Step S1: Obtain the current object, determine whether it is empty. If it is determined to be yes, end; otherwise, go to step S2;
[0019] Step S2: Determine whether the CTUL_NAME attribute of the current object is empty. If it is determined to be yes, continue to determine whether it is the top-level object. If it is the top-level object, set the CTUL_NAME attribute of the current object to the window title; otherwise, set the CTUL_NAME attribute of the current object to the combination of the control type and the index, and call the event handling function module to bind the event handling function to the current object;
[0020] Step S3: Obtain the list of all child objects of the current object, traverse each child object in the object list, and go to Step S2 until the traversal ends.
[0021] Preferably, the processing process of the event handling function binding module includes:
[0022] Step T1: According to the parent window object of the input child control, obtain all child controls of the same type as the child control under the parent window object;
[0023] Step T2: Traverse the child controls, and determine whether the attribute of the identifier CTUL_NAME of each child control has been set. If it is determined to be yes, go to Step T4; otherwise, go to Step T3;
[0024] Step T3: Set the CTUL_NAME attribute of the current child control to the combination of the control type and the index, and record the CTUL_NAME attribute of the parent object;
[0025] Step T4: Connect the trigger signal of the child control to the corresponding slot function;
[0026] Step T5: Go to Step T2 until all child controls are traversed and processed.
[0027] Preferably, the operation information extracted from the event by the event handling function includes: the operation object name, the parent object name, the operation type, and the operation parameters; among them,
[0028] The operation object name is the CTUL_NAME attribute;
[0029] The parent object name is the CTUL_NAME attribute of the parent object recorded in the event handling function binding module;
[0030] The operation type includes all special operation behaviors of the controls defined in QT, as well as the common operation behaviors for all controls;
[0031] The operation parameters are used to record the specific state of the operation event.
[0032] Preferably, all special operation behaviors of the controls defined in QT include:
[0033] The completion operation of text input and editing in the text box;
[0034] Text editing and cursor position change operations of the multi-line text box;
[0035] Drop-down option selection, option change, and mouse hover operations of the drop-down box;
[0036] Value change, slider click, and slider release operations of the slider;
[0037] Selection behavior and deselection behavior of the checkbox;
[0038] Click, press, and release operations of the button;
[0039] State change operations of the radio button;
[0040] Cell click, cell editing, and cell focus change operations of the table;
[0041] Click operation of the menu button;
[0042] Option click and selection change operations of the list control;
[0043] And close, resize, and move operations of the main form.
[0044] Preferably, the common operation behaviors for all controls include: mouse click, mouse movement, mouse wheel scrolling, and keyboard click operations.
[0045] On the other hand, the present invention provides a low-intrusive user operation behavior acquisition method under the QT framework, implemented based on the above system, including:
[0046] Initialization stage: When the human-computer interaction function software developed based on QT is started, the operation behavior acquisition dynamic library is started simultaneously;
[0047] Acquisition stage: When the top-level event filter captures an event generated by the user's operation behavior of using the human-computer interaction function software, it is transmitted to the operation behavior acquisition dynamic library; the operation behavior acquisition dynamic library recursively analyzes the attributes of the event based on the object tree, determines the user operation behavior, and generates an operation record.
[0048] Compared with the prior art, the advantages of the present invention are:
[0049] Low-intrusive acquisition architecture based on event filters: By utilizing the event notification mechanism and top-level event filter technology of the QT framework, the present invention only needs to simply install an event filter in the human-computer interaction function software, without modifying the core business logic of the function software or significantly changing the code. Through this "low-intrusive" implementation, the coupling degree between the acquisition system and the function software is extremely low, greatly improving the generality and usability.
[0050] Recursive Dynamic Recognition and Control Binding Technology: The present invention designs an algorithm for dynamically traversing the object tree. By recursively scanning all controls in the functional software (such as buttons, text boxes, drop-down boxes, etc.), unique identifiers (such as CTUL_NAME and PARENT_NAME) are automatically assigned to each control and event handling functions are bound. Without the need to know the specific settings of the software control structure in advance, precise event capture can be achieved, enhancing adaptability and flexibility, with good generality and applicable to all software developed based on QT.
[0051] Call in the form of a dynamic library: When the operation behavior acquisition logic changes, there is no need to recompile the functional software code, which has good flexibility. Description of the Drawings
[0052] Figure 1 It is a flowchart of the low-invasive user operation behavior acquisition method under the QT framework of the present invention;
[0053] Figure 2 It is a schematic diagram of installing an event filter. Detailed Implementation Manner
[0054] Based on the event notification mechanism of the QT framework, the present invention uses hook technology to achieve low-invasive operation behavior acquisition. This method not only reduces the development cost of the acquisition software, but also improves the accuracy of behavior acquisition.
[0055] For convenience, it is stipulated in this document that: The human-machine interface software developed using QT is called the human-machine interaction functional software or simply the functional software for short. The main principle of the present invention is that in the software developed based on QT, all user operations will generate corresponding events and be captured by the event filter. Therefore, the present invention installs a top-level event filter in the main function of the human-machine interaction functional software, and the filter transmits all the generated events to the operation behavior acquisition dynamic library for analysis. In the acquisition library, the attributes of each event are recursively analyzed, and the user operation behavior (such as button click, text input, list selection, etc.) is obtained through event attribute analysis, and the analysis results are recorded. This method can efficiently and accurately collect detailed operation data with minimal changes to the functional software.
[0056] The technical solution of the present invention will be described in detail below with reference to the drawings and embodiments.
[0057] Embodiment 1
[0058] As Figure 1As shown in the figure, Embodiment 1 of the present invention proposes a low-invasive user operation behavior acquisition system under the QT framework, which is deployed in a human-computer interaction function software developed based on QT. The system includes: a top-level event filter and an operation behavior acquisition dynamic library. The top-level event filter is used to capture the events generated by the operation behaviors of the user using the human-computer interaction function software and transmit them to the operation behavior acquisition dynamic library; the operation behavior acquisition dynamic library is used to recursively analyze the attributes of the events based on the object tree, determine the user operation behaviors, and generate operation records. Separating the function software from the acquisition library has stronger versatility and low invasiveness.
[0059] The specific description of each part is as follows:
[0060] (1) Operation behavior acquisition dynamic library
[0061] The operation behavior acquisition dynamic library has three functions. One is to dynamically identify and traverse the object tree of the function software and identify each control; the second is to bind an event handling function to each control; the third is to extract operation information from the event information and record it when the event handling function is triggered.
[0062] The operation behavior acquisition dynamic library can be further divided into the following functional modules:
[0063] A) Control dynamic identification module
[0064] The function of the control dynamic identification module is to deeply traverse a QT top-level object, obtain all the child controls in its object tree, and identify the child controls. If it is a top-level object, set the CTUL_NAME attribute of the current object to the window title; otherwise, the CTUL_NAME attribute is a combination of the control type + index.
[0065] The specific implementation algorithm is shown in Table 1:
[0066] Table 1
[0067]
[0068] B) Event handling function binding module
[0069] Event handling functions, for different types of child controls, recursively bind corresponding event handling functions to the current control and all its child controls. When the event handling function binding module is called, it will sequentially call the binding functions corresponding to each middle control type, such as the button binding function, the dropdown box binding function, etc. These binding functions mainly handle events related to the control type. Traverse all child controls of this type in the specified window, set unique attributes (CTUL_NAME and PARENT_NAME) for each child control. The CTUL_NAME attribute is a combination of the control type and the index, and connect the trigger events of the child controls to the corresponding slot functions. When the corresponding operation behavior of the child control occurs, the slot function will be triggered to record the operation information. In the prior art, the identification of child controls is to uniquely identify a child control through the interface path. However, in QT, different child controls in the same interface can have the same objectname, so it is impossible to uniquely identify a child control. To achieve precise event capture, it is necessary to know the specific settings of the software control structure, and the amount of such processing code is huge. While this application automatically assigns unique identifiers to each control and binds event handling functions, without the need to know the specific settings of the software control structure, it can achieve precise event capture, enhance adaptability and flexibility, has good generality, and is applicable to all software developed based on QT.
[0070] Taking the button binding function as an example, its specific implementation algorithm is shown in Table 2:
[0071] Table 2
[0072]
[0073] Among them, HandlePushButtonClicked is the event handling function of the button control. Similarly, for other control types such as text boxes and dropdown menus, there are corresponding event handling functions, and these functions are all included in the event handling function module.
[0074] C) Event handling function module
[0075] The event handling function module contains event handling functions set for different types of controls. The function of these functions is to extract operation information from events and save it. The extracted operation information includes:
[0076] 1. Operation object name:
[0077] This is the unique identifier of the control that triggers the event. Through this identifier, the operated control can be uniquely located. This identifier is the CTUL_NAME in the event handling function binding module.
[0078] 2. Parent object name:
[0079] This is the unique identifier of the parent window to which the control triggering the event belongs. This identifier is the PARENT_NAME in the event handling function binding module.
[0080] 3. Operation type:
[0081] For different types of controls, their operation types are also different. For example, the operation type for a checkbox click event is "checkbox_clicked". The operation types include all the special operation behaviors of the controls defined in QT, as well as the common operation behaviors for all controls.
[0082] Among them, all the special operation behaviors of the controls defined in QT include: text input and editing completion operations for text boxes; text editing and cursor position change operations for multi-line text boxes; drop-down option selection, option change, and mouse hover operations for drop-down boxes; value change, slider click, and slider release operations for sliders; selection and deselection behaviors for checkboxes; click, press, and release operations for buttons; state change operations for radio buttons; cell click, cell editing, and cell focus change operations for tables; click operations for menu buttons; option click and selection change operations for list controls; and close, resize, and move operations for the main form.
[0083] The common operation behaviors for all controls include: mouse click, mouse movement, mouse wheel scrolling, and keyboard click operations.
[0084] 4. Operation parameters:
[0085] Operation parameters are used to specify the state of the operation event. For example, the state of a checkbox click event is divided into two types: selected and unselected, and its operation parameters can be true or false.
[0086] (2) Human-computer interaction function software
[0087] This function software needs to be changed in two aspects. One is to link the operation behavior acquisition dynamic library in the software; the other is to install an event filter in the main function. The code is shown in the highlighted part in Figure 2 which means defining an event filter eventFilter and installing this event filter.
[0088] Among them, CEventFilter is the event filter class implemented in the operation behavior acquisition dynamic library.
[0089] It should be noted that in the embodiments of the above system, the various modules included are only divided according to functional logic, but are not limited to the above division, as long as the corresponding functions can be realized; in addition, the specific names of the functional modules are only for the convenience of mutual distinction and do not limit the protection scope of the present invention.
[0090] Example 2
[0091] Example 2 of the present invention proposes a method for collecting low-invasive user operation behaviors under the QT framework, which is implemented based on the system of Example 1. It includes the following stages:
[0092] (1) Initialization stage
[0093] 1.1 The functional software is started, and at the same time, the dynamic library for collecting operation behaviors is started;
[0094] 1.2 The dynamic library for collecting operation behaviors is initialized, and an event handler (CEventHandler) is created to handle various interface operation events;
[0095] 1.3 The functional software installs a top-level event filter (InstallEventFilter) in the main function. When a user operation occurs on the functional software, the event information is passed to the dynamic library for collecting operation behaviors for processing.
[0096] (2) Stage of marking and binding event handling functions
[0097] 2.1 After receiving the event information passed by the event handler, the dynamic library for collecting operation behaviors determines whether the event trigger is a top-level object. If it is a top-level object, the top-level object is retrieved;
[0098] 2.2 Traverse the object tree with the top-level object as the root, bind corresponding event handling functions to each interface control (i.e., sub-object), assign a unique identifier (CTUL_NAME) to each control, and record the identifier of its parent container (PARENT_NAME). The CTUL_NAME attribute is a combination of the control type + index.
[0099] (3) Collection stage
[0100] 3.1 When the user performs an operation on the functional software, the QT event filter sends the event information that occurs to the dynamic library for collecting operation behaviors and automatically triggers the corresponding event handling function;
[0101] 3.2 In the triggered event handling function, an operation record is generated. The operation record includes information such as the operation time, operation object identifier, parent container identifier, operation type, and operation parameters.
[0102] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit them. Although the present invention has been described in detail with reference to the embodiments, those of ordinary skill in the art should understand that any modification or equivalent replacement of the technical solutions of the present invention does not depart from the spirit and scope of the technical solutions of the present invention, and they should all be covered by the scope of the claims of the present invention.
Claims
1. A low-invasive user operation behavior collection system under the QT framework, deployed in a human-computer interaction function software developed based on QT, characterized in that The system includes: a top - level event filter and an operation behavior collection dynamic library. Among them, the top - level event filter is used to capture the events generated by the operation behavior of the user using the human - computer interaction function software and transmit them to the operation behavior collection dynamic library; the operation behavior collection dynamic library is used to recursively analyze the attributes of the events based on the object tree, determine the user operation behavior, and generate an operation record; the operation behavior collection dynamic library includes: a control dynamic identification module, which is used to deeply traverse the QT top - level object, obtain all sub - controls in its object tree, and uniquely identify the sub - controls; an event handling function binding module, which is used to traverse all sub - controls of the same type for different sub - control types, set unique attributes respectively, and bind corresponding event handling functions to each sub - control; and an event handling function module, which is used to provide event handling functions for various sub - control types. The event handling functions are used to extract operation information from the events and generate operation records; the processing process of the control dynamic identification module includes: Step S1: Obtain the current object, judge whether it is empty. If it is judged to be yes, end; otherwise, go to Step S2; Step S2: Judge whether the CTUL_NAME attribute of the current object is empty. If it is judged to be yes, continue to judge whether it is a top - level object. If it is a top - level object, set the CTUL_NAME attribute of the current object to the window title. If it is not a top - level object, set the CTUL_NAME attribute of the current object to the combination of the control type and the index, call the event handling function module, and bind an event handling function to the current object; Step S3: Obtain the list of all sub - objects of the current object, traverse each sub - object in the sub - object list, and go to Step S2 until the traversal ends.
2. The low-invasive user operation behavior acquisition system under the QT framework according to claim 1, characterized in that, The top - level event filter is deployed in the main function of the human - computer interaction function software.
3. The low-invasive user operation behavior acquisition system under the QT framework according to claim 1, characterized in that, The operation behavior collection dynamic library is linked to the human - computer interaction function software.
4. The low-invasive user operation behavior acquisition system under the QT framework according to claim 1, characterized in that The processing process of the event handling function binding module includes: Step T1: According to the parent window object of the input sub - control, obtain all sub - controls of the same type under the parent window object; Step T2: Traverse the sub - controls, judge whether the attribute of the identifier CTUL_NAME of each sub - control has been set. If it is judged to be yes, go to Step T4; otherwise, go to Step T3; Step T3: Set the CTUL_NAME attribute of the current sub - control to the combination of the control type and the index, and record the CTUL_NAME attribute of the parent object; Step T4: Connect the trigger signal of the sub - control to the corresponding slot function; Step T5: Go to Step T2 until all sub - controls are traversed and processed.
5. The low-invasive user operation behavior acquisition system under the QT framework according to claim 4, characterized in that The operation information extracted by the event handling function from the event includes: the operation object name, the parent object name, the operation type, and the operation parameters. Among them, the operation object name is the CTUL_NAME attribute; the parent object name is the CTUL_NAME attribute of the parent object recorded in the event handling function binding module; the operation type includes all special operation behaviors of the controls defined in QT, as well as the common operation behaviors for all controls; The operation parameters are used to record the specific status of operation events.
6. The low-intrusive user operation behavior acquisition system under the QT framework according to claim 5, characterized in that The special operation behaviors of all controls defined in QT, including: The operations of text input and editing completion in the text box; The operations of text editing and cursor position change in the multi-line text box; The operations of dropdown option selection, option change, and mouse hovering in the dropdown box; The operations of value change, slider click, and slider release in the slider; The selection and deselection behaviors of the checkbox; The click, press, and release operations of the button; The status change operation of the radio button; The operations of cell click, cell editing, and cell focus change in the table; The click operation of the menu button; The operations of option click and selection change in the list control; And the operations of closing, resizing, and moving of the main form.
7. The low-invasive user operation behavior acquisition system under the QT framework according to claim 5, characterized in that, The common operation behaviors for all controls, including: mouse click, mouse movement, mouse wheel scrolling, and keyboard click operations.
8. A low-invasive user operation behavior acquisition method under the QT framework, implemented based on the system described in any one of claims 1-7, including: Initialization stage: When the human-computer interaction function software developed based on QT starts, the operation behavior acquisition dynamic library is started simultaneously; Acquisition stage: When the top-level event filter captures the event generated by the user's operation behavior of using the human-computer interaction function software, it is transmitted to the operation behavior acquisition dynamic library; The operation behavior acquisition dynamic library recursively analyzes the attributes of the event based on the object tree, determines the user operation behavior, and generates an operation record.
Citation Information
Patent Citations
Qt desktop point burying system, method and device based on database configuration
CN112965877A