mcrahr
23rd August 2009, 08:42
Hi I have a ?
I do like this in the *.h file
typedef struct{
QRect dataRect;
QString imgName;
int id;
} image;
QList<image> list;
this in the cpp file.
image myImage;
myImage.dataRect=this->rect();
myImage.id=0;
myImage.imgName="b.png";
list.append(myImage);
myImage.dataRect=QRect(10,400,167,64);
myImage.id=1;
myImage.imgName="b2.png";
list.append(myImage);
myImage.dataRect=QRect(185,400,167,64);
myImage.id=2;
myImage.imgName="b3.png";
list.append(myImage);
Now I would like to change the image name.
but it does not change in the list why ?
image myImage=list.at(a);
if (myImage.dataRect.contains(e->pos()))
{
id=a;
switch (a)
{
case 0: break;
case 1: break;
case 2: myImage.imgName="b10.png";break;
case 3: myImage.imgName="b12.png";break;
}
I do like this in the *.h file
typedef struct{
QRect dataRect;
QString imgName;
int id;
} image;
QList<image> list;
this in the cpp file.
image myImage;
myImage.dataRect=this->rect();
myImage.id=0;
myImage.imgName="b.png";
list.append(myImage);
myImage.dataRect=QRect(10,400,167,64);
myImage.id=1;
myImage.imgName="b2.png";
list.append(myImage);
myImage.dataRect=QRect(185,400,167,64);
myImage.id=2;
myImage.imgName="b3.png";
list.append(myImage);
Now I would like to change the image name.
but it does not change in the list why ?
image myImage=list.at(a);
if (myImage.dataRect.contains(e->pos()))
{
id=a;
switch (a)
{
case 0: break;
case 1: break;
case 2: myImage.imgName="b10.png";break;
case 3: myImage.imgName="b12.png";break;
}