summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/declarative/QmlChanges.txt1
-rw-r--r--src/declarative/graphicsitems/qdeclarativeitem.cpp8
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextedit.cpp73
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextedit_p.h4
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextedit_p_p.h4
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextinput.cpp5
-rw-r--r--src/declarative/qml/qdeclarativebinding.cpp8
-rw-r--r--src/declarative/qml/qdeclarativecompiler.cpp17
-rw-r--r--src/declarative/qml/qdeclarativecomponent.cpp10
-rw-r--r--src/declarative/qml/qdeclarativeengine.cpp4
-rw-r--r--src/declarative/qml/qdeclarativeobjectscriptclass.cpp2
-rw-r--r--src/declarative/qml/qdeclarativevmemetaobject.cpp2
-rw-r--r--src/declarative/util/qdeclarativestateoperations.cpp4
-rw-r--r--src/gui/graphicsview/qgraphicsscene.cpp14
-rw-r--r--src/gui/graphicsview/qgraphicswidget_p.cpp3
-rw-r--r--src/network/access/qnetworkaccessmanager.cpp8
16 files changed, 114 insertions, 53 deletions
diff --git a/src/declarative/QmlChanges.txt b/src/declarative/QmlChanges.txt
index 25c2417..3eed8d6 100644
--- a/src/declarative/QmlChanges.txt
+++ b/src/declarative/QmlChanges.txt
@@ -15,6 +15,7 @@ QList<QObject*> models no longer provide properties in model object. The
properties are now updated when the object changes. An object's property
"foo" may now be accessed as "foo", modelData.foo" or model.modelData.foo"
component.createObject has gained a mandatory "parent" argument
+TextEdit and TextInput now have a "selectByMouse" property that defaults to false.
C++ API
-------
diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp
index 9547884..2841ac3 100644
--- a/src/declarative/graphicsitems/qdeclarativeitem.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp
@@ -2681,7 +2681,13 @@ bool QDeclarativeItem::sceneEvent(QEvent *event)
}
}
-/*! \internal */
+/*!
+ \reimp
+
+ Note that unlike QGraphicsItems, QDeclarativeItem::itemChange() is \e not called
+ during initial widget polishing. Items wishing to optimize start-up construction
+ should instead consider using componentComplete().
+*/
QVariant QDeclarativeItem::itemChange(GraphicsItemChange change,
const QVariant &value)
{
diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp
index 40d37a2..a154d53 100644
--- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp
@@ -61,8 +61,9 @@ QT_BEGIN_NAMESPACE
/*!
\qmlclass TextEdit QDeclarativeTextEdit
- \since 4.7
+ \since 4.7
\brief The TextEdit item allows you to add editable formatted text to a scene.
+ \inherits Item
It can display both plain and rich text. For example:
@@ -80,6 +81,14 @@ TextEdit {
\image declarative-textedit.gif
+ Note that the TextEdit does not implement scrolling, following the cursor, or other behaviors specific
+ to a look-and-feel. For example, to add flickable scrolling that follows the cursor:
+
+ \snippet snippets/declarative/texteditor.qml 0
+
+ A particular look-and-feel might use smooth scrolling (eg. using SmoothedFollow), might have a visible
+ scrollbar, or a scrollbar that fades in to show location, etc.
+
\sa Text
*/
@@ -523,7 +532,7 @@ void QDeclarativeTextEdit::setCursorVisible(bool on)
QFocusEvent focusEvent(on ? QEvent::FocusIn : QEvent::FocusOut);
if (!on && !d->persistentSelection)
d->control->setCursorIsFocusIndicator(true);
- d->control->processEvent(&focusEvent, QPointF(0, 0));
+ d->control->processEvent(&focusEvent, QPointF(0, -d->yoff));
emit cursorVisibleChanged(d->cursorVisible);
}
@@ -574,7 +583,7 @@ void QDeclarativeTextEdit::setCursorDelegate(QDeclarativeComponent* c)
disconnect(d->control, SIGNAL(cursorPositionChanged()),
this, SLOT(moveCursorDelegate()));
d->control->setCursorWidth(-1);
- dirtyCache(cursorRect());
+ dirtyCache(cursorRectangle());
delete d->cursor;
d->cursor = 0;
}
@@ -601,7 +610,7 @@ void QDeclarativeTextEdit::loadCursorDelegate()
connect(d->control, SIGNAL(cursorPositionChanged()),
this, SLOT(moveCursorDelegate()));
d->control->setCursorWidth(0);
- dirtyCache(cursorRect());
+ dirtyCache(cursorRectangle());
QDeclarative_setParent_noEvent(d->cursor, this);
d->cursor->setParentItem(this);
d->cursor->setHeight(QFontMetrics(d->font).height());
@@ -773,7 +782,7 @@ void QDeclarativeTextEdit::componentComplete()
}
/*!
- \qmlproperty string TextEdit::selectByMouse
+ \qmlproperty bool TextEdit::selectByMouse
Defaults to false.
@@ -854,13 +863,15 @@ Qt::TextInteractionFlags QDeclarativeTextEdit::textInteractionFlags() const
}
/*!
- Returns the rectangle where the text cursor is rendered
- within the text edit.
+ \qmlproperty rectangle TextEdit::cursorRectangle
+
+ The rectangle where the text cursor is rendered
+ within the text edit. Read-only.
*/
-QRect QDeclarativeTextEdit::cursorRect() const
+QRect QDeclarativeTextEdit::cursorRectangle() const
{
Q_D(const QDeclarativeTextEdit);
- return d->control->cursorRect().toRect();
+ return d->control->cursorRect().toRect().translated(0,-d->yoff);
}
@@ -872,7 +883,7 @@ bool QDeclarativeTextEdit::event(QEvent *event)
{
Q_D(QDeclarativeTextEdit);
if (event->type() == QEvent::ShortcutOverride) {
- d->control->processEvent(event, QPointF(0, 0));
+ d->control->processEvent(event, QPointF(0, -d->yoff));
return event->isAccepted();
}
return QDeclarativePaintedItem::event(event);
@@ -887,7 +898,7 @@ void QDeclarativeTextEdit::keyPressEvent(QKeyEvent *event)
Q_D(QDeclarativeTextEdit);
keyPressPreHandler(event);
if (!event->isAccepted())
- d->control->processEvent(event, QPointF(0, 0));
+ d->control->processEvent(event, QPointF(0, -d->yoff));
if (!event->isAccepted())
QDeclarativePaintedItem::keyPressEvent(event);
}
@@ -901,7 +912,7 @@ void QDeclarativeTextEdit::keyReleaseEvent(QKeyEvent *event)
Q_D(QDeclarativeTextEdit);
keyReleasePreHandler(event);
if (!event->isAccepted())
- d->control->processEvent(event, QPointF(0, 0));
+ d->control->processEvent(event, QPointF(0, -d->yoff));
if (!event->isAccepted())
QDeclarativePaintedItem::keyReleaseEvent(event);
}
@@ -942,7 +953,7 @@ void QDeclarativeTextEdit::mousePressEvent(QGraphicsSceneMouseEvent *event)
if (!hadFocus && hasFocus())
d->clickCausedFocus = true;
if (event->type() != QEvent::GraphicsSceneMouseDoubleClick || d->selectByMouse)
- d->control->processEvent(event, QPointF(0, 0));
+ d->control->processEvent(event, QPointF(0, -d->yoff));
if (!event->isAccepted())
QDeclarativePaintedItem::mousePressEvent(event);
}
@@ -959,7 +970,7 @@ void QDeclarativeTextEdit::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
qt_widget_private(widget)->handleSoftwareInputPanel(event->button(), d->clickCausedFocus);
d->clickCausedFocus = false;
- d->control->processEvent(event, QPointF(0, 0));
+ d->control->processEvent(event, QPointF(0, -d->yoff));
if (!event->isAccepted())
QDeclarativePaintedItem::mouseReleaseEvent(event);
}
@@ -972,7 +983,7 @@ void QDeclarativeTextEdit::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event
{
Q_D(QDeclarativeTextEdit);
if (d->selectByMouse) {
- d->control->processEvent(event, QPointF(0, 0));
+ d->control->processEvent(event, QPointF(0, -d->yoff));
if (!event->isAccepted())
QDeclarativePaintedItem::mouseDoubleClickEvent(event);
} else {
@@ -988,7 +999,7 @@ void QDeclarativeTextEdit::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
{
Q_D(QDeclarativeTextEdit);
if (d->selectByMouse) {
- d->control->processEvent(event, QPointF(0, 0));
+ d->control->processEvent(event, QPointF(0, -d->yoff));
if (!event->isAccepted())
QDeclarativePaintedItem::mouseMoveEvent(event);
event->setAccepted(true);
@@ -1004,7 +1015,7 @@ Handles the given input method \a event.
void QDeclarativeTextEdit::inputMethodEvent(QInputMethodEvent *event)
{
Q_D(QDeclarativeTextEdit);
- d->control->processEvent(event, QPointF(0, 0));
+ d->control->processEvent(event, QPointF(0, -d->yoff));
}
/*!
@@ -1026,13 +1037,20 @@ void QDeclarativeTextEdit::drawContents(QPainter *painter, const QRect &bounds)
Q_D(QDeclarativeTextEdit);
painter->setRenderHint(QPainter::TextAntialiasing, true);
+ painter->translate(0,d->yoff);
+
+ d->control->drawContents(painter, bounds.translated(0,-d->yoff));
- d->control->drawContents(painter, bounds);
+ painter->translate(0,-d->yoff);
}
-void QDeclarativeTextEdit::updateImgCache(const QRectF &r)
+void QDeclarativeTextEdit::updateImgCache(const QRectF &rf)
{
- dirtyCache(r.toRect());
+ Q_D(const QDeclarativeTextEdit);
+ QRect r = rf.toRect();
+ if (r != QRect(0,0,INT_MAX,INT_MAX)) // Don't translate "everything"
+ r = r.translated(0,d->yoff);
+ dirtyCache(r);
emit update();
}
@@ -1069,6 +1087,7 @@ void QDeclarativeTextEditPrivate::init()
QObject::connect(control, SIGNAL(selectionChanged()), q, SLOT(updateSelectionMarkers()));
QObject::connect(control, SIGNAL(cursorPositionChanged()), q, SLOT(updateSelectionMarkers()));
QObject::connect(control, SIGNAL(cursorPositionChanged()), q, SIGNAL(cursorPositionChanged()));
+ QObject::connect(control, SIGNAL(cursorPositionChanged()), q, SIGNAL(cursorRectangleChanged()));
document = control->document();
document->setDefaultFont(font);
@@ -1141,18 +1160,20 @@ void QDeclarativeTextEdit::updateSize()
d->document->setTextWidth(width());
dy -= (int)d->document->size().height();
- int yoff = 0;
if (heightValid()) {
if (d->vAlign == AlignBottom)
- yoff = dy;
+ d->yoff = dy;
else if (d->vAlign == AlignVCenter)
- yoff = dy/2;
+ d->yoff = dy/2;
+ } else {
+ d->yoff = 0;
}
- setBaselineOffset(fm.ascent() + yoff + d->textMargin);
+ setBaselineOffset(fm.ascent() + d->yoff + d->textMargin);
//### need to comfirm cost of always setting these
int newWidth = qCeil(d->document->idealWidth());
- d->document->setTextWidth(newWidth); // ### QTextDoc> Alignment will not work unless textWidth is set. Does Text need this line as well?
+ if (!widthValid())
+ d->document->setTextWidth(newWidth); // ### Text does not align if width is not set (QTextDoc bug)
int cursorWidth = 1;
if(d->cursor)
cursorWidth = d->cursor->width();
@@ -1161,7 +1182,7 @@ void QDeclarativeTextEdit::updateSize()
newWidth += 3;// ### Need a better way of accounting for space between char and cursor
// ### Setting the implicitWidth triggers another updateSize(), and unless there are bindings nothing has changed.
setImplicitWidth(newWidth);
- setImplicitHeight(d->text.isEmpty() ? fm.height() : (int)d->document->size().height());
+ setImplicitHeight(d->document->isEmpty() ? fm.height() : (int)d->document->size().height());
setContentsSize(QSize(width(), height()));
} else {
diff --git a/src/declarative/graphicsitems/qdeclarativetextedit_p.h b/src/declarative/graphicsitems/qdeclarativetextedit_p.h
index 8848d47..891b868 100644
--- a/src/declarative/graphicsitems/qdeclarativetextedit_p.h
+++ b/src/declarative/graphicsitems/qdeclarativetextedit_p.h
@@ -78,6 +78,7 @@ class Q_DECLARATIVE_EXPORT QDeclarativeTextEdit : public QDeclarativePaintedItem
Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly NOTIFY readOnlyChanged)
Q_PROPERTY(bool cursorVisible READ isCursorVisible WRITE setCursorVisible NOTIFY cursorVisibleChanged)
Q_PROPERTY(int cursorPosition READ cursorPosition WRITE setCursorPosition NOTIFY cursorPositionChanged)
+ Q_PROPERTY(QRect cursorRectangle READ cursorRectangle NOTIFY cursorRectangleChanged)
Q_PROPERTY(QDeclarativeComponent* cursorDelegate READ cursorDelegate WRITE setCursorDelegate NOTIFY cursorDelegateChanged)
Q_PROPERTY(int selectionStart READ selectionStart WRITE setSelectionStart NOTIFY selectionStartChanged)
Q_PROPERTY(int selectionEnd READ selectionEnd WRITE setSelectionEnd NOTIFY selectionEndChanged)
@@ -180,13 +181,14 @@ public:
void setTextInteractionFlags(Qt::TextInteractionFlags flags);
Qt::TextInteractionFlags textInteractionFlags() const;
- QRect cursorRect() const;
+ QRect cursorRectangle() const;
QVariant inputMethodQuery(Qt::InputMethodQuery property) const;
Q_SIGNALS:
void textChanged(const QString &);
void cursorPositionChanged();
+ void cursorRectangleChanged();
void selectionStartChanged();
void selectionEndChanged();
void selectionChanged();
diff --git a/src/declarative/graphicsitems/qdeclarativetextedit_p_p.h b/src/declarative/graphicsitems/qdeclarativetextedit_p_p.h
index 885620d..d96796c 100644
--- a/src/declarative/graphicsitems/qdeclarativetextedit_p_p.h
+++ b/src/declarative/graphicsitems/qdeclarativetextedit_p_p.h
@@ -73,7 +73,8 @@ public:
persistentSelection(true), clickCausedFocus(false), textMargin(0.0), lastSelectionStart(0), lastSelectionEnd(0),
cursorComponent(0), cursor(0), format(QDeclarativeTextEdit::AutoText), document(0),
wrapMode(QDeclarativeTextEdit::NoWrap),
- selectByMouse(false)
+ selectByMouse(false),
+ yoff(0)
{
}
@@ -112,6 +113,7 @@ public:
QTextControl *control;
QDeclarativeTextEdit::WrapMode wrapMode;
bool selectByMouse;
+ int yoff;
};
QT_END_NAMESPACE
diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp
index 2e7715f..1ac1b4e 100644
--- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp
@@ -54,8 +54,9 @@ QT_BEGIN_NAMESPACE
/*!
\qmlclass TextInput QDeclarativeTextInput
- \since 4.7
+ \since 4.7
\brief The TextInput item allows you to add an editable line of text to a scene.
+ \inherits Item
TextInput can only display a single line of text, and can only display
plain text. However it can provide addition input constraints on the text.
@@ -1120,7 +1121,7 @@ QString QDeclarativeTextInput::displayText() const
}
/*!
- \qmlproperty string TextInput::selectByMouse
+ \qmlproperty bool TextInput::selectByMouse
Defaults to false.
diff --git a/src/declarative/qml/qdeclarativebinding.cpp b/src/declarative/qml/qdeclarativebinding.cpp
index 8230941..882e981 100644
--- a/src/declarative/qml/qdeclarativebinding.cpp
+++ b/src/declarative/qml/qdeclarativebinding.cpp
@@ -191,7 +191,9 @@ void QDeclarativeBinding::update(QDeclarativePropertyPrivate::WriteFlags flags)
data->error.setUrl(url);
data->error.setLine(line);
data->error.setColumn(-1);
- data->error.setDescription(QLatin1String("Unable to assign [undefined] to ") + QLatin1String(QMetaType::typeName(data->property.propertyType())));
+ data->error.setDescription(QLatin1String("Unable to assign [undefined] to ")
+ + QLatin1String(QMetaType::typeName(data->property.propertyType()))
+ + QLatin1String(" ") + data->property.name());
} else if (!scriptValue.isRegExp() && scriptValue.isFunction()) {
@@ -353,8 +355,6 @@ void QDeclarativeAbstractBinding::removeFromObject()
if (m_prevBinding) {
int index = propertyIndex();
- Q_ASSERT(m_object);
-
*m_prevBinding = m_nextBinding;
if (m_nextBinding) m_nextBinding->m_prevBinding = m_prevBinding;
m_prevBinding = 0;
@@ -363,7 +363,7 @@ void QDeclarativeAbstractBinding::removeFromObject()
if (index & 0xFF000000) {
// Value type - we don't remove the proxy from the object. It will sit their happily
// doing nothing for ever more.
- } else {
+ } else if (m_object) {
QDeclarativeData *data = QDeclarativeData::get(m_object, false);
if (data) data->clearBindingBit(index);
}
diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp
index b5bf972..d27aced 100644
--- a/src/declarative/qml/qdeclarativecompiler.cpp
+++ b/src/declarative/qml/qdeclarativecompiler.cpp
@@ -1089,6 +1089,23 @@ void QDeclarativeCompiler::genObjectBody(QDeclarativeParser::Object *obj)
fetch.line = prop->location.start.line;
output->bytecode << fetch;
+ if (!prop->value->metadata.isEmpty()) {
+ QDeclarativeInstruction meta;
+ meta.type = QDeclarativeInstruction::StoreMetaObject;
+ meta.line = 0;
+ meta.storeMeta.data = output->indexForByteArray(prop->value->metadata);
+ meta.storeMeta.aliasData = output->indexForByteArray(prop->value->synthdata);
+ meta.storeMeta.propertyCache = output->propertyCaches.count();
+ // ### Surely the creation of this property cache could be more efficient
+ QDeclarativePropertyCache *propertyCache =
+ enginePrivate->cache(prop->value->metaObject()->superClass())->copy();
+ propertyCache->append(engine, prop->value->metaObject(), QDeclarativePropertyCache::Data::NoFlags,
+ QDeclarativePropertyCache::Data::IsVMEFunction);
+
+ output->propertyCaches << propertyCache;
+ output->bytecode << meta;
+ }
+
genObjectBody(prop->value);
QDeclarativeInstruction pop;
diff --git a/src/declarative/qml/qdeclarativecomponent.cpp b/src/declarative/qml/qdeclarativecomponent.cpp
index 3b782e7..7aa17e8 100644
--- a/src/declarative/qml/qdeclarativecomponent.cpp
+++ b/src/declarative/qml/qdeclarativecomponent.cpp
@@ -549,15 +549,19 @@ QDeclarativeComponent::QDeclarativeComponent(QDeclarativeComponentPrivate &dd, Q
Returns an object instance from this component, or null if object creation fails.
The object will be created in the same context as the one in which the component
- was created.
+ was created. This function will always return null when called on components
+ which were not created in QML.
Note that if the returned object is to be displayed, its \c parent must be set to
- an existing item in a scene, or else the object will not be visible.
+ an existing item in a scene, or else the object will not be visible. The parent
+ argument is required to help you avoid this, you must explicitly pass in null if
+ you wish to create an object without setting a parent.
*/
/*!
\internal
- A version of create which returns a scriptObject, for use in script
+ A version of create which returns a scriptObject, for use in script.
+ This function will only work on components created in QML.
Sets graphics object parent because forgetting to do this is a frequent
and serious problem.
diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp
index df9aa59..a7384a9 100644
--- a/src/declarative/qml/qdeclarativeengine.cpp
+++ b/src/declarative/qml/qdeclarativeengine.cpp
@@ -1049,9 +1049,9 @@ If you are certain the files will be local, you could simplify to:
\snippet doc/src/snippets/declarative/componentCreation.js 2
-The methods and properties of the Component element are defined in its own
+The methods and properties of the \l {Component} element are defined in its own
page, but when using it dynamically only two methods are usually used.
-\c Component.createObject() returns the created object or \c null if there is an error.
+ \l {Component::createObject()}{Component.createObject()} returns the created object or \c null if there is an error.
If there is an error, \l {Component::errorString()}{Component.errorString()} describes
the error that occurred. Note that createObject() takes exactly one argument, which is set
to the parent of the created object. Graphical objects without a parent will not appear
diff --git a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp
index 8b64e0e..aca01b2 100644
--- a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp
+++ b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp
@@ -623,7 +623,7 @@ private:
inline void cleanup();
- void *data[4];
+ char data[4 * sizeof(void *)];
int type;
};
}
diff --git a/src/declarative/qml/qdeclarativevmemetaobject.cpp b/src/declarative/qml/qdeclarativevmemetaobject.cpp
index 13e9c26..7aea7cb 100644
--- a/src/declarative/qml/qdeclarativevmemetaobject.cpp
+++ b/src/declarative/qml/qdeclarativevmemetaobject.cpp
@@ -381,7 +381,7 @@ QDeclarativeVMEMetaObject::QDeclarativeVMEMetaObject(QObject *obj,
const QMetaObject *other,
const QDeclarativeVMEMetaData *meta,
QDeclarativeCompiledData *cdata)
-: object(obj), compiledData(cdata), ctxt(QDeclarativeData::get(obj)->outerContext),
+: object(obj), compiledData(cdata), ctxt(QDeclarativeData::get(obj, true)->outerContext),
metaData(meta), data(0), methods(0), parent(0)
{
compiledData->addref();
diff --git a/src/declarative/util/qdeclarativestateoperations.cpp b/src/declarative/util/qdeclarativestateoperations.cpp
index 80ae5f5..99f163e 100644
--- a/src/declarative/util/qdeclarativestateoperations.cpp
+++ b/src/declarative/util/qdeclarativestateoperations.cpp
@@ -1128,8 +1128,8 @@ void QDeclarativeAnchorChanges::setObject(QDeclarativeItem *target)
\qml
AnchorChanges {
target: myItem
- left: undefined //remove myItem's left anchor
- right: otherItem.right
+ anchors.left: undefined //remove myItem's left anchor
+ anchors.right: otherItem.right
}
\endqml
*/
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp
index 344df30..ae0abf9 100644
--- a/src/gui/graphicsview/qgraphicsscene.cpp
+++ b/src/gui/graphicsview/qgraphicsscene.cpp
@@ -2545,12 +2545,16 @@ void QGraphicsScene::addItem(QGraphicsItem *item)
return;
}
- if (d->unpolishedItems.isEmpty()) {
- QMetaMethod method = metaObject()->method(d->polishItemsIndex);
- method.invoke(this, Qt::QueuedConnection);
+ // QDeclarativeItems do not rely on initial itemChanged message, as the componentComplete
+ // function allows far more opportunity for delayed-construction optimization.
+ if (!item->d_ptr->isDeclarativeItem) {
+ if (d->unpolishedItems.isEmpty()) {
+ QMetaMethod method = metaObject()->method(d->polishItemsIndex);
+ method.invoke(this, Qt::QueuedConnection);
+ }
+ d->unpolishedItems.append(item);
+ item->d_ptr->pendingPolish = true;
}
- d->unpolishedItems.append(item);
- item->d_ptr->pendingPolish = true;
// Detach this item from its parent if the parent's scene is different
// from this scene.
diff --git a/src/gui/graphicsview/qgraphicswidget_p.cpp b/src/gui/graphicsview/qgraphicswidget_p.cpp
index 076e8626..28070da 100644
--- a/src/gui/graphicsview/qgraphicswidget_p.cpp
+++ b/src/gui/graphicsview/qgraphicswidget_p.cpp
@@ -79,7 +79,8 @@ void QGraphicsWidgetPrivate::init(QGraphicsItem *parentItem, Qt::WindowFlags wFl
resolveLayoutDirection();
q->unsetWindowFrameMargins();
- flags |= QGraphicsItem::ItemUsesExtendedStyleOption | QGraphicsItem::ItemSendsGeometryChanges;
+ flags |= QGraphicsItem::ItemUsesExtendedStyleOption;
+ flags |= QGraphicsItem::ItemSendsGeometryChanges;
if (windowFlags & Qt::Window)
flags |= QGraphicsItem::ItemIsPanel;
}
diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp
index 1c7661d..b7539da 100644
--- a/src/network/access/qnetworkaccessmanager.cpp
+++ b/src/network/access/qnetworkaccessmanager.cpp
@@ -595,8 +595,9 @@ QNetworkCookieJar *QNetworkAccessManager::cookieJar() const
\note QNetworkAccessManager takes ownership of the \a cookieJar object.
- QNetworkAccessManager will set the parent of the \a cookieJar
- passed to itself, so that the cookie jar is deleted when this
+ If \a cookieJar is in the same thread as this QNetworkAccessManager,
+ it will set the parent of the \a cookieJar
+ so that the cookie jar is deleted when this
object is deleted as well. If you want to share cookie jars
between different QNetworkAccessManager objects, you may want to
set the cookie jar's parent to 0 after calling this function.
@@ -621,7 +622,8 @@ void QNetworkAccessManager::setCookieJar(QNetworkCookieJar *cookieJar)
if (d->cookieJar && d->cookieJar->parent() == this)
delete d->cookieJar;
d->cookieJar = cookieJar;
- d->cookieJar->setParent(this);
+ if (thread() == cookieJar->thread())
+ d->cookieJar->setParent(this);
}
}