diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/tools/qbytearray.cpp | 39 | ||||
-rw-r--r-- | src/corelib/tools/qbytearray.h | 3 | ||||
-rw-r--r-- | src/corelib/tools/qstring.cpp | 40 | ||||
-rw-r--r-- | src/corelib/tools/qstring.h | 1 | ||||
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativeitem.cpp | 5 | ||||
-rw-r--r-- | src/gui/graphicsview/qgraphicswidget.cpp | 10 | ||||
-rw-r--r-- | src/gui/kernel/qwidget_mac.mm | 6 | ||||
-rw-r--r-- | src/gui/widgets/qtabwidget.cpp | 2 | ||||
-rw-r--r-- | src/network/access/qnetworkcookiejar.cpp | 3 |
9 files changed, 85 insertions, 24 deletions
diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp index c5f70b0..29a7263 100644 --- a/src/corelib/tools/qbytearray.cpp +++ b/src/corelib/tools/qbytearray.cpp @@ -3814,7 +3814,7 @@ QByteArray QByteArray::number(double n, char f, int prec) accepting a \c{const char *} expected to be '\\0'-terminated will fail. - \sa data(), constData() + \sa setRawData(), data(), constData() */ QByteArray QByteArray::fromRawData(const char *data, int size) @@ -3834,6 +3834,37 @@ QByteArray QByteArray::fromRawData(const char *data, int size) } /*! + \since 4.7 + + Resets the QByteArray to use the first \a size bytes of the + \a data array. The bytes are \e not copied. The QByteArray will + contain the \a data pointer. The caller guarantees that \a data + will not be deleted or modified as long as this QByteArray and any + copies of it exist that have not been modified. + + This function can be used instead of fromRawData() to re-use + existings QByteArray objects to save memory re-allocations. + + \sa fromRawData(), data(), constData() +*/ +QByteArray &QByteArray::setRawData(const char *data, uint size) +{ + if (d->ref != 1 || d->alloc) { + *this = fromRawData(data, size); + } else { + if (data) { + d->data = const_cast<char *>(data); + } else { + d->data = d->array; + size = 0; + } + d->alloc = d->size = size; + *d->array = '\0'; + } + return *this; +} + +/*! Returns a decoded copy of the Base64 array \a base64. Input is not checked for validity; invalid characters in the input are skipped, enabling the decoding process to continue with subsequent characters. @@ -4228,12 +4259,6 @@ QByteArray QByteArray::toPercentEncoding(const QByteArray &exclude, const QByteA */ /*! - \fn QByteArray& QByteArray::setRawData(const char *a, uint n) - - Use fromRawData() instead. -*/ - -/*! \fn void QByteArray::resetRawData(const char *data, uint n) Use clear() instead. diff --git a/src/corelib/tools/qbytearray.h b/src/corelib/tools/qbytearray.h index 0b77512..a3fe3f5 100644 --- a/src/corelib/tools/qbytearray.h +++ b/src/corelib/tools/qbytearray.h @@ -299,6 +299,7 @@ public: QByteArray &setNum(qulonglong, int base = 10); QByteArray &setNum(float, char f = 'g', int prec = 6); QByteArray &setNum(double, char f = 'g', int prec = 6); + QByteArray &setRawData(const char *a, uint n); // ### Qt 5: use an int static QByteArray number(int, int base = 10); static QByteArray number(uint, int base = 10); @@ -343,8 +344,6 @@ public: inline QT3_SUPPORT QByteArray& duplicate(const QByteArray& a) { *this = a; return *this; } inline QT3_SUPPORT QByteArray& duplicate(const char *a, uint n) { *this = QByteArray(a, n); return *this; } - inline QT3_SUPPORT QByteArray& setRawData(const char *a, uint n) - { *this = fromRawData(a, n); return *this; } inline QT3_SUPPORT void resetRawData(const char *, uint) { clear(); } inline QT3_SUPPORT QByteArray lower() const { return toLower(); } inline QT3_SUPPORT QByteArray upper() const { return toUpper(); } diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index 2f12b80..0169b20 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -7056,7 +7056,7 @@ void QString::updateProperties() const '\\0'-terminated string (although utf16() does, at the cost of copying the raw data). - \sa fromUtf16() + \sa fromUtf16(), setRawData() */ QString QString::fromRawData(const QChar *unicode, int size) { @@ -7075,6 +7075,44 @@ QString QString::fromRawData(const QChar *unicode, int size) return QString(x, 0); } +/*! + \since 4.7 + + Resets the QString to use the first \a size Unicode characters + in the array \a unicode. The data in \a unicode is \e not + copied. The caller must be able to guarantee that \a unicode will + not be deleted or modified as long as the QString (or an + unmodified copy of it) exists. + + This function can be used instead of fromRawData() to re-use + existings QString objects to save memory re-allocations. + + \sa fromRawData() +*/ +QString &QString::setRawData(const QChar *unicode, int size) +{ + if (d->ref != 1 || d->alloc) { + *this = fromRawData(unicode, size); + } else { +#ifdef QT3_SUPPORT + if (d->asciiCache) { + Q_ASSERT(asciiCache); + asciiCache->remove(d); + } +#endif + if (unicode) { + d->data = (ushort *)unicode; + } else { + d->data = d->array; + size = 0; + } + d->alloc = d->size = size; + *d->array = '\0'; + d->clean = d->asciiCache = d->simpletext = d->righttoleft = d->capacity = 0; + } + return *this; +} + /*! \class QLatin1String \brief The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal. diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h index ea12c2f..a1c4e77 100644 --- a/src/corelib/tools/qstring.h +++ b/src/corelib/tools/qstring.h @@ -343,6 +343,7 @@ public: int toWCharArray(wchar_t *array) const; static QString fromWCharArray(const wchar_t *, int size = -1); + QString &setRawData(const QChar *unicode, int size); QString &setUnicode(const QChar *unicode, int size); inline QString &setUtf16(const ushort *utf16, int size); diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp index bc0c65e..096e4bf 100644 --- a/src/declarative/graphicsitems/qdeclarativeitem.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp @@ -1268,11 +1268,6 @@ QDeclarativeKeysAttached *QDeclarativeKeysAttached::qmlAttachedProperties(QObjec */ /*! - \property QDeclarativeItem::effect - \internal -*/ - -/*! \property QDeclarativeItem::focus \internal */ diff --git a/src/gui/graphicsview/qgraphicswidget.cpp b/src/gui/graphicsview/qgraphicswidget.cpp index bc8ccb01..06a44b7 100644 --- a/src/gui/graphicsview/qgraphicswidget.cpp +++ b/src/gui/graphicsview/qgraphicswidget.cpp @@ -324,11 +324,9 @@ void QGraphicsWidget::resize(const QSizeF &size) */ /*! - \fn QGraphicsWidget::geometryChanged() - This signal gets emitted whenever the geometry of the item changes - \internal + This signal gets emitted whenever the geometry is changed in setGeometry(). */ /*! @@ -408,12 +406,6 @@ void QGraphicsWidget::setGeometry(const QRectF &rect) } /*! - \fn QGraphicsWidget::geometryChanged() - - This signal gets emitted whenever the geometry is changed in setGeometry(). -*/ - -/*! \fn QRectF QGraphicsWidget::rect() const Returns the item's local rect as a QRectF. This function is equivalent diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index d7cd2eb..e29b755 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -2300,6 +2300,12 @@ void QWidgetPrivate::finishCreateWindow_sys_Cocoa(void * /*NSWindow * */ voidWin if (q->testAttribute(Qt::WA_DropSiteRegistered)) registerDropSite(true); transferChildren(); + + // Tell Cocoa explicit that we wan't the view to receive key events + // (regardless of focus policy) because this is how it works on other + // platforms (and in the carbon port): + if (!qApp->focusWidget()) + [windowRef makeFirstResponder:nsview]; } if (topExtra->posFromMove) { diff --git a/src/gui/widgets/qtabwidget.cpp b/src/gui/widgets/qtabwidget.cpp index 047a905..4a61935 100644 --- a/src/gui/widgets/qtabwidget.cpp +++ b/src/gui/widgets/qtabwidget.cpp @@ -542,6 +542,8 @@ void QTabWidget::setTabEnabled(int index, bool enable) { Q_D(QTabWidget); d->tabs->setTabEnabled(index, enable); + if (QWidget *widget = d->stack->widget(index)) + widget->setEnabled(enable); } /*! diff --git a/src/network/access/qnetworkcookiejar.cpp b/src/network/access/qnetworkcookiejar.cpp index 8727095..0b3a918 100644 --- a/src/network/access/qnetworkcookiejar.cpp +++ b/src/network/access/qnetworkcookiejar.cpp @@ -269,6 +269,7 @@ QList<QNetworkCookie> QNetworkCookieJar::cookiesForUrl(const QUrl &url) const Q_D(const QNetworkCookieJar); QDateTime now = QDateTime::currentDateTime(); QList<QNetworkCookie> result; + bool isEncrypted = url.scheme().toLower() == QLatin1String("https"); // scan our cookies for something that matches QList<QNetworkCookie>::ConstIterator it = d->allCookies.constBegin(), @@ -280,6 +281,8 @@ QList<QNetworkCookie> QNetworkCookieJar::cookiesForUrl(const QUrl &url) const continue; if (!(*it).isSessionCookie() && (*it).expirationDate() < now) continue; + if ((*it).isSecure() && !isEncrypted) + continue; // insert this cookie into result, sorted by path QList<QNetworkCookie>::Iterator insertIt = result.begin(); |