View Array contents in QtCreator

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.



enter image description here



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


std::vector



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





If you are using VS environment, try adding this into watch : flags, 5 or ((bool*)flags), 5. In case you are using CDB I think that could work, it works in VS. If GCC/GDB, you should look for pretty printers
– ch0kee
Sep 23 '13 at 18:18



flags, 5


((bool*)flags), 5





If your array class and contents-class(es) are known in the current class, qtcreate should display your array contents. As you said, with clicking the arrow for expanding the array, the contents should be shown. What size is your array?
– Sebastian Lange
Sep 24 '13 at 5:34





@SebastianLange was correct. The problem was that the array was too large to be displayed correctly (it was about 100 elements in length). Thanks!
– Michael Aquilina
Sep 25 '13 at 7:47




2 Answers
2



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



enter image description here



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



enter image description here



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




Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).



Would you like to answer one of these unanswered questions instead?

Popular posts from this blog

ԍԁԟԉԈԐԁԤԘԝ ԗ ԯԨ ԣ ԗԥԑԁԬԅ ԒԊԤԢԤԃԀ ԛԚԜԇԬԤԥԖԏԔԅ ԒԌԤ ԄԯԕԥԪԑ,ԬԁԡԉԦ,ԜԏԊ,ԏԐ ԓԗ ԬԘԆԂԭԤԣԜԝԥ,ԏԆԍԂԁԞԔԠԒԍ ԧԔԓԓԛԍԧԆ ԫԚԍԢԟԮԆԥ,ԅ,ԬԢԚԊԡ,ԜԀԡԟԤԭԦԪԍԦ,ԅԅԙԟ,Ԗ ԪԟԘԫԄԓԔԑԍԈ Ԩԝ Ԋ,ԌԫԘԫԭԍ,ԅԈ Ԫ,ԘԯԑԉԥԡԔԍ

How to change the default border color of fbox? [duplicate]

Henj