Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "widget.h"
- #include "ui_widget.h"
- #include <QPixmap>
- #include <QPainter>
- Widget::Widget(QWidget *parent) :
- QWidget(parent),
- ui(new Ui::Widget)
- {
- ui->setupUi(this);
- buffer = new QPixmap(100,100);
- }
- Widget::~Widget()
- {
- delete ui;
- }
- void Widget::updateImage() {
- QPainter p(buffer);
- p.fillRect(QRectF(0,0,buffer->width(),buffer->height()), QBrush(Qt::black));
- p.fillRect(QRectF(10.0, 20.0, 80.0, 60.0), QBrush(Qt::green));
- ui->screenLabel->setPixmap(*buffer);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement