summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/3rdparty/harfbuzz/src/harfbuzz-thai.c2
-rw-r--r--src/3rdparty/pcre/sljit/sljitUtils.c8
-rwxr-xr-xsrc/3rdparty/sha3/KeccakF-1600-opt32.c8
-rw-r--r--src/android/jar/bundledjar.pro3
-rw-r--r--src/android/jar/distributedjar.pro2
-rw-r--r--src/android/jar/jar.pri18
-rw-r--r--src/android/jar/jar.pro21
-rw-r--r--src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java6
-rw-r--r--src/android/java/AndroidManifest.xml6
-rw-r--r--src/android/java/READ-THIS-BEFORE-MANUALLY-ADDING-FILES-TO-PACKAGE.txt6
-rw-r--r--src/android/java/res/values/libs.xml2
-rw-r--r--src/android/java/src/org/qtproject/qt5/android/bindings/QtActivity.java116
-rw-r--r--src/concurrent/doc/src/qtconcurrent-module.qdoc2
-rw-r--r--src/corelib/corelib.pro2
-rw-r--r--src/corelib/doc/src/qtcore-index.qdoc2
-rw-r--r--src/corelib/global/qcompilerdetection.h2
-rw-r--r--src/corelib/thread/qmutex.cpp2
-rw-r--r--src/corelib/tools/qlocale.cpp87
-rw-r--r--src/corelib/tools/qlocale_blackberry.cpp4
-rw-r--r--src/corelib/tools/qlocale_mac.mm4
-rw-r--r--src/corelib/tools/qlocale_p.h32
-rw-r--r--src/corelib/tools/qlocale_unix.cpp4
-rw-r--r--src/corelib/tools/qlocale_win.cpp2
-rw-r--r--src/gui/accessible/qaccessible.h2
-rw-r--r--src/gui/accessible/qaccessibleobject.cpp4
-rw-r--r--src/gui/doc/images/icon.pngbin0 -> 40790 bytes
-rw-r--r--src/gui/gui.pro4
-rw-r--r--src/gui/kernel/qevent.cpp13
-rw-r--r--src/network/doc/src/network-programming.qdoc2
-rw-r--r--src/network/network.pro3
-rw-r--r--src/opengl/doc/src/qtopengl-index.qdoc2
-rw-r--r--src/opengl/doc/src/qtopengl-module.qdoc2
-rw-r--r--src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp4
-rw-r--r--src/plugins/platforms/android/src/qandroidinputcontext.cpp28
-rw-r--r--src/plugins/platforms/android/src/qandroidplatformservices.cpp20
-rw-r--r--src/plugins/platforms/cocoa/qcocoatheme.mm29
-rw-r--r--src/plugins/platforms/eglfs/qeglfswindow.cpp1
-rw-r--r--src/plugins/platforms/ios/qiosbackingstore.mm1
-rw-r--r--src/plugins/platforms/ios/qioscontext.mm23
-rw-r--r--src/plugins/platforms/ios/qiosglobal.mm3
-rw-r--r--src/plugins/platforms/ios/qiosscreen.mm15
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.cpp2
-rw-r--r--src/plugins/platformthemes/gtk2/qgtk2dialoghelpers.cpp2
-rw-r--r--src/sql/doc/qtsql.qdocconf2
-rw-r--r--src/sql/doc/src/qtsql.qdoc4
-rw-r--r--src/sql/sql.pro3
-rw-r--r--src/testlib/3rdparty/valgrind_p.h6
-rw-r--r--src/tools/qdoc/config.cpp322
-rw-r--r--src/tools/qdoc/config.h41
-rw-r--r--src/tools/qdoc/ditaxmlgenerator.cpp13
-rw-r--r--src/tools/qdoc/ditaxmlgenerator.h4
-rw-r--r--src/tools/qdoc/location.cpp14
-rw-r--r--src/tools/qdoc/location.h2
-rw-r--r--src/tools/qdoc/main.cpp2
-rw-r--r--src/widgets/styles/qmacstyle_mac.mm90
-rw-r--r--src/widgets/widgets.pro3
-rw-r--r--src/widgets/widgets/qplaintextedit.cpp46
-rw-r--r--src/widgets/widgets/qplaintextedit.h3
-rw-r--r--src/widgets/widgets/qtextedit.cpp2
59 files changed, 677 insertions, 381 deletions
diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-thai.c b/src/3rdparty/harfbuzz/src/harfbuzz-thai.c
index d8f7d44887..e351dbfd49 100644
--- a/src/3rdparty/harfbuzz/src/harfbuzz-thai.c
+++ b/src/3rdparty/harfbuzz/src/harfbuzz-thai.c
@@ -261,7 +261,7 @@ static HB_Bool HB_ThaiConvertStringToGlyphIndices (HB_ShaperItem *item)
for (int lgi = 0; lgi < lgn; lgi++) {
if ( rglyphs[lgi] == 0xdd/*TH_BLANK_BASE_GLYPH*/ ) {
glyphString[slen++] = C_DOTTED_CIRCLE;
- } else if (cstr[i] == (signed char)~0) {
+ } else if ((unsigned char)cstr[i] == (unsigned char)~0) {
// The only glyphs that should be passed to this function that cannot be mapped to
// tis620 are the ones of type Inherited class. Pass these glyphs untouched.
glyphString[slen++] = string[i];
diff --git a/src/3rdparty/pcre/sljit/sljitUtils.c b/src/3rdparty/pcre/sljit/sljitUtils.c
index 1f023fa644..b29b4036b3 100644
--- a/src/3rdparty/pcre/sljit/sljitUtils.c
+++ b/src/3rdparty/pcre/sljit/sljitUtils.c
@@ -315,12 +315,12 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_sw SLJIT_CALL sljit_stack_resize(struct sljit_sta
aligned_new_limit = (new_limit + sljit_page_align) & ~sljit_page_align;
aligned_old_limit = (stack->limit + sljit_page_align) & ~sljit_page_align;
/* If madvise is available, we release the unnecessary space. */
-#if defined(POSIX_MADV_DONTNEED)
- if (aligned_new_limit < aligned_old_limit)
- posix_madvise((void*)aligned_new_limit, aligned_old_limit - aligned_new_limit, POSIX_MADV_DONTNEED);
-#elif defined(MADV_DONTNEED)
+#if defined(MADV_DONTNEED)
if (aligned_new_limit < aligned_old_limit)
madvise((void*)aligned_new_limit, aligned_old_limit - aligned_new_limit, MADV_DONTNEED);
+#elif defined(POSIX_MADV_DONTNEED)
+ if (aligned_new_limit < aligned_old_limit)
+ posix_madvise((void*)aligned_new_limit, aligned_old_limit - aligned_new_limit, POSIX_MADV_DONTNEED);
#endif
stack->limit = new_limit;
return 0;
diff --git a/src/3rdparty/sha3/KeccakF-1600-opt32.c b/src/3rdparty/sha3/KeccakF-1600-opt32.c
index b1b442c7e0..4e32dca9cb 100755
--- a/src/3rdparty/sha3/KeccakF-1600-opt32.c
+++ b/src/3rdparty/sha3/KeccakF-1600-opt32.c
@@ -114,8 +114,8 @@ static void setInterleavedWordsInto8bytes(UINT8* dest, UINT32 even, UINT32 odd)
const UINT32 * pI = (const UINT32 *)input; \
UINT32 * pS = state; \
UINT32 t, x0, x1; \
- int i; \
- for (i = (rateInLanes)-1; i >= 0; --i) \
+ int i; \
+ for (i = (int)(rateInLanes)-1; i >= 0; --i) \
{ \
x0 = *(pI++); \
t = (x0 ^ (x0 >> 1)) & 0x22222222UL; x0 = x0 ^ t ^ (t << 1); \
@@ -170,7 +170,7 @@ static void xor8bytesIntoInterleavedWords(UINT32* evenAndOdd, const UINT8* sourc
#define xorLanesIntoState(laneCount, state, input) \
{ \
- int i; \
+ unsigned i; \
for(i=0; i<(laneCount); i++) \
xor8bytesIntoInterleavedWords(state+i*2, input+i*8); \
}
@@ -212,7 +212,7 @@ static void setInterleavedWordsInto8bytes(UINT8* dest, UINT32* evenAndOdd)
#define extractLanes(laneCount, state, data) \
{ \
- int i; \
+ unsigned i; \
for(i=0; i<(laneCount); i++) \
setInterleavedWordsInto8bytes(data+i*8, (UINT32*)state+i*2); \
}
diff --git a/src/android/jar/bundledjar.pro b/src/android/jar/bundledjar.pro
new file mode 100644
index 0000000000..e82c01c51b
--- /dev/null
+++ b/src/android/jar/bundledjar.pro
@@ -0,0 +1,3 @@
+TARGET = QtAndroid-bundled
+CONFIG += bundled_jar_file
+include(jar.pri)
diff --git a/src/android/jar/distributedjar.pro b/src/android/jar/distributedjar.pro
new file mode 100644
index 0000000000..15f362f629
--- /dev/null
+++ b/src/android/jar/distributedjar.pro
@@ -0,0 +1,2 @@
+TARGET = QtAndroid
+include(jar.pri)
diff --git a/src/android/jar/jar.pri b/src/android/jar/jar.pri
new file mode 100644
index 0000000000..19501d7b29
--- /dev/null
+++ b/src/android/jar/jar.pri
@@ -0,0 +1,18 @@
+CONFIG += java
+DESTDIR = $$[QT_INSTALL_PREFIX/get]/jar
+
+PATHPREFIX = $$PWD/src/org/qtproject/qt5/android/
+
+JAVACLASSPATH += $$PWD/src/
+JAVASOURCES += \
+ $$PATHPREFIX/QtActivityDelegate.java \
+ $$PATHPREFIX/QtEditText.java \
+ $$PATHPREFIX/QtInputConnection.java \
+ $$PATHPREFIX/QtLayout.java \
+ $$PATHPREFIX/QtNative.java \
+ $$PATHPREFIX/QtNativeLibrariesDir.java \
+ $$PATHPREFIX/QtSurface.java
+
+# install
+target.path = $$[QT_INSTALL_PREFIX]/jar
+INSTALLS += target
diff --git a/src/android/jar/jar.pro b/src/android/jar/jar.pro
index 1955f16142..8d19c1b7d6 100644
--- a/src/android/jar/jar.pro
+++ b/src/android/jar/jar.pro
@@ -1,19 +1,2 @@
-CONFIG += java
-TARGET = QtAndroid
-DESTDIR = $$[QT_INSTALL_PREFIX/get]/jar
-
-PATHPREFIX = $$PWD/src/org/qtproject/qt5/android/
-
-JAVACLASSPATH += $$PWD/src/
-JAVASOURCES += \
- $$PATHPREFIX/QtActivityDelegate.java \
- $$PATHPREFIX/QtEditText.java \
- $$PATHPREFIX/QtInputConnection.java \
- $$PATHPREFIX/QtLayout.java \
- $$PATHPREFIX/QtNative.java \
- $$PATHPREFIX/QtNativeLibrariesDir.java \
- $$PATHPREFIX/QtSurface.java
-
-# install
-target.path = $$[QT_INSTALL_PREFIX]/jar
-INSTALLS += target
+TEMPLATE = subdirs
+SUBDIRS += bundledjar.pro distributedjar.pro
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 be618934df..06ece9d04c 100644
--- a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java
+++ b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java
@@ -704,10 +704,8 @@ public class QtActivityDelegate
}
}
- if (keyCode == KeyEvent.KEYCODE_BACK && m_keyboardIsVisible)
- {
- if (!m_keyboardIsHiding)
- hideSoftwareKeyboard();
+ if (keyCode == KeyEvent.KEYCODE_BACK && m_keyboardIsVisible && !m_keyboardIsHiding) {
+ hideSoftwareKeyboard();
return true;
}
diff --git a/src/android/java/AndroidManifest.xml b/src/android/java/AndroidManifest.xml
index 6a407dcb6e..48fb23ab28 100644
--- a/src/android/java/AndroidManifest.xml
+++ b/src/android/java/AndroidManifest.xml
@@ -11,8 +11,12 @@
<meta-data android:name="android.app.qt_libs_resource_id" android:resource="@array/qt_libs"/>
<meta-data android:name="android.app.bundled_libs_resource_id" android:resource="@array/bundled_libs"/>
<meta-data android:name="android.app.lib_name" android:value=""/>
+ <!-- Deploy Qt libs as part of package -->
+ <meta-data android:name="android.app.bundle_local_qt_libs" android:value="1"/>
+ <meta-data android:name="android.app.bundled_in_lib_resource_id" android:resource="@array/bundled_in_lib"/>
+ <meta-data android:name="android.app.bundled_in_assets_resource_id" android:resource="@array/bundled_in_assets"/>
<!-- Run with local libs -->
- <meta-data android:name="android.app.use_local_qt_libs" android:value="0"/>
+ <meta-data android:name="android.app.use_local_qt_libs" android:value="1"/>
<meta-data android:name="android.app.libs_prefix" android:value="/data/local/tmp/qt/"/>
<meta-data android:name="android.app.load_local_libs" android:value=""/>
<meta-data android:name="android.app.load_local_jars" android:value=""/>
diff --git a/src/android/java/READ-THIS-BEFORE-MANUALLY-ADDING-FILES-TO-PACKAGE.txt b/src/android/java/READ-THIS-BEFORE-MANUALLY-ADDING-FILES-TO-PACKAGE.txt
new file mode 100644
index 0000000000..978417721f
--- /dev/null
+++ b/src/android/java/READ-THIS-BEFORE-MANUALLY-ADDING-FILES-TO-PACKAGE.txt
@@ -0,0 +1,6 @@
+If this package is accessed by Qt Creator, certain changes can be
+overwritten without warning. In particular, Qt Creator may overwrite
+settings which are maintained using its own UI, and files and
+directories containing the string "--Managed_by_Qt_Creator--", as well
+as native libraries whose file names begin with "libQt5" may be
+deleted without warning if they are contained inside this package.
diff --git a/src/android/java/res/values/libs.xml b/src/android/java/res/values/libs.xml
index f47174e3d3..09fa409458 100644
--- a/src/android/java/res/values/libs.xml
+++ b/src/android/java/res/values/libs.xml
@@ -8,4 +8,6 @@
<item>Qt5Core</item>
</array>
<array name="bundled_libs"/>
+ <array name="bundled_in_lib" />
+ <array name="bundled_in_assets" />
</resources>
diff --git a/src/android/java/src/org/qtproject/qt5/android/bindings/QtActivity.java b/src/android/java/src/org/qtproject/qt5/android/bindings/QtActivity.java
index dfb638fbb0..22b34fdbef 100644
--- a/src/android/java/src/org/qtproject/qt5/android/bindings/QtActivity.java
+++ b/src/android/java/src/org/qtproject/qt5/android/bindings/QtActivity.java
@@ -27,6 +27,11 @@
package org.qtproject.qt5.android.bindings;
import java.io.File;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.InputStream;
+import java.io.FileOutputStream;
+import java.io.FileInputStream;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
@@ -47,6 +52,7 @@ import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.res.Configuration;
import android.content.res.Resources.Theme;
+import android.content.res.AssetManager;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.net.Uri;
@@ -89,6 +95,8 @@ public class QtActivity extends Activity
private static final String ENVIRONMENT_VARIABLES_KEY = "environment.variables";
private static final String APPLICATION_PARAMETERS_KEY = "application.parameters";
private static final String BUNDLED_LIBRARIES_KEY = "bundled.libraries";
+ private static final String BUNDLED_IN_LIB_RESOURCE_ID_KEY = "android.app.bundled_in_lib_resource_id";
+ private static final String BUNDLED_IN_ASSETS_RESOURCE_ID_KEY = "android.app.bundled_in_assets_resource_id";
private static final String MAIN_LIBRARY_KEY = "main.library";
private static final String STATIC_INIT_CLASSES_KEY = "static.init.classes";
private static final String NECESSITAS_API_LEVEL_KEY = "necessitas.api.level";
@@ -120,6 +128,8 @@ public class QtActivity extends Activity
// note that the android style plugin in Qt 5.1 is not fully functional.
private static final int INCOMPATIBLE_MINISTRO_VERSION = 1; // Incompatible Ministro version. Ministro needs to be upgraded.
+ private static final int BUFFER_SIZE = 1024;
+
private ActivityInfo m_activityInfo = null; // activity info object, used to access the libs and the strings
private DexClassLoader m_classLoader = null; // loader object
private String[] m_sources = {"https://files.kde.org/necessitas/ministro/android/necessitas/qt5/latest"}; // Make sure you are using ONLY secure locations
@@ -308,6 +318,92 @@ public class QtActivity extends Activity
errorDialog.show();
}
+ static private void copyFile(InputStream inputStream, OutputStream outputStream)
+ throws IOException
+ {
+ byte[] buffer = new byte[BUFFER_SIZE];
+
+ int count;
+ while ((count = inputStream.read(buffer)) > 0)
+ outputStream.write(buffer, 0, count);
+ }
+
+
+ private void copyAsset(String source, String destination)
+ throws IOException
+ {
+ // Already exists, we don't have to do anything
+ File destinationFile = new File(destination);
+ if (destinationFile.exists())
+ return;
+
+ File parentDirectory = destinationFile.getParentFile();
+ if (!parentDirectory.exists())
+ parentDirectory.mkdirs();
+
+ destinationFile.createNewFile();
+
+ AssetManager assetsManager = getAssets();
+ InputStream inputStream = assetsManager.open(source);
+ OutputStream outputStream = new FileOutputStream(destinationFile);
+ copyFile(inputStream, outputStream);
+ }
+
+ private static void createBundledBinary(String source, String destination)
+ throws IOException
+ {
+ // Already exists, we don't have to do anything
+ File destinationFile = new File(destination);
+ if (destinationFile.exists())
+ return;
+
+ File parentDirectory = destinationFile.getParentFile();
+ if (!parentDirectory.exists())
+ parentDirectory.mkdirs();
+
+ destinationFile.createNewFile();
+
+ InputStream inputStream = new FileInputStream(source);
+ OutputStream outputStream = new FileOutputStream(destinationFile);
+ copyFile(inputStream, outputStream);
+ }
+
+ private void extractBundledPluginsAndImports(String localPrefix)
+ throws IOException
+ {
+ ArrayList<String> libs = new ArrayList<String>();
+
+ {
+ String key = BUNDLED_IN_LIB_RESOURCE_ID_KEY;
+ java.util.Set<String> keys = m_activityInfo.metaData.keySet();
+ if (m_activityInfo.metaData.containsKey(key)) {
+ String[] list = getResources().getStringArray(m_activityInfo.metaData.getInt(key));
+
+ for (String bundledImportBinary : list) {
+ String[] split = bundledImportBinary.split(":");
+ String sourceFileName = localPrefix + "lib/" + split[0];
+ String destinationFileName = localPrefix + split[1];
+ createBundledBinary(sourceFileName, destinationFileName);
+ }
+ }
+ }
+
+ {
+ String key = BUNDLED_IN_ASSETS_RESOURCE_ID_KEY;
+ if (m_activityInfo.metaData.containsKey(key)) {
+ String[] list = getResources().getStringArray(m_activityInfo.metaData.getInt(key));
+
+ for (String fileName : list) {
+ String[] split = fileName.split(":");
+ String sourceFileName = split[0];
+ String destinationFileName = localPrefix + split[1];
+ copyAsset(sourceFileName, destinationFileName);
+ }
+ }
+
+ }
+ }
+
private void startApp(final boolean firstStart)
{
try {
@@ -328,13 +424,26 @@ public class QtActivity extends Activity
&& m_activityInfo.metaData.getInt("android.app.use_local_qt_libs") == 1) {
ArrayList<String> libraryList = new ArrayList<String>();
+
String localPrefix = "/data/local/tmp/qt/";
if (m_activityInfo.metaData.containsKey("android.app.libs_prefix"))
localPrefix = m_activityInfo.metaData.getString("android.app.libs_prefix");
+ boolean bundlingQtLibs = false;
+ if (m_activityInfo.metaData.containsKey("android.app.bundle_local_qt_libs")
+ && m_activityInfo.metaData.getInt("android.app.bundle_local_qt_libs") == 1) {
+ localPrefix = getApplicationInfo().dataDir + "/";
+ extractBundledPluginsAndImports(localPrefix);
+ bundlingQtLibs = true;
+ }
+
if (m_qtLibs != null) {
- for (int i=0;i<m_qtLibs.length;i++)
- libraryList.add(localPrefix+"lib/lib"+m_qtLibs[i]+".so");
+ for (int i=0;i<m_qtLibs.length;i++) {
+ libraryList.add(localPrefix
+ + "lib/lib"
+ + m_qtLibs[i]
+ + ".so");
+ }
}
if (m_activityInfo.metaData.containsKey("android.app.load_local_libs")) {
@@ -345,9 +454,10 @@ public class QtActivity extends Activity
}
}
+
String dexPaths = new String();
String pathSeparator = System.getProperty("path.separator", ":");
- if (m_activityInfo.metaData.containsKey("android.app.load_local_jars")) {
+ if (!bundlingQtLibs && m_activityInfo.metaData.containsKey("android.app.load_local_jars")) {
String[] jarFiles = m_activityInfo.metaData.getString("android.app.load_local_jars").split(":");
for (String jar:jarFiles) {
if (jar.length() > 0) {
diff --git a/src/concurrent/doc/src/qtconcurrent-module.qdoc b/src/concurrent/doc/src/qtconcurrent-module.qdoc
index 51721d916f..2144c2661a 100644
--- a/src/concurrent/doc/src/qtconcurrent-module.qdoc
+++ b/src/concurrent/doc/src/qtconcurrent-module.qdoc
@@ -27,7 +27,7 @@
/*!
\module QtConcurrent
- \title Qt Concurrent C++ classes
+ \title Qt Concurrent C++ Classes
\brief The Qt Concurrent module contains functionality to support concurrent execution of program code
\ingroup modules
diff --git a/src/corelib/corelib.pro b/src/corelib/corelib.pro
index 3b7eb11229..0a5cc04a17 100644
--- a/src/corelib/corelib.pro
+++ b/src/corelib/corelib.pro
@@ -21,6 +21,8 @@ ANDROID_JAR_DEPENDENCIES = \
ANDROID_LIB_DEPENDENCIES = \
plugins/platforms/android/libqtforandroid.so \
libs/libgnustl_shared.so
+ANDROID_BUNDLED_JAR_DEPENDENCIES = \
+ jar/QtAndroid-bundled.jar
load(qt_module)
diff --git a/src/corelib/doc/src/qtcore-index.qdoc b/src/corelib/doc/src/qtcore-index.qdoc
index 148dd68f55..9568ea9f8e 100644
--- a/src/corelib/doc/src/qtcore-index.qdoc
+++ b/src/corelib/doc/src/qtcore-index.qdoc
@@ -103,7 +103,7 @@
\section1 Reference
These are links to the API reference materials.
\list
- \li \l{Qt Core C++ Classes}{C++ classes}
+ \li \l{Qt Core C++ Classes}{C++ Classes}
\list
\li \l{Animation Framework}{Animation Classes}
\li \l{Threading Classes}
diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h
index ab84adacce..9b609f76d0 100644
--- a/src/corelib/global/qcompilerdetection.h
+++ b/src/corelib/global/qcompilerdetection.h
@@ -658,7 +658,7 @@
# define Q_COMPILER_ALIGNOF
# define Q_COMPILER_INHERITING_CONSTRUCTORS
# define Q_COMPILER_THREAD_LOCAL
-# if (__GNUC__ * 100 + __GNUC_MINOR__) > 408 || __GNUC_PATCHLEVEL__ > 1
+# if (__GNUC__ * 100 + __GNUC_MINOR__) > 408 || __GNUC_PATCHLEVEL__ >= 1
# define Q_COMPILER_REF_QUALIFIERS
# endif
# endif
diff --git a/src/corelib/thread/qmutex.cpp b/src/corelib/thread/qmutex.cpp
index 45e52d7b85..1ed4a77950 100644
--- a/src/corelib/thread/qmutex.cpp
+++ b/src/corelib/thread/qmutex.cpp
@@ -467,8 +467,6 @@ bool QBasicMutex::lockInternal(int timeout) QT_MUTEX_LOCK_NOEXCEPT
// we try to acquire the mutex by changing to dummyLocked()
if (d_ptr.testAndSetAcquire(d, dummyLocked())) {
// Mutex acquired
- Q_ASSERT(d->waiters.load() == -QMutexPrivate::BigNumber || d->waiters.load() == 0);
- d->waiters.store(0);
d->deref();
return true;
} else {
diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp
index b5f983899a..991cc9e170 100644
--- a/src/corelib/tools/qlocale.cpp
+++ b/src/corelib/tools/qlocale.cpp
@@ -529,6 +529,9 @@ int qt_repeatCount(const QString &s, int i)
static const QLocaleData *default_data = 0;
static uint default_number_options = 0;
+static const QLocaleData *const c_data = locale_data;
+static QLocalePrivate c_private = { c_data, Q_BASIC_ATOMIC_INITIALIZER(1), 0 };
+
#ifndef QT_NO_SYSTEMLOCALE
@@ -643,6 +646,12 @@ static const QLocaleData *defaultData()
return default_data;
}
+const QLocaleData *QLocaleData::c()
+{
+ Q_ASSERT(locale_index[QLocale::C] == 0);
+ return c_data;
+}
+
static QString getLocaleListData(const ushort *data, int size, int index)
{
static const ushort separator = ';';
@@ -699,20 +708,35 @@ const QLocaleData *QLocalePrivate::dataPointerForIndex(quint16 index)
return &locale_data[index];
}
-static quint16 localeDataIndex(const QLocaleData *p)
+Q_GLOBAL_STATIC_WITH_ARGS(QSharedDataPointer<QLocalePrivate>, defaultLocalePrivate,
+ (QLocalePrivate::create(defaultData(), default_number_options)))
+
+static QLocalePrivate *localePrivateByName(const QString &name)
{
-#ifndef QT_NO_SYSTEMLOCALE
- Q_ASSERT((p >= locale_data && p - locale_data < locale_data_size)
- || (p != 0 && p == system_data));
- quint16 index = p == system_data ? locale_data_size : p - locale_data;
-#else
- Q_ASSERT(p >= locale_data && p - locale_data < locale_data_size);
- quint16 index = p - locale_data;
-#endif
+ if (name == QLatin1String("C"))
+ return &c_private;
+ return QLocalePrivate::create(findLocaleData(name));
+}
- return index;
+static QLocalePrivate *findLocalePrivate(QLocale::Language language, QLocale::Script script,
+ QLocale::Country country)
+{
+ if (language == QLocale::C)
+ return &c_private;
+
+ const QLocaleData *data = QLocaleData::findLocaleData(language, script, country);
+
+ int numberOptions = 0;
+
+ // If not found, should default to system
+ if (data->m_language_id == QLocale::C && language != QLocale::C) {
+ numberOptions = default_number_options;
+ data = defaultData();
+ }
+ return QLocalePrivate::create(data, numberOptions);
}
+
/*!
\internal
*/
@@ -751,7 +775,7 @@ QLocale::QLocale(QLocalePrivate &dd)
*/
QLocale::QLocale(const QString &name)
- : d(new QLocalePrivate(localeDataIndex(findLocaleData(name))))
+ : d(localePrivateByName(name))
{
}
@@ -764,7 +788,7 @@ QLocale::QLocale(const QString &name)
*/
QLocale::QLocale()
- : d(new QLocalePrivate(localeDataIndex(defaultData()), default_number_options))
+ : d(*defaultLocalePrivate)
{
}
@@ -788,21 +812,10 @@ QLocale::QLocale()
*/
QLocale::QLocale(Language language, Country country)
+ : d(findLocalePrivate(language, QLocale::AnyScript, country))
{
- const QLocaleData *data = QLocaleData::findLocaleData(language, QLocale::AnyScript, country);
- int index;
- int numberOptions = 0;
-
- // If not found, should default to system
- if (data->m_language_id == QLocale::C && language != QLocale::C) {
- numberOptions = default_number_options;
- index = localeDataIndex(defaultData());
- } else {
- index = localeDataIndex(data);
- }
- d = new QLocalePrivate(index, numberOptions);
}
-\
+
/*!
\since 4.8
@@ -828,19 +841,8 @@ QLocale::QLocale(Language language, Country country)
*/
QLocale::QLocale(Language language, Script script, Country country)
+ : d(findLocalePrivate(language, script, country))
{
- const QLocaleData *data = QLocaleData::findLocaleData(language, script, country);
- int index;
- int numberOptions = 0;
-
- // If not found, should default to system
- if (data->m_language_id == QLocale::C && language != QLocale::C) {
- numberOptions = default_number_options;
- index = localeDataIndex(defaultData());
- } else {
- index = localeDataIndex(data);
- }
- d = new QLocalePrivate(index, numberOptions);
}
/*!
@@ -998,6 +1000,11 @@ void QLocale::setDefault(const QLocale &locale)
{
default_data = locale.d->m_data;
default_number_options = locale.numberOptions();
+
+ if (defaultLocalePrivate.exists()) {
+ // update the cached private
+ *defaultLocalePrivate = locale.d;
+ }
}
/*!
@@ -2117,7 +2124,7 @@ QString QLocale::toString(double i, char f, int prec) const
QLocale QLocale::system()
{
- return QLocale(*new QLocalePrivate(localeDataIndex(systemData())));
+ return QLocale(*QLocalePrivate::create(systemData()));
}
@@ -2152,7 +2159,7 @@ QList<QLocale> QLocale::matchingLocales(QLocale::Language language,
&& (language == QLocale::AnyLanguage || data->m_language_id == uint(language))) {
if ((script == QLocale::AnyScript || data->m_script_id == uint(script))
&& (country == QLocale::AnyCountry || data->m_country_id == uint(country))) {
- QLocale locale(*new QLocalePrivate(localeDataIndex(data)));
+ QLocale locale(*QLocalePrivate::create(data));
result.append(locale);
}
++data;
@@ -2252,7 +2259,7 @@ QString QLocale::standaloneMonthName(int month, FormatType type) const
#ifndef QT_NO_SYSTEMLOCALE
if (d->m_data == systemData()) {
QVariant res = systemLocale()->query(type == LongFormat
- ? QSystemLocale::MonthNameLong : QSystemLocale::MonthNameShort,
+ ? QSystemLocale::StandaloneMonthNameLong : QSystemLocale::StandaloneMonthNameShort,
month);
if (!res.isNull())
return res.toString();
diff --git a/src/corelib/tools/qlocale_blackberry.cpp b/src/corelib/tools/qlocale_blackberry.cpp
index 1db7b7d546..6d60a97062 100644
--- a/src/corelib/tools/qlocale_blackberry.cpp
+++ b/src/corelib/tools/qlocale_blackberry.cpp
@@ -280,6 +280,10 @@ QVariant QSystemLocale::query(QueryType type, QVariant in) const
return lc_language.monthName(in.toInt(), QLocale::LongFormat);
case MonthNameShort:
return lc_language.monthName(in.toInt(), QLocale::ShortFormat);
+ case StandaloneMonthNameLong:
+ return lc_language.standaloneMonthName(in.toInt(), QLocale::LongFormat);
+ case StandaloneMonthNameShort:
+ return lc_language.standaloneMonthName(in.toInt(), QLocale::ShortFormat);
case DateToStringLong:
return lc_region.toString(in.toDate(), QLocale::LongFormat);
case DateToStringShort:
diff --git a/src/corelib/tools/qlocale_mac.mm b/src/corelib/tools/qlocale_mac.mm
index 9292dccf19..f399b7689d 100644
--- a/src/corelib/tools/qlocale_mac.mm
+++ b/src/corelib/tools/qlocale_mac.mm
@@ -401,7 +401,9 @@ QVariant QSystemLocale::query(QueryType type, QVariant in = QVariant()) const
return macDayName(in.toInt(), (type == DayNameShort));
case MonthNameLong:
case MonthNameShort:
- return macMonthName(in.toInt(), (type == MonthNameShort));
+ case StandaloneMonthNameLong:
+ case StandaloneMonthNameShort:
+ return macMonthName(in.toInt(), (type == MonthNameShort || type == StandaloneMonthNameShort));
case DateToStringShort:
case DateToStringLong:
return macDateToString(in.toDate(), (type == DateToStringShort));
diff --git a/src/corelib/tools/qlocale_p.h b/src/corelib/tools/qlocale_p.h
index 9674342307..a62ee9304b 100644
--- a/src/corelib/tools/qlocale_p.h
+++ b/src/corelib/tools/qlocale_p.h
@@ -115,7 +115,9 @@ public:
ListToSeparatedString, // QString
LocaleChanged, // system locale changed
NativeLanguageName, // QString
- NativeCountryName // QString
+ NativeCountryName, // QString
+ StandaloneMonthNameLong, // QString, in: int
+ StandaloneMonthNameShort // QString, in: int
};
virtual QVariant query(QueryType type, QVariant in) const;
virtual QLocale fallbackUiLocale() const;
@@ -162,6 +164,7 @@ public:
static const QLocaleData *findLocaleData(QLocale::Language language,
QLocale::Script script,
QLocale::Country country);
+ static const QLocaleData *c();
quint16 m_language_id, m_script_id, m_country_id;
@@ -205,17 +208,16 @@ public:
quint16 m_weekend_end : 3;
};
-class Q_CORE_EXPORT QLocalePrivate : public QSharedData
+class Q_CORE_EXPORT QLocalePrivate
{
public:
- explicit QLocalePrivate(int index, int numberOptions = 0)
- : m_index(index), m_numberOptions(numberOptions)
- {
- m_data = dataPointerForIndex(index);
- }
-
- ~QLocalePrivate()
+ static QLocalePrivate *create(const QLocaleData *data, int numberOptions = 0)
{
+ QLocalePrivate *retval = new QLocalePrivate;
+ retval->m_data = data;
+ retval->ref.store(1);
+ retval->m_numberOptions = numberOptions;
+ return retval;
}
QChar decimal() const { return QChar(m_data->m_decimal); }
@@ -332,11 +334,19 @@ public:
QString dateTimeToString(const QString &format, const QDate *date, const QTime *time,
const QLocale *q) const;
- quint16 m_index;
- quint16 m_numberOptions;
const QLocaleData *m_data;
+ QBasicAtomicInt ref;
+ quint16 m_numberOptions;
};
+template <>
+inline QLocalePrivate *QSharedDataPointer<QLocalePrivate>::clone()
+{
+ // cannot use QLocalePrivate's copy constructor
+ // since it is deleted in C++11
+ return QLocalePrivate::create(d->m_data, d->m_numberOptions);
+}
+
inline char QLocalePrivate::digitToCLocale(QChar in) const
{
const QChar _zero = zero();
diff --git a/src/corelib/tools/qlocale_unix.cpp b/src/corelib/tools/qlocale_unix.cpp
index 4e443cd79b..9ea28895bd 100644
--- a/src/corelib/tools/qlocale_unix.cpp
+++ b/src/corelib/tools/qlocale_unix.cpp
@@ -173,6 +173,10 @@ QVariant QSystemLocale::query(QueryType type, QVariant in) const
return lc_time.monthName(in.toInt(), QLocale::LongFormat);
case MonthNameShort:
return lc_time.monthName(in.toInt(), QLocale::ShortFormat);
+ case StandaloneMonthNameLong:
+ return lc_time.standaloneMonthName(in.toInt(), QLocale::LongFormat);
+ case StandaloneMonthNameShort:
+ return lc_time.standaloneMonthName(in.toInt(), QLocale::ShortFormat);
case DateToStringLong:
return lc_time.toString(in.toDate(), QLocale::LongFormat);
case DateToStringShort:
diff --git a/src/corelib/tools/qlocale_win.cpp b/src/corelib/tools/qlocale_win.cpp
index d576f1c281..0730002ca3 100644
--- a/src/corelib/tools/qlocale_win.cpp
+++ b/src/corelib/tools/qlocale_win.cpp
@@ -684,8 +684,10 @@ QVariant QSystemLocale::query(QueryType type, QVariant in = QVariant()) const
case DayNameShort:
return d->dayName(in.toInt(), QLocale::ShortFormat);
case MonthNameLong:
+ case StandaloneMonthNameLong:
return d->monthName(in.toInt(), QLocale::LongFormat);
case MonthNameShort:
+ case StandaloneMonthNameShort:
return d->monthName(in.toInt(), QLocale::ShortFormat);
case DateToStringShort:
return d->toString(in.toDate(), QLocale::ShortFormat);
diff --git a/src/gui/accessible/qaccessible.h b/src/gui/accessible/qaccessible.h
index 283209d08f..6667cae237 100644
--- a/src/gui/accessible/qaccessible.h
+++ b/src/gui/accessible/qaccessible.h
@@ -68,7 +68,7 @@ class QTextCursor;
class Q_GUI_EXPORT QAccessible
{
Q_GADGET
- Q_ENUMS(Role Event State)
+ Q_ENUMS(Role Event)
public:
enum Event {
diff --git a/src/gui/accessible/qaccessibleobject.cpp b/src/gui/accessible/qaccessibleobject.cpp
index ccbfd36b70..664ff9eaf4 100644
--- a/src/gui/accessible/qaccessibleobject.cpp
+++ b/src/gui/accessible/qaccessibleobject.cpp
@@ -100,10 +100,6 @@ QAccessibleObject::~QAccessibleObject()
*/
QObject *QAccessibleObject::object() const
{
-#ifndef QT_NO_DEBUG
- if (!d->object)
- qWarning("QAccessibleInterface is invalid. Crash pending...");
-#endif
return d->object;
}
diff --git a/src/gui/doc/images/icon.png b/src/gui/doc/images/icon.png
new file mode 100644
index 0000000000..cc2b6ac93a
--- /dev/null
+++ b/src/gui/doc/images/icon.png
Binary files differ
diff --git a/src/gui/gui.pro b/src/gui/gui.pro
index 062f00c4c4..b44f563b3e 100644
--- a/src/gui/gui.pro
+++ b/src/gui/gui.pro
@@ -8,6 +8,10 @@ DEFINES += QT_NO_USING_NAMESPACE
QMAKE_DOCS = $$PWD/doc/qtgui.qdocconf
+MODULE_PLUGIN_TYPES = \
+ platforms \
+ imageformats
+
load(qt_module)
# Code coverage with TestCocoon
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp
index c5be379b7d..ba97db4d39 100644
--- a/src/gui/kernel/qevent.cpp
+++ b/src/gui/kernel/qevent.cpp
@@ -947,11 +947,14 @@ QKeyEvent::~QKeyEvent()
/*!
\fn QString QKeyEvent::text() const
- Returns the Unicode text that this key generated. The text
- returned can be an empty string in cases
- where modifier keys, such as Shift, Control, Alt, and Meta,
- are being pressed or released. In such cases key() will contain
- a valid value.
+ Returns the Unicode text that this key generated.
+
+ Return values when modifier keys such as
+ Shift, Control, Alt, and Meta are pressed
+ differ among platforms and could return an empty string.
+
+ \note \l key() will always return a valid value,
+ independent of modifier keys.
\sa Qt::WA_KeyCompression
*/
diff --git a/src/network/doc/src/network-programming.qdoc b/src/network/doc/src/network-programming.qdoc
index f236948b57..821b0ada15 100644
--- a/src/network/doc/src/network-programming.qdoc
+++ b/src/network/doc/src/network-programming.qdoc
@@ -51,7 +51,7 @@
\section1 Qt's Classes for Network Programming
- The \l{Qt Network - C++ Classes} page contains a list of the C++ classes
+ The \l{Qt Network C++ Classes} page contains a list of the C++ classes
in Qt Network.
\section1 High Level Network Operations for HTTP and FTP
diff --git a/src/network/network.pro b/src/network/network.pro
index d2b2447611..79e357e0cb 100644
--- a/src/network/network.pro
+++ b/src/network/network.pro
@@ -11,6 +11,9 @@ DEFINES += QT_NO_USING_NAMESPACE
#DEFINES += QUDPSOCKET_DEBUG QUDPSERVER_DEBUG
win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x64000000
+MODULE_PLUGIN_TYPES = \
+ bearer
+
QMAKE_DOCS = $$PWD/doc/qtnetwork.qdocconf
load(qt_module)
diff --git a/src/opengl/doc/src/qtopengl-index.qdoc b/src/opengl/doc/src/qtopengl-index.qdoc
index 94109aa706..fc131c4b17 100644
--- a/src/opengl/doc/src/qtopengl-index.qdoc
+++ b/src/opengl/doc/src/qtopengl-index.qdoc
@@ -67,6 +67,6 @@
OpenGL module can take advantage of the whole Qt API for
non-OpenGL-specific GUI functionality.
- The \l{Qt OpenGL C++ classes} page gives an overview over the available classes
+ The \l{Qt OpenGL C++ Classes} page gives an overview over the available classes
int this module.
*/
diff --git a/src/opengl/doc/src/qtopengl-module.qdoc b/src/opengl/doc/src/qtopengl-module.qdoc
index e75eb49447..9c15a54428 100644
--- a/src/opengl/doc/src/qtopengl-module.qdoc
+++ b/src/opengl/doc/src/qtopengl-module.qdoc
@@ -27,7 +27,7 @@
/*!
\module QtOpenGL
- \title Qt OpenGL C++ classes
+ \title Qt OpenGL C++ Classes
\ingroup modules
\ingroup technology-apis
diff --git a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp
index 91472f9efb..f4cfa3ca40 100644
--- a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp
+++ b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp
@@ -648,8 +648,8 @@ QFontEngine *QFontconfigDatabase::fontEngine(const QFontDef &f, QChar::Script sc
}
if (f.hintingPreference == QFont::PreferDefaultHinting) {
- QByteArray desktopEnvironment = QGuiApplicationPrivate::platformIntegration()->services()->desktopEnvironment();
- if (desktopEnvironment == "GNOME" || desktopEnvironment == "UNITY") {
+ const QPlatformServices *services = QGuiApplicationPrivate::platformIntegration()->services();
+ if (services && (services->desktopEnvironment() == "GNOME" || services->desktopEnvironment() == "UNITY")) {
void *hintStyleResource =
QGuiApplication::platformNativeInterface()->nativeResourceForScreen("hintstyle",
QGuiApplication::primaryScreen());
diff --git a/src/plugins/platforms/android/src/qandroidinputcontext.cpp b/src/plugins/platforms/android/src/qandroidinputcontext.cpp
index 2180560b04..1981ac0b75 100644
--- a/src/plugins/platforms/android/src/qandroidinputcontext.cpp
+++ b/src/plugins/platforms/android/src/qandroidinputcontext.cpp
@@ -237,13 +237,11 @@ static JNINativeMethod methods[] = {
QAndroidInputContext::QAndroidInputContext():QPlatformInputContext()
{
- JNIEnv *env = 0;
- if (QtAndroid::javaVM()->AttachCurrentThread(&env, NULL) < 0) {
- qCritical() << "AttachCurrentThread failed";
+ QtAndroid::AttachedJNIEnv env;
+ if (!env.jniEnv)
return;
- }
- jclass clazz = QtAndroid::findClass(QtNativeInputConnectionClassName, env);
+ jclass clazz = QtAndroid::findClass(QtNativeInputConnectionClassName, env.jniEnv);
if (clazz == NULL) {
qCritical() << "Native registration unable to find class '"
<< QtNativeInputConnectionClassName
@@ -251,14 +249,14 @@ QAndroidInputContext::QAndroidInputContext():QPlatformInputContext()
return;
}
- if (env->RegisterNatives(clazz, methods, sizeof(methods) / sizeof(methods[0])) < 0) {
+ if (env.jniEnv->RegisterNatives(clazz, methods, sizeof(methods) / sizeof(methods[0])) < 0) {
qCritical() << "RegisterNatives failed for '"
<< QtNativeInputConnectionClassName
<< "'";
return;
}
- clazz = QtAndroid::findClass(QtExtractedTextClassName, env);
+ clazz = QtAndroid::findClass(QtExtractedTextClassName, env.jniEnv);
if (clazz == NULL) {
qCritical() << "Native registration unable to find class '"
<< QtExtractedTextClassName
@@ -266,44 +264,44 @@ QAndroidInputContext::QAndroidInputContext():QPlatformInputContext()
return;
}
- m_extractedTextClass = static_cast<jclass>(env->NewGlobalRef(clazz));
- m_classConstructorMethodID = env->GetMethodID(m_extractedTextClass, "<init>", "()V");
+ m_extractedTextClass = static_cast<jclass>(env.jniEnv->NewGlobalRef(clazz));
+ m_classConstructorMethodID = env.jniEnv->GetMethodID(m_extractedTextClass, "<init>", "()V");
if (m_classConstructorMethodID == NULL) {
qCritical() << "GetMethodID failed";
return;
}
- m_partialEndOffsetFieldID = env->GetFieldID(m_extractedTextClass, "partialEndOffset", "I");
+ m_partialEndOffsetFieldID = env.jniEnv->GetFieldID(m_extractedTextClass, "partialEndOffset", "I");
if (m_partialEndOffsetFieldID == NULL) {
qCritical() << "Can't find field partialEndOffset";
return;
}
- m_partialStartOffsetFieldID = env->GetFieldID(m_extractedTextClass, "partialStartOffset", "I");
+ m_partialStartOffsetFieldID = env.jniEnv->GetFieldID(m_extractedTextClass, "partialStartOffset", "I");
if (m_partialStartOffsetFieldID == NULL) {
qCritical() << "Can't find field partialStartOffset";
return;
}
- m_selectionEndFieldID = env->GetFieldID(m_extractedTextClass, "selectionEnd", "I");
+ m_selectionEndFieldID = env.jniEnv->GetFieldID(m_extractedTextClass, "selectionEnd", "I");
if (m_selectionEndFieldID == NULL) {
qCritical() << "Can't find field selectionEnd";
return;
}
- m_selectionStartFieldID = env->GetFieldID(m_extractedTextClass, "selectionStart", "I");
+ m_selectionStartFieldID = env.jniEnv->GetFieldID(m_extractedTextClass, "selectionStart", "I");
if (m_selectionStartFieldID == NULL) {
qCritical() << "Can't find field selectionStart";
return;
}
- m_startOffsetFieldID = env->GetFieldID(m_extractedTextClass, "startOffset", "I");
+ m_startOffsetFieldID = env.jniEnv->GetFieldID(m_extractedTextClass, "startOffset", "I");
if (m_startOffsetFieldID == NULL) {
qCritical() << "Can't find field startOffset";
return;
}
- m_textFieldID = env->GetFieldID(m_extractedTextClass, "text", "Ljava/lang/String;");
+ m_textFieldID = env.jniEnv->GetFieldID(m_extractedTextClass, "text", "Ljava/lang/String;");
if (m_textFieldID == NULL) {
qCritical() << "Can't find field text";
return;
diff --git a/src/plugins/platforms/android/src/qandroidplatformservices.cpp b/src/plugins/platforms/android/src/qandroidplatformservices.cpp
index 841a9d4d51..0df882f1f0 100644
--- a/src/plugins/platforms/android/src/qandroidplatformservices.cpp
+++ b/src/plugins/platforms/android/src/qandroidplatformservices.cpp
@@ -46,29 +46,25 @@
QAndroidPlatformServices::QAndroidPlatformServices()
{
- JNIEnv *env;
- if (QtAndroid::javaVM()->AttachCurrentThread(&env, NULL) < 0) {
- qCritical() << "AttachCurrentThread failed";
+ QtAndroid::AttachedJNIEnv env;
+ if (!env.jniEnv)
return;
- }
- m_openURIMethodID = env->GetStaticMethodID(QtAndroid::applicationClass(),
+ m_openURIMethodID = env.jniEnv->GetStaticMethodID(QtAndroid::applicationClass(),
"openURL",
"(Ljava/lang/String;)V");
}
bool QAndroidPlatformServices::openUrl(const QUrl &url)
{
- JNIEnv *env;
- if (QtAndroid::javaVM()->AttachCurrentThread(&env, NULL) < 0) {
- qCritical() << "AttachCurrentThread failed";
+ QtAndroid::AttachedJNIEnv env;
+ if (!env.jniEnv)
return false;
- }
- jstring string = env->NewString(reinterpret_cast<const jchar *>(url.toString().constData()),
+ jstring string = env.jniEnv->NewString(reinterpret_cast<const jchar *>(url.toString().constData()),
url.toString().length());
- env->CallStaticVoidMethod(QtAndroid::applicationClass(), m_openURIMethodID, string);
- env->DeleteLocalRef(string);
+ env.jniEnv->CallStaticVoidMethod(QtAndroid::applicationClass(), m_openURIMethodID, string);
+ env.jniEnv->DeleteLocalRef(string);
return true;
}
diff --git a/src/plugins/platforms/cocoa/qcocoatheme.mm b/src/plugins/platforms/cocoa/qcocoatheme.mm
index 8337e00eb6..36d7a49746 100644
--- a/src/plugins/platforms/cocoa/qcocoatheme.mm
+++ b/src/plugins/platforms/cocoa/qcocoatheme.mm
@@ -54,6 +54,7 @@
#include "qcocoamenu.h"
#include "qcocoamenubar.h"
#include "qcocoahelpers.h"
+#include "qcocoaautoreleasepool.h"
#include <QtCore/qfileinfo.h>
#include <QtGui/private/qguiapplication_p.h>
@@ -250,27 +251,17 @@ QPixmap QCocoaTheme::standardPixmap(StandardPixmap sp, const QSizeF &size) const
QPixmap QCocoaTheme::fileIconPixmap(const QFileInfo &fileInfo, const QSizeF &size) const
{
- FSRef macRef;
- OSStatus status = FSPathMakeRef(reinterpret_cast<const UInt8*>(fileInfo.canonicalFilePath().toUtf8().constData()),
- &macRef, 0);
- if (status != noErr)
- return QPixmap();
- FSCatalogInfo info;
- HFSUniStr255 macName;
- status = FSGetCatalogInfo(&macRef, kIconServicesCatalogInfoMask, &info, &macName, 0, 0);
- if (status != noErr)
- return QPixmap();
- IconRef iconRef;
- SInt16 iconLabel;
- status = GetIconRefFromFileInfo(&macRef, macName.length, macName.unicode,
- kIconServicesCatalogInfoMask, &info, kIconServicesNormalUsageFlag,
- &iconRef, &iconLabel);
- if (status != noErr)
- return QPixmap();
+ QCocoaAutoReleasePool pool;
- QPixmap pixmap = qt_mac_convert_iconref(iconRef, size.width(), size.height());
- ReleaseIconRef(iconRef);
+ NSImage *iconImage = [[NSWorkspace sharedWorkspace] iconForFile:QCFString::toNSString(fileInfo.canonicalFilePath())];
+ if (!iconImage)
+ return QPixmap();
+ NSRect iconRect = NSMakeRect(0, 0, size.width(), size.height());
+ CGImageRef cgImage = [iconImage CGImageForProposedRect:&iconRect
+ context:[NSGraphicsContext currentContext]
+ hints:nil];
+ QPixmap pixmap = QPixmap::fromImage(qt_mac_toQImage(cgImage));
return pixmap;
}
diff --git a/src/plugins/platforms/eglfs/qeglfswindow.cpp b/src/plugins/platforms/eglfs/qeglfswindow.cpp
index ebf8e4af85..cd92a07f00 100644
--- a/src/plugins/platforms/eglfs/qeglfswindow.cpp
+++ b/src/plugins/platforms/eglfs/qeglfswindow.cpp
@@ -131,6 +131,7 @@ void QEglFSWindow::setGeometry(const QRect &)
QRect rect(screen()->availableGeometry());
QPlatformWindow::setGeometry(rect);
QWindowSystemInterface::handleGeometryChange(window(), rect);
+ QWindowSystemInterface::handleExposeEvent(window(), QRegion(rect));
}
void QEglFSWindow::setWindowState(Qt::WindowState)
diff --git a/src/plugins/platforms/ios/qiosbackingstore.mm b/src/plugins/platforms/ios/qiosbackingstore.mm
index f3c1af2b2d..6007e247f0 100644
--- a/src/plugins/platforms/ios/qiosbackingstore.mm
+++ b/src/plugins/platforms/ios/qiosbackingstore.mm
@@ -74,7 +74,6 @@ void QIOSBackingStore::beginPaint(const QRegion &)
m_context->makeCurrent(window());
- static_cast<QOpenGLPaintDevice *>(paintDevice())->setSize(window()->size());
QIOSWindow *iosWindow = static_cast<QIOSWindow *>(window()->handle());
static_cast<QOpenGLPaintDevice *>(paintDevice())->setSize(window()->size() * iosWindow->devicePixelRatio());
}
diff --git a/src/plugins/platforms/ios/qioscontext.mm b/src/plugins/platforms/ios/qioscontext.mm
index e2a6113010..807c75df54 100644
--- a/src/plugins/platforms/ios/qioscontext.mm
+++ b/src/plugins/platforms/ios/qioscontext.mm
@@ -52,20 +52,17 @@
QIOSContext::QIOSContext(QOpenGLContext *context)
: QPlatformOpenGLContext()
, m_eaglContext([[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2])
+ , m_format(context->format())
{
- // Start out with the requested format
- QSurfaceFormat format = context->format();
-
- format.setRenderableType(QSurfaceFormat::OpenGLES);
- format.setMajorVersion(2);
- format.setMinorVersion(0);
-
- // Even though iOS internally double-buffers its rendering, we
- // report single-buffered here since the buffer remains unchanged
- // when swapping unlesss you manually clear it yourself.
- format.setSwapBehavior(QSurfaceFormat::SingleBuffer);
-
- m_format = format;
+ m_format.setRenderableType(QSurfaceFormat::OpenGLES);
+ m_format.setMajorVersion(2);
+ m_format.setMinorVersion(0);
+
+ // iOS internally double-buffers its rendering using copy instead of flipping,
+ // so technically we could report that we are single-buffered so that clients
+ // could take advantage of the unchanged buffer, but this means clients (and Qt)
+ // will also assume that swapBufferes() is not needed, which is _not_ the case.
+ m_format.setSwapBehavior(QSurfaceFormat::DoubleBuffer);
}
QIOSContext::~QIOSContext()
diff --git a/src/plugins/platforms/ios/qiosglobal.mm b/src/plugins/platforms/ios/qiosglobal.mm
index d26eca54e5..9abb4ba851 100644
--- a/src/plugins/platforms/ios/qiosglobal.mm
+++ b/src/plugins/platforms/ios/qiosglobal.mm
@@ -104,7 +104,8 @@ Qt::ScreenOrientation toQtScreenOrientation(UIDeviceOrientation uiDeviceOrientat
break;
case UIDeviceOrientationFaceUp:
case UIDeviceOrientationFaceDown:
- qtOrientation = static_cast<Qt::ScreenOrientation>(-1); // not supported ATM.
+ // FIXME: Use cached device orientation, or fall back to interface orientation
+ qtOrientation = Qt::PortraitOrientation;
break;
default:
qtOrientation = Qt::PortraitOrientation;
diff --git a/src/plugins/platforms/ios/qiosscreen.mm b/src/plugins/platforms/ios/qiosscreen.mm
index b73f9c3cbc..c1613c1af4 100644
--- a/src/plugins/platforms/ios/qiosscreen.mm
+++ b/src/plugins/platforms/ios/qiosscreen.mm
@@ -83,9 +83,18 @@
- (void) orientationChanged:(NSNotification *)notification
{
Q_UNUSED(notification);
- Qt::ScreenOrientation orientation = toQtScreenOrientation([UIDevice currentDevice].orientation);
- if (orientation != -1)
- QWindowSystemInterface::handleScreenOrientationChange(m_screen->screen(), orientation);
+
+ UIDeviceOrientation deviceOrientation = [UIDevice currentDevice].orientation;
+ switch (deviceOrientation) {
+ case UIDeviceOrientationFaceUp:
+ case UIDeviceOrientationFaceDown:
+ // We ignore these events, as iOS will send events with the 'regular'
+ // orientations alongside these two orientations.
+ return;
+ default:
+ Qt::ScreenOrientation screenOrientation = toQtScreenOrientation(deviceOrientation);
+ QWindowSystemInterface::handleScreenOrientationChange(m_screen->screen(), screenOrientation);
+ }
}
@end
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp
index c845b875bf..6291396e6e 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.cpp
+++ b/src/plugins/platforms/xcb/qxcbwindow.cpp
@@ -630,7 +630,7 @@ void QXcbWindow::show()
const QWindow *tp = window()->transientParent();
if (isTransient(window()) || tp != 0) {
xcb_window_t transientXcbParent = 0;
- if (tp)
+ if (tp && tp->handle())
transientXcbParent = static_cast<const QXcbWindow *>(tp->handle())->winId();
// Default to client leader if there is no transient parent, else modal dialogs can
// be hidden by their parents.
diff --git a/src/plugins/platformthemes/gtk2/qgtk2dialoghelpers.cpp b/src/plugins/platformthemes/gtk2/qgtk2dialoghelpers.cpp
index 25d45eb81d..77a78d2140 100644
--- a/src/plugins/platformthemes/gtk2/qgtk2dialoghelpers.cpp
+++ b/src/plugins/platformthemes/gtk2/qgtk2dialoghelpers.cpp
@@ -430,6 +430,7 @@ void QGtk2FileDialogHelper::applyOptions()
if (!initialNameFilter.isEmpty())
selectNameFilter(initialNameFilter);
+#if GTK_CHECK_VERSION(2, 20, 0)
GtkWidget *acceptButton = gtk_dialog_get_widget_for_response(gtkDialog, GTK_RESPONSE_OK);
if (acceptButton) {
if (opts->isLabelExplicitlySet(QFileDialogOptions::Accept))
@@ -447,6 +448,7 @@ void QGtk2FileDialogHelper::applyOptions()
else
gtk_button_set_label(GTK_BUTTON(rejectButton), GTK_STOCK_CANCEL);
}
+#endif
}
void QGtk2FileDialogHelper::setNameFilters(const QStringList &filters)
diff --git a/src/sql/doc/qtsql.qdocconf b/src/sql/doc/qtsql.qdocconf
index e53bd50b55..c2686079d5 100644
--- a/src/sql/doc/qtsql.qdocconf
+++ b/src/sql/doc/qtsql.qdocconf
@@ -21,7 +21,7 @@ qhp.QtSql.customFilters.Qt.filterAttributes = qtsql $QT_VERSION
qhp.QtSql.subprojects = classes
qhp.QtSql.subprojects.classes.title = C++ Classes
-qhp.QtSql.subprojects.classes.indexTitle = Qt SQL Module C++ Classes
+qhp.QtSql.subprojects.classes.indexTitle = Qt SQL C++ Classes
qhp.QtSql.subprojects.classes.selectors = class fake:headerfile
qhp.QtSql.subprojects.classes.sortPages = true
tagfile = ../../../doc/qtsql/qtsql.tags
diff --git a/src/sql/doc/src/qtsql.qdoc b/src/sql/doc/src/qtsql.qdoc
index 15b8603a66..8ce981756a 100644
--- a/src/sql/doc/src/qtsql.qdoc
+++ b/src/sql/doc/src/qtsql.qdoc
@@ -54,13 +54,13 @@
\section1 Reference
These are links to the API reference materials.
\list
- \li \l{Qt SQL Module C++ Classes}{C++ classes}
+ \li \l{Qt SQL C++ Classes}{C++ Classes}
\endlist
*/
/*!
\module QtSql
- \title Qt SQL Module C++ Classes
+ \title Qt SQL C++ Classes
\ingroup modules
\brief Provides a driver layer, SQL API layer, and a user
interface layer for SQL databases.
diff --git a/src/sql/sql.pro b/src/sql/sql.pro
index 4f5af51c52..10004cb445 100644
--- a/src/sql/sql.pro
+++ b/src/sql/sql.pro
@@ -4,6 +4,9 @@ QT = core-private
DEFINES += QT_NO_USING_NAMESPACE
win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x62000000
+MODULE_PLUGIN_TYPES = \
+ sqldrivers
+
QMAKE_DOCS = $$PWD/doc/qtsql.qdocconf
load(qt_module)
diff --git a/src/testlib/3rdparty/valgrind_p.h b/src/testlib/3rdparty/valgrind_p.h
index bbce1b24d6..4745371d81 100644
--- a/src/testlib/3rdparty/valgrind_p.h
+++ b/src/testlib/3rdparty/valgrind_p.h
@@ -133,6 +133,7 @@
_zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5) \
{ \
(_zzq_rlval) = (_zzq_default); \
+ (void)_zzq_rlval; \
}
#else /* ! NVALGRIND */
@@ -205,6 +206,7 @@ typedef
: "cc", "memory" \
); \
_zzq_rlval = _zzq_result; \
+ (void)_zzq_rlval; \
}
#define VALGRIND_GET_NR_CONTEXT(_zzq_rlval) \
@@ -319,6 +321,7 @@ typedef
: "b" (_zzq_default), "b" (_zzq_ptr) \
: "cc", "memory", "r3", "r4"); \
_zzq_rlval = _zzq_result; \
+ (void)_zzq_rlval; \
}
#define VALGRIND_GET_NR_CONTEXT(_zzq_rlval) \
@@ -377,6 +380,7 @@ typedef
: "0" (_zzq_default), "r" (_zzq_ptr) \
: "cc", "memory"); \
_zzq_rlval = _zzq_result; \
+ (void)_zzq_rlval; \
}
#define VALGRIND_GET_NR_CONTEXT(_zzq_rlval) \
@@ -447,6 +451,7 @@ typedef
: "b" (_zzq_ptr) \
: "r3", "r4", "cc", "memory"); \
_zzq_rlval = _zzq_result; \
+ (void)_zzq_rlval; \
}
#define VALGRIND_GET_NR_CONTEXT(_zzq_rlval) \
@@ -519,6 +524,7 @@ typedef
: "b" (_zzq_ptr) \
: "r3", "r4", "cc", "memory"); \
_zzq_rlval = _zzq_result; \
+ (void)_zzq_rlval; \
}
#define VALGRIND_GET_NR_CONTEXT(_zzq_rlval) \
diff --git a/src/tools/qdoc/config.cpp b/src/tools/qdoc/config.cpp
index 766697dfc2..ce3b34841e 100644
--- a/src/tools/qdoc/config.cpp
+++ b/src/tools/qdoc/config.cpp
@@ -55,8 +55,9 @@
QT_BEGIN_NAMESPACE
-/*
- An entry on the MetaStack.
+/*!
+ An entry in a stack, where each entry is a list
+ of string values.
*/
class MetaStackEntry
{
@@ -68,14 +69,19 @@ public:
QStringList next;
};
-/*
+/*!
+ Start accumulating values in a list by appending an empty
+ string to the list.
*/
void MetaStackEntry::open()
{
next.append(QString());
}
-/*
+/*!
+ Stop accumulating values and append the list of accumulated
+ values to the complete list of accumulated values.
+
*/
void MetaStackEntry::close()
{
@@ -83,8 +89,10 @@ void MetaStackEntry::close()
next.clear();
}
-/*
- ###
+/*!
+ \class MetaStack
+
+ This class maintains a stack of values of config file variables.
*/
class MetaStack : private QStack<MetaStackEntry>
{
@@ -97,12 +105,21 @@ public:
QStringList getExpanded(const Location& location);
};
+/*!
+ The default constructor pushes a new stack entry and
+ opens it.
+ */
MetaStack::MetaStack()
{
push(MetaStackEntry());
top().open();
}
+/*!
+ Processes the character \a ch using the \a location.
+ It really just builds up a name by appending \a ch to
+ it.
+ */
void MetaStack::process(QChar ch, const Location& location)
{
if (ch == QLatin1Char('{')) {
@@ -133,6 +150,9 @@ void MetaStack::process(QChar ch, const Location& location)
top().open();
}
else {
+ /*
+ This is where all the processing is done.
+ */
QStringList::Iterator pre = top().next.begin();
while (pre != top().next.end()) {
*pre += ch;
@@ -141,6 +161,9 @@ void MetaStack::process(QChar ch, const Location& location)
}
}
+/*!
+ Returns the accumulated string values.
+ */
QStringList MetaStack::getExpanded(const Location& location)
{
if (count() > 1)
@@ -176,9 +199,7 @@ Config::Config(const QString& programName)
{
loc = Location::null;
lastLocation_ = Location::null;
- locMap.clear();
- stringPairMap.clear();
- stringListPairMap.clear();
+ configVars_.clear();
numInstances++;
}
@@ -211,19 +232,6 @@ void Config::load(const QString& fileName)
}
/*!
- Writes the qdoc configuration data to the named file.
- The previous contents of the file are overwritten.
- */
-void Config::unload(const QString& fileName)
-{
- QStringPairMap::ConstIterator v = stringPairMap.constBegin();
- while (v != stringPairMap.constEnd()) {
- qDebug() << v.key() << " = " << v.value().second;
- ++v;
- }
- qDebug() << "fileName:" << fileName;
-}
-/*!
Joins all the strings in \a values into a single string with the
individual \a values separated by ' '. Then it inserts the result
into the string list map with \a var as the key.
@@ -233,10 +241,7 @@ void Config::unload(const QString& fileName)
*/
void Config::setStringList(const QString& var, const QStringList& values)
{
- stringPairMap[var].first = QDir::currentPath();
- stringPairMap[var].second = values.join(QLatin1Char(' '));
- stringListPairMap[var].first = QDir::currentPath();
- stringListPairMap[var].second = values;
+ configVars_.insert(var,ConfigVar(var, values, QDir::currentPath()));
}
/*!
@@ -303,30 +308,29 @@ QSet<QString> Config::getOutputFormats() const
*/
QString Config::getString(const QString& var) const
{
- if (!locMap[var].isEmpty())
- (Location&) lastLocation_ = locMap[var];
- return stringPairMap[var].second;
-}
-
-/*!
- This function looks up the variable \a var in the location map
- and, if found, sets the internal variable \c{lastLocation_} to the
- location that \a var maps to.
-
- Then it looks up \a var in the configuration variable map and,
- if found, constructs a path from the pair value, which consists
- of the directory path of the configuration file where the value
- came from, and the value itself. The constructed path is returned.
- */
-QString Config::getPath(const QString& var) const
-{
- if (!locMap[var].isEmpty())
- (Location&) lastLocation_ = locMap[var];
- QString path;
- if (stringPairMap.contains(var)) {
- path = QDir(stringPairMap[var].first + "/" + stringPairMap[var].second).absolutePath();
+ QList<ConfigVar> configVars = configVars_.values(var);
+ QString value;
+ int high = 0;
+ if (!configVars.empty()) {
+ int i = configVars.size() - 1;
+ while (i >= 0) {
+ const ConfigVar& cv = configVars[i];
+ if (!cv.location_.isEmpty())
+ (Location&) lastLocation_ = cv.location_;
+ if (!cv.values_.isEmpty()) {
+ if (!cv.plus_)
+ value.clear();
+ for (int j=0; j<cv.values_.size(); ++j) {
+ if (!value.isEmpty() && !value.endsWith(QChar('\n')))
+ value.append(QChar(' '));
+ value.append(cv.values_[j]);
+ high = j;
+ }
+ }
+ --i;
+ }
}
- return path;
+ return value;
}
/*!
@@ -341,40 +345,65 @@ QSet<QString> Config::getStringSet(const QString& var) const
/*!
First, this function looks up the configuration variable \a var
- in the location map and, if found, sets the internal variable
+ in the location map. If found, it sets the internal variable
\c{lastLocation_} to the Location that \a var maps to.
- Then it looks up the configuration variable \a var in the string
- list map, and returns the string list that \a var maps to.
+ Then it looks up the configuration variable \a var in the map of
+ configuration variable records. If found, it gets a list of all
+ the records for \a var. Then it appends all the values for \a var
+ to a list and returns the list. As it appends the values from each
+ record, if the \a var used '=' instead of '+=' the list is cleared
+ before the values are appended. \note '+=' should always be used.
+ The final list is returned.
*/
QStringList Config::getStringList(const QString& var) const
{
- if (!locMap[var].isEmpty())
- (Location&) lastLocation_ = locMap[var];
- return stringListPairMap[var].second;
+ QList<ConfigVar> configVars = configVars_.values(var);
+ QStringList values;
+ if (!configVars.empty()) {
+ int i = configVars.size() - 1;
+ while (i >= 0) {
+ if (!configVars[i].location_.isEmpty())
+ (Location&) lastLocation_ = configVars[i].location_;
+ if (configVars[i].plus_)
+ values.append(configVars[i].values_);
+ else
+ values = configVars[i].values_;
+ --i;
+ }
+ }
+ return values;
}
-
/*!
\brief Returns the a path list where all paths are canonicalized, then
made relative to the config file.
\param var The variable containing the list of paths.
\see Location::canonicalRelativePath()
*/
-QStringList Config::getCanonicalRelativePathList(const QString& var) const
+QStringList Config::getCanonicalPathList(const QString& var) const
{
- if (!locMap[var].isEmpty())
- (Location&) lastLocation_ = locMap[var];
QStringList t;
- QStringListPairMap::const_iterator it = stringListPairMap.constFind(var);
- if (it != stringListPairMap.constEnd()) {
- const QStringList& sl = it.value().second;
- if (!sl.isEmpty()) {
- t.reserve(sl.size());
- for (int i=0; i<sl.size(); ++i) {
- const QString &canonicalized = location().canonicalRelativePath(sl[i]);
- t.append(canonicalized);
+ QList<ConfigVar> configVars = configVars_.values(var);
+ if (!configVars.empty()) {
+ int i = configVars.size() - 1;
+ while (i >= 0) {
+ const ConfigVar& cv = configVars[i];
+ if (!cv.location_.isEmpty())
+ (Location&) lastLocation_ = cv.location_;
+ if (!cv.plus_) {
+ t.clear();
+ }
+ const QString d = cv.currentPath_;
+ const QStringList& sl = cv.values_;
+ if (!sl.isEmpty()) {
+ t.reserve(t.size() + sl.size());
+ for (int i=0; i<sl.size(); ++i) {
+ QDir dir(d + "/" + sl[i]);
+ t.append(dir.canonicalPath());
+ }
}
+ --i;
}
}
return t;
@@ -382,32 +411,30 @@ QStringList Config::getCanonicalRelativePathList(const QString& var) const
/*!
This function should only be called when the configuration
- variable \a var maps to a string list that contains file paths.
+ variable \a var maps to string lists that contain file paths.
It cleans the paths with QDir::cleanPath() before returning
them.
-
- First, this function looks up the configuration variable \a var
- in the location map and, if found, sets the internal variable
- \c{lastLocation_} the Location that \a var maps to.
-
- Then it looks up the configuration variable \a var in the string
- list map, which maps to a string list that contains file paths.
- These paths might not be clean, so QDir::cleanPath() is called
- for each one. The string list returned contains cleaned paths.
*/
QStringList Config::getCleanPathList(const QString& var) const
{
- if (!locMap[var].isEmpty())
- (Location&) lastLocation_ = locMap[var];
QStringList t;
- QStringListPairMap::const_iterator it = stringListPairMap.constFind(var);
- if (it != stringListPairMap.constEnd()) {
- const QStringList& sl = it.value().second;
- if (!sl.isEmpty()) {
- t.reserve(sl.size());
- for (int i=0; i<sl.size(); ++i) {
- t.append(QDir::cleanPath(sl[i]));
+ QList<ConfigVar> configVars = configVars_.values(var);
+ if (!configVars.empty()) {
+ int i = configVars.size() - 1;
+ while (i >= 0) {
+ const ConfigVar& cv = configVars[i];
+ if (!cv.plus_)
+ t.clear();
+ if (!cv.location_.isEmpty())
+ (Location&) lastLocation_ = cv.location_;
+ const QStringList& sl = cv.values_;
+ if (!sl.isEmpty()) {
+ t.reserve(t.size() + sl.size());
+ for (int i=0; i<sl.size(); ++i) {
+ t.append(QDir::cleanPath(sl[i].simplified()));
+ }
}
+ --i;
}
}
return t;
@@ -415,7 +442,7 @@ QStringList Config::getCleanPathList(const QString& var) const
/*!
This function should only be called when the configuration
- variable \a var maps to a string list that contains file paths.
+ variable \a var maps to string lists that contain file paths.
It cleans the paths with QDir::cleanPath() before returning
them.
@@ -424,30 +451,39 @@ QStringList Config::getCleanPathList(const QString& var) const
\c{lastLocation_} the Location that \a var maps to.
Then it looks up the configuration variable \a var in the string
- list map, which maps to a string list that contains file paths.
+ list map, which maps to one or more records that each contains a
+ list of file paths.
+
These paths might not be clean, so QDir::cleanPath() is called
for each one. The string list returned contains cleaned paths.
*/
QStringList Config::getPathList(const QString& var) const
{
- if (!locMap[var].isEmpty())
- (Location&) lastLocation_ = locMap[var];
QStringList t;
- QStringListPairMap::const_iterator it = stringListPairMap.constFind(var);
- if (it != stringListPairMap.constEnd()) {
- const QStringList& sl = it.value().second;
- const QString d = it.value().first;
- if (!sl.isEmpty()) {
- t.reserve(sl.size());
- for (int i=0; i<sl.size(); ++i) {
- QFileInfo fileInfo;
- QString path = d + "/" + QDir::cleanPath(sl[i]);
- fileInfo.setFile(path);
- if (!fileInfo.exists())
- lastLocation_.warning(tr("File '%1' does not exist").arg(path));
- else
- t.append(path);
+ QList<ConfigVar> configVars = configVars_.values(var);
+ if (!configVars.empty()) {
+ int i = configVars.size() - 1;
+ while (i >= 0) {
+ const ConfigVar& cv = configVars[i];
+ if (!cv.plus_)
+ t.clear();
+ if (!cv.location_.isEmpty())
+ (Location&) lastLocation_ = cv.location_;
+ const QString d = cv.currentPath_;
+ const QStringList& sl = cv.values_;
+ if (!sl.isEmpty()) {
+ t.reserve(t.size() + sl.size());
+ for (int i=0; i<sl.size(); ++i) {
+ QFileInfo fileInfo;
+ QString path = d + "/" + QDir::cleanPath(sl[i].simplified());
+ fileInfo.setFile(path);
+ if (!fileInfo.exists())
+ lastLocation_.warning(tr("File '%1' does not exist").arg(path));
+ else
+ t.append(path);
+ }
}
+ --i;
}
}
return t;
@@ -509,30 +545,31 @@ QSet<QString> Config::subVars(const QString& var) const
{
QSet<QString> result;
QString varDot = var + QLatin1Char('.');
- QStringPairMap::ConstIterator v = stringPairMap.constBegin();
- while (v != stringPairMap.constEnd()) {
- if (v.key().startsWith(varDot)) {
- QString subVar = v.key().mid(varDot.length());
+ ConfigVarMultimap::ConstIterator i = configVars_.constBegin();
+ while (i != configVars_.constEnd()) {
+ if (i.key().startsWith(varDot)) {
+ QString subVar = i.key().mid(varDot.length());
int dot = subVar.indexOf(QLatin1Char('.'));
if (dot != -1)
subVar.truncate(dot);
- result.insert(subVar);
+ if (!result.contains(subVar))
+ result.insert(subVar);
}
- ++v;
+ ++i;
}
return result;
}
/*!
- Same as subVars(), but in this case we return a string map
- with the matching keys (stripped of the prefix \a var and
- mapped to their values. The pairs are inserted into \a t
+ Same as subVars(), but in this case we return a config var
+ multimap with the matching keys (stripped of the prefix \a var
+ and mapped to their values. The pairs are inserted into \a t
*/
-void Config::subVarsAndValues(const QString& var, QStringPairMap& t) const
+void Config::subVarsAndValues(const QString& var, ConfigVarMultimap& t) const
{
QString varDot = var + QLatin1Char('.');
- QStringPairMap::ConstIterator v = stringPairMap.constBegin();
- while (v != stringPairMap.constEnd()) {
+ ConfigVarMultimap::ConstIterator v = configVars_.constBegin();
+ while (v != configVars_.constEnd()) {
if (v.key().startsWith(varDot)) {
QString subVar = v.key().mid(varDot.length());
int dot = subVar.indexOf(QLatin1Char('.'));
@@ -559,7 +596,7 @@ QStringList Config::getAllFiles(const QString &filesVar,
const QSet<QString> &excludedFiles)
{
QStringList result = getStringList(filesVar);
- QStringList dirs = getCanonicalRelativePathList(dirsVar);
+ QStringList dirs = getCanonicalPathList(dirsVar);
QString nameFilter = getString(filesVar + dot + QLatin1String(CONFIG_FILEEXTENSIONS));
@@ -575,7 +612,7 @@ QStringList Config::getExampleQdocFiles(const QSet<QString> &excludedDirs,
const QSet<QString> &excludedFiles)
{
QStringList result;
- QStringList dirs = getCanonicalRelativePathList("exampledirs");
+ QStringList dirs = getCanonicalPathList("exampledirs");
QString nameFilter = " *.qdoc";
QStringList::ConstIterator d = dirs.constBegin();
@@ -590,7 +627,7 @@ QStringList Config::getExampleImageFiles(const QSet<QString> &excludedDirs,
const QSet<QString> &excludedFiles)
{
QStringList result;
- QStringList dirs = getCanonicalRelativePathList("exampledirs");
+ QStringList dirs = getCanonicalPathList("exampledirs");
QString nameFilter = getString(CONFIG_EXAMPLES + dot + QLatin1String(CONFIG_IMAGEEXTENSIONS));
QStringList::ConstIterator d = dirs.constBegin();
@@ -869,7 +906,7 @@ void Config::load(Location location, const QString& fileName)
Location keyLoc = location;
bool plus = false;
QString stringValue;
- QStringList stringListValue;
+ QStringList rhsValues;
QString word;
bool inQuote = false;
bool prevWordQuoted = true;
@@ -931,6 +968,7 @@ void Config::load(Location location, const QString& fileName)
else {
/*
It wasn't an include statement, so it's something else.
+ We must see either '=' or '+=' next. If not, fatal error.
*/
if (cc == '+') {
plus = true;
@@ -972,7 +1010,12 @@ void Config::load(Location location, const QString& fileName)
if (metWord)
stringValue += QLatin1Char(' ');
stringValue += word;
- stringListValue << word;
+#if 0
+ if (metWord)
+ rhsValues << QString(" " + word);
+ else
+#endif
+ rhsValues << word;
metWord = true;
word.clear();
prevWordQuoted = false;
@@ -988,7 +1031,7 @@ void Config::load(Location location, const QString& fileName)
stringValue += QLatin1Char(' ');
stringValue += word;
if (!word.isEmpty())
- stringListValue << word;
+ rhsValues << word;
metWord = true;
word.clear();
prevWordQuoted = true;
@@ -1025,30 +1068,9 @@ void Config::load(Location location, const QString& fileName)
if (!keySyntax.exactMatch(*key))
keyLoc.fatal(tr("Invalid key '%1'").arg(*key));
- if (plus) {
- if (locMap[*key].isEmpty()) {
- locMap[*key] = keyLoc;
- }
- else {
- locMap[*key].setEtc(true);
- }
- if (stringPairMap[*key].second.isEmpty()) {
- stringPairMap[*key].first = QDir::currentPath();
- stringPairMap[*key].second = stringValue;
- }
- else {
- stringPairMap[*key].second += QLatin1Char(' ') + stringValue;
- }
- stringListPairMap[*key].first = QDir::currentPath();
- stringListPairMap[*key].second += stringListValue;
- }
- else {
- locMap[*key] = keyLoc;
- stringPairMap[*key].first = QDir::currentPath();
- stringPairMap[*key].second = stringValue;
- stringListPairMap[*key].first = QDir::currentPath();
- stringListPairMap[*key].second = stringListValue;
- }
+ ConfigVarMultimap::Iterator i;
+ i = configVars_.insert(*key, ConfigVar(*key, rhsValues, QDir::currentPath(), keyLoc));
+ i.value().plus_ = (plus ? true : false);
++key;
}
}
@@ -1058,8 +1080,9 @@ void Config::load(Location location, const QString& fileName)
}
}
popWorkingDir();
- if (!workingDirs_.isEmpty())
- QDir::setCurrent(QFileInfo(workingDirs_.top()).path());
+ if (!workingDirs_.isEmpty()) {
+ QDir::setCurrent(workingDirs_.top());
+ }
}
QStringList Config::getFilesHere(const QString& uncleanDir,
@@ -1068,8 +1091,7 @@ QStringList Config::getFilesHere(const QString& uncleanDir,
const QSet<QString> &excludedDirs,
const QSet<QString> &excludedFiles)
{
- //
- QString dir = location.isEmpty() ? QDir::cleanPath(uncleanDir) : location.canonicalRelativePath(uncleanDir);
+ QString dir = location.isEmpty() ? QDir::cleanPath(uncleanDir) : Location::canonicalRelativePath(uncleanDir);
QStringList result;
if (excludedDirs.contains(dir))
return result;
diff --git a/src/tools/qdoc/config.h b/src/tools/qdoc/config.h
index e21998070a..f23873b8f9 100644
--- a/src/tools/qdoc/config.h
+++ b/src/tools/qdoc/config.h
@@ -56,19 +56,29 @@
QT_BEGIN_NAMESPACE
/*
- In QStringPair, the first string is the path to a directory;
- the second string is some value.
+ This struct contains all the information for
+ one config variable found in a qdocconf file.
*/
-typedef QPair<QString, QString> QStringPair;
+struct ConfigVar {
+ bool plus_;
+ QString name_;
+ QStringList values_;
+ QString currentPath_;
+ Location location_;
+
+ ConfigVar() : plus_(false) { }
+
+ ConfigVar(const QString& name, const QStringList& values, const QString& dir)
+ : plus_(true), name_(name), values_(values), currentPath_(dir) { }
+
+ ConfigVar(const QString& name, const QStringList& values, const QString& dir, const Location& loc)
+ : plus_(false), name_(name), values_(values), currentPath_(dir), location_(loc) { }
+};
/*
- In QStringListPair, the first string is the path to a directory;
- the string list is a list of string values.
+ In this multimap, the key is a config variable name.
*/
-typedef QPair<QString, QStringList> QStringListPair;
-typedef QMultiMap<QString, QStringPair> QStringPairMultiMap;
-typedef QMap<QString, QStringPair> QStringPairMap;
-typedef QMap<QString, QStringListPair> QStringListPairMap;
+typedef QMultiMap<QString, ConfigVar> ConfigVarMultimap;
class Config
{
@@ -79,7 +89,6 @@ public:
~Config();
void load(const QString& fileName);
- void unload(const QString& fileName);
void setStringList(const QString& var, const QStringList& values);
const QString& programName() const { return prog; }
@@ -90,16 +99,15 @@ public:
QString getOutputDir() const;
QSet<QString> getOutputFormats() const;
QString getString(const QString& var) const;
- QString getPath(const QString& var) const;
QSet<QString> getStringSet(const QString& var) const;
QStringList getStringList(const QString& var) const;
- QStringList getCanonicalRelativePathList(const QString& var) const;
+ QStringList getCanonicalPathList(const QString& var) const;
QStringList getCleanPathList(const QString& var) const;
QStringList getPathList(const QString& var) const;
QRegExp getRegExp(const QString& var) const;
QList<QRegExp> getRegExpList(const QString& var) const;
QSet<QString> subVars(const QString& var) const;
- void subVarsAndValues(const QString& var, QStringPairMap& t) const;
+ void subVarsAndValues(const QString& var, ConfigVarMultimap& t) const;
QStringList getAllFiles(const QString& filesVar,
const QString& dirsVar,
const QSet<QString> &excludedDirs = QSet<QString>(),
@@ -146,12 +154,7 @@ private:
QString prog;
Location loc;
Location lastLocation_;
- QMap<QString, Location> locMap;
- QMap<QString, QString> stringValueMap;
- QMap<QString, QStringList> stringListValueMap;
-
- QStringPairMap stringPairMap;
- QStringListPairMap stringListPairMap;
+ ConfigVarMultimap configVars_;
static QMap<QString, QString> uncompressedFiles;
static QMap<QString, QString> extractedDirs;
diff --git a/src/tools/qdoc/ditaxmlgenerator.cpp b/src/tools/qdoc/ditaxmlgenerator.cpp
index a828101551..314dda3a9d 100644
--- a/src/tools/qdoc/ditaxmlgenerator.cpp
+++ b/src/tools/qdoc/ditaxmlgenerator.cpp
@@ -5829,8 +5829,11 @@ bool DitaXmlGenerator::writeMetadataElements(const InnerNode* inner,
QString DitaXmlGenerator::getMetadataElement(const InnerNode* inner, DitaXmlGenerator::DitaTag t)
{
QString s = Generator::getMetadataElement(inner, ditaTags[t]);
- if (s.isEmpty())
- s = metadataDefault(t);
+ if (s.isEmpty()) {
+ QStringList sl = metadataDefault(t);
+ if (!sl.isEmpty())
+ s = sl[0];
+ }
return s;
}
@@ -5850,7 +5853,7 @@ QStringList DitaXmlGenerator::getMetadataElements(const InnerNode* inner,
{
QStringList s = Generator::getMetadataElements(inner,ditaTags[t]);
if (s.isEmpty())
- s.append(metadataDefault(t));
+ s = metadataDefault(t);
return s;
}
@@ -5858,9 +5861,9 @@ QStringList DitaXmlGenerator::getMetadataElements(const InnerNode* inner,
Returns the value of key \a t or an empty string
if \a t is not found in the map.
*/
-QString DitaXmlGenerator::metadataDefault(DitaTag t) const
+QStringList DitaXmlGenerator::metadataDefault(DitaTag t) const
{
- return metadataDefaults.value(ditaTags[t]).second;
+ return metadataDefaults.value(ditaTags[t]).values_;
}
/*!
diff --git a/src/tools/qdoc/ditaxmlgenerator.h b/src/tools/qdoc/ditaxmlgenerator.h
index 15ef4260b2..a55ccf81c8 100644
--- a/src/tools/qdoc/ditaxmlgenerator.h
+++ b/src/tools/qdoc/ditaxmlgenerator.h
@@ -458,7 +458,7 @@ private:
int leaveSection();
bool inSection() const { return (sectionNestingLevel > 0); }
int currentSectionNestingLevel() const { return sectionNestingLevel; }
- QString metadataDefault(DitaTag t) const;
+ QStringList metadataDefault(DitaTag t) const;
QString stripMarkup(const QString& src) const;
Node* collectNodesByTypeAndSubtype(const InnerNode* parent);
void writeDitaRefs(const DitaRefList& ditarefs);
@@ -507,7 +507,7 @@ private:
static QString ditaTags[];
QStack<QXmlStreamWriter*> xmlWriterStack;
QStack<DitaTag> tagStack;
- QStringPairMap metadataDefaults;
+ ConfigVarMultimap metadataDefaults;
QVector<NodeMultiMap*> nodeTypeMaps;
QVector<NodeMultiMap*> nodeSubtypeMaps;
QVector<NodeMultiMap*> pageTypeMaps;
diff --git a/src/tools/qdoc/location.cpp b/src/tools/qdoc/location.cpp
index 86329b9190..64a635115e 100644
--- a/src/tools/qdoc/location.cpp
+++ b/src/tools/qdoc/location.cpp
@@ -229,15 +229,13 @@ QString Location::fileName() const
/*!
- * \brief Returns \a path which is canonicalized and relative to the config file.
- *
- * QDir::relativeFilePath does not canonicalize the paths, so
- * if the config file is located at qtbase\src\widgets\doc\qtwidgets.qdocconf
- * and it has a reference to any ancestor folder (e.g. ".." or even "../doc")
- * \param path
- * \return
+ \brief Returns \a path which is canonicalized and relative to the config file.
+
+ QDir::relativeFilePath does not canonicalize the paths, so
+ if the config file is located at qtbase\src\widgets\doc\qtwidgets.qdocconf
+ and it has a reference to any ancestor folder (e.g. ".." or even "../doc")
*/
-QString Location::canonicalRelativePath(const QString &path) const
+QString Location::canonicalRelativePath(const QString &path)
{
QDir configFileDir(QDir::current());
QDir dir(path);
diff --git a/src/tools/qdoc/location.h b/src/tools/qdoc/location.h
index 20ddfd076e..33472810d3 100644
--- a/src/tools/qdoc/location.h
+++ b/src/tools/qdoc/location.h
@@ -81,7 +81,6 @@ public:
int depth() const { return stkDepth; }
const QString& filePath() const { return stkTop->filePath; }
QString fileName() const;
- QString canonicalRelativePath(const QString &path) const;
int lineNo() const { return stkTop->lineNo; }
int columnNo() const { return stkTop->columnNo; }
bool etc() const { return etcetera; }
@@ -101,6 +100,7 @@ public:
static void logToStdErr(const QString& message);
static void startLoggingProgress() { logProgress_ = true; }
static void stopLoggingProgress() { logProgress_ = false; }
+ static QString canonicalRelativePath(const QString &path);
private:
enum MessageType { Warning, Error };
diff --git a/src/tools/qdoc/main.cpp b/src/tools/qdoc/main.cpp
index a4e35c5f96..ef8a6fd9c5 100644
--- a/src/tools/qdoc/main.cpp
+++ b/src/tools/qdoc/main.cpp
@@ -360,7 +360,7 @@ static void processQdocconfFile(const QString &fileName)
QStringList excludedFilesList;
Generator::debugSegfault("Reading excludedirs");
- excludedDirsList = config.getCanonicalRelativePathList(CONFIG_EXCLUDEDIRS);
+ excludedDirsList = config.getCanonicalPathList(CONFIG_EXCLUDEDIRS);
foreach (const QString &excludeDir, excludedDirsList) {
QString p = QDir::fromNativeSeparators(excludeDir);
QDir tmp(p);
diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm
index b2bf2c5565..8ff6419075 100644
--- a/src/widgets/styles/qmacstyle_mac.mm
+++ b/src/widgets/styles/qmacstyle_mac.mm
@@ -1660,7 +1660,20 @@ void QMacStylePrivate::drawColorlessButton(const HIRect &macRect, HIThemeButtonD
extraHeight = 0,
finalyoff = 0;
- const QStyleOptionComboBox *combo = qstyleoption_cast<const QStyleOptionComboBox *>(opt);
+ const bool combo = opt->type == QStyleOption::SO_ComboBox;
+ const bool button = opt->type == QStyleOption::SO_Button;
+ const bool pressed = bdi->state == kThemeStatePressed;
+
+ if (button && pressed) {
+ if (bdi->kind == kThemePushButton) {
+ extraHeight = 2;
+ } else if (bdi->kind == kThemePushButtonSmall) {
+ xoff = 1;
+ extraWidth = 2;
+ extraHeight = 5;
+ }
+ }
+
int width = int(macRect.size.width) + extraWidth;
int height = int(macRect.size.height) + extraHeight;
@@ -1668,8 +1681,9 @@ void QMacStylePrivate::drawColorlessButton(const HIRect &macRect, HIThemeButtonD
return; // nothing to draw
QString key = QLatin1String("$qt_mac_style_ctb_") + QString::number(bdi->kind) + QLatin1Char('_')
- + QString::number(bdi->value) + QLatin1Char('_') + QString::number(width)
- + QLatin1Char('_') + QString::number(height);
+ + QString::number(bdi->value) + QLatin1Char('_')
+ + (button ? QString::number(bdi->state) + QLatin1Char('_') : QString())
+ + QLatin1Char('_') + QString::number(width) + QLatin1Char('_') + QString::number(height);
QPixmap pm;
if (!QPixmapCache::find(key, pm)) {
QPixmap activePixmap(width, height);
@@ -1680,17 +1694,18 @@ void QMacStylePrivate::drawColorlessButton(const HIRect &macRect, HIThemeButtonD
// ourselves, if a scaled version is needed.
QPainter tmpPainter(&activePixmap);
QMacStylePrivate::drawCombobox(macRect, *bdi, &tmpPainter);
- }
- else {
+ } else {
QMacCGContext cg(&activePixmap);
HIRect newRect = CGRectMake(xoff, yoff, macRect.size.width, macRect.size.height);
+ if (button && pressed)
+ bdi->state = kThemeStateActive;
HIThemeDrawButton(&newRect, bdi, cg, kHIThemeOrientationNormal, 0);
}
}
- if (!combo && bdi->value == kThemeButtonOff) {
+ if (!combo && !button && bdi->value == kThemeButtonOff) {
pm = activePixmap;
- } else if (combo) {
+ } else if (combo || button) {
QImage image = activePixmap.toImage();
for (int y = 0; y < height; ++y) {
@@ -1711,6 +1726,8 @@ void QMacStylePrivate::drawColorlessButton(const HIRect &macRect, HIThemeButtonD
qSwap(darkest, mid);
int gray = (mid + 2 * lightest) / 3;
+ if (pressed)
+ gray *= 0.88;
pixel = qRgba(gray, gray, gray, qAlpha(pixel));
}
}
@@ -1753,7 +1770,7 @@ void QMacStylePrivate::drawColorlessButton(const HIRect &macRect, HIThemeButtonD
}
QPixmapCache::insert(key, pm);
}
- p->drawPixmap(int(macRect.origin.x), int(macRect.origin.y) + finalyoff, width, height, pm);
+ p->drawPixmap(int(macRect.origin.x) - xoff, int(macRect.origin.y) + finalyoff, width, height, pm);
}
QMacStyle::QMacStyle()
@@ -3539,23 +3556,52 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
newRect.origin.y += QMacStylePrivate::PushButtonTopOffset;
newRect.size.width -= QMacStylePrivate::PushButtonRightOffset - 4;
}
- HIThemeDrawButton(&newRect, &bdi, cg, kHIThemeOrientationNormal, 0);
- if (btn->features & QStyleOptionButton::HasMenu) {
+ bool hasMenu = btn->features & QStyleOptionButton::HasMenu;
+ if (hasMenu && bdi.state == kThemeStatePressed && QSysInfo::macVersion() > QSysInfo::MV_10_6)
+ d->drawColorlessButton(newRect, &bdi, p, opt);
+ else
+ HIThemeDrawButton(&newRect, &bdi, cg, kHIThemeOrientationNormal, 0);
+
+ if (hasMenu) {
int mbi = proxy()->pixelMetric(QStyle::PM_MenuButtonIndicator, btn, w);
QRect ir = btn->rect;
- int arrowYOffset = bdi.kind == kThemePushButton ? 4 : 2;
- HIRect arrowRect = CGRectMake(ir.right() - mbi - QMacStylePrivate::PushButtonRightOffset,
- ir.height() / 2 - arrowYOffset, mbi, ir.height() / 2);
+ int arrowXOffset = 0;
+ if (QSysInfo::macVersion() > QSysInfo::MV_10_6)
+ arrowXOffset = bdi.kind == kThemePushButton ? 6 :
+ bdi.kind == kThemePushButtonSmall ? 7 : 8;
+ int arrowYOffset;
+ if (QSysInfo::macVersion() > QSysInfo::MV_10_6)
+ arrowYOffset = bdi.kind == kThemePushButton ? 3 :
+ bdi.kind == kThemePushButtonSmall ? 1 : 2;
+ else
+ arrowYOffset = bdi.kind == kThemePushButton ? 4 : 2;
+ if (!w) {
+ // adjustment for Qt Quick Controls
+ arrowYOffset -= ir.top();
+ if (bdi.kind == kThemePushButtonSmall)
+ arrowYOffset += 1;
+ }
+ QRect ar = QRect(ir.right() - mbi - QMacStylePrivate::PushButtonRightOffset,
+ ir.height() / 2 - arrowYOffset, mbi, ir.height() / 2);
+ ar = visualRect(btn->direction, ir, ar);
+ HIRect arrowRect = CGRectMake(ar.x() + arrowXOffset, ar.y(), ar.width(), ar.height());
HIThemePopupArrowDrawInfo pdi;
pdi.version = qt_mac_hitheme_version;
pdi.state = tds == kThemeStateInactive ? kThemeStateActive : tds;
pdi.orientation = kThemeArrowDown;
- if (arrowRect.size.width < 8.)
- pdi.size = kThemeArrow5pt;
- else
- pdi.size = kThemeArrow9pt;
+ if (QSysInfo::macVersion() > QSysInfo::MV_10_6) {
+ if (bdi.kind == kThemePushButtonMini)
+ pdi.size = kThemeArrow5pt;
+ else if (bdi.kind == kThemePushButton || bdi.kind == kThemePushButtonSmall)
+ pdi.size = kThemeArrow7pt;
+ } else {
+ if (arrowRect.size.width < 8.)
+ pdi.size = kThemeArrow5pt;
+ else
+ pdi.size = kThemeArrow9pt;
+ }
HIThemeDrawPopupArrow(&arrowRect, &pdi, cg, kHIThemeOrientationNormal);
}
}
@@ -3621,8 +3667,12 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
QRect freeContentRect = btn->rect;
QRect textRect = itemTextRect(
btn->fontMetrics, freeContentRect, Qt::AlignCenter, btn->state & State_Enabled, btn->text);
- if (hasMenu)
- textRect.adjust(-1, 0, -1, 0);
+ if (hasMenu) {
+ if (QSysInfo::macVersion() > QSysInfo::MV_10_6)
+ textRect.moveTo(w ? 15 : 11, textRect.top()); // Supports Qt Quick Controls
+ else
+ textRect.adjust(-1, 0, -1, 0);
+ }
// Draw the icon:
if (hasIcon) {
int contentW = textRect.width();
@@ -3662,6 +3712,8 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
if (const QStyleOptionComboBox *cb = qstyleoption_cast<const QStyleOptionComboBox *>(opt)) {
QStyleOptionComboBox comboCopy = *cb;
comboCopy.direction = Qt::LeftToRight;
+ if ((opt->state & QStyle::State_Small) && QSysInfo::macVersion() > QSysInfo::MV_10_6)
+ comboCopy.rect.translate(0, w ? -1 : -2); // Supports Qt Quick Controls
QCommonStyle::drawControl(CE_ComboBoxLabel, &comboCopy, p, w);
}
break;
diff --git a/src/widgets/widgets.pro b/src/widgets/widgets.pro
index 18a4d57900..43f7ae8af3 100644
--- a/src/widgets/widgets.pro
+++ b/src/widgets/widgets.pro
@@ -7,6 +7,9 @@ DEFINES += QT_NO_USING_NAMESPACE
win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x65000000
irix-cc*:QMAKE_CXXFLAGS += -no_prelink -ptused
+MODULE_PLUGIN_TYPES = \
+ accessible
+
QMAKE_DOCS = $$PWD/doc/qtwidgets.qdocconf
load(qt_module)
diff --git a/src/widgets/widgets/qplaintextedit.cpp b/src/widgets/widgets/qplaintextedit.cpp
index 95271adeb0..5a8da45a88 100644
--- a/src/widgets/widgets/qplaintextedit.cpp
+++ b/src/widgets/widgets/qplaintextedit.cpp
@@ -2223,11 +2223,57 @@ void QPlainTextEdit::changeEvent(QEvent *e)
#ifndef QT_NO_WHEELEVENT
void QPlainTextEdit::wheelEvent(QWheelEvent *e)
{
+ Q_D(QPlainTextEdit);
+ if (!(d->control->textInteractionFlags() & Qt::TextEditable)) {
+ if (e->modifiers() & Qt::ControlModifier) {
+ const int delta = e->delta();
+ if (delta < 0)
+ zoomOut();
+ else if (delta > 0)
+ zoomIn();
+ return;
+ }
+ }
QAbstractScrollArea::wheelEvent(e);
updateMicroFocus();
}
#endif
+/*!
+ \fn QPlainTextEdit::zoomIn(int range)
+
+ Zooms in on the text by making the base font size \a range
+ points larger and recalculating all font sizes to be the new size.
+ This does not change the size of any images.
+
+ \sa zoomOut()
+*/
+void QPlainTextEdit::zoomIn(int range)
+{
+ QFont f = font();
+ const int newSize = f.pointSize() + range;
+ if (newSize <= 0)
+ return;
+ f.setPointSize(newSize);
+ setFont(f);
+}
+
+/*!
+ \fn QPlainTextEdit::zoomOut(int range)
+
+ \overload
+
+ Zooms out on the text by making the base font size \a range points
+ smaller and recalculating all font sizes to be the new size. This
+ does not change the size of any images.
+
+ \sa zoomIn()
+*/
+void QPlainTextEdit::zoomOut(int range)
+{
+ zoomIn(-range);
+}
+
#ifndef QT_NO_CONTEXTMENU
/*! This function creates the standard context menu which is shown
when the user clicks on the line edit with the right mouse
diff --git a/src/widgets/widgets/qplaintextedit.h b/src/widgets/widgets/qplaintextedit.h
index 42e8288cf3..81548818ef 100644
--- a/src/widgets/widgets/qplaintextedit.h
+++ b/src/widgets/widgets/qplaintextedit.h
@@ -202,6 +202,9 @@ public Q_SLOTS:
void centerCursor();
+ void zoomIn(int range = 1);
+ void zoomOut(int range = 1);
+
Q_SIGNALS:
void textChanged();
void undoAvailable(bool b);
diff --git a/src/widgets/widgets/qtextedit.cpp b/src/widgets/widgets/qtextedit.cpp
index bf2c8a4495..4b3bf6de65 100644
--- a/src/widgets/widgets/qtextedit.cpp
+++ b/src/widgets/widgets/qtextedit.cpp
@@ -445,6 +445,8 @@ void QTextEditPrivate::_q_ensureVisible(const QRectF &_rect)
example, the documentTitle() function will return the text from
within HTML \c{<title>} tags.
+ \note Zooming into HTML documents only works if the font-size is not set to a fixed size.
+
\section1 Using QTextEdit as an Editor
All the information about using QTextEdit as a display widget also