Merge "Merge remote-tracking branch 'origin/5.12' into 5.13"

This commit is contained in:
Qt Forward Merge Bot 2019-07-18 01:00:08 +02:00
commit d3de20d409
9 changed files with 112 additions and 85 deletions

View File

@ -341,11 +341,10 @@ static int fromOffsetString(const QStringRef &offsetString, bool *valid) Q_DECL_
setDate(). The fromString() function returns a QDate given a string and a
date format which is used to interpret the date within the string.
The year(), month(), and day() functions provide access to the
year, month, and day numbers. Also, dayOfWeek() and dayOfYear()
functions are provided. The same information is provided in
textual format by the toString(), shortDayName(), longDayName(),
shortMonthName(), and longMonthName() functions.
The year(), month(), and day() functions provide access to the year, month,
and day numbers. Also, dayOfWeek() and dayOfYear() functions are
provided. The same information is provided in textual format by
toString(). The day and month numbers can be mapped to names using QLocal.
QDate provides a full set of operators to compare two QDate
objects where smaller means earlier, and larger means later.
@ -810,11 +809,10 @@ static QString toStringIsoDate(qint64 jd)
Returns the date as a string. The \a format parameter determines
the format of the string.
If the \a format is Qt::TextDate, the string is formatted in
the default way. QDate::shortDayName() and QDate::shortMonthName()
are used to generate the string, so the day and month names will
be localized names using the system locale, i.e. QLocale::system(). An
example of this formatting is "Sat May 20 1995".
If the \a format is Qt::TextDate, the string is formatted in the default
way. The day and month names will be localized names using the system
locale, i.e. QLocale::system(). An example of this formatting
is "Sat May 20 1995".
If the \a format is Qt::ISODate, the string format corresponds
to the ISO 8601 extended specification for representations of
@ -846,7 +844,7 @@ static QString toStringIsoDate(qint64 jd)
range 0 to 9999. This restriction may apply to locale-aware
formats as well, depending on the locale settings.
\sa fromString(), shortDayName(), shortMonthName(), QLocale::toString()
\sa fromString(), QLocale::toString()
*/
QString QDate::toString(Qt::DateFormat format) const
{
@ -3795,12 +3793,10 @@ void QDateTime::setTime_t(uint secsSince1Jan1970UTC)
Returns the datetime as a string in the \a format given.
If the \a format is Qt::TextDate, the string is formatted in
the default way. QDate::shortDayName(), QDate::shortMonthName(),
and QTime::toString() are used to generate the string, so the
day and month names will be localized names using the system locale,
i.e. QLocale::system(). An example of this formatting is
"Wed May 20 03:40:13 1998".
If the \a format is Qt::TextDate, the string is formatted in the default
way. The day and month names will be localized names using the system
locale, i.e. QLocale::system(). An example of this formatting is "Wed May 20
03:40:13 1998".
If the \a format is Qt::ISODate, the string format corresponds
to the ISO 8601 extended specification for representations of
@ -4976,18 +4972,14 @@ QDateTime QDateTime::fromString(const QString& string, Qt::DateFormat format)
\row \li dd \li the day as number with a leading zero (01 to 31)
\row \li ddd
\li the abbreviated localized day name (e.g. 'Mon' to 'Sun').
Uses QDate::shortDayName().
\row \li dddd
\li the long localized day name (e.g. 'Monday' to 'Sunday').
Uses QDate::longDayName().
\row \li M \li the month as number without a leading zero (1-12)
\row \li MM \li the month as number with a leading zero (01-12)
\row \li MMM
\li the abbreviated localized month name (e.g. 'Jan' to 'Dec').
Uses QDate::shortMonthName().
\row \li MMMM
\li the long localized month name (e.g. 'January' to 'December').
Uses QDate::longMonthName().
\row \li yy \li the year as two digit number (00-99)
\row \li yyyy \li the year as four digit number
\endtable

View File

@ -611,8 +611,8 @@ bool QOpenGLContext::create()
d->platformGLContext = QGuiApplicationPrivate::platformIntegration()->createPlatformOpenGLContext(this);
if (!d->platformGLContext)
return false;
d->platformGLContext->initialize();
d->platformGLContext->setContext(this);
d->platformGLContext->initialize();
if (!d->platformGLContext->isSharing())
d->shareContext = 0;
d->shareGroup = d->shareContext ? d->shareContext->shareGroup() : new QOpenGLContextGroup;

View File

@ -627,7 +627,7 @@ void QHttpSocketEngine::slotSocketReadNotification()
// from http spec is also allowed.
if (proxyConnectionHeader.isEmpty())
proxyConnectionHeader = d->reply->headerField("Connection");
if (proxyConnectionHeader.compare("close", Qt::CaseSensitive) == 0) {
if (proxyConnectionHeader.compare("close", Qt::CaseInsensitive) == 0) {
willClose = true;
} else if (proxyConnectionHeader.compare("keep-alive", Qt::CaseInsensitive) == 0) {
willClose = false;

View File

@ -56,6 +56,8 @@ public:
QCocoaGLContext(QOpenGLContext *context);
~QCocoaGLContext();
void initialize() override;
bool makeCurrent(QPlatformSurface *surface) override;
void swapBuffers(QPlatformSurface *surface) override;
void doneCurrent() override;

View File

@ -40,6 +40,8 @@
#include "qcocoaglcontext.h"
#include "qcocoawindow.h"
#include "qcocoahelpers.h"
#include "qcocoascreen.h"
#include <qdebug.h>
#include <QtPlatformHeaders/qcocoanativecontext.h>
#include <dlfcn.h>
@ -53,32 +55,19 @@ static inline QByteArray getGlString(GLenum param)
return QByteArray();
}
@implementation NSOpenGLPixelFormat (QtHelpers)
- (GLint)qt_getAttribute:(NSOpenGLPixelFormatAttribute)attribute
{
int value = 0;
[self getValues:&value forAttribute:attribute forVirtualScreen:0];
return value;
}
@end
@implementation NSOpenGLContext (QtHelpers)
- (GLint)qt_getParameter:(NSOpenGLContextParameter)parameter
{
int value = 0;
[self getValues:&value forParameter:parameter];
return value;
}
@end
QT_BEGIN_NAMESPACE
Q_LOGGING_CATEGORY(lcQpaOpenGLContext, "qt.qpa.openglcontext", QtWarningMsg);
QCocoaGLContext::QCocoaGLContext(QOpenGLContext *context)
: QPlatformOpenGLContext(), m_format(context->format())
: QPlatformOpenGLContext()
, m_format(context->format())
{
QVariant nativeHandle = context->nativeHandle();
}
void QCocoaGLContext::initialize()
{
QVariant nativeHandle = context()->nativeHandle();
if (!nativeHandle.isNull()) {
if (!nativeHandle.canConvert<QCocoaNativeContext>()) {
qCWarning(lcQpaOpenGLContext, "QOpenGLContext native handle must be a QCocoaNativeContext");
@ -95,7 +84,7 @@ QCocoaGLContext::QCocoaGLContext(QOpenGLContext *context)
// Note: We have no way of knowing whether the NSOpenGLContext was created with the
// share context as reported by the QOpenGLContext, but we just have to trust that
// it was. It's okey, as the only thing we're using it for is to report isShared().
if (QPlatformOpenGLContext *shareContext = context->shareHandle())
if (QPlatformOpenGLContext *shareContext = context()->shareHandle())
m_shareContext = static_cast<QCocoaGLContext *>(shareContext)->nativeContext();
updateSurfaceFormat();
@ -110,7 +99,7 @@ QCocoaGLContext::QCocoaGLContext(QOpenGLContext *context)
if (m_format.renderableType() != QSurfaceFormat::OpenGL)
return;
if (QPlatformOpenGLContext *shareContext = context->shareHandle()) {
if (QPlatformOpenGLContext *shareContext = context()->shareHandle()) {
m_shareContext = static_cast<QCocoaGLContext *>(shareContext)->nativeContext();
// Allow sharing between 3.2 Core and 4.1 Core profile versions in
@ -150,6 +139,9 @@ QCocoaGLContext::QCocoaGLContext(QOpenGLContext *context)
return;
}
// The native handle should reflect the underlying context, even if we created it
context()->setNativeHandle(QVariant::fromValue<QCocoaNativeContext>(m_context));
// --------------------- Set NSOpenGLContext properties ---------------------
const GLint interval = m_format.swapInterval() >= 0 ? m_format.swapInterval() : 1;
@ -285,7 +277,32 @@ void QCocoaGLContext::updateSurfaceFormat()
NSOpenGLPixelFormat *pixelFormat = m_context.pixelFormat;
int colorSize = [pixelFormat qt_getAttribute:NSOpenGLPFAColorSize];
GLint virtualScreen = [&, this]() {
auto *platformScreen = static_cast<QCocoaScreen*>(context()->screen()->handle());
auto displayId = platformScreen->nativeScreen().qt_displayId;
auto requestedDisplay = CGDisplayIDToOpenGLDisplayMask(displayId);
for (int i = 0; i < pixelFormat.numberOfVirtualScreens; ++i) {
GLint supportedDisplays;
[pixelFormat getValues:&supportedDisplays forAttribute:NSOpenGLPFAScreenMask forVirtualScreen:i];
// Note: The mask returned for NSOpenGLPFAScreenMask is a bit mask of
// physical displays that the renderer can drive, while the one returned
// from CGDisplayIDToOpenGLDisplayMask has a single bit set, representing
// that particular display.
if (requestedDisplay & supportedDisplays)
return i;
}
qCWarning(lcQpaOpenGLContext) << "Could not find virtual screen for"
<< platformScreen << "with displayId" << displayId;
return 0;
}();
auto pixelFormatAttribute = [&](NSOpenGLPixelFormatAttribute attribute) {
int value = 0;
[pixelFormat getValues:&value forAttribute:attribute forVirtualScreen:virtualScreen];
return value;
};
int colorSize = pixelFormatAttribute(NSOpenGLPFAColorSize);
colorSize /= 4; // The attribute includes the alpha component
m_format.setRedBufferSize(colorSize);
m_format.setGreenBufferSize(colorSize);
@ -297,22 +314,28 @@ void QCocoaGLContext::updateSurfaceFormat()
// size, as that will make the user believe the alpha channel can be used for
// something useful, when in reality it can't, due to the surface being opaque.
if (m_format.alphaBufferSize() > 0)
m_format.setAlphaBufferSize([pixelFormat qt_getAttribute:NSOpenGLPFAAlphaSize]);
m_format.setAlphaBufferSize(pixelFormatAttribute(NSOpenGLPFAAlphaSize));
m_format.setDepthBufferSize([pixelFormat qt_getAttribute:NSOpenGLPFADepthSize]);
m_format.setStencilBufferSize([pixelFormat qt_getAttribute:NSOpenGLPFAStencilSize]);
m_format.setSamples([pixelFormat qt_getAttribute:NSOpenGLPFASamples]);
m_format.setDepthBufferSize(pixelFormatAttribute(NSOpenGLPFADepthSize));
m_format.setStencilBufferSize(pixelFormatAttribute(NSOpenGLPFAStencilSize));
m_format.setSamples(pixelFormatAttribute(NSOpenGLPFASamples));
if ([pixelFormat qt_getAttribute:NSOpenGLPFATripleBuffer])
if (pixelFormatAttribute(NSOpenGLPFATripleBuffer))
m_format.setSwapBehavior(QSurfaceFormat::TripleBuffer);
else if ([pixelFormat qt_getAttribute:NSOpenGLPFADoubleBuffer])
else if (pixelFormatAttribute(NSOpenGLPFADoubleBuffer))
m_format.setSwapBehavior(QSurfaceFormat::DoubleBuffer);
else
m_format.setSwapBehavior(QSurfaceFormat::SingleBuffer);
// ------------------- Query the context -------------------
m_format.setSwapInterval([m_context qt_getParameter:NSOpenGLCPSwapInterval]);
auto glContextParameter = [&](NSOpenGLContextParameter parameter) {
int value = 0;
[m_context getValues:&value forParameter:parameter];
return value;
};
m_format.setSwapInterval(glContextParameter(NSOpenGLCPSwapInterval));
if (oldContext)
[oldContext makeCurrentContext];

View File

@ -331,9 +331,7 @@ QPlatformOffscreenSurface *QCocoaIntegration::createPlatformOffscreenSurface(QOf
#ifndef QT_NO_OPENGL
QPlatformOpenGLContext *QCocoaIntegration::createPlatformOpenGLContext(QOpenGLContext *context) const
{
QCocoaGLContext *glContext = new QCocoaGLContext(context);
context->setNativeHandle(QVariant::fromValue<QCocoaNativeContext>(glContext->nativeContext()));
return glContext;
return new QCocoaGLContext(context);
}
#endif

View File

@ -303,23 +303,28 @@ void QWindowsScreen::handleChanges(const QWindowsScreenData &newData)
m_data.hMonitor = newData.hMonitor;
}
if (m_data.geometry != newData.geometry || m_data.availableGeometry != newData.availableGeometry) {
m_data.geometry = newData.geometry;
m_data.availableGeometry = newData.availableGeometry;
QWindowSystemInterface::handleScreenGeometryChange(screen(),
newData.geometry, newData.availableGeometry);
}
if (!qFuzzyCompare(m_data.dpi.first, newData.dpi.first)
|| !qFuzzyCompare(m_data.dpi.second, newData.dpi.second)) {
m_data.dpi = newData.dpi;
// QGuiApplicationPrivate::processScreenGeometryChange() checks and emits
// DPI and orientation as well, so, assign new values and emit DPI first.
const bool geometryChanged = m_data.geometry != newData.geometry
|| m_data.availableGeometry != newData.availableGeometry;
const bool dpiChanged = !qFuzzyCompare(m_data.dpi.first, newData.dpi.first)
|| !qFuzzyCompare(m_data.dpi.second, newData.dpi.second);
const bool orientationChanged = m_data.orientation != newData.orientation;
m_data.dpi = newData.dpi;
m_data.orientation = newData.orientation;
m_data.geometry = newData.geometry;
m_data.availableGeometry = newData.availableGeometry;
if (dpiChanged) {
QWindowSystemInterface::handleScreenLogicalDotsPerInchChange(screen(),
newData.dpi.first,
newData.dpi.second);
}
if (m_data.orientation != newData.orientation) {
m_data.orientation = newData.orientation;
QWindowSystemInterface::handleScreenOrientationChange(screen(),
newData.orientation);
if (orientationChanged)
QWindowSystemInterface::handleScreenOrientationChange(screen(), newData.orientation);
if (geometryChanged) {
QWindowSystemInterface::handleScreenGeometryChange(screen(),
newData.geometry, newData.availableGeometry);
}
}

View File

@ -293,7 +293,7 @@ QLineEdit::~QLineEdit()
/*!
\property QLineEdit::text
\brief the line edit's text
\brief the line edit's text.
Setting this property clears the selection, clears the undo/redo
history, moves the cursor to the end of the line and resets the
@ -322,7 +322,7 @@ void QLineEdit::setText(const QString& text)
\since 4.7
\property QLineEdit::placeholderText
\brief the line edit's placeholder text
\brief the line edit's placeholder text.
Setting this property makes the line edit display a grayed-out
placeholder text as long as the line edit is empty.
@ -354,7 +354,7 @@ void QLineEdit::setPlaceholderText(const QString& placeholderText)
/*!
\property QLineEdit::displayText
\brief the displayed text
\brief the displayed text.
If \l echoMode is \l Normal this returns the same as text(); if
\l EchoMode is \l Password or \l PasswordEchoOnEdit it returns a string of
@ -375,7 +375,7 @@ QString QLineEdit::displayText() const
/*!
\property QLineEdit::maxLength
\brief the maximum permitted length of the text
\brief the maximum permitted length of the text.
If the text is too long, it is truncated at the limit.
@ -405,7 +405,7 @@ void QLineEdit::setMaxLength(int maxLength)
/*!
\property QLineEdit::frame
\brief whether the line edit draws itself with a frame
\brief whether the line edit draws itself with a frame.
If enabled (the default) the line edit draws itself inside a
frame, otherwise the line edit draws itself without any frame.
@ -544,7 +544,7 @@ void QLineEdit::setFrame(bool enable)
/*!
\property QLineEdit::echoMode
\brief the line edit's echo mode
\brief the line edit's echo mode.
The echo mode determines how the text entered in the line edit is
displayed (or echoed) to the user.
@ -723,7 +723,7 @@ QSize QLineEdit::minimumSizeHint() const
/*!
\property QLineEdit::cursorPosition
\brief the current cursor position for this line edit
\brief the current cursor position for this line edit.
Setting the cursor position causes a repaint when appropriate.
@ -756,7 +756,7 @@ int QLineEdit::cursorPositionAt(const QPoint &pos)
/*!
\property QLineEdit::alignment
\brief the alignment of the line edit
\brief the alignment of the line edit.
Both horizontal and vertical alignment is allowed here, Qt::AlignJustify
will map to Qt::AlignLeft.
@ -894,7 +894,7 @@ void QLineEdit::end(bool mark)
/*!
\property QLineEdit::modified
\brief whether the line edit's contents has been modified by the user
\brief whether the line edit's contents has been modified by the user.
The modified flag is never read by QLineEdit; it has a default value
of false and is changed to true whenever the user changes the line
@ -924,7 +924,7 @@ void QLineEdit::setModified(bool modified)
/*!
\property QLineEdit::hasSelectedText
\brief whether there is any text selected
\brief whether there is any text selected.
hasSelectedText() returns \c true if some or all of the text has been
selected by the user; otherwise returns \c false.
@ -943,7 +943,7 @@ bool QLineEdit::hasSelectedText() const
/*!
\property QLineEdit::selectedText
\brief the selected text
\brief the selected text.
If there is no selected text this property's value is
an empty string.
@ -1030,7 +1030,7 @@ void QLineEdit::setSelection(int start, int length)
/*!
\property QLineEdit::undoAvailable
\brief whether undo is available
\brief whether undo is available.
Undo becomes available once the user has modified the text in the line edit.
@ -1045,7 +1045,7 @@ bool QLineEdit::isUndoAvailable() const
/*!
\property QLineEdit::redoAvailable
\brief whether redo is available
\brief whether redo is available.
Redo becomes available once the user has performed one or more undo operations
on text in the line edit.
@ -1062,7 +1062,7 @@ bool QLineEdit::isRedoAvailable() const
/*!
\property QLineEdit::dragEnabled
\brief whether the lineedit starts a drag if the user presses and
moves the mouse on some selected text
moves the mouse on some selected text.
Dragging is disabled by default.
*/
@ -1081,7 +1081,7 @@ void QLineEdit::setDragEnabled(bool b)
/*!
\property QLineEdit::cursorMoveStyle
\brief the movement style of cursor in this line edit
\brief the movement style of cursor in this line edit.
\since 4.8
When this property is set to Qt::VisualMoveStyle, the line edit will use visual
@ -1184,7 +1184,7 @@ QMargins QLineEdit::textMargins() const
/*!
\property QLineEdit::inputMask
\brief The validation input mask
\brief The validation input mask.
If no mask is set, inputMask() returns an empty string.

View File

@ -71,6 +71,8 @@ class tst_Http2 : public QObject
public:
tst_Http2();
~tst_Http2();
public slots:
void init();
private slots:
// Tests:
void singleRequest_data();
@ -174,6 +176,11 @@ tst_Http2::~tst_Http2()
}
}
void tst_Http2::init()
{
manager.clearConnectionCache();
}
void tst_Http2::singleRequest_data()
{
QTest::addColumn<QNetworkRequest::Attribute>("h2Attribute");