summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@theqtcompany.com>2016-01-26 18:33:02 +0000
committerThe Qt Project <gerrit-noreply@qt-project.org>2016-01-26 19:40:45 +0000
commitf3060312c89344744832e3352fe4f53efcb94c9b (patch)
treede69be5e25a1acd3207a8952376f634fe94fefcc /src
parentc29d3692d700f7ef6d5833242878b4ec6f81c928 (diff)
parenta15c3d086dafea83e4760f0b447be43d26b80697 (diff)
Merge "Merge remote-tracking branch 'origin/5.6' into dev" into refs/staging/dev
Diffstat (limited to 'src')
-rw-r--r--src/3rdparty/dbus-ifaces/org.kde.StatusNotifierItem.xml8
-rw-r--r--src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro3
-rw-r--r--src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java56
-rw-r--r--src/concurrent/qtconcurrentiteratekernel.cpp52
-rw-r--r--src/concurrent/qtconcurrentiteratekernel.h28
-rw-r--r--src/concurrent/qtconcurrentmedian.h66
-rw-r--r--src/corelib/doc/snippets/code/doc_src_containers.cpp7
-rw-r--r--src/corelib/doc/src/containers.qdoc4
-rw-r--r--src/corelib/global/qcompilerdetection.h8
-rw-r--r--src/corelib/global/qversiontagging.h12
-rw-r--r--src/corelib/io/qdir.cpp11
-rw-r--r--src/corelib/io/qfileinfo.cpp2
-rw-r--r--src/corelib/io/qfilesystemengine_win.cpp33
-rw-r--r--src/corelib/io/qfilesystementry.cpp10
-rw-r--r--src/corelib/io/qfilesystemiterator_win.cpp3
-rw-r--r--src/corelib/io/qfsfileengine_win.cpp2
-rw-r--r--src/corelib/kernel/qcoreapplication.cpp16
-rw-r--r--src/corelib/tools/qdatetime.cpp22
-rw-r--r--src/corelib/tools/qstring.cpp54
-rw-r--r--src/dbus/qdbusconnection_p.h1
-rw-r--r--src/dbus/qdbusintegrator.cpp46
-rw-r--r--src/dbus/qdbusintegrator_p.h19
-rw-r--r--src/gui/kernel/qguiapplication.cpp48
-rw-r--r--src/gui/kernel/qplatformgraphicsbufferhelper.cpp1
-rw-r--r--src/gui/opengl/qopenglpaintengine.cpp15
-rw-r--r--src/gui/opengl/qopenglpaintengine_p.h5
-rw-r--r--src/gui/painting/qplatformbackingstore.cpp2
-rw-r--r--src/gui/text/qfontengine_ft_p.h92
-rw-r--r--src/gui/text/qtextcursor.cpp4
-rw-r--r--src/gui/text/qtextcursor.h6
-rw-r--r--src/gui/text/qtextcursor_p.h3
-rw-r--r--src/gui/text/qtextdocument.cpp7
-rw-r--r--src/gui/text/qtextdocument_p.cpp2
-rw-r--r--src/gui/text/qtextobject.cpp5
-rw-r--r--src/gui/text/qtexttable.cpp13
-rw-r--r--src/network/kernel/qnetworkinterface_unix.cpp36
-rw-r--r--src/network/socket/qnativesocketengine_winrt.cpp2
-rw-r--r--src/platformsupport/dbustray/qstatusnotifieritemadaptor_p.h8
-rw-r--r--src/platformsupport/eglconvenience/qeglplatformcontext.cpp7
-rw-r--r--src/platformsupport/eglconvenience/qeglplatformcontext_p.h1
-rw-r--r--src/platformsupport/fbconvenience/qfbbackingstore_p.h6
-rw-r--r--src/platformsupport/linuxaccessibility/bridge_p.h2
-rw-r--r--src/platformsupport/services/genericunix/qgenericunixservices_p.h4
-rw-r--r--src/platformsupport/themes/genericunix/qgenericunixthemes.cpp24
-rw-r--r--src/platformsupport/themes/genericunix/qgenericunixthemes_p.h14
-rw-r--r--src/plugins/platforms/android/qandroidplatformtheme.cpp2
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.mm12
-rw-r--r--src/plugins/platforms/eglfs/qeglfscontext.cpp10
-rw-r--r--src/plugins/platforms/eglfs/qeglfscontext.h1
-rw-r--r--src/testlib/qtestcase.cpp10
-rw-r--r--src/tools/moc/generator.cpp1
-rw-r--r--src/widgets/itemviews/qdirmodel.cpp2
-rw-r--r--src/widgets/kernel/qapplication.cpp18
-rw-r--r--src/widgets/kernel/qwidget.cpp3
54 files changed, 571 insertions, 258 deletions
diff --git a/src/3rdparty/dbus-ifaces/org.kde.StatusNotifierItem.xml b/src/3rdparty/dbus-ifaces/org.kde.StatusNotifierItem.xml
index aeeb42fa87..1cbd78a9c3 100644
--- a/src/3rdparty/dbus-ifaces/org.kde.StatusNotifierItem.xml
+++ b/src/3rdparty/dbus-ifaces/org.kde.StatusNotifierItem.xml
@@ -19,13 +19,13 @@
<property name="IconName" type="s" access="read"/>
<!--struct containing width, height and image data-->
- <property name="IconPixmap" type="(iiay)" access="read">
+ <property name="IconPixmap" type="a(iiay)" access="read">
<annotation name="org.qtproject.QtDBus.QtTypeName" value="QXdgDBusImageVector"/>
</property>
<property name="OverlayIconName" type="s" access="read"/>
- <property name="OverlayIconPixmap" type="(iiay)" access="read">
+ <property name="OverlayIconPixmap" type="a(iiay)" access="read">
<annotation name="org.qtproject.QtDBus.QtTypeName" value="QXdgDBusImageVector"/>
</property>
@@ -34,7 +34,7 @@
<property name="AttentionIconName" type="s" access="read"/>
<!--same definition as image-->
- <property name="AttentionIconPixmap" type="(iiay)" access="read">
+ <property name="AttentionIconPixmap" type="a(iiay)" access="read">
<annotation name="org.qtproject.QtDBus.QtTypeName" value="QXdgDBusImageVector"/>
</property>
@@ -45,7 +45,7 @@
<!-- tooltip data -->
<!--(iiay) is an image-->
- <property name="ToolTip" type="(s(iiay)ss)" access="read">
+ <property name="ToolTip" type="(sa(iiay)ss)" access="read">
<annotation name="org.qtproject.QtDBus.QtTypeName" value="QXdgDBusToolTipStruct"/>
</property>
diff --git a/src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro b/src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro
index 031f7ecd58..edfc0e7954 100644
--- a/src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro
+++ b/src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro
@@ -15,6 +15,9 @@ DEFINES += HAVE_ATEXIT
unix: DEFINES += HAVE_PTHREAD HAVE_SCHED_H HAVE_SCHED_YIELD
win32: DEFINES += HB_NO_WIN1256
+#Workaround https://code.google.com/p/android/issues/detail?id=194631
+android: DEFINES += _POSIX_C_SOURCE=200112L
+
INCLUDEPATH += $$PWD/include
INCLUDEPATH += $$QT.core.includes
diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java
index 54adc2dfe1..14c7a03a36 100644
--- a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java
+++ b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java
@@ -48,6 +48,7 @@ import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.res.Configuration;
import android.graphics.drawable.ColorDrawable;
+import android.graphics.Rect;
import android.net.LocalServerSocket;
import android.net.LocalSocket;
import android.os.Build;
@@ -74,7 +75,6 @@ import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager;
import android.view.ViewTreeObserver;
import android.widget.PopupMenu;
-import android.graphics.Rect;
import java.io.BufferedReader;
import java.io.DataOutputStream;
@@ -134,6 +134,9 @@ public class QtActivityDelegate
private boolean m_keyboardIsVisible = false;
public boolean m_backKeyPressedSent = false;
private long m_showHideTimeStamp = System.nanoTime();
+ private int m_portraitKeyboardHeight = 0;
+ private int m_landscapeKeyboardHeight = 0;
+ private int m_probeKeyboardHeightDelay = 50; // ms
public void setFullScreen(boolean enterFullScreen)
{
@@ -244,19 +247,26 @@ public class QtActivityDelegate
}, 5);
}
- public void showSoftwareKeyboard(int x, int y, int width, int height, int inputHints, int enterKeyType)
+ public void showSoftwareKeyboard(final int x, final int y, final int width, final int height, final int inputHints, final int enterKeyType)
{
if (m_imm == null)
return;
+ DisplayMetrics metrics = new DisplayMetrics();
+ m_activity.getWindowManager().getDefaultDisplay().getMetrics(metrics);
+
+ // If the screen is in portrait mode than we estimate that keyboard height will not be higher than 2/5 of the screen.
+ // else than we estimate that keyboard height will not be higher than 2/3 of the screen
+ final int visibleHeight;
+ if (metrics.widthPixels < metrics.heightPixels)
+ visibleHeight = m_portraitKeyboardHeight != 0 ? m_portraitKeyboardHeight : metrics.heightPixels * 3 / 5;
+ else
+ visibleHeight = m_landscapeKeyboardHeight != 0 ? m_landscapeKeyboardHeight : metrics.heightPixels / 3;
+
if (m_softInputMode != 0) {
m_activity.getWindow().setSoftInputMode(m_softInputMode);
- // softInputIsHidden is true if SOFT_INPUT_STATE_HIDDEN or SOFT_INPUT_STATE_ALWAYS_HIDDEN is set.
- final boolean softInputIsHidden = (m_softInputMode & WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN) != 0;
- if (softInputIsHidden)
- return;
} else {
- if (height > m_layout.getHeight() * 2 / 3)
+ if (height > visibleHeight)
m_activity.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_UNCHANGED | WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
else
m_activity.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_UNCHANGED | WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
@@ -362,6 +372,38 @@ public class QtActivityDelegate
//FALLTHROUGH
case InputMethodManager.RESULT_UNCHANGED_SHOWN:
setKeyboardVisibility(true, System.nanoTime());
+ if (m_softInputMode == 0) {
+ // probe for real keyboard height
+ m_layout.postDelayed(new Runnable() {
+ @Override
+ public void run() {
+ if (!m_keyboardIsVisible)
+ return;
+ DisplayMetrics metrics = new DisplayMetrics();
+ m_activity.getWindowManager().getDefaultDisplay().getMetrics(metrics);
+ Rect r = new Rect();
+ m_activity.getWindow().getDecorView().getWindowVisibleDisplayFrame(r);
+ if (metrics.heightPixels != r.bottom) {
+ if (metrics.widthPixels > metrics.heightPixels) { // landscape
+ if (m_landscapeKeyboardHeight != r.bottom) {
+ m_landscapeKeyboardHeight = r.bottom;
+ showSoftwareKeyboard(x, y, width, height, inputHints, enterKeyType);
+ }
+ } else {
+ if (m_portraitKeyboardHeight != r.bottom) {
+ m_portraitKeyboardHeight = r.bottom;
+ showSoftwareKeyboard(x, y, width, height, inputHints, enterKeyType);
+ }
+ }
+ } else {
+ // no luck ?
+ // maybe the delay was too short, so let's make it longer
+ if (m_probeKeyboardHeightDelay < 1000)
+ m_probeKeyboardHeightDelay *= 2;
+ }
+ }
+ }, m_probeKeyboardHeightDelay);
+ }
break;
case InputMethodManager.RESULT_HIDDEN:
case InputMethodManager.RESULT_UNCHANGED_HIDDEN:
diff --git a/src/concurrent/qtconcurrentiteratekernel.cpp b/src/concurrent/qtconcurrentiteratekernel.cpp
index b3f290998c..a04f0d66cc 100644
--- a/src/concurrent/qtconcurrentiteratekernel.cpp
+++ b/src/concurrent/qtconcurrentiteratekernel.cpp
@@ -188,6 +188,58 @@ int BlockSizeManager::blockSize()
return m_blockSize;
}
+/*! \internal
+
+*/
+BlockSizeManagerV2::BlockSizeManagerV2(int iterationCount)
+ : maxBlockSize(iterationCount / (QThreadPool::globalInstance()->maxThreadCount() * 2)),
+ beforeUser(0), afterUser(0),
+ m_blockSize(1)
+{ }
+
+// Records the time before user code.
+void BlockSizeManagerV2::timeBeforeUser()
+{
+ if (blockSizeMaxed())
+ return;
+
+ beforeUser = getticks();
+ controlPartElapsed.addValue(elapsed(beforeUser, afterUser));
+}
+
+ // Records the time after user code and adjust the block size if we are spending
+ // to much time in the for control code compared with the user code.
+void BlockSizeManagerV2::timeAfterUser()
+{
+ if (blockSizeMaxed())
+ return;
+
+ afterUser = getticks();
+ userPartElapsed.addValue(elapsed(afterUser, beforeUser));
+
+ if (controlPartElapsed.isMedianValid() == false)
+ return;
+
+ if (controlPartElapsed.median() * TargetRatio < userPartElapsed.median())
+ return;
+
+ m_blockSize = qMin(m_blockSize * 2, maxBlockSize);
+
+#ifdef QTCONCURRENT_FOR_DEBUG
+ qDebug() << QThread::currentThread() << "adjusting block size" << controlPartElapsed.median() << userPartElapsed.median() << m_blockSize;
+#endif
+
+ // Reset the medians after adjusting the block size so we get
+ // new measurements with the new block size.
+ controlPartElapsed.reset();
+ userPartElapsed.reset();
+}
+
+int BlockSizeManagerV2::blockSize()
+{
+ return m_blockSize;
+}
+
} // namespace QtConcurrent
QT_END_NAMESPACE
diff --git a/src/concurrent/qtconcurrentiteratekernel.h b/src/concurrent/qtconcurrentiteratekernel.h
index 2540f2f9be..b4360abd26 100644
--- a/src/concurrent/qtconcurrentiteratekernel.h
+++ b/src/concurrent/qtconcurrentiteratekernel.h
@@ -88,6 +88,32 @@ private:
Q_DISABLE_COPY(BlockSizeManager)
};
+// ### Qt6: Replace BlockSizeManager with V2 implementation
+class Q_CONCURRENT_EXPORT BlockSizeManagerV2
+{
+public:
+ explicit BlockSizeManagerV2(int iterationCount);
+
+ void timeBeforeUser();
+ void timeAfterUser();
+ int blockSize();
+
+private:
+ inline bool blockSizeMaxed()
+ {
+ return (m_blockSize >= maxBlockSize);
+ }
+
+ const int maxBlockSize;
+ qint64 beforeUser;
+ qint64 afterUser;
+ MedianDouble controlPartElapsed;
+ MedianDouble userPartElapsed;
+ int m_blockSize;
+
+ Q_DISABLE_COPY(BlockSizeManagerV2)
+};
+
template <typename T>
class ResultReporter
{
@@ -196,7 +222,7 @@ public:
ThreadFunctionResult forThreadFunction()
{
- BlockSizeManager blockSizeManager(iterationCount);
+ BlockSizeManagerV2 blockSizeManager(iterationCount);
ResultReporter<T> resultReporter(this);
for(;;) {
diff --git a/src/concurrent/qtconcurrentmedian.h b/src/concurrent/qtconcurrentmedian.h
index 78c2719838..d0f832812c 100644
--- a/src/concurrent/qtconcurrentmedian.h
+++ b/src/concurrent/qtconcurrentmedian.h
@@ -127,6 +127,72 @@ private:
bool dirty;
};
+// ### Qt6: Drop Median<double> in favor of this faster MedianDouble
+class MedianDouble
+{
+public:
+ enum { BufferSize = 7 };
+
+ MedianDouble()
+ : currentMedian(), currentIndex(0), valid(false), dirty(true)
+ {
+ }
+
+ void reset()
+ {
+ std::fill_n(values, static_cast<int>(BufferSize), 0.0);
+ currentIndex = 0;
+ valid = false;
+ dirty = true;
+ }
+
+ void addValue(double value)
+ {
+ ++currentIndex;
+ if (currentIndex == BufferSize) {
+ currentIndex = 0;
+ valid = true;
+ }
+
+ // Only update the cached median value when we have to, that
+ // is when the new value is on then other side of the median
+ // compared to the current value at the index.
+ const double currentIndexValue = values[currentIndex];
+ if ((currentIndexValue > currentMedian && currentMedian > value)
+ || (currentMedian > currentIndexValue && value > currentMedian)) {
+ dirty = true;
+ }
+
+ values[currentIndex] = value;
+ }
+
+ bool isMedianValid() const
+ {
+ return valid;
+ }
+
+ double median()
+ {
+ if (dirty) {
+ dirty = false;
+
+ double sorted[BufferSize];
+ ::memcpy(&sorted, &values, sizeof(sorted));
+ std::sort(sorted, sorted + static_cast<int>(BufferSize));
+ currentMedian = sorted[BufferSize / 2];
+ }
+
+ return currentMedian;
+ }
+
+private:
+ double values[BufferSize];
+ double currentMedian;
+ int currentIndex;
+ bool valid;
+ bool dirty;
+};
+
} // namespace QtConcurrent
#endif //Q_QDOC
diff --git a/src/corelib/doc/snippets/code/doc_src_containers.cpp b/src/corelib/doc/snippets/code/doc_src_containers.cpp
index 395e48bc89..5b0d829367 100644
--- a/src/corelib/doc/snippets/code/doc_src_containers.cpp
+++ b/src/corelib/doc/snippets/code/doc_src_containers.cpp
@@ -156,10 +156,9 @@ for (i = list.begin(); i != list.end(); ++i)
QList<QString> list;
list << "A" << "B" << "C" << "D";
-QList<QString>::iterator i = list.end();
-while (i != list.begin()) {
- --i;
- *i = (*i).toLower();
+QList<QString>::reverse_iterator i;
+for (i = list.rbegin(); i != list.rend(); ++i)
+ *i = i->toLower();
}
//! [11]
diff --git a/src/corelib/doc/src/containers.qdoc b/src/corelib/doc/src/containers.qdoc
index 0ae3817ac7..988f728946 100644
--- a/src/corelib/doc/src/containers.qdoc
+++ b/src/corelib/doc/src/containers.qdoc
@@ -472,9 +472,7 @@
\image stliterators1.png
- Iterating backward with an STL-style iterator requires us to
- decrement the iterator \e before we access the item. This
- requires a \c while loop:
+ Iterating backward with an STL-style iterator is done with reverse iterators:
\snippet code/doc_src_containers.cpp 11
diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h
index eec8b5223b..e655aace32 100644
--- a/src/corelib/global/qcompilerdetection.h
+++ b/src/corelib/global/qcompilerdetection.h
@@ -937,8 +937,8 @@
// Older versions (QNX 650) do not support C++11 features
// _HAS_* macros are set to 1 by toolchains that actually include
// Dinkum C++11 libcpp.
-# if !__GLIBCXX__
-# if !_HAS_CPP0X
+# if !defined(__GLIBCXX__)
+# if !defined(_HAS_CPP0X) || !_HAS_CPP0X
// Disable C++11 features that depend on library support
# undef Q_COMPILER_INITIALIZER_LISTS
# undef Q_COMPILER_RVALUE_REFS
@@ -946,10 +946,10 @@
# undef Q_COMPILER_UNICODE_STRINGS
# undef Q_COMPILER_NOEXCEPT
# endif // !_HAS_CPP0X
-# if !_HAS_NULLPTR_T
+# if !defined(_HAS_NULLPTR_T) || !_HAS_NULLPTR_T
# undef Q_COMPILER_NULLPTR
# endif //!_HAS_NULLPTR_T
-# if !_HAS_CONSTEXPR
+# if !defined(_HAS_CONSTEXPR) || !_HAS_CONSTEXPR
// The libcpp is missing constexpr keywords on important functions like std::numeric_limits<>::min()
// Disable constexpr support on QNX even if the compiler supports it
# undef Q_COMPILER_CONSTEXPR
diff --git a/src/corelib/global/qversiontagging.h b/src/corelib/global/qversiontagging.h
index 706e7e07ff..f9062a98fb 100644
--- a/src/corelib/global/qversiontagging.h
+++ b/src/corelib/global/qversiontagging.h
@@ -52,7 +52,7 @@ QT_BEGIN_NAMESPACE
* qt_version_tag symbol that is present in QtCore. Such symbol is versioned,
* so the linker will automatically pull the current Qt version and add it to
* the ELF header of the library/application. The assembly produces one section
- * called ".qtversion" containing two pointer-sized values. The first is a
+ * called ".qtversion" containing two 32-bit values. The first is a
* relocation to the qt_version_tag symbol (which is what causes the ELF
* version to get used). The second value is the current Qt version at the time
* of compilation.
@@ -64,10 +64,12 @@ QT_BEGIN_NAMESPACE
// don't make tags in QtCore, bootstrapped systems or if the user asked not to
#elif defined(Q_CC_GNU) && !defined(Q_OS_ANDROID)
# if defined(Q_PROCESSOR_X86) && (defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD_KERNEL))
-# ifdef __LP64__
-# define QT_VERSION_TAG_RELOC(sym) ".quad " QT_STRINGIFY(QT_MANGLE_NAMESPACE(sym)) "@GOTPCREL\n"
-# elif defined(Q_PROCESSOR_X86_64) // x32
-# define QT_VERSION_TAG_RELOC(sym) ".long " QT_STRINGIFY(QT_MANGLE_NAMESPACE(sym)) "@GOTPCREL\n"
+# if defined(Q_PROCESSOR_X86_64) // x86-64 or x32
+# if defined(__code_model_large__)
+# define QT_VERSION_TAG_RELOC(sym) ".quad " QT_STRINGIFY(QT_MANGLE_NAMESPACE(sym)) "@GOT\n"
+# else
+# define QT_VERSION_TAG_RELOC(sym) ".long " QT_STRINGIFY(QT_MANGLE_NAMESPACE(sym)) "@GOTPCREL\n"
+# endif
# else // x86
# define QT_VERSION_TAG_RELOC(sym) ".long " QT_STRINGIFY(QT_MANGLE_NAMESPACE(sym)) "@GOT\n"
# endif
diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp
index 34cea0935c..9b9b00f76d 100644
--- a/src/corelib/io/qdir.cpp
+++ b/src/corelib/io/qdir.cpp
@@ -158,7 +158,11 @@ inline void QDirPrivate::setPath(const QString &path)
if (p.endsWith(QLatin1Char('/'))
&& p.length() > 1
#if defined(Q_OS_WIN)
+# if defined (Q_OS_WINRT)
+ && (!(p.toLower() == QDir::rootPath().toLower()))
+# else
&& (!(p.length() == 3 && p.at(1).unicode() == ':' && p.at(0).isLetter()))
+# endif
#endif
) {
p.truncate(p.length() - 1);
@@ -891,6 +895,9 @@ bool QDir::cd(const QString &dirName)
#if defined (Q_OS_UNIX)
//After cleanPath() if path is "/.." or starts with "/../" it means trying to cd above root.
if (newPath.startsWith(QLatin1String("/../")) || newPath == QLatin1String("/.."))
+#elif defined (Q_OS_WINRT)
+ const QString rootPath = QDir::rootPath();
+ if (newPath.size() < rootPath.size() && rootPath.startsWith(newPath))
#else
/*
cleanPath() already took care of replacing '\' with '/'.
@@ -2193,7 +2200,11 @@ QString QDir::cleanPath(const QString &path)
// Strip away last slash except for root directories
if (ret.length() > 1 && ret.endsWith(QLatin1Char('/'))) {
#if defined (Q_OS_WIN)
+# if defined(Q_OS_WINRT)
+ if (!((ret.length() == 3 || ret.length() == QDir::rootPath().length()) && ret.at(1) == QLatin1Char(':')))
+# else
if (!(ret.length() == 3 && ret.at(1) == QLatin1Char(':')))
+# endif
#endif
ret.chop(1);
}
diff --git a/src/corelib/io/qfileinfo.cpp b/src/corelib/io/qfileinfo.cpp
index d4a8d09107..76b56f4699 100644
--- a/src/corelib/io/qfileinfo.cpp
+++ b/src/corelib/io/qfileinfo.cpp
@@ -1101,7 +1101,7 @@ bool QFileInfo::isRoot() const
return true;
if (d->fileEngine == 0) {
if (d->fileEntry.isRoot()) {
-#if defined(Q_OS_WIN)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
//the path is a drive root, but the drive may not exist
//for backward compatibility, return true only if the drive exists
if (!d->cache_enabled || !d->metaData.hasFlags(QFileSystemMetaData::ExistsAttribute))
diff --git a/src/corelib/io/qfilesystemengine_win.cpp b/src/corelib/io/qfilesystemengine_win.cpp
index 826a023d3d..0829bbc6e8 100644
--- a/src/corelib/io/qfilesystemengine_win.cpp
+++ b/src/corelib/io/qfilesystemengine_win.cpp
@@ -84,6 +84,11 @@ using namespace Microsoft::WRL::Wrappers;
using namespace ABI::Windows::Foundation;
using namespace ABI::Windows::Storage;
using namespace ABI::Windows::ApplicationModel;
+
+#if _MSC_VER < 1900
+#define Q_OS_WINRT_WIN81
+#endif
+
#endif // Q_OS_WINRT
#ifndef SPI_GETPLATFORMTYPE
@@ -528,7 +533,7 @@ QString QFileSystemEngine::nativeAbsoluteFilePath(const QString &path)
{
// can be //server or //server/share
QString absPath;
-#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT_WIN81)
QVarLengthArray<wchar_t, MAX_PATH> buf(qMax(MAX_PATH, path.size() + 1));
wchar_t *fileName = 0;
DWORD retLen = GetFullPathName((wchar_t*)path.utf16(), buf.size(), buf.data(), &fileName);
@@ -538,6 +543,16 @@ QString QFileSystemEngine::nativeAbsoluteFilePath(const QString &path)
}
if (retLen != 0)
absPath = QString::fromWCharArray(buf.data(), retLen);
+# if defined(Q_OS_WINRT)
+ // Win32 returns eg C:/ as root directory with a trailing /.
+ // WinRT returns the sandbox root without /.
+ // Also C:/../.. returns C:/ on Win32, while for WinRT it steps outside the package
+ // and goes beyond package root. Hence force the engine to stay inside
+ // the package.
+ const QString rootPath = QDir::toNativeSeparators(QDir::rootPath());
+ if (absPath.size() < rootPath.size() && rootPath.startsWith(absPath))
+ absPath = rootPath;
+# endif // Q_OS_WINRT
#elif !defined(Q_OS_WINCE)
if (QDir::isRelativePath(path))
absPath = QDir::toNativeSeparators(QDir::cleanPath(QDir::currentPath() + QLatin1Char('/') + path));
@@ -575,7 +590,7 @@ QFileSystemEntry QFileSystemEngine::absoluteName(const QFileSystemEntry &entry)
ret = entry.filePath();
#endif
} else {
-#ifndef Q_OS_WINRT
+#ifndef Q_OS_WINRT_WIN81
ret = QDir::cleanPath(QDir::currentPath() + QLatin1Char('/') + entry.filePath());
#else
// Some WinRT APIs do not support absolute paths (due to sandboxing).
@@ -1224,8 +1239,8 @@ QString QFileSystemEngine::rootPath()
if (FAILED(item->get_Path(finalWinPath.GetAddressOf())))
return ret;
- ret = QDir::fromNativeSeparators(QString::fromWCharArray(finalWinPath.GetRawBuffer(nullptr)));
-
+ const QString qtWinPath = QDir::fromNativeSeparators(QString::fromWCharArray(finalWinPath.GetRawBuffer(nullptr)));
+ ret = qtWinPath.endsWith(QLatin1Char('/')) ? qtWinPath : qtWinPath + QLatin1Char('/');
#else
QString ret = QString::fromLatin1(qgetenv("SystemDrive"));
if (ret.isEmpty())
@@ -1343,7 +1358,7 @@ bool QFileSystemEngine::setCurrentPath(const QFileSystemEntry &entry)
if(!(meta.exists() && meta.isDirectory()))
return false;
-#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT_WIN81)
//TODO: this should really be using nativeFilePath(), but that returns a path in long format \\?\c:\foo
//which causes many problems later on when it's returned through currentPath()
return ::SetCurrentDirectory(reinterpret_cast<const wchar_t*>(QDir::toNativeSeparators(entry.filePath()).utf16())) != 0;
@@ -1356,7 +1371,7 @@ bool QFileSystemEngine::setCurrentPath(const QFileSystemEntry &entry)
QFileSystemEntry QFileSystemEngine::currentPath()
{
QString ret;
-#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT_WIN81)
DWORD size = 0;
wchar_t currentName[PATH_MAX];
size = ::GetCurrentDirectory(PATH_MAX, currentName);
@@ -1372,17 +1387,17 @@ QFileSystemEntry QFileSystemEngine::currentPath()
}
if (ret.length() >= 2 && ret[1] == QLatin1Char(':'))
ret[0] = ret.at(0).toUpper(); // Force uppercase drive letters.
-#else // !Q_OS_WINCE && !Q_OS_WINRT
+#else // !Q_OS_WINCE && !Q_OS_WINRT_WIN81
//TODO - a race condition exists when using currentPath / setCurrentPath from multiple threads
if (qfsPrivateCurrentDir.isEmpty())
-#ifndef Q_OS_WINRT
+#ifndef Q_OS_WINRT_WIN81
qfsPrivateCurrentDir = QCoreApplication::applicationDirPath();
#else
qfsPrivateCurrentDir = QDir::rootPath();
#endif
ret = qfsPrivateCurrentDir;
-#endif // Q_OS_WINCE || Q_OS_WINRT
+#endif // Q_OS_WINCE || Q_OS_WINRT_WIN81
return QFileSystemEntry(ret, QFileSystemEntry::FromNativePath());
}
diff --git a/src/corelib/io/qfilesystementry.cpp b/src/corelib/io/qfilesystementry.cpp
index bf63e72a79..21c6fd89a9 100644
--- a/src/corelib/io/qfilesystementry.cpp
+++ b/src/corelib/io/qfilesystementry.cpp
@@ -172,6 +172,12 @@ void QFileSystemEntry::resolveNativeFilePath() const
m_nativeFilePath.remove(0,1);
if (m_nativeFilePath.isEmpty())
m_nativeFilePath.append(QLatin1Char('.'));
+ // WinRT/MSVC2015 allows a maximum of 256 characters for a filepath
+ // unless //?/ is prepended which extends the rule to have a maximum
+ // of 256 characters in the filename plus the preprending path
+#if _MSC_VER >= 1900
+ m_nativeFilePath.prepend("\\\\?\\");
+#endif
#endif
}
}
@@ -289,9 +295,13 @@ bool QFileSystemEntry::isAbsolute() const
bool QFileSystemEntry::isDriveRoot() const
{
resolveFilePath();
+#ifndef Q_OS_WINRT
return (m_filePath.length() == 3
&& m_filePath.at(0).isLetter() && m_filePath.at(1) == QLatin1Char(':')
&& m_filePath.at(2) == QLatin1Char('/'));
+#else // !Q_OS_WINRT
+ return m_filePath == QDir::rootPath();
+#endif // !Q_OS_WINRT
}
#endif
diff --git a/src/corelib/io/qfilesystemiterator_win.cpp b/src/corelib/io/qfilesystemiterator_win.cpp
index 82c4a69025..2caf87a7b4 100644
--- a/src/corelib/io/qfilesystemiterator_win.cpp
+++ b/src/corelib/io/qfilesystemiterator_win.cpp
@@ -73,7 +73,8 @@ QFileSystemIterator::QFileSystemIterator(const QFileSystemEntry &entry, QDir::Fi
if (!nativePath.endsWith(QLatin1Char('\\')))
nativePath.append(QLatin1Char('\\'));
nativePath.append(QLatin1Char('*'));
-#ifdef Q_OS_WINRT
+ // In MSVC2015+ case we prepend //?/ for longer file-name support
+#if defined(Q_OS_WINRT) && _MSC_VER < 1900
if (nativePath.startsWith(QLatin1Char('\\')))
nativePath.remove(0, 1);
#endif
diff --git a/src/corelib/io/qfsfileengine_win.cpp b/src/corelib/io/qfsfileengine_win.cpp
index f4adee8c1b..d94a8433a9 100644
--- a/src/corelib/io/qfsfileengine_win.cpp
+++ b/src/corelib/io/qfsfileengine_win.cpp
@@ -1043,7 +1043,7 @@ uchar *QFSFileEnginePrivate::map(qint64 offset, qint64 size,
offsetHi, offsetLo, size + extra);
#else
LPVOID mapAddress = ::MapViewOfFileFromApp(mapHandle, access,
- (ULONG64(offsetHi) << 32) + offsetLo, size);
+ (ULONG64(offsetHi) << 32) + offsetLo, size + extra);
#endif
if (mapAddress) {
uchar *address = extra + static_cast<uchar*>(mapAddress);
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index c49994a98d..60f3dc0db0 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -183,16 +183,18 @@ void QCoreApplicationPrivate::processCommandLineArguments()
{
int j = argc ? 1 : 0;
for (int i = 1; i < argc; ++i) {
- if (argv[i] && *argv[i] != '-') {
+ if (!argv[i])
+ continue;
+ if (*argv[i] != '-') {
argv[j++] = argv[i];
continue;
}
- QByteArray arg = argv[i];
- if (arg.startsWith("--"))
- arg.remove(0, 1);
- if (arg.startsWith("-qmljsdebugger=")) {
- qmljs_debug_arguments = QString::fromLocal8Bit(arg.right(arg.length() - 15));
- } else if (arg == "-qmljsdebugger" && i < argc - 1) {
+ const char *arg = argv[i];
+ if (arg[1] == '-') // startsWith("--")
+ ++arg;
+ if (strncmp(arg, "-qmljsdebugger=", 15) == 0) {
+ qmljs_debug_arguments = QString::fromLocal8Bit(arg + 15);
+ } else if (strcmp(arg, "-qmljsdebugger") == 0 && i < argc - 1) {
++i;
qmljs_debug_arguments = QString::fromLocal8Bit(argv[i]);
} else {
diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp
index 96c188666d..4f7d99b1d8 100644
--- a/src/corelib/tools/qdatetime.cpp
+++ b/src/corelib/tools/qdatetime.cpp
@@ -2706,10 +2706,11 @@ qint64 QDateTimePrivate::toMSecsSinceEpoch() const
}
case Qt::TimeZone:
-#ifndef QT_BOOTSTRAPPED
+#ifdef QT_BOOTSTRAPPED
+ break;
+#else
return zoneMSecsToEpochMSecs(m_msecs, m_timeZone);
#endif
- break;
}
Q_UNREACHABLE();
return 0;
@@ -3206,7 +3207,9 @@ QString QDateTime::timeZoneAbbreviation() const
case Qt::OffsetFromUTC:
return QTimeZonePrivate::utcQString() + toOffsetString(Qt::ISODate, d->m_offsetFromUtc);
case Qt::TimeZone:
-#ifndef QT_BOOTSTRAPPED
+#ifdef QT_BOOTSTRAPPED
+ break;
+#else
return d->m_timeZone.d->abbreviation(d->toMSecsSinceEpoch());
#endif // QT_BOOTSTRAPPED
case Qt::LocalTime: {
@@ -3237,7 +3240,9 @@ bool QDateTime::isDaylightTime() const
case Qt::OffsetFromUTC:
return false;
case Qt::TimeZone:
-#ifndef QT_BOOTSTRAPPED
+#ifdef QT_BOOTSTRAPPED
+ break;
+#else
return d->m_timeZone.d->isDaylightTime(toMSecsSinceEpoch());
#endif // QT_BOOTSTRAPPED
case Qt::LocalTime: {
@@ -4829,10 +4834,8 @@ QDataStream &operator<<(QDataStream &out, const QDateTime &dateTime)
out << (qint8)QDateTimePrivate::OffsetFromUTC;
break;
case Qt::TimeZone:
-#ifndef QT_BOOTSTRAPPED
out << (qint8)QDateTimePrivate::TimeZone;
break;
-#endif // QT_BOOTSTRAPPED
case Qt::LocalTime:
out << (qint8)QDateTimePrivate::LocalUnknown;
break;
@@ -4905,10 +4908,11 @@ QDataStream &operator>>(QDataStream &in, QDateTime &dateTime)
spec = Qt::OffsetFromUTC;
break;
case QDateTimePrivate::TimeZone:
-#ifndef QT_BOOTSTRAPPED
spec = Qt::TimeZone;
+#ifndef QT_BOOTSTRAPPED
+ // FIXME: need to use a different constructor !
+#endif
break;
-#endif // QT_BOOTSTRAPPED
case QDateTimePrivate::LocalUnknown:
case QDateTimePrivate::LocalStandard:
case QDateTimePrivate::LocalDST:
@@ -4964,8 +4968,8 @@ QDebug operator<<(QDebug dbg, const QDateTime &date)
case Qt::TimeZone:
#ifndef QT_BOOTSTRAPPED
dbg << ' ' << date.timeZone().id();
- break;
#endif // QT_BOOTSTRAPPED
+ break;
case Qt::LocalTime:
break;
}
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp
index 9b98f4322b..24d43dad88 100644
--- a/src/corelib/tools/qstring.cpp
+++ b/src/corelib/tools/qstring.cpp
@@ -5733,37 +5733,42 @@ static QString detachAndConvertCase(T &str, QStringIterator it)
Q_ASSERT(!str.isEmpty());
QString s = qMove(str); // will copy if T is const QString
QChar *pp = s.begin() + it.index(); // will detach if necessary
- uint uc = it.nextUnchecked();
- forever {
+
+ do {
+ uint uc = it.nextUnchecked();
+
const QUnicodeTables::Properties *prop = qGetProp(uc);
signed short caseDiff = Traits::caseDiff(prop);
if (Q_UNLIKELY(Traits::caseSpecial(prop))) {
- // slow path: the string is growing
const ushort *specialCase = specialCaseMap + caseDiff;
ushort length = *specialCase++;
- int inpos = it.index() - 1;
- int outpos = pp - s.constBegin();
-
- s.replace(outpos, 1, reinterpret_cast<const QChar *>(specialCase), length);
- pp = const_cast<QChar *>(s.constBegin()) + outpos + length;
-
- // do we need to adjust the input iterator too?
- // if it is pointing to s's data, str is empty
- if (str.isEmpty())
- it = QStringIterator(s.constBegin(), inpos + length, s.constEnd());
- } else if (QChar::requiresSurrogates(uc)) {
- *pp++ = QChar::highSurrogate(uc + caseDiff);
+
+ if (Q_LIKELY(length == 1)) {
+ *pp++ = QChar(*specialCase);
+ } else {
+ // slow path: the string is growing
+ int inpos = it.index() - 1;
+ int outpos = pp - s.constBegin();
+
+ s.replace(outpos, 1, reinterpret_cast<const QChar *>(specialCase), length);
+ pp = const_cast<QChar *>(s.constBegin()) + outpos + length;
+
+ // do we need to adjust the input iterator too?
+ // if it is pointing to s's data, str is empty
+ if (str.isEmpty())
+ it = QStringIterator(s.constBegin(), inpos + length, s.constEnd());
+ }
+ } else if (Q_UNLIKELY(QChar::requiresSurrogates(uc))) {
+ // so far, case convertion never changes planes (guaranteed by the qunicodetables generator)
+ pp++;
*pp++ = QChar::lowSurrogate(uc + caseDiff);
} else {
*pp++ = QChar(uc + caseDiff);
}
+ } while (it.hasNext());
- if (!it.hasNext())
- return s;
-
- uc = it.nextUnchecked();
- }
+ return s;
}
template <typename Traits, typename T>
@@ -5776,12 +5781,13 @@ static QString convertCase(T &str)
while (e != p && e[-1].isHighSurrogate())
--e;
- const QUnicodeTables::Properties *prop;
QStringIterator it(p, e);
- for ( ; it.hasNext(); it.advanceUnchecked()) {
- prop = qGetProp(it.peekNextUnchecked());
- if (Traits::caseDiff(prop))
+ while (it.hasNext()) {
+ uint uc = it.nextUnchecked();
+ if (Traits::caseDiff(qGetProp(uc))) {
+ it.recedeUnchecked();
return detachAndConvertCase<Traits>(str, it);
+ }
}
return qMove(str);
}
diff --git a/src/dbus/qdbusconnection_p.h b/src/dbus/qdbusconnection_p.h
index d5f4f80e64..83a2e6fc32 100644
--- a/src/dbus/qdbusconnection_p.h
+++ b/src/dbus/qdbusconnection_p.h
@@ -286,6 +286,7 @@ private slots:
signals:
void dispatchStatusChanged();
+ void spyHooksFinished(const QDBusMessage &msg);
void messageNeedsSending(QDBusPendingCallPrivate *pcall, void *msg, int timeout = -1);
void signalNeedsConnecting(const QString &key, const QDBusConnectionPrivate::SignalHook &hook);
bool signalNeedsDisconnecting(const QString &key, const QDBusConnectionPrivate::SignalHook &hook);
diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp
index e630744854..3cd5c4d8e4 100644
--- a/src/dbus/qdbusintegrator.cpp
+++ b/src/dbus/qdbusintegrator.cpp
@@ -126,8 +126,7 @@ void qdbusDefaultThreadDebug(int action, int condition, QDBusConnectionPrivate *
qdbusThreadDebugFunc qdbusThreadDebug = 0;
#endif
-typedef void (*QDBusSpyHook)(const QDBusMessage&);
-typedef QVarLengthArray<QDBusSpyHook, 4> QDBusSpyHookList;
+typedef QVarLengthArray<QDBusSpyCallEvent::Hook, 4> QDBusSpyHookList;
Q_GLOBAL_STATIC(QDBusSpyHookList, qDBusSpyHookList)
extern "C" {
@@ -467,12 +466,29 @@ static QStringList matchArgsForService(const QString &service, QDBusServiceWatch
}
-extern Q_DBUS_EXPORT void qDBusAddSpyHook(QDBusSpyHook);
-void qDBusAddSpyHook(QDBusSpyHook hook)
+extern Q_DBUS_EXPORT void qDBusAddSpyHook(QDBusSpyCallEvent::Hook);
+void qDBusAddSpyHook(QDBusSpyCallEvent::Hook hook)
{
qDBusSpyHookList()->append(hook);
}
+QDBusSpyCallEvent::~QDBusSpyCallEvent()
+{
+ // Reinsert the message into the processing queue for the connection.
+ // This is done in the destructor so the message is reinserted even if
+ // QCoreApplication is destroyed.
+ QDBusConnectionPrivate *d = static_cast<QDBusConnectionPrivate *>(const_cast<QObject *>(sender()));
+ qDBusDebug() << d << "message spies done for" << msg;
+ emit d->spyHooksFinished(msg);
+}
+
+void QDBusSpyCallEvent::placeMetaCall(QObject *)
+{
+ // call the spy hook list
+ for (int i = 0; i < hookCount; ++i)
+ hooks[i](msg);
+}
+
extern "C" {
static DBusHandlerResult
qDBusSignalFilter(DBusConnection *connection, DBusMessage *message, void *data)
@@ -494,16 +510,11 @@ qDBusSignalFilter(DBusConnection *connection, DBusMessage *message, void *data)
bool QDBusConnectionPrivate::handleMessage(const QDBusMessage &amsg)
{
- const QDBusSpyHookList *list = qDBusSpyHookList();
- for (int i = 0; list && i < list->size(); ++i) {
- qDBusDebug() << "calling the message spy hook";
- (*(*list)[i])(amsg);
- }
-
if (!ref.load())
return false;
if (!dispatchEnabled && !QDBusMessagePrivate::isLocal(amsg)) {
// queue messages only, we'll handle them later
+ qDBusDebug() << this << "delivery is suspended";
pendingMessages << amsg;
return amsg.type() == QDBusMessage::MethodCallMessage;
}
@@ -515,6 +526,15 @@ bool QDBusConnectionPrivate::handleMessage(const QDBusMessage &amsg)
// let them see the signal too
return false;
case QDBusMessage::MethodCallMessage:
+ // run it through the spy filters (if any) before the regular processing
+ if (Q_UNLIKELY(qDBusSpyHookList.exists()) && qApp) {
+ const QDBusSpyHookList &list = *qDBusSpyHookList;
+ qDBusDebug() << this << "invoking message spies";
+ QCoreApplication::postEvent(qApp, new QDBusSpyCallEvent(this, QDBusConnection(this),
+ amsg, list.constData(), list.size()));
+ return true;
+ }
+
handleObjectCall(amsg);
return true;
case QDBusMessage::ReplyMessage:
@@ -986,6 +1006,8 @@ QDBusConnectionPrivate::QDBusConnectionPrivate(QObject *p)
QDBusMetaTypeId::init();
connect(this, &QDBusConnectionPrivate::dispatchStatusChanged,
this, &QDBusConnectionPrivate::doDispatch, Qt::QueuedConnection);
+ connect(this, &QDBusConnectionPrivate::spyHooksFinished,
+ this, &QDBusConnectionPrivate::handleObjectCall, Qt::QueuedConnection);
connect(this, &QDBusConnectionPrivate::messageNeedsSending,
this, &QDBusConnectionPrivate::sendInternal);
connect(this, &QDBusConnectionPrivate::signalNeedsConnecting,
@@ -1097,8 +1119,10 @@ void QDBusConnectionPrivate::doDispatch()
// dispatch previously queued messages
PendingMessageList::Iterator it = pendingMessages.begin();
PendingMessageList::Iterator end = pendingMessages.end();
- for ( ; it != end; ++it)
+ for ( ; it != end; ++it) {
+ qDBusDebug() << this << "dequeueing message" << *it;
handleMessage(qMove(*it));
+ }
pendingMessages.clear();
}
}
diff --git a/src/dbus/qdbusintegrator_p.h b/src/dbus/qdbusintegrator_p.h
index 90ae1fc6a6..89043148e3 100644
--- a/src/dbus/qdbusintegrator_p.h
+++ b/src/dbus/qdbusintegrator_p.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2016 Intel Corporation.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtDBus module of the Qt Toolkit.
@@ -71,6 +72,7 @@
QT_BEGIN_NAMESPACE
class QDBusConnectionPrivate;
+class QDBusMessage;
// Really private structs used by qdbusintegrator.cpp
// Things that aren't used by any other file
@@ -139,6 +141,23 @@ private:
bool handled;
};
+class QDBusSpyCallEvent : public QMetaCallEvent
+{
+public:
+ typedef void (*Hook)(const QDBusMessage&);
+ QDBusSpyCallEvent(QDBusConnectionPrivate *cp, const QDBusConnection &c, const QDBusMessage &msg,
+ const Hook *hooks, int count)
+ : QMetaCallEvent(0, 0, Q_NULLPTR, cp, 0), conn(c), msg(msg), hooks(hooks), hookCount(count)
+ {}
+ ~QDBusSpyCallEvent();
+ void placeMetaCall(QObject *) Q_DECL_OVERRIDE;
+
+ QDBusConnection conn; // keeps the refcount in QDBusConnectionPrivate up
+ QDBusMessage msg;
+ const Hook *hooks;
+ int hookCount;
+};
+
QT_END_NAMESPACE
Q_DECLARE_METATYPE(QDBusSlotCache)
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index 37d6ab6be0..58e2586024 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -1220,30 +1220,32 @@ void QGuiApplicationPrivate::createPlatformIntegration()
int j = argc ? 1 : 0;
for (int i=1; i<argc; i++) {
- if (argv[i] && *argv[i] != '-') {
+ if (!argv[i])
+ continue;
+ if (*argv[i] != '-') {
argv[j++] = argv[i];
continue;
}
const bool isXcb = platformName == "xcb";
- QByteArray arg = argv[i];
- if (arg.startsWith("--"))
- arg.remove(0, 1);
- if (arg == "-platformpluginpath") {
+ const char *arg = argv[i];
+ if (arg[1] == '-') // startsWith("--")
+ ++arg;
+ if (strcmp(arg, "-platformpluginpath") == 0) {
if (++i < argc)
platformPluginPath = QString::fromLocal8Bit(argv[i]);
- } else if (arg == "-platform") {
+ } else if (strcmp(arg, "-platform") == 0) {
if (++i < argc)
platformName = argv[i];
- } else if (arg == "-platformtheme") {
+ } else if (strcmp(arg, "-platformtheme") == 0) {
if (++i < argc)
platformThemeName = QString::fromLocal8Bit(argv[i]);
- } else if (arg == "-qwindowgeometry" || (isXcb && arg == "-geometry")) {
+ } else if (strcmp(arg, "-qwindowgeometry") == 0 || (isXcb && strcmp(arg, "-geometry") == 0)) {
if (++i < argc)
windowGeometrySpecification = QWindowGeometrySpecification::fromArgument(argv[i]);
- } else if (arg == "-qwindowtitle" || (isXcb && arg == "-title")) {
+ } else if (strcmp(arg, "-qwindowtitle") == 0 || (isXcb && strcmp(arg, "-title") == 0)) {
if (++i < argc)
firstWindowTitle = QString::fromLocal8Bit(argv[i]);
- } else if (arg == "-qwindowicon" || (isXcb && arg == "-icon")) {
+ } else if (strcmp(arg, "-qwindowicon") == 0 || (isXcb && strcmp(arg, "-icon") == 0)) {
if (++i < argc) {
icon = QString::fromLocal8Bit(argv[i]);
}
@@ -1319,20 +1321,22 @@ void QGuiApplicationPrivate::init()
QString s;
int j = argc ? 1 : 0;
for (int i=1; i<argc; i++) {
- if (argv[i] && *argv[i] != '-') {
+ if (!argv[i])
+ continue;
+ if (*argv[i] != '-') {
argv[j++] = argv[i];
continue;
}
- QByteArray arg = argv[i];
- if (arg.startsWith("--"))
- arg.remove(0, 1);
- if (arg == "-plugin") {
+ const char *arg = argv[i];
+ if (arg[1] == '-') // startsWith("--")
+ ++arg;
+ if (strcmp(arg, "-plugin") == 0) {
if (++i < argc)
pluginList << argv[i];
- } else if (arg == "-reverse") {
+ } else if (strcmp(arg, "-reverse") == 0) {
force_reverse = true;
#ifdef Q_OS_MAC
- } else if (arg.startsWith("-psn_")) {
+ } else if (strncmp(arg, "-psn_", 5) == 0) {
// eat "-psn_xxxx" on Mac, which is passed when starting an app from Finder.
// special hack to change working directory (for an app bundle) when running from finder
if (QDir::currentPath() == QLatin1String("/")) {
@@ -1344,7 +1348,7 @@ void QGuiApplicationPrivate::init()
}
#endif
#ifndef QT_NO_SESSIONMANAGER
- } else if (arg == "-session" && i < argc-1) {
+ } else if (strcmp(arg, "-session") == 0 && i < argc - 1) {
++i;
if (argv[i] && *argv[i]) {
session_id = QString::fromLatin1(argv[i]);
@@ -1356,11 +1360,11 @@ void QGuiApplicationPrivate::init()
is_session_restored = true;
}
#endif
- } else if (arg == "-testability") {
+ } else if (strcmp(arg, "-testability") == 0) {
loadTestability = true;
- } else if (arg.indexOf("-style=", 0) != -1) {
- s = QString::fromLocal8Bit(arg.right(arg.length() - 7).toLower());
- } else if (arg == "-style" && i < argc-1) {
+ } else if (strncmp(arg, "-style=", 7) == 0) {
+ s = QString::fromLocal8Bit(arg + 7).toLower();
+ } else if (strcmp(arg, "-style") == 0 && i < argc - 1) {
s = QString::fromLocal8Bit(argv[++i]).toLower();
} else {
argv[j++] = argv[i];
diff --git a/src/gui/kernel/qplatformgraphicsbufferhelper.cpp b/src/gui/kernel/qplatformgraphicsbufferhelper.cpp
index 46a536c923..82a88eca04 100644
--- a/src/gui/kernel/qplatformgraphicsbufferhelper.cpp
+++ b/src/gui/kernel/qplatformgraphicsbufferhelper.cpp
@@ -238,6 +238,7 @@ bool QPlatformGraphicsBufferHelper::bindSWToTexture(const QPlatformGraphicsBuffe
#else
Q_UNUSED(graphicsBuffer)
Q_UNUSED(swizzleRandB)
+ Q_UNUSED(premultipliedB)
Q_UNUSED(subRect)
return false;
#endif // QT_NO_OPENGL
diff --git a/src/gui/opengl/qopenglpaintengine.cpp b/src/gui/opengl/qopenglpaintengine.cpp
index a1e5084fc1..d93871c99b 100644
--- a/src/gui/opengl/qopenglpaintengine.cpp
+++ b/src/gui/opengl/qopenglpaintengine.cpp
@@ -99,13 +99,6 @@ QOpenGL2PaintEngineExPrivate::~QOpenGL2PaintEngineExPrivate()
{
delete shaderManager;
- while (pathCaches.size()) {
- QVectorPath::CacheEntry *e = *(pathCaches.constBegin());
- e->cleanup(e->engine, e->data);
- e->data = 0;
- e->engine = 0;
- }
-
if (elementIndicesVBOId != 0) {
funcs.glDeleteBuffers(1, &elementIndicesVBOId);
elementIndicesVBOId = 0;
@@ -298,8 +291,6 @@ void QOpenGL2PaintEngineExPrivate::updateBrushTexture()
}
updateTexture(QT_BRUSH_TEXTURE_UNIT, currentBrushImage, wrapMode, filterMode, ForceUpdate);
-
- textureInvertedY = false;
}
brushTextureDirty = false;
}
@@ -415,11 +406,7 @@ void QOpenGL2PaintEngineExPrivate::updateBrushUniforms()
dy = 0;
}
QTransform gl_to_qt(1, 0, 0, m22, 0, dy);
- QTransform inv_matrix;
- if (style == Qt::TexturePattern && textureInvertedY == -1)
- inv_matrix = gl_to_qt * (QTransform(1, 0, 0, -1, 0, currentBrush.texture().height()) * brushQTransform * matrix).inverted() * translate;
- else
- inv_matrix = gl_to_qt * (brushQTransform * matrix).inverted() * translate;
+ QTransform inv_matrix = gl_to_qt * (brushQTransform * matrix).inverted() * translate;
shaderManager->currentProgram()->setUniformValue(location(QOpenGLEngineShaderManager::BrushTransform), inv_matrix);
shaderManager->currentProgram()->setUniformValue(location(QOpenGLEngineShaderManager::BrushTexture), QT_BRUSH_TEXTURE_UNIT);
diff --git a/src/gui/opengl/qopenglpaintengine_p.h b/src/gui/opengl/qopenglpaintengine_p.h
index 88ad22e635..c9f328203c 100644
--- a/src/gui/opengl/qopenglpaintengine_p.h
+++ b/src/gui/opengl/qopenglpaintengine_p.h
@@ -315,14 +315,9 @@ public:
bool needsSync;
bool multisamplingAlwaysEnabled;
- GLfloat depthRange[2];
-
- float textureInvertedY;
-
QTriangulatingStroker stroker;
QDashedStrokeProcessor dasher;
- QSet<QVectorPath::CacheEntry *> pathCaches;
QVector<GLuint> unusedVBOSToClean;
QVector<GLuint> unusedIBOSToClean;
diff --git a/src/gui/painting/qplatformbackingstore.cpp b/src/gui/painting/qplatformbackingstore.cpp
index 640792c6ec..d35f1d00d1 100644
--- a/src/gui/painting/qplatformbackingstore.cpp
+++ b/src/gui/painting/qplatformbackingstore.cpp
@@ -391,7 +391,7 @@ void QPlatformBackingStore::composeAndFlush(QWindow *window, const QRegion &regi
// The backingstore is for the entire tlw.
// In case of native children offset tells the position relative to the tlw.
const QRect srcRect = toBottomLeftRect(deviceWindowRect.translated(offset), d_ptr->textureSize.height());
- const QMatrix3x3 source = QOpenGLTextureBlitter::sourceTransform(deviceRect(srcRect, window),
+ const QMatrix3x3 source = QOpenGLTextureBlitter::sourceTransform(srcRect,
d_ptr->textureSize,
origin);
d_ptr->blitter->blit(textureId, QMatrix4x4(), source);
diff --git a/src/gui/text/qfontengine_ft_p.h b/src/gui/text/qfontengine_ft_p.h
index 9c1cf20827..1886fc67ba 100644
--- a/src/gui/text/qfontengine_ft_p.h
+++ b/src/gui/text/qfontengine_ft_p.h
@@ -195,65 +195,65 @@ private:
mutable int fast_glyph_count;
};
- virtual QFontEngine::FaceId faceId() const Q_DECL_OVERRIDE;
- virtual QFontEngine::Properties properties() const Q_DECL_OVERRIDE;
- virtual QFixed emSquareSize() const Q_DECL_OVERRIDE;
- virtual bool supportsSubPixelPositions() const Q_DECL_OVERRIDE
+ QFontEngine::FaceId faceId() const Q_DECL_OVERRIDE;
+ QFontEngine::Properties properties() const Q_DECL_OVERRIDE;
+ QFixed emSquareSize() const Q_DECL_OVERRIDE;
+ bool supportsSubPixelPositions() const Q_DECL_OVERRIDE
{
return default_hint_style == HintLight ||
default_hint_style == HintNone;
}
- virtual bool getSfntTableData(uint tag, uchar *buffer, uint *length) const Q_DECL_OVERRIDE;
- virtual int synthesized() const Q_DECL_OVERRIDE;
+ bool getSfntTableData(uint tag, uchar *buffer, uint *length) const Q_DECL_OVERRIDE;
+ int synthesized() const Q_DECL_OVERRIDE;
- virtual QFixed ascent() const Q_DECL_OVERRIDE;
- virtual QFixed descent() const Q_DECL_OVERRIDE;
- virtual QFixed leading() const Q_DECL_OVERRIDE;
- virtual QFixed xHeight() const Q_DECL_OVERRIDE;
- virtual QFixed averageCharWidth() const Q_DECL_OVERRIDE;
+ QFixed ascent() const Q_DECL_OVERRIDE;
+ QFixed descent() const Q_DECL_OVERRIDE;
+ QFixed leading() const Q_DECL_OVERRIDE;
+ QFixed xHeight() const Q_DECL_OVERRIDE;
+ QFixed averageCharWidth() const Q_DECL_OVERRIDE;
- virtual qreal maxCharWidth() const Q_DECL_OVERRIDE;
- virtual QFixed lineThickness() const Q_DECL_OVERRIDE;
- virtual QFixed underlinePosition() const Q_DECL_OVERRIDE;
+ qreal maxCharWidth() const Q_DECL_OVERRIDE;
+ QFixed lineThickness() const Q_DECL_OVERRIDE;
+ QFixed underlinePosition() const Q_DECL_OVERRIDE;
- virtual glyph_t glyphIndex(uint ucs4) const Q_DECL_OVERRIDE;
+ glyph_t glyphIndex(uint ucs4) const Q_DECL_OVERRIDE;
void doKerning(QGlyphLayout *, ShaperFlags) const Q_DECL_OVERRIDE;
- virtual void getUnscaledGlyph(glyph_t glyph, QPainterPath *path, glyph_metrics_t *metrics) Q_DECL_OVERRIDE;
+ void getUnscaledGlyph(glyph_t glyph, QPainterPath *path, glyph_metrics_t *metrics) Q_DECL_OVERRIDE;
- virtual bool supportsTransformation(const QTransform &transform) const Q_DECL_OVERRIDE;
+ bool supportsTransformation(const QTransform &transform) const Q_DECL_OVERRIDE;
- virtual void addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions, int nglyphs,
- QPainterPath *path, QTextItem::RenderFlags flags) Q_DECL_OVERRIDE;
- virtual void addOutlineToPath(qreal x, qreal y, const QGlyphLayout &glyphs,
- QPainterPath *path, QTextItem::RenderFlags flags) Q_DECL_OVERRIDE;
+ void addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions, int nglyphs,
+ QPainterPath *path, QTextItem::RenderFlags flags) Q_DECL_OVERRIDE;
+ void addOutlineToPath(qreal x, qreal y, const QGlyphLayout &glyphs,
+ QPainterPath *path, QTextItem::RenderFlags flags) Q_DECL_OVERRIDE;
- virtual bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, ShaperFlags flags) const Q_DECL_OVERRIDE;
+ bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, ShaperFlags flags) const Q_DECL_OVERRIDE;
- virtual glyph_metrics_t boundingBox(const QGlyphLayout &glyphs) Q_DECL_OVERRIDE;
- virtual glyph_metrics_t boundingBox(glyph_t glyph) Q_DECL_OVERRIDE;
- virtual glyph_metrics_t boundingBox(glyph_t glyph, const QTransform &matrix) Q_DECL_OVERRIDE;
+ glyph_metrics_t boundingBox(const QGlyphLayout &glyphs) Q_DECL_OVERRIDE;
+ glyph_metrics_t boundingBox(glyph_t glyph) Q_DECL_OVERRIDE;
+ glyph_metrics_t boundingBox(glyph_t glyph, const QTransform &matrix) Q_DECL_OVERRIDE;
- virtual void recalcAdvances(QGlyphLayout *glyphs, ShaperFlags flags) const Q_DECL_OVERRIDE;
- virtual QImage alphaMapForGlyph(glyph_t g) Q_DECL_OVERRIDE { return alphaMapForGlyph(g, 0); }
- virtual QImage alphaMapForGlyph(glyph_t, QFixed) Q_DECL_OVERRIDE;
+ void recalcAdvances(QGlyphLayout *glyphs, ShaperFlags flags) const Q_DECL_OVERRIDE;
+ QImage alphaMapForGlyph(glyph_t g) Q_DECL_OVERRIDE { return alphaMapForGlyph(g, 0); }
+ QImage alphaMapForGlyph(glyph_t, QFixed) Q_DECL_OVERRIDE;
QImage alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition, const QTransform &t) Q_DECL_OVERRIDE;
- virtual QImage alphaRGBMapForGlyph(glyph_t, QFixed subPixelPosition, const QTransform &t) Q_DECL_OVERRIDE;
- virtual glyph_metrics_t alphaMapBoundingBox(glyph_t glyph,
- QFixed subPixelPosition,
- const QTransform &matrix,
- QFontEngine::GlyphFormat format) Q_DECL_OVERRIDE;
- virtual QImage *lockedAlphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition,
- GlyphFormat neededFormat, const QTransform &t,
- QPoint *offset) Q_DECL_OVERRIDE;
- virtual bool hasInternalCaching() const Q_DECL_OVERRIDE { return cacheEnabled; }
- virtual void unlockAlphaMapForGlyph() Q_DECL_OVERRIDE;
-
- virtual void removeGlyphFromCache(glyph_t glyph) Q_DECL_OVERRIDE;
- virtual int glyphMargin(QFontEngine::GlyphFormat /* format */) Q_DECL_OVERRIDE { return 0; }
-
- virtual int glyphCount() const Q_DECL_OVERRIDE;
+ QImage alphaRGBMapForGlyph(glyph_t, QFixed subPixelPosition, const QTransform &t) Q_DECL_OVERRIDE;
+ glyph_metrics_t alphaMapBoundingBox(glyph_t glyph,
+ QFixed subPixelPosition,
+ const QTransform &matrix,
+ QFontEngine::GlyphFormat format) Q_DECL_OVERRIDE;
+ QImage *lockedAlphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition,
+ GlyphFormat neededFormat, const QTransform &t,
+ QPoint *offset) Q_DECL_OVERRIDE;
+ bool hasInternalCaching() const Q_DECL_OVERRIDE { return cacheEnabled; }
+ void unlockAlphaMapForGlyph() Q_DECL_OVERRIDE;
+
+ void removeGlyphFromCache(glyph_t glyph) Q_DECL_OVERRIDE;
+ int glyphMargin(QFontEngine::GlyphFormat /* format */) Q_DECL_OVERRIDE { return 0; }
+
+ int glyphCount() const Q_DECL_OVERRIDE;
enum Scaling {
Scaled,
@@ -283,12 +283,12 @@ private:
bool init(FaceId faceId, bool antialias, GlyphFormat format,
QFreetypeFace *freetypeFace);
- virtual int getPointInOutline(glyph_t glyph, int flags, quint32 point, QFixed *xpos, QFixed *ypos, quint32 *nPoints) Q_DECL_OVERRIDE;
+ int getPointInOutline(glyph_t glyph, int flags, quint32 point, QFixed *xpos, QFixed *ypos, quint32 *nPoints) Q_DECL_OVERRIDE;
void setQtDefaultHintStyle(QFont::HintingPreference hintingPreference);
- virtual void setDefaultHintStyle(HintStyle style) Q_DECL_OVERRIDE;
+ void setDefaultHintStyle(HintStyle style) Q_DECL_OVERRIDE;
- virtual QFontEngine *cloneWithSize(qreal pixelSize) const Q_DECL_OVERRIDE;
+ QFontEngine *cloneWithSize(qreal pixelSize) const Q_DECL_OVERRIDE;
bool initFromFontEngine(const QFontEngineFT *fontEngine);
HintStyle defaultHintStyle() const { return default_hint_style; }
diff --git a/src/gui/text/qtextcursor.cpp b/src/gui/text/qtextcursor.cpp
index f824d1b369..85484b8b03 100644
--- a/src/gui/text/qtextcursor.cpp
+++ b/src/gui/text/qtextcursor.cpp
@@ -1078,8 +1078,8 @@ QTextCursor::QTextCursor(const QTextBlock &block)
/*!
\internal
*/
-QTextCursor::QTextCursor(QTextDocumentPrivate *p, int pos)
- : d(new QTextCursorPrivate(p))
+QTextCursor::QTextCursor(QTextDocumentPrivate &p, int pos)
+ : d(new QTextCursorPrivate(&p))
{
d->adjusted_anchor = d->anchor = d->position = pos;
diff --git a/src/gui/text/qtextcursor.h b/src/gui/text/qtextcursor.h
index bc099e9d03..b8fa3145eb 100644
--- a/src/gui/text/qtextcursor.h
+++ b/src/gui/text/qtextcursor.h
@@ -67,10 +67,8 @@ class Q_GUI_EXPORT QTextCursor
public:
QTextCursor();
explicit QTextCursor(QTextDocument *document);
- QTextCursor(QTextDocumentPrivate *p, int pos);
explicit QTextCursor(QTextFrame *frame);
explicit QTextCursor(const QTextBlock &block);
- explicit QTextCursor(QTextCursorPrivate *d);
QTextCursor(const QTextCursor &cursor);
#ifdef Q_COMPILER_RVALUE_REFS
QTextCursor &operator=(QTextCursor &&other) Q_DECL_NOTHROW { swap(other); return *this; }
@@ -227,8 +225,12 @@ public:
QTextDocument *document() const;
private:
+ QTextCursor(QTextDocumentPrivate &p, int pos);
+ explicit QTextCursor(QTextCursorPrivate *d);
+
QSharedDataPointer<QTextCursorPrivate> d;
friend class QTextCursorPrivate;
+ friend class QTextDocumentPrivate;
friend class QTextDocumentFragmentPrivate;
friend class QTextCopyHelper;
friend class QWidgetTextControlPrivate;
diff --git a/src/gui/text/qtextcursor_p.h b/src/gui/text/qtextcursor_p.h
index 9463a8be6f..5b593b8a9b 100644
--- a/src/gui/text/qtextcursor_p.h
+++ b/src/gui/text/qtextcursor_p.h
@@ -106,6 +106,9 @@ public:
void aboutToRemoveCell(int from, int to);
+ static QTextCursor fromPosition(QTextDocumentPrivate *d, int pos)
+ { return QTextCursor(*d, pos); }
+
QTextDocumentPrivate *priv;
qreal x;
int position;
diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp
index 01d6d2c519..f50f771c07 100644
--- a/src/gui/text/qtextdocument.cpp
+++ b/src/gui/text/qtextdocument.cpp
@@ -39,6 +39,7 @@
#include "qtextdocument.h"
#include <qtextformat.h>
+#include "qtextcursor_p.h"
#include "qtextdocumentlayout_p.h"
#include "qtextdocumentfragment.h"
#include "qtextdocumentfragment_p.h"
@@ -1279,7 +1280,7 @@ static bool findInBlock(const QTextBlock &block, const QString &expression, int
}
}
//we have a hit, return the cursor for that.
- *cursor = QTextCursor(block.docHandle(), block.position() + idx);
+ *cursor = QTextCursorPrivate::fromPosition(block.docHandle(), block.position() + idx);
cursor->setPosition(cursor->position() + expression.length(), QTextCursor::KeepAnchor);
return true;
}
@@ -1397,7 +1398,7 @@ static bool findInBlock(const QTextBlock &block, const QRegExp &expression, int
}
}
//we have a hit, return the cursor for that.
- *cursor = QTextCursor(block.docHandle(), block.position() + idx);
+ *cursor = QTextCursorPrivate::fromPosition(block.docHandle(), block.position() + idx);
cursor->setPosition(cursor->position() + expr.matchedLength(), QTextCursor::KeepAnchor);
return true;
}
@@ -1525,7 +1526,7 @@ static bool findInBlock(const QTextBlock &block, const QRegularExpression &expre
}
}
//we have a hit, return the cursor for that.
- *cursor = QTextCursor(block.docHandle(), block.position() + idx);
+ *cursor = QTextCursorPrivate::fromPosition(block.docHandle(), block.position() + idx);
cursor->setPosition(cursor->position() + match.capturedLength(), QTextCursor::KeepAnchor);
return true;
}
diff --git a/src/gui/text/qtextdocument_p.cpp b/src/gui/text/qtextdocument_p.cpp
index ed421177fe..cfca718f01 100644
--- a/src/gui/text/qtextdocument_p.cpp
+++ b/src/gui/text/qtextdocument_p.cpp
@@ -1710,7 +1710,7 @@ bool QTextDocumentPrivate::ensureMaximumBlockCount()
beginEditBlock();
const int blocksToRemove = blocks.numNodes() - maximumBlockCount;
- QTextCursor cursor(this, 0);
+ QTextCursor cursor(*this, 0);
cursor.movePosition(QTextCursor::NextBlock, QTextCursor::KeepAnchor, blocksToRemove);
unreachableCharacterCount += cursor.selectionEnd() - cursor.selectionStart();
diff --git a/src/gui/text/qtextobject.cpp b/src/gui/text/qtextobject.cpp
index 6aefe8b339..49cf35ecc0 100644
--- a/src/gui/text/qtextobject.cpp
+++ b/src/gui/text/qtextobject.cpp
@@ -39,6 +39,7 @@
#include "qtextobject.h"
#include "qtextobject_p.h"
+#include "qtextcursor_p.h"
#include "qtextdocument.h"
#include "qtextformat_p.h"
#include "qtextdocument_p.h"
@@ -467,7 +468,7 @@ QTextFrame *QTextFrame::parentFrame() const
QTextCursor QTextFrame::firstCursorPosition() const
{
Q_D(const QTextFrame);
- return QTextCursor(d->pieceTable, firstPosition());
+ return QTextCursorPrivate::fromPosition(d->pieceTable, firstPosition());
}
/*!
@@ -478,7 +479,7 @@ QTextCursor QTextFrame::firstCursorPosition() const
QTextCursor QTextFrame::lastCursorPosition() const
{
Q_D(const QTextFrame);
- return QTextCursor(d->pieceTable, lastPosition());
+ return QTextCursorPrivate::fromPosition(d->pieceTable, lastPosition());
}
/*!
diff --git a/src/gui/text/qtexttable.cpp b/src/gui/text/qtexttable.cpp
index 20821c66ef..062a214d63 100644
--- a/src/gui/text/qtexttable.cpp
+++ b/src/gui/text/qtexttable.cpp
@@ -41,6 +41,7 @@
#include "qtextcursor.h"
#include "qtextformat.h"
#include <qdebug.h>
+#include "qtextcursor_p.h"
#include "qtexttable_p.h"
#include "qvarlengtharray.h"
@@ -226,7 +227,7 @@ int QTextTableCell::columnSpan() const
*/
QTextCursor QTextTableCell::firstCursorPosition() const
{
- return QTextCursor(table->d_func()->pieceTable, firstPosition());
+ return QTextCursorPrivate::fromPosition(table->d_func()->pieceTable, firstPosition());
}
/*!
@@ -236,7 +237,7 @@ QTextCursor QTextTableCell::firstCursorPosition() const
*/
QTextCursor QTextTableCell::lastCursorPosition() const
{
- return QTextCursor(table->d_func()->pieceTable, lastPosition());
+ return QTextCursorPrivate::fromPosition(table->d_func()->pieceTable, lastPosition());
}
@@ -1109,10 +1110,10 @@ void QTextTable::mergeCells(int row, int column, int numRows, int numCols)
if (nextPos > pos) {
if (needsParagraph) {
needsParagraph = false;
- QTextCursor(p, insertPos++).insertBlock();
+ QTextCursorPrivate::fromPosition(p, insertPos++).insertBlock();
p->move(pos + 1, insertPos, nextPos - pos);
} else if (rowHasText) {
- QTextCursor(p, insertPos++).insertText(QLatin1String(" "));
+ QTextCursorPrivate::fromPosition(p, insertPos++).insertText(QLatin1String(" "));
p->move(pos + 1, insertPos, nextPos - pos);
} else {
p->move(pos, insertPos, nextPos - pos);
@@ -1288,7 +1289,7 @@ QTextCursor QTextTable::rowStart(const QTextCursor &c) const
int row = cell.row();
QTextDocumentPrivate *p = d->pieceTable;
QTextDocumentPrivate::FragmentIterator it(&p->fragmentMap(), d->grid[row*d->nCols]);
- return QTextCursor(p, it.position());
+ return QTextCursorPrivate::fromPosition(p, it.position());
}
/*!
@@ -1310,7 +1311,7 @@ QTextCursor QTextTable::rowEnd(const QTextCursor &c) const
int fragment = row < d->nRows ? d->grid[row*d->nCols] : d->fragment_end;
QTextDocumentPrivate *p = d->pieceTable;
QTextDocumentPrivate::FragmentIterator it(&p->fragmentMap(), fragment);
- return QTextCursor(p, it.position() - 1);
+ return QTextCursorPrivate::fromPosition(p, it.position() - 1);
}
/*!
diff --git a/src/network/kernel/qnetworkinterface_unix.cpp b/src/network/kernel/qnetworkinterface_unix.cpp
index d04ea085c2..da53ccfe70 100644
--- a/src/network/kernel/qnetworkinterface_unix.cpp
+++ b/src/network/kernel/qnetworkinterface_unix.cpp
@@ -320,29 +320,29 @@ static QList<QNetworkInterfacePrivate *> interfaceListing()
}
#endif
- // Get the interface broadcast address
- QNetworkAddressEntry entry;
- if (iface->flags & QNetworkInterface::CanBroadcast) {
- if (qt_safe_ioctl(socket, SIOCGIFBRDADDR, &req) >= 0) {
- sockaddr *sa = &req.ifr_addr;
- if (sa->sa_family == AF_INET)
- entry.setBroadcast(addressFromSockaddr(sa));
- }
- }
-
// Get the address of the interface
+ QNetworkAddressEntry entry;
if (qt_safe_ioctl(socket, SIOCGIFADDR, &req) >= 0) {
sockaddr *sa = &req.ifr_addr;
entry.setIp(addressFromSockaddr(sa));
- }
- // Get the interface netmask
- if (qt_safe_ioctl(socket, SIOCGIFNETMASK, &req) >= 0) {
- sockaddr *sa = &req.ifr_addr;
- entry.setNetmask(addressFromSockaddr(sa));
- }
+ // Get the interface broadcast address
+ if (iface->flags & QNetworkInterface::CanBroadcast) {
+ if (qt_safe_ioctl(socket, SIOCGIFBRDADDR, &req) >= 0) {
+ sockaddr *sa = &req.ifr_addr;
+ if (sa->sa_family == AF_INET)
+ entry.setBroadcast(addressFromSockaddr(sa));
+ }
+ }
- iface->addressEntries << entry;
+ // Get the interface netmask
+ if (qt_safe_ioctl(socket, SIOCGIFNETMASK, &req) >= 0) {
+ sockaddr *sa = &req.ifr_addr;
+ entry.setNetmask(addressFromSockaddr(sa));
+ }
+
+ iface->addressEntries << entry;
+ }
}
::close(socket);
@@ -395,7 +395,7 @@ static QList<QNetworkInterfacePrivate *> createInterfaces(ifaddrs *rawList)
// - virtual interfaces with no HW address have no AF_PACKET
// - interface labels have no AF_PACKET, but shouldn't be shown as a new interface
for (ifaddrs *ptr = rawList; ptr; ptr = ptr->ifa_next) {
- if (ptr->ifa_addr && ptr->ifa_addr->sa_family != AF_PACKET) {
+ if (!ptr->ifa_addr || ptr->ifa_addr->sa_family != AF_PACKET) {
QString name = QString::fromLatin1(ptr->ifa_name);
if (seenInterfaces.contains(name))
continue;
diff --git a/src/network/socket/qnativesocketengine_winrt.cpp b/src/network/socket/qnativesocketengine_winrt.cpp
index 2a0995d4e7..68ee1e52d5 100644
--- a/src/network/socket/qnativesocketengine_winrt.cpp
+++ b/src/network/socket/qnativesocketengine_winrt.cpp
@@ -584,7 +584,7 @@ qint64 QNativeSocketEngine::readDatagram(char *data, qint64 maxlen, QIpPacketHea
} else {
readOrigin = datagram.data;
}
- strcpy(data, readOrigin);
+ memcpy(data, readOrigin, qMin(maxlen, qint64(datagram.data.length())));
return readOrigin.length();
}
diff --git a/src/platformsupport/dbustray/qstatusnotifieritemadaptor_p.h b/src/platformsupport/dbustray/qstatusnotifieritemadaptor_p.h
index a2e468da94..deab9e74b5 100644
--- a/src/platformsupport/dbustray/qstatusnotifieritemadaptor_p.h
+++ b/src/platformsupport/dbustray/qstatusnotifieritemadaptor_p.h
@@ -92,19 +92,19 @@ class QStatusNotifierItemAdaptor: public QDBusAbstractAdaptor
" <property access=\"read\" type=\"o\" name=\"Menu\"/>\n"
" <property access=\"read\" type=\"b\" name=\"ItemIsMenu\"/>\n"
" <property access=\"read\" type=\"s\" name=\"IconName\"/>\n"
-" <property access=\"read\" type=\"(iiay)\" name=\"IconPixmap\">\n"
+" <property access=\"read\" type=\"a(iiay)\" name=\"IconPixmap\">\n"
" <annotation value=\"QXdgDBusImageVector\" name=\"org.qtproject.QtDBus.QtTypeName\"/>\n"
" </property>\n"
" <property access=\"read\" type=\"s\" name=\"OverlayIconName\"/>\n"
-" <property access=\"read\" type=\"(iiay)\" name=\"OverlayIconPixmap\">\n"
+" <property access=\"read\" type=\"a(iiay)\" name=\"OverlayIconPixmap\">\n"
" <annotation value=\"QXdgDBusImageVector\" name=\"org.qtproject.QtDBus.QtTypeName\"/>\n"
" </property>\n"
" <property access=\"read\" type=\"s\" name=\"AttentionIconName\"/>\n"
-" <property access=\"read\" type=\"(iiay)\" name=\"AttentionIconPixmap\">\n"
+" <property access=\"read\" type=\"a(iiay)\" name=\"AttentionIconPixmap\">\n"
" <annotation value=\"QXdgDBusImageVector\" name=\"org.qtproject.QtDBus.QtTypeName\"/>\n"
" </property>\n"
" <property access=\"read\" type=\"s\" name=\"AttentionMovieName\"/>\n"
-" <property access=\"read\" type=\"(s(iiay)ss)\" name=\"ToolTip\">\n"
+" <property access=\"read\" type=\"(sa(iiay)ss)\" name=\"ToolTip\">\n"
" <annotation value=\"QXdgDBusToolTipStruct\" name=\"org.qtproject.QtDBus.QtTypeName\"/>\n"
" </property>\n"
" <method name=\"ContextMenu\">\n"
diff --git a/src/platformsupport/eglconvenience/qeglplatformcontext.cpp b/src/platformsupport/eglconvenience/qeglplatformcontext.cpp
index d63f81a1d8..9e7298b89a 100644
--- a/src/platformsupport/eglconvenience/qeglplatformcontext.cpp
+++ b/src/platformsupport/eglconvenience/qeglplatformcontext.cpp
@@ -281,6 +281,12 @@ void QEGLPlatformContext::destroyTemporaryOffscreenSurface(EGLSurface surface)
eglDestroySurface(m_eglDisplay, surface);
}
+void QEGLPlatformContext::runGLChecks()
+{
+ // Nothing to do here, subclasses may override in order to perform OpenGL
+ // queries needing a context.
+}
+
void QEGLPlatformContext::updateFormatFromGL()
{
#ifndef QT_NO_OPENGL
@@ -352,6 +358,7 @@ void QEGLPlatformContext::updateFormatFromGL()
}
}
}
+ runGLChecks();
eglMakeCurrent(prevDisplay, prevSurfaceDraw, prevSurfaceRead, prevContext);
} else {
qWarning("QEGLPlatformContext: Failed to make temporary surface current, format not updated (%x)", eglGetError());
diff --git a/src/platformsupport/eglconvenience/qeglplatformcontext_p.h b/src/platformsupport/eglconvenience/qeglplatformcontext_p.h
index be7f5e9f3e..2679c3b9f8 100644
--- a/src/platformsupport/eglconvenience/qeglplatformcontext_p.h
+++ b/src/platformsupport/eglconvenience/qeglplatformcontext_p.h
@@ -90,6 +90,7 @@ protected:
virtual EGLSurface eglSurfaceForPlatformSurface(QPlatformSurface *surface) = 0;
virtual EGLSurface createTemporaryOffscreenSurface();
virtual void destroyTemporaryOffscreenSurface(EGLSurface surface);
+ virtual void runGLChecks();
private:
void init(const QSurfaceFormat &format, QPlatformOpenGLContext *share);
diff --git a/src/platformsupport/fbconvenience/qfbbackingstore_p.h b/src/platformsupport/fbconvenience/qfbbackingstore_p.h
index 0b8eb0d74e..fc06b95475 100644
--- a/src/platformsupport/fbconvenience/qfbbackingstore_p.h
+++ b/src/platformsupport/fbconvenience/qfbbackingstore_p.h
@@ -66,10 +66,10 @@ public:
QFbBackingStore(QWindow *window);
~QFbBackingStore();
- virtual QPaintDevice *paintDevice() Q_DECL_OVERRIDE { return &mImage; }
- virtual void flush(QWindow *window, const QRegion &region, const QPoint &offset) Q_DECL_OVERRIDE;
+ QPaintDevice *paintDevice() Q_DECL_OVERRIDE { return &mImage; }
+ void flush(QWindow *window, const QRegion &region, const QPoint &offset) Q_DECL_OVERRIDE;
- virtual void resize(const QSize &size, const QRegion &region) Q_DECL_OVERRIDE;
+ void resize(const QSize &size, const QRegion &region) Q_DECL_OVERRIDE;
const QImage image();
diff --git a/src/platformsupport/linuxaccessibility/bridge_p.h b/src/platformsupport/linuxaccessibility/bridge_p.h
index f95bcab897..44dfa82f5d 100644
--- a/src/platformsupport/linuxaccessibility/bridge_p.h
+++ b/src/platformsupport/linuxaccessibility/bridge_p.h
@@ -72,7 +72,7 @@ public:
virtual ~QSpiAccessibleBridge();
- virtual void notifyAccessibilityUpdate(QAccessibleEvent *event) Q_DECL_OVERRIDE;
+ void notifyAccessibilityUpdate(QAccessibleEvent *event) Q_DECL_OVERRIDE;
QDBusConnection dBusConnection() const;
public Q_SLOTS:
diff --git a/src/platformsupport/services/genericunix/qgenericunixservices_p.h b/src/platformsupport/services/genericunix/qgenericunixservices_p.h
index 0d87b7367e..205b2e6160 100644
--- a/src/platformsupport/services/genericunix/qgenericunixservices_p.h
+++ b/src/platformsupport/services/genericunix/qgenericunixservices_p.h
@@ -63,8 +63,8 @@ public:
QByteArray desktopEnvironment() const Q_DECL_OVERRIDE;
- virtual bool openUrl(const QUrl &url) Q_DECL_OVERRIDE;
- virtual bool openDocument(const QUrl &url) Q_DECL_OVERRIDE;
+ bool openUrl(const QUrl &url) Q_DECL_OVERRIDE;
+ bool openDocument(const QUrl &url) Q_DECL_OVERRIDE;
private:
QString m_webBrowser;
diff --git a/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp b/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp
index 0f03ab0e52..026ba11c3d 100644
--- a/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp
+++ b/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp
@@ -583,23 +583,23 @@ const char *QGnomeTheme::name = "gnome";
class QGnomeThemePrivate : public QPlatformThemePrivate
{
public:
- QGnomeThemePrivate() : fontsConfigured(false) { }
+ QGnomeThemePrivate() : systemFont(Q_NULLPTR), fixedFont(Q_NULLPTR) {}
+ ~QGnomeThemePrivate() { delete systemFont; delete fixedFont; }
+
void configureFonts(const QString &gtkFontName) const
{
- Q_ASSERT(!fontsConfigured);
+ Q_ASSERT(!systemFont);
const int split = gtkFontName.lastIndexOf(QChar::Space);
float size = gtkFontName.mid(split+1).toFloat();
QString fontName = gtkFontName.left(split);
- systemFont = QFont(fontName, size);
- fixedFont = QFont(QLatin1String("monospace"), systemFont.pointSize());
- fixedFont.setStyleHint(QFont::TypeWriter);
- fontsConfigured = true;
+ systemFont = new QFont(fontName, size);
+ fixedFont = new QFont(QLatin1String("monospace"), systemFont->pointSize());
+ fixedFont->setStyleHint(QFont::TypeWriter);
}
- mutable QFont systemFont;
- mutable QFont fixedFont;
- mutable bool fontsConfigured;
+ mutable QFont *systemFont;
+ mutable QFont *fixedFont;
};
QGnomeTheme::QGnomeTheme()
@@ -638,13 +638,13 @@ QVariant QGnomeTheme::themeHint(QPlatformTheme::ThemeHint hint) const
const QFont *QGnomeTheme::font(Font type) const
{
Q_D(const QGnomeTheme);
- if (!d->fontsConfigured)
+ if (!d->systemFont)
d->configureFonts(gtkFontName());
switch (type) {
case QPlatformTheme::SystemFont:
- return &d->systemFont;
+ return d->systemFont;
case QPlatformTheme::FixedFont:
- return &d->fixedFont;
+ return d->fixedFont;
default:
return 0;
}
diff --git a/src/platformsupport/themes/genericunix/qgenericunixthemes_p.h b/src/platformsupport/themes/genericunix/qgenericunixthemes_p.h
index 4b8eb13b42..2d46a4d95e 100644
--- a/src/platformsupport/themes/genericunix/qgenericunixthemes_p.h
+++ b/src/platformsupport/themes/genericunix/qgenericunixthemes_p.h
@@ -81,8 +81,8 @@ public:
static QPlatformTheme *createUnixTheme(const QString &name);
static QStringList themeNames();
- virtual const QFont *font(Font type) const Q_DECL_OVERRIDE;
- virtual QVariant themeHint(ThemeHint hint) const Q_DECL_OVERRIDE;
+ const QFont *font(Font type) const Q_DECL_OVERRIDE;
+ QVariant themeHint(ThemeHint hint) const Q_DECL_OVERRIDE;
static QStringList xdgIconThemePaths();
#if !defined(QT_NO_DBUS) && !defined(QT_NO_SYSTEMTRAYICON)
@@ -102,11 +102,11 @@ public:
QKdeTheme(const QStringList& kdeDirs, int kdeVersion);
static QPlatformTheme *createKdeTheme();
- virtual QVariant themeHint(ThemeHint hint) const Q_DECL_OVERRIDE;
+ QVariant themeHint(ThemeHint hint) const Q_DECL_OVERRIDE;
- virtual const QPalette *palette(Palette type = SystemPalette) const Q_DECL_OVERRIDE;
+ const QPalette *palette(Palette type = SystemPalette) const Q_DECL_OVERRIDE;
- virtual const QFont *font(Font type) const Q_DECL_OVERRIDE;
+ const QFont *font(Font type) const Q_DECL_OVERRIDE;
#if !defined(QT_NO_DBUS) && !defined(QT_NO_SYSTEMTRAYICON)
QPlatformSystemTrayIcon *createPlatformSystemTrayIcon() const Q_DECL_OVERRIDE;
#endif
@@ -122,8 +122,8 @@ class QGnomeTheme : public QPlatformTheme
Q_DECLARE_PRIVATE(QGnomeTheme)
public:
QGnomeTheme();
- virtual QVariant themeHint(ThemeHint hint) const Q_DECL_OVERRIDE;
- virtual const QFont *font(Font type) const Q_DECL_OVERRIDE;
+ QVariant themeHint(ThemeHint hint) const Q_DECL_OVERRIDE;
+ const QFont *font(Font type) const Q_DECL_OVERRIDE;
QString standardButtonText(int button) const Q_DECL_OVERRIDE;
virtual QString gtkFontName() const;
diff --git a/src/plugins/platforms/android/qandroidplatformtheme.cpp b/src/plugins/platforms/android/qandroidplatformtheme.cpp
index a906d0b9fd..7bed4a739a 100644
--- a/src/plugins/platforms/android/qandroidplatformtheme.cpp
+++ b/src/plugins/platforms/android/qandroidplatformtheme.cpp
@@ -201,7 +201,7 @@ QJsonObject AndroidStyle::loadStyleData()
}
Q_ASSERT(!stylePath.isEmpty());
- if (!androidTheme.isEmpty() && QFileInfo(stylePath + androidTheme + QLatin1String("style.json")).exists())
+ if (!androidTheme.isEmpty() && QFileInfo::exists(stylePath + androidTheme + QLatin1String("style.json")))
stylePath += androidTheme;
QFile f(stylePath + QLatin1String("style.json"));
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm
index 3d6732b648..eb65f7e061 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.mm
+++ b/src/plugins/platforms/cocoa/qcocoawindow.mm
@@ -1792,6 +1792,18 @@ void QCocoaWindow::exposeWindow()
if (!isWindowExposable())
return;
+ // Update the QWindow's screen property. This property is set
+ // to QGuiApplication::primaryScreen() at QWindow construciton
+ // time, and we won't get a NSWindowDidChangeScreenNotification
+ // on show. The case where the window is initially displayed
+ // on a non-primary screen needs special handling here.
+ NSUInteger screenIndex = [[NSScreen screens] indexOfObject:m_nsWindow.screen];
+ if (screenIndex != NSNotFound) {
+ QCocoaScreen *cocoaScreen = QCocoaIntegration::instance()->screenAtIndex(screenIndex);
+ if (cocoaScreen)
+ window()->setScreen(cocoaScreen->screen());
+ }
+
if (!m_isExposed) {
m_isExposed = true;
m_exposedGeometry = geometry();
diff --git a/src/plugins/platforms/eglfs/qeglfscontext.cpp b/src/plugins/platforms/eglfs/qeglfscontext.cpp
index 1bb4918948..229ac6bbd9 100644
--- a/src/plugins/platforms/eglfs/qeglfscontext.cpp
+++ b/src/plugins/platforms/eglfs/qeglfscontext.cpp
@@ -91,6 +91,16 @@ void QEglFSContext::destroyTemporaryOffscreenSurface(EGLSurface surface)
}
}
+void QEglFSContext::runGLChecks()
+{
+ // Note that even though there is an EGL context current here,
+ // QOpenGLContext and QOpenGLFunctions are not yet usable at this stage.
+ const char *renderer = reinterpret_cast<const char *>(glGetString(GL_RENDERER));
+ // Be nice and warn about a common source of confusion.
+ if (renderer && strstr(renderer, "llvmpipe"))
+ qWarning("Running on a software rasterizer (LLVMpipe), expect limited performance.");
+}
+
void QEglFSContext::swapBuffers(QPlatformSurface *surface)
{
// draw the cursor
diff --git a/src/plugins/platforms/eglfs/qeglfscontext.h b/src/plugins/platforms/eglfs/qeglfscontext.h
index ffe105cdac..b861ae5329 100644
--- a/src/plugins/platforms/eglfs/qeglfscontext.h
+++ b/src/plugins/platforms/eglfs/qeglfscontext.h
@@ -54,6 +54,7 @@ public:
EGLSurface eglSurfaceForPlatformSurface(QPlatformSurface *surface) Q_DECL_OVERRIDE;
EGLSurface createTemporaryOffscreenSurface() Q_DECL_OVERRIDE;
void destroyTemporaryOffscreenSurface(EGLSurface surface) Q_DECL_OVERRIDE;
+ void runGLChecks() Q_DECL_OVERRIDE;
void swapBuffers(QPlatformSurface *surface) Q_DECL_OVERRIDE;
private:
diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp
index d71b64428d..1a634a0f75 100644
--- a/src/testlib/qtestcase.cpp
+++ b/src/testlib/qtestcase.cpp
@@ -1969,7 +1969,7 @@ QString QTest::qFindTestData(const QString& base, const char *file, int line, co
QString testsPath = QLibraryInfo::location(QLibraryInfo::TestsPath);
QString candidate = QString::fromLatin1("%1/%2/%3")
.arg(testsPath, QFile::decodeName(testObjectName).toLower(), base);
- if (QFileInfo(candidate).exists()) {
+ if (QFileInfo::exists(candidate)) {
found = candidate;
}
else if (QTestLog::verboseLevel() >= 2) {
@@ -1994,7 +1994,7 @@ QString QTest::qFindTestData(const QString& base, const char *file, int line, co
}
QString candidate = QString::fromLatin1("%1/%2").arg(srcdir.canonicalFilePath(), base);
- if (QFileInfo(candidate).exists()) {
+ if (QFileInfo::exists(candidate)) {
found = candidate;
}
else if (QTestLog::verboseLevel() >= 2) {
@@ -2008,21 +2008,21 @@ QString QTest::qFindTestData(const QString& base, const char *file, int line, co
// 4. Try resources
if (found.isEmpty()) {
QString candidate = QString::fromLatin1(":/%1").arg(base);
- if (QFileInfo(candidate).exists())
+ if (QFileInfo::exists(candidate))
found = candidate;
}
// 5. Try current directory
if (found.isEmpty()) {
QString candidate = QString::fromLatin1("%1/%2").arg(QDir::currentPath()).arg(base);
- if (QFileInfo(candidate).exists())
+ if (QFileInfo::exists(candidate))
found = candidate;
}
// 6. Try main source directory
if (found.isEmpty()) {
QString candidate = QTest::mainSourcePath % QLatin1Char('/') % base;
- if (QFileInfo(candidate).exists())
+ if (QFileInfo::exists(candidate))
found = candidate;
}
diff --git a/src/tools/moc/generator.cpp b/src/tools/moc/generator.cpp
index a7a7195fd4..587aa5971d 100644
--- a/src/tools/moc/generator.cpp
+++ b/src/tools/moc/generator.cpp
@@ -1255,6 +1255,7 @@ void Generator::generateStaticMetacall()
fprintf(out, " if (*reinterpret_cast<_t *>(func) == static_cast<_t>(&%s::%s)) {\n",
cdef->classname.constData(), f.name.constData());
fprintf(out, " *result = %d;\n", methodindex);
+ fprintf(out, " return;\n");
fprintf(out, " }\n }\n");
}
if (!anythingUsed)
diff --git a/src/widgets/itemviews/qdirmodel.cpp b/src/widgets/itemviews/qdirmodel.cpp
index 2d1d362cec..37ba5a59f8 100644
--- a/src/widgets/itemviews/qdirmodel.cpp
+++ b/src/widgets/itemviews/qdirmodel.cpp
@@ -871,7 +871,7 @@ QModelIndex QDirModel::index(const QString &path, int column) const
#endif
QStringList pathElements = absolutePath.split(QLatin1Char('/'), QString::SkipEmptyParts);
- if ((pathElements.isEmpty() || !QFileInfo(path).exists())
+ if ((pathElements.isEmpty() || !QFileInfo::exists(path))
#if !defined(Q_OS_WIN) || defined(Q_OS_WINCE)
&& path != QLatin1String("/")
#endif
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index 7aabb701a9..c431e0bcd6 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -485,22 +485,24 @@ void QApplicationPrivate::process_cmdline()
j = 1;
for (i=1; i<argc; i++) { // if you add anything here, modify QCoreApplication::arguments()
- if (argv[i] && *argv[i] != '-') {
+ if (!argv[i])
+ continue;
+ if (*argv[i] != '-') {
argv[j++] = argv[i];
continue;
}
- QByteArray arg = argv[i];
- if (arg.startsWith("--"))
- arg.remove(0, 1);
- if (arg == "-qdevel" || arg == "-qdebug") {
+ const char *arg = argv[i];
+ if (arg[1] == '-') // startsWith("--")
+ ++arg;
+ if (strcmp(arg, "-qdevel") == 0 || strcmp(arg, "-qdebug") == 0) {
// obsolete argument
#ifndef QT_NO_STYLE_STYLESHEET
- } else if (arg == "-stylesheet" && i < argc -1) {
+ } else if (strcmp(arg, "-stylesheet") == 0 && i < argc -1) {
styleSheet = QLatin1String("file:///");
styleSheet.append(QString::fromLocal8Bit(argv[++i]));
- } else if (arg.indexOf("-stylesheet=") != -1) {
+ } else if (strncmp(arg, "-stylesheet=", 12) == 0) {
styleSheet = QLatin1String("file:///");
- styleSheet.append(QString::fromLocal8Bit(arg.right(arg.length() - 12)));
+ styleSheet.append(QString::fromLocal8Bit(arg + 12));
#endif
} else if (qstrcmp(arg, "-widgetcount") == 0) {
widgetCount = true;
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index 16dee8ea06..d123bba1d9 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -9174,6 +9174,9 @@ bool QWidget::event(QEvent *event)
const QWindow *win = te->window;
d->setWinId((win && win->handle()) ? win->handle()->winId() : 0);
}
+#ifndef QT_NO_OPENGL
+ d->renderToTextureReallyDirty = 1;
+#endif
break;
#ifndef QT_NO_PROPERTIES
case QEvent::DynamicPropertyChange: {