QT signal transmitting and receiving repeater
By designing a QT signal transceiver repeater, all slot functions are registered in the port, the problem of confusion in the signal slot function link logic in the QT framework is solved, clear management and distribution of signals are realized, and the scalability and management capabilities of the system are enhanced.
Patent Information
- Application Number
- CN202411548193.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-01
- Publication Date
- 2025-03-11
AI Technical Summary
In the QT framework, the general signal slot function processing method only supports single-to-single signal slot function links, resulting in logical confusion between signal slot functions, and the expected effect cannot be achieved after sending the signal.
A QT signal transceiver repeater is designed to realize signal management and distribution by registering all slot functions in a certain port. The repeater includes a port storage module, a processing module, a signal transceiver module, a signal source and an execution component. Through the bidirectional connection and forward connection of these modules, the processing and distribution of signals are realized.
The QT signal transceiver repeater can clearly manage the registration and connection of slot functions, enhance the system's scalability and the management capabilities of signal slot functions, support multicast-like signal propagation methods, and meet the in-depth customization needs of QT projects.
Smart Images

Figure CN119602846A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of repeaters, and in particular to a QT signal transceiver repeater. Background Art
[0002] Currently, in the Qt framework, signals and slots are a powerful mechanism for communication between objects. This mechanism allows an object to send a signal when its state changes, and then other objects capture this signal and execute the corresponding slot function (member function). The communication method of signals and slots is type-safe and can be performed across threads. However, the general signal slot function processing method under the QT framework only supports one-to-one linking between signal slot functions, and the linking functions are too scattered. It often causes confusion in the connection logic between signal slot functions, and the expected effect cannot be achieved after sending the signal. Therefore, it is urgent to develop a QT signal transceiver repeater to solve the above technical problems.
[0003] In view of this, the present invention is proposed. Summary of the invention
[0004] The purpose of the present invention is to provide a QT signal transceiver repeater, which registers all slot functions in a certain port, which not only helps to manage the registration of slot functions, but also can clearly see the connection status of each slot function. It has broad application prospects and is conducive to popularization and application.
[0005] In order to achieve the above-mentioned purpose, the present invention provides a QT signal transceiver repeater, including a port storage module, a processing module, a signal transceiver module, a signal source and an execution component, the processing module is bidirectionally connected to the port storage module and the signal transceiver module respectively, the signal source is forwardly connected to the signal transceiver module and the execution component in turn, after the signal transceiver module receives the signal, it transmits the signal to the processing module for signal processing, the processing module sends the processed signal and the corresponding port number to the port storage module, the port storage module searches for the component that has been registered on the corresponding port, and returns the component and method that needs to receive the signal to the processing module according to the processed signal, the processing module processes the signal into a signal that can be received by the execution component and sends it to the signal transceiver module, the signal transceiver module sends the signal to the execution component to execute the slot function.
[0006] Preferably, there are several execution components, and each of the execution components is a QT object in a QT framework having a signal-slot mechanism.
[0007] Preferably, when in use, the components in the QT framework are registered to the fixed port of the repeater, and signals from any component are received. The sender component and the execution component may not be in the same interface, and the port subscription may be performed at any different time points.
[0008] Preferably, after receiving the signal, the QT signal transceiver processor searches for the port number corresponding to the signal in the port storage module, and sends an execution instruction to all execution components that have subscribed to the port to achieve the distribution of several signals.
[0009] Preferably, the port storage module maps several signals and slot functions in a multicast-like manner, and when the processing module queries the mapping corresponding to a signal, returns the slot function pointers of all the ports subscribed in the mapping, which are distributed and executed by the processing module to establish a mapping relationship between signals and slot functions.
[0010] A QT signal transceiver repeater provided by the present invention has the following beneficial effects.
[0011] 1. The present invention completely uses the native QT framework, and the signal slot is the native architecture of the QT framework and cannot be modified, which enhances the scalability of the system and can be widely used in QT projects and deeply customized to meet project requirements.
[0012] 2. The present invention saves all link components into the port storage module, so that the connection status of each slot function can be clearly seen, which is beneficial to the management of signal slot functions in complex projects.
[0013] 3. The present invention can store multiple slot functions at one port, and can realize a signal propagation method similar to multicast. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] Figure 1 A structural block diagram of a QT signal transceiver repeater provided by the present invention; Figure 2 The present invention provides a flowchart of a QT signal transceiver repeater. DETAILED DESCRIPTION
[0015] The present invention is further described below in conjunction with specific embodiments and drawings to help understand the content of the present invention.
[0016] like Figure 1As shown, it is a structural block diagram of a QT signal transceiver repeater provided by the present invention. The QT signal transceiver repeater includes a port storage module, a processing module, a signal transceiver module, a signal source and an execution component. The processing module is bidirectionally connected to the port storage module and the signal transceiver module respectively, and the signal source is forwardly connected to the signal transceiver module and the execution component in sequence. After receiving the signal, the signal transceiver module transmits the signal to the processing module for signal processing. The processing module sends the processed signal and the corresponding port number to the port storage module. The port storage module searches for the components that have been registered on the corresponding port, and returns the components and methods that need to receive the signal to the processing module according to the processed signal. The processing module processes the signal into a signal that can be received by the execution component and sends it to the signal transceiver module. The signal transceiver module sends the signal to the execution component to execute the slot function. There are several execution components, and the execution component is a QT object in the QT framework with a signal slot mechanism.
[0017] like Figure 2 As shown, it is a workflow diagram of a QT signal transceiver repeater provided by the present invention. When in use, the components in the QT framework are registered to the fixed port of the repeater, and the signal from any component is received. The sending component and the execution component may not be in the same interface, and the port can be subscribed at any different time points. After receiving the signal, the QT signal transceiver processor searches for the port number corresponding to the subscription of the signal in the port storage module, and sends an execution instruction to all the execution components that have subscribed to the port, so as to realize the distribution of several signals. The port storage module maps several signals and slot functions in a manner similar to multicast, and when the processing module queries the mapping corresponding to a certain signal, it returns the slot function pointers of all the slot functions that have subscribed to the port in the mapping, and hands them over to the processing module for distribution and execution, so as to realize the establishment of the mapping relationship between the signal slot functions.
[0018] The present invention completely uses the native QT framework, and the signal slot is the native architecture of the QT framework and cannot be modified, which enhances the scalability of the system and can be widely used in QT projects and deeply customized to meet project requirements. The present invention saves all link components to the port storage module, and the connection status of each slot function can be clearly seen, which is conducive to the management of signal slot functions in complex projects. The present invention can save multiple slot functions at one port, and can realize a signal propagation method similar to multicast.
[0019] The invention concept is described in detail using specific examples herein, and the description of the above embodiments is only used to help understand the core idea of the invention. It should be pointed out that any obvious modification, equivalent substitution or other improvement made by a person of ordinary skill in the art without departing from the invention concept should be included in the protection scope of the present invention.
Claims
1. A QT signal transceiver repeater, characterized in that: It includes a port storage module, a processing module, a signal transceiver module, a signal source and an execution component. The processing module is bidirectionally connected to the port storage module and the signal transceiver module respectively. The signal source is forwardly connected to the signal transceiver module and the execution component in turn. After receiving the signal, the signal transceiver module transmits the signal to the processing module for signal processing. The processing module sends the processed signal and the corresponding port number to the port storage module. The port storage module searches for the component that has been registered on the corresponding port, and returns the component and method that need to receive the signal to the processing module according to the processed signal. The processing module processes the signal into a signal that can be received by the execution component and sends it to the signal transceiver module. The signal transceiver module sends the signal to the execution component to execute the slot function.
2. A QT signal transceiver repeater according to claim 1, characterized in that: There are several execution components, and each of the execution components is a QT object in a QT framework having a signal slot mechanism.
3. A QT signal transceiver repeater according to claim 2, characterized in that: When in use, the components in the QT framework are registered to the fixed port of the repeater, and receive signals from any component. The sender component and the execution component may not be in the same interface, and the port subscription can be performed at any different time points.
4. A QT signal transceiver processor according to claim 3, characterized in that: After receiving the signal, the QT signal transceiver processor searches for the subscribed port number corresponding to the signal in the port storage module, and sends execution instructions to all execution components that have subscribed to the port to achieve the distribution of several signals.
5. A QT signal transceiver processor according to claim 4, characterized in that: The port storage module maps several signals and slot functions in a multicast-like manner, and returns the slot function pointers of all subscribed ports in the mapping when the processing module queries the mapping corresponding to a signal, and distributes and executes them to the processing module to establish the mapping relationship between signals and slot functions.