There are a three ways to do this. All require that you link your program with a debug version of QT.
  • Assuming the default encodings and locale on a QString, you can view the string by diving on q (double left click or middle click) then dive on the data member "d", you should see a data member named unicode. After diving on that member, cast its datatype to $wstring_u16; that is, change the Type field to contain $wstring_u16).
  • You can tell TotalView that when you dive on a QString, it should always display it as a C/C++ string. Do this by using the TotalView Type Transformation Facility (TTF). The TTF allows you to write transformations for your data types. (We provide transformations for common STL containers). Edit or create a $HOME/.tvdrc file and enter the following code: ::TV::TTF::RTF::build_struct_transform {
    name {^(class|struct) QString$}
    members {
    { ascii { $wstring_u16 cast { * { d -> unicode } } } }
    }
    }

    After you restart the debugger, TotalView will display the QString so that it has one member (named ascii) containing your transformed QString.
  • TotalView allows you to call member functions. This means that you can call the ascii method on your QString. Do by selecting the Tools > Evaluate and typing the obj.ascii() expression where obj is the object you want to call the method on. In the previous example this would be q).