Hello everyone,

i'm trying to add a variable to my QPixmap-Path. I thought it just works as a String but apparently it doesn't. Here is what i've written so far.

Qt Code:
  1. picData(int i) {
  2. std::ostringstream s;
  3. s << i;
  4. greyscale = new QLabel();
  5. greyscale->setPixmap(QPixmap("images/0"+s.str+"_greyscale.png"));
  6. };
To copy to clipboard, switch view to plain text mode 

The "s.str" is an integer that stands for different groups of pictures. In the folder are different .png files from e.g. 1 to 9. I don't want to write everything except for the one number over and over again. Is there another way?

Thank you in advance.
Moat