CN115098083B - Method, device and equipment for expanding graphic view frame and storage medium - Google Patents
Method, device and equipment for expanding graphic view frame and storage medium Download PDFInfo
- Publication number
- CN115098083B CN115098083B CN202211029388.9A CN202211029388A CN115098083B CN 115098083 B CN115098083 B CN 115098083B CN 202211029388 A CN202211029388 A CN 202211029388A CN 115098083 B CN115098083 B CN 115098083B
- Authority
- CN
- China
- Prior art keywords
- item
- base class
- project
- custom
- function
- 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.)
- Active
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/30—Creation or generation of source code
- G06F8/31—Programming languages or programming paradigms
- G06F8/315—Object-oriented languages
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/01—Input arrangements or combined input and output arrangements for interaction between user and computer
- G06F3/048—Interaction techniques based on graphical user interfaces [GUI]
- G06F3/0484—Interaction techniques based on graphical user interfaces [GUI] for the control of specific functions or operations, e.g. selecting or manipulating an object, an image or a displayed text element, setting a parameter value or selecting a range
- G06F3/04845—Interaction techniques based on graphical user interfaces [GUI] for the control of specific functions or operations, e.g. selecting or manipulating an object, an image or a displayed text element, setting a parameter value or selecting a range for image manipulation, e.g. dragging, rotation, expansion or change of colour
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/30—Creation or generation of source code
- G06F8/38—Creation or generation of source code for implementing user interfaces
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2203/00—Indexing scheme relating to G06F3/00 - G06F3/048
- G06F2203/048—Indexing scheme relating to G06F3/048
- G06F2203/04806—Zoom, i.e. interaction techniques or interactors for controlling the zooming operation
Landscapes
- Engineering & Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Software Systems (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Human Computer Interaction (AREA)
- Computing Systems (AREA)
- User Interface Of Digital Computer (AREA)
- Processing Or Creating Images (AREA)
Abstract
The invention discloses a method, a device, equipment and a storage medium for expanding a graph view frame, wherein the method comprises the following steps: creating an item base class inherited to the Qt primitive item; rewriting a drawing function and a mouse event in the project base class; and inheriting the item base class after the drawing function and the mouse event are rewritten, and creating and extending the user-defined item of the graphic view frame. According to the method, the drawing function and the mouse event in the project set are rewritten by creating the project base class inherited to the Qt primitive project, so that the project base class after the drawing function is rewritten can be drawn in a user-defined mode, the project base class after the mouse event is rewritten can be managed and controlled in a unified mode, the existing method that the user-defined drawing and the unified management control cannot be combined is avoided, meanwhile, the user-defined project of the graph view frame with different functions and purposes is inherited in the rewritten project base class, and a user can draw the user-defined graph conveniently and quickly.
Description
Technical Field
The present invention relates to the field of information system technologies, and in particular, to a method, an apparatus, a device, and a storage medium for expanding a graphical view frame.
Background
At present, in a cross-platform drawing scene of a plurality of operating systems such as Windows and Linux, qt is widely used as a cross-platform graphical interface development framework, and Qt provides very rich modularized internal functions and interfaces to realize various drawing effects.
In actual development of Qt, the following two drawing methods are widely used, namely: the Qt drawing engine is used for drawing, namely a QPair class of Qt is used, and the QPair class provides rich interfaces for drawing various geometric figures such as characters, figures, pixels and the like and can perform some simple operations and control. The second method comprises the following steps: the graph view framework using Qt, which provides a framework of graph views, consists of three levels: a View View layer, a Scene layer and a graphic Item layer. Wherein the Scene layer serves as a container of the Item layer and is responsible for transmitting events translated by the View layer to each Item and managing the state of the Item. View provides a View window that is responsible for visualizing the content in the Scene layer. Items with standard items such as rectangles, ellipses, text, etc. can also self-define items. Item has properties of receiving mouse and keyboard input events, multiple Item combinations, and collision detection. The Qt graphical view framework can manage and interact with a large number of graphical items. Although various graphs which the user wants to realize can be drawn, the drawn graphs cannot be managed, hundreds of same or different graphs which are drawn cannot receive mouse events and cannot realize complex functions such as dragging, zooming and the like, and the second mode is relatively complex to realize and cannot realize customized drawing of graph items.
Therefore, there is a need for an extension method of a graphic view framework capable of extending, drawing by definition, and controlling graphic items.
Disclosure of Invention
The invention provides an expansion method, an expansion device, equipment and a storage medium of a graph view frame, which aim to solve the technical problem that the expansion, the custom drawing and the unified management control of a graph item cannot be carried out in the prior art.
In order to solve the above technical problem, an embodiment of the present invention provides an expansion method of a graph view frame, including:
creating an item base class inherited to the Qt primitive item;
rewriting a drawing function and a mouse event in the item base class;
inheriting the item base class after the drawing function and the mouse event are rewritten, and creating and extending the user-defined item of the graphic view frame.
Compared with the prior art, the method has the advantages that the drawing function and the mouse event in the project set are rewritten by creating the project base class inherited to the Qt primitive project, the project base class after the drawing function is rewritten can be drawn in a user-defined mode, the project base class after the mouse event is rewritten can be managed and controlled in a unified mode, the existing method that the user-defined drawing and the unified management control cannot be combined is avoided, meanwhile, the method inherits the project base class after the drawing function and the mouse event are rewritten, the user-defined project of the graphic view frame is created and expanded, the user-defined project inherited to the project base class can be expanded in different functions, the expansion of the user-defined graphic project is achieved, a user can draw the user-defined graphic more conveniently and rapidly, and the drawing and control convenience is improved.
As a preferred scheme, the rewriting of the drawing function and the mouse event in the item base class specifically includes:
calling a pure virtual function in the project base class, and rewriting a drawing function according to the pure virtual function so as to realize the basic drawing of the project base class; wherein the pure imaginary function is a custom drawing function;
in the item base class, mouse events including move, select, and zoom are rewritten to achieve basic control of the item base class.
It can be understood that the item base class can realize the basic drawing and the basic control of the graphic item by rewriting the drawing function and the mouse event in the item base class, and the custom drawing of the graphic item is extended by the pure virtual function belonging to the custom drawing, so that the extended graphic item has the basic drawing elements later, and the basic control functions of the graphic item, such as moving, rotating and zooming, are realized.
As a preferred scheme, the inheriting the item base class after the rewriting drawing function and the mouse event, and creating and expanding the custom item of the graphic view frame specifically include:
inheriting the project base class after the drawing function and the mouse event are rewritten, and therefore a user-defined project inherited to the project base class is created;
and rewriting the custom drawing function in the custom project so that the custom project can realize custom drawing through the drawing function.
It can be understood that the user-defined item inherited to the item base class after the drawing function and the mouse event are rewritten is created by inheriting the item base class, and the user-defined drawing function in the user-defined item is rewritten, so that all the expanded graphic items can be drawn by the user in a user-defined manner, the user can draw the graphic in a personalized manner, the drawing convenience and efficiency of the user-defined graphic are improved, and the user experience is optimized.
As a preferred solution, after rewriting the custom drawing function in the custom item, the method further includes:
adding a pointer as a project graphic item and/or a micro-control into a member variable, thereby completing the expansion of a graphic view frame of a user-defined project; wherein, the self-defining item comprises a plurality of defined and added member variables.
It can be understood that the extension of the graphic view frame of the self-defined project can be realized by adding the pointer of the project graphic item and/or the micro-control element to the member variable in the self-defined project, and the extension performance of the whole frame is improved, so that the user can further perform the self-defined extension of the required functions through the self-defined project, and the user-defined operation experience is further improved.
Correspondingly, the invention also provides an expansion device of the graphic view frame, which comprises: a base class creation module, a rewrite module, and an extension module;
the base class creating module is used for creating an item base class inherited to the Qt primitive item;
the rewriting module is used for rewriting a drawing function and a mouse event in the project base class;
and the extension module is used for inheriting the item base class after the drawing function and the mouse event are rewritten, and creating and extending the user-defined item of the graphic view frame.
As a preferred scheme, the rewriting of the drawing function and the mouse event in the item base class specifically includes:
calling a pure virtual function in the project base class, and rewriting a drawing function according to the pure virtual function so as to realize the basic drawing of the project base class; wherein the pure imaginary function is a custom drawing function;
in the item base class, mouse events including move, select, and zoom are rewritten to achieve basic control of the item base class.
As a preferred scheme, the inheriting the item base class after the drawing function is rewritten and the mouse event is rewritten, and the user-defined item of the graphic view frame is created and extended, specifically:
inheriting the project base class after the drawing function and the mouse event are rewritten, and therefore a user-defined project inherited to the project base class is created;
and rewriting a custom drawing function in the custom project so that the custom project can realize custom drawing through the drawing function.
Preferably, after rewriting the custom drawing function in the custom item, the method further includes:
adding a pointer to a project graphic item and/or a micro-control to a member variable, thereby completing the expansion of a graphic view frame of a user-defined project; wherein, the self-defining item comprises a plurality of defined and added member variables.
Accordingly, the present invention also provides a terminal device, which includes a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor implements the method for extending the graphical view framework as described above when executing the computer program.
Accordingly, the present invention also provides a computer readable storage medium comprising a stored computer program; wherein the computer program, when running, controls the device on which the computer-readable storage medium is located to perform the method for extending the graphical view framework as described above.
Drawings
FIG. 1: the step flow chart of the method for expanding the graphic view frame provided by the embodiment of the invention is shown;
FIG. 2: an execution frame diagram of an expansion method of a graph view frame provided by the embodiment of the invention;
FIG. 3: the embodiment of the invention provides a structural schematic diagram of an expansion device of a graphic view frame.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Example one
Referring to fig. 1, a method for expanding a graph view frame according to an embodiment of the present invention includes the following steps S101 to S103:
s101: an item base class is created that inherits the Qt primitive item.
It should be noted that, in this embodiment, the Qt primitive item is a qgraphics item, the created item base class is an exampleitempase, and this embodiment mainly implements image view framework extension of a graphics item that can be expanded and highly customized for drawing and control, draws a graphic by using the graphics item as a main body, draws a graphic by using the qgraphics item as a main bearer, and makes the qpair implement auxiliary drawing, so that the qgraphics item implements basic event reception for the graphics item, thereby implementing control of dragging, zooming, rotating, and the like, and makes the qpair implement element drawing on the graphics item.
S102: and rewriting a drawing function and a mouse event in the item base class.
As a preferred solution of this embodiment, the rewriting of the drawing function and the mouse event in the item base class specifically includes:
calling a pure virtual function in the project base class, and rewriting a drawing function according to the pure virtual function so as to realize the basic drawing of the project base class; wherein the pure virtual function is a custom drawing function; in the item base class, mouse events including move, select, and zoom are rewritten to achieve basic control of the item base class.
Please refer to fig. 2, in this embodiment, after the example itemtbase item base class is created, a paint function (drawing function) of the qgraphics item and a mouse event are rewritten, so that the example itemtbase item base class is used as a basic drawing and a basic control of a graphics item to be extended later.
Further, in this embodiment, the pure virtual function is a customPaint function, that is, a custom rendering function, and the customipain function is called and a QPainer parameter in the paint function is utilized to implement a pair of paint functions (a drawing function), so as to implement a drawing element for basic custom rendering of the graphic item, including but not limited to a frame and a control point element displayed after selection; basic control examples of the graphic item, such as functions of moving, rotating, zooming and the like, are realized by rewriting mouse events including moving, selecting, zooming and the like in the exemplarItemBase item base class, wherein the mouse events include, but are not limited to, mousePresEvent, mouseEvent, mouseReleaseEvent.
It can be understood that the item base class can realize the basic drawing and the basic control of the graphic item by rewriting the drawing function and the mouse event in the item base class, and extend the self-defined drawing of the graphic item by the pure virtual function belonging to the self-defined drawing, so that the graphic item extended later has the basic drawing elements and realizes the basic control functions of the graphic item, such as moving, rotating and zooming.
S103: inheriting the project base class after the drawing function and the mouse event are rewritten, and creating and extending the user-defined project of the graphic view frame.
As a preferred solution of this embodiment, the inheriting the item base class after the rewriting drawing function and the mouse event, and creating and extending the custom item of the graphic view frame specifically include:
inheriting the project base class after the drawing function and the mouse event are rewritten, and accordingly creating a custom project inherited to the project base class; and rewriting the custom drawing function in the custom project so that the custom project can realize custom drawing through the drawing function.
It should be noted that, referring to fig. 2, the custom Item is inherited to the example itetembase Item base class, the custom Item is an extended Item, and the customipaint function is called in the paint function, so that the customipaint pure virtual function is used to rewrite the extended graphic Item, thereby implementing custom drawing by using the qpair, for example, drawing pictures, characters, polygons, and other graphics and all graphics that can be drawn by other qpair classes.
It can be understood that the user-defined item inherited to the item base class after the drawing function and the mouse event are rewritten is created by inheriting the item base class, and the user-defined drawing function in the user-defined item is rewritten, so that all the expanded graphic items can be drawn by the user in a user-defined manner, the user can draw the graphic in a personalized manner, the drawing convenience and efficiency of the user-defined graphic are improved, and the user experience is optimized.
As a preferable solution of this embodiment, after rewriting the custom rendering function in the custom item, the method further includes:
adding a pointer as a project graphic item and/or a micro-control into a member variable, thereby completing the expansion of a graphic view frame of a user-defined project; wherein, the self-defining item comprises a plurality of defined and added member variables.
It should be noted that, please refer to fig. 2, in this embodiment, some Item graphic items, such as videos and texts, which are expanded by the qgraphics Item user themselves, may be added in the frame, and a qpair class or an Item graphic Item carried by the Qt may be selected according to requirements, or the user may self-define an Item graphic Item in any form, and the Item graphic Item may be implemented by adding a Qt-carried expanded Item, such as a qgraphics textitem, a qgraphics video Item, and the like, to a member variable in another Item class (self-defined Item) after inheriting the exempleitembotmase Item base class, or by rewriting the other user, including but not limited to the qgraphics textitem, the qgraphics video Item, and the like.
Furthermore, if the factor of the graphic item hierarchy or the Z-axis is not considered, on the basis of the self-defined item, the QWidget class can be further expanded, that is, a QWidget control carried by the Qt and other defined controls are added, the QWidget range is very wide, the QWidget class can be expanded, and control is realized, so that the expandability of the qgraphics item framework in the embodiment is very large. The specific method comprises the following steps: the instantiation of the QWIdget control needs to transmit a QWIdget pointer to serve as a dependent point and a parent object of the control, in the Qt graphic Item framework, only a View layer is inherited to the QWIdget, so to realize the QWIdget extension, the QWIdget control object to be extended needs to be added into a member variable in a custom Item corresponding to the ExampleteBase Item base class, then the parent pointer of the QWIdget is set as a pointer of the View layer, then in the custommPuint, the position and the size of the extended QWIdget are bound, and the mixed extension of the Item and the QWIdget can be realized, wherein the QWIdget control comprises but is not limited to QSlier, QLabel and QPushButton.
It can be understood that the extension of the graphic view frame of the self-defined project can be realized by adding the pointer of the project graphic item and/or the micro-control element to the member variable in the self-defined project, and the extension performance of the whole frame is improved, so that the user can further perform the self-defined extension of the required functions through the self-defined project, and the user-defined operation experience is further improved.
It can be understood that, in this embodiment, a Qt graphics Item framework is fully utilized, and the method of the technical solution of the present invention is utilized on this framework, so that the disadvantages of the graphics Item framework itself can be overcome, and the advantages of qpair and QWidget are utilized to implement a highly customizable controllable graphics Item, and the graphics Item can be extended by selecting three ways, i.e., item, painter, and Widget.
The above embodiment is implemented, and has the following effects:
compared with the prior art, the method and the device have the advantages that the drawing function and the mouse event in the item set are rewritten by creating the item base class inherited to the Qt primitive item, so that the item base class after the drawing function is rewritten can be drawn in a user-defined mode, the item base class after the mouse event is rewritten can be managed and controlled in a unified mode, the existing method that the user-defined drawing and the unified management control cannot be combined is avoided, meanwhile, the method and the device can inherit the item base class after the drawing function and the mouse event are rewritten, the user-defined item of the graph view frame is created and expanded, so that the user-defined item inherited to the item base class can be expanded in different functions, the expansion of the user-defined graph item is achieved, a user can draw the user-defined graph more conveniently and quickly, and the drawing and control convenience are improved.
Example two
Accordingly, please refer to fig. 3, which is an expanding apparatus of a graphical view frame according to the present invention, comprising: a base class creation module 201, a rewrite module 202, and an extension module 203.
The base class creating module 201 is configured to create an item base class inherited to the Qt primitive item.
The rewriting module 202 is configured to rewrite a drawing function and a mouse event in the item base class.
The extension module 203 is configured to inherit the item base class after the drawing function and the mouse event are rewritten, and create and extend the custom item of the graphic view frame.
As a preferred scheme, the rewriting of the drawing function and the mouse event in the item base class specifically includes:
calling a pure virtual function in the project base class, and rewriting a drawing function according to the pure virtual function so as to realize the basic drawing of the project base class; wherein the pure virtual function is a custom drawing function; in the item base class, mouse events including move, select, and zoom are rewritten to achieve basic control of the item base class.
As a preferred scheme, the inheriting the item base class after the drawing function is rewritten and the mouse event is rewritten, and the user-defined item of the graphic view frame is created and extended, specifically:
inheriting the project base class after the drawing function and the mouse event are rewritten, and therefore a user-defined project inherited to the project base class is created; and rewriting the custom drawing function in the custom project so that the custom project can realize custom drawing through the drawing function.
Preferably, after rewriting the custom drawing function in the custom item, the method further includes:
adding a pointer as a project graphic item and/or a micro-control into a member variable, thereby completing the expansion of a graphic view frame of a user-defined project; wherein, the self-defining item comprises a plurality of defined and added member variables.
It can be clearly understood by those skilled in the art that, for convenience and simplicity of description, the specific working process of the apparatus described above may refer to the corresponding process in the foregoing method embodiment, and details are not described herein again.
The embodiment of the invention has the following effects:
compared with the prior art, the method and the device have the advantages that the drawing function and the mouse event in the item set are rewritten by creating the item base class inherited to the Qt primitive item, so that the item base class after the drawing function is rewritten can be drawn in a user-defined mode, the item base class after the mouse event is rewritten can be managed and controlled in a unified mode, the existing method that the user-defined drawing and the unified management control cannot be combined is avoided, meanwhile, the method and the device can inherit the item base class after the drawing function and the mouse event are rewritten, the user-defined item of the graph view frame is created and expanded, so that the user-defined item inherited to the item base class can be expanded in different functions, the expansion of the user-defined graph item is achieved, a user can draw the user-defined graph more conveniently and quickly, and the drawing and control convenience are improved.
EXAMPLE III
Correspondingly, the invention also provides a terminal device, comprising: a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, the processor implementing the method for extending a graphical view frame according to any of the above embodiments when executing the computer program.
The terminal device of this embodiment includes: a processor, a memory, and a computer program, computer instructions stored in the memory and executable on the processor. The processor, when executing the computer program, implements the steps in the first embodiment, for example, steps S101 to S103 shown in fig. 1. Alternatively, the processor implements the functions of the modules/units in the above-mentioned device embodiments when executing the computer program, for example, the extension module 203.
Illustratively, the computer program may be partitioned into one or more modules/units that are stored in the memory and executed by the processor to implement the invention. The one or more modules/units may be a series of computer program instruction segments capable of performing specific functions, which are used for describing the execution process of the computer program in the terminal device. For example, the extension module 203 is configured to inherit the item base class after the drawing function and the mouse event are rewritten, and create and extend the custom item of the graphic view frame.
The terminal device can be a desktop computer, a notebook, a palm computer, a cloud server and other computing devices. The terminal device may include, but is not limited to, a processor, a memory. It will be appreciated by those skilled in the art that the schematic diagram is merely an example of a terminal device and does not constitute a limitation of a terminal device, and may include more or less components than those shown, or combine certain components, or different components, for example, the terminal device may also include input output devices, network access devices, buses, etc.
The Processor may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic, discrete hardware components, etc. The general-purpose processor may be a microprocessor or the processor may be any conventional processor or the like, said processor being the control center of said terminal device, and various interfaces and lines are used to connect the various parts of the whole terminal device.
The memory may be used to store the computer programs and/or modules, and the processor may implement various functions of the terminal device by running or executing the computer programs and/or modules stored in the memory and calling data stored in the memory. The memory may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function, and the like; the storage data area may store data created according to the use of the mobile terminal, and the like. In addition, the memory may include high-speed random access memory, and may also include non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), at least one magnetic disk storage device, a Flash memory device, or other volatile solid state storage device.
Wherein, the terminal device integrated module/unit can be stored in a computer readable storage medium if it is implemented in the form of software functional unit and sold or used as a stand-alone product. Based on such understanding, all or part of the flow of the method according to the embodiments of the present invention may also be implemented by a computer program, which may be stored in a computer-readable storage medium, and when the computer program is executed by a processor, the steps of the method embodiments described above may be implemented. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, usb disk, removable hard disk, magnetic disk, optical disk, computer Memory, read-Only Memory (ROM), random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, software distribution medium, and the like. It should be noted that the computer readable medium may contain content that is subject to appropriate increase or decrease as required by legislation and patent practice in jurisdictions, for example, in some jurisdictions, computer readable media does not include electrical carrier signals and telecommunications signals as is required by legislation and patent practice.
Example four
Accordingly, the present invention further provides a computer-readable storage medium, which includes a stored computer program, wherein when the computer program runs, a device on which the computer-readable storage medium is located is controlled to execute the method for expanding the graphical view framework according to any one of the above embodiments.
The above-mentioned embodiments are provided to further explain the objects, technical solutions and advantages of the present invention in detail, and it should be understood that the above-mentioned embodiments are only examples of the present invention and are not intended to limit the scope of the present invention. It should be understood that various changes, substitutions and alterations can be made herein without departing from the spirit and scope of the invention as defined by the appended claims.
Claims (6)
1. An expansion method of a graphic view frame, comprising:
creating an item base class inherited to the Qt primitive item;
rewriting a drawing function and a mouse event in the item base class;
specifically, in the project base class, calling a pure virtual function, and rewriting a drawing function according to the pure virtual function so as to realize basic drawing of the project base class; wherein the pure virtual function is a custom drawing function; in the project base class, rewriting mouse events including movement, selection and scaling so as to realize basic control of the project base class;
calling a pure virtual function in the drawing function to enable the pure virtual function to be used for rewriting the expanded graphic item, thereby realizing self-defined drawing by adopting a QPair;
inheriting the project base class after the drawing function and the mouse event are rewritten, and creating and extending a user-defined project of the graphic view frame; after the item base class is inherited, adding an expansion self-defined item of the Qt or a self-defined item rewritten by a user into member variables in other self-defined items; and adding a QWIdget control object to be expanded in member variables in a custom item of the inheritance item base class, setting a parent pointer of the QWIdget as a pointer of a View layer, and binding the position and the size of the expanded QWIdget in a pure virtual function, thereby realizing the mixed expansion of the custom item and the QWIdget.
2. The method for extending a graphic view frame according to claim 1, wherein the step of inheriting the item base class after the drawing function and the mouse event are rewritten and creating and extending a custom item of the graphic view frame specifically comprises the steps of:
inheriting the project base class after the drawing function and the mouse event are rewritten, and therefore a user-defined project inherited to the project base class is created;
and rewriting a custom drawing function in the custom project so that the custom project can realize custom drawing through the drawing function.
3. An expansion device of a graphic view frame, comprising: a base class creation module, a rewrite module, and an extension module;
the base class creating module is used for creating an item base class inherited to the Qt primitive item;
the rewriting module is used for rewriting a drawing function and a mouse event in the project base class;
specifically, in the item base class, a pure virtual function is called, and a drawing function is rewritten according to the pure virtual function, so as to realize the basic drawing of the item base class; wherein the pure imaginary function is a custom drawing function; in the project base class, rewriting mouse events including movement, selection and scaling so as to realize basic control of the project base class;
calling a pure virtual function in the drawing function to enable the pure virtual function to be used for rewriting the expanded graphic item, thereby realizing self-defined drawing by adopting a QPair;
inheriting the item base class after the drawing function and the mouse event are rewritten, and creating and expanding a user-defined item of the graphic view frame; after the item base class is inherited, adding an expansion self-defined item of the Qt or a self-defined item rewritten by a user into member variables in other self-defined items; and adding a QWIdget control object to be expanded into member variables in a custom item of the inheritance item base class, setting a parent pointer of the QWIdget as a pointer of a View layer, and binding the position and the size of the expanded QWIdget in a pure virtual function, thereby realizing the mixed expansion of the custom item and the QWIdget.
4. The apparatus for extending a graphic view frame according to claim 3, wherein the step of inheriting the item base class after rewriting the drawing function and the mouse event, and creating and extending the custom item of the graphic view frame specifically comprises:
inheriting the project base class after the drawing function and the mouse event are rewritten, and therefore a user-defined project inherited to the project base class is created;
and rewriting the custom drawing function in the custom project so that the custom project can realize custom drawing through the drawing function.
5. A terminal device comprising a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, the processor implementing the method of extending the graphical view framework of any of claims 1-2 when executing the computer program.
6. A computer-readable storage medium, characterized in that the computer-readable storage medium comprises a stored computer program; wherein the computer program, when executed, controls an apparatus on which the computer-readable storage medium is located to perform the method of extending the graphical view framework of any of claims 1-2.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211029388.9A CN115098083B (en) | 2022-08-26 | 2022-08-26 | Method, device and equipment for expanding graphic view frame and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211029388.9A CN115098083B (en) | 2022-08-26 | 2022-08-26 | Method, device and equipment for expanding graphic view frame and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN115098083A CN115098083A (en) | 2022-09-23 |
CN115098083B true CN115098083B (en) | 2022-11-22 |
Family
ID=83300782
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202211029388.9A Active CN115098083B (en) | 2022-08-26 | 2022-08-26 | Method, device and equipment for expanding graphic view frame and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115098083B (en) |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US5442793A (en) * | 1993-02-26 | 1995-08-15 | Microsoft Corporation | Method and system for locating an inherited virtual function member of a derived class |
WO2003067427A2 (en) * | 2002-02-07 | 2003-08-14 | British Telecommunications Public Limited Company | Graphical user interface |
CN109739490A (en) * | 2018-12-15 | 2019-05-10 | 南京理工大学 | Quick electrical component model creating method based on QT graph framework |
CN110969625A (en) * | 2019-11-13 | 2020-04-07 | 南通恒康数控机械股份有限公司 | Sponge cutting graph display method based on Qt |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114217725A (en) * | 2021-12-15 | 2022-03-22 | 深圳市海浦蒙特科技有限公司 | Drawing method, device, equipment and medium based on Qt graphic view frame |
-
2022
- 2022-08-26 CN CN202211029388.9A patent/CN115098083B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US5442793A (en) * | 1993-02-26 | 1995-08-15 | Microsoft Corporation | Method and system for locating an inherited virtual function member of a derived class |
WO2003067427A2 (en) * | 2002-02-07 | 2003-08-14 | British Telecommunications Public Limited Company | Graphical user interface |
CN109739490A (en) * | 2018-12-15 | 2019-05-10 | 南京理工大学 | Quick electrical component model creating method based on QT graph framework |
CN110969625A (en) * | 2019-11-13 | 2020-04-07 | 南通恒康数控机械股份有限公司 | Sponge cutting graph display method based on Qt |
Also Published As
Publication number | Publication date |
---|---|
CN115098083A (en) | 2022-09-23 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US9196075B2 (en) | Animation of computer-generated display components of user interfaces and content items | |
US9142044B2 (en) | Apparatus, systems and methods for layout of scene graphs using node bounding areas | |
US8441496B1 (en) | Method and system for modifying and rendering scenes via display lists | |
EP2984558B1 (en) | Multiple displays for displaying workspaces | |
CN107015791B (en) | Processing method, device and system for generating chart component system | |
CN109783757B (en) | Method, device and system for rendering webpage, storage medium and electronic device | |
US10964122B2 (en) | Snapping virtual object to target surface | |
CN111476007B (en) | Table generation method, table generation device, computer device and computer-readable storage medium | |
CN107766703A (en) | Watermark addition processing method, device and client | |
US20140325404A1 (en) | Generating Screen Data | |
CN111290680B (en) | List display method, device, terminal and storage medium | |
US10963141B2 (en) | Smart multi-touch layout control for mobile devices | |
CN109976744B (en) | Visual programming method, system and terminal equipment | |
CN115098083B (en) | Method, device and equipment for expanding graphic view frame and storage medium | |
CN114995699A (en) | Interface interaction method and device | |
US20130106885A1 (en) | Aliasing of live elements in a user interface | |
CN112116719A (en) | Method, device, storage medium and electronic device for determining objects in three-dimensional scene | |
CN112578961B (en) | Application identifier display method and device | |
Urbanek | iPlots eXtreme: next-generation interactive graphics design and implementation of modern interactive graphics | |
CN115618136A (en) | Method and device for realizing step bar, electronic equipment and storage medium | |
CN114518821A (en) | Application icon management method and device and electronic equipment | |
CN110888787A (en) | Data monitoring method, device and system | |
CN116974678B (en) | Page-based view controller jump method, device and storage medium | |
CN112817508B (en) | Method, device and equipment for managing gesture control instruction of resource material | |
CN112464126B (en) | Method for generating panoramic chart based on Threejs, terminal equipment and storage medium |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant | ||
CP03 | Change of name, title or address |
Address after: No. 56 Nanli East Road, Shiqi Town, Panyu District, Guangzhou City, Guangdong Province, 510000 Patentee after: Guangdong Baolun Electronics Co.,Ltd. Address before: No.19 Chuangyuan Road, Zhongcun street, Panyu District, Guangzhou, Guangdong 510000 Patentee before: GUANGZHOU ITC ELECTRONIC TECHNOLOGY Co.,Ltd. |
|
CP03 | Change of name, title or address |