Hi all,

Im am working on a program and have problems with handling a QByteArray string.
When I try to convert that QByteArray string to a QString with
Qt Code:
  1. QString newQString = QString(&oldQBytearrayString);
To copy to clipboard, switch view to plain text mode 
I do get the following error:

Qt Code:
  1. error: conversion from ‘QByteArray*’ to ‘QChar’ is ambiguous
  2. /usr/include/QtCore/qchar.h:372:8: note: candidates are: QChar::QChar(int) <near match>
  3. /usr/include/QtCore/qchar.h:371:8: note: QChar::QChar(uint) <near match>
  4. /usr/include/QtCore/qchar.h:370:8: note: QChar::QChar(short int) <near match>
  5. /usr/include/QtCore/qchar.h:81:12: note: QChar::QChar(ushort) <near match>
  6. /usr/include/QtCore/qchar.h:77:36: note: QChar::QChar(uchar) <near match>
  7. /usr/include/QtCore/qchar.h:76:36: note: QChar::QChar(char) <near match>
To copy to clipboard, switch view to plain text mode 

The newQString is the output of a script of me and should be a plain text string.

What is going wrong here?


Code Snippet:

myclass.cpp
Qt Code:
  1. void myclass::Thefunction(){
  2.  
  3. // QProcess *scriptcall; pointer declared as a public member in the class header file
  4. scriptcall = new QProcess(this);
  5. scriptcall -> start("./myscript");
  6.  
  7. connect(scriptcall, SIGNAL(readyReadStandardOutput()), this, SLOT(Readoutput()));
  8.  
  9. }
  10.  
  11. void myclass::Readoutput(){
  12.  
  13. QByteArray oldQByteArrayString;
  14. oldQByteArrayString = scriptcall -> readAllStandardOutput();
  15. QString newQString = QString(&oldQByteArrayString); //this line causes the error
  16.  
  17. }
To copy to clipboard, switch view to plain text mode 

Additional Information: I can use oldQByteArrayString with a function that requires QSTtring as a parameter without a problem. (QComboBox::addItem( const QString)). When I look at the hex code of oldQByteArray, it contains exactly what I want to be there - 4 ascii code letters, no special chars.