Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to display whole QString while debugging

I am using Qtcreator and always when I need to display large string, it's trimmed, see screenshot: enter image description here

Is there any way to display whole QString? Note that using Open view contents in editor doesn't help either, it's same there.

like image 708
Petr Avatar asked Dec 09 '14 09:12

Petr


People also ask

How to debug a line in Qt Creator?

In Qt Creator, you can use the left pane of the Debugger Log view for that purpose. When you press Ctrl+Enter, the contents of the line under the text cursor are sent directly to the native debugger. Alternatively, you can use the line edit at the bottom of the view. Output is displayed in the right pane of the Debugger Log view.

How do I open the string Visualizer during debugging?

To open the string visualizer, you must be paused during debugging. Hover over a variable that has a plain text, XML, HTML, or JSON string value, and select the magnifying glass icon . In the string visualizer window, the Expression field shows the variable or expression you're hovering over, and the Value field shows the string value.

How do I debug a qfileinfo file?

Also, the debugger displays access data for QFileInfo and provides access to the real contents of QVariant. Right-click in the Locals or the Expressions view to open a context menu that provides additional options for viewing data. The available options depend on the type of the current items, and are provided by the Debugging Helpers.

How do you tell the debugger what to show?

Tell the debugger what to show using the DebuggerDisplay Attribute (C#, Visual Basic, F#, C++/CLI) The DebuggerDisplayAttribute controls how an object, property, or field is displayed in the debugger variable windows. This attribute can be applied to types, delegates, properties, fields, and assemblies.


3 Answers

There is a setting under "Tools -> Options -> Debugger -> (Locals & Expressions or General (depending on your creator version))" that limits the string length to default 10000 characters.

like image 81
user3779331 Avatar answered Oct 14 '22 22:10

user3779331


This is the best answer: https://stackoverflow.com/a/52298088/9256941

"In Local and Expressions, right click on the variable and click on Change Value Display Format, then under Change Display for type QString click on Separate Window"

like image 33
Sergey Lobanov Avatar answered Oct 14 '22 23:10

Sergey Lobanov


Seems to be a limitation of the Qt Creator UI that cuts the displayed length of strings.

qDebug() << yourString; seems to work for me, I can see my whole string in the application output panel :-)

like image 43
RDK Avatar answered Oct 15 '22 00:10

RDK