summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2009-11-04 15:45:57 (GMT)
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2009-11-04 15:45:57 (GMT)
commit56b8d24c337d30c6bcdda101fbc664c4fd6d642d (patch)
treeae1d621e9933d88e22f03e28dfea671a3a272ab1 /examples
parent4e5a1a77677540422cc69ec5c2b1341ca4b318f9 (diff)
parent05eeb454e0fcc83db330ee7df33a800a6998fc30 (diff)
downloadQt-56b8d24c337d30c6bcdda101fbc664c4fd6d642d.zip
Qt-56b8d24c337d30c6bcdda101fbc664c4fd6d642d.tar.gz
Qt-56b8d24c337d30c6bcdda101fbc664c4fd6d642d.tar.bz2
Merge branch '4.6' of scm.dev.nokia.troll.no:qt/qt into 4.6
Diffstat (limited to 'examples')
-rw-r--r--examples/gestures/imagegestures/imagegestures.pro6
-rw-r--r--examples/gestures/imagegestures/imagewidget.cpp30
-rw-r--r--examples/multimedia/videographicsitem/videoitem.cpp4
-rw-r--r--examples/multimedia/videographicsitem/videoplayer.cpp3
-rw-r--r--examples/multimedia/videowidget/videoplayer.cpp3
-rw-r--r--examples/multimedia/videowidget/videowidget.cpp2
-rw-r--r--examples/multimedia/videowidget/videowidgetsurface.cpp4
7 files changed, 23 insertions, 29 deletions
diff --git a/examples/gestures/imagegestures/imagegestures.pro b/examples/gestures/imagegestures/imagegestures.pro
index 7780ad9..8c947e4 100644
--- a/examples/gestures/imagegestures/imagegestures.pro
+++ b/examples/gestures/imagegestures/imagegestures.pro
@@ -5,12 +5,12 @@ SOURCES = imagewidget.cpp \
mainwidget.cpp
# install
-target.path = $$[QT_INSTALL_EXAMPLES]/gestures/imageviewer
+target.path = $$[QT_INSTALL_EXAMPLES]/gestures/imagegestures
sources.files = $$SOURCES \
$$HEADERS \
$$RESOURCES \
$$FORMS \
- imageviewer.pro
-sources.path = $$[QT_INSTALL_EXAMPLES]/gestures/imageviewer
+ imagegestures.pro
+sources.path = $$[QT_INSTALL_EXAMPLES]/gestures/imagegestures
INSTALLS += target \
sources
diff --git a/examples/gestures/imagegestures/imagewidget.cpp b/examples/gestures/imagegestures/imagewidget.cpp
index 28de6da..f615129 100644
--- a/examples/gestures/imagegestures/imagewidget.cpp
+++ b/examples/gestures/imagegestures/imagewidget.cpp
@@ -102,17 +102,13 @@ void ImageWidget::mouseDoubleClickEvent(QMouseEvent *)
//! [gesture event handler]
bool ImageWidget::gestureEvent(QGestureEvent *event)
{
- if (QGesture *pan = event->gesture(Qt::PanGesture)) {
- panTriggered(static_cast<QPanGesture*>(pan));
- return true;
- } else if (QGesture *pinch = event->gesture(Qt::PinchGesture)) {
- pinchTriggered(static_cast<QPinchGesture*>(pinch));
- return true;
- } else if (QGesture *swipe = event->gesture(Qt::SwipeGesture)) {
- swipeTriggered(static_cast<QSwipeGesture*>(swipe));
- return true;
- }
- return false;
+ if (QGesture *pan = event->gesture(Qt::PanGesture))
+ panTriggered(static_cast<QPanGesture *>(pan));
+ if (QGesture *pinch = event->gesture(Qt::PinchGesture))
+ pinchTriggered(static_cast<QPinchGesture *>(pinch));
+ if (QGesture *swipe = event->gesture(Qt::SwipeGesture))
+ swipeTriggered(static_cast<QSwipeGesture *>(swipe));
+ return true;
}
//! [gesture event handler]
@@ -128,21 +124,21 @@ void ImageWidget::panTriggered(QPanGesture *gesture)
setCursor(Qt::ArrowCursor);
}
#endif
- QPointF lastOffset = gesture->offset();
- horizontalOffset += lastOffset.x();
- verticalOffset += lastOffset.y();
+ QPointF delta = gesture->delta();
+ horizontalOffset += delta.x();
+ verticalOffset += delta.y();
update();
}
void ImageWidget::pinchTriggered(QPinchGesture *gesture)
{
- QPinchGesture::WhatChanged whatChanged = gesture->whatChanged();
- if (whatChanged & QPinchGesture::RotationAngleChanged) {
+ QPinchGesture::ChangeFlags changeFlags = gesture->changeFlags();
+ if (changeFlags & QPinchGesture::RotationAngleChanged) {
qreal value = gesture->property("rotationAngle").toReal();
qreal lastValue = gesture->property("lastRotationAngle").toReal();
rotationAngle += value - lastValue;
}
- if (whatChanged & QPinchGesture::ScaleFactorChanged) {
+ if (changeFlags & QPinchGesture::ScaleFactorChanged) {
qreal value = gesture->property("scaleFactor").toReal();
qreal lastValue = gesture->property("lastScaleFactor").toReal();
scaleFactor += value - lastValue;
diff --git a/examples/multimedia/videographicsitem/videoitem.cpp b/examples/multimedia/videographicsitem/videoitem.cpp
index c95e335..99e8df8 100644
--- a/examples/multimedia/videographicsitem/videoitem.cpp
+++ b/examples/multimedia/videographicsitem/videoitem.cpp
@@ -104,7 +104,7 @@ QList<QVideoFrame::PixelFormat> VideoItem::supportedPixelFormats(
bool VideoItem::start(const QVideoSurfaceFormat &format)
{
if (isFormatSupported(format)) {
- imageFormat = QVideoFrame::equivalentImageFormat(format.pixelFormat());
+ imageFormat = QVideoFrame::imageFormatFromPixelFormat(format.pixelFormat());
imageSize = format.frameSize();
framePainted = true;
@@ -129,7 +129,7 @@ void VideoItem::stop()
bool VideoItem::present(const QVideoFrame &frame)
{
if (!framePainted) {
- if (!isStarted())
+ if (!QAbstractVideoSurface::isActive())
setError(StoppedError);
return false;
diff --git a/examples/multimedia/videographicsitem/videoplayer.cpp b/examples/multimedia/videographicsitem/videoplayer.cpp
index 83644db..9ac4152 100644
--- a/examples/multimedia/videographicsitem/videoplayer.cpp
+++ b/examples/multimedia/videographicsitem/videoplayer.cpp
@@ -119,8 +119,7 @@ void VideoPlayer::openFile()
QString fileName = QFileDialog::getOpenFileName(this, tr("Open Movie"));
if (!fileName.isEmpty()) {
- if (videoItem->isStarted())
- videoItem->stop();
+ videoItem->stop();
movie.setFileName(fileName);
diff --git a/examples/multimedia/videowidget/videoplayer.cpp b/examples/multimedia/videowidget/videoplayer.cpp
index ed24714..cd146e8 100644
--- a/examples/multimedia/videowidget/videoplayer.cpp
+++ b/examples/multimedia/videowidget/videoplayer.cpp
@@ -100,8 +100,7 @@ void VideoPlayer::openFile()
QString fileName = QFileDialog::getOpenFileName(this, tr("Open Movie"));
if (!fileName.isEmpty()) {
- if (surface->isStarted())
- surface->stop();
+ surface->stop();
movie.setFileName(fileName);
diff --git a/examples/multimedia/videowidget/videowidget.cpp b/examples/multimedia/videowidget/videowidget.cpp
index 80688e1..f73a52f 100644
--- a/examples/multimedia/videowidget/videowidget.cpp
+++ b/examples/multimedia/videowidget/videowidget.cpp
@@ -84,7 +84,7 @@ void VideoWidget::paintEvent(QPaintEvent *event)
{
QPainter painter(this);
- if (surface->isStarted()) {
+ if (surface->isActive()) {
const QRect videoRect = surface->videoRect();
if (!videoRect.contains(event->rect())) {
diff --git a/examples/multimedia/videowidget/videowidgetsurface.cpp b/examples/multimedia/videowidget/videowidgetsurface.cpp
index ec9b8b5..b69375c 100644
--- a/examples/multimedia/videowidget/videowidgetsurface.cpp
+++ b/examples/multimedia/videowidget/videowidgetsurface.cpp
@@ -73,7 +73,7 @@ bool VideoWidgetSurface::isFormatSupported(
{
Q_UNUSED(similar);
- const QImage::Format imageFormat = QVideoFrame::equivalentImageFormat(format.pixelFormat());
+ const QImage::Format imageFormat = QVideoFrame::imageFormatFromPixelFormat(format.pixelFormat());
const QSize size = format.frameSize();
return imageFormat != QImage::Format_Invalid
@@ -85,7 +85,7 @@ bool VideoWidgetSurface::isFormatSupported(
//! [2]
bool VideoWidgetSurface::start(const QVideoSurfaceFormat &format)
{
- const QImage::Format imageFormat = QVideoFrame::equivalentImageFormat(format.pixelFormat());
+ const QImage::Format imageFormat = QVideoFrame::imageFormatFromPixelFormat(format.pixelFormat());
const QSize size = format.frameSize();
if (imageFormat != QImage::Format_Invalid && !size.isEmpty()) {