
Originally Posted by
vcp
Hi thanks for your answer, but the problem is that the image is shown side by side (tiled)
Ah, sorry, have read to fast. So you have to subclass:
#ifndef MYQMIDIAREA_H
#define MYQMIDIAREA_H
#include <QtGui>
class myQMdiArea : public QMdiArea
{
Q_OBJECT
public:
protected:
};
#endif // MYQMIDIAREA_H
#ifndef MYQMIDIAREA_H
#define MYQMIDIAREA_H
#include <QtGui>
class myQMdiArea : public QMdiArea
{
Q_OBJECT
public:
myQMdiArea(QWidget *parent = 0);
protected:
void paintEvent(QPaintEvent *);
};
#endif // MYQMIDIAREA_H
To copy to clipboard, switch view to plain text mode
#include "myqmdiarea.h"
myQMdiArea
::myQMdiArea(QWidget *parent
) : QMdiArea(parent)
{}
{
painter.
fillRect(paintEvent
->rect
(),
QColor(23,
200,
123));
QImage img
("/home/lykurg/Desktop/icons/oxygen/16x16/apps/gimp.png");
painter.
drawImage(QPointF(10,
10),img
);
}
#include "myqmdiarea.h"
myQMdiArea::myQMdiArea(QWidget *parent)
: QMdiArea(parent)
{}
void myQMdiArea::paintEvent(QPaintEvent *paintEvent)
{
QPainter painter(viewport());
painter.fillRect(paintEvent->rect(), QColor(23,200,123));
QImage img("/home/lykurg/Desktop/icons/oxygen/16x16/apps/gimp.png");
painter.drawImage(QPointF(10,10),img);
}
To copy to clipboard, switch view to plain text mode
Note: the paintEvent is not very nice, only an example!
Bookmarks