Hi all,

I have a program in which two widgets are connected together. One widget displays an image and upon a mouse event (press) it passes the co-ordinates (in the form of a QPoint) to the other widget. My hope is that this Widget then displays a cropped version of the other image.

I have so far been unsuccessful in this. My main problem is updating the cropped-image display widget. Currently it shows nothing (the signals and slots are working by the way).

Here is the code

Qt Code:
  1. MyWidgetOne::MyWidgetOne(QWidget* parent): QWidget(parent)
  2. {
  3. int x, y;
  4.  
  5. coordOne = new QPoint;
  6.  
  7. drawLabel = new QLabel;
  8. QPixmap dl;
  9. dl.load("resources/image_ori.bmp");
  10. dl = dl.copy(x-25, y-25, 50, 50);
  11. dl.save("resources/image.bmp");
  12. drawLabel->setPixmap(dl);
  13.  
  14.  
  15. QVBoxLayout* mainLayout = new QVBoxLayout;
  16. mainLayout->addWidget(drawLabel);
  17.  
  18. setLayout(mainLayout);
  19. setWindowTitle(tr("Receiver"));
  20. }
  21.  
  22. void MyWidgetOne::showCoords(QPoint xy)
  23. {
  24. int i, j;
  25. coordOne = &xy;
  26. i = (coordOne->x());
  27. j = coordOne->y();
  28. x = i;
  29. y = j;
  30. update();
  31. //repaint();
  32. }
To copy to clipboard, switch view to plain text mode 

So as you can see I use x and y to define the corner of the area to be displayed (with a 50 height and width). When I receive the QPoint, I update this values via i and j).

I thought putting update() or repaint() would work but they have so far been of no use. Any help would be appreciated.