Hi everybody,
I'm just a new to qt!

I'm going to implement a project, that I need to draw an unknown number of images on screen.
I tried 3 methods, but none of them worked.

1.
I tested QLabel for drawing a picture by the use of "pixmap".
As I said I need to paint an unknown number of images.[n*m, e.g. 2 or 6,...]

I tried like this... with the thought that this will add several(here 2) labels(pix) to my MainWindow:

Qt Code:
  1. QPixmap *pixmap_and = new QPixmap("../pix/AND.png");
  2. QLabel *label_1 = new QLabel(this);
  3. label_1->setPixmap(*pixmap_and);
  4. label_1->adjustSize();
  5. label_1->move(100,100);
  6.  
  7. QLayout *layout_1 = this->layout();
  8. layout_1->addWidget( label_1 );
  9. label_1->move(200,200);
  10. layout_1->addWidget( label_1 );
  11.  
  12. this->setLayout(layout_1);
To copy to clipboard, switch view to plain text mode 

I doesn't work!
I found that for drawing several images using QLabels I need to create several number of QLabels.
I tried to use a "vector" of "QLable". Unfortunately I couldn't do it because of several syntax problems.
would you guide me how can I implement that? (If it is possible!)

2.
I also tried QImage and QPainter.
I implemented a code like this :

Qt Code:
  1. QImage image("../pix/AND.png");
  2. if (!image.isNull())
  3. ui->label->setText("Image Loaded! ");
  4. QPainter qpainter(this);
  5. qpainter.drawImage(100,100,image);
  6.  
  7. image.load(":/pix/AND.png");
  8. qpainter.drawImage(100,100,image);
To copy to clipboard, switch view to plain text mode 


As you see I used both pix in my hard and Qt resources. The image is sucsessfuly loaded. But I dont see anything
on screen. Is there any problem in my code?


3. I also tried this:
Qt Code:
  1. QPixmap pixmap_tmp;
  2. pixmap_tmp.load("../pix/AND.png");
  3. qpainter.drawPixmap(200,200,50,50,pixmap_tmp);
  4.  
  5. pixmap_tmp.load(":/pix/AND.png");
  6. qpainter.drawPixmap(200,200,50,50,pixmap_tmp);
To copy to clipboard, switch view to plain text mode 

again I didn't see anything on screen. ?!


Thanks in advance for further helps,