EDN Admin
Well-known member
can you convert it something so i can convert that to vb
<span style="font-size:small
<span style="font-size:small <span style="font-size:small
<pre class="prettyprint #include "interface/canvas.h"
#include <QPainter>
#include <QMouseEvent>
#include <QTabletEvent>
#include <QRadialGradient>
#include <QPointF>
#include <QDebug>
#include <QRect>
#include <QPixmap>
#include <QImageReader>
#include "base/mathutil.h"
#include "graphics/common/dirtydevice.h"
#include "graphics/common/strokesamples.h"
#include "graphics/test/strokesamplestest.h"
#include "graphics/bitmap/bitmapimage.h"
#include "interface/canvasenv.h"
#include "structure/composition.h"
#include "tool/tool.h"
#include "tool/standard/emptytool.h"
#include "tool/standard/eraser.h"
#include "tool/standard/paintbrush.h"
#include "tool/standard/zoom.h"
#include "tool/standard/pan.h"
using namespace tool;
using namespace canvas;
//=====================================================
// Normal public functions
Canvas::Canvas(QWeakPointer<structure::Composition> _composition, QWidget *_parent)
:
composition(_composition),
QWidget(_parent), strokeBusy(false), tabletInputBusy(false),
mousePressure(1.0f), mouseTwist(0.0f), mouseTilt(0.0f),
currentTool(), emptyTool(new tool::EmptyTool()), paintBrush(new PaintBrush()), eraser(new Eraser())
{
this->setFocusPolicy(Qt::StrongFocus);
this->zoomTool = QSharedPointer<Tool>(new Zoom());
this->panTool = QSharedPointer<Tool>(new Pan());
this->setCursor(Qt::BlankCursor);
this->setMouseTracking(true);
this->resizeComposition(QSize(1024,768));
// Temporary:
this->image = QSharedPointer<BitmapImage>(new BitmapImage(0x0, QRect(0,0,1024,768), Qt::transparent));
this->toolEnv = QSharedPointer<canvas::CanvasEnv>(new canvas::CanvasEnv());
this->toolEnv->getCanvasPaint()->setCanvasEnv(this->toolEnv.toWeakRef());
this->toolEnv->getCamera().setPosition(QPointF(image->width() / 2, image->height() / 2));
}
void Canvas::setCurrentTool(QSharedPointer<tool::Tool> newTool) {
if(!newTool) {
this->currentTool = this->emptyTool;
}
else if (this->toolEnv->getCurrentLayer()) {
// Only activate when there is a current layer.
this->currentTool = newTool;
this->currentTool->activate(this->toolEnv, this->toolEnv->getCurrentLayer()->getType());
} else {
qDebug() << "Canvas, setCurrentTool, error: no current layer is set";
}
repaintAll();
}
//====================================================
// Slots
void Canvas::layerChanged(int layerNr) {
QSharedPointer<structure::Composition> comp = this->composition.toStrongRef();
if(comp) {
this->toolEnv->setCurrentLayer(comp->getLayer(layerNr));
this->repaintAll();
}
}
void Canvas::frameChanged(int frameNr) {
this->toolEnv->setCurrentFrameNr(frameNr);
this->repaintAll();
}
void Canvas::keyAdded(int frameNr) {
this->repaintAll();
}
void Canvas::colorChanged(const QColor &color) {
this->toolEnv->getCanvasGraphics()->setForegroundColor(color);
}
//====================================================
// Handling pointer or keyboard input
void Canvas::tabletEvent(QTabletEvent *event) {
event->accept();
// Get high resolution coordinates relative to this widget.
QPointF point(
event->x() + (event->hiResGlobalX() - event->globalX()),
event->y() + (event->hiResGlobalY() - event->globalY())
);
this->tabletInputBusy = true;
this->pointerEvent(point, event->pressure());
this->toolEnv->setPointerPos(point);
}
void Canvas::mousePressEvent(QMouseEvent *event) {
event->accept();
this->tabletInputBusy = false;
this->pointerEvent(event->posF(), mousePressure);
this->toolEnv->setPointerPos(event->posF());
}
void Canvas::mouseMoveEvent(QMouseEvent *event) {
//qDebug() << "Mouse move " << event->pos();
event->accept();
if(this->tabletInputBusy)
return;
if(this->strokeBusy)
this->pointerEvent(event->posF(), mousePressure);
else
this->pointerEvent(event->posF(), 0.0f);
this->toolEnv->setPointerPos(event->posF());
}
void Canvas::mouseReleaseEvent(QMouseEvent *event) {
event->accept();
this->pointerEvent(event->posF(), 0.0f);
this->toolEnv->setPointerPos(event->posF());
}
void Canvas::mouseDoubleClickEvent(QMouseEvent *event) {
event->accept();
this->toolEnv->setPointerPos(event->posF());
}
void Canvas::keyPressEvent(QKeyEvent *event) {
if(event->isAutoRepeat()) {
event->accept();
//qDebug() << "Key press (autorepeat): " << event->key();
return;
}
else {
qDebug() << "Key pressed: " << event->key();
}
if(event->key() == Qt::Key_Control) {
event->accept();
this->previousTool = currentTool;
this->currentTool = zoomTool;
setMessage("zooming");
setCurrentTool(currentTool);
}
else if (event->key() == Qt::Key_Space) {
event->accept();
this->previousTool = currentTool;
this->currentTool = panTool;
setMessage("panning");
setCurrentTool(currentTool);
}
else if (event->key() == Qt::Key_P) {
event->accept();
this->currentTool = this->paintBrush;
setMessage("painting");
setCurrentTool(this->currentTool);
}
else if (event->key() == Qt::Key_E) {
event->accept();
this->currentTool = this->eraser;
setMessage("erasing");
setCurrentTool(this->currentTool);
}
}
void Canvas::keyReleaseEvent(QKeyEvent *event) {
if(event->isAutoRepeat()) {
event->accept();
//qDebug() << "Key release (autorepeat): " << event->key();
return;
}
else {
qDebug() << "Key released: " << event->key();
}
if(event->key() == Qt::Key_Space || event->key() == Qt::Key_Control) {
if(this->previousTool) {
this->currentTool = previousTool;
this->previousTool = QSharedPointer<tool::Tool>();
setCurrentTool(currentTool);
}
}
event->accept();
}
//=====================================================
// Other events
void Canvas::resizeEvent(QResizeEvent *event) {
this->toolEnv->setWidgetGeometry(QRect(0,0,event->size().width(), event->size().height()));
this->resizeComposition(event->size());
repaintAll();
}
void Canvas::focusInEvent ( QFocusEvent * event ) {
event->accept();
qDebug() << "Got focus";
repaintAll();
}
void Canvas::focusOutEvent ( QFocusEvent * event ) {
event->accept();
qDebug() << "Lost focus";
}
void Canvas::enterEvent ( QEvent * event ) {
qDebug() << "Requesting focus";
this->setFocus(Qt::MouseFocusReason);
}
void Canvas::leaveEvent ( QEvent * event ) {
}
//=======================================================
// Output
void Canvas:aintEvent(QPaintEvent *event) {
//-----------------------------------------------
// We render the composition.
QPainter q(this);
q.setClipping(true);
q.setClipRect(event->rect());
q.drawImage(0,0,*(this->compositionTotal.data()));
}
//===========================================================
// Private methods
void Canvas::resizeComposition(const QSize &size) {
this->compositionTotal = QSharedPointer<QImage>(new QImage(size.width(), size.height(), QImage::Format_ARGB32_Premultiplied));
this->compositionLayer = QSharedPointer<QImage>(new QImage(size.width(), size.height(), QImage::Format_ARGB32_Premultiplied));
}
// TODO: add other information such as tilt, rotation, ...
void Canvas:ointerEvent(const QPointF &screenPoint, float pressure) {
// Reset paint environment
this->toolEnv->getCanvasPaint()->clearUpdateRectangles();
this->toolEnv->getCanvasPaint()->setUpdateCursor(false);
this->giveInputToTool(screenPoint, pressure);
this->toolRendering(screenPoint);
}
void Canvas::giveInputToTool(const QPointF &screenPoint, float pressure) {
// Only continue if there is a current tool ...
if(!currentTool)
return;
// We map the point into world space
QPointF passedPoint;
if(this->currentTool->pointsInScreenSpace())
passedPoint = screenPoint;
else
passedPoint = this->toolEnv->getCamera().screenToWorld(screenPoint);
if(this->strokeBusy) {
if(pressure < currentTool->getPressureActivationThreshold()) {
// Not enough pressure, ending stroke.
this->strokeBusy = false;
currentTool->endStroke(this->toolEnv);
}
else {
// Still enough pressure, keep updating stroke.
currentTool->updateStroke(this->toolEnv, passedPoint, pressure, 0.0f, 0.0f);
}
}
else {
if(pressure >= currentTool->getPressureActivationThreshold()) {
// Enough pressure -> activate tool.
this->strokeBusy = true;
currentTool->beginStroke(this->toolEnv);
currentTool->updateStroke(this->toolEnv, passedPoint, pressure, 0.0f, 0.0f);
}
else {
// If no stroke is being drawn, then the tool might
// still be interested in using the pointer movement.
currentTool->hover(this->toolEnv, passedPoint);
}
}
}
void Canvas::toolRendering(const QPointF &screenPoint) {
bool refreshCursor =
base::MathUtil::distance(screenPoint, this->prevCursorLoc) >= 1.0f ||
this->toolEnv->getCanvasPaint()->isUpdatingCursor();
QRegion updateRegion;
// Add all update rectangles
updateRegion.operator +=(this->toolEnv->getCanvasPaint()->getUpdateRegion());
// Optionally add the cursor refresh region
if(refreshCursor) {
updateRegion.operator +=(this->prevCursorRegion);
}
this->repaintBackground(updateRegion);
if(refreshCursor) {
// Repaint the cursor (track the dirty region). This repainting
// happens on top of the total composition, in order for special composition modes
// to have the expected effect.
graphics:irtyDevice dirtyDev(this->compositionTotal.data(), false);
QPainter pDirty(&dirtyDev);
pDirty.translate(screenPoint);
if(this->currentTool)
this->currentTool->paintCursor(this->toolEnv, pDirty);
pDirty.end();
this->prevCursorRegion = dirtyDev.getDirtyRegion();
// We need to extend the region we want to refresh on screen
updateRegion.operator+=(dirtyDev.getDirtyRegion());
}
this->prevCursorLoc = screenPoint;
// Repaint the canvas widget
update(updateRegion);
}
void Canvas::repaintBackground(const QRegion ®ion) {
// Repaint the background of the composition.
QPainter pLayer(this->compositionLayer.data()); // paint the layer
QPainter pTotal(this->compositionTotal.data()); // paint background
pLayer.setClipping(true);
pTotal.setClipping(true);
// If there is no current tool, then let the empty tool do the "drawing"
QSharedPointer<tool::Tool> tool;
if(this->currentTool)
tool = this->currentTool;
else
tool = this->emptyTool;
QVector<QRect> updateRects = region.rects();
for(QVector<QRect>::ConstIterator iter = updateRects.begin(); iter != updateRects.end(); ++iter) {
const QRect &rect = *iter;
// Also get the rectangle in world space (for the layer painting)
QRect rectWorld = this->toolEnv->getCamera().screenToWorld(rect);
if(!rect.isEmpty()) {
pLayer.save();
pTotal.save();
pLayer.setClipRect(rect);
pTotal.setClipRect(rect);
// First render the layer, with a possible overlay of the tool
pLayer.setCompositionMode(QPainter::CompositionMode_Clear);
pLayer.fillRect(rect, Qt::white);
if(this->toolEnv->getCurrentLayer()) {
pLayer.setCompositionMode(QPainter::CompositionMode_SourceOver);
pLayer.setTransform(this->toolEnv->getCamera().getWorldToScreenTransform());
this->toolEnv->getCurrentLayer()->paintFrame(this->toolEnv->getCurrentFrameNr(), pLayer, rectWorld);
tool->paintLayerOverlay(this->toolEnv, pLayer, rect);
}
// Render total, with a possible overlay of the tool
pTotal.fillRect(rect, Qt::white);
pTotal.drawImage(0,0,*(this->compositionLayer.data()));
tool->paintTotalOverlay(this->toolEnv, pTotal, rect);
//pTotal.drawRect(rect);
pTotal.restore();
pLayer.restore();
}
}
//pTotal.drawText(50,50,message);
// It is important that the QPainter is destroyed here (automatically ok),
// because otherwise we wont be able to paint the composition in the future.
}
void Canvas::setMessage(const QString &str) {
this->message = str;
// this->repaint(QRect(0,0,200,50));
}
void Canvas::repaintAll() {
repaintBackground(QRegion(this->geometry()));
update(this->geometry());
}
[/code]
<br/>
<br/><hr class="sig btickle1
View the full article
<span style="font-size:small
<span style="font-size:small <span style="font-size:small
<pre class="prettyprint #include "interface/canvas.h"
#include <QPainter>
#include <QMouseEvent>
#include <QTabletEvent>
#include <QRadialGradient>
#include <QPointF>
#include <QDebug>
#include <QRect>
#include <QPixmap>
#include <QImageReader>
#include "base/mathutil.h"
#include "graphics/common/dirtydevice.h"
#include "graphics/common/strokesamples.h"
#include "graphics/test/strokesamplestest.h"
#include "graphics/bitmap/bitmapimage.h"
#include "interface/canvasenv.h"
#include "structure/composition.h"
#include "tool/tool.h"
#include "tool/standard/emptytool.h"
#include "tool/standard/eraser.h"
#include "tool/standard/paintbrush.h"
#include "tool/standard/zoom.h"
#include "tool/standard/pan.h"
using namespace tool;
using namespace canvas;
//=====================================================
// Normal public functions
Canvas::Canvas(QWeakPointer<structure::Composition> _composition, QWidget *_parent)
:
composition(_composition),
QWidget(_parent), strokeBusy(false), tabletInputBusy(false),
mousePressure(1.0f), mouseTwist(0.0f), mouseTilt(0.0f),
currentTool(), emptyTool(new tool::EmptyTool()), paintBrush(new PaintBrush()), eraser(new Eraser())
{
this->setFocusPolicy(Qt::StrongFocus);
this->zoomTool = QSharedPointer<Tool>(new Zoom());
this->panTool = QSharedPointer<Tool>(new Pan());
this->setCursor(Qt::BlankCursor);
this->setMouseTracking(true);
this->resizeComposition(QSize(1024,768));
// Temporary:
this->image = QSharedPointer<BitmapImage>(new BitmapImage(0x0, QRect(0,0,1024,768), Qt::transparent));
this->toolEnv = QSharedPointer<canvas::CanvasEnv>(new canvas::CanvasEnv());
this->toolEnv->getCanvasPaint()->setCanvasEnv(this->toolEnv.toWeakRef());
this->toolEnv->getCamera().setPosition(QPointF(image->width() / 2, image->height() / 2));
}
void Canvas::setCurrentTool(QSharedPointer<tool::Tool> newTool) {
if(!newTool) {
this->currentTool = this->emptyTool;
}
else if (this->toolEnv->getCurrentLayer()) {
// Only activate when there is a current layer.
this->currentTool = newTool;
this->currentTool->activate(this->toolEnv, this->toolEnv->getCurrentLayer()->getType());
} else {
qDebug() << "Canvas, setCurrentTool, error: no current layer is set";
}
repaintAll();
}
//====================================================
// Slots
void Canvas::layerChanged(int layerNr) {
QSharedPointer<structure::Composition> comp = this->composition.toStrongRef();
if(comp) {
this->toolEnv->setCurrentLayer(comp->getLayer(layerNr));
this->repaintAll();
}
}
void Canvas::frameChanged(int frameNr) {
this->toolEnv->setCurrentFrameNr(frameNr);
this->repaintAll();
}
void Canvas::keyAdded(int frameNr) {
this->repaintAll();
}
void Canvas::colorChanged(const QColor &color) {
this->toolEnv->getCanvasGraphics()->setForegroundColor(color);
}
//====================================================
// Handling pointer or keyboard input
void Canvas::tabletEvent(QTabletEvent *event) {
event->accept();
// Get high resolution coordinates relative to this widget.
QPointF point(
event->x() + (event->hiResGlobalX() - event->globalX()),
event->y() + (event->hiResGlobalY() - event->globalY())
);
this->tabletInputBusy = true;
this->pointerEvent(point, event->pressure());
this->toolEnv->setPointerPos(point);
}
void Canvas::mousePressEvent(QMouseEvent *event) {
event->accept();
this->tabletInputBusy = false;
this->pointerEvent(event->posF(), mousePressure);
this->toolEnv->setPointerPos(event->posF());
}
void Canvas::mouseMoveEvent(QMouseEvent *event) {
//qDebug() << "Mouse move " << event->pos();
event->accept();
if(this->tabletInputBusy)
return;
if(this->strokeBusy)
this->pointerEvent(event->posF(), mousePressure);
else
this->pointerEvent(event->posF(), 0.0f);
this->toolEnv->setPointerPos(event->posF());
}
void Canvas::mouseReleaseEvent(QMouseEvent *event) {
event->accept();
this->pointerEvent(event->posF(), 0.0f);
this->toolEnv->setPointerPos(event->posF());
}
void Canvas::mouseDoubleClickEvent(QMouseEvent *event) {
event->accept();
this->toolEnv->setPointerPos(event->posF());
}
void Canvas::keyPressEvent(QKeyEvent *event) {
if(event->isAutoRepeat()) {
event->accept();
//qDebug() << "Key press (autorepeat): " << event->key();
return;
}
else {
qDebug() << "Key pressed: " << event->key();
}
if(event->key() == Qt::Key_Control) {
event->accept();
this->previousTool = currentTool;
this->currentTool = zoomTool;
setMessage("zooming");
setCurrentTool(currentTool);
}
else if (event->key() == Qt::Key_Space) {
event->accept();
this->previousTool = currentTool;
this->currentTool = panTool;
setMessage("panning");
setCurrentTool(currentTool);
}
else if (event->key() == Qt::Key_P) {
event->accept();
this->currentTool = this->paintBrush;
setMessage("painting");
setCurrentTool(this->currentTool);
}
else if (event->key() == Qt::Key_E) {
event->accept();
this->currentTool = this->eraser;
setMessage("erasing");
setCurrentTool(this->currentTool);
}
}
void Canvas::keyReleaseEvent(QKeyEvent *event) {
if(event->isAutoRepeat()) {
event->accept();
//qDebug() << "Key release (autorepeat): " << event->key();
return;
}
else {
qDebug() << "Key released: " << event->key();
}
if(event->key() == Qt::Key_Space || event->key() == Qt::Key_Control) {
if(this->previousTool) {
this->currentTool = previousTool;
this->previousTool = QSharedPointer<tool::Tool>();
setCurrentTool(currentTool);
}
}
event->accept();
}
//=====================================================
// Other events
void Canvas::resizeEvent(QResizeEvent *event) {
this->toolEnv->setWidgetGeometry(QRect(0,0,event->size().width(), event->size().height()));
this->resizeComposition(event->size());
repaintAll();
}
void Canvas::focusInEvent ( QFocusEvent * event ) {
event->accept();
qDebug() << "Got focus";
repaintAll();
}
void Canvas::focusOutEvent ( QFocusEvent * event ) {
event->accept();
qDebug() << "Lost focus";
}
void Canvas::enterEvent ( QEvent * event ) {
qDebug() << "Requesting focus";
this->setFocus(Qt::MouseFocusReason);
}
void Canvas::leaveEvent ( QEvent * event ) {
}
//=======================================================
// Output
void Canvas:aintEvent(QPaintEvent *event) {
//-----------------------------------------------
// We render the composition.
QPainter q(this);
q.setClipping(true);
q.setClipRect(event->rect());
q.drawImage(0,0,*(this->compositionTotal.data()));
}
//===========================================================
// Private methods
void Canvas::resizeComposition(const QSize &size) {
this->compositionTotal = QSharedPointer<QImage>(new QImage(size.width(), size.height(), QImage::Format_ARGB32_Premultiplied));
this->compositionLayer = QSharedPointer<QImage>(new QImage(size.width(), size.height(), QImage::Format_ARGB32_Premultiplied));
}
// TODO: add other information such as tilt, rotation, ...
void Canvas:ointerEvent(const QPointF &screenPoint, float pressure) {
// Reset paint environment
this->toolEnv->getCanvasPaint()->clearUpdateRectangles();
this->toolEnv->getCanvasPaint()->setUpdateCursor(false);
this->giveInputToTool(screenPoint, pressure);
this->toolRendering(screenPoint);
}
void Canvas::giveInputToTool(const QPointF &screenPoint, float pressure) {
// Only continue if there is a current tool ...
if(!currentTool)
return;
// We map the point into world space
QPointF passedPoint;
if(this->currentTool->pointsInScreenSpace())
passedPoint = screenPoint;
else
passedPoint = this->toolEnv->getCamera().screenToWorld(screenPoint);
if(this->strokeBusy) {
if(pressure < currentTool->getPressureActivationThreshold()) {
// Not enough pressure, ending stroke.
this->strokeBusy = false;
currentTool->endStroke(this->toolEnv);
}
else {
// Still enough pressure, keep updating stroke.
currentTool->updateStroke(this->toolEnv, passedPoint, pressure, 0.0f, 0.0f);
}
}
else {
if(pressure >= currentTool->getPressureActivationThreshold()) {
// Enough pressure -> activate tool.
this->strokeBusy = true;
currentTool->beginStroke(this->toolEnv);
currentTool->updateStroke(this->toolEnv, passedPoint, pressure, 0.0f, 0.0f);
}
else {
// If no stroke is being drawn, then the tool might
// still be interested in using the pointer movement.
currentTool->hover(this->toolEnv, passedPoint);
}
}
}
void Canvas::toolRendering(const QPointF &screenPoint) {
bool refreshCursor =
base::MathUtil::distance(screenPoint, this->prevCursorLoc) >= 1.0f ||
this->toolEnv->getCanvasPaint()->isUpdatingCursor();
QRegion updateRegion;
// Add all update rectangles
updateRegion.operator +=(this->toolEnv->getCanvasPaint()->getUpdateRegion());
// Optionally add the cursor refresh region
if(refreshCursor) {
updateRegion.operator +=(this->prevCursorRegion);
}
this->repaintBackground(updateRegion);
if(refreshCursor) {
// Repaint the cursor (track the dirty region). This repainting
// happens on top of the total composition, in order for special composition modes
// to have the expected effect.
graphics:irtyDevice dirtyDev(this->compositionTotal.data(), false);
QPainter pDirty(&dirtyDev);
pDirty.translate(screenPoint);
if(this->currentTool)
this->currentTool->paintCursor(this->toolEnv, pDirty);
pDirty.end();
this->prevCursorRegion = dirtyDev.getDirtyRegion();
// We need to extend the region we want to refresh on screen
updateRegion.operator+=(dirtyDev.getDirtyRegion());
}
this->prevCursorLoc = screenPoint;
// Repaint the canvas widget
update(updateRegion);
}
void Canvas::repaintBackground(const QRegion ®ion) {
// Repaint the background of the composition.
QPainter pLayer(this->compositionLayer.data()); // paint the layer
QPainter pTotal(this->compositionTotal.data()); // paint background
pLayer.setClipping(true);
pTotal.setClipping(true);
// If there is no current tool, then let the empty tool do the "drawing"
QSharedPointer<tool::Tool> tool;
if(this->currentTool)
tool = this->currentTool;
else
tool = this->emptyTool;
QVector<QRect> updateRects = region.rects();
for(QVector<QRect>::ConstIterator iter = updateRects.begin(); iter != updateRects.end(); ++iter) {
const QRect &rect = *iter;
// Also get the rectangle in world space (for the layer painting)
QRect rectWorld = this->toolEnv->getCamera().screenToWorld(rect);
if(!rect.isEmpty()) {
pLayer.save();
pTotal.save();
pLayer.setClipRect(rect);
pTotal.setClipRect(rect);
// First render the layer, with a possible overlay of the tool
pLayer.setCompositionMode(QPainter::CompositionMode_Clear);
pLayer.fillRect(rect, Qt::white);
if(this->toolEnv->getCurrentLayer()) {
pLayer.setCompositionMode(QPainter::CompositionMode_SourceOver);
pLayer.setTransform(this->toolEnv->getCamera().getWorldToScreenTransform());
this->toolEnv->getCurrentLayer()->paintFrame(this->toolEnv->getCurrentFrameNr(), pLayer, rectWorld);
tool->paintLayerOverlay(this->toolEnv, pLayer, rect);
}
// Render total, with a possible overlay of the tool
pTotal.fillRect(rect, Qt::white);
pTotal.drawImage(0,0,*(this->compositionLayer.data()));
tool->paintTotalOverlay(this->toolEnv, pTotal, rect);
//pTotal.drawRect(rect);
pTotal.restore();
pLayer.restore();
}
}
//pTotal.drawText(50,50,message);
// It is important that the QPainter is destroyed here (automatically ok),
// because otherwise we wont be able to paint the composition in the future.
}
void Canvas::setMessage(const QString &str) {
this->message = str;
// this->repaint(QRect(0,0,200,50));
}
void Canvas::repaintAll() {
repaintBackground(QRegion(this->geometry()));
update(this->geometry());
}
[/code]
<br/>
<br/><hr class="sig btickle1
View the full article