Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 29th, 2012  |  syntax: None  |  size: 0.39 KB  |  hits: 16  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Issues with qDebug and QString const reference
  2. FileInfoWrapper(const QFileInfo &_fileInfo) : fileInfo(_fileInfo) {}
  3.  
  4. const QString& FileName() const { return fileInfo.fileName(); }
  5.        
  6. QFileInfo info(somePath);
  7.  
  8. qDebug() << info.absoluteDir(); // works
  9.  
  10. FileInfoWrapper test(info);
  11.  
  12. qDebug() << test.FileName(); // this crashes the entire application
  13.        
  14. std::cout << test.FileName().toStdString();