Problem description
In the process of using QT’s graphicsview framework to create and interact with user-defined items, you need to remove unnecessary user-defined items. However, after the user-defined items interact with the re implemented rotation and scaling, removeitem () + delete will occasionally cause the error of accessing illegal memory, and even if you only use removeitem (), there will occasionally be residual items in the view.
Solutions
Using setitemindex method of qgraphicsscene (qgraphicsscene:: Noindex);
to disable quick query of index can solve the above problem.
other
For the problem of whether to delete after using removeitem(), the official question has given a clear explanation
The ownership of item is passed on to the caller (i.e., qgraphics scene will no longer delete item when destroyed).
remove the item and all its children from the scene. Ownership of the item is passed to the caller (that is, qgraphicsscene will not delete the item when it is destroyed).
So remember to delete
Read More:
- WSL start QT error qt.qpa.xcb : could not connect to display :0.0
- On the problem of QT program open crash
- QT interface refresh crash, exception
- QT encountered in CentOS installation( qt.qpa.plugin : Could not load the Qt platform plugin “xcb” )
- Could not find method causes verifyerror, which in turn causes crash
- Docker delete error response from daemon: Conflict: unable to delete xxxxx solution
- Abnormal crash of APP startup — pointer being free was not allocated * * set a breakpoint in malloc_ error_ break to debug
- [Solved] Es delete all the data in the index without deleting the index structure, including curl deletion
- QT learning 3: configuration and testing of QT creator 2.4.1 development environment
- Win10 desktop right click display settings MS- settings:display Or Ms- settings:personalization-background resolvent
- Summary of problems encountered in using OpenGL in QT
- Delete files with specified suffix in specified folder under Linux
- Matlab delete row or col to delete the row or column of the matrix
- The solution of PDF file unable to display thumbnail in win7
- Endnote inserting documents causes word to crash! ! Solution
- The use of Chinese characters in Qt and the solution to the “error C2001: newline in constant” problem
- How to open Ctrl + Alt + delete in MAC virtual machine
- [Solved] vivado Install Error: Xilinx Design Tool Display in Red
- Error: undefined reference to ‘CV:: xxx’ encountered in using OpenCV in QT
- Linux_ day07_ 05_ Configure common add, delete, modify and query commands in network