Merge "Merge remote-tracking branch 'origin/5.3' into dev" into refs/staging/dev

bb10
Frederik Gladhorn 2014-07-24 21:10:29 +02:00 committed by The Qt Project
commit a1d2bf257e
26 changed files with 264 additions and 42 deletions

View File

@ -66,7 +66,8 @@ if (NOT _qt5gui_OPENGL_INCLUDE_DIR)
endif()
unset(_GL_INCDIRS)
_qt5_Gui_check_file_exists(${_qt5gui_OPENGL_INCLUDE_DIR})
# Don\'t check for existence of the "_qt5gui_OPENGL_INCLUDE_DIR" because it is
# optional.
list(APPEND Qt5Gui_INCLUDE_DIRS ${_qt5gui_OPENGL_INCLUDE_DIR})
set_property(TARGET Qt5::Gui APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${_qt5gui_OPENGL_INCLUDE_DIR})
@ -105,13 +106,18 @@ macro(_qt5gui_find_extra_libs Name Libs LibDir IncDirs)
)
!!IF mac
set(Qt5Gui_${_cmake_lib_name}_LIBRARY "${Qt5Gui_${_cmake_lib_name}_LIBRARY}/${_lib}")
if (NOT EXISTS "${Qt5Gui_${_cmake_lib_name}_LIBRARY}")
set(Qt5Gui_${_cmake_lib_name}_LIBRARY)
endif()
!!ENDIF
if (WIN32 AND NOT Qt5Gui_${_cmake_lib_name}_LIBRARY)
if (NOT Qt5Gui_${_cmake_lib_name}_LIBRARY)
# The above find_library call doesn\'t work for finding
# libraries in Windows SDK paths outside of the proper
# environment. Just add the library name to the result
# variable instead.
# We avoid doing this in the first case because Qt may be
# environment, even if the libraries are present. In other
# cases it is OK for the libraries to not be found
# because they are optional dependencies of Qt5Gui, needed
# only if the qopengl.h header is used.
# We try to find the libraries in the first place because Qt may be
# compiled with another set of GL libraries (such as coming
# from ANGLE). The point of these find calls is to try to
# find the same binaries as Qt is compiled with (as they are
@ -119,7 +125,6 @@ macro(_qt5gui_find_extra_libs Name Libs LibDir IncDirs)
# above with paths known to qmake.
set(_Qt5Gui_${_cmake_lib_name}_LIBRARY_DONE TRUE)
unset(Qt5Gui_${_cmake_lib_name}_LIBRARY CACHE)
list(APPEND Qt5Gui_${Name}_LIBRARIES ${_lib})
else()
add_library(Qt5::Gui_${_cmake_lib_name} SHARED IMPORTED)
set_property(TARGET Qt5::Gui_${_cmake_lib_name} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${Qt5Gui_${Name}_INCLUDE_DIRS})
@ -152,11 +157,6 @@ macro(_qt5gui_find_extra_libs Name Libs LibDir IncDirs)
endif()
endif()
endforeach()
if (NOT CMAKE_CROSSCOMPILING)
foreach(_dir ${Qt5Gui_${Name}_INCLUDE_DIRS})
_qt5_Gui_check_file_exists(${_dir})
endforeach()
endif()
endmacro()

View File

@ -1119,6 +1119,11 @@ Qt::WindowState QWindow::windowState() const
void QWindow::setTransientParent(QWindow *parent)
{
Q_D(QWindow);
if (parent && !parent->isTopLevel()) {
qWarning() << Q_FUNC_INFO << parent << "must be a top level window.";
return;
}
d->transientParent = parent;
QGuiApplicationPrivate::updateBlockedStatus(this);

View File

@ -108,6 +108,10 @@ QT_BEGIN_NAMESPACE
This class is only used if the text layout is used to lay out
parts of a QTextDocument.
Normally, you do not need to create a QTextInlineObject. It is
used by QAbstractTextDocumentLayout to handle inline objects when
implementing a custom layout.
The inline object has various attributes that can be set, for
example using, setWidth(), setAscent(), and setDescent(). The
rectangle it occupies is given by rect(), and its direction by
@ -117,6 +121,7 @@ QT_BEGIN_NAMESPACE
/*!
\fn QTextInlineObject::QTextInlineObject(int i, QTextEngine *e)
\internal
Creates a new inline object for the item at position \a i in the
text engine \a e.

View File

@ -56,7 +56,7 @@
#define CACHE_POSTFIX QLatin1String(".d")
#define PREPARED_SLASH QLatin1String("prepared/")
#define CACHE_VERSION 7
#define CACHE_VERSION 8
#define DATA_DIR QLatin1String("data")
#define MAX_COMPRESSION_SIZE (1024 * 1024 * 3)
@ -686,6 +686,7 @@ void QCacheItem::writeHeader(QFile *device) const
out << qint32(CacheMagic);
out << qint32(CurrentCacheVersion);
out << static_cast<qint32>(out.version());
out << metaData;
bool compressed = canCompress();
out << compressed;
@ -719,6 +720,13 @@ bool QCacheItem::read(QFile *device, bool readData)
if (v != CurrentCacheVersion)
return false;
qint32 streamVersion;
in >> streamVersion;
// Default stream version is also the highest we can handle
if (streamVersion > in.version())
return false;
in.setVersion(streamVersion);
bool compressed;
QByteArray dataBA;
in >> metaData;

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the plugins of the Qt Toolkit.
@ -347,7 +347,13 @@ QWindowsTabletDeviceData QWindowsTabletSupport::tabletInit(const quint64 uniqueI
bool QWindowsTabletSupport::translateTabletProximityEvent(WPARAM /* wParam */, LPARAM lParam)
{
const bool enteredProximity = LOWORD(lParam) != 0;
if (!LOWORD(lParam)) {
qCDebug(lcQpaTablet) << "leave proximity for device #" << m_currentDevice;
QWindowSystemInterface::handleTabletLeaveProximityEvent(m_devices.at(m_currentDevice).currentDevice,
m_devices.at(m_currentDevice).currentPointerType,
m_devices.at(m_currentDevice).uniqueId);
return true;
}
PACKET proximityBuffer[1]; // we are only interested in the first packet in this case
const int totalPacks = QWindowsTabletSupport::m_winTab32DLL.wTPacketsGet(m_context, 1, proximityBuffer);
if (!totalPacks)
@ -367,17 +373,11 @@ bool QWindowsTabletSupport::translateTabletProximityEvent(WPARAM /* wParam */, L
m_devices.push_back(tabletInit(uniqueId, cursorType));
}
m_devices[m_currentDevice].currentPointerType = pointerType(currentCursor);
qCDebug(lcQpaTablet) << __FUNCTION__ << (enteredProximity ? "enter" : "leave")
<< " proximity for device #" << m_currentDevice << m_devices.at(m_currentDevice);
if (enteredProximity) {
QWindowSystemInterface::handleTabletEnterProximityEvent(m_devices.at(m_currentDevice).currentDevice,
m_devices.at(m_currentDevice).currentPointerType,
m_devices.at(m_currentDevice).uniqueId);
} else {
QWindowSystemInterface::handleTabletLeaveProximityEvent(m_devices.at(m_currentDevice).currentDevice,
m_devices.at(m_currentDevice).currentPointerType,
m_devices.at(m_currentDevice).uniqueId);
}
qCDebug(lcQpaTablet) << "enter proximity for device #"
<< m_currentDevice << m_devices.at(m_currentDevice);
QWindowSystemInterface::handleTabletEnterProximityEvent(m_devices.at(m_currentDevice).currentDevice,
m_devices.at(m_currentDevice).currentPointerType,
m_devices.at(m_currentDevice).uniqueId);
return true;
}

View File

@ -1709,8 +1709,11 @@ void QWindowsWindow::setWindowState_sys(Qt::WindowState newState)
if (!wasSync)
clearFlag(SynchronousGeometryChangeEvent);
// preserve maximized state
if (visible)
if (visible) {
setFlag(WithinMaximize);
ShowWindow(m_data.hwnd, (newState == Qt::WindowMaximized) ? SW_MAXIMIZE : SW_SHOWNOACTIVATE);
clearFlag(WithinMaximize);
}
m_savedStyle = 0;
m_savedFrameGeometry = QRect();
}

View File

@ -359,7 +359,10 @@ void QAlphaPaintEngine::flushAndInit(bool init)
d->m_picpainter->setOpacity(painter()->opacity());
d->m_picpainter->setTransform(painter()->combinedTransform());
d->m_picengine->syncState();
*d->m_picpainter->d_func()->state = *painter()->d_func()->state;
QPainterState &state = *d->m_picpainter->d_func()->state;
QPainter *oldPainter = state.painter;
state = *painter()->d_func()->state;
state.painter = oldPainter;
}
}

View File

@ -1435,7 +1435,7 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO
if (QWidget *nativeParent = q->nativeParentWidget()) {
if (nativeParent->windowHandle()) {
if (flags & Qt::Window) {
win->setTransientParent(nativeParent->windowHandle());
win->setTransientParent(nativeParent->window()->windowHandle());
win->setParent(0);
} else {
win->setTransientParent(0);

View File

@ -8,6 +8,9 @@ DEFINES += QT_NO_USING_NAMESPACE
win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x65000000
irix-cc*:QMAKE_CXXFLAGS += -no_prelink -ptused
MODULE_PLUGIN_TYPES += \
styles
QMAKE_DOCS = $$PWD/doc/qtwidgets.qdocconf
load(qt_module)

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtWidgets module of the Qt Toolkit.
@ -1224,7 +1224,9 @@ void QSplitter::childEvent(QChildEvent *c)
return;
}
QWidget *w = static_cast<QWidget*>(c->child());
if (c->added() && !d->blockChildAdd && !w->isWindow() && !d->findWidget(w)) {
if (w->isWindow())
return;
if (c->added() && !d->blockChildAdd && !d->findWidget(w)) {
d->insertWidget_helper(d->list.count(), w, false);
} else if (c->polished() && !d->blockChildAdd) {
if (isVisible() && !(w->isHidden() && w->testAttribute(Qt::WA_WState_ExplicitShowHide)))

View File

@ -34,6 +34,7 @@
"qnamespace.h" => "Qt",
"qnumeric.h" => "QtNumeric",
"qvariant.h" => "QVariantHash,QVariantList,QVariantMap",
"qgl.h" => "QGL",
"qsql.h" => "QSql",
"qssl.h" => "QSsl",
"qtest.h" => "QTest",

View File

@ -1029,6 +1029,13 @@ void tst_QUrl::toString_data()
QTest::newRow("underscore") << QString::fromLatin1("http://foo_bar.host.com/rss.php")
<< uint(QUrl::None)
<< QString::fromLatin1("http://foo_bar.host.com/rss.php");
QTest::newRow("mailto-brackets") << QString::fromLatin1("mailto:test[at]gmail[dot]com")
<< uint(QUrl::PrettyDecoded)
<< QString::fromLatin1("mailto:test[at]gmail[dot]com");
QTest::newRow("mailto-query") << QString::fromLatin1("mailto:?to=test@example.com")
<< uint(QUrl::PrettyDecoded)
<< QString::fromLatin1("mailto:?to=test@example.com");
}
void tst_QUrl::toString()

View File

@ -15,3 +15,8 @@ wince* {
DEPLOYMENT += addFiles timesFont
}
android {
RESOURCES += \
testdata.qrc
}

View File

@ -0,0 +1,18 @@
<RCC>
<qresource prefix="/">
<file>testdata/scanner/comments/input</file>
<file>testdata/scanner/comments/output</file>
<file>testdata/scanner/comments2/input</file>
<file>testdata/scanner/comments2/output</file>
<file>testdata/scanner/comments3/input</file>
<file>testdata/scanner/comments3/output</file>
<file>testdata/scanner/comments4/input</file>
<file>testdata/scanner/comments4/output</file>
<file>testdata/scanner/quotedstring/input</file>
<file>testdata/scanner/quotedstring/output</file>
<file>testdata/scanner/simple/input</file>
<file>testdata/scanner/simple/output</file>
<file>testdata/scanner/unicode/input</file>
<file>testdata/scanner/unicode/output</file>
</qresource>
</RCC>

View File

@ -130,7 +130,9 @@ void tst_QCssParser::scanner_data()
QTest::addColumn<QString>("input");
QTest::addColumn<QString>("output");
#if !defined(Q_OS_IRIX) && !defined(Q_OS_WINCE)
#if defined(Q_OS_ANDROID)
QDir d(":/");
#elif !defined(Q_OS_IRIX) && !defined(Q_OS_WINCE)
QDir d(SRCDIR);
#else
QDir d(QDir::current());

View File

@ -8,8 +8,14 @@ linux: CONFIG += insignificant_test
SOURCES += \
tst_qglyphrun.cpp
wince* {
DEFINES += SRCDIR=\\\"\\\"
} else {
DEFINES += SRCDIR=\\\"$$PWD/\\\"
android {
RESOURCES += \
testdata.qrc
}
wince* {
additionalFiles.files = test.ttf
additionalFiles.path = .
DEPLOYMENT += additionalFiles
}

View File

@ -0,0 +1,5 @@
<RCC>
<qresource prefix="/">
<file>test.ttf</file>
</qresource>
</RCC>

View File

@ -94,7 +94,7 @@ void tst_QGlyphRun::initTestCase()
{
m_testFont_ok = false;
m_testFontId = QFontDatabase::addApplicationFont(SRCDIR "test.ttf");
m_testFontId = QFontDatabase::addApplicationFont(QFINDTESTDATA("test.ttf"));
QVERIFY(m_testFontId >= 0);
m_testFont = QFont("QtsSpecialTestFont");

View File

@ -8,3 +8,8 @@ SOURCES += \
tst_qrawfont.cpp
TESTDATA += testfont_bold_italic.ttf testfont.ttf
android {
RESOURCES += \
testdata.qrc
}

View File

@ -0,0 +1,6 @@
<RCC>
<qresource prefix="/">
<file>testfont_bold_italic.ttf</file>
<file>testfont.ttf</file>
</qresource>
</RCC>

View File

@ -7,7 +7,9 @@ wince* {
addFiles.files = testdata
addFiles.path = .
DEPLOYMENT += addFiles
DEFINES += SRCDIR=\\\".\\\"
} else {
DEFINES += SRCDIR=\\\"$$PWD\\\"
}
android {
RESOURCES += \
testdata.qrc
}

View File

@ -0,0 +1,6 @@
<RCC>
<qresource prefix="/">
<file>testdata/symlink.zip</file>
<file>testdata/test.zip</file>
</qresource>
</RCC>

View File

@ -68,7 +68,7 @@ void tst_QZip::cleanup()
void tst_QZip::basicUnpack()
{
QZipReader zip(QString(SRCDIR) + "/testdata/test.zip", QIODevice::ReadOnly);
QZipReader zip(QFINDTESTDATA("/testdata/test.zip"), QIODevice::ReadOnly);
QList<QZipReader::FileInfo> files = zip.fileInfoList();
QCOMPARE(files.count(), 2);
@ -104,7 +104,7 @@ void tst_QZip::basicUnpack()
void tst_QZip::symlinks()
{
QZipReader zip(QString(SRCDIR) + "/testdata/symlink.zip", QIODevice::ReadOnly);
QZipReader zip(QFINDTESTDATA("/testdata/symlink.zip"), QIODevice::ReadOnly);
QList<QZipReader::FileInfo> files = zip.fileInfoList();
QCOMPARE(files.count(), 2);

View File

@ -85,6 +85,9 @@ private slots:
void oldCacheVersionFile_data();
void oldCacheVersionFile();
void streamVersion_data();
void streamVersion();
void sync();
void crashWhenParentingCache();
@ -568,6 +571,74 @@ void tst_QNetworkDiskCache::oldCacheVersionFile()
}
}
void tst_QNetworkDiskCache::streamVersion_data()
{
QTest::addColumn<int>("version");
QTest::newRow("Qt 5.1") << int(QDataStream::Qt_5_1);
QDataStream ds;
QTest::newRow("current") << ds.version();
QTest::newRow("higher than current") << ds.version() + 1;
}
void tst_QNetworkDiskCache::streamVersion()
{
SubQNetworkDiskCache cache;
QUrl url(EXAMPLE_URL);
cache.setupWithOne(tempDir.path(), url);
QString cacheFile;
// find the file
QStringList files = countFiles(cache.cacheDirectory());
foreach (const QString &file, files) {
QFileInfo info(file);
if (info.isFile()) {
cacheFile = file;
break;
}
}
QFile file(cacheFile);
QVERIFY(file.open(QFile::ReadWrite|QIODevice::Truncate));
QDataStream out(&file);
QFETCH(int, version);
if (version < out.version())
out.setVersion(version);
out << qint32(0xe8); // cache magic
// Following code works only for cache file version 8 and should be updated on version change
out << qint32(8);
out << qint32(version);
QNetworkCacheMetaData md;
md.setUrl(url);
QNetworkCacheMetaData::RawHeader header("content-type", "text/html");
QNetworkCacheMetaData::RawHeaderList list;
list.append(header);
md.setRawHeaders(list);
md.setLastModified(QDateTime::currentDateTimeUtc().toOffsetFromUtc(3600));
out << md;
bool compressed = true;
out << compressed;
QByteArray data("Hello World!");
out << qCompress(data);
file.close();
QNetworkCacheMetaData cachedMetaData = cache.call_fileMetaData(cacheFile);
if (version > out.version()) {
QVERIFY(!cachedMetaData.isValid());
QVERIFY(!QFile::exists(cacheFile));
} else {
QVERIFY(cachedMetaData.isValid());
QVERIFY(QFile::exists(cacheFile));
QIODevice *dataDevice = cache.data(url);
QVERIFY(dataDevice != 0);
QByteArray cachedData = dataDevice->readAll();
QCOMPARE(cachedData, data);
}
}
class Runner : public QThread
{

View File

@ -50,6 +50,7 @@
#include <QVBoxLayout>
#include <QSizeGrip>
#include <QDesktopWidget>
#include <QWindow>
#include <private/qguiapplication_p.h>
#include <qpa/qplatformtheme.h>
#include <qpa/qplatformtheme_p.h>
@ -85,6 +86,8 @@ private slots:
void setVisible();
void reject();
void snapToDefaultButton();
void transientParent_data();
void transientParent();
private:
QDialog *testWidget;
@ -584,5 +587,34 @@ void tst_QDialog::snapToDefaultButton()
#endif // !QT_NO_CURSOR
}
void tst_QDialog::transientParent_data()
{
QTest::addColumn<bool>("nativewidgets");
QTest::newRow("Non-native") << false;
QTest::newRow("Native") << true;
}
void tst_QDialog::transientParent()
{
QFETCH(bool, nativewidgets);
testWidget->hide();
QWidget topLevel;
topLevel.resize(200, 200);
topLevel.move(QGuiApplication::primaryScreen()->availableGeometry().center() - QPoint(100, 100));
QVBoxLayout *layout = new QVBoxLayout(&topLevel);
QWidget *innerWidget = new QWidget(&topLevel);
layout->addWidget(innerWidget);
if (nativewidgets)
innerWidget->winId();
topLevel.show();
QVERIFY(QTest::qWaitForWindowExposed(&topLevel));
QDialog dialog(innerWidget);
dialog.show();
QVERIFY(QTest::qWaitForWindowExposed(&dialog));
// Transient parent should always be the top level, also when using
// native child widgets.
QCOMPARE(dialog.windowHandle()->transientParent(), topLevel.windowHandle());
}
QTEST_MAIN(tst_QDialog)
#include "tst_qdialog.moc"

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the test suite of the Qt Toolkit.
@ -54,6 +54,8 @@
#include <qtextedit.h>
#include <qtreeview.h>
#include <qlabel.h>
#include <qdialog.h>
#include <qscreen.h>
#include <qdebug.h> // for file error messages
QT_FORWARD_DECLARE_CLASS(QSplitter)
@ -94,6 +96,8 @@ private slots:
void taskQTBUG_4101_ensureOneNonCollapsedWidget_data();
void taskQTBUG_4101_ensureOneNonCollapsedWidget();
void setLayout();
void autoAdd();
private:
void removeThirdWidget();
void addThirdWidget();
@ -781,5 +785,28 @@ void tst_QSplitter::setLayout()
QCOMPARE(splitter.layout(), &layout);
}
void tst_QSplitter::autoAdd()
{
QSplitter splitter;
splitter.setWindowTitle("autoAdd");
splitter.setMinimumSize(QSize(200, 200));
splitter.move(QGuiApplication::primaryScreen()->availableGeometry().center() - QPoint(100, 100));
splitter.show();
QVERIFY(QTest::qWaitForWindowExposed(&splitter));
// Constructing a child widget on the splitter should
// automatically add and show it.
QWidget *childWidget = new QWidget(&splitter);
QCOMPARE(splitter.count(), 1);
QTRY_VERIFY(childWidget->isVisible());
// Deleting should automatically remove it
delete childWidget;
QCOMPARE(splitter.count(), 0);
// QTBUG-40132, top level windows should not be affected by this.
QDialog *dialog = new QDialog(&splitter);
QCOMPARE(splitter.count(), 0);
QCoreApplication::processEvents();
QVERIFY(!dialog->isVisible());
}
QTEST_MAIN(tst_QSplitter)
#include "tst_qsplitter.moc"