summaryrefslogtreecommitdiffstats
path: root/examples/widgets/tablet
diff options
context:
space:
mode:
authorAaron McCarthy <aaron.mccarthy@nokia.com>2010-01-29 03:47:42 (GMT)
committerAaron McCarthy <aaron.mccarthy@nokia.com>2010-01-29 03:47:42 (GMT)
commit350b0fadf3fbd12a278681513295577a066b0fb1 (patch)
treef0ebad6693c3cf3b7754fb8187a6b320e5d4679f /examples/widgets/tablet
parente4625e53aa893f7c59407913e743951294c7dafe (diff)
parent9d636095403f5abecbdff8ffffe658f35ff10001 (diff)
downloadQt-350b0fadf3fbd12a278681513295577a066b0fb1.zip
Qt-350b0fadf3fbd12a278681513295577a066b0fb1.tar.gz
Qt-350b0fadf3fbd12a278681513295577a066b0fb1.tar.bz2
Merge commit 'origin/4.6' into bearermanagement/integration-4
Conflicts: configure src/gui/painting/qpainter.cpp src/s60installs/s60installs.pro
Diffstat (limited to 'examples/widgets/tablet')
-rw-r--r--examples/widgets/tablet/main.cpp2
-rw-r--r--examples/widgets/tablet/mainwindow.cpp2
-rw-r--r--examples/widgets/tablet/mainwindow.h2
-rw-r--r--examples/widgets/tablet/tabletapplication.cpp2
-rw-r--r--examples/widgets/tablet/tabletapplication.h2
-rw-r--r--examples/widgets/tablet/tabletcanvas.cpp32
-rw-r--r--examples/widgets/tablet/tabletcanvas.h10
7 files changed, 26 insertions, 26 deletions
diff --git a/examples/widgets/tablet/main.cpp b/examples/widgets/tablet/main.cpp
index 684ae7e..7f862cf 100644
--- a/examples/widgets/tablet/main.cpp
+++ b/examples/widgets/tablet/main.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/examples/widgets/tablet/mainwindow.cpp b/examples/widgets/tablet/mainwindow.cpp
index 9fa8c24..ae1d5d3 100644
--- a/examples/widgets/tablet/mainwindow.cpp
+++ b/examples/widgets/tablet/mainwindow.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/examples/widgets/tablet/mainwindow.h b/examples/widgets/tablet/mainwindow.h
index 4365ba1..bca25d7 100644
--- a/examples/widgets/tablet/mainwindow.h
+++ b/examples/widgets/tablet/mainwindow.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/examples/widgets/tablet/tabletapplication.cpp b/examples/widgets/tablet/tabletapplication.cpp
index 00e9489..d03c9ae 100644
--- a/examples/widgets/tablet/tabletapplication.cpp
+++ b/examples/widgets/tablet/tabletapplication.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/examples/widgets/tablet/tabletapplication.h b/examples/widgets/tablet/tabletapplication.h
index 09ddf8e..62d29a0 100644
--- a/examples/widgets/tablet/tabletapplication.h
+++ b/examples/widgets/tablet/tabletapplication.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/examples/widgets/tablet/tabletcanvas.cpp b/examples/widgets/tablet/tabletcanvas.cpp
index 130498b..4d8f37a 100644
--- a/examples/widgets/tablet/tabletcanvas.cpp
+++ b/examples/widgets/tablet/tabletcanvas.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -50,7 +50,7 @@ TabletCanvas::TabletCanvas()
resize(500, 500);
myBrush = QBrush();
myPen = QPen();
- initImage();
+ initPixmap();
setAutoFillBackground(true);
deviceDown = false;
myColor = Qt::red;
@@ -60,29 +60,29 @@ TabletCanvas::TabletCanvas()
lineWidthType = LineWidthPressure;
}
-void TabletCanvas::initImage()
+void TabletCanvas::initPixmap()
{
- QImage newImage = QImage(width(), height(), QImage::Format_ARGB32);
- QPainter painter(&newImage);
- painter.fillRect(0, 0, newImage.width(), newImage.height(), Qt::white);
- if (!image.isNull())
- painter.drawImage(0, 0, image);
+ QPixmap newPixmap = QPixmap(width(), height());
+ newPixmap.fill(Qt::white);
+ QPainter painter(&newPixmap);
+ if (!pixmap.isNull())
+ painter.drawPixmap(0, 0, pixmap);
painter.end();
- image = newImage;
+ pixmap = newPixmap;
}
//! [0]
//! [1]
bool TabletCanvas::saveImage(const QString &file)
{
- return image.save(file);
+ return pixmap.save(file);
}
//! [1]
//! [2]
bool TabletCanvas::loadImage(const QString &file)
{
- bool success = image.load(file);
+ bool success = pixmap.load(file);
if (success) {
update();
@@ -114,8 +114,8 @@ void TabletCanvas::tabletEvent(QTabletEvent *event)
if (deviceDown) {
updateBrush(event);
- QPainter painter(&image);
- paintImage(painter, event);
+ QPainter painter(&pixmap);
+ paintPixmap(painter, event);
}
break;
default:
@@ -129,12 +129,12 @@ void TabletCanvas::tabletEvent(QTabletEvent *event)
void TabletCanvas::paintEvent(QPaintEvent *)
{
QPainter painter(this);
- painter.drawImage(QPoint(0, 0), image);
+ painter.drawPixmap(0, 0, pixmap);
}
//! [4]
//! [5]
-void TabletCanvas::paintImage(QPainter &painter, QTabletEvent *event)
+void TabletCanvas::paintPixmap(QPainter &painter, QTabletEvent *event)
{
QPoint brushAdjust(10, 10);
@@ -271,6 +271,6 @@ void TabletCanvas::updateBrush(QTabletEvent *event)
void TabletCanvas::resizeEvent(QResizeEvent *)
{
- initImage();
+ initPixmap();
polyLine[0] = polyLine[1] = polyLine[2] = QPoint();
}
diff --git a/examples/widgets/tablet/tabletcanvas.h b/examples/widgets/tablet/tabletcanvas.h
index 02b8794..240fb18 100644
--- a/examples/widgets/tablet/tabletcanvas.h
+++ b/examples/widgets/tablet/tabletcanvas.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -43,7 +43,7 @@
#define TABLETCANVAS_H
#include <QWidget>
-#include <QImage>
+#include <QPixmap>
#include <QPoint>
#include <QTabletEvent>
#include <QColor>
@@ -92,8 +92,8 @@ protected:
void resizeEvent(QResizeEvent *event);
private:
- void initImage();
- void paintImage(QPainter &painter, QTabletEvent *event);
+ void initPixmap();
+ void paintPixmap(QPainter &painter, QTabletEvent *event);
Qt::BrushStyle brushPattern(qreal value);
void updateBrush(QTabletEvent *event);
@@ -104,7 +104,7 @@ private:
QTabletEvent::TabletDevice myTabletDevice;
QColor myColor;
- QImage image;
+ QPixmap pixmap;
QBrush myBrush;
QPen myPen;
bool deviceDown;