As I understand it:
QPainter: paints on a QPixmap.
QPixmap: a surface. Displayed by a QLabel. Can be converted into a QImage, where I can do some stuff which I haven't read about yet.
QLabel: used to display a QPixmap.

So I have a button that makes an ellipse with certain parameters. I click it, nothing happens. I resize the window around the areas where it's supposed to be drawn, or minimize and restore the window, and voila there it is:
cochlear4.PNG
The white one is the one added by the button, the red ones were drawn inside the constructor of the class that defines the window (I think the parent of this particular tab would be QWidget _guiTab, you'll see that later on maybe).

But I want it to update automatically. I have no idea how to do that (I don't want to make it poll or anything like that), so in lieu of an automatic solution I created an update button. Problem is, only QWidget has an update() function. I would've expected QPixmap, or QLabel to have this function (I don't know if QPixmap has already recognized that the QPainter has already drawn on it, or if QLabel simply hasn't refreshed QPixmap). And it seems it's not really a slot, so I have to make my own wrapper function inside this class that calls _guiTab->update(). It STILL doesn't work. Here's the affected code:

header file:
Qt Code:
  1. QLineEdit* _nameInput;
  2.  
  3. QComboBox* _frequencyBox;
  4. QPixmap *pixmap;
  5. QLabel *pixmaplabel;
  6. QPainter *drawstuff;
  7. QPushButton* _startStopButton;
  8. QPushButton *ellipse;
  9. QPushButton *updateButton;
  10. QPointArray splineone;
  11. QString* _subjectName;
To copy to clipboard, switch view to plain text mode 

This is all in the constructor:
Qt Code:
  1. QFrame *testFrame = new QFrame(_guiTab);
  2. testFrame->setGeometry(350,20,650,620);
  3. testFrame->setFrameShadow(QFrame::Sunken);
  4. testFrame->setFrameShape(QFrame::Panel);
  5.  
  6. ellipse = new QPushButton("&Ellipse", modeFrame);
  7. ellipse->setGeometry(10,160,100,40);
  8. connect(ellipse,SIGNAL(clicked()),this,SLOT(doimplantscomeinellipses()));
  9.  
  10. updateButton = new QPushButton("&Update", modeFrame);
  11. updateButton->setGeometry(50,260,200,40);
  12. connect(updateButton,SIGNAL(clicked()),this,SLOT(updatewrapper()));
  13.  
  14. pixmaplabel = new QLabel(testFrame);
  15. pixmap = new QPixmap(650,600);
  16. pixmaplabel->setPixmap(*pixmap);
  17. pixmaplabel->setAutoResize(TRUE);
  18. drawstuff = new QPainter(pixmap);
  19. QPointArray splineone(4);
  20. splineone[0]=QPoint(50,50);
  21. splineone[1]=QPoint(150,0);
  22. splineone[2]=QPoint(150,150);
  23. splineone[3]=QPoint(400,200);
  24. drawstuff->setPen(Qt::red);
  25. drawstuff->drawRect(10,10,200,100);
  26. drawstuff->drawCubicBezier(splineone);
  27. drawstuff->drawRoundRect(200,180,400,320);
  28. _nameInput = new QLineEdit(modeFrame);
  29. _nameInput->setGeometry(10,50,280,45);
  30. connect(_nameInput,SIGNAL(textChanged ( const QString & )),this,SLOT(nameInputChanged( const QString & )));
To copy to clipboard, switch view to plain text mode 

and somewhere below that:
Qt Code:
  1. void CochlearImplantExperiment_amt::doimplantscomeinellipses()
  2. {
  3. drawstuff->setPen(Qt::white);
  4. drawstuff->drawEllipse(100,100,400,150);
  5. }
  6. void CochlearImplantExperiment_amt::updatewrapper()
  7. {
  8. _guiTab->update();
  9. cout << "wtf";
  10. }
To copy to clipboard, switch view to plain text mode 


I'm not even sure that this combination of classes is the right thing to use. Previously I used QPainter drawing on a QCanvas, coupled with QCanvasView, but I found that there was no low level access to the points on a curve drawn on the QCanvas. You see, what I want to do is to make a curve/shape, and program a controller that guides a human to trace such a curve using vibrotactile signals. This curve is defined in the program because drawing with a mouse sucks, and besides the shapes that the user will be asked to trace IRL will be predefined shapes anyway. So I was thinking about converting QPixmap into a QImage later, and then operating on pixels of a specific colour in that QImage to make the controller find the path it's supposed to guide the user along. Is that possible with QImage/QPixmap or am I wasting my time?