diff options
35 files changed, 384 insertions, 292 deletions
diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp index 30af6fa..ce9ed58 100644 --- a/src/corelib/kernel/qmetatype.cpp +++ b/src/corelib/kernel/qmetatype.cpp @@ -518,19 +518,15 @@ int QMetaType::registerTypedef(const char* typeName, int aliasId) idx = qMetaTypeCustomType_unlocked(normalizedTypeName.constData(), normalizedTypeName.size()); - if (idx) { - Q_ASSERT(idx == aliasId); + if (idx) return idx; - } - if (!idx) { - QCustomTypeInfo inf; - inf.typeName = normalizedTypeName; - inf.alias = aliasId; - inf.constr = 0; - inf.destr = 0; - ct->append(inf); - } + QCustomTypeInfo inf; + inf.typeName = normalizedTypeName; + inf.alias = aliasId; + inf.constr = 0; + inf.destr = 0; + ct->append(inf); return aliasId; } diff --git a/src/gui/itemviews/qsortfilterproxymodel.cpp b/src/gui/itemviews/qsortfilterproxymodel.cpp index c6ad345..dce5c6a 100644 --- a/src/gui/itemviews/qsortfilterproxymodel.cpp +++ b/src/gui/itemviews/qsortfilterproxymodel.cpp @@ -1217,13 +1217,13 @@ void QSortFilterProxyModelPrivate::_q_sourceAboutToBeReset() { Q_Q(QSortFilterProxyModel); q->beginResetModel(); - invalidatePersistentIndexes(); - clear_mapping(); } void QSortFilterProxyModelPrivate::_q_sourceReset() { Q_Q(QSortFilterProxyModel); + invalidatePersistentIndexes(); + clear_mapping(); // All internal structures are deleted in clear() q->endResetModel(); update_source_sort_column(); diff --git a/src/gui/itemviews/qtreeview.cpp b/src/gui/itemviews/qtreeview.cpp index 101dafe..61ad79d 100644 --- a/src/gui/itemviews/qtreeview.cpp +++ b/src/gui/itemviews/qtreeview.cpp @@ -1232,17 +1232,17 @@ bool QTreeView::viewportEvent(QEvent *event) int oldBranch = d->hoverBranch; d->hoverBranch = d->itemDecorationAt(he->pos()); if (oldBranch != d->hoverBranch) { - QModelIndex oldIndex = d->modelIndex(oldBranch), - newIndex = d->modelIndex(d->hoverBranch); - if (oldIndex != newIndex) { - QRect oldRect = visualRect(oldIndex); - QRect newRect = visualRect(newIndex); - oldRect.setLeft(oldRect.left() - d->indent); - newRect.setLeft(newRect.left() - d->indent); - //we need to paint the whole items (including the decoration) so that when the user - //moves the mouse over those elements they are updated - viewport()->update(oldRect); - viewport()->update(newRect); + //we need to paint the whole items (including the decoration) so that when the user + //moves the mouse over those elements they are updated + if (oldBranch >= 0) { + int y = d->coordinateForItem(oldBranch); + int h = d->itemHeight(oldBranch); + viewport()->update(QRect(0, y, viewport()->width(), h)); + } + if (d->hoverBranch >= 0) { + int y = d->coordinateForItem(d->hoverBranch); + int h = d->itemHeight(d->hoverBranch); + viewport()->update(QRect(0, y, viewport()->width(), h)); } } break; } diff --git a/src/gui/widgets/qsplitter.cpp b/src/gui/widgets/qsplitter.cpp index 965094e..f4076eb 100644 --- a/src/gui/widgets/qsplitter.cpp +++ b/src/gui/widgets/qsplitter.cpp @@ -1276,7 +1276,6 @@ void QSplitter::childEvent(QChildEvent *c) if (!c->child()->isWidgetType()) return; QWidget *w = static_cast<QWidget*>(c->child()); - if (c->added() && !d->blockChildAdd && !w->isWindow() && !d->findWidget(w)) { d->insertWidget_helper(d->list.count(), w, false); } else if (c->polished() && !d->blockChildAdd) { @@ -1313,18 +1312,16 @@ void QSplitter::setRubberBand(int pos) const int rBord = 3; // customizable? int hw = handleWidth(); if (!d->rubberBand) { - d->rubberBand = new QRubberBand(QRubberBand::Line); + QBoolBlocker b(d->blockChildAdd); + d->rubberBand = new QRubberBand(QRubberBand::Line, this); // For accessibility to identify this special widget. d->rubberBand->setObjectName(QLatin1String("qt_rubberband")); } - if (d->orient == Qt::Horizontal) - d->rubberBand->setGeometry(QRect(QPoint(pos + hw / 2 - rBord, r.y()), - QSize(2 * rBord, r.height())).translated(mapToGlobal(QPoint()))); - else - d->rubberBand->setGeometry(QRect(QPoint(r.x(), pos + hw / 2 - rBord), - QSize(r.width(), 2 * rBord)).translated(mapToGlobal(QPoint()))); - if (!d->rubberBand->isVisible()) - d->rubberBand->show(); + + const QRect newGeom = d->orient == Qt::Horizontal ? QRect(QPoint(pos + hw / 2 - rBord, r.y()), QSize(2 * rBord, r.height())) + : QRect(QPoint(r.x(), pos + hw / 2 - rBord), QSize(r.width(), 2 * rBord)); + d->rubberBand->setGeometry(newGeom); + d->rubberBand->show(); } /*! @@ -1555,16 +1552,14 @@ QSize QSplitter::sizeHint() const ensurePolished(); int l = 0; int t = 0; - QObjectList childList = children(); - for (int i = 0; i < childList.size(); ++i) { - if (QWidget *w = qobject_cast<QWidget *>(childList.at(i))) { - if (w->isHidden()) - continue; - QSize s = w->sizeHint(); - if (s.isValid()) { - l += d->pick(s); - t = qMax(t, d->trans(s)); - } + for (int i = 0; i < d->list.size(); ++i) { + QWidget *w = d->list.at(i)->widget; + if (w->isHidden()) + continue; + QSize s = w->sizeHint(); + if (s.isValid()) { + l += d->pick(s); + t = qMax(t, d->trans(s)); } } return orientation() == Qt::Horizontal ? QSize(l, t) : QSize(t, l); diff --git a/src/multimedia/base/qvideowidget.cpp b/src/multimedia/base/qvideowidget.cpp index aabfefc..3820af9 100644 --- a/src/multimedia/base/qvideowidget.cpp +++ b/src/multimedia/base/qvideowidget.cpp @@ -105,12 +105,12 @@ void QVideoWidgetControlBackend::setFullScreen(bool fullScreen) } -QVideoWidget::AspectRatioMode QVideoWidgetControlBackend::aspectRatioMode() const +Qt::AspectRatioMode QVideoWidgetControlBackend::aspectRatioMode() const { return m_widgetControl->aspectRatioMode(); } -void QVideoWidgetControlBackend::setAspectRatioMode(QVideoWidget::AspectRatioMode mode) +void QVideoWidgetControlBackend::setAspectRatioMode(Qt::AspectRatioMode mode) { m_widgetControl->setAspectRatioMode(mode); } @@ -120,16 +120,16 @@ QRendererVideoWidgetBackend::QRendererVideoWidgetBackend( : m_rendererControl(control) , m_widget(widget) , m_surface(new QPainterVideoSurface) - , m_aspectRatioMode(QVideoWidget::KeepAspectRatio) + , m_aspectRatioMode(Qt::KeepAspectRatio) , m_updatePaintDevice(true) { connect(this, SIGNAL(brightnessChanged(int)), m_widget, SLOT(_q_brightnessChanged(int))); connect(this, SIGNAL(contrastChanged(int)), m_widget, SLOT(_q_contrastChanged(int))); connect(this, SIGNAL(hueChanged(int)), m_widget, SLOT(_q_hueChanged(int))); connect(this, SIGNAL(saturationChanged(int)), m_widget, SLOT(_q_saturationChanged(int))); - connect(m_surface, SIGNAL(frameChanged()), m_widget, SLOT(update())); + connect(m_surface, SIGNAL(frameChanged()), this, SLOT(frameChanged())); connect(m_surface, SIGNAL(surfaceFormatChanged(QVideoSurfaceFormat)), - m_widget, SLOT(_q_dimensionsChanged())); + this, SLOT(formatChanged(QVideoSurfaceFormat))); m_rendererControl->setSurface(m_surface); } @@ -172,12 +172,12 @@ void QRendererVideoWidgetBackend::setSaturation(int saturation) emit saturationChanged(saturation); } -QVideoWidget::AspectRatioMode QRendererVideoWidgetBackend::aspectRatioMode() const +Qt::AspectRatioMode QRendererVideoWidgetBackend::aspectRatioMode() const { return m_aspectRatioMode; } -void QRendererVideoWidgetBackend::setAspectRatioMode(QVideoWidget::AspectRatioMode mode) +void QRendererVideoWidgetBackend::setAspectRatioMode(Qt::AspectRatioMode mode) { m_aspectRatioMode = mode; @@ -207,6 +207,7 @@ void QRendererVideoWidgetBackend::hideEvent(QHideEvent *) void QRendererVideoWidgetBackend::resizeEvent(QResizeEvent *) { + updateRects(); } void QRendererVideoWidgetBackend::moveEvent(QMoveEvent *) @@ -217,8 +218,8 @@ void QRendererVideoWidgetBackend::paintEvent(QPaintEvent *event) { QPainter painter(m_widget); - if (m_surface->isActive()) { - m_surface->paint(&painter, displayRect()); + if (m_surface->isActive() && m_boundingRect.intersects(event->rect())) { + m_surface->paint(&painter, m_boundingRect, m_sourceRect); m_surface->setReady(true); } else { @@ -240,33 +241,53 @@ void QRendererVideoWidgetBackend::paintEvent(QPaintEvent *event) } } -QRect QRendererVideoWidgetBackend::displayRect() const +void QRendererVideoWidgetBackend::formatChanged(const QVideoSurfaceFormat &format) { - QRect displayRect = m_widget->rect(); + m_nativeSize = format.sizeHint(); - if (m_aspectRatioMode != QVideoWidget::IgnoreAspectRatio) { - QVideoSurfaceFormat format = m_surface->surfaceFormat(); + updateRects(); - QSize aspectRatio = format.pixelAspectRatio(); + m_widget->updateGeometry(); +} + +void QRendererVideoWidgetBackend::frameChanged() +{ + m_widget->update(m_boundingRect); +} + +void QRendererVideoWidgetBackend::updateRects() +{ + QRect rect = m_widget->rect(); - QSize size = format.viewport().size(); - size.rwidth() *= aspectRatio.width(); - size.rheight() *= aspectRatio.height(); - size.scale(displayRect.size(), Qt::KeepAspectRatio); + if (m_nativeSize.isEmpty()) { + m_boundingRect = QRect(); + } else if (m_aspectRatioMode == Qt::IgnoreAspectRatio) { + m_boundingRect = rect; + m_sourceRect = QRectF(0, 0, 1, 1); + } else if (m_aspectRatioMode == Qt::KeepAspectRatio) { + QSize size = m_nativeSize; + size.scale(rect.size(), Qt::KeepAspectRatio); - QPoint center = displayRect.center(); + m_boundingRect = QRect(0, 0, size.width(), size.height()); + m_boundingRect.moveCenter(rect.center()); - displayRect = QRect(QPoint(0, 0), size); - displayRect.moveCenter(center); - } + m_sourceRect = QRectF(0, 0, 1, 1); + } else if (m_aspectRatioMode == Qt::KeepAspectRatioByExpanding) { + m_boundingRect = rect; - return displayRect; + QSizeF size = rect.size(); + size.scale(m_nativeSize, Qt::KeepAspectRatio); + + m_sourceRect = QRectF( + 0, 0, size.width() / m_nativeSize.width(), size.height() / m_nativeSize.height()); + m_sourceRect.moveCenter(QPointF(0.5, 0.5)); + } } QWindowVideoWidgetBackend::QWindowVideoWidgetBackend(QVideoWindowControl *control, QWidget *widget) : m_windowControl(control) , m_widget(widget) - , m_aspectRatioMode(QVideoWidget::KeepAspectRatio) + , m_aspectRatioMode(Qt::KeepAspectRatio) { connect(control, SIGNAL(brightnessChanged(int)), m_widget, SLOT(_q_brightnessChanged(int))); connect(control, SIGNAL(contrastChanged(int)), m_widget, SLOT(_q_contrastChanged(int))); @@ -305,12 +326,12 @@ void QWindowVideoWidgetBackend::setFullScreen(bool fullScreen) m_windowControl->setFullScreen(fullScreen); } -QVideoWidget::AspectRatioMode QWindowVideoWidgetBackend::aspectRatioMode() const +Qt::AspectRatioMode QWindowVideoWidgetBackend::aspectRatioMode() const { return m_windowControl->aspectRatioMode(); } -void QWindowVideoWidgetBackend::setAspectRatioMode(QVideoWidget::AspectRatioMode mode) +void QWindowVideoWidgetBackend::setAspectRatioMode(Qt::AspectRatioMode mode) { m_windowControl->setAspectRatioMode(mode); } @@ -515,16 +536,6 @@ void QVideoWidgetPrivate::_q_dimensionsChanged() */ /*! - \enum QVideoWidget::AspectRatioMode - - Specfies how video is scaled with respect to its aspect ratio. - - \value IgnoreAspectRatio The video is scaled to fill the widget ignoring its aspect ratio. - \value KeepAspectRatio The video is scaled to the largest rectangle that will fit within the - widget's dimensions while still retaining its original aspect ratio. -*/ - -/*! Constructs a new video widget. The \a parent is passed to QWidget. @@ -617,12 +628,12 @@ void QVideoWidget::setMediaObject(QMediaObject *object) \brief how video is scaled with respect to its aspect ratio. */ -QVideoWidget::AspectRatioMode QVideoWidget::aspectRatioMode() const +Qt::AspectRatioMode QVideoWidget::aspectRatioMode() const { return d_func()->aspectRatioMode; } -void QVideoWidget::setAspectRatioMode(QVideoWidget::AspectRatioMode mode) +void QVideoWidget::setAspectRatioMode(Qt::AspectRatioMode mode) { Q_D(QVideoWidget); diff --git a/src/multimedia/base/qvideowidget.h b/src/multimedia/base/qvideowidget.h index 4e6cf2e..4b24bcb 100644 --- a/src/multimedia/base/qvideowidget.h +++ b/src/multimedia/base/qvideowidget.h @@ -60,16 +60,13 @@ class Q_MULTIMEDIA_EXPORT QVideoWidget : public QWidget Q_OBJECT Q_PROPERTY(QMediaObject* mediaObject READ mediaObject WRITE setMediaObject) Q_PROPERTY(bool fullScreen READ isFullScreen WRITE setFullScreen NOTIFY fullScreenChanged) - Q_PROPERTY(AspectRatioMode aspectRatioMode READ aspectRatioMode WRITE setAspectRatioMode NOTIFY aspectRatioModeChanged) + Q_PROPERTY(Qt::AspectRatioMode aspectRatioMode READ aspectRatioMode WRITE setAspectRatioMode NOTIFY aspectRatioModeChanged) Q_PROPERTY(int brightness READ brightness WRITE setBrightness NOTIFY brightnessChanged) Q_PROPERTY(int contrast READ contrast WRITE setContrast NOTIFY contrastChanged) Q_PROPERTY(int hue READ hue WRITE setHue NOTIFY hueChanged) Q_PROPERTY(int saturation READ saturation WRITE setSaturation NOTIFY saturationChanged) - Q_ENUMS(AspectRatio) public: - enum AspectRatioMode { IgnoreAspectRatio, KeepAspectRatio }; - QVideoWidget(QWidget *parent = 0); ~QVideoWidget(); @@ -80,7 +77,7 @@ public: bool isFullScreen() const; #endif - AspectRatioMode aspectRatioMode() const; + Qt::AspectRatioMode aspectRatioMode() const; int brightness() const; int contrast() const; @@ -91,7 +88,7 @@ public: public Q_SLOTS: void setFullScreen(bool fullScreen); - void setAspectRatioMode(QVideoWidget::AspectRatioMode mode); + void setAspectRatioMode(Qt::AspectRatioMode mode); void setBrightness(int brightness); void setContrast(int contrast); void setHue(int hue); diff --git a/src/multimedia/base/qvideowidget_p.h b/src/multimedia/base/qvideowidget_p.h index 4227afd..44fd1cd 100644 --- a/src/multimedia/base/qvideowidget_p.h +++ b/src/multimedia/base/qvideowidget_p.h @@ -78,8 +78,8 @@ public: virtual void setFullScreen(bool fullScreen) = 0; - virtual QVideoWidget::AspectRatioMode aspectRatioMode() const = 0; - virtual void setAspectRatioMode(QVideoWidget::AspectRatioMode mode) = 0; + virtual Qt::AspectRatioMode aspectRatioMode() const = 0; + virtual void setAspectRatioMode(Qt::AspectRatioMode mode) = 0; }; class QVideoWidgetBackend : public QObject, public QVideoWidgetControlInterface @@ -111,8 +111,8 @@ public: void setFullScreen(bool fullScreen); - QVideoWidget::AspectRatioMode aspectRatioMode() const; - void setAspectRatioMode(QVideoWidget::AspectRatioMode mode); + Qt::AspectRatioMode aspectRatioMode() const; + void setAspectRatioMode(Qt::AspectRatioMode mode); private: QVideoWidgetControl *m_widgetControl; @@ -137,8 +137,8 @@ public: void setFullScreen(bool fullScreen); - QVideoWidget::AspectRatioMode aspectRatioMode() const; - void setAspectRatioMode(QVideoWidget::AspectRatioMode mode); + Qt::AspectRatioMode aspectRatioMode() const; + void setAspectRatioMode(Qt::AspectRatioMode mode); QSize sizeHint() const; @@ -155,14 +155,20 @@ Q_SIGNALS: void hueChanged(int hue); void saturationChanged(int saturation); +private Q_SLOTS: + void formatChanged(const QVideoSurfaceFormat &format); + void frameChanged(); + private: - QRect displayRect() const; + void updateRects(); QVideoRendererControl *m_rendererControl; QWidget *m_widget; QPainterVideoSurface *m_surface; - QVideoWidget::AspectRatioMode m_aspectRatioMode; - QSize m_aspectRatio; + Qt::AspectRatioMode m_aspectRatioMode; + QRect m_boundingRect; + QRectF m_sourceRect; + QSize m_nativeSize; bool m_updatePaintDevice; }; @@ -182,8 +188,8 @@ public: void setFullScreen(bool fullScreen); - QVideoWidget::AspectRatioMode aspectRatioMode() const; - void setAspectRatioMode(QVideoWidget::AspectRatioMode mode); + Qt::AspectRatioMode aspectRatioMode() const; + void setAspectRatioMode(Qt::AspectRatioMode mode); QSize sizeHint() const; @@ -196,7 +202,7 @@ public: private: QVideoWindowControl *m_windowControl; QWidget *m_widget; - QVideoWidget::AspectRatioMode m_aspectRatioMode; + Qt::AspectRatioMode m_aspectRatioMode; QSize m_pixelAspectRatio; }; @@ -221,7 +227,7 @@ public: , contrast(0) , hue(0) , saturation(0) - , aspectRatioMode(QVideoWidget::KeepAspectRatio) + , aspectRatioMode(Qt::KeepAspectRatio) , nonFullScreenFlags(0) , wasFullScreen(false) { @@ -240,7 +246,7 @@ public: int contrast; int hue; int saturation; - QVideoWidget::AspectRatioMode aspectRatioMode; + Qt::AspectRatioMode aspectRatioMode; Qt::WindowFlags nonFullScreenFlags; bool wasFullScreen; diff --git a/src/multimedia/base/qvideowidgetcontrol.cpp b/src/multimedia/base/qvideowidgetcontrol.cpp index c53c77b..e8957dc 100644 --- a/src/multimedia/base/qvideowidgetcontrol.cpp +++ b/src/multimedia/base/qvideowidgetcontrol.cpp @@ -126,7 +126,7 @@ QVideoWidgetControl::~QVideoWidgetControl() */ /*! - \fn QVideoWidgetControl::setAspectRatioMode(QVideoWidget::AspectRatioMode mode) + \fn QVideoWidgetControl::setAspectRatioMode(Qt::AspectRatioMode mode) Sets the aspect ratio \a mode which determines how video is scaled to the fit the widget with respect to its aspect ratio. diff --git a/src/multimedia/base/qvideowidgetcontrol.h b/src/multimedia/base/qvideowidgetcontrol.h index 6981e89..4c0a6c6 100644 --- a/src/multimedia/base/qvideowidgetcontrol.h +++ b/src/multimedia/base/qvideowidgetcontrol.h @@ -66,8 +66,8 @@ public: virtual QWidget *videoWidget() = 0; - virtual QVideoWidget::AspectRatioMode aspectRatioMode() const = 0; - virtual void setAspectRatioMode(QVideoWidget::AspectRatioMode mode) = 0; + virtual Qt::AspectRatioMode aspectRatioMode() const = 0; + virtual void setAspectRatioMode(Qt::AspectRatioMode mode) = 0; virtual bool isFullScreen() const = 0; virtual void setFullScreen(bool fullScreen) = 0; diff --git a/src/multimedia/base/qvideowindowcontrol.cpp b/src/multimedia/base/qvideowindowcontrol.cpp index da46823..c74a0d5 100644 --- a/src/multimedia/base/qvideowindowcontrol.cpp +++ b/src/multimedia/base/qvideowindowcontrol.cpp @@ -62,7 +62,7 @@ QT_BEGIN_NAMESPACE QVideoWindowControl *windowControl = mediaService->control<QVideoWindowControl *>(); windowControl->setWinId(widget->winId()); windowControl->setDisplayRect(widget->rect()); - windowControl->setAspectRatioMode(QVideoWidget::KeepAspectRatio); + windowControl->setAspectRatioMode(Qt::KeepAspectRatio); \endcode QVideoWindowControl is one of number of possible video output controls, @@ -176,7 +176,7 @@ QVideoWindowControl::~QVideoWindowControl() */ /*! - \fn QVideoWindowControl::setAspectRatioMode(QVideoWidget::AspectRatioMode mode) + \fn QVideoWindowControl::setAspectRatioMode(Qt::AspectRatioMode mode) Sets the aspect ratio \a mode which determines how video is scaled to the fit the display region with respect to its aspect ratio. diff --git a/src/multimedia/base/qvideowindowcontrol.h b/src/multimedia/base/qvideowindowcontrol.h index 9ee96ab..53f7b0e 100644 --- a/src/multimedia/base/qvideowindowcontrol.h +++ b/src/multimedia/base/qvideowindowcontrol.h @@ -74,8 +74,8 @@ public: virtual QSize nativeSize() const = 0; - virtual QVideoWidget::AspectRatioMode aspectRatioMode() const = 0; - virtual void setAspectRatioMode(QVideoWidget::AspectRatioMode mode) = 0; + virtual Qt::AspectRatioMode aspectRatioMode() const = 0; + virtual void setAspectRatioMode(Qt::AspectRatioMode mode) = 0; virtual int brightness() const = 0; virtual void setBrightness(int brightness) = 0; diff --git a/src/plugins/mediaservices/directshow/mediaplayer/vmr9videowindowcontrol.cpp b/src/plugins/mediaservices/directshow/mediaplayer/vmr9videowindowcontrol.cpp index b1ddd98..4b9aeb8 100644 --- a/src/plugins/mediaservices/directshow/mediaplayer/vmr9videowindowcontrol.cpp +++ b/src/plugins/mediaservices/directshow/mediaplayer/vmr9videowindowcontrol.cpp @@ -162,30 +162,30 @@ QSize Vmr9VideoWindowControl::nativeSize() const return size; } -QVideoWidget::AspectRatioMode Vmr9VideoWindowControl::aspectRatioMode() const +Qt::AspectRatioMode Vmr9VideoWindowControl::aspectRatioMode() const { - QVideoWidget::AspectRatioMode mode = QVideoWidget::KeepAspectRatio; + Qt::AspectRatioMode mode = Qt::KeepAspectRatio; if (IVMRWindowlessControl9 *control = com_cast<IVMRWindowlessControl9>( m_filter, IID_IVMRWindowlessControl9)) { DWORD arMode; if (control->GetAspectRatioMode(&arMode) == S_OK && arMode == VMR9ARMode_None) - mode = QVideoWidget::IgnoreAspectRatio; + mode = Qt::IgnoreAspectRatio; control->Release(); } return mode; } -void Vmr9VideoWindowControl::setAspectRatioMode(QVideoWidget::AspectRatioMode mode) +void Vmr9VideoWindowControl::setAspectRatioMode(Qt::AspectRatioMode mode) { if (IVMRWindowlessControl9 *control = com_cast<IVMRWindowlessControl9>( m_filter, IID_IVMRWindowlessControl9)) { switch (mode) { - case QVideoWidget::IgnoreAspectRatio: + case Qt::IgnoreAspectRatio: control->SetAspectRatioMode(VMR9ARMode_None); break; - case QVideoWidget::KeepAspectRatio: + case Qt::KeepAspectRatio: control->SetAspectRatioMode(VMR9ARMode_LetterBox); break; default: diff --git a/src/plugins/mediaservices/directshow/mediaplayer/vmr9videowindowcontrol.h b/src/plugins/mediaservices/directshow/mediaplayer/vmr9videowindowcontrol.h index a0aca95..bf4fb42 100644 --- a/src/plugins/mediaservices/directshow/mediaplayer/vmr9videowindowcontrol.h +++ b/src/plugins/mediaservices/directshow/mediaplayer/vmr9videowindowcontrol.h @@ -75,8 +75,8 @@ public: QSize nativeSize() const; - QVideoWidget::AspectRatioMode aspectRatioMode() const; - void setAspectRatioMode(QVideoWidget::AspectRatioMode mode); + Qt::AspectRatioMode aspectRatioMode() const; + void setAspectRatioMode(Qt::AspectRatioMode mode); int brightness() const; void setBrightness(int brightness); diff --git a/src/plugins/mediaservices/gstreamer/qgstreamervideooverlay.cpp b/src/plugins/mediaservices/gstreamer/qgstreamervideooverlay.cpp index 846a24a..427d514 100644 --- a/src/plugins/mediaservices/gstreamer/qgstreamervideooverlay.cpp +++ b/src/plugins/mediaservices/gstreamer/qgstreamervideooverlay.cpp @@ -52,7 +52,7 @@ QGstreamerVideoOverlay::QGstreamerVideoOverlay(QObject *parent) : QVideoWindowControl(parent) , m_surface(new QX11VideoSurface) , m_videoSink(reinterpret_cast<GstElement*>(QVideoSurfaceGstSink::createSink(m_surface))) - , m_aspectRatioMode(QVideoWidget::KeepAspectRatio) + , m_aspectRatioMode(Qt::KeepAspectRatio) , m_fullScreen(false) { if (m_videoSink) { @@ -94,12 +94,12 @@ void QGstreamerVideoOverlay::setDisplayRect(const QRect &rect) setScaledDisplayRect(); } -QVideoWidget::AspectRatioMode QGstreamerVideoOverlay::aspectRatioMode() const +Qt::AspectRatioMode QGstreamerVideoOverlay::aspectRatioMode() const { return m_aspectRatioMode; } -void QGstreamerVideoOverlay::setAspectRatioMode(QVideoWidget::AspectRatioMode mode) +void QGstreamerVideoOverlay::setAspectRatioMode(Qt::AspectRatioMode mode) { m_aspectRatioMode = mode; @@ -193,7 +193,7 @@ void QGstreamerVideoOverlay::surfaceFormatChanged() void QGstreamerVideoOverlay::setScaledDisplayRect() { switch (m_aspectRatioMode) { - case QVideoWidget::KeepAspectRatio: + case Qt::KeepAspectRatio: { QSize size = m_surface->surfaceFormat().viewport().size(); @@ -205,7 +205,7 @@ void QGstreamerVideoOverlay::setScaledDisplayRect() m_surface->setDisplayRect(rect); } break; - case QVideoWidget::IgnoreAspectRatio: + case Qt::IgnoreAspectRatio: m_surface->setDisplayRect(m_displayRect); break; }; diff --git a/src/plugins/mediaservices/gstreamer/qgstreamervideooverlay.h b/src/plugins/mediaservices/gstreamer/qgstreamervideooverlay.h index 9566949..1188074 100644 --- a/src/plugins/mediaservices/gstreamer/qgstreamervideooverlay.h +++ b/src/plugins/mediaservices/gstreamer/qgstreamervideooverlay.h @@ -73,8 +73,8 @@ public: QSize nativeSize() const; - QVideoWidget::AspectRatioMode aspectRatioMode() const; - void setAspectRatioMode(QVideoWidget::AspectRatioMode mode); + Qt::AspectRatioMode aspectRatioMode() const; + void setAspectRatioMode(Qt::AspectRatioMode mode); void repaint(); @@ -102,7 +102,7 @@ private: QX11VideoSurface *m_surface; GstElement *m_videoSink; - QVideoWidget::AspectRatioMode m_aspectRatioMode; + Qt::AspectRatioMode m_aspectRatioMode; QRect m_displayRect; bool m_fullScreen; }; diff --git a/src/plugins/mediaservices/gstreamer/qgstreamervideowidget.cpp b/src/plugins/mediaservices/gstreamer/qgstreamervideowidget.cpp index 8307aa5..763f7f1 100644 --- a/src/plugins/mediaservices/gstreamer/qgstreamervideowidget.cpp +++ b/src/plugins/mediaservices/gstreamer/qgstreamervideowidget.cpp @@ -233,17 +233,17 @@ QWidget *QGstreamerVideoWidgetControl::videoWidget() return m_widget; } -QVideoWidget::AspectRatioMode QGstreamerVideoWidgetControl::aspectRatioMode() const +Qt::AspectRatioMode QGstreamerVideoWidgetControl::aspectRatioMode() const { return m_aspectRatioMode; } -void QGstreamerVideoWidgetControl::setAspectRatioMode(QVideoWidget::AspectRatioMode mode) +void QGstreamerVideoWidgetControl::setAspectRatioMode(Qt::AspectRatioMode mode) { if (m_videoSink) { g_object_set(G_OBJECT(m_videoSink), "force-aspect-ratio", - (mode == QVideoWidget::KeepAspectRatio), + (mode == Qt::KeepAspectRatio), (const char*)NULL); } diff --git a/src/plugins/mediaservices/gstreamer/qgstreamervideowidget.h b/src/plugins/mediaservices/gstreamer/qgstreamervideowidget.h index 6a4c0f3..28b48af 100644 --- a/src/plugins/mediaservices/gstreamer/qgstreamervideowidget.h +++ b/src/plugins/mediaservices/gstreamer/qgstreamervideowidget.h @@ -67,8 +67,8 @@ public: QWidget *videoWidget(); - QVideoWidget::AspectRatioMode aspectRatioMode() const; - void setAspectRatioMode(QVideoWidget::AspectRatioMode mode); + Qt::AspectRatioMode aspectRatioMode() const; + void setAspectRatioMode(Qt::AspectRatioMode mode); bool isFullScreen() const; void setFullScreen(bool fullScreen); @@ -99,7 +99,7 @@ private: GstElement *m_videoSink; QGstreamerVideoWidget *m_widget; WId m_windowId; - QVideoWidget::AspectRatioMode m_aspectRatioMode; + Qt::AspectRatioMode m_aspectRatioMode; bool m_fullScreen; }; diff --git a/src/plugins/mediaservices/qt7/qt7movievideowidget.h b/src/plugins/mediaservices/qt7/qt7movievideowidget.h index 558c3d7..7908efd 100644 --- a/src/plugins/mediaservices/qt7/qt7movievideowidget.h +++ b/src/plugins/mediaservices/qt7/qt7movievideowidget.h @@ -83,8 +83,8 @@ public: QSize nativeSize() const; - QVideoWidget::AspectRatioMode aspectRatioMode() const; - void setAspectRatioMode(QVideoWidget::AspectRatioMode mode); + Qt::AspectRatioMode aspectRatioMode() const; + void setAspectRatioMode(Qt::AspectRatioMode mode); int brightness() const; void setBrightness(int brightness); @@ -118,7 +118,7 @@ private: bool m_fullscreen; QSize m_nativeSize; - QVideoWidget::AspectRatioMode m_aspectRatioMode; + Qt::AspectRatioMode m_aspectRatioMode; int m_brightness; int m_contrast; int m_hue; diff --git a/src/plugins/mediaservices/qt7/qt7movievideowidget.mm b/src/plugins/mediaservices/qt7/qt7movievideowidget.mm index 00ceffc..197c26e 100644 --- a/src/plugins/mediaservices/qt7/qt7movievideowidget.mm +++ b/src/plugins/mediaservices/qt7/qt7movievideowidget.mm @@ -66,7 +66,7 @@ public: : QGLWidget(format, parent), m_texRef(0), m_nativeSize(640,480), - m_aspectRatioMode(QVideoWidget::KeepAspectRatio) + m_aspectRatioMode(Qt::KeepAspectRatio) { setAutoFillBackground(false); } @@ -145,7 +145,7 @@ public: m_nativeSize = size; } - void setAspectRatioMode(QVideoWidget::AspectRatioMode mode) + void setAspectRatioMode(Qt::AspectRatioMode mode) { if (m_aspectRatioMode != mode) { m_aspectRatioMode = mode; @@ -158,7 +158,7 @@ private: { QRect displayRect = rect(); - if (m_aspectRatioMode == QVideoWidget::KeepAspectRatio) { + if (m_aspectRatioMode == Qt::KeepAspectRatio) { QSize size = m_nativeSize; size.scale(displayRect.size(), Qt::KeepAspectRatio); @@ -170,7 +170,7 @@ private: CVOpenGLTextureRef m_texRef; QSize m_nativeSize; - QVideoWidget::AspectRatioMode m_aspectRatioMode; + Qt::AspectRatioMode m_aspectRatioMode; }; QT7MovieVideoWidget::QT7MovieVideoWidget(QObject *parent) @@ -178,7 +178,7 @@ QT7MovieVideoWidget::QT7MovieVideoWidget(QObject *parent) m_movie(0), m_videoWidget(0), m_fullscreen(false), - m_aspectRatioMode(QVideoWidget::KeepAspectRatio), + m_aspectRatioMode(Qt::KeepAspectRatio), m_brightness(0), m_contrast(0), m_hue(0), @@ -324,12 +324,12 @@ QSize QT7MovieVideoWidget::nativeSize() const return m_nativeSize; } -QVideoWidget::AspectRatioMode QT7MovieVideoWidget::aspectRatioMode() const +Qt::AspectRatioMode QT7MovieVideoWidget::aspectRatioMode() const { return m_aspectRatioMode; } -void QT7MovieVideoWidget::setAspectRatioMode(QVideoWidget::AspectRatioMode mode) +void QT7MovieVideoWidget::setAspectRatioMode(Qt::AspectRatioMode mode) { m_aspectRatioMode = mode; m_videoWidget->setAspectRatioMode(mode); diff --git a/src/plugins/mediaservices/qt7/qt7movieviewoutput.h b/src/plugins/mediaservices/qt7/qt7movieviewoutput.h index 30eefa7..31a0314 100644 --- a/src/plugins/mediaservices/qt7/qt7movieviewoutput.h +++ b/src/plugins/mediaservices/qt7/qt7movieviewoutput.h @@ -80,8 +80,8 @@ public: QSize nativeSize() const; - QVideoWidget::AspectRatioMode aspectRatioMode() const; - void setAspectRatioMode(QVideoWidget::AspectRatioMode mode); + Qt::AspectRatioMode aspectRatioMode() const; + void setAspectRatioMode(Qt::AspectRatioMode mode); int brightness() const; void setBrightness(int brightness); @@ -105,7 +105,7 @@ private: QRect m_displayRect; bool m_fullscreen; QSize m_nativeSize; - QVideoWidget::AspectRatioMode m_aspectRatioMode; + Qt::AspectRatioMode m_aspectRatioMode; int m_brightness; int m_contrast; int m_hue; diff --git a/src/plugins/mediaservices/qt7/qt7movieviewoutput.mm b/src/plugins/mediaservices/qt7/qt7movieviewoutput.mm index 254af46..d8dbf9b 100644 --- a/src/plugins/mediaservices/qt7/qt7movieviewoutput.mm +++ b/src/plugins/mediaservices/qt7/qt7movieviewoutput.mm @@ -156,7 +156,7 @@ QT7MovieViewOutput::QT7MovieViewOutput(QObject *parent) m_movieView(0), m_winId(0), m_fullscreen(false), - m_aspectRatioMode(QVideoWidget::KeepAspectRatio), + m_aspectRatioMode(Qt::KeepAspectRatio), m_brightness(0), m_contrast(0), m_hue(0), @@ -230,7 +230,7 @@ void QT7MovieViewOutput::setDisplayRect(const QRect &rect) if (m_movieView) { AutoReleasePool pool; - [(QTMovieView*)m_movieView setPreservesAspectRatio:(m_aspectRatioMode == QVideoWidget::KeepAspectRatio ? YES : NO)]; + [(QTMovieView*)m_movieView setPreservesAspectRatio:(m_aspectRatioMode == Qt::KeepAspectRatio ? YES : NO)]; [(QTMovieView*)m_movieView setFrame:NSMakeRect(m_displayRect.x(), m_displayRect.y(), m_displayRect.width(), @@ -259,12 +259,12 @@ QSize QT7MovieViewOutput::nativeSize() const return m_nativeSize; } -QVideoWidget::AspectRatioMode QT7MovieViewOutput::aspectRatioMode() const +Qt::AspectRatioMode QT7MovieViewOutput::aspectRatioMode() const { return m_aspectRatioMode; } -void QT7MovieViewOutput::setAspectRatioMode(QVideoWidget::AspectRatioMode mode) +void QT7MovieViewOutput::setAspectRatioMode(Qt::AspectRatioMode mode) { m_aspectRatioMode = mode; setDisplayRect(m_displayRect); diff --git a/tests/auto/declarative/qdeclarativeecmascript/testtypes.cpp b/tests/auto/declarative/qdeclarativeecmascript/testtypes.cpp index ce505f3..a3bcb6a 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/testtypes.cpp +++ b/tests/auto/declarative/qdeclarativeecmascript/testtypes.cpp @@ -43,7 +43,7 @@ class BaseExtensionObject : public QObject { Q_OBJECT - Q_PROPERTY(int baseExtendedProperty READ extendedProperty WRITE setExtendedProperty NOTIFY extendedPropertyChanged); + Q_PROPERTY(int baseExtendedProperty READ extendedProperty WRITE setExtendedProperty NOTIFY extendedPropertyChanged) public: BaseExtensionObject(QObject *parent) : QObject(parent), m_value(0) {} @@ -59,7 +59,7 @@ private: class ExtensionObject : public QObject { Q_OBJECT - Q_PROPERTY(int extendedProperty READ extendedProperty WRITE setExtendedProperty NOTIFY extendedPropertyChanged); + Q_PROPERTY(int extendedProperty READ extendedProperty WRITE setExtendedProperty NOTIFY extendedPropertyChanged) public: ExtensionObject(QObject *parent) : QObject(parent), m_value(0) {} diff --git a/tests/auto/declarative/qdeclarativeecmascript/testtypes.h b/tests/auto/declarative/qdeclarativeecmascript/testtypes.h index 78a5e0f..72dc3bb 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/testtypes.h +++ b/tests/auto/declarative/qdeclarativeecmascript/testtypes.h @@ -205,9 +205,9 @@ public slots: class MyDefaultObject1 : public QObject { Q_OBJECT - Q_PROPERTY(int horseLegs READ horseLegs CONSTANT); - Q_PROPERTY(int antLegs READ antLegs CONSTANT); - Q_PROPERTY(int emuLegs READ emuLegs CONSTANT); + Q_PROPERTY(int horseLegs READ horseLegs CONSTANT) + Q_PROPERTY(int antLegs READ antLegs CONSTANT) + Q_PROPERTY(int emuLegs READ emuLegs CONSTANT) public: int horseLegs() const { return 4; } int antLegs() const { return 6; } @@ -217,8 +217,8 @@ public: class MyDefaultObject3 : public QObject { Q_OBJECT - Q_PROPERTY(int antLegs READ antLegs CONSTANT); - Q_PROPERTY(int humanLegs READ humanLegs CONSTANT); + Q_PROPERTY(int antLegs READ antLegs CONSTANT) + Q_PROPERTY(int humanLegs READ humanLegs CONSTANT) public: int antLegs() const { return 7; } // Mutant int humanLegs() const { return 2; } @@ -229,9 +229,9 @@ class MyDeferredObject : public QObject { Q_OBJECT Q_PROPERTY(int value READ value WRITE setValue NOTIFY valueChanged) - Q_PROPERTY(QObject *objectProperty READ objectProperty WRITE setObjectProperty); - Q_PROPERTY(QObject *objectProperty2 READ objectProperty2 WRITE setObjectProperty2); - Q_CLASSINFO("DeferredPropertyNames", "value,objectProperty,objectProperty2"); + Q_PROPERTY(QObject *objectProperty READ objectProperty WRITE setObjectProperty) + Q_PROPERTY(QObject *objectProperty2 READ objectProperty2 WRITE setObjectProperty2) + Q_CLASSINFO("DeferredPropertyNames", "value,objectProperty,objectProperty2") public: MyDeferredObject() : m_value(0), m_object(0), m_object2(0) {} @@ -258,7 +258,7 @@ QML_DECLARE_TYPE(MyDeferredObject); class MyBaseExtendedObject : public QObject { Q_OBJECT -Q_PROPERTY(int baseProperty READ baseProperty WRITE setBaseProperty); +Q_PROPERTY(int baseProperty READ baseProperty WRITE setBaseProperty) public: MyBaseExtendedObject() : m_value(0) {} @@ -273,7 +273,7 @@ QML_DECLARE_TYPE(MyBaseExtendedObject); class MyExtendedObject : public MyBaseExtendedObject { Q_OBJECT -Q_PROPERTY(int coreProperty READ coreProperty WRITE setCoreProperty); +Q_PROPERTY(int coreProperty READ coreProperty WRITE setCoreProperty) public: MyExtendedObject() : m_value(0) {} @@ -291,34 +291,34 @@ class MyTypeObject : public QObject Q_ENUMS(MyEnum) Q_FLAGS(MyFlags) - Q_PROPERTY(QString id READ id WRITE setId); - Q_PROPERTY(QObject *objectProperty READ objectProperty WRITE setObjectProperty); - Q_PROPERTY(QDeclarativeComponent *componentProperty READ componentProperty WRITE setComponentProperty); - Q_PROPERTY(MyFlags flagProperty READ flagProperty WRITE setFlagProperty); - Q_PROPERTY(MyEnum enumProperty READ enumProperty WRITE setEnumProperty); - Q_PROPERTY(QString stringProperty READ stringProperty WRITE setStringProperty); - Q_PROPERTY(uint uintProperty READ uintProperty WRITE setUintProperty); - Q_PROPERTY(int intProperty READ intProperty WRITE setIntProperty); - Q_PROPERTY(qreal realProperty READ realProperty WRITE setRealProperty); - Q_PROPERTY(double doubleProperty READ doubleProperty WRITE setDoubleProperty); - Q_PROPERTY(float floatProperty READ floatProperty WRITE setFloatProperty); - Q_PROPERTY(QColor colorProperty READ colorProperty WRITE setColorProperty); - Q_PROPERTY(QDate dateProperty READ dateProperty WRITE setDateProperty); - Q_PROPERTY(QTime timeProperty READ timeProperty WRITE setTimeProperty); - Q_PROPERTY(QDateTime dateTimeProperty READ dateTimeProperty WRITE setDateTimeProperty); - Q_PROPERTY(QPoint pointProperty READ pointProperty WRITE setPointProperty); - Q_PROPERTY(QPointF pointFProperty READ pointFProperty WRITE setPointFProperty); - Q_PROPERTY(QSize sizeProperty READ sizeProperty WRITE setSizeProperty); - Q_PROPERTY(QSizeF sizeFProperty READ sizeFProperty WRITE setSizeFProperty); - Q_PROPERTY(QRect rectProperty READ rectProperty WRITE setRectProperty NOTIFY rectPropertyChanged); - Q_PROPERTY(QRect rectProperty2 READ rectProperty2 WRITE setRectProperty2); - Q_PROPERTY(QRectF rectFProperty READ rectFProperty WRITE setRectFProperty); - Q_PROPERTY(bool boolProperty READ boolProperty WRITE setBoolProperty); - Q_PROPERTY(QVariant variantProperty READ variantProperty WRITE setVariantProperty); - Q_PROPERTY(QVector3D vectorProperty READ vectorProperty WRITE setVectorProperty); - Q_PROPERTY(QUrl urlProperty READ urlProperty WRITE setUrlProperty); - - Q_PROPERTY(QDeclarativeScriptString scriptProperty READ scriptProperty WRITE setScriptProperty); + Q_PROPERTY(QString id READ id WRITE setId) + Q_PROPERTY(QObject *objectProperty READ objectProperty WRITE setObjectProperty) + Q_PROPERTY(QDeclarativeComponent *componentProperty READ componentProperty WRITE setComponentProperty) + Q_PROPERTY(MyFlags flagProperty READ flagProperty WRITE setFlagProperty) + Q_PROPERTY(MyEnum enumProperty READ enumProperty WRITE setEnumProperty) + Q_PROPERTY(QString stringProperty READ stringProperty WRITE setStringProperty) + Q_PROPERTY(uint uintProperty READ uintProperty WRITE setUintProperty) + Q_PROPERTY(int intProperty READ intProperty WRITE setIntProperty) + Q_PROPERTY(qreal realProperty READ realProperty WRITE setRealProperty) + Q_PROPERTY(double doubleProperty READ doubleProperty WRITE setDoubleProperty) + Q_PROPERTY(float floatProperty READ floatProperty WRITE setFloatProperty) + Q_PROPERTY(QColor colorProperty READ colorProperty WRITE setColorProperty) + Q_PROPERTY(QDate dateProperty READ dateProperty WRITE setDateProperty) + Q_PROPERTY(QTime timeProperty READ timeProperty WRITE setTimeProperty) + Q_PROPERTY(QDateTime dateTimeProperty READ dateTimeProperty WRITE setDateTimeProperty) + Q_PROPERTY(QPoint pointProperty READ pointProperty WRITE setPointProperty) + Q_PROPERTY(QPointF pointFProperty READ pointFProperty WRITE setPointFProperty) + Q_PROPERTY(QSize sizeProperty READ sizeProperty WRITE setSizeProperty) + Q_PROPERTY(QSizeF sizeFProperty READ sizeFProperty WRITE setSizeFProperty) + Q_PROPERTY(QRect rectProperty READ rectProperty WRITE setRectProperty NOTIFY rectPropertyChanged) + Q_PROPERTY(QRect rectProperty2 READ rectProperty2 WRITE setRectProperty2) + Q_PROPERTY(QRectF rectFProperty READ rectFProperty WRITE setRectFProperty) + Q_PROPERTY(bool boolProperty READ boolProperty WRITE setBoolProperty) + Q_PROPERTY(QVariant variantProperty READ variantProperty WRITE setVariantProperty) + Q_PROPERTY(QVector3D vectorProperty READ vectorProperty WRITE setVectorProperty) + Q_PROPERTY(QUrl urlProperty READ urlProperty WRITE setUrlProperty) + + Q_PROPERTY(QDeclarativeScriptString scriptProperty READ scriptProperty WRITE setScriptProperty) public: MyTypeObject() diff --git a/tests/auto/declarative/qdeclarativelanguage/testtypes.h b/tests/auto/declarative/qdeclarativelanguage/testtypes.h index df93dc8..4963e2e 100644 --- a/tests/auto/declarative/qdeclarativelanguage/testtypes.h +++ b/tests/auto/declarative/qdeclarativelanguage/testtypes.h @@ -106,8 +106,8 @@ class MyQmlObject : public QObject, public MyInterface, public QDeclarativeParse Q_PROPERTY(QRect rect READ rect WRITE setRect) Q_PROPERTY(QMatrix matrix READ matrix WRITE setMatrix) //assumed to be unsupported by QML Q_PROPERTY(MyInterface *interfaceProperty READ interface WRITE setInterface) - Q_PROPERTY(int onLiteralSignal READ onLiteralSignal WRITE setOnLiteralSignal); - Q_PROPERTY(MyCustomVariantType customType READ customType WRITE setCustomType); + Q_PROPERTY(int onLiteralSignal READ onLiteralSignal WRITE setOnLiteralSignal) + Q_PROPERTY(MyCustomVariantType customType READ customType WRITE setCustomType) Q_PROPERTY(MyQmlObject *qmlobjectProperty READ qmlobject WRITE setQmlobject) Q_PROPERTY(int propertyWithNotify READ propertyWithNotify WRITE setPropertyWithNotify NOTIFY oddlyNamedNotifySignal) @@ -135,7 +135,7 @@ public: static MyAttachedObject *qmlAttachedProperties(QObject *other) { return new MyAttachedObject(other); } - Q_CLASSINFO("DefaultMethod", "basicSlot()"); + Q_CLASSINFO("DefaultMethod", "basicSlot()") int onLiteralSignal() const { return m_value; } void setOnLiteralSignal(int v) { m_value = v; } @@ -171,8 +171,8 @@ QML_DECLARE_TYPE(MyQmlObject); class MyGroupedObject : public QObject { Q_OBJECT - Q_PROPERTY(QDeclarativeScriptString script READ script WRITE setScript); - Q_PROPERTY(int value READ value WRITE setValue); + Q_PROPERTY(QDeclarativeScriptString script READ script WRITE setScript) + Q_PROPERTY(int value READ value WRITE setValue) public: QDeclarativeScriptString script() const { return m_script; } void setScript(const QDeclarativeScriptString &s) { m_script = s; } @@ -194,36 +194,36 @@ class MyTypeObject : public QObject Q_ENUMS(MyEnum) Q_FLAGS(MyFlags) - Q_PROPERTY(QString id READ id WRITE setId); - Q_PROPERTY(QObject *objectProperty READ objectProperty WRITE setObjectProperty); - Q_PROPERTY(QDeclarativeComponent *componentProperty READ componentProperty WRITE setComponentProperty); - Q_PROPERTY(MyFlags flagProperty READ flagProperty WRITE setFlagProperty); - Q_PROPERTY(MyEnum enumProperty READ enumProperty WRITE setEnumProperty); - Q_PROPERTY(QString stringProperty READ stringProperty WRITE setStringProperty); - Q_PROPERTY(uint uintProperty READ uintProperty WRITE setUintProperty); - Q_PROPERTY(int intProperty READ intProperty WRITE setIntProperty); - Q_PROPERTY(qreal realProperty READ realProperty WRITE setRealProperty); - Q_PROPERTY(double doubleProperty READ doubleProperty WRITE setDoubleProperty); - Q_PROPERTY(float floatProperty READ floatProperty WRITE setFloatProperty); - Q_PROPERTY(QColor colorProperty READ colorProperty WRITE setColorProperty); - Q_PROPERTY(QDate dateProperty READ dateProperty WRITE setDateProperty); - Q_PROPERTY(QTime timeProperty READ timeProperty WRITE setTimeProperty); - Q_PROPERTY(QDateTime dateTimeProperty READ dateTimeProperty WRITE setDateTimeProperty); - Q_PROPERTY(QPoint pointProperty READ pointProperty WRITE setPointProperty); - Q_PROPERTY(QPointF pointFProperty READ pointFProperty WRITE setPointFProperty); - Q_PROPERTY(QSize sizeProperty READ sizeProperty WRITE setSizeProperty); - Q_PROPERTY(QSizeF sizeFProperty READ sizeFProperty WRITE setSizeFProperty); - Q_PROPERTY(QRect rectProperty READ rectProperty WRITE setRectProperty NOTIFY rectPropertyChanged); - Q_PROPERTY(QRect rectProperty2 READ rectProperty2 WRITE setRectProperty2); - Q_PROPERTY(QRectF rectFProperty READ rectFProperty WRITE setRectFProperty); - Q_PROPERTY(bool boolProperty READ boolProperty WRITE setBoolProperty); - Q_PROPERTY(QVariant variantProperty READ variantProperty WRITE setVariantProperty); - Q_PROPERTY(QVector3D vectorProperty READ vectorProperty WRITE setVectorProperty); - Q_PROPERTY(QUrl urlProperty READ urlProperty WRITE setUrlProperty); - - Q_PROPERTY(QDeclarativeScriptString scriptProperty READ scriptProperty WRITE setScriptProperty); - Q_PROPERTY(MyGroupedObject *grouped READ grouped CONSTANT); - Q_PROPERTY(MyGroupedObject *nullGrouped READ nullGrouped CONSTANT); + Q_PROPERTY(QString id READ id WRITE setId) + Q_PROPERTY(QObject *objectProperty READ objectProperty WRITE setObjectProperty) + Q_PROPERTY(QDeclarativeComponent *componentProperty READ componentProperty WRITE setComponentProperty) + Q_PROPERTY(MyFlags flagProperty READ flagProperty WRITE setFlagProperty) + Q_PROPERTY(MyEnum enumProperty READ enumProperty WRITE setEnumProperty) + Q_PROPERTY(QString stringProperty READ stringProperty WRITE setStringProperty) + Q_PROPERTY(uint uintProperty READ uintProperty WRITE setUintProperty) + Q_PROPERTY(int intProperty READ intProperty WRITE setIntProperty) + Q_PROPERTY(qreal realProperty READ realProperty WRITE setRealProperty) + Q_PROPERTY(double doubleProperty READ doubleProperty WRITE setDoubleProperty) + Q_PROPERTY(float floatProperty READ floatProperty WRITE setFloatProperty) + Q_PROPERTY(QColor colorProperty READ colorProperty WRITE setColorProperty) + Q_PROPERTY(QDate dateProperty READ dateProperty WRITE setDateProperty) + Q_PROPERTY(QTime timeProperty READ timeProperty WRITE setTimeProperty) + Q_PROPERTY(QDateTime dateTimeProperty READ dateTimeProperty WRITE setDateTimeProperty) + Q_PROPERTY(QPoint pointProperty READ pointProperty WRITE setPointProperty) + Q_PROPERTY(QPointF pointFProperty READ pointFProperty WRITE setPointFProperty) + Q_PROPERTY(QSize sizeProperty READ sizeProperty WRITE setSizeProperty) + Q_PROPERTY(QSizeF sizeFProperty READ sizeFProperty WRITE setSizeFProperty) + Q_PROPERTY(QRect rectProperty READ rectProperty WRITE setRectProperty NOTIFY rectPropertyChanged) + Q_PROPERTY(QRect rectProperty2 READ rectProperty2 WRITE setRectProperty2) + Q_PROPERTY(QRectF rectFProperty READ rectFProperty WRITE setRectFProperty) + Q_PROPERTY(bool boolProperty READ boolProperty WRITE setBoolProperty) + Q_PROPERTY(QVariant variantProperty READ variantProperty WRITE setVariantProperty) + Q_PROPERTY(QVector3D vectorProperty READ vectorProperty WRITE setVectorProperty) + Q_PROPERTY(QUrl urlProperty READ urlProperty WRITE setUrlProperty) + + Q_PROPERTY(QDeclarativeScriptString scriptProperty READ scriptProperty WRITE setScriptProperty) + Q_PROPERTY(MyGroupedObject *grouped READ grouped CONSTANT) + Q_PROPERTY(MyGroupedObject *nullGrouped READ nullGrouped CONSTANT) public: MyTypeObject() @@ -467,7 +467,7 @@ class MyContainer : public QObject Q_OBJECT Q_PROPERTY(QDeclarativeListProperty<QObject> children READ children) Q_PROPERTY(QDeclarativeListProperty<MyInterface> qlistInterfaces READ qlistInterfaces) - Q_CLASSINFO("DefaultProperty", "children"); + Q_CLASSINFO("DefaultProperty", "children") public: MyContainer() {} @@ -549,7 +549,7 @@ namespace MyNamespace { class MySecondNamespacedType : public QObject { Q_OBJECT - Q_PROPERTY(QDeclarativeListProperty<MyNamespace::MyNamespacedType> list READ list); + Q_PROPERTY(QDeclarativeListProperty<MyNamespace::MyNamespacedType> list READ list) public: QDeclarativeListProperty<MyNamespacedType> list() { return QDeclarativeListProperty<MyNamespacedType>(this, m_list); } diff --git a/tests/auto/declarative/qdeclarativelistreference/tst_qdeclarativelistreference.cpp b/tests/auto/declarative/qdeclarativelistreference/tst_qdeclarativelistreference.cpp index f3c72d1..908f336 100644 --- a/tests/auto/declarative/qdeclarativelistreference/tst_qdeclarativelistreference.cpp +++ b/tests/auto/declarative/qdeclarativelistreference/tst_qdeclarativelistreference.cpp @@ -91,8 +91,8 @@ private slots: class TestType : public QObject { Q_OBJECT - Q_PROPERTY(QDeclarativeListProperty<TestType> data READ dataProperty); - Q_PROPERTY(int intProperty READ intProperty); + Q_PROPERTY(QDeclarativeListProperty<TestType> data READ dataProperty) + Q_PROPERTY(int intProperty READ intProperty) public: TestType() : property(this, data) {} diff --git a/tests/auto/declarative/qdeclarativemetatype/tst_qdeclarativemetatype.cpp b/tests/auto/declarative/qdeclarativemetatype/tst_qdeclarativemetatype.cpp index 279a9b7..36efe13 100644 --- a/tests/auto/declarative/qdeclarativemetatype/tst_qdeclarativemetatype.cpp +++ b/tests/auto/declarative/qdeclarativemetatype/tst_qdeclarativemetatype.cpp @@ -77,9 +77,9 @@ private slots: class TestType : public QObject { Q_OBJECT - Q_PROPERTY(int foo READ foo); + Q_PROPERTY(int foo READ foo) - Q_CLASSINFO("DefaultProperty", "foo"); + Q_CLASSINFO("DefaultProperty", "foo") public: int foo() { return 0; } }; @@ -88,7 +88,7 @@ QML_DECLARE_TYPE(TestType); class ParserStatusTestType : public QObject, public QDeclarativeParserStatus { Q_OBJECT - Q_CLASSINFO("DefaultProperty", "foo"); // Missing default property + Q_CLASSINFO("DefaultProperty", "foo") // Missing default property }; QML_DECLARE_TYPE(ParserStatusTestType); diff --git a/tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp b/tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp index 76c5403..eed12ea 100644 --- a/tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp +++ b/tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp @@ -183,15 +183,15 @@ void tst_qdeclarativeproperty::qmlmetaproperty() class PropertyObject : public QObject { Q_OBJECT - Q_PROPERTY(int defaultProperty READ defaultProperty); - Q_PROPERTY(QRect rectProperty READ rectProperty); - Q_PROPERTY(QRect wrectProperty READ wrectProperty WRITE setWRectProperty); - Q_PROPERTY(QUrl url READ url WRITE setUrl); - Q_PROPERTY(int resettableProperty READ resettableProperty WRITE setResettableProperty RESET resetProperty); + Q_PROPERTY(int defaultProperty READ defaultProperty) + Q_PROPERTY(QRect rectProperty READ rectProperty) + Q_PROPERTY(QRect wrectProperty READ wrectProperty WRITE setWRectProperty) + Q_PROPERTY(QUrl url READ url WRITE setUrl) + Q_PROPERTY(int resettableProperty READ resettableProperty WRITE setResettableProperty RESET resetProperty) Q_PROPERTY(int propertyWithNotify READ propertyWithNotify WRITE setPropertyWithNotify NOTIFY oddlyNamedNotifySignal) - Q_PROPERTY(MyQmlObject *qmlObject READ qmlObject); + Q_PROPERTY(MyQmlObject *qmlObject READ qmlObject) - Q_CLASSINFO("DefaultProperty", "defaultProperty"); + Q_CLASSINFO("DefaultProperty", "defaultProperty") public: PropertyObject() : m_resetProperty(9) {} diff --git a/tests/auto/declarative/qdeclarativevaluetypes/testtypes.h b/tests/auto/declarative/qdeclarativevaluetypes/testtypes.h index dfc2829..0ad8449 100644 --- a/tests/auto/declarative/qdeclarativevaluetypes/testtypes.h +++ b/tests/auto/declarative/qdeclarativevaluetypes/testtypes.h @@ -59,14 +59,14 @@ class MyTypeObject : public QObject { Q_OBJECT - Q_PROPERTY(QPoint point READ point WRITE setPoint NOTIFY changed); - Q_PROPERTY(QPointF pointf READ pointf WRITE setPointf NOTIFY changed); - Q_PROPERTY(QSize size READ size WRITE setSize NOTIFY changed); - Q_PROPERTY(QSizeF sizef READ sizef WRITE setSizef NOTIFY changed); - Q_PROPERTY(QRect rect READ rect WRITE setRect NOTIFY changed); - Q_PROPERTY(QRectF rectf READ rectf WRITE setRectf NOTIFY changed); - Q_PROPERTY(QVector3D vector READ vector WRITE setVector NOTIFY changed); - Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY changed); + Q_PROPERTY(QPoint point READ point WRITE setPoint NOTIFY changed) + Q_PROPERTY(QPointF pointf READ pointf WRITE setPointf NOTIFY changed) + Q_PROPERTY(QSize size READ size WRITE setSize NOTIFY changed) + Q_PROPERTY(QSizeF sizef READ sizef WRITE setSizef NOTIFY changed) + Q_PROPERTY(QRect rect READ rect WRITE setRect NOTIFY changed) + Q_PROPERTY(QRectF rectf READ rectf WRITE setRectf NOTIFY changed) + Q_PROPERTY(QVector3D vector READ vector WRITE setVector NOTIFY changed) + Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY changed) public: MyTypeObject() : diff --git a/tests/auto/qdbuscontext/tst_qdbuscontext.cpp b/tests/auto/qdbuscontext/tst_qdbuscontext.cpp index be62d5b..2b7ac06 100644 --- a/tests/auto/qdbuscontext/tst_qdbuscontext.cpp +++ b/tests/auto/qdbuscontext/tst_qdbuscontext.cpp @@ -47,7 +47,7 @@ const char errorMsg[] = "A generic error"; class TestObject: public QObject, protected QDBusContext { Q_OBJECT - Q_CLASSINFO("D-Bus Interface", "com.trolltech.tst_QDBusContext.TestObject"); + Q_CLASSINFO("D-Bus Interface", "com.trolltech.tst_QDBusContext.TestObject") public: inline TestObject(QObject *parent) : QObject(parent) { } public Q_SLOTS: diff --git a/tests/auto/qfilesystemwatcher/tst_qfilesystemwatcher.cpp b/tests/auto/qfilesystemwatcher/tst_qfilesystemwatcher.cpp index 901099d..7138905 100644 --- a/tests/auto/qfilesystemwatcher/tst_qfilesystemwatcher.cpp +++ b/tests/auto/qfilesystemwatcher/tst_qfilesystemwatcher.cpp @@ -405,7 +405,7 @@ void tst_QFileSystemWatcher::removePaths() #if 0 class SignalTest : public QObject { - Q_OBJECT; + Q_OBJECT public slots: void fileSlot(const QString &file) { qDebug() << "file " << file;} void dirSlot(const QString &dir) { qDebug() << "dir" << dir;} diff --git a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp index 16a621a..fa3e0f9 100644 --- a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp +++ b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp @@ -48,7 +48,7 @@ #include <QtGui/qwindowsstyle.h> class tst_QGraphicsAnchorLayout : public QObject { - Q_OBJECT; + Q_OBJECT public: tst_QGraphicsAnchorLayout() : QObject() { diff --git a/tests/auto/qnetworkaccessmanager_and_qprogressdialog/tst_qnetworkaccessmanager_and_qprogressdialog.cpp b/tests/auto/qnetworkaccessmanager_and_qprogressdialog/tst_qnetworkaccessmanager_and_qprogressdialog.cpp index a813110..99d775d 100644 --- a/tests/auto/qnetworkaccessmanager_and_qprogressdialog/tst_qnetworkaccessmanager_and_qprogressdialog.cpp +++ b/tests/auto/qnetworkaccessmanager_and_qprogressdialog/tst_qnetworkaccessmanager_and_qprogressdialog.cpp @@ -62,7 +62,7 @@ private slots: class DownloadCheckWidget : public QWidget { - Q_OBJECT; + Q_OBJECT public: DownloadCheckWidget(QWidget *parent = 0) : QWidget(parent) , progressDlg(this), netmanager(this) diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp index 76e69c5..e11900e 100644 --- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp @@ -3952,7 +3952,7 @@ void tst_QNetworkReply::httpReUsingConnectionSequential() } class HttpReUsingConnectionFromFinishedSlot : public QObject { - Q_OBJECT; + Q_OBJECT public: QNetworkReply* reply1; QNetworkReply* reply2; diff --git a/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp b/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp index 56eaf25..2339b21 100644 --- a/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp +++ b/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp @@ -139,6 +139,8 @@ private slots: void taskQTBUG_7537_appearsAndSort(); void taskQTBUG_7716_unnecessaryDynamicSorting(); + void testMultipleProxiesWithSelection(); + protected: void buildHierarchy(const QStringList &data, QAbstractItemModel *model); void checkHierarchy(const QStringList &data, const QAbstractItemModel *model); @@ -2951,5 +2953,90 @@ void tst_QSortFilterProxyModel::taskQTBUG_7716_unnecessaryDynamicSorting() } } +class SelectionProxyModel : QAbstractProxyModel +{ + Q_OBJECT +public: + SelectionProxyModel() + : QAbstractProxyModel(), selectionModel(0) + { + } + + QModelIndex mapFromSource(QModelIndex const&) const + { return QModelIndex(); } + + QModelIndex mapToSource(QModelIndex const&) const + { return QModelIndex(); } + + QModelIndex index(int, int, const QModelIndex&) const + { return QModelIndex(); } + + QModelIndex parent(const QModelIndex&) const + { return QModelIndex(); } + + int rowCount(const QModelIndex&) const + { return 0; } + + int columnCount(const QModelIndex&) const + { return 0; } + + void setSourceModel( QAbstractItemModel *sourceModel ) + { + beginResetModel(); + disconnect( sourceModel, SIGNAL(modelAboutToBeReset()), this, SLOT(sourceModelAboutToBeReset()) ); + QAbstractProxyModel::setSourceModel( sourceModel ); + connect( sourceModel, SIGNAL(modelAboutToBeReset()), this, SLOT(sourceModelAboutToBeReset()) ); + endResetModel(); + } + + void setSelectionModel( QItemSelectionModel *_selectionModel ) + { + selectionModel = _selectionModel; + } + +private slots: + void sourceModelAboutToBeReset() + { + QVERIFY( selectionModel->selectedIndexes().size() == 1 ); + beginResetModel(); + } + + void sourceModelReset() + { + endResetModel(); + } + +private: + QItemSelectionModel *selectionModel; + +}; + +void tst_QSortFilterProxyModel::testMultipleProxiesWithSelection() +{ + QStringListModel model; + const QStringList initial = QString("bravo charlie delta echo").split(" "); + model.setStringList(initial); + + QSortFilterProxyModel proxy; + proxy.setSourceModel( &model ); + + SelectionProxyModel proxy1; + QSortFilterProxyModel proxy2; + + // Note that the order here matters. The order of the sourceAboutToBeReset + // exposes the bug in QSortFilterProxyModel. + proxy2.setSourceModel( &proxy ); + proxy1.setSourceModel( &proxy ); + + QItemSelectionModel selectionModel(&proxy2); + proxy1.setSelectionModel( &selectionModel ); + + selectionModel.select( proxy2.index( 0, 0 ), QItemSelectionModel::Select ); + + // trick the proxy into emitting begin/end reset signals. + proxy.setSourceModel(0); + +} + QTEST_MAIN(tst_QSortFilterProxyModel) #include "tst_qsortfilterproxymodel.moc" diff --git a/tests/auto/qvideowidget/tst_qvideowidget.cpp b/tests/auto/qvideowidget/tst_qvideowidget.cpp index f703055..f1eef50 100644 --- a/tests/auto/qvideowidget/tst_qvideowidget.cpp +++ b/tests/auto/qvideowidget/tst_qvideowidget.cpp @@ -120,7 +120,7 @@ private: void color_data(); }; -Q_DECLARE_METATYPE(QVideoWidget::AspectRatioMode) +Q_DECLARE_METATYPE(Qt::AspectRatioMode) Q_DECLARE_METATYPE(const uchar *) class QtTestOutputControl : public QVideoOutputControl @@ -148,7 +148,7 @@ public: , m_brightness(0) , m_contrast(0) , m_saturation(0) - , m_aspectRatioMode(QVideoWidget::KeepAspectRatio) + , m_aspectRatioMode(Qt::KeepAspectRatio) , m_fullScreen(0) { } @@ -169,8 +169,8 @@ public: QSize nativeSize() const { return m_nativeSize; } void setNativeSize(const QSize &size) { m_nativeSize = size; emit nativeSizeChanged(); } - QVideoWidget::AspectRatioMode aspectRatioMode() const { return m_aspectRatioMode; } - void setAspectRatioMode(QVideoWidget::AspectRatioMode mode) { m_aspectRatioMode = mode; } + Qt::AspectRatioMode aspectRatioMode() const { return m_aspectRatioMode; } + void setAspectRatioMode(Qt::AspectRatioMode mode) { m_aspectRatioMode = mode; } int brightness() const { return m_brightness; } void setBrightness(int brightness) { emit brightnessChanged(m_brightness = brightness); } @@ -191,7 +191,7 @@ private: int m_contrast; int m_hue; int m_saturation; - QVideoWidget::AspectRatioMode m_aspectRatioMode; + Qt::AspectRatioMode m_aspectRatioMode; QRect m_displayRect; QSize m_nativeSize; bool m_fullScreen; @@ -205,7 +205,7 @@ public: , m_contrast(1.0) , m_hue(1.0) , m_saturation(1.0) - , m_aspectRatioMode(QVideoWidget::KeepAspectRatio) + , m_aspectRatioMode(Qt::KeepAspectRatio) , m_fullScreen(false) { } @@ -213,8 +213,8 @@ public: bool isFullScreen() const { return m_fullScreen; } void setFullScreen(bool fullScreen) { emit fullScreenChanged(m_fullScreen = fullScreen); } - QVideoWidget::AspectRatioMode aspectRatioMode() const { return m_aspectRatioMode; } - void setAspectRatioMode(QVideoWidget::AspectRatioMode mode) { m_aspectRatioMode = mode; } + Qt::AspectRatioMode aspectRatioMode() const { return m_aspectRatioMode; } + void setAspectRatioMode(Qt::AspectRatioMode mode) { m_aspectRatioMode = mode; } int brightness() const { return m_brightness; } void setBrightness(int brightness) { emit brightnessChanged(m_brightness = brightness); } @@ -245,7 +245,7 @@ private: int m_contrast; int m_hue; int m_saturation; - QVideoWidget::AspectRatioMode m_aspectRatioMode; + Qt::AspectRatioMode m_aspectRatioMode; QSize m_sizeHint; bool m_fullScreen; }; @@ -358,8 +358,8 @@ void tst_QVideoWidget::nullObject() QTest::qWaitForWindowShown(&widget); QCOMPARE(widget.isFullScreen(), true); - widget.setAspectRatioMode(QVideoWidget::IgnoreAspectRatio); - QCOMPARE(widget.aspectRatioMode(), QVideoWidget::IgnoreAspectRatio); + widget.setAspectRatioMode(Qt::IgnoreAspectRatio); + QCOMPARE(widget.aspectRatioMode(), Qt::IgnoreAspectRatio); { QSignalSpy spy(&widget, SIGNAL(brightnessChanged(int))); @@ -443,8 +443,8 @@ void tst_QVideoWidget::nullService() QTest::qWaitForWindowShown(&widget); QCOMPARE(widget.isFullScreen(), true); - widget.setAspectRatioMode(QVideoWidget::IgnoreAspectRatio); - QCOMPARE(widget.aspectRatioMode(), QVideoWidget::IgnoreAspectRatio); + widget.setAspectRatioMode(Qt::IgnoreAspectRatio); + QCOMPARE(widget.aspectRatioMode(), Qt::IgnoreAspectRatio); widget.setBrightness(100); QCOMPARE(widget.brightness(), 100); @@ -711,65 +711,65 @@ void tst_QVideoWidget::showRendererControl() void tst_QVideoWidget::aspectRatioWindowControl() { QtTestVideoObject object(new QtTestWindowControl, 0, 0); - object.testService->windowControl->setAspectRatioMode(QVideoWidget::IgnoreAspectRatio); + object.testService->windowControl->setAspectRatioMode(Qt::IgnoreAspectRatio); QVideoWidget widget; widget.setMediaObject(&object); widget.setWindowFlags(Qt::X11BypassWindowManagerHint); // Test the aspect ratio defaults to keeping the aspect ratio. - QCOMPARE(widget.aspectRatioMode(), QVideoWidget::KeepAspectRatio); + QCOMPARE(widget.aspectRatioMode(), Qt::KeepAspectRatio); // Test the control has been informed of the aspect ratio change, post show. widget.show(); QTest::qWaitForWindowShown(&widget); - QCOMPARE(widget.aspectRatioMode(), QVideoWidget::KeepAspectRatio); - QCOMPARE(object.testService->windowControl->aspectRatioMode(), QVideoWidget::KeepAspectRatio); + QCOMPARE(widget.aspectRatioMode(), Qt::KeepAspectRatio); + QCOMPARE(object.testService->windowControl->aspectRatioMode(), Qt::KeepAspectRatio); // Test an aspect ratio change is enforced immediately while visible. - widget.setAspectRatioMode(QVideoWidget::IgnoreAspectRatio); - QCOMPARE(widget.aspectRatioMode(), QVideoWidget::IgnoreAspectRatio); - QCOMPARE(object.testService->windowControl->aspectRatioMode(), QVideoWidget::IgnoreAspectRatio); + widget.setAspectRatioMode(Qt::IgnoreAspectRatio); + QCOMPARE(widget.aspectRatioMode(), Qt::IgnoreAspectRatio); + QCOMPARE(object.testService->windowControl->aspectRatioMode(), Qt::IgnoreAspectRatio); // Test an aspect ratio set while not visible is respected. widget.hide(); - widget.setAspectRatioMode(QVideoWidget::KeepAspectRatio); - QCOMPARE(widget.aspectRatioMode(), QVideoWidget::KeepAspectRatio); + widget.setAspectRatioMode(Qt::KeepAspectRatio); + QCOMPARE(widget.aspectRatioMode(), Qt::KeepAspectRatio); widget.show(); - QCOMPARE(widget.aspectRatioMode(), QVideoWidget::KeepAspectRatio); - QCOMPARE(object.testService->windowControl->aspectRatioMode(), QVideoWidget::KeepAspectRatio); + QCOMPARE(widget.aspectRatioMode(), Qt::KeepAspectRatio); + QCOMPARE(object.testService->windowControl->aspectRatioMode(), Qt::KeepAspectRatio); } void tst_QVideoWidget::aspectRatioWidgetControl() { QtTestVideoObject object(0, new QtTestWidgetControl, 0); - object.testService->widgetControl->setAspectRatioMode(QVideoWidget::IgnoreAspectRatio); + object.testService->widgetControl->setAspectRatioMode(Qt::IgnoreAspectRatio); QVideoWidget widget; widget.setMediaObject(&object); widget.setWindowFlags(Qt::X11BypassWindowManagerHint); // Test the aspect ratio defaults to keeping the aspect ratio. - QCOMPARE(widget.aspectRatioMode(), QVideoWidget::KeepAspectRatio); + QCOMPARE(widget.aspectRatioMode(), Qt::KeepAspectRatio); // Test the control has been informed of the aspect ratio change, post show. widget.show(); QTest::qWaitForWindowShown(&widget); - QCOMPARE(widget.aspectRatioMode(), QVideoWidget::KeepAspectRatio); - QCOMPARE(object.testService->widgetControl->aspectRatioMode(), QVideoWidget::KeepAspectRatio); + QCOMPARE(widget.aspectRatioMode(), Qt::KeepAspectRatio); + QCOMPARE(object.testService->widgetControl->aspectRatioMode(), Qt::KeepAspectRatio); // Test an aspect ratio change is enforced immediately while visible. - widget.setAspectRatioMode(QVideoWidget::IgnoreAspectRatio); - QCOMPARE(widget.aspectRatioMode(), QVideoWidget::IgnoreAspectRatio); - QCOMPARE(object.testService->widgetControl->aspectRatioMode(), QVideoWidget::IgnoreAspectRatio); + widget.setAspectRatioMode(Qt::IgnoreAspectRatio); + QCOMPARE(widget.aspectRatioMode(), Qt::IgnoreAspectRatio); + QCOMPARE(object.testService->widgetControl->aspectRatioMode(), Qt::IgnoreAspectRatio); // Test an aspect ratio set while not visible is respected. widget.hide(); - widget.setAspectRatioMode(QVideoWidget::KeepAspectRatio); - QCOMPARE(widget.aspectRatioMode(), QVideoWidget::KeepAspectRatio); + widget.setAspectRatioMode(Qt::KeepAspectRatio); + QCOMPARE(widget.aspectRatioMode(), Qt::KeepAspectRatio); widget.show(); - QCOMPARE(widget.aspectRatioMode(), QVideoWidget::KeepAspectRatio); - QCOMPARE(object.testService->widgetControl->aspectRatioMode(), QVideoWidget::KeepAspectRatio); + QCOMPARE(widget.aspectRatioMode(), Qt::KeepAspectRatio); + QCOMPARE(object.testService->widgetControl->aspectRatioMode(), Qt::KeepAspectRatio); } void tst_QVideoWidget::aspectRatioRendererControl() @@ -781,23 +781,23 @@ void tst_QVideoWidget::aspectRatioRendererControl() widget.setWindowFlags(Qt::X11BypassWindowManagerHint); // Test the aspect ratio defaults to keeping the aspect ratio. - QCOMPARE(widget.aspectRatioMode(), QVideoWidget::KeepAspectRatio); + QCOMPARE(widget.aspectRatioMode(), Qt::KeepAspectRatio); // Test the control has been informed of the aspect ratio change, post show. widget.show(); QTest::qWaitForWindowShown(&widget); - QCOMPARE(widget.aspectRatioMode(), QVideoWidget::KeepAspectRatio); + QCOMPARE(widget.aspectRatioMode(), Qt::KeepAspectRatio); // Test an aspect ratio change is enforced immediately while visible. - widget.setAspectRatioMode(QVideoWidget::IgnoreAspectRatio); - QCOMPARE(widget.aspectRatioMode(), QVideoWidget::IgnoreAspectRatio); + widget.setAspectRatioMode(Qt::IgnoreAspectRatio); + QCOMPARE(widget.aspectRatioMode(), Qt::IgnoreAspectRatio); // Test an aspect ratio set while not visible is respected. widget.hide(); - widget.setAspectRatioMode(QVideoWidget::KeepAspectRatio); - QCOMPARE(widget.aspectRatioMode(), QVideoWidget::KeepAspectRatio); + widget.setAspectRatioMode(Qt::KeepAspectRatio); + QCOMPARE(widget.aspectRatioMode(), Qt::KeepAspectRatio); widget.show(); - QCOMPARE(widget.aspectRatioMode(), QVideoWidget::KeepAspectRatio); + QCOMPARE(widget.aspectRatioMode(), Qt::KeepAspectRatio); } void tst_QVideoWidget::sizeHint_data() |