CN112947805A - Icon sorting method and device - Google Patents

Icon sorting method and device Download PDF

Info

Publication number
CN112947805A
CN112947805A CN201911266551.1A CN201911266551A CN112947805A CN 112947805 A CN112947805 A CN 112947805A CN 201911266551 A CN201911266551 A CN 201911266551A CN 112947805 A CN112947805 A CN 112947805A
Authority
CN
China
Prior art keywords
coordinate
window control
interface
interval
icon
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
CN201911266551.1A
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.)
State Grid Information and Telecommunication Co Ltd
Beijing China Power Information Technology Co Ltd
Original Assignee
State Grid Information and Telecommunication Co Ltd
Beijing China Power Information Technology Co Ltd
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 State Grid Information and Telecommunication Co Ltd, Beijing China Power Information Technology Co Ltd filed Critical State Grid Information and Telecommunication Co Ltd
Priority to CN201911266551.1A priority Critical patent/CN112947805A/en
Publication of CN112947805A publication Critical patent/CN112947805A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input 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/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0481Interaction techniques based on graphical user interfaces [GUI] based on specific properties of the displayed interaction object or a metaphor-based environment, e.g. interaction with desktop elements like windows or icons, or assisted by a cursor's changing behaviour or appearance
    • G06F3/04817Interaction techniques based on graphical user interfaces [GUI] based on specific properties of the displayed interaction object or a metaphor-based environment, e.g. interaction with desktop elements like windows or icons, or assisted by a cursor's changing behaviour or appearance using icons
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input 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/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0484Interaction 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/0486Drag-and-drop
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/451Execution arrangements for user interfaces

Abstract

The invention provides an icon sorting method and device, wherein the method comprises the steps of monitoring a new thread generated when a mouse is used for dragging a first icon on an interface drawn based on a Pyqt technology stack, obtaining the current coordinate of the mouse, wherein the interface drawn based on the Pyqt technology stack comprises a plurality of icons, a window control is preset in each icon, comparing the current coordinate with a pre-stored coordinate interval of the window control, and if the current coordinate is in the coordinate interval of any window control, re-sorting all icons on the interface by taking the position of a second icon corresponding to the coordinate interval of the window control as the new position of the first icon. According to the scheme, the current coordinate is compared with a pre-stored coordinate interval of the window control, when the current coordinate is determined to be in the coordinate interval of the window control, the current coordinate is used as the position of the first icon, and the icons on the interface are sorted again based on the position, so that the purpose of sorting the icons on the interface drawn based on the Pyqt technology stack is achieved.

Description

Icon sorting method and device
Technical Field
The invention relates to the technical field of computers, in particular to an icon sorting method and device.
Background
At present, the application of the Python language is more and more extensive, and the Python language is used in various application scenes. For example: in the development application scene of the interface program, the interface drawn based on the Pyqt technology stack. However, the purpose of icon dragging and sorting cannot be achieved in the interface drawn based on the Pyqt technology stack.
For example, a plurality of icons exist in an interface drawn by a Pyqt technology stack, each icon can only be fixed at a certain fixed position in the interface, and a user cannot drag, move and sort the icons in the interface according to the user's desire.
Disclosure of Invention
In view of this, embodiments of the present invention provide an icon sorting method and apparatus, which are used to solve the problem that icons of an interface drawn based on a Pyqt technology stack cannot be dragged and sorted.
In order to achieve the above purpose, the embodiments of the present invention provide the following technical solutions:
a first aspect of an embodiment of the present invention provides an icon sorting method, where the method includes:
monitoring a new thread generated when a dragging event occurs, and acquiring the current coordinate of a mouse after the dragging event occurs, wherein the dragging event refers to the fact that the mouse is used for dragging a first icon on an interface drawn based on a Pyqt technology stack, the interface drawn based on the Pyqt technology stack comprises a plurality of icons, and window controls are preset in the icons;
comparing the current coordinate with a coordinate interval of a pre-stored window control;
and if the current coordinate is in the coordinate interval of any window control, taking the position of a second icon corresponding to the coordinate interval of the window control as the new position of the first icon, and reordering all icons on the interface.
Preferably, the process of drawing an interface based on a Pyqt technology stack includes:
generating an interface in a grid layout, wherein a type of module is arranged in each grid, and the module corresponds to an icon;
when the interface is rendered, inserting a window control into each module, and storing the coordinate interval of the window control;
and after the rendering is finished, displaying the icon corresponding to the module on the interface.
Preferably, the comparing the current coordinate with a coordinate interval of a pre-stored window control includes:
acquiring a coordinate interval of a pre-stored window control, wherein the coordinate interval is composed of coordinate points in four directions of an upper left coordinate point, an upper right coordinate point, a lower left coordinate point and a lower right coordinate point of the window control;
calculating whether the abscissa and the ordinate of the current coordinate are in the coordinate interval of each pre-stored window control by taking a coordinate point in any direction as a reference point;
and if the abscissa and the ordinate of the current coordinate are both in the coordinate interval of the pre-stored window control, determining that the current coordinate is in the coordinate interval of the window control.
Preferably, the calculating, for each coordinate interval of the pre-stored window control, whether the current coordinate is within the coordinate interval of the pre-stored window control with a coordinate point in any direction as a reference point includes:
and aiming at the coordinate interval of each pre-stored window control, calculating whether the abscissa of the current coordinate point is positioned between the abscissa of the upper left coordinate point and the abscissa of the upper right coordinate point by taking the upper left coordinate point as a reference point, and calculating whether the ordinate of the current coordinate point is positioned between the ordinate of the upper left coordinate point and the ordinate of the lower left coordinate point.
Preferably, the method further comprises the following steps:
and obtaining the coordinate intervals of the window controls corresponding to all the reordered icons on the interface, and updating the interface.
A second aspect of the present invention provides an icon sorting apparatus, including:
the monitoring module is used for monitoring a new thread generated when a dragging event occurs, and acquiring the current coordinates of a mouse after the dragging event occurs, wherein the dragging event refers to the operation of dragging a first icon on an interface drawn based on a Pyqt technology stack by using the mouse, the interface drawn based on the Pyqt technology stack comprises a plurality of icons, and window controls are preset in the icons;
the comparison module is used for comparing the current coordinate with a coordinate interval of a pre-stored window control;
and the sorting module is used for taking the position of a second icon corresponding to the coordinate interval of the window control as the new position of the first icon and re-sorting all the icons on the interface if the current coordinate is in the coordinate interval of any window control.
Preferably, the method further comprises the following steps:
the initialization module is used for generating an interface which is arranged in grids, one type of module is arranged in each grid, the module corresponds to one icon, a window control is inserted into each module when the interface is rendered, the coordinate interval of the window control is recorded, and the icon corresponding to the module is displayed on the interface after the rendering is finished.
Preferably, the comparing module includes:
the system comprises an acquisition unit, a display unit and a control unit, wherein the acquisition unit is used for acquiring a pre-stored coordinate interval of a window control, and the coordinate interval is composed of coordinate points in four directions of an upper left coordinate point, an upper right coordinate point, a lower left coordinate point and a lower right coordinate point of the window control;
and the calculating unit is used for calculating whether the abscissa and the ordinate of the current coordinate are in the coordinate interval of the pre-stored window control by taking a coordinate point in any direction as a reference point in the coordinate interval of each pre-stored window control, and determining that the current coordinate is in the coordinate interval of the window control if the abscissa and the ordinate of the current coordinate are both in the coordinate interval of the pre-stored window control.
Preferably, the calculating unit that calculates whether the abscissa and the ordinate of the current coordinate are located in the coordinate interval of the pre-stored window control is specifically configured to calculate, for each coordinate interval of the pre-stored window control, whether the abscissa of the current coordinate point is located between the abscissa of the upper left coordinate point and the abscissa of the upper right coordinate point, and whether the ordinate of the current coordinate point is located between the ordinate of the upper left coordinate point and the ordinate of the lower left coordinate point, with the upper left coordinate point as a reference point.
Preferably, the method further comprises the following steps:
and the updating module is used for acquiring the coordinate intervals of the window controls corresponding to the reordered icons on the interface and updating the interface.
Compared with the prior art, the technical scheme provided by the invention has the following advantages:
monitoring a new thread generated when a mouse is used for dragging a first icon on an interface drawn based on a Pyqt technology stack, obtaining the current coordinates of the mouse, wherein the interface drawn based on the Pyqt technology stack comprises a plurality of icons, window controls are preset in the icons, comparing the current coordinates with a pre-stored coordinate interval of the window controls, and if the current coordinates are in the coordinate interval of any one window control, reordering all the icons on the interface by taking the position of a second icon corresponding to the coordinate interval of the window controls as the new position of the first icon. According to the scheme, the current coordinate is compared with a pre-stored coordinate interval of the window control, when the current coordinate is determined to be in the coordinate interval of the window control, the current coordinate is used as the position of the first icon, and the icons on the interface are sorted again based on the position, so that the purpose of sorting the icons on the interface drawn based on the Pyqt technology stack is achieved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
Fig. 1 is a flowchart of drawing an interface based on a Pyqt technology stack according to an embodiment of the present invention;
fig. 2 is a schematic diagram of an interface generated after an interface is drawn based on a Pyqt technology stack according to an embodiment of the present invention;
fig. 3 is a flowchart of an icon sorting method according to an embodiment of the present invention;
fig. 4 is a flowchart illustrating a process of comparing a current coordinate with a coordinate interval of a pre-stored window control according to an embodiment of the present invention;
fig. 5 is a schematic diagram illustrating that a current coordinate is within a coordinate interval of a window control according to an embodiment of the present invention;
fig. 6 is a flowchart for calculating whether the abscissa and the ordinate of the current coordinate are within a coordinate interval of a pre-stored window control according to an embodiment of the present invention;
fig. 7 is a schematic interface diagram obtained by reordering all icons according to an embodiment of the present invention;
fig. 8 is a schematic structural diagram of an icon sorting apparatus according to an embodiment of the present invention.
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.
In this application, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
As can be seen from the background art, in the prior art, Python language is used in various application scenarios. For example: in the development application scene of the interface program, the interface drawn based on the Pyqt technology stack. However, the purpose of icon dragging and sorting cannot be achieved in the interface drawn based on the Pyqt technology stack.
Therefore, the invention provides an icon sorting method and device, which are used for determining that the current coordinate is in the coordinate interval of the window control by comparing the current coordinate with the coordinate interval of the pre-stored window control, and taking the current coordinate as the position of the first icon, so that the problem that the icons of the interface drawn based on the Pyqt technology stack cannot be dragged and sorted is solved.
The invention aims to solve the problem that icons of an interface drawn based on a Pyqt technology stack cannot be dragged and sorted. As shown in fig. 1, a flowchart for specific implementation of a Pyqt technology stack-based drawing interface according to an embodiment of the present invention includes:
and S101, generating an interface in a grid layout, wherein one type of module is arranged in each grid.
In S101, the grid layout is a layout mode when the interface is drawn by the Pyqt technology stack, and the specific layout mode further includes: horizontal layout, vertical layout, table layout, wherein each module corresponds to an icon.
In the process of implementing S101 specifically, an interface drawn by the Pyqt technology stack is generated in a grid layout manner, and a type of module is set in each grid, where the module includes a preset window control, and the rest elements of the module are all included in the window control, and the window control includes, but is not limited to, a Qwidget control.
And S102, inserting a window control into each module when the interface is rendered, and storing the coordinate interval of the window control.
In the process of specifically implementing S102, in the process of rendering the interface, the same window control is inserted into each module at the same time, and the coordinate interval of the window control is stored, so that the current coordinate after the mouse dragging icon is moved is compared with the coordinate interval of the window control.
And S103, displaying the icon corresponding to the module on the interface after the rendering is finished.
In the process of implementing S103 specifically, after the rendering of the interface is finished, an icon corresponding to the module is displayed on the interface.
The embodiment of the invention provides an interface schematic diagram generated after drawing an interface based on a Pyqt technology stack is completed based on the method shown in fig. 1, as shown in fig. 2.
In fig. 2, the icons in the interface are "human resources", "finance", "SAP travel reimbursement" and "engineering chain" in order from left to right.
Based on the interface generated by the method in fig. 1 in the foregoing embodiment of the present invention, when icons in the interface are dragged and sorted, as shown in fig. 3, a flowchart of a method for sorting icons provided in the embodiment of the present invention is shown, where the method includes the following steps:
s301, monitoring a new thread generated when a dragging event occurs, and acquiring the current coordinate of the mouse after the dragging event occurs.
In S301, the dragging event refers to a dragging operation performed by using a mouse on a first icon on an interface drawn based on a Pyqt technology stack, where the interface drawn based on the Pyqt technology stack includes a plurality of icons, window controls are preset in the icons, and each window control has a corresponding coordinate interval.
In the specific implementation process of S301, when a mouse drags a certain icon on an interface drawn based on a Pyqt technology stack, a thread corresponding to a drag event is generated. The action of moving the mouse dragging icon on the interface and finally stopping at the position on the interface can be determined by the thread, and the coordinate of the position on the interface, namely the current coordinate, can be determined.
S302, comparing the current coordinate with a coordinate interval of a pre-stored window control, determining whether the current coordinate is in the coordinate interval of any window control, if so, executing S303, otherwise, generating a new icon sequence according to the current coordinate, and storing the icon sequence.
In the specific implementation process of S302, the current coordinate is compared with coordinate intervals of a plurality of window controls preset in an interface drawn by the Pyqt technology stack.
Optionally, the specific implementation process of comparing the current coordinate with the coordinate interval of the pre-stored window control, as shown in fig. 4, mainly includes:
s401, obtaining a coordinate interval of a pre-stored window control.
In S401, the coordinate section is formed of coordinate points in four directions, i.e., an upper left coordinate point, an upper right coordinate point, a lower left coordinate point, and a lower right coordinate point of the window control. Fig. 5 is a schematic diagram illustrating that the current coordinate is within the coordinate interval of a window control.
In fig. 5, coordinate points in four directions of the window control are an upper left coordinate point (800, 900), an upper right coordinate point (900 ), a lower left coordinate point (800, 1000), and a lower right coordinate point (900, 1000), respectively, and the coordinate point in the coordinate interval of the window control is the current coordinate (825, 930) after the icon is dragged by the mouse.
S402, calculating whether the abscissa and the ordinate of the current coordinate are in the coordinate interval of the pre-stored window control by taking the coordinate point in any direction as a reference point according to the coordinate interval of each pre-stored window control, if so, executing S403, and if not, executing S404.
In the process of implementing S402 specifically, whether the abscissa and ordinate of the current coordinate are within the coordinate interval of the pre-stored window control is calculated by using any coordinate point in four directions of the upper left coordinate point, the upper right coordinate point, the lower left coordinate point, and the lower right coordinate point of the window control as a reference point.
And S403, determining that the current coordinate is in the coordinate interval of the window control.
And S404, determining that the current coordinate is not in the coordinate interval of the window control.
And S303, taking the position of the second icon corresponding to the coordinate interval of the window control as the new position of the first icon, and reordering all icons on the interface.
In the process of specifically implementing S303, when a drag event occurs and the dragged icon is located in a coordinate interval of another window control, the position of the second icon corresponding to the coordinate interval of the window control is taken as a new position of the first icon, and all icons on the interface are reordered, so that all icons are stored in the interface according to the reordered sequence.
Optionally, after the drag event is ended, obtaining the coordinate intervals of the window controls corresponding to the reordered icons on the interface, updating the interface, and storing the coordinates and the sequence of all the icons on the interface.
Based on the icon sorting method disclosed in the embodiment of the present invention, a new thread generated when a mouse is used to drag a first icon on an interface drawn based on a Pyqt technology stack is monitored, a current coordinate of the mouse is obtained, the interface drawn based on the Pyqt technology stack includes a plurality of icons, a window control is pre-set in each icon, the current coordinate is compared with a pre-stored coordinate interval of the window control, and if the current coordinate is in the coordinate interval of any window control, a position of a second icon corresponding to the coordinate interval of the window control is used as a new position of the first icon, and all icons on the interface are re-sorted. According to the scheme, the current coordinate is compared with a pre-stored coordinate interval of the window control, when the current coordinate is determined to be in the coordinate interval of the window control, the current coordinate is used as the position of the first icon, and the icons on the interface are sorted again based on the position, so that the purpose of sorting the icons on the interface drawn based on the Pyqt technology stack is achieved.
Optionally, a specific implementation process of calculating whether the abscissa and the ordinate of the current coordinate are within a coordinate interval of a pre-stored window control by using the upper-left coordinate point as a reference point, as shown in fig. 6, mainly includes:
s601, aiming at the coordinate interval of each pre-stored window control, taking the upper left coordinate point as a reference point, calculating whether the abscissa of the current coordinate is positioned between the abscissa of the upper left coordinate point and the abscissa of the upper right coordinate point, if so, executing S602, and if not, generating a new icon sequence according to the current coordinate, and storing the icon sequence.
In the process of implementing S601 specifically, taking the top-left coordinate point of each window control as a reference point, if the abscissa of the current coordinate is greater than the abscissa of the top-left coordinate point of the window control and smaller than the top-right coordinate point of the window control, it is determined that the abscissa of the current coordinate point is located between the abscissa of the top-left coordinate point and the abscissa of the top-right coordinate point. Conversely, it is determined that the abscissa of the current coordinate point is not located between the abscissas of the upper-left coordinate point and the upper-right coordinate point.
For example: as can be seen from fig. 5, with the top-left coordinate point (800, 900) of the window control as the reference point, the abscissa 825 of the current coordinate (825, 930) is greater than the abscissa 800 of the top-left coordinate point of the window control and less than the abscissa 900 of the top-right coordinate point of the window control, and then the abscissa of the current coordinate point is determined to be located between the abscissa of the top-left coordinate point and the abscissa of the top-right coordinate point.
And S602, calculating whether the ordinate of the current coordinate point is located between the ordinate of the upper left coordinate point and the ordinate of the lower left coordinate point, if so, determining that the current coordinate is located in the coordinate interval of the window control, otherwise, generating a new icon sequence according to the current coordinate, and storing the icon sequence.
In the specific implementation process of S602, if the ordinate of the current coordinate point is greater than the ordinate of the upper-left coordinate point of the window control and smaller than the ordinate of the lower-left coordinate point of the window control, it is determined that the ordinate of the current coordinate point is located between the ordinate of the upper-left coordinate point and the ordinate of the lower-left coordinate point. In contrast, it is determined that the ordinate of the current coordinate point is not located between the ordinate of the upper-left coordinate point and the ordinate of the lower-left coordinate point.
For example: as can be seen from fig. 5, if the ordinate 930 of the current coordinate (825, 930) is greater than the ordinate 900 of the upper left coordinate point of the window control and less than the ordinate 1000 of the lower left coordinate point of the window control, it is determined that the ordinate of the current coordinate point is located between the ordinate of the upper left coordinate point and the ordinate of the lower left coordinate point.
It should be noted that, after determining that the current coordinate is in the coordinate interval of the window control, the position of the second icon corresponding to the coordinate interval of the window control is taken as the new position of the first icon, and all icons on the interface are reordered.
Specifically, as shown in fig. 7, a schematic interface diagram obtained by reordering all icons is shown.
In fig. 7, an icon corresponding to the "engineering chain" is dragged to the icon position of the "finance" through a mouse, after a dragging event occurs, if a new coordinate is located in the coordinate interval of the window control corresponding to the "finance", the "engineering chain" is considered to be dragged to a second position, a new sequence of "human resources", "engineering chain", "finance", and "SAP business travel reimbursement" is formed, the sequence is recorded in a file according to a standard format, and then the interface is refreshed again according to the new sequence.
The coordinate point on the upper left of the window control is used as the reference point, and other coordinate points may be set as the reference points according to actual situations.
Based on the icon sorting method disclosed in the embodiment of the present invention, a new thread generated when a mouse is used to drag a first icon on an interface drawn based on a Pyqt technology stack is monitored, a current coordinate of the mouse is obtained, the interface drawn based on the Pyqt technology stack includes a plurality of icons, a window control is pre-set in each icon, the current coordinate is compared with a pre-stored coordinate interval of the window control, and if the current coordinate is in the coordinate interval of any window control, a position of a second icon corresponding to the coordinate interval of the window control is used as a new position of the first icon, and all icons on the interface are re-sorted. According to the scheme, the current coordinate is compared with a pre-stored coordinate interval of the window control, when the current coordinate is determined to be in the coordinate interval of the window control, the current coordinate is used as the position of the first icon, and the icons on the interface are sorted again based on the position, so that the purpose of sorting the icons on the interface drawn based on the Pyqt technology stack is achieved.
Based on the icon sorting method disclosed in the embodiment of the present invention, an icon sorting device is further correspondingly disclosed in the embodiment of the present invention, and as shown in fig. 8, a schematic structural diagram of an icon sorting device provided in the embodiment of the present invention mainly includes: a listening module 80, a comparing module 81 and a sorting module 82.
The monitoring module 80 is configured to monitor a new thread generated when a drag event occurs, acquire current coordinates of a mouse after the drag event occurs, where the drag event refers to a drag operation performed on a first icon on an interface drawn based on a Pyqt technology stack by using the mouse, the interface drawn based on the Pyqt technology stack includes a plurality of icons, and a window control is preset in each icon.
And the comparison module 81 is configured to compare the current coordinate with a coordinate interval of a pre-stored window control.
And the sorting module 82 is configured to, if the current coordinate is within the coordinate interval of any window control, take the position of the second icon corresponding to the coordinate interval of the window control as the new position of the first icon, and reorder all icons on the interface.
An optional structure of the comparison module 81 in the embodiment of the present invention is: the comparison module 81 includes an acquisition unit and a calculation unit.
The acquisition unit is used for acquiring a pre-stored coordinate interval of the window control, and the coordinate interval is composed of coordinate points of four directions of an upper left coordinate point, an upper right coordinate point, a lower left coordinate point and a lower right coordinate point of the window control.
And the calculating unit is used for calculating whether the abscissa and the ordinate of the current coordinate are in the coordinate interval of the pre-stored window control by taking the coordinate point in any direction as a reference point in the coordinate interval of each pre-stored window control, and determining that the current coordinate is in the coordinate interval of the window control if the abscissa and the ordinate of the current coordinate are both in the coordinate interval of the pre-stored window control.
And the calculating unit is specifically configured to calculate, for each pre-stored coordinate interval of the window control, whether an abscissa of the current coordinate point is located between an abscissa of the upper left coordinate point and an abscissa of the upper right coordinate point, and whether an ordinate of the current coordinate point is located between an ordinate of the upper left coordinate point and an ordinate of the lower left coordinate point, with the upper left coordinate point as a reference point.
Based on the icon sorting device disclosed in the embodiment of the present invention, a new thread generated when a mouse is used to drag a first icon on an interface drawn based on a Pyqt technology stack is monitored, a current coordinate of the mouse is obtained, the interface drawn based on the Pyqt technology stack includes a plurality of icons, a window control is pre-set in each icon, the current coordinate is compared with a pre-stored coordinate interval of the window control, and if the current coordinate is in the coordinate interval of any window control, a position of a second icon corresponding to the coordinate interval of the window control is used as a new position of the first icon, and all icons on the interface are re-sorted. According to the scheme, the current coordinate is compared with a pre-stored coordinate interval of the window control, when the current coordinate is determined to be in the coordinate interval of the window control, the current coordinate is used as the position of the first icon, and the icons on the interface are sorted again based on the position, so that the purpose of sorting the icons on the interface drawn based on the Pyqt technology stack is achieved.
Based on the icon sorting device disclosed in the embodiment of the present invention, the icon sorting device further includes: and initializing the module.
The initialization module is used for generating an interface which is arranged in grids, one type of module is arranged in each grid, the module corresponds to one icon, a window control is inserted into each module when the interface is rendered, the coordinate interval of the window control is recorded, and the icon corresponding to the module is displayed on the interface after the rendering is finished.
Based on the icon sorting device disclosed in the embodiment of the present invention, the icon sorting device further includes: and updating the module.
And the updating module is used for acquiring the coordinate intervals of the window controls corresponding to the reordered icons on the interface and updating the interface.
Based on the icon sorting device disclosed in the embodiment of the present invention, a new thread generated when a mouse is used to drag a first icon on an interface drawn based on a Pyqt technology stack is monitored, a current coordinate of the mouse is obtained, the interface drawn based on the Pyqt technology stack includes a plurality of icons, a window control is pre-set in each icon, the current coordinate is compared with a pre-stored coordinate interval of the window control, and if the current coordinate is in the coordinate interval of any window control, a position of a second icon corresponding to the coordinate interval of the window control is used as a new position of the first icon, and all icons on the interface are re-sorted. According to the scheme, the current coordinate is compared with a pre-stored coordinate interval of the window control, when the current coordinate is determined to be in the coordinate interval of the window control, the current coordinate is used as the position of the first icon, and the icons on the interface are sorted again based on the position, so that the purpose of sorting the icons on the interface drawn based on the Pyqt technology stack is achieved.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, the system or system embodiments are substantially similar to the method embodiments and therefore are described in a relatively simple manner, and reference may be made to some of the descriptions of the method embodiments for related points. The above-described system and system embodiments are only illustrative, wherein the units described as separate parts may or may not be physically separate, and the parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative components and steps have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (10)

1. A method of icon ranking, the method comprising:
monitoring a new thread generated when a dragging event occurs, and acquiring the current coordinate of a mouse after the dragging event occurs, wherein the dragging event refers to the fact that the mouse is used for dragging a first icon on an interface drawn based on a Pyqt technology stack, the interface drawn based on the Pyqt technology stack comprises a plurality of icons, and window controls are preset in the icons;
comparing the current coordinate with a coordinate interval of a pre-stored window control;
and if the current coordinate is in the coordinate interval of any window control, taking the position of a second icon corresponding to the coordinate interval of the window control as the new position of the first icon, and reordering all icons on the interface.
2. The method according to claim 1, wherein the Pyqt-based technology stack interface drawing process comprises:
generating an interface in a grid layout, wherein a type of module is arranged in each grid, and the module corresponds to an icon;
when the interface is rendered, inserting a window control into each module, and storing the coordinate interval of the window control;
and after the rendering is finished, displaying the icon corresponding to the module on the interface.
3. The method of claim 1, wherein comparing the current coordinates to a pre-stored coordinate interval of a window control comprises:
acquiring a coordinate interval of a pre-stored window control, wherein the coordinate interval is composed of coordinate points in four directions of an upper left coordinate point, an upper right coordinate point, a lower left coordinate point and a lower right coordinate point of the window control;
calculating whether the abscissa and the ordinate of the current coordinate are in the coordinate interval of each pre-stored window control by taking a coordinate point in any direction as a reference point;
and if the abscissa and the ordinate of the current coordinate are both in the coordinate interval of the pre-stored window control, determining that the current coordinate is in the coordinate interval of the window control.
4. The method of claim 3, wherein the calculating, for each pre-stored coordinate interval of the window control, whether the current coordinate is within the coordinate interval of the pre-stored window control with a coordinate point in either direction as a reference point comprises:
and aiming at the coordinate interval of each pre-stored window control, calculating whether the abscissa of the current coordinate point is positioned between the abscissa of the upper left coordinate point and the abscissa of the upper right coordinate point by taking the upper left coordinate point as a reference point, and calculating whether the ordinate of the current coordinate point is positioned between the ordinate of the upper left coordinate point and the ordinate of the lower left coordinate point.
5. The method of any of claims 1 to 4, further comprising:
and obtaining the coordinate intervals of the window controls corresponding to all the reordered icons on the interface, and updating the interface.
6. An apparatus for ordering icons, the apparatus comprising:
the monitoring module is used for monitoring a new thread generated when a dragging event occurs, and acquiring the current coordinates of a mouse after the dragging event occurs, wherein the dragging event refers to the operation of dragging a first icon on an interface drawn based on a Pyqt technology stack by using the mouse, the interface drawn based on the Pyqt technology stack comprises a plurality of icons, and window controls are preset in the icons;
the comparison module is used for comparing the current coordinate with a coordinate interval of a pre-stored window control;
and the sorting module is used for taking the position of a second icon corresponding to the coordinate interval of the window control as the new position of the first icon and re-sorting all the icons on the interface if the current coordinate is in the coordinate interval of any window control.
7. The apparatus of claim 6, further comprising:
the initialization module is used for generating an interface which is arranged in grids, one type of module is arranged in each grid, the module corresponds to one icon, a window control is inserted into each module when the interface is rendered, the coordinate interval of the window control is recorded, and the icon corresponding to the module is displayed on the interface after the rendering is finished.
8. The apparatus of claim 6, wherein the comparison module comprises:
the system comprises an acquisition unit, a display unit and a control unit, wherein the acquisition unit is used for acquiring a pre-stored coordinate interval of a window control, and the coordinate interval is composed of coordinate points in four directions of an upper left coordinate point, an upper right coordinate point, a lower left coordinate point and a lower right coordinate point of the window control;
and the calculating unit is used for calculating whether the abscissa and the ordinate of the current coordinate are in the coordinate interval of the pre-stored window control by taking a coordinate point in any direction as a reference point in the coordinate interval of each pre-stored window control, and determining that the current coordinate is in the coordinate interval of the window control if the abscissa and the ordinate of the current coordinate are both in the coordinate interval of the pre-stored window control.
9. The apparatus according to claim 8, wherein the calculating unit is configured to calculate whether the abscissa and the ordinate of the current coordinate are within a coordinate interval of the pre-stored window controls, and specifically, for each pre-stored coordinate interval of the window controls, with an upper left coordinate point as a reference point, calculate whether the abscissa of the current coordinate point is located between the abscissa of the upper left coordinate point and the abscissa of the upper right coordinate point, and calculate whether the ordinate of the current coordinate point is located between the ordinate of the upper left coordinate point and the ordinate of the lower left coordinate point.
10. The apparatus of any one of claims 6 to 9, further comprising:
and the updating module is used for acquiring the coordinate intervals of the window controls corresponding to the reordered icons on the interface and updating the interface.
CN201911266551.1A 2019-12-11 2019-12-11 Icon sorting method and device Pending CN112947805A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911266551.1A CN112947805A (en) 2019-12-11 2019-12-11 Icon sorting method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911266551.1A CN112947805A (en) 2019-12-11 2019-12-11 Icon sorting method and device

Publications (1)

Publication Number Publication Date
CN112947805A true CN112947805A (en) 2021-06-11

Family

ID=76226438

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911266551.1A Pending CN112947805A (en) 2019-12-11 2019-12-11 Icon sorting method and device

Country Status (1)

Country Link
CN (1) CN112947805A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114528807A (en) * 2022-01-26 2022-05-24 北京飞书科技有限公司 Information processing method, device, terminal and storage medium
CN115657920A (en) * 2022-10-17 2023-01-31 中科世通亨奇(北京)科技有限公司 Control method and device for dragging type personalized self-set workbench assembly

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090113330A1 (en) * 2007-10-30 2009-04-30 John Michael Garrison Method For Predictive Drag and Drop Operation To Improve Accessibility
CN103488379A (en) * 2013-09-16 2014-01-01 北京奇虎科技有限公司 Desktop element adjusting method and desktop element adjusting device for intelligent terminal
CN106354366A (en) * 2016-08-26 2017-01-25 乐视控股(北京)有限公司 Method for treating desktop icons arrangement and device thereof

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090113330A1 (en) * 2007-10-30 2009-04-30 John Michael Garrison Method For Predictive Drag and Drop Operation To Improve Accessibility
CN103488379A (en) * 2013-09-16 2014-01-01 北京奇虎科技有限公司 Desktop element adjusting method and desktop element adjusting device for intelligent terminal
CN106354366A (en) * 2016-08-26 2017-01-25 乐视控股(北京)有限公司 Method for treating desktop icons arrangement and device thereof

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114528807A (en) * 2022-01-26 2022-05-24 北京飞书科技有限公司 Information processing method, device, terminal and storage medium
CN115657920A (en) * 2022-10-17 2023-01-31 中科世通亨奇(北京)科技有限公司 Control method and device for dragging type personalized self-set workbench assembly

Similar Documents

Publication Publication Date Title
US9542070B2 (en) Method and apparatus for providing an interactive user interface
CN104898952B (en) A kind of terminal split screen implementation method and terminal
CN102970343B (en) Method and device for displaying push information
CN108196759B (en) Icon control method and terminal
US20170075524A1 (en) Method And Apparatus Of Switching Interfaces
US10324613B2 (en) Method and electronic device for moving icon to page
CN107977141B (en) Interaction control method and device, electronic equipment and storage medium
US20140359478A1 (en) Systems and Methods for Sharing a User Interface Element Based on User Gestures
EP2649795A1 (en) Annotation method and system for conferencing
CN104035683A (en) Split-screen multitask interaction method for communication terminal
CN112073301B (en) Method, device and computer readable medium for deleting chat group members
CN105094841A (en) Page commenting method and device
CN109298909A (en) A kind of method, mobile terminal and computer readable storage medium that window is adjusted
CN112947805A (en) Icon sorting method and device
CN105843467A (en) Icon displaying method and device
CN112783394A (en) List page display method and device
CN109189301A (en) A kind of method and device of screenshot capture
CN107391914B (en) Parameter display method, device and equipment
CN106648281B (en) Screenshot method and device
CN104102367B (en) A kind of information processing method and device
WO2017113713A1 (en) Method and device for adjusting display interface
CN108121581B (en) User interface for self-learning
CN108089902B (en) The detection method of split screen display available state calculates equipment and computer storage medium
CN109388737B (en) Method and device for sending exposure data of content item and storage medium
CN104793848B (en) Information processing method and electronic equipment

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
WD01 Invention patent application deemed withdrawn after publication
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20210611