简体   繁体   中英

View Array contents in QtCreator

Is it possible to view the contents of an array in Qt Creator when debugging?

It seems to detect that my array is an array and not a pointer. Additionally, an arrow becomes available for me to click on as if to expand - but nothing shows after that.

在此处输入图片说明

When I tried it on std::vector , Qt Creator managed to display the contents as expected.

PS: I found this old post about viewing array contents, but its over 2 years old and does not seem relevant anymore.

If you mean a regular array like

int array[20] 

you can add a 'watch' manualy in this form:

(int[20])array

You can add it in your variables view.

you can veiw the content of array by going to local and expression part

在此处输入图片说明

and click right and sellect add new expression evaluator then add your array between watcher like

(int(*)[10])arr;

or

(int[10])(*arr);

now you can see each element at your array

在此处输入图片说明

this is faster than entering each element manual by adding *(arr + element number) at add new expression evaluator this is too bad if you have array of 1000 element or more

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM