Merge remote-tracking branch 'origin/5.11' into dev

Change-Id: Ic811cd444e523b904211797112bba6aaec85dddd
bb10
Qt Forward Merge Bot 2018-04-06 09:32:13 +02:00
commit 1a464f35d1
14 changed files with 62 additions and 25 deletions

2
configure vendored
View File

@ -305,7 +305,7 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
BUILD_ON_MAC=no
if [ -d /System/Library/Frameworks/Carbon.framework ]; then
if [ -d /System/Library/Frameworks/Cocoa.framework ]; then
BUILD_ON_MAC=yes
fi
if [ "$OSTYPE" = "msys" ]; then

View File

@ -4439,7 +4439,7 @@ bool QInternal::activateCallbacks(Callback cb, void **parameters)
Calls the message handler with the critical message \a message. If no
message handler has been installed, the message is printed to
stderr. Under Windows, the message is sent to the debugger.
On QNX the message is sent to slogger2
On QNX the message is sent to slogger2.
It exits if the environment variable QT_FATAL_CRITICALS is not empty.
@ -4472,7 +4472,7 @@ bool QInternal::activateCallbacks(Callback cb, void **parameters)
Calls the message handler with the fatal message \a message. If no
message handler has been installed, the message is printed to
stderr. Under Windows, the message is sent to the debugger.
On QNX the message is sent to slogger2
On QNX the message is sent to slogger2.
If you are using the \b{default message handler} this function will
abort to create a core dump. On Windows, for debug builds,

View File

@ -917,10 +917,11 @@ void QHttp2ProtocolHandler::handleContinuedHEADERS()
if (activeStreams.contains(streamID)) {
Stream &stream = activeStreams[streamID];
if (stream.state != Stream::halfClosedLocal
&& stream.state != Stream::remoteReserved) {
&& stream.state != Stream::remoteReserved
&& stream.state != Stream::open) {
// We can receive HEADERS on streams initiated by our requests
// (these streams are in halfClosedLocal state) or remote-reserved
// streams from a server's PUSH_PROMISE.
// (these streams are in halfClosedLocal or open state) or
// remote-reserved streams from a server's PUSH_PROMISE.
finishStreamWithError(stream, QNetworkReply::ProtocolFailure,
QLatin1String("HEADERS on invalid stream"));
sendRST_STREAM(streamID, CANCEL);

View File

@ -107,6 +107,7 @@ public:
void changeCursor(QCursor * widgetCursor, QWindow * widget) override;
void setOverrideCursor(const QCursor &cursor) override;
void clearOverrideCursor() override;
bool hasOverrideCursor() const { return m_overriddenCursor != nullptr; }
QPoint pos() const override;
void setPos(const QPoint &pos) override;

View File

@ -2410,6 +2410,8 @@ static inline bool applyNewCursor(const QWindow *w)
void QWindowsWindow::applyCursor()
{
if (static_cast<const QWindowsCursor *>(screen()->cursor())->hasOverrideCursor())
return;
#ifndef QT_NO_CURSOR
if (m_cursor->isNull()) { // Recurse up to parent with non-null cursor. Set default for toplevel.
if (const QWindow *p = window()->parent()) {

View File

@ -302,7 +302,7 @@ void QGLXContext::init(QXcbScreen *screen, QPlatformOpenGLContext *share)
contextAttributes << GLX_CONTEXT_PROFILE_MASK_ARB << GLX_CONTEXT_ES2_PROFILE_BIT_EXT;
}
if (supportsRobustness && supportsVideoMemoryPurge) {
if (supportsRobustness && supportsVideoMemoryPurge && m_format.testOption(QSurfaceFormat::ResetNotification)) {
QVector<int> contextAttributesWithNvidiaReset = contextAttributes;
contextAttributesWithNvidiaReset << GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB << GLX_LOSE_CONTEXT_ON_RESET_ARB;
@ -539,6 +539,7 @@ bool QGLXContext::makeCurrent(QPlatformSurface *surface)
m_lost = false;
if (m_getGraphicsResetStatus && m_getGraphicsResetStatus() != GL_NO_ERROR) {
m_lost = true;
success = false;
// Drop the surface. Will recreate on the next makeCurrent.
window->invalidateSurface();
}
@ -547,6 +548,11 @@ bool QGLXContext::makeCurrent(QPlatformSurface *surface)
QGLXPbuffer *pbuffer = static_cast<QGLXPbuffer *>(surface);
glxDrawable = pbuffer->pbuffer();
success = glXMakeContextCurrent(m_display, glxDrawable, glxDrawable, m_context);
m_lost = false;
if (m_getGraphicsResetStatus && m_getGraphicsResetStatus() != GL_NO_ERROR) {
m_lost = true;
success = false;
}
}
if (success && surfaceClass == QSurface::Window) {

View File

@ -3944,7 +3944,8 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
if (!hasMenu && ct != QMacStylePrivate::Button_SquareButton) {
if (isPressed
|| (isActive && isEnabled
&& ((btn.features & QStyleOptionButton::DefaultButton && !d->autoDefaultButton)
&& ((btn.state & State_On)
|| ((btn.features & QStyleOptionButton::DefaultButton) && !d->autoDefaultButton)
|| d->autoDefaultButton == btn.styleObject)))
btn.palette.setColor(QPalette::ButtonText, Qt::white);
}

View File

@ -839,7 +839,7 @@ int QWidgetItemV2::heightForWidth(int width) const
const QSize &size = q_cachedHfws[offset % HfwCacheMaxSize];
if (size.width() == width) {
if (q_hfwCacheSize == HfwCacheMaxSize)
q_firstCachedHfw = offset;
q_firstCachedHfw = offset % HfwCacheMaxSize;
return size.height();
}
}

View File

@ -611,12 +611,11 @@ void QAbstractSpinBox::stepDown()
}
/*!
Virtual function that is called whenever the user triggers a step.
The \a steps parameter indicates how many steps were taken, e.g.
Pressing Qt::Key_Down will trigger a call to stepBy(-1),
whereas pressing Qt::Key_Prior will trigger a call to
stepBy(10).
The \a steps parameter indicates how many steps were taken.
For example, pressing \c Qt::Key_Down will trigger a call to \c stepBy(-1),
whereas pressing \c Qt::Key_PageUp will trigger a call to \c stepBy(10).
If you subclass QAbstractSpinBox you must reimplement this
If you subclass \c QAbstractSpinBox you must reimplement this
function. Note that this function is called even if the resulting
value will be outside the bounds of minimum and maximum. It's this
function's job to handle these situations.

View File

@ -2166,8 +2166,12 @@ void QTabBar::mouseReleaseEvent(QMouseEvent *event)
QStyleOptionTabBarBase optTabBase;
optTabBase.initFrom(this);
optTabBase.documentMode = d->documentMode;
if (style()->styleHint(QStyle::SH_TabBar_SelectMouseType, &optTabBase, this) == QEvent::MouseButtonRelease)
const bool selectOnRelease =
(style()->styleHint(QStyle::SH_TabBar_SelectMouseType, &optTabBase, this) == QEvent::MouseButtonRelease);
if (selectOnRelease)
setCurrentIndex(i);
if (!selectOnRelease || !d->validIndex(i) || d->currentIndex == i)
repaint(tabRect(i));
}
/*!\reimp

View File

@ -203,6 +203,7 @@ private:
private slots:
void initTestCase()
{
qputenv("XDG_CONFIG_DIRS", "/does/not/exist");
qputenv("QT_MESSAGE_PATTERN", QByteArray("%{category}: %{type},%{message}"));
oldMessageHandler = qInstallMessageHandler(myCustomMessageHandler);
// Create configuration

View File

@ -50,6 +50,7 @@ private slots:
{
// ensure a clean environment
QStandardPaths::setTestModeEnabled(true);
qputenv("XDG_CONFIG_DIRS", "/does/not/exist");
qunsetenv("QT_LOGGING_CONF");
qunsetenv("QT_LOGGING_RULES");
}

View File

@ -79,9 +79,7 @@ private slots:
void ctor();
void emptyCtor();
void legacyNames();
void consistentC();
void unixLocaleName();
void matchingLocales();
void stringToDouble_data();
void stringToDouble();
@ -108,8 +106,6 @@ private slots:
void toDateTime();
void negativeNumbers();
void numberOptions();
void testNames_data();
void testNames();
void dayName_data();
void dayName();
void standaloneDayName_data();
@ -143,6 +139,15 @@ private slots:
void systemLocale();
// *** ORDER-DEPENDENCY *** (This Is Bad.)
// Test order is determined by order of declaration here: *all* tests that
// QLocale::setDefault() *must* appear *after* all other tests !
void defaulted_ctor(); // This one must be the first of these.
void legacyNames();
void unixLocaleName();
void testNames_data();
void testNames();
// DO NOT add tests here unless they QLocale::setDefault(); see above.
private:
QString m_decimal, m_thousand, m_sdate, m_ldate, m_time;
QString m_sysapp;
@ -232,6 +237,23 @@ void tst_QLocale::ctor()
TEST_CTOR(Chinese, LatinScript, UnitedStates, QLocale::Chinese, QLocale::SimplifiedHanScript, QLocale::China);
#undef TEST_CTOR
}
void tst_QLocale::defaulted_ctor()
{
QLocale default_locale = QLocale::system();
QLocale::Language default_lang = default_locale.language();
QLocale::Country default_country = default_locale.country();
qDebug("Default: %s/%s", QLocale::languageToString(default_lang).toLatin1().constData(),
QLocale::countryToString(default_country).toLatin1().constData());
{
QLocale l(QLocale::C, QLocale::AnyCountry);
QCOMPARE(l.language(), QLocale::C);
QCOMPARE(l.country(), QLocale::AnyCountry);
}
#define TEST_CTOR(req_lang, req_country, exp_lang, exp_country) \
{ \
QLocale l(QLocale::req_lang, QLocale::req_country); \
@ -239,11 +261,6 @@ void tst_QLocale::ctor()
QCOMPARE((int)l.country(), (int)exp_country); \
}
{
QLocale l(QLocale::C, QLocale::AnyCountry);
QCOMPARE(l.language(), QLocale::C);
QCOMPARE(l.country(), QLocale::AnyCountry);
}
TEST_CTOR(AnyLanguage, AnyCountry, default_lang, default_country)
TEST_CTOR(C, AnyCountry, QLocale::C, QLocale::AnyCountry)
TEST_CTOR(Aymara, AnyCountry, default_lang, default_country)
@ -1961,10 +1978,11 @@ void tst_QLocale::testNames_data()
QTest::addColumn<int>("language");
QTest::addColumn<int>("country");
QLocale::setDefault(QLocale(QLocale::C)); // Ensures predictable fall-backs
for (int i = 0; i < locale_data_count; ++i) {
const QLocaleData &item = locale_data[i];
const QString testName = QLatin1String("data_") + QString::number(i) + QLatin1String(" (")
+ QLocale::languageToString((QLocale::Language)item.m_language_id)
+ QLatin1Char('/') + QLocale::countryToString((QLocale::Country)item.m_country_id)

View File

@ -93,6 +93,9 @@ void tst_QCursor::equality()
VERIFY_DIFFERENT(bitmapCursor, pixmapCursor);
// Empty pixmap
for (int i = 0; i < 18; ++i)
QTest::ignoreMessage(QtWarningMsg, "QCursor: Cannot create bitmap cursor; invalid bitmap(s)");
QPixmap emptyPixmap;
QCursor emptyPixmapCursor(emptyPixmap);
QCOMPARE(emptyPixmapCursor.shape(), Qt::ArrowCursor);