Hi I have a ?
I do like this in the *.h file
typedef struct{
int id;
} image;
QList<image> list;
typedef struct{
QRect dataRect;
QString imgName;
int id;
} image;
QList<image> list;
To copy to clipboard, switch view to plain text mode
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);
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);
To copy to clipboard, switch view to plain text mode
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;
}
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;
}
To copy to clipboard, switch view to plain text mode
Bookmarks