The QT debugging problems to be solved in this article are as follows:
cause : Add a two-dimensional array of type Qcolor to the code to store each pixel of the picture.
Symptom : The error shown appears when debugging.
reason : After Baidu and repeatedly review the code, found in the code, there is an array out of bounds of the situation. Because the two dimensions of the array are not the same when defined, the actual
now qwidget the redraw event, because of the differences in the coordinate system, the two dimensions in order to make the array out of bounds.
In detail : The array I defined in the program is Qcolor color [height] [Width], and I meant height to represent the height of the image, and the initial value of height is 400;width
Represents the height of the picture, and the initial value of width is 600.
In the PaintEvent event of QT, however, in the Qpainter drawpoint (int x,int y) function, x represents the horizontal axis of the image, corresponding to the width of the array;
Y indicates the ordinate of the picture, corresponding to the height of the array.
Because the correspondence between the coordinate system and the array dimension is not realized at first, the corresponding error results in the cross-border.
If in doubt, please leave a message! If there is a problem, please correct me!
"Unhandled exception in App.exe (QtGuid4.dll): 0xc0000005:access violation" error resolution