I'm not sure I understand what you really intend to do and where the problem is. Is this what you are looking for?
#include <QApplication>
#include <QtGui>
int main(int argc, char *argv[])
{
pictureLabel->setPixmap(drawStuff());
mainLayout->addWidget(pictureLabel);
window.show();
return application.exec();
}
{
p.setPen(pen);
p.drawPoint(20,20);
return pm;
}
#include <QApplication>
#include <QtGui>
QPixmap drawStuff();
int main(int argc, char *argv[])
{
QApplication application(argc, argv);
QWidget window;
QVBoxLayout* mainLayout = new QVBoxLayout(&window);
QLabel* pictureLabel = new QLabel;
pictureLabel->setPixmap(drawStuff());
mainLayout->addWidget(pictureLabel);
window.show();
return application.exec();
}
QPixmap drawStuff()
{
QPixmap pm(100,100);
QPainter p(&pm);
QPen pen(Qt::white, 10);
p.setPen(pen);
p.drawPoint(20,20);
return pm;
}
To copy to clipboard, switch view to plain text mode
Bookmarks