diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2009-12-07 04:40:54 (GMT) |
---|---|---|
committer | Michael Brasser <michael.brasser@nokia.com> | 2009-12-07 04:40:54 (GMT) |
commit | 93a2b57c7e3c2be5b1c64d3408d27acb4aa2c8fc (patch) | |
tree | 5efe4f6c6386e25dc7d3235c7f261d3fdf5a19c3 /examples | |
parent | 55a3fda3baf545cc7fbfa6b2c00705be40a7319b (diff) | |
parent | 47008b211fe3b972077466e593a2a9016446bab2 (diff) | |
download | Qt-93a2b57c7e3c2be5b1c64d3408d27acb4aa2c8fc.zip Qt-93a2b57c7e3c2be5b1c64d3408d27acb4aa2c8fc.tar.gz Qt-93a2b57c7e3c2be5b1c64d3408d27acb4aa2c8fc.tar.bz2 |
Merge branch '4.6' of scm.dev.nokia.troll.no:qt/qt into kinetic-declarativeui
Conflicts:
src/tools/moc/generator.cpp
Diffstat (limited to 'examples')
-rw-r--r-- | examples/script/helloscript/helloscript.js (renamed from examples/script/helloscript/helloscript.qs) | 0 | ||||
-rw-r--r-- | examples/script/helloscript/helloscript.qrc | 2 | ||||
-rw-r--r-- | examples/script/helloscript/main.cpp | 2 | ||||
-rw-r--r-- | examples/script/qsdbg/example.js (renamed from examples/script/qsdbg/example.qs) | 0 | ||||
-rw-r--r-- | examples/script/qsdbg/main.cpp | 5 | ||||
-rw-r--r-- | examples/widgets/tablet/tabletcanvas.cpp | 30 | ||||
-rw-r--r-- | examples/widgets/tablet/tabletcanvas.h | 8 |
7 files changed, 25 insertions, 22 deletions
diff --git a/examples/script/helloscript/helloscript.qs b/examples/script/helloscript/helloscript.js index 6d8e87c..6d8e87c 100644 --- a/examples/script/helloscript/helloscript.qs +++ b/examples/script/helloscript/helloscript.js diff --git a/examples/script/helloscript/helloscript.qrc b/examples/script/helloscript/helloscript.qrc index dc93461..c52fa15 100644 --- a/examples/script/helloscript/helloscript.qrc +++ b/examples/script/helloscript/helloscript.qrc @@ -1,5 +1,5 @@ <RCC> <qresource prefix="/" > - <file>helloscript.qs</file> + <file>helloscript.js</file> </qresource> </RCC> diff --git a/examples/script/helloscript/main.cpp b/examples/script/helloscript/main.cpp index bc9a65e..55d63bf 100644 --- a/examples/script/helloscript/main.cpp +++ b/examples/script/helloscript/main.cpp @@ -68,7 +68,7 @@ int main(int argc, char *argv[]) //! [2] //! [3] - QString fileName(":/helloscript.qs"); + QString fileName(":/helloscript.js"); QFile scriptFile(fileName); scriptFile.open(QIODevice::ReadOnly); QTextStream stream(&scriptFile); diff --git a/examples/script/qsdbg/example.qs b/examples/script/qsdbg/example.js index 47c1363..47c1363 100644 --- a/examples/script/qsdbg/example.qs +++ b/examples/script/qsdbg/example.js diff --git a/examples/script/qsdbg/main.cpp b/examples/script/qsdbg/main.cpp index 526de0c..2a86c3d 100644 --- a/examples/script/qsdbg/main.cpp +++ b/examples/script/qsdbg/main.cpp @@ -39,14 +39,17 @@ ** ****************************************************************************/ +#include <QtCore/QCoreApplication> #include <QtScript> #include "scriptdebugger.h" int main(int argc, char **argv) { + QCoreApplication app(argc, argv); + if (argc < 2) { - fprintf(stderr, "*** you must specify a script file to evaluate (try example.qs)\n"); + fprintf(stderr, "*** you must specify a script file to evaluate (try example.js)\n"); return(-1); } diff --git a/examples/widgets/tablet/tabletcanvas.cpp b/examples/widgets/tablet/tabletcanvas.cpp index 130498b..20b0d1e 100644 --- a/examples/widgets/tablet/tabletcanvas.cpp +++ b/examples/widgets/tablet/tabletcanvas.cpp @@ -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..5a2fb1d 100644 --- a/examples/widgets/tablet/tabletcanvas.h +++ b/examples/widgets/tablet/tabletcanvas.h @@ -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; |