moatilliatta
8th September 2010, 15:04
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.
picData(int i) {
std::ostringstream s;
s << i;
greyscale = new QLabel();
greyscale->setPixmap(QPixmap("images/0"+s.str+"_greyscale.png"));
};
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
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.
picData(int i) {
std::ostringstream s;
s << i;
greyscale = new QLabel();
greyscale->setPixmap(QPixmap("images/0"+s.str+"_greyscale.png"));
};
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