aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2014-06-03 15:28:51 +0200
committerSimon Hausmann <simon.hausmann@digia.com>2014-06-04 17:02:55 +0200
commit11a11d1280b1634628b9c4a92a0fc420ee8a3a81 (patch)
treeb48d9608ef3f08123cdeea605068342131b32b44 /src/quick
parent52e07d564b65ed6ce26955a676c7692ad67686c1 (diff)
parentfea26bb2941c3f24c4a5f3ad5efc1b85e0123ff3 (diff)
Merge remote-tracking branch 'origin/stable' into dev
The merge conflict is about the removal of "d1" from the register set on ARM, but that was already done in dev in commit ddb33ee9ba9e1344caa9be5dbf4b534c3ede692e The change in src/quick/scenegraph/coreapi/qsgrenderer.cpp with commit 2414f1675eab163b22dcc4e8ded80ed04d06369b was reverted to what it was before, per Laszlo's advice. Conflicts: src/qml/jit/qv4isel_masm.cpp Change-Id: I7bce546c5cdee01e37853a476d82279d4e72948b
Diffstat (limited to 'src/quick')
-rw-r--r--src/quick/items/context2d/qquickcontext2d.cpp20
-rw-r--r--src/quick/items/context2d/qquickcontext2d_p.h2
-rw-r--r--src/quick/items/context2d/qquickcontext2dcommandbuffer.cpp3
-rw-r--r--src/quick/items/qquickaccessibleattached.cpp157
-rw-r--r--src/quick/items/qquickclipnode.cpp2
-rw-r--r--src/quick/items/qquickmousearea.cpp2
-rw-r--r--src/quick/items/qquickmultipointtoucharea.cpp2
-rw-r--r--src/quick/items/qquickrendercontrol.cpp23
-rw-r--r--src/quick/items/qquickrendercontrol_p.h1
-rw-r--r--src/quick/items/qquickshadereffect.cpp10
-rw-r--r--src/quick/items/qquickwindow.h2
-rw-r--r--src/quick/scenegraph/qsgcontext.cpp3
-rw-r--r--src/quick/scenegraph/qsgdefaultglyphnode_p.cpp1
-rw-r--r--src/quick/util/qquickanimationcontroller.cpp2
-rw-r--r--src/quick/util/qquickpixmapcache.cpp2
15 files changed, 151 insertions, 81 deletions
diff --git a/src/quick/items/context2d/qquickcontext2d.cpp b/src/quick/items/context2d/qquickcontext2d.cpp
index 29e83e8247..a7d5f7d65f 100644
--- a/src/quick/items/context2d/qquickcontext2d.cpp
+++ b/src/quick/items/context2d/qquickcontext2d.cpp
@@ -3177,11 +3177,6 @@ QV4::ReturnedValue QQuickJSContext2DPixelData::getIndexed(QV4::Managed *m, uint
QV4::ExecutionEngine *v4 = m->engine();
QV4::Scope scope(v4);
QV4::Scoped<QQuickJSContext2DPixelData> r(scope, m->as<QQuickJSContext2DPixelData>());
- if (!m) {
- if (hasProperty)
- *hasProperty = false;
- return m->engine()->currentContext()->throwTypeError();
- }
if (r && index < static_cast<quint32>(r->image.width() * r->image.height() * 4)) {
if (hasProperty)
@@ -3610,10 +3605,12 @@ void QQuickContext2D::clip()
QPainterPath clipPath = m_path;
clipPath.closeSubpath();
- if (!state.clipPath.isEmpty())
+ if (state.clip) {
state.clipPath = clipPath.intersected(state.clipPath);
- else
+ } else {
+ state.clip = true;
state.clipPath = clipPath;
+ }
buffer()->clip(state.clipPath);
}
@@ -4282,9 +4279,8 @@ void QQuickContext2D::popState()
if (newState.miterLimit != state.miterLimit)
buffer()->setMiterLimit(newState.miterLimit);
- if (newState.clipPath != state.clipPath) {
+ if (newState.clip && (!state.clip || newState.clipPath != state.clipPath))
buffer()->clip(newState.clipPath);
- }
if (newState.shadowBlur != state.shadowBlur)
buffer()->setShadowBlur(newState.shadowBlur);
@@ -4312,12 +4308,6 @@ void QQuickContext2D::reset()
m_path = QPainterPath();
- QPainterPath defaultClipPath;
-
- QRect r(0, 0, m_canvas->canvasSize().width(), m_canvas->canvasSize().height());
- r = r.united(m_canvas->canvasWindow().toRect());
- defaultClipPath.addRect(r);
- newState.clipPath = defaultClipPath;
newState.clipPath.setFillRule(Qt::WindingFill);
m_stateStack.clear();
diff --git a/src/quick/items/context2d/qquickcontext2d_p.h b/src/quick/items/context2d/qquickcontext2d_p.h
index ab851d302f..bd1a83ce08 100644
--- a/src/quick/items/context2d/qquickcontext2d_p.h
+++ b/src/quick/items/context2d/qquickcontext2d_p.h
@@ -123,6 +123,7 @@ public:
, strokePatternRepeatX(false)
, strokePatternRepeatY(false)
, invertibleCTM(true)
+ , clip(false)
, fillRule(Qt::WindingFill)
, globalAlpha(1.0)
, lineWidth(1)
@@ -150,6 +151,7 @@ public:
bool strokePatternRepeatX:1;
bool strokePatternRepeatY:1;
bool invertibleCTM:1;
+ bool clip:1;
Qt::FillRule fillRule;
qreal globalAlpha;
qreal lineWidth;
diff --git a/src/quick/items/context2d/qquickcontext2dcommandbuffer.cpp b/src/quick/items/context2d/qquickcontext2dcommandbuffer.cpp
index 5697c25ff0..cb09c9d4ff 100644
--- a/src/quick/items/context2d/qquickcontext2dcommandbuffer.cpp
+++ b/src/quick/items/context2d/qquickcontext2dcommandbuffer.cpp
@@ -215,7 +215,8 @@ void QQuickContext2DCommandBuffer::setPainterState(QPainter* p, const QQuickCont
if (state.globalCompositeOperation != p->compositionMode())
p->setCompositionMode(state.globalCompositeOperation);
- p->setClipPath(state.clipPath);
+ if (state.clip)
+ p->setClipPath(state.clipPath);
}
static void qt_drawImage(QPainter *p, QQuickContext2D::State& state, QImage image, const QRectF& sr, const QRectF& dr, bool shadow = false)
diff --git a/src/quick/items/qquickaccessibleattached.cpp b/src/quick/items/qquickaccessibleattached.cpp
index b5cc6ea3ef..16f684ce77 100644
--- a/src/quick/items/qquickaccessibleattached.cpp
+++ b/src/quick/items/qquickaccessibleattached.cpp
@@ -56,16 +56,39 @@ QT_BEGIN_NAMESPACE
\ingroup qtquick-visual-utility
\ingroup accessibility
- This class is part of \l {Accessibility for Qt Quick Applications}.
+ This class is part of the \l {Accessibility for Qt Quick Applications}.
Items the user interacts with or that give information to the user
- need to expose their information in a semantic way.
+ need to expose their information to the accessibility framework.
Then assistive tools can make use of that information to enable
users to interact with the application in various ways.
-
This enables Qt Quick applications to be used with screen-readers for example.
- The most important properties to set are \l name and \l role.
+ The most important properties are \l name, \l description and \l role.
+
+ Example implementation of a simple button:
+ \qml
+ Rectangle {
+ id: myButton
+ Text {
+ id: label
+ text: "next"
+ }
+ Accessible.role: Accessible.Button
+ Accessible.name: label.text
+ Accessible.description: "shows the next page"
+ function accessiblePressAction() {
+ // do a button click
+ }
+ }
+ \endqml
+ The \l role is set to \c Button to indicate the type of control.
+ \l Accessible.name is the most important information and bound to the text on the button.
+ The name is a short and consise description of the control and should reflect the visual label.
+ In this case it is not clear what the button does with the name only, so \l description contains
+ an explanation.
+ There is also a function \c accessiblePressAction() which can be invoked by assistive tools to trigger
+ the button. This function needs to have the same effect as tapping or clicking the button would have.
\sa Accessibility
*/
@@ -94,25 +117,7 @@ QT_BEGIN_NAMESPACE
This flags sets the semantic type of the widget.
A button for example would have "Button" as type.
- The value must be one of \l QAccessible::Role .
- Example:
- \qml
- Item {
- id: myButton
-
- Text {
- id: label
- // ...
- }
-
- Accessible.name: label.text
- Accessible.role: Accessible.Button
-
- function accessiblePressAction() {
- //...
- }
- }
- \endqml
+ The value must be one of \l QAccessible::Role.
Some roles have special semantics.
In order to implement check boxes for example a "checked" property is expected.
@@ -120,74 +125,116 @@ QT_BEGIN_NAMESPACE
\table
\header
\li \b {Role}
- \li \b {Expected property}
- \li
-
+ \li \b {Properties and functions}
+ \li \b {Explanation}
\row
- \li Button
- \li function accessiblePressAction
- \li Called when the button receives a press action. The implementation should visually simulate a button click and perform the button action.
+ \li All interactive elements
+ \li \l focusable and \l focused
+ \li All elements that the user can interact with should have focusable set to \c true and
+ set \l focus to \c true when they have the focus. This is important even for applications
+ that run on touch-only devices since screen readers often implement a virtual focus that
+ can be moved from item to item.
\row
- \li CheckBox, Radiobutton
- \li checked
+ \li Button, CheckBox, RadioButton
+ \li \c accessiblePressAction()
+ \li A button should have a function with the name \c accessiblePressAction.
+ This function may be called by an assistive tool such as a screen-reader.
+ The implementation needs to behave the same as a mouse click or tap on the button.
+ \row
+ \li CheckBox, RadioButton
+ \li \l checkable, \l checked
\li The check state of the check box. Updated on Press, Check and Uncheck actions.
\row
\li Slider, SpinBox, Dial, ScrollBar
- \li value, minimumValue, maximumValue, stepSize
- \li value will be updated on increase and decrase actions, in accordance with the other properties
-
+ \li \c value, \c minimumValue, \c maximumValue, \c stepSize
+ \li These properties reflect the state and possible values for the elements.
+ \row
+ \li Slider, SpinBox, Dial, ScrollBar
+ \li \c accessibleIncreaseAction(), \c accessibleDecreaseAction()
+ \li Actions to increase and decrease the value of the element.
\endtable
*/
-/*! \qmlproperty bool focusable
+/*! \qmlproperty bool QtQuick::Accessible::focusable
\brief This property holds whether this item is focusable.
- By default, this property is false except for items where the role is one of
- CheckBox, RadioButton, Button, MenuItem, PageTab, EditableText, SpinBox, ComboBox,
- Terminal or ScrollBar.
+ By default, this property is \c false except for items where the role is one of
+ \c CheckBox, \c RadioButton, \c Button, \c MenuItem, \c PageTab, \c EditableText, \c SpinBox, \c ComboBox,
+ \c Terminal or \c ScrollBar.
+ \sa focused
*/
-/*! \qmlproperty bool focused
+/*! \qmlproperty bool QtQuick::Accessible::focused
\brief This property holds whether this item currently has the active focus.
- By default, this property is false, but it will return true for items that
- have \l QQuickItem::hasActiveFocus() returning true.
+ By default, this property is \c false, but it will return \c true for items that
+ have \l QQuickItem::hasActiveFocus() returning \c true.
+ \sa focusable
*/
-/*! \qmlproperty bool checkable
+/*! \qmlproperty bool QtQuick::Accessible::checkable
\brief This property holds whether this item is checkable (like a check box or some buttons).
+
+ By default this property is \c false.
+ \sa checked
*/
-/*! \qmlproperty bool checked
+/*! \qmlproperty bool QtQuick::Accessible::checked
\brief This property holds whether this item is currently checked.
+
+ By default this property is \c false.
+ \sa checkable
*/
-/*! \qmlproperty bool editable
+/*! \qmlproperty bool QtQuick::Accessible::editable
\brief This property holds whether this item has editable text.
+
+ By default this property is \c false.
*/
-/*! \qmlproperty bool multiLine
+/*! \qmlproperty bool QtQuick::Accessible::multiLine
\brief This property holds whether this item has multiple text lines.
+
+ By default this property is \c false.
*/
-/*! \qmlproperty bool readOnly
- \brief This property holds whether this item while being of type \l QAccessible::EditableText
- is set to read-only.
+/*! \qmlproperty bool QtQuick::Accessible::readOnly
+ \brief This property indicates that a text field is read only.
+
+ It is relevant when the role is \l QAccessible::EditableText and set to be read-only.
+ By default this property is \c false.
*/
-/*! \qmlproperty bool selected
+/*! \qmlproperty bool QtQuick::Accessible::selected
\brief This property holds whether this item is selected.
+
+ By default this property is \c false.
+ \sa selectable
*/
-/*! \qmlproperty bool selectable
+/*! \qmlproperty bool QtQuick::Accessible::selectable
\brief This property holds whether this item can be selected.
+
+ By default this property is \c false.
+ \sa selected
*/
-/*! \qmlproperty bool pressed
+/*! \qmlproperty bool QtQuick::Accessible::pressed
\brief This property holds whether this item is pressed (for example a button during a mouse click).
+
+ By default this property is \c false.
*/
-/*! \qmlproperty bool checkStateMixed
+/*! \qmlproperty bool QtQuick::Accessible::checkStateMixed
\brief This property holds whether this item is in the partially checked state.
+
+ By default this property is \c false.
+ \sa checked, checkable
*/
-/*! \qmlproperty bool defaultButton
+/*! \qmlproperty bool QtQuick::Accessible::defaultButton
\brief This property holds whether this item is the default button of a dialog.
+
+ By default this property is \c false.
*/
-/*! \qmlproperty bool passwordEdit
+/*! \qmlproperty bool QtQuick::Accessible::passwordEdit
\brief This property holds whether this item is a password text edit.
+
+ By default this property is \c false.
*/
-/*! \qmlproperty bool selectableText
+/*! \qmlproperty bool QtQuick::Accessible::selectableText
\brief This property holds whether this item contains selectable text.
+
+ By default this property is \c false.
*/
QQuickAccessibleAttached::QQuickAccessibleAttached(QObject *parent)
diff --git a/src/quick/items/qquickclipnode.cpp b/src/quick/items/qquickclipnode.cpp
index 3974073b55..78c29ea4a7 100644
--- a/src/quick/items/qquickclipnode.cpp
+++ b/src/quick/items/qquickclipnode.cpp
@@ -114,8 +114,8 @@ void QQuickDefaultClipNode::updateGeometry()
}
}
- markDirty(DirtyGeometry);
}
+ markDirty(DirtyGeometry);
setClipRect(m_rect);
}
diff --git a/src/quick/items/qquickmousearea.cpp b/src/quick/items/qquickmousearea.cpp
index 01d1305260..f2f90935a3 100644
--- a/src/quick/items/qquickmousearea.cpp
+++ b/src/quick/items/qquickmousearea.cpp
@@ -900,7 +900,7 @@ bool QQuickMouseArea::sendMouseEvent(QMouseEvent *event)
default:
break;
}
- grabber = c->mouseGrabberItem();
+ grabber = c ? c->mouseGrabberItem() : 0;
if (grabber && stealThisEvent && !grabber->keepMouseGrab() && grabber != this)
grabMouse();
diff --git a/src/quick/items/qquickmultipointtoucharea.cpp b/src/quick/items/qquickmultipointtoucharea.cpp
index c20559454e..ee31c018af 100644
--- a/src/quick/items/qquickmultipointtoucharea.cpp
+++ b/src/quick/items/qquickmultipointtoucharea.cpp
@@ -844,7 +844,7 @@ bool QQuickMultiPointTouchArea::sendMouseEvent(QMouseEvent *event)
default:
break;
}
- grabber = c->mouseGrabberItem();
+ grabber = c ? c->mouseGrabberItem() : 0;
if (grabber && stealThisEvent && !grabber->keepMouseGrab() && grabber != this)
grabMouse();
diff --git a/src/quick/items/qquickrendercontrol.cpp b/src/quick/items/qquickrendercontrol.cpp
index 55736c33c3..b8d572114a 100644
--- a/src/quick/items/qquickrendercontrol.cpp
+++ b/src/quick/items/qquickrendercontrol.cpp
@@ -120,13 +120,13 @@ void QQuickRenderControl::initialize(QOpenGLContext *gl)
// surface belonging to window. In fact window may not have a native
// window/surface at all.
- QQuickWindowPrivate::get(d->window)->context->initialize(gl);
+ d->rc->initialize(gl);
}
void QQuickRenderControl::invalidate()
{
Q_D(QQuickRenderControl);
- QQuickWindowPrivate::get(d->window)->context->invalidate();
+ d->rc->invalidate();
}
/*!
@@ -242,6 +242,10 @@ void QQuickRenderControl::setWindow(QQuickWindow *window)
d->window = window;
}
+/*!
+ Returns the offscreen window.
+ */
+
QQuickWindow *QQuickRenderControl::window() const
{
Q_D(const QQuickRenderControl);
@@ -249,6 +253,21 @@ QQuickWindow *QQuickRenderControl::window() const
}
/*!
+ Create an offscreen QQuickWindow for this render control,
+ unless the render control already has a window().
+
+ Returns the offscreen window if one is created, otherwise returns null.
+ The caller takes ownership of the window, and is responsible for deleting it.
+ */
+QQuickWindow *QQuickRenderControl::createOffscreenWindow()
+{
+ Q_D(QQuickRenderControl);
+ if (!d->window)
+ return new QQuickWindow(this);
+ return 0;
+}
+
+/*!
\fn QWindow *QQuickRenderControl::renderWindow(QPoint *offset)
Reimplemented in subclasses to return the real window this render control
diff --git a/src/quick/items/qquickrendercontrol_p.h b/src/quick/items/qquickrendercontrol_p.h
index e7b7759afa..cc30e37724 100644
--- a/src/quick/items/qquickrendercontrol_p.h
+++ b/src/quick/items/qquickrendercontrol_p.h
@@ -63,6 +63,7 @@ public:
~QQuickRenderControl();
QQuickWindow *window() const;
+ QQuickWindow *createOffscreenWindow();
virtual QWindow *renderWindow(QPoint *offset) { Q_UNUSED(offset); return 0; }
static QWindow *renderWindowFor(QQuickWindow *win, QPoint *offset = 0);
diff --git a/src/quick/items/qquickshadereffect.cpp b/src/quick/items/qquickshadereffect.cpp
index e57b7abddc..8bcd2e64db 100644
--- a/src/quick/items/qquickshadereffect.cpp
+++ b/src/quick/items/qquickshadereffect.cpp
@@ -97,7 +97,8 @@ namespace {
// Returns -1 if not found, returns index to first character after the name if found.
int qt_search_for_variable(const char *s, int length, int index, VariableQualifier &decl,
int &typeIndex, int &typeLength,
- int &nameIndex, int &nameLength)
+ int &nameIndex, int &nameLength,
+ QQuickShaderEffectCommon::Key::ShaderType shaderType)
{
enum Identifier {
QualifierIdentifier, // Base state
@@ -124,6 +125,7 @@ namespace {
int idLength = index - idIndex;
const int attrLen = sizeof("attribute") - 1;
+ const int inLen = sizeof("in") - 1;
const int uniLen = sizeof("uniform") - 1;
const int loLen = sizeof("lowp") - 1;
const int medLen = sizeof("mediump") - 1;
@@ -134,6 +136,10 @@ namespace {
if (idLength == attrLen && qstrncmp("attribute", s + idIndex, attrLen) == 0) {
decl = AttributeQualifier;
expected = PrecisionIdentifier;
+ } else if (shaderType == QQuickShaderEffectCommon::Key::VertexShader
+ && idLength == inLen && qstrncmp("in", s + idIndex, inLen) == 0) {
+ decl = AttributeQualifier;
+ expected = PrecisionIdentifier;
} else if (idLength == uniLen && qstrncmp("uniform", s + idIndex, uniLen) == 0) {
decl = UniformQualifier;
expected = PrecisionIdentifier;
@@ -287,7 +293,7 @@ void QQuickShaderEffectCommon::lookThroughShaderCode(QQuickItem *item, Key::Shad
const char *s = code.constData();
VariableQualifier decl = AttributeQualifier;
while ((index = qt_search_for_variable(s, code.size(), index, decl, typeIndex, typeLength,
- nameIndex, nameLength)) != -1)
+ nameIndex, nameLength, shaderType)) != -1)
{
if (decl == AttributeQualifier) {
if (shaderType == Key::VertexShader)
diff --git a/src/quick/items/qquickwindow.h b/src/quick/items/qquickwindow.h
index 1a4adb0785..c95ec5b46d 100644
--- a/src/quick/items/qquickwindow.h
+++ b/src/quick/items/qquickwindow.h
@@ -199,7 +199,7 @@ private Q_SLOTS:
private:
friend class QQuickItem;
friend class QQuickWidget;
- friend class QQuickWidgetPrivate;
+ friend class QQuickRenderControl;
friend class QQuickAnimatorController;
explicit QQuickWindow(QQuickRenderControl*);
Q_DISABLE_COPY(QQuickWindow)
diff --git a/src/quick/scenegraph/qsgcontext.cpp b/src/quick/scenegraph/qsgcontext.cpp
index 99b52a65cb..6a69ea02db 100644
--- a/src/quick/scenegraph/qsgcontext.cpp
+++ b/src/quick/scenegraph/qsgcontext.cpp
@@ -416,6 +416,7 @@ QSGRenderContext *QSGRenderContext::from(QOpenGLContext *context)
void QSGRenderContext::registerFontengineForCleanup(QFontEngine *engine)
{
+ engine->ref.ref();
m_fontEnginesToClean << engine;
}
@@ -495,6 +496,8 @@ void QSGRenderContext::invalidate()
for (QSet<QFontEngine *>::const_iterator it = m_fontEnginesToClean.constBegin(),
end = m_fontEnginesToClean.constEnd(); it != end; ++it) {
(*it)->clearGlyphCache(m_gl);
+ if (!(*it)->ref.deref())
+ delete *it;
}
m_fontEnginesToClean.clear();
diff --git a/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp b/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp
index a69cbc54ea..c3234be158 100644
--- a/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp
+++ b/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp
@@ -352,6 +352,7 @@ QSGTextMaskMaterial::QSGTextMaskMaterial(const QRawFont &font, QFontEngine::Glyp
QSGTextMaskMaterial::~QSGTextMaskMaterial()
{
+ delete m_texture;
}
void QSGTextMaskMaterial::init(QFontEngine::GlyphFormat glyphFormat)
diff --git a/src/quick/util/qquickanimationcontroller.cpp b/src/quick/util/qquickanimationcontroller.cpp
index 0214dde597..6a9308da3e 100644
--- a/src/quick/util/qquickanimationcontroller.cpp
+++ b/src/quick/util/qquickanimationcontroller.cpp
@@ -142,7 +142,7 @@ void QQuickAnimationController::setProgress(qreal progress)
}
/*!
- \qmlproperty real QtQuick::AnimationController::animation
+ \qmlproperty Animation QtQuick::AnimationController::animation
\default
This property holds the animation to be controlled by the AnimationController.
diff --git a/src/quick/util/qquickpixmapcache.cpp b/src/quick/util/qquickpixmapcache.cpp
index b90ca47fd1..0a5b26281a 100644
--- a/src/quick/util/qquickpixmapcache.cpp
+++ b/src/quick/util/qquickpixmapcache.cpp
@@ -810,7 +810,7 @@ void QQuickPixmapStore::unreferencePixmap(QQuickPixmapData *data)
if (!m_lastUnreferencedPixmap)
m_lastUnreferencedPixmap = data;
- shrinkCache(-1); // Shrink the cache incase it has become larger than cache_limit
+ shrinkCache(-1); // Shrink the cache in case it has become larger than cache_limit
if (m_timerId == -1 && m_unreferencedPixmaps && !m_destroying)
m_timerId = startTimer(CACHE_EXPIRE_TIME * 1000);