diff options
Diffstat (limited to 'src/quick')
-rw-r--r-- | src/quick/doc/src/appdevguide/porting.qdoc | 2 | ||||
-rw-r--r-- | src/quick/doc/src/appdevguide/qtquicktest.qdoc | 3 | ||||
-rw-r--r-- | src/quick/items/qquickflickable.cpp | 19 | ||||
-rw-r--r-- | src/quick/items/qquickflickable_p_p.h | 2 | ||||
-rw-r--r-- | src/quick/items/qquickitem.h | 2 | ||||
-rw-r--r-- | src/quick/items/qquicktextinput.cpp | 3 | ||||
-rw-r--r-- | src/quick/items/qquickthreadedwindowmanager.cpp | 12 | ||||
-rw-r--r-- | src/quick/items/qquickthreadedwindowmanager_p.h | 1 | ||||
-rw-r--r-- | src/quick/items/qquickview.cpp | 25 | ||||
-rw-r--r-- | src/quick/items/qquickview.h | 2 | ||||
-rw-r--r-- | src/quick/items/qquickwindow.cpp | 46 | ||||
-rw-r--r-- | src/quick/items/qquickwindowmanager.cpp | 7 | ||||
-rw-r--r-- | src/quick/util/qquickapplication.cpp | 7 | ||||
-rw-r--r-- | src/quick/util/qquickapplication_p.h | 2 |
14 files changed, 101 insertions, 32 deletions
diff --git a/src/quick/doc/src/appdevguide/porting.qdoc b/src/quick/doc/src/appdevguide/porting.qdoc index 3ac13cd255..6bb2a75074 100644 --- a/src/quick/doc/src/appdevguide/porting.qdoc +++ b/src/quick/doc/src/appdevguide/porting.qdoc @@ -190,7 +190,7 @@ new applications.) \section3 QDeclarativeItem and QDeclarativeView When porting to QQuickItem, note that QDeclarativeItem inherited from QGraphicsItem; in contrast, -QQuickItem inherits directly from QObject, and any QGraphicsItem-specific functionality is longer +QQuickItem inherits directly from QObject, and any QGraphicsItem-specific functionality is no longer available. In particular, QQuickItem does not have a \c paint() method for performing custom rendering through the QPainter API. Instead, in Qt 5, custom rendering should be performed through the new \c QSG* classes to take full advantage of the scene graph. See the \l {Qt Quick Scene Graph} diff --git a/src/quick/doc/src/appdevguide/qtquicktest.qdoc b/src/quick/doc/src/appdevguide/qtquicktest.qdoc index 4db6f4ba58..c577a90be1 100644 --- a/src/quick/doc/src/appdevguide/qtquicktest.qdoc +++ b/src/quick/doc/src/appdevguide/qtquicktest.qdoc @@ -95,9 +95,6 @@ tst_example -input /mnt/SDCard/qmltests \endcode - See \c{tests/qmlauto} in the source tree for an example of creating a - test harness that uses the \c{QUICK_TEST_SOURCE_DIR} macro. - If your test case needs QML imports, then you can add them as \c{-import} options to the the test program command-line by adding the following line to your .pro file: diff --git a/src/quick/items/qquickflickable.cpp b/src/quick/items/qquickflickable.cpp index a15f77d3ce..a0bd1fab8e 100644 --- a/src/quick/items/qquickflickable.cpp +++ b/src/quick/items/qquickflickable.cpp @@ -974,10 +974,10 @@ void QQuickFlickablePrivate::handleMousePressEvent(QMouseEvent *event) hData.reset(); vData.reset(); - hData.dragMinBound = q->minXExtent(); - vData.dragMinBound = q->minYExtent(); - hData.dragMaxBound = q->maxXExtent(); - vData.dragMaxBound = q->maxYExtent(); + hData.dragMinBound = q->minXExtent() - hData.startMargin; + vData.dragMinBound = q->minYExtent() - vData.startMargin; + hData.dragMaxBound = q->maxXExtent() + hData.endMargin; + vData.dragMaxBound = q->maxYExtent() + vData.endMargin; fixupMode = Normal; lastPos = QPointF(); pressPos = event->localPos(); @@ -1021,8 +1021,11 @@ void QQuickFlickablePrivate::handleMouseMoveEvent(QMouseEvent *event) if (!vMoved) vData.dragStartOffset = dy; qreal newY = dy + vData.pressPos - vData.dragStartOffset; - const qreal minY = vData.dragMinBound; - const qreal maxY = vData.dragMaxBound; + // Recalculate bounds in case margins have changed, but use the content + // size estimate taken at the start of the drag in case the drag causes + // the estimate to be altered + const qreal minY = vData.dragMinBound + vData.startMargin; + const qreal maxY = vData.dragMaxBound - vData.endMargin; if (newY > minY) newY = minY + (newY - minY) / 2; if (newY < maxY && maxY - minY <= 0) @@ -1055,8 +1058,8 @@ void QQuickFlickablePrivate::handleMouseMoveEvent(QMouseEvent *event) if (!hMoved) hData.dragStartOffset = dx; qreal newX = dx + hData.pressPos - hData.dragStartOffset; - const qreal minX = hData.dragMinBound; - const qreal maxX = hData.dragMaxBound; + const qreal minX = hData.dragMinBound + hData.startMargin; + const qreal maxX = hData.dragMaxBound - hData.endMargin; if (newX > minX) newX = minX + (newX - minX) / 2; if (newX < maxX && maxX - minX <= 0) diff --git a/src/quick/items/qquickflickable_p_p.h b/src/quick/items/qquickflickable_p_p.h index ab5f03f34d..ac1ecdb3cb 100644 --- a/src/quick/items/qquickflickable_p_p.h +++ b/src/quick/items/qquickflickable_p_p.h @@ -104,7 +104,7 @@ public: , viewSize(-1), startMargin(0), endMargin(0) , origin(0) , transitionTo(0) - , continuousFlickVelocity(0), vTime(0) + , continuousFlickVelocity(0), velocityTime(), vTime(0) , smoothVelocity(fp), atEnd(false), atBeginning(true) , transitionToSet(false) , fixingUp(false), inOvershoot(false), moving(false), flicking(false) diff --git a/src/quick/items/qquickitem.h b/src/quick/items/qquickitem.h index fa6aa62907..af79a08b1c 100644 --- a/src/quick/items/qquickitem.h +++ b/src/quick/items/qquickitem.h @@ -139,7 +139,7 @@ class Q_QUICK_EXPORT QQuickItem : public QObject, public QQmlParserStatus Q_PROPERTY(qreal rotation READ rotation WRITE setRotation NOTIFY rotationChanged) Q_PROPERTY(qreal scale READ scale WRITE setScale NOTIFY scaleChanged) Q_PROPERTY(TransformOrigin transformOrigin READ transformOrigin WRITE setTransformOrigin NOTIFY transformOriginChanged) - Q_PROPERTY(QPointF transformOriginPoint READ transformOriginPoint) // XXX todo - notify? + Q_PROPERTY(QPointF transformOriginPoint READ transformOriginPoint) // deprecated - see QTBUG-26423 Q_PROPERTY(QQmlListProperty<QQuickTransform> transform READ transform DESIGNABLE false FINAL) Q_PROPERTY(bool smooth READ smooth WRITE setSmooth NOTIFY smoothChanged) diff --git a/src/quick/items/qquicktextinput.cpp b/src/quick/items/qquicktextinput.cpp index 22551c9d4c..88e6d750eb 100644 --- a/src/quick/items/qquicktextinput.cpp +++ b/src/quick/items/qquicktextinput.cpp @@ -2698,6 +2698,9 @@ void QQuickTextInputPrivate::updateLayout() option.setTextDirection(layoutDirection()); option.setWrapMode(QTextOption::WrapMode(wrapMode)); option.setAlignment(Qt::Alignment(q->effectiveHAlign())); + if (!qmlDisableDistanceField()) + option.setUseDesignMetrics(renderType != QQuickTextInput::NativeRendering); + m_textLayout.setTextOption(option); m_textLayout.setFont(font); diff --git a/src/quick/items/qquickthreadedwindowmanager.cpp b/src/quick/items/qquickthreadedwindowmanager.cpp index fac4fb034f..4c38686298 100644 --- a/src/quick/items/qquickthreadedwindowmanager.cpp +++ b/src/quick/items/qquickthreadedwindowmanager.cpp @@ -184,6 +184,7 @@ void QQuickRenderThreadSingleContextWindowManager::handleAddedWindow(QQuickWindo data->sizeWasChanged = false; data->windowSize = window->size(); data->isVisible = window->isVisible(); + data->isRenderable = QQuickWindowPrivate::get(window)->isRenderable(); m_rendered_windows[window] = data; isExternalUpdatePending = true; @@ -397,7 +398,9 @@ void QQuickRenderThreadSingleContextWindowManager::run() WindowData *windowData = it.value(); QQuickWindowPrivate *windowPrivate = QQuickWindowPrivate::get(window); - if (windowPrivate->isRenderable()) { + windowData->isRenderable = windowPrivate->isRenderable(); + + if (windowData->isRenderable) { gl->makeCurrent(window); if (windowData->viewportSize != windowData->windowSize) { @@ -410,10 +413,6 @@ void QQuickRenderThreadSingleContextWindowManager::run() } windowPrivate->syncSceneGraph(); - } else { - qWarning().nospace() - << "Non-renderable window " << window - << " (" << window->geometry() << ")."; } } inSync = false; @@ -435,6 +434,9 @@ void QQuickRenderThreadSingleContextWindowManager::run() WindowData *windowData = it.value(); QQuickWindowPrivate *windowPrivate = QQuickWindowPrivate::get(window); + if (!windowData->isRenderable) + continue; + #ifdef THREAD_DEBUG printf(" RenderThread: Rendering window %p\n", window); #endif diff --git a/src/quick/items/qquickthreadedwindowmanager_p.h b/src/quick/items/qquickthreadedwindowmanager_p.h index 9e28d87eef..b71620f933 100644 --- a/src/quick/items/qquickthreadedwindowmanager_p.h +++ b/src/quick/items/qquickthreadedwindowmanager_p.h @@ -159,6 +159,7 @@ private: uint sizeWasChanged : 1; uint isVisible : 1; + uint isRenderable : 1; }; QHash<QQuickWindow *, WindowData *> m_rendered_windows; diff --git a/src/quick/items/qquickview.cpp b/src/quick/items/qquickview.cpp index 7182e74c0c..befba37515 100644 --- a/src/quick/items/qquickview.cpp +++ b/src/quick/items/qquickview.cpp @@ -236,6 +236,31 @@ void QQuickView::setSource(const QUrl& url) } /*! + \internal + + Set the source \a url, \a component and content \a item (root of the QML object hierarchy) directly. + */ +void QQuickView::setContent(const QUrl& url, QQmlComponent *component, QObject* item) +{ + Q_D(QQuickView); + d->source = url; + d->component = component; + + if (d->component && d->component->isError()) { + QList<QQmlError> errorList = d->component->errors(); + foreach (const QQmlError &error, errorList) { + QMessageLogger(error.url().toString().toLatin1().constData(), error.line(), 0).warning() + << error; + } + emit statusChanged(status()); + return; + } + + d->setRootObject(item); + emit statusChanged(status()); +} + +/*! Returns the source URL, if set. \sa setSource() diff --git a/src/quick/items/qquickview.h b/src/quick/items/qquickview.h index 756890e7ec..4a885bc993 100644 --- a/src/quick/items/qquickview.h +++ b/src/quick/items/qquickview.h @@ -54,6 +54,7 @@ class QQmlEngine; class QQmlContext; class QQmlError; class QQuickItem; +class QQmlComponent; class QQuickViewPrivate; class Q_QUICK_EXPORT QQuickView : public QQuickWindow @@ -90,6 +91,7 @@ public: public Q_SLOTS: void setSource(const QUrl&); + void setContent(const QUrl& url, QQmlComponent *component, QObject *item); Q_SIGNALS: void statusChanged(QQuickView::Status); diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp index f03a2c9a64..4ea31a0d6f 100644 --- a/src/quick/items/qquickwindow.cpp +++ b/src/quick/items/qquickwindow.cpp @@ -1093,14 +1093,6 @@ QQuickItem *QQuickWindow::mouseGrabberItem() const } -/*! - \qmlproperty color QtQuick.Window2::Window::color - - The background color for the window. - - Setting this property is more efficient than using a separate Rectangle. -*/ - bool QQuickWindowPrivate::clearHover() { Q_Q(QQuickWindow); @@ -2004,7 +1996,11 @@ bool QQuickWindowPrivate::isRenderable() const { if (geometry.width() <= 0 || geometry.height() <= 0) return false; - return visible || (renderWithoutShowing && platformWindow); + // Change to be applied after the visibility property is integrated in qtbase: +// return visibility != QWindow::Hidden || (renderWithoutShowing && platformWindow); + // Temporary version which is implementation-agnostic but slightly less efficient: + const QQuickWindow *q = q_func(); + return q->isVisible() || (renderWithoutShowing && platformWindow); } /*! @@ -2474,7 +2470,7 @@ QOpenGLContext *QQuickWindow::openglContext() const void QQuickWindow::setRenderTarget(QOpenGLFramebufferObject *fbo) { Q_D(QQuickWindow); - if (d->context && d->context && QThread::currentThread() != d->context->thread()) { + if (d->context && QThread::currentThread() != d->context->thread()) { qWarning("QQuickWindow::setRenderThread: Cannot set render target from outside the rendering thread"); return; } @@ -2506,7 +2502,7 @@ void QQuickWindow::setRenderTarget(QOpenGLFramebufferObject *fbo) void QQuickWindow::setRenderTarget(uint fboId, const QSize &size) { Q_D(QQuickWindow); - if (d->context && d->context && QThread::currentThread() != d->context->thread()) { + if (d->context && QThread::currentThread() != d->context->thread()) { qWarning("QQuickWindow::setRenderThread: Cannot set render target from outside the rendering thread"); return; } @@ -2759,6 +2755,14 @@ QSGTexture *QQuickWindow::createTextureFromId(uint id, const QSize &size, Create } /*! + \qmlproperty color QtQuick.Window2::Window::color + + The background color for the window. + + Setting this property is more efficient than using a separate Rectangle. +*/ + +/*! \property QQuickWindow::color \brief The color used to clear the OpenGL context. @@ -2776,6 +2780,7 @@ void QQuickWindow::setColor(const QColor &color) d->clearColor = color; emit colorChanged(color); + d->dirtyItem(contentItem()); } QColor QQuickWindow::color() const @@ -2783,7 +2788,26 @@ QColor QQuickWindow::color() const return d_func()->clearColor; } +/*! + \qmlproperty string QtQuick.Window2::Window::title + + The window's title in the windowing system. + The window title might appear in the title area of the window decorations, + depending on the windowing system and the window flags. It might also + be used by the windowing system to identify the window in other contexts, + such as in the task switcher. + */ + +/*! + \qmlproperty string QtQuick.Window2::Window::modality + + The modality of the window. + + A modal window prevents other windows from receiving input events. + Possible values are Qt.NonModal (the default), Qt.WindowModal, + and Qt.ApplicationModal. + */ #include "moc_qquickwindow.cpp" diff --git a/src/quick/items/qquickwindowmanager.cpp b/src/quick/items/qquickwindowmanager.cpp index 50887e8e99..5da904ace2 100644 --- a/src/quick/items/qquickwindowmanager.cpp +++ b/src/quick/items/qquickwindowmanager.cpp @@ -131,8 +131,11 @@ QQuickWindowManager *QQuickWindowManager::instance() s_instance = QSGContext::createWindowManager(); bool bufferQueuing = QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::BufferQueueingOpenGL); - bool fancy = bufferQueuing - && QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::ThreadedOpenGL); +#ifdef Q_OS_WIN + bool fancy = false; // QTBUG-28037 +#else + bool fancy = QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::ThreadedOpenGL); +#endif if (qmlNoThreadedRenderer()) fancy = false; else if (qmlForceThreadedRenderer()) diff --git a/src/quick/util/qquickapplication.cpp b/src/quick/util/qquickapplication.cpp index 27ee2f0be1..962fb52d05 100644 --- a/src/quick/util/qquickapplication.cpp +++ b/src/quick/util/qquickapplication.cpp @@ -42,6 +42,8 @@ #include "qquickapplication_p.h" #include <private/qobject_p.h> +#include <private/qguiapplication_p.h> +#include <qpa/qplatformintegration.h> #include <QtGui/QGuiApplication> #include <QtCore/QDebug> @@ -91,6 +93,11 @@ Qt::LayoutDirection QQuickApplication::layoutDirection() const return d->direction; } +bool QQuickApplication::supportsMultipleWindows() const +{ + return QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::MultipleWindows); +} + bool QQuickApplication::eventFilter(QObject *, QEvent *event) { Q_D(QQuickApplication); diff --git a/src/quick/util/qquickapplication_p.h b/src/quick/util/qquickapplication_p.h index 5cf31efe5c..5519f22243 100644 --- a/src/quick/util/qquickapplication_p.h +++ b/src/quick/util/qquickapplication_p.h @@ -57,12 +57,14 @@ class Q_AUTOTEST_EXPORT QQuickApplication : public QObject Q_OBJECT Q_PROPERTY(bool active READ active NOTIFY activeChanged) Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection NOTIFY layoutDirectionChanged) + Q_PROPERTY(bool supportsMultipleWindows READ supportsMultipleWindows CONSTANT) public: explicit QQuickApplication(QObject *parent = 0); virtual ~QQuickApplication(); bool active() const; Qt::LayoutDirection layoutDirection() const; + bool supportsMultipleWindows() const; Q_SIGNALS: void activeChanged(); |