summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/angle/src/config.pri2
-rw-r--r--src/angle/src/libGLESv2/libGLESv2.pro4
-rw-r--r--src/corelib/Qt5CTestMacros.cmake80
-rw-r--r--src/corelib/codecs/codecs.qdoc6
-rw-r--r--src/corelib/doc/snippets/code/src_corelib_tools_qregularexpression.cpp124
-rw-r--r--src/corelib/doc/snippets/qprocess/qprocess-simpleexecution.cpp2
-rw-r--r--src/corelib/doc/src/animation.qdoc8
-rw-r--r--src/corelib/doc/src/containers.qdoc30
-rw-r--r--src/corelib/doc/src/datastreamformat.qdoc4
-rw-r--r--src/corelib/doc/src/eventsandfilters.qdoc7
-rw-r--r--src/corelib/doc/src/implicit-sharing.qdoc6
-rw-r--r--src/corelib/doc/src/io.qdoc8
-rw-r--r--src/corelib/doc/src/json.qdoc3
-rw-r--r--src/corelib/doc/src/plugins-howto.qdoc8
-rw-r--r--src/corelib/doc/src/qtcore-index.qdoc119
-rw-r--r--src/corelib/doc/src/qtcore.qdoc7
-rw-r--r--src/corelib/doc/src/statemachine.qdoc7
-rw-r--r--src/corelib/doc/src/threads.qdoc28
-rw-r--r--src/corelib/global/qfeatures.h5
-rw-r--r--src/corelib/global/qfeatures.txt7
-rw-r--r--src/corelib/global/qlibraryinfo.cpp8
-rw-r--r--src/corelib/global/qlibraryinfo.h4
-rw-r--r--src/corelib/global/qnamespace.h5
-rw-r--r--src/corelib/global/qnamespace.qdoc19
-rw-r--r--src/corelib/global/qt_windows.h13
-rw-r--r--src/corelib/io/io.pri4
-rw-r--r--src/corelib/io/qfilesystemengine.cpp7
-rw-r--r--src/corelib/io/qfilesystemwatcher.cpp7
-rw-r--r--src/corelib/io/qfilesystemwatcher_inotify.cpp8
-rw-r--r--src/corelib/io/qprocess.cpp4
-rw-r--r--src/corelib/io/qstandardpaths.cpp2
-rw-r--r--src/corelib/io/qstandardpaths_json.cpp258
-rw-r--r--src/corelib/io/qwindowspipereader.cpp8
-rw-r--r--src/corelib/itemmodels/qabstractitemmodel_p.h2
-rw-r--r--src/corelib/kernel/qcoreapplication.cpp28
-rw-r--r--src/corelib/kernel/qcoreapplication.h6
-rw-r--r--src/corelib/kernel/qcoreevent.cpp1
-rw-r--r--src/corelib/kernel/qcoreevent.h2
-rw-r--r--src/corelib/kernel/qeventdispatcher_blackberry.cpp55
-rw-r--r--src/corelib/kernel/qeventdispatcher_blackberry_p.h6
-rw-r--r--src/corelib/kernel/qeventdispatcher_unix.cpp57
-rw-r--r--src/corelib/kernel/qeventdispatcher_unix_p.h2
-rw-r--r--src/corelib/kernel/qmath.h48
-rw-r--r--src/corelib/kernel/qmimedata.cpp3
-rw-r--r--src/corelib/thread/qfutureinterface.cpp10
-rw-r--r--src/corelib/thread/qfutureinterface.h15
-rw-r--r--src/corelib/thread/qfutureinterface_p.h26
-rw-r--r--src/corelib/tools/qdatetime.cpp114
-rw-r--r--src/corelib/tools/qdatetime.h4
-rw-r--r--src/corelib/tools/qmap.cpp18
-rw-r--r--src/corelib/tools/qmap.h12
-rw-r--r--src/corelib/tools/qregexp.cpp3
-rw-r--r--src/corelib/tools/qvector.h6
-rw-r--r--src/dbus/qdbusdemarshaller.cpp1
-rw-r--r--src/gui/accessible/qaccessible.cpp3
-rw-r--r--src/gui/accessible/qaccessible.h4
-rw-r--r--src/gui/image/qimage.cpp10
-rw-r--r--src/gui/image/qpnghandler.cpp7
-rw-r--r--src/gui/itemmodels/qstandarditemmodel.cpp18
-rw-r--r--src/gui/kernel/qguiapplication.cpp20
-rw-r--r--src/gui/kernel/qguiapplication_p.h1
-rw-r--r--src/gui/kernel/qplatformintegration.cpp4
-rw-r--r--src/gui/kernel/qplatformintegration.h11
-rw-r--r--src/gui/kernel/qplatformmenu.h1
-rw-r--r--src/gui/kernel/qwindow.cpp54
-rw-r--r--src/gui/kernel/qwindow.h19
-rw-r--r--src/gui/kernel/qwindow_p.h1
-rw-r--r--src/gui/opengl/qopenglframebufferobject.cpp1
-rw-r--r--src/gui/painting/qpainter.cpp5
-rw-r--r--src/gui/painting/qpathclipper.cpp1
-rw-r--r--src/gui/text/qfontengine.cpp7
-rw-r--r--src/gui/text/qsyntaxhighlighter.cpp29
-rw-r--r--src/gui/text/qtextlayout.cpp4
-rw-r--r--src/network/access/qhttpnetworkconnectionchannel.cpp1
-rw-r--r--src/network/access/qhttpnetworkrequest.cpp9
-rw-r--r--src/network/access/qnetworkrequest.cpp12
-rw-r--r--src/network/kernel/qnetworkproxy.cpp10
-rw-r--r--src/network/kernel/qnetworkproxy_blackberry.cpp23
-rw-r--r--src/network/socket/socket.pri4
-rw-r--r--src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp4
-rw-r--r--src/opengl/qglframebufferobject.cpp1
-rw-r--r--src/platformsupport/dnd/qsimpledrag.cpp15
-rw-r--r--src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm4
-rw-r--r--src/platformsupport/linuxaccessibility/atspiadaptor.cpp8
-rw-r--r--src/plugins/accessible/qaccessiblebase.pri2
-rw-r--r--src/plugins/accessible/widgets/itemviews.cpp30
-rw-r--r--src/plugins/accessible/widgets/qaccessiblewidgets.cpp5
-rw-r--r--src/plugins/accessible/widgets/qaccessiblewidgets.h1
-rw-r--r--src/plugins/accessible/widgets/simplewidgets.cpp17
-rw-r--r--src/plugins/accessible/widgets/widgets.pro4
-rw-r--r--src/plugins/bearer/blackberry/blackberry.pro6
-rw-r--r--src/plugins/bearer/blackberry/qbbengine.cpp5
-rw-r--r--src/plugins/bearer/connman/connman.pro6
-rw-r--r--src/plugins/bearer/corewlan/corewlan.pro6
-rw-r--r--src/plugins/bearer/generic/generic.pro6
-rw-r--r--src/plugins/bearer/nativewifi/nativewifi.pro6
-rw-r--r--src/plugins/bearer/networkmanager/networkmanager.pro6
-rw-r--r--src/plugins/bearer/nla/nla.pro6
-rw-r--r--src/plugins/generic/evdevkeyboard/evdevkeyboard.pro6
-rw-r--r--src/plugins/generic/evdevmouse/evdevmouse.pro6
-rw-r--r--src/plugins/generic/evdevtablet/evdevtablet.pro6
-rw-r--r--src/plugins/generic/evdevtouch/evdevtouch.pro6
-rw-r--r--src/plugins/generic/meego/meego.pro7
-rw-r--r--src/plugins/generic/tslib/tslib.pro6
-rw-r--r--src/plugins/imageformats/gif/gif.pro6
-rw-r--r--src/plugins/imageformats/ico/ico.pro6
-rw-r--r--src/plugins/imageformats/jpeg/jpeg.pro6
-rw-r--r--src/plugins/platforminputcontexts/ibus/ibus.pro7
-rw-r--r--src/plugins/platforminputcontexts/maliit/maliit.pro7
-rw-r--r--src/plugins/platforms/cocoa/cocoa.pro5
-rw-r--r--src/plugins/platforms/cocoa/qcocoaintegration.h2
-rw-r--r--src/plugins/platforms/cocoa/qcocoaintegration.mm20
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenu.h1
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenu.mm6
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenuitem.mm2
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.h1
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.mm15
-rw-r--r--src/plugins/platforms/cocoa/qnsview.h3
-rw-r--r--src/plugins/platforms/cocoa/qnsview.mm105
-rw-r--r--src/plugins/platforms/cocoa/qprintengine_mac.mm4
-rw-r--r--src/plugins/platforms/directfb/directfb.pro5
-rw-r--r--src/plugins/platforms/eglfs/eglfs.pro7
-rw-r--r--src/plugins/platforms/eglfs/qeglfswindow.cpp3
-rw-r--r--src/plugins/platforms/kms/kms.pro6
-rw-r--r--src/plugins/platforms/linuxfb/linuxfb.pro7
-rw-r--r--src/plugins/platforms/minimal/minimal.pro6
-rw-r--r--src/plugins/platforms/minimal/qminimalintegration.cpp1
-rw-r--r--src/plugins/platforms/minimalegl/minimalegl.pro7
-rw-r--r--src/plugins/platforms/openwfd/openwf.pro5
-rw-r--r--src/plugins/platforms/qnx/qnx.pro6
-rw-r--r--src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp5
-rw-r--r--src/plugins/platforms/qnx/qqnxwindow.cpp14
-rw-r--r--src/plugins/platforms/windows/accessible/iaccessible2.cpp27
-rw-r--r--src/plugins/platforms/windows/qwindowsdialoghelpers.cpp504
-rw-r--r--src/plugins/platforms/windows/qwindowsdrag.cpp72
-rw-r--r--src/plugins/platforms/windows/qwindowsdrag.h6
-rw-r--r--src/plugins/platforms/windows/qwindowsintegration.cpp8
-rw-r--r--src/plugins/platforms/windows/qwindowsintegration.h4
-rw-r--r--src/plugins/platforms/windows/qwindowstheme.cpp2
-rw-r--r--src/plugins/platforms/windows/windows.pro6
-rw-r--r--src/plugins/platforms/xcb/qxcbcursor.cpp17
-rw-r--r--src/plugins/platforms/xcb/qxcbcursor.h2
-rw-r--r--src/plugins/platforms/xcb/qxcbintegration.cpp5
-rw-r--r--src/plugins/platforms/xcb/qxcbnativeinterface.cpp19
-rw-r--r--src/plugins/platforms/xcb/qxcbnativeinterface.h4
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.cpp18
-rw-r--r--src/plugins/platforms/xcb/xcb.pro5
-rw-r--r--src/plugins/printsupport/cocoa/cocoa.pro6
-rw-r--r--src/plugins/printsupport/cups/cups.pro6
-rw-r--r--src/plugins/printsupport/windows/windows.pro7
-rw-r--r--src/plugins/qpluginbase.pri1
-rw-r--r--src/plugins/sqldrivers/qsqldriverbase.pri6
-rw-r--r--src/printsupport/kernel/qprintengine_pdf.cpp9
-rw-r--r--src/printsupport/kernel/qprintengine_pdf_p.h2
-rw-r--r--src/printsupport/kernel/qprintengine_win.cpp16
-rw-r--r--src/sql/kernel/qsql.qdoc1
-rw-r--r--src/sql/models/qsqlrelationaldelegate.h11
-rw-r--r--src/testlib/qtestcase.cpp16
-rw-r--r--src/testlib/qtestlog.cpp10
-rw-r--r--src/testlib/qtestsystem.h6
-rw-r--r--src/tools/bootstrap/bootstrap.pri1
-rw-r--r--src/tools/bootstrap/bootstrap.pro1
-rw-r--r--src/tools/rcc/rcc.cpp2
-rw-r--r--src/widgets/dialogs/qdialog.cpp5
-rw-r--r--src/widgets/dialogs/qerrormessage.cpp16
-rw-r--r--src/widgets/dialogs/qfiledialog.cpp50
-rw-r--r--src/widgets/dialogs/qfiledialog_p.h1
-rw-r--r--src/widgets/dialogs/qprogressdialog.cpp22
-rw-r--r--src/widgets/dialogs/qwizard.cpp56
-rw-r--r--src/widgets/itemviews/qabstractitemview.cpp29
-rw-r--r--src/widgets/itemviews/qabstractitemview_p.h4
-rw-r--r--src/widgets/itemviews/qcolumnview.cpp2
-rw-r--r--src/widgets/itemviews/qfileiconprovider.cpp6
-rw-r--r--src/widgets/itemviews/qheaderview.cpp2
-rw-r--r--src/widgets/itemviews/qitemeditorfactory.cpp2
-rw-r--r--src/widgets/itemviews/qstyleditemdelegate.cpp4
-rw-r--r--src/widgets/itemviews/qtableview.cpp8
-rw-r--r--src/widgets/itemviews/qtreeview.cpp2
-rw-r--r--src/widgets/itemviews/qtreewidget.cpp2
-rw-r--r--src/widgets/itemviews/qtreewidgetitemiterator.cpp2
-rw-r--r--src/widgets/kernel/kernel.pri3
-rw-r--r--src/widgets/kernel/qaction.cpp51
-rw-r--r--src/widgets/kernel/qaction.h14
-rw-r--r--src/widgets/kernel/qaction_p.h4
-rw-r--r--src/widgets/kernel/qapplication.cpp3
-rw-r--r--src/widgets/kernel/qsoftkeymanager.cpp270
-rw-r--r--src/widgets/kernel/qsoftkeymanager_common_p.h85
-rw-r--r--src/widgets/kernel/qsoftkeymanager_p.h112
-rw-r--r--src/widgets/kernel/qwidget.cpp37
-rw-r--r--src/widgets/kernel/qwidgetwindow.cpp12
-rw-r--r--src/widgets/statemachine/qguistatemachine.cpp4
-rw-r--r--src/widgets/styles/qcommonstyle.cpp11
-rw-r--r--src/widgets/styles/qmacstyle_mac.mm9
-rw-r--r--src/widgets/styles/qstyleanimation.cpp45
-rw-r--r--src/widgets/styles/qstyleanimation_p.h24
-rw-r--r--src/widgets/styles/qstylehelper.cpp17
-rw-r--r--src/widgets/styles/qstylehelper_p.h2
-rw-r--r--src/widgets/styles/qwindowsvistastyle.cpp53
-rw-r--r--src/widgets/util/qsystemtrayicon_win.cpp14
-rw-r--r--src/widgets/widgets/qcombobox.cpp50
-rw-r--r--src/widgets/widgets/qcombobox.h4
-rw-r--r--src/widgets/widgets/qcombobox_p.h4
-rw-r--r--src/widgets/widgets/qdialogbuttonbox.cpp134
-rw-r--r--src/widgets/widgets/qlineedit.h1
-rw-r--r--src/widgets/widgets/qmenu.cpp23
-rw-r--r--src/widgets/widgets/qmenubar.cpp14
-rw-r--r--src/widgets/widgets/qmenubar_p.h3
207 files changed, 1991 insertions, 1958 deletions
diff --git a/src/angle/src/config.pri b/src/angle/src/config.pri
index 3770d6ef09..7aedbc92cb 100644
--- a/src/angle/src/config.pri
+++ b/src/angle/src/config.pri
@@ -13,7 +13,7 @@ isEmpty(ANGLE_DIR) {
}
win32 {
- GNUTOOLS_DIR=$$[QT_HOST_DATA]/../gnuwin32/bin
+ GNUTOOLS_DIR=$$PWD/../../../../gnuwin32/bin
exists($$GNUTOOLS_DIR/gperf.exe) {
GNUTOOLS = "(set $$escape_expand(\\\")PATH=$$replace(GNUTOOLS_DIR, [/\\\\], $${QMAKE_DIR_SEP});%PATH%$$escape_expand(\\\"))"
}
diff --git a/src/angle/src/libGLESv2/libGLESv2.pro b/src/angle/src/libGLESv2/libGLESv2.pro
index a4e83ea10d..c8da379862 100644
--- a/src/angle/src/libGLESv2/libGLESv2.pro
+++ b/src/angle/src/libGLESv2/libGLESv2.pro
@@ -1,6 +1,7 @@
TEMPLATE = lib
TARGET = libGLESv2
DEPENDPATH += . shaders
+CONFIG += simd
include(../common/common.pri)
@@ -60,10 +61,11 @@ SOURCES += \
$$ANGLE_DIR/src/libGLESv2/ResourceManager.cpp \
$$ANGLE_DIR/src/libGLESv2/Shader.cpp \
$$ANGLE_DIR/src/libGLESv2/Texture.cpp \
- $$ANGLE_DIR/src/libGLESv2/TextureSSE2.cpp \
$$ANGLE_DIR/src/libGLESv2/utilities.cpp \
$$ANGLE_DIR/src/libGLESv2/VertexDataManager.cpp
+SSE2_SOURCES += $$ANGLE_DIR/src/libGLESv2/TextureSSE2.cpp
+
float_converter.target = float_converter
float_converter.commands = python $$ANGLE_DIR/src/libGLESv2/Float16ToFloat32.py \
> $$ANGLE_DIR/src/libGLESv2/Float16ToFloat32.cpp
diff --git a/src/corelib/Qt5CTestMacros.cmake b/src/corelib/Qt5CTestMacros.cmake
index 3d1b3b3191..715ad9356e 100644
--- a/src/corelib/Qt5CTestMacros.cmake
+++ b/src/corelib/Qt5CTestMacros.cmake
@@ -59,3 +59,83 @@ macro(expect_fail _dir)
--build-options "-DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}" ${BUILD_OPTIONS_LIST}
)
endmacro()
+
+function(test_module_includes)
+
+ set(all_args ${ARGN})
+ set(packages_string "")
+ set(libraries_string "")
+
+ foreach(_package ${Qt5_MODULE_TEST_DEPENDS})
+ set(packages_string
+ "
+ ${packages_string}
+ find_package(Qt5${_package} REQUIRED)
+ "
+ )
+ endforeach()
+
+ while(all_args)
+ list(GET all_args 0 qtmodule)
+ list(REMOVE_AT all_args 0 1)
+ set(packages_string
+ "${packages_string}
+ find_package(Qt5${qtmodule} REQUIRED)
+ include_directories(\${Qt5${qtmodule}_INCLUDE_DIRS})
+ add_definitions(\${Qt5${qtmodule}_DEFINITIONS})\n"
+ )
+ set(libraries_string "${libraries_string} Qt5::${qtmodule}")
+ endwhile()
+
+ file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/module_includes/CMakeLists.txt"
+ "
+ cmake_minimum_required(VERSION 2.8)
+ project(module_includes)
+
+ ${packages_string}
+
+ set(CMAKE_CXX_FLAGS \"\${CMAKE_CXX_FLAGS} \${Qt5Core_EXECUTABLE_COMPILE_FLAGS}\")
+
+ add_executable(module_includes_exe \"\${CMAKE_CURRENT_SOURCE_DIR}/main.cpp\")
+ target_link_libraries(module_includes_exe ${libraries_string})\n"
+ )
+
+ set(all_args ${ARGN})
+ set(includes_string "")
+ set(instances_string "")
+ while(all_args)
+ list(GET all_args 0 qtmodule)
+ list(GET all_args 1 qtinclude)
+ list(REMOVE_AT all_args 0 1)
+ set(includes_string
+ "${includes_string}
+ #include <${qtinclude}>
+ #include <Qt${qtmodule}/${qtinclude}>
+ #include <Qt${qtmodule}>
+ #include <Qt${qtmodule}/Qt${qtmodule}>"
+ )
+ set(instances_string
+ "${instances_string}
+ ${qtinclude} local${qtinclude};
+ ")
+ endwhile()
+
+ file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/module_includes/main.cpp"
+ "
+
+ ${includes_string}
+
+ int main(int, char **) { ${instances_string} return 0; }\n"
+ )
+
+ add_test(module_includes ${CMAKE_CTEST_COMMAND}
+ --build-and-test
+ "${CMAKE_CURRENT_BINARY_DIR}/module_includes/"
+ "${CMAKE_CURRENT_BINARY_DIR}/module_includes/build"
+ --build-config "${CMAKE_BUILD_TYPE}"
+ --build-generator ${CMAKE_GENERATOR}
+ --build-makeprogram ${CMAKE_MAKE_PROGRAM}
+ --build-project module_includes
+ --build-options "-DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}" ${BUILD_OPTIONS_LIST}
+ )
+endfunction()
diff --git a/src/corelib/codecs/codecs.qdoc b/src/corelib/codecs/codecs.qdoc
index b982302355..3a9f5c8f79 100644
--- a/src/corelib/codecs/codecs.qdoc
+++ b/src/corelib/codecs/codecs.qdoc
@@ -31,10 +31,10 @@
\ingroup groups
\brief Codec support in Qt.
- These codecs provide facilities for conversion between Unicode and
- specific text encodings.
+ These \l{Qt Core} codecs classes provide facilities for conversion between
+ Unicode and specific text encodings.
- \generatelist{related}
+ \annotatedlist codecs
*/
/*!
diff --git a/src/corelib/doc/snippets/code/src_corelib_tools_qregularexpression.cpp b/src/corelib/doc/snippets/code/src_corelib_tools_qregularexpression.cpp
index 6538c7178d..f1479a8ed7 100644
--- a/src/corelib/doc/snippets/code/src_corelib_tools_qregularexpression.cpp
+++ b/src/corelib/doc/snippets/code/src_corelib_tools_qregularexpression.cpp
@@ -38,17 +38,28 @@
**
****************************************************************************/
+#include <QString>
+#include <QStringList>
+#include <QRegularExpression>
+#include <QRegularExpressionMatch>
+#include <QRegularExpressionMatchIterator>
+
+int main() {
+
+{
//! [0]
QRegularExpression re("a pattern");
//! [0]
+}
-
+{
//! [1]
QRegularExpression re;
re.setPattern("another pattern");
//! [1]
+}
-
+{
//! [2]
// matches two digits followed by a space and a word
QRegularExpression re("\\d\\d \\w+");
@@ -56,27 +67,31 @@ QRegularExpression re("\\d\\d \\w+");
// matches a backslash
QRegularExpression re2("\\\\");
//! [2]
+}
-
+{
//! [3]
QRegularExpression re("a third pattern");
QString pattern = re.pattern(); // pattern == "a third pattern"
//! [3]
+}
-
+{
//! [4]
// matches "Qt rocks", but also "QT rocks", "QT ROCKS", "qT rOcKs", etc.
QRegularExpression re("Qt rocks", QRegularExpression::CaseInsensitiveOption);
//! [4]
+}
-
+{
//! [5]
QRegularExpression re("^\\d+$");
re.setPatternOptions(QRegularExpression::MultilineOption);
// re matches any line in the subject string that contains only digits (but at least one)
//! [5]
+}
-
+{
//! [6]
QRegularExpression re = QRegularExpression("^two.*words$", QRegularExpression::MultilineOption
| QRegularExpression::DotMatchesEverythingOption);
@@ -84,16 +99,18 @@ QRegularExpression re = QRegularExpression("^two.*words$", QRegularExpression::M
QRegularExpression::PatternOptions options = re.patternOptions();
// options == QRegularExpression::MultilineOption | QRegularExpression::DotMatchesEverythingOption
//! [6]
+}
-
+{
//! [7]
// match two digits followed by a space and a word
QRegularExpression re("\\d\\d \\w+");
QRegularExpressionMatch match = re.match("abc123 def");
bool hasMatch = match.hasMatch(); // true
//! [7]
+}
-
+{
//! [8]
QRegularExpression re("\\d\\d \\w+");
QRegularExpressionMatch match = re.match("abc123 def");
@@ -102,8 +119,9 @@ if (match.hasMatch()) {
// ...
}
//! [8]
+}
-
+{
//! [9]
QRegularExpression re("\\d\\d \\w+");
QRegularExpressionMatch match = re.match("12 abc 45 def", 1);
@@ -112,31 +130,34 @@ if (match.hasMatch()) {
// ...
}
//! [9]
+}
-
+{
//! [10]
QRegularExpression re("^(\\d\\d)/(\\d\\d)/(\\d\\d\\d\\d)$");
QRegularExpressionMatch match = re.match("08/12/1985");
if (match.hasMatch()) {
- QString day = re.captured(1); // day == "08"
- QString month = re.captured(2); // month == "12"
- QString year = re.captured(3); // year == "1985"
+ QString day = match.captured(1); // day == "08"
+ QString month = match.captured(2); // month == "12"
+ QString year = match.captured(3); // year == "1985"
// ...
}
//! [10]
+}
-
+{
//! [11]
QRegularExpression re("abc(\\d+)def");
QRegularExpressionMatch match = re.match("XYZabc123defXYZ");
if (match.hasMatch()) {
- int startOffset = re.capturedStart(1); // startOffset == 6
- int endOffset = re.capturedEnd(1); // endOffset == 9
+ int startOffset = match.capturedStart(1); // startOffset == 6
+ int endOffset = match.capturedEnd(1); // endOffset == 9
// ...
}
//! [11]
+}
-
+{
//! [12]
QRegularExpression re("^(?<date>\\d\\d)/(?<month>\\d\\d)/(?<year>\\d\\d\\d\\d)$");
QRegularExpressionMatch match = re.match("08/12/1985");
@@ -146,14 +167,14 @@ if (match.hasMatch()) {
QString year = match.captured("year"); // year == 1985
}
//! [12]
+}
-
+{
//! [13]
QRegularExpression re("(\\w+)");
QRegularExpressionMatchIterator i = re.globalMatch("the quick fox");
//! [13]
-
//! [14]
QStringList words;
while (i.hasNext()) {
@@ -163,72 +184,86 @@ while (i.hasNext()) {
}
// words contains "the", "quick", "fox"
//! [14]
+}
-
+{
//! [15]
QString pattern("^(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) \\d\\d?, \\d\\d\\d\\d$");
QRegularExpression re(pattern);
QString input("Jan 21,");
-QRegularExpressionMatch match = re.match(input, 0, QRegularExpressionMatch::PartialPreferCompleteMatch);
+QRegularExpressionMatch match = re.match(input, 0, QRegularExpression::PartialPreferCompleteMatch);
bool hasMatch = match.hasMatch(); // false
bool hasPartialMatch = match.hasPartialMatch(); // true
//! [15]
+}
-
+{
+QString pattern("^(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) \\d\\d?, \\d\\d\\d\\d$");
+QRegularExpression re(pattern);
//! [16]
QString input("Dec 8, 1985");
-QRegularExpressionMatch match = re.match(input, 0, QRegularExpressionMatch::PartialPreferCompleteMatch);
+QRegularExpressionMatch match = re.match(input, 0, QRegularExpression::PartialPreferCompleteMatch);
bool hasMatch = match.hasMatch(); // true
bool hasPartialMatch = match.hasPartialMatch(); // false
//! [16]
+}
-
+{
//! [17]
QRegularExpression re("abc\\w+X|def");
-QRegularExpressionMatch match = re.match("abcdef", 0, QRegularExpressionMatch::PartialPreferCompleteMatch);
+QRegularExpressionMatch match = re.match("abcdef", 0, QRegularExpression::PartialPreferCompleteMatch);
bool hasMatch = match.hasMatch(); // true
bool hasPartialMatch = match.hasPartialMatch(); // false
QString captured = match.captured(0); // captured == "def"
//! [17]
+}
-
+{
//! [18]
QRegularExpression re("abc\\w+X|defY");
-QRegularExpressionMatch match = re.match("abcdef", 0, QRegularExpressionMatch::PartialPreferCompleteMatch);
+QRegularExpressionMatch match = re.match("abcdef", 0, QRegularExpression::PartialPreferCompleteMatch);
bool hasMatch = match.hasMatch(); // false
bool hasPartialMatch = match.hasPartialMatch(); // true
QString captured = match.captured(0); // captured == "abcdef"
//! [18]
+}
-
+{
//! [19]
QRegularExpression re("abc|ab");
-QRegularExpressionMatch match = re.match("ab", 0, QRegularExpressionMatch::PartialPreferFirstMatch);
+QRegularExpressionMatch match = re.match("ab", 0, QRegularExpression::PartialPreferFirstMatch);
bool hasMatch = match.hasMatch(); // false
bool hasPartialMatch = match.hasPartialMatch(); // true
//! [19]
+}
-
+{
//! [20]
QRegularExpression re("abc(def)?");
-QRegularExpressionMatch match = re.match("abc", 0, QRegularExpressionMatch::PartialPreferFirstMatch);
+QRegularExpressionMatch match = re.match("abc", 0, QRegularExpression::PartialPreferFirstMatch);
bool hasMatch = match.hasMatch(); // false
bool hasPartialMatch = match.hasPartialMatch(); // true
//! [20]
+}
+{
//! [21]
QRegularExpression re("(abc)*");
-QRegularExpressionMatch match = re.match("abc", 0, QRegularExpressionMatch::PartialPreferFirstMatch);
+QRegularExpressionMatch match = re.match("abc", 0, QRegularExpression::PartialPreferFirstMatch);
bool hasMatch = match.hasMatch(); // false
bool hasPartialMatch = match.hasPartialMatch(); // true
//! [21]
+}
+{
//! [22]
QRegularExpression invalidRe("(unmatched|parenthesis");
bool isValid = invalidRe.isValid(); // false
//! [22]
+}
+{
//! [23]
QRegularExpression invalidRe("(unmatched|parenthesis");
if (!invalidRe.isValid()) {
@@ -237,44 +272,62 @@ if (!invalidRe.isValid()) {
// ...
}
//! [23]
+}
+{
//! [24]
QRegularExpression re("^this pattern must match exactly$");
//! [24]
+}
+{
//! [25]
QString p("a .*|pattern");
QRegularExpression re("\\A(?:" + p + ")\\z"); // re matches exactly the pattern string p
//! [25]
+}
+{
//! [26]
QString escaped = QRegularExpression::escape("a(x) = f(x) + g(x)");
// escaped == "a\\(x\\)\\ \\=\\ f\\(x\\)\\ \\+\\ g\\(x\\)"
//! [26]
+}
+{
+QString name;
+QString nickname;
//! [27]
QString pattern = "(" + QRegularExpression::escape(name) +
"|" + QRegularExpression::escape(nickname) + ")";
QRegularExpression re(pattern);
//! [27]
+}
+{
+QString string;
+QRegularExpression re;
//! [28]
-QRegularExpressionMatch match = re.match(...);
+QRegularExpressionMatch match = re.match(string);
for (int i = 0; i <= match.lastCapturedIndex(); ++i) {
QString captured = match.captured(i);
// ...
}
//! [28]
+}
+{
//! [29]
-QRegularExpression("(\\d\\d) (?<name>\\w+)");
+QRegularExpression re("(\\d\\d) (?<name>\\w+)");
QRegularExpressionMatch match = re.match("23 Jordan");
if (match.hasMatch()) {
QString number = match.captured(1); // first == "23"
QString name = match.captured("name"); // name == "Jordan"
}
//! [29]
+}
+{
//! [30]
// extracts the words
QRegularExpression re("(\\w+)");
@@ -285,5 +338,6 @@ while (i.hasNext()) {
// ...
}
//! [30]
+}
-
+}
diff --git a/src/corelib/doc/snippets/qprocess/qprocess-simpleexecution.cpp b/src/corelib/doc/snippets/qprocess/qprocess-simpleexecution.cpp
index e7c1c36e9d..8181cb04dd 100644
--- a/src/corelib/doc/snippets/qprocess/qprocess-simpleexecution.cpp
+++ b/src/corelib/doc/snippets/qprocess/qprocess-simpleexecution.cpp
@@ -56,7 +56,7 @@ int main(int argc, char *argv[])
//! [2]
QStringList arguments;
- arguments << "-style" << "motif";
+ arguments << "-style" << "fusion";
QProcess *myProcess = new QProcess(parent);
myProcess->start(program, arguments);
diff --git a/src/corelib/doc/src/animation.qdoc b/src/corelib/doc/src/animation.qdoc
index c76845c93c..7724d533d6 100644
--- a/src/corelib/doc/src/animation.qdoc
+++ b/src/corelib/doc/src/animation.qdoc
@@ -28,6 +28,11 @@
/*!
\group animation
\title Animation Framework
+
+ This page lists classes belonging to \l{Qt Core}'s
+ \l{The Animation Framework}{animation framework}.
+
+ \annotatedlist animation
*/
/*!
@@ -102,7 +107,7 @@
the framework, please look up their class descriptions.
\section1 Classes in the Animation Framework
-
+
These classes provide a framework for creating both simple and complex
animations.
@@ -361,4 +366,3 @@
framework for animations, see the states example (it lives in the
\c{examples/animation/states} directory).
*/
-
diff --git a/src/corelib/doc/src/containers.qdoc b/src/corelib/doc/src/containers.qdoc
index 24c5629ae2..262add419c 100644
--- a/src/corelib/doc/src/containers.qdoc
+++ b/src/corelib/doc/src/containers.qdoc
@@ -26,22 +26,6 @@
****************************************************************************/
/*!
- \group tools
- \title Non-GUI Classes
- \ingroup groups
-
- \brief Collection classes such as list, queue, stack and string, along
- with other classes that can be used without needing QApplication.
-
- The non-GUI classes are general-purpose collection and string classes
- that may be used independently of the GUI classes.
-
- In particular, these classes do not depend on QApplication at all,
- and so can be used in non-GUI programs.
-
-*/
-
-/*!
\page containers.html
\title Container Classes
\ingroup technology-apis
@@ -394,13 +378,13 @@
QMapIterator, which is somewhat different because it iterates on
(key, value) pairs.
- Like QListIterator, QMapIterator provides
- \l{QMapIterator::toFront()}{toFront()},
- \l{QMapIterator::toBack()}{toBack()},
- \l{QMapIterator::hasNext()}{hasNext()},
- \l{QMapIterator::next()}{next()},
- \l{QMapIterator::peekNext()}{peekNext()},
- \l{QMapIterator::hasPrevious()}{hasPrevious()},
+ Like QListIterator, QMapIterator provides
+ \l{QMapIterator::toFront()}{toFront()},
+ \l{QMapIterator::toBack()}{toBack()},
+ \l{QMapIterator::hasNext()}{hasNext()},
+ \l{QMapIterator::next()}{next()},
+ \l{QMapIterator::peekNext()}{peekNext()},
+ \l{QMapIterator::hasPrevious()}{hasPrevious()},
\l{QMapIterator::previous()}{previous()}, and
\l{QMapIterator::peekPrevious()}{peekPrevious()}. The key and
value components are extracted by calling key() and value() on
diff --git a/src/corelib/doc/src/datastreamformat.qdoc b/src/corelib/doc/src/datastreamformat.qdoc
index 8c3b592276..e2c3f9bae1 100644
--- a/src/corelib/doc/src/datastreamformat.qdoc
+++ b/src/corelib/doc/src/datastreamformat.qdoc
@@ -33,7 +33,7 @@
The \l QDataStream allows you to serialize some of the Qt data types.
The table below lists the data types that QDataStream can serialize
and how they are represented. The format described below is
- \l{QDataStream::setVersion()}{version 12}.
+ \l{QDataStream::setVersion()}{version 13}.
It is always best to cast integers to a Qt integer type, such as
qint16 or quint32, when reading and writing. This ensures that
@@ -129,7 +129,7 @@
\li \list
\li Date (QDate)
\li Time (QTime)
- \li 0 for Qt::LocalTime, 1 for Qt::UTC (quint8)
+ \li The \l{Qt::TimeSpec}{time spec} (quint8)
\endlist
\row \li QEasingCurve
\li \list
diff --git a/src/corelib/doc/src/eventsandfilters.qdoc b/src/corelib/doc/src/eventsandfilters.qdoc
index 5fe444538d..e4605afb0b 100644
--- a/src/corelib/doc/src/eventsandfilters.qdoc
+++ b/src/corelib/doc/src/eventsandfilters.qdoc
@@ -32,10 +32,11 @@
\brief Classes used to create and handle events.
- These classes are used to create and handle events.
+ These \l{Qt Core} classes are used to create and handle events.
- For more information see the \link object.html Object model\endlink
- and \link signalsandslots.html Signals and Slots\endlink.
+ For more information see the \l{The Event System}{Event System} page.
+
+ \annotatedlist events
*/
/*!
diff --git a/src/corelib/doc/src/implicit-sharing.qdoc b/src/corelib/doc/src/implicit-sharing.qdoc
index 7b29998951..2038d43230 100644
--- a/src/corelib/doc/src/implicit-sharing.qdoc
+++ b/src/corelib/doc/src/implicit-sharing.qdoc
@@ -31,6 +31,12 @@
/*!
\group shared
\title Implicitly Shared Classes
+
+ These \l{Qt Core} classes provides a safe and efficient way of sharing and
+ manipulating data by \l{Implicit Sharing}{implicitly sharing} data.
+
+ \annotatedlist shared
+
*/
/*!
diff --git a/src/corelib/doc/src/io.qdoc b/src/corelib/doc/src/io.qdoc
index cd967844c0..7aff227931 100644
--- a/src/corelib/doc/src/io.qdoc
+++ b/src/corelib/doc/src/io.qdoc
@@ -33,7 +33,9 @@
\brief Classes providing file input and output along with directory and
network handling.
- These classes are used to handle input and output to and from external
- devices, processes, files etc. as well as manipulating files and directories.
-*/
+ These \l{Qt Core} classes are used to handle input and output to and from
+ external devices, processes, files etc. as well as manipulating files and
+ directories.
+ \annotatedlist io
+*/
diff --git a/src/corelib/doc/src/json.qdoc b/src/corelib/doc/src/json.qdoc
index 25496dd759..9e6e190dcb 100644
--- a/src/corelib/doc/src/json.qdoc
+++ b/src/corelib/doc/src/json.qdoc
@@ -108,5 +108,6 @@
\annotatedlist json
- All JSON classes are value based, implicitly shared classes.
+ All JSON classes are value based,
+ \l{Implicit Sharing}{implicitly shared classes}.
*/
diff --git a/src/corelib/doc/src/plugins-howto.qdoc b/src/corelib/doc/src/plugins-howto.qdoc
index f0031ee26b..bc387aeed9 100644
--- a/src/corelib/doc/src/plugins-howto.qdoc
+++ b/src/corelib/doc/src/plugins-howto.qdoc
@@ -32,12 +32,14 @@
\brief Plugin related classes.
- These classes deal with shared libraries, (e.g. .so and DLL files),
- and with Qt plugins.
+ These \l{Qt Core} classes deal with shared libraries, (e.g. .so and DLL
+ files), and with Qt plugins.
- See the \link plugins-howto.html plugins documentation\endlink.
+ See the \l{How to Create Qt Plugins} page for more information..
See also the \l{ActiveQt framework} for Windows.
+
+ \annotatedlist plugins
*/
/*!
diff --git a/src/corelib/doc/src/qtcore-index.qdoc b/src/corelib/doc/src/qtcore-index.qdoc
new file mode 100644
index 0000000000..f876a362c7
--- /dev/null
+++ b/src/corelib/doc/src/qtcore-index.qdoc
@@ -0,0 +1,119 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \page qtcore-index.html
+ \title Qt Core
+
+ \brief The Qt Core module is part of Qt's essential modules.
+
+ \section1 Getting Started
+ All other Qt modules rely on this module. To include the
+ definitions of the module's classes, use the following directive:
+
+ \snippet code/doc_src_qtcore.cpp 0
+
+ \section1 Core Functionalities
+
+ Qt adds these features to C++:
+
+ \list
+ \li a very powerful mechanism for seamless object communication called
+ signals and slots
+ \li queryable and designable object properties
+ \li hierarchical and queryable object trees that organize
+ \li object ownership in a natural way with guarded pointers (QPointer)
+ \li a dynamic cast that works across library boundaries
+ \endlist
+
+ The following pages provide more information about Qt's core features:
+ \list
+ \li \l{The Meta-Object System}
+ \li \l{The Property System}
+ \li \l{Object Model}
+ \li \l{Object Trees & Ownership}
+ \li \l{Signals & Slots}
+ \endlist
+
+ \section1 Threading and Concurrent Programming
+
+ Qt provides thread support in the form of platform-independent \l{Threading
+ Classes}{threading classes}, a thread-safe way of posting events, and
+ signal-slot connections across threads. Multithreaded programming is also a
+ useful paradigm for performing time-consuming operations without freezing
+ the user interface of an application.
+
+ The \l{Thread Support in Qt} page contains information on implementing
+ threads in applications. Additional concurrent classes are provided by the
+ \l{Qt Concurrent} module.
+
+ \section1 Input/Output, Resources, and Containers
+
+ Qt provides a resource system for organizing application files and assets,
+ a set of containers, and classes for receiving input and printing output.
+ \list
+ \li \l{Container Classes}
+ \li \l{Serializing Qt Data Types}
+ \li \l{Implicit Sharing}
+ \endlist
+
+ In addition, Qt Core provides a platform-independent mechanism for storing
+ binary files in the application's executable.
+
+ \list
+ \li \l{The Qt Resource System}
+ \endlist
+
+ \section1 Additional Frameworks
+ Qt Core also provides some of Qt's key frameworks.
+
+ \list
+ \li \l{The Animation Framework}
+ \li \l{JSON Support in Qt}
+ \li \l{The State Machine Framework}
+ \li \l{How to Create Qt Plugins}
+ \li \l{The Event System}
+ \endlist
+
+ \section1 Related Information
+ \section1 Reference
+ These are links to the API reference materials.
+ \list
+ \li \l{Qt Core C++ Classes}{C++ classes}
+ \list
+ \li \l{Animation Framework}{Animation Classes}
+ \li \l{Threading Classes}
+ \li \l{Container Classes}
+ \li \l{Plugin Classes}
+ \li \l{Implicitly Shared Classes}
+ \li \l{State Machine Classes}
+ \li \l{Input/Output and Networking}{Input/Output Classes}
+ \li \l{Event Classes}
+ \endlist
+ \endlist
+
+*/
diff --git a/src/corelib/doc/src/qtcore.qdoc b/src/corelib/doc/src/qtcore.qdoc
index 0d06bb7998..4b4814d5b7 100644
--- a/src/corelib/doc/src/qtcore.qdoc
+++ b/src/corelib/doc/src/qtcore.qdoc
@@ -27,16 +27,13 @@
/*!
\module QtCore
- \title QtCore Module
+ \title Qt Core C++ Classes
\ingroup modules
- \keyword QtCore
-
- \brief The QtCore module contains core non-GUI functionality.
+ \brief Provides core non-GUI functionality.
All other Qt modules rely on this module. To include the
definitions of the module's classes, use the following directive:
\snippet code/doc_src_qtcore.cpp 0
*/
-
diff --git a/src/corelib/doc/src/statemachine.qdoc b/src/corelib/doc/src/statemachine.qdoc
index dd4f992288..1a5c216e04 100644
--- a/src/corelib/doc/src/statemachine.qdoc
+++ b/src/corelib/doc/src/statemachine.qdoc
@@ -28,6 +28,11 @@
/*!
\group statemachine
\title State Machine Classes
+
+ These \l{Qt Core} classes are part of the \l{The State Machine Framework}{
+ State Machine Framework}.
+
+ \annotatedlist statemachine
*/
/*!
@@ -69,7 +74,7 @@
\section1 Classes in the State Machine Framework
These classes are provided by qt for creating event-driven state machines.
-
+
\annotatedlist statemachine
\section1 A Simple State Machine
diff --git a/src/corelib/doc/src/threads.qdoc b/src/corelib/doc/src/threads.qdoc
index 0f752bc726..64d33e3b34 100644
--- a/src/corelib/doc/src/threads.qdoc
+++ b/src/corelib/doc/src/threads.qdoc
@@ -28,6 +28,10 @@
/*!
\group thread
\title Threading Classes
+
+ These \l{Qt Core} classes provide threading support to applications.
+ The \l{Thread Support in Qt} page covers how to use these classes.
+ \annotatedlist thread
*/
/*!
@@ -111,13 +115,13 @@
/*!
\page threads-starting.html
\title Starting Threads with QThread
-
+
\contentspage Thread Support in Qt
\nextpage Synchronizing Threads
A QThread instance represents a thread and provides the means to
\l{QThread::start()}{start()} a thread, which will then execute the
- reimplementation of QThread::run(). The \c run() implementation is for a
+ reimplementation of QThread::run(). The \c run() implementation is for a
thread what the \c main() entry point is for the application. All code
executed in a call stack that starts in the \c run() function is executed
by the new thread, and the thread finishes when the function returns.
@@ -141,12 +145,12 @@
Then, create an instance of the thread object and call
QThread::start(). Note that you must create the QApplication (or
QCoreApplication) object before you can create a QThread.
-
- The function will return immediately and the
+
+ The function will return immediately and the
main thread will continue. The code that appears in the
\l{QThread::run()}{run()} reimplementation will then be executed
in a separate thread.
-
+
Creating threads is explained in more detail in the QThread
documentation.
@@ -160,7 +164,7 @@
/*!
\page threads-synchronizing.html
\title Synchronizing Threads
-
+
\previouspage Starting Threads with QThread
\contentspage Thread Support in Qt
\nextpage Reentrancy and Thread-Safety
@@ -227,7 +231,7 @@
\list
\li A \e thread-safe function can be called simultaneously from
- multiple threads, even when the invocations use shared data,
+ multiple threads, even when the invocations use shared data,
because all references to the shared data are serialized.
\li A \e reentrant function can also be called simultaneously from
multiple threads, but only if each invocation uses its own data.
@@ -577,8 +581,8 @@
\endlist
- Qt Concurrent supports several STL-compatible container and iterator types,
- but works best with Qt containers that have random-access iterators, such as
+ Qt Concurrent supports several STL-compatible container and iterator types,
+ but works best with Qt containers that have random-access iterators, such as
QList or QVector. The map and filter functions accept both containers and begin/end iterators.
STL Iterator support overview:
@@ -609,14 +613,14 @@
\li QList, QVector, std::vector
\li Supported and Recommended
\endtable
-
+
Random access iterators can be faster in cases where Qt Concurrent is iterating
over a large number of lightweight items, since they allow skipping to any point
in the container. In addition, using random access iterators allows Qt Concurrent
to provide progress information trough QFuture::progressValue() and QFutureWatcher::
progressValueChanged().
- The non in-place modifying functions such as mapped() and filtered() makes a
+ The non in-place modifying functions such as mapped() and filtered() makes a
copy of the container when called. If you are using STL containers this copy operation
might take some time, in this case we recommend specifying the begin and end iterators
for the container instead.
@@ -643,7 +647,7 @@
QPainter can be used in a thread to paint onto QImage, QPrinter, and
QPicture paint devices. Painting onto QPixmaps and QWidgets is \e not
- supported. On Mac OS X the automatic progress dialog will not be
+ supported. On Mac OS X the automatic progress dialog will not be
displayed if you are printing from outside the GUI thread.
Any number of threads can paint at any given time, however only
diff --git a/src/corelib/global/qfeatures.h b/src/corelib/global/qfeatures.h
index b4b73a9aaa..b4194c18f8 100644
--- a/src/corelib/global/qfeatures.h
+++ b/src/corelib/global/qfeatures.h
@@ -326,11 +326,6 @@
#define QT_NO_SOCKS5
#endif
-// QSoftKeyManager
-#if !defined(QT_NO_SOFTKEYMANAGER) && (defined(QT_NO_ACTION))
-#define QT_NO_SOFTKEYMANAGER
-#endif
-
// QSplitter
#if !defined(QT_NO_SPLITTER) && (defined(QT_NO_RUBBERBAND))
#define QT_NO_SPLITTER
diff --git a/src/corelib/global/qfeatures.txt b/src/corelib/global/qfeatures.txt
index 7f31259c16..0f3a5c9a1d 100644
--- a/src/corelib/global/qfeatures.txt
+++ b/src/corelib/global/qfeatures.txt
@@ -63,13 +63,6 @@ Requires:
Name: QAction
SeeAlso: ???
-Feature: SOFTKEYMANAGER
-Description: Supports softkeys.
-Section: Gui
-Requires: ACTION
-Name: QSoftKeyManager
-SeeAlso: ???
-
Feature: CURSOR
Description: Supports mouse cursors.
Section: Kernel
diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp
index ccf071826a..ffdf8d0fd3 100644
--- a/src/corelib/global/qlibraryinfo.cpp
+++ b/src/corelib/global/qlibraryinfo.cpp
@@ -276,6 +276,8 @@ static const struct {
{ "HostPrefix", "" },
{ "HostBinaries", "bin" },
{ "HostData", "." },
+ { "TargetSpec", "" },
+ { "HostSpec", "" },
#endif
};
@@ -378,6 +380,12 @@ QLibraryInfo::rawLocation(LibraryLocation loc, PathGroup group)
#endif // QT_NO_SETTINGS
}
+#ifdef QT_BOOTSTRAPPED
+ // The specs need to be returned verbatim.
+ if (loc == TargetSpecPath || loc == HostSpecPath)
+ return ret;
+#endif
+
if (!ret.isEmpty() && QDir::isRelativePath(ret)) {
QString baseDir;
#ifdef QT_BOOTSTRAPPED
diff --git a/src/corelib/global/qlibraryinfo.h b/src/corelib/global/qlibraryinfo.h
index 1d9b809207..93b0c81562 100644
--- a/src/corelib/global/qlibraryinfo.h
+++ b/src/corelib/global/qlibraryinfo.h
@@ -81,7 +81,9 @@ public:
HostPrefixPath,
HostBinariesPath,
HostDataPath,
- LastHostPath = HostDataPath,
+ TargetSpecPath,
+ HostSpecPath,
+ LastHostPath = HostSpecPath,
#endif
SettingsPath = 100
};
diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h
index e7953b47dd..6430c85936 100644
--- a/src/corelib/global/qnamespace.h
+++ b/src/corelib/global/qnamespace.h
@@ -311,8 +311,6 @@ public:
BypassGraphicsProxyWidget = 0x20000000,
WindowOkButtonHint = 0x00080000,
WindowCancelButtonHint = 0x00100000,
- WindowSoftkeysVisibleHint = 0x40000000,
- WindowSoftkeysRespondHint = 0x80000000,
NoDropShadowWindowHint = 0x40000000
};
@@ -470,9 +468,6 @@ public:
WA_WState_AcceptedTouchBeginEvent = 122,
WA_TouchPadAcceptSingleTouchEvents = 123,
- WA_MergeSoftkeys = 124,
- WA_MergeSoftkeysRecursively = 125,
-
WA_X11DoNotAcceptFocus = 126,
WA_MacNoShadow = 127,
diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc
index 50578d78c5..66442a83c7 100644
--- a/src/corelib/global/qnamespace.qdoc
+++ b/src/corelib/global/qnamespace.qdoc
@@ -1160,17 +1160,6 @@
\value WA_TouchPadAcceptSingleTouchEvents Allows touchpad single
touch events to be sent to the widget.
- \value WA_MergeSoftkeys Allows widget to merge softkeys with parent widget,
- i.e. widget can set only one softkeys and request softkey implementation
- to take rest of the softkeys from the parent. Note parents are traversed until
- WA_MergeSoftkeys is not set. See also Qt::WA_MergeSoftkeysRecursively
- This attribute currently has effect only on Symbian platforms
-
- \value WA_MergeSoftkeysRecursively Allows widget to merge softkeys recursively
- with all parents. If this attribute is set, the widget parents are traversed until
- window boundary (widget without parent or dialog) is found.
- This attribute currently has effect only on Symbian platforms
-
\value WA_X11DoNotAcceptFocus Asks the window manager to not give focus
to this top level window. This attribute has no effect on non-X11
platforms.
@@ -2031,14 +2020,6 @@
\value WindowCancelButtonHint Adds a Cancel button to the window decoration of a dialog.
Only supported for Windows CE.
- \value WindowSoftkeysVisibleHint Makes softkeys visible when widget is fullscreen.
- Only supported for Symbian.
-
- \value WindowSoftkeysRespondHint Makes softkeys to receive key events even
- when invisible. With this hint the softkey actions are triggered
- even the softkeys are invisible i.e. the window is displayed with
- \c showFullscreen(). Only supported for Symbian.
-
\value WindowTransparentForInput Informs the window system that this window
is used only for output (displaying something) and does not take input.
Therefore input events should pass through as if it wasn't there.
diff --git a/src/corelib/global/qt_windows.h b/src/corelib/global/qt_windows.h
index 4bd8d60754..00a511a96f 100644
--- a/src/corelib/global/qt_windows.h
+++ b/src/corelib/global/qt_windows.h
@@ -46,17 +46,17 @@
// Borland's windows.h does not set these correctly, resulting in
// unusable WinSDK standard dialogs
#ifndef WINVER
-#define WINVER 0x400
+# define WINVER 0x0501
#endif
#ifndef _WIN32_WINNT
-#define _WIN32_WINNT 0x400
+# define _WIN32_WINNT 0x0501
#endif
#endif
#if defined(Q_CC_MINGW)
// mingw's windows.h does not set _WIN32_WINNT, resulting breaking compilation
#ifndef WINVER
-#define WINVER 0x500
+# define WINVER 0x501
#endif
#endif
@@ -65,6 +65,13 @@
#endif
#include <windows.h>
+#if defined(_WIN32_IE) && _WIN32_IE < 0x0501
+# undef _WIN32_IE
+#endif
+#if !defined(_WIN32_IE)
+# define _WIN32_IE 0x0501
+#endif
+
#ifdef _WIN32_WCE
#include <ceconfig.h>
#endif
diff --git a/src/corelib/io/io.pri b/src/corelib/io/io.pri
index 9e89f9fdc0..f57dcebe33 100644
--- a/src/corelib/io/io.pri
+++ b/src/corelib/io/io.pri
@@ -118,15 +118,13 @@ win32 {
} else {
SOURCES += io/qstandardpaths_unix.cpp
}
- } else:standardpathsjson {
- SOURCES += io/qstandardpaths_json.cpp
} else:blackberry {
SOURCES += io/qstandardpaths_blackberry.cpp
} else {
SOURCES += io/qstandardpaths_unix.cpp
}
- linux-* {
+ linux-*|if(qnx:contains(QT_CONFIG, inotify)) {
SOURCES += io/qfilesystemwatcher_inotify.cpp
HEADERS += io/qfilesystemwatcher_inotify_p.h
}
diff --git a/src/corelib/io/qfilesystemengine.cpp b/src/corelib/io/qfilesystemengine.cpp
index fe06210fb9..8707aec0b8 100644
--- a/src/corelib/io/qfilesystemengine.cpp
+++ b/src/corelib/io/qfilesystemengine.cpp
@@ -300,6 +300,13 @@ void QFileSystemMetaData::fillFromDirEnt(const QT_DIRENT &entry)
const struct dirent_extra_stat * const extra_stat =
reinterpret_cast<struct dirent_extra_stat *>(extra);
+ // Remember whether this was a link or not, this saves an lstat() call later.
+ if (extra->d_type == _DTYPE_LSTAT) {
+ knownFlagsMask |= QFileSystemMetaData::LinkType;
+ if (S_ISLNK(extra_stat->d_stat.st_mode))
+ entryFlags |= QFileSystemMetaData::LinkType;
+ }
+
// For symlinks, the extra type _DTYPE_LSTAT doesn't work for filling out the meta data,
// as we need the stat() information there, not the lstat() information.
// In this case, don't use the extra information.
diff --git a/src/corelib/io/qfilesystemwatcher.cpp b/src/corelib/io/qfilesystemwatcher.cpp
index 77a5959f8f..449be9b7b5 100644
--- a/src/corelib/io/qfilesystemwatcher.cpp
+++ b/src/corelib/io/qfilesystemwatcher.cpp
@@ -51,11 +51,14 @@
#include <qset.h>
#include <qtimer.h>
+#if defined(Q_OS_LINUX) || (defined(Q_OS_QNX) && !defined(QT_NO_INOTIFY))
+#define USE_INOTIFY
+#endif
#include "qfilesystemwatcher_polling_p.h"
#if defined(Q_OS_WIN)
# include "qfilesystemwatcher_win_p.h"
-#elif defined(Q_OS_LINUX)
+#elif defined(USE_INOTIFY)
# include "qfilesystemwatcher_inotify_p.h"
#elif defined(Q_OS_FREEBSD) || defined(Q_OS_MAC)
# include "qfilesystemwatcher_kqueue_p.h"
@@ -67,7 +70,7 @@ QFileSystemWatcherEngine *QFileSystemWatcherPrivate::createNativeEngine(QObject
{
#if defined(Q_OS_WIN)
return new QWindowsFileSystemWatcherEngine(parent);
-#elif defined(Q_OS_LINUX)
+#elif defined(USE_INOTIFY)
// there is a chance that inotify may fail on Linux pre-2.6.13 (August
// 2005), so we can't just new inotify directly.
return QInotifyFileSystemWatcherEngine::create(parent);
diff --git a/src/corelib/io/qfilesystemwatcher_inotify.cpp b/src/corelib/io/qfilesystemwatcher_inotify.cpp
index 390a280ff2..11ac0e5b5d 100644
--- a/src/corelib/io/qfilesystemwatcher_inotify.cpp
+++ b/src/corelib/io/qfilesystemwatcher_inotify.cpp
@@ -52,12 +52,20 @@
#include <qsocketnotifier.h>
#include <qvarlengtharray.h>
+#if defined(Q_OS_LINUX)
#include <sys/syscall.h>
#include <sys/ioctl.h>
#include <unistd.h>
#include <fcntl.h>
+#endif
#if defined(QT_NO_INOTIFY)
+
+#if defined(Q_OS_QNX)
+// These files should only be compiled on QNX if the inotify headers are found
+#error "Should not get here."
+#endif
+
#include <linux/types.h>
#if defined(__i386__)
diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp
index 395effaff9..c52053000d 100644
--- a/src/corelib/io/qprocess.cpp
+++ b/src/corelib/io/qprocess.cpp
@@ -458,8 +458,8 @@ void QProcessPrivate::Channel::clear()
are supplied as individual strings in a QStringList.
For example, the following code snippet runs the analog clock
- example in the Motif style on X11 platforms by passing strings
- containing "-style" and "motif" as two items in the list of
+ example in the Fusion style on X11 platforms by passing strings
+ containing "-style" and "fusion" as two items in the list of
arguments:
\snippet qprocess/qprocess-simpleexecution.cpp 0
diff --git a/src/corelib/io/qstandardpaths.cpp b/src/corelib/io/qstandardpaths.cpp
index 91e343b021..4d7e359117 100644
--- a/src/corelib/io/qstandardpaths.cpp
+++ b/src/corelib/io/qstandardpaths.cpp
@@ -272,7 +272,7 @@ QString QStandardPaths::findExecutable(const QString &executableName, const QStr
searchPaths.reserve(rawPaths.size());
foreach (const QString &rawPath, rawPaths) {
QString cleanPath = QDir::cleanPath(rawPath);
- if (cleanPath.size() > 1 && cleanPath.endsWith('/'))
+ if (cleanPath.size() > 1 && cleanPath.endsWith(QLatin1Char('/')))
cleanPath.truncate(cleanPath.size() - 1);
searchPaths.push_back(cleanPath);
}
diff --git a/src/corelib/io/qstandardpaths_json.cpp b/src/corelib/io/qstandardpaths_json.cpp
deleted file mode 100644
index 839cd9e873..0000000000
--- a/src/corelib/io/qstandardpaths_json.cpp
+++ /dev/null
@@ -1,258 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include "qstandardpaths.h"
-
-#include <QString>
-#include <QJsonDocument>
-#include <QJsonObject>
-#include <QJsonValue>
-#include <QJsonArray>
-#include <QFile>
-#include <QDir>
-#include <QAtomicPointer>
-#include <QCoreApplication>
-#include <QRegularExpression>
-#include <QRegularExpressionMatchIterator>
-#include <QRegularExpressionMatch>
-
-#ifndef QT_NO_STANDARDPATHS
-
-QT_BEGIN_NAMESPACE
-
-class QStandardPathsPrivate {
-public:
- QStandardPathsPrivate() : object(0){}
- ~QStandardPathsPrivate() { delete object.load(); }
- QAtomicPointer<QJsonObject> object;
-};
-
-Q_GLOBAL_STATIC(QStandardPathsPrivate, configCache);
-
-/*!
- \internal
- Substitute environment variables in the form ${name}
-
- The JSON QStandardPaths implementation can be configured on a per user
- (or per application) basis through the use of environment variables,
- which are evaluated each time a location is queried. This function
- performs that evaluation on \a value. No substitution is performed
- for undefined variables.
-
- This slightly underselects according to the 2009-09-20 version of
- the GNU setenv(3) manual page: It disallows '}' within the variable
- name. ${var}} will look for a variable named "var", not "var}".
- */
-static QString substituteEnvVars(const QJsonValue & value)
-{
- QString str = value.toString();
- if (str.isEmpty() || !str.contains(QLatin1String("${")))
- return str;
-
- // optimize for a common case
- str.replace(QLatin1String("${HOME}"), QDir::homePath());
-
- // Do ${} format environment variable substitution if necessary
- // repeat this test because ${HOME} might expand to the empty string
- if (!str.isEmpty() && str.contains(QLatin1String("${"))) {
- QRegularExpression varRegExp(QLatin1String("\\$\\{([^\\}=]*)\\}"));
- QRegularExpressionMatchIterator matchIterator =
- varRegExp.globalMatch(str);
- while (matchIterator.hasNext()) {
- QRegularExpressionMatch match = matchIterator.next();
- QByteArray envValue =
- qgetenv(match.captured(1).toLatin1().data());
- if (!envValue.isNull()) {
- QString replacement =
- QFile::decodeName(envValue);
- str.replace(match.captured(0), replacement);
- }
- }
- }
- return str;
-}
-
-static void appendOrganizationAndApp(QString &path)
-{
- const QString org = QCoreApplication::organizationName();
- if (!org.isEmpty())
- path += QLatin1Char('/') + org;
- const QString appName = QCoreApplication::applicationName();
- if (!appName.isEmpty())
- path += QLatin1Char('/') + appName;
-}
-
-QString QStandardPaths::writableLocation(StandardLocation type)
-{
- QStringList locations = QStandardPaths::standardLocations(type);
- if (locations.isEmpty())
- return QString();
- return locations.first();
-}
-
-QStringList QStandardPaths::standardLocations(StandardLocation type)
-{
- switch (type) {
- case HomeLocation:
- return QStringList(QDir::homePath()); // set $HOME
- case TempLocation:
- return QStringList(QDir::tempPath()); // set $TMPDIR
- default:
- break;
- }
-
- if (isTestModeEnabled()) {
- const QString qttestDir = QDir::homePath() + QLatin1String("/.qttest");
- QString path;
- switch (type) {
- case GenericDataLocation:
- case DataLocation:
- path = qttestDir + QLatin1String("/share");
- if (type == DataLocation)
- appendOrganizationAndApp(path);
- return QStringList(path);
- case GenericCacheLocation:
- case CacheLocation:
- path = qttestDir + QLatin1String("/cache");
- if (type == CacheLocation)
- appendOrganizationAndApp(path);
- return QStringList(path);
- case ConfigLocation:
- return QStringList(qttestDir + QLatin1String("/config"));
- default:
- break;
- }
- }
-
-
- QJsonObject * localConfigObject = configCache()->object.loadAcquire();
- if (localConfigObject == 0) {
- QString configHome = QFile::decodeName(qgetenv("PATH_CONFIG_HOME"));
- if (configHome.isEmpty())
- configHome = QLatin1String("/etc/user-dirs.json");
- QFile file(configHome);
- if (file.open(QIODevice::ReadOnly)) {
- QJsonDocument configDoc = QJsonDocument::fromJson(file.readAll());
- if (configDoc.isNull())
- return QStringList();
-
- QJsonObject myConfigObject = configDoc.object();
- localConfigObject = new QJsonObject(myConfigObject);
- if (!configCache()->object.testAndSetRelease(0, localConfigObject)) {
- delete localConfigObject;
- localConfigObject = configCache()->object.loadAcquire();
- }
- } else {
- return QStringList();
- }
- }
-
- QLatin1String key("");
-
- switch (type) {
- case DocumentsLocation:
- key = QLatin1String("DOCUMENTS");
- break;
- case PicturesLocation:
- key = QLatin1String("PICTURES");
- break;
- case MusicLocation:
- key = QLatin1String("MUSIC");
- break;
- case MoviesLocation:
- key = QLatin1String("VIDEOS");
- break;
- case DownloadLocation:
- key = QLatin1String("DOWNLOAD");
- break;
- case ApplicationsLocation:
- key = QLatin1String("APPLICATIONS");
- break;
- case CacheLocation:
- key = QLatin1String("CACHE");
- break;
- case GenericCacheLocation:
- key = QLatin1String("GENERIC_CACHE");
- break;
- case DataLocation:
- key = QLatin1String("DATA");
- break;
- case GenericDataLocation:
- key = QLatin1String("GENERIC_DATA");
- break;
- case ConfigLocation:
- key = QLatin1String("CONFIG");
- break;
- case RuntimeLocation:
- key = QLatin1String("RUNTIME");
- break;
- case DesktopLocation:
- key = QLatin1String("DESKTOP");
- break;
- case FontsLocation:
- key = QLatin1String("FONTS");
- break;
-
- default:
- return QStringList();
- }
-
- QJsonObject::const_iterator iter = localConfigObject->constFind(key);
- if (iter == localConfigObject->constEnd())
- return QStringList();
-
- switch (iter.value().type()) {
- case QJsonValue::Array: {
- QStringList resultList;
- foreach (const QJsonValue &item, iter.value().toArray())
- resultList.append(substituteEnvVars(item));
- return resultList;
- }
- case QJsonValue::String:
- return QStringList(substituteEnvVars(iter.value()));
- default:
- break;
- }
- return QStringList();
-}
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_STANDARDPATHS
diff --git a/src/corelib/io/qwindowspipereader.cpp b/src/corelib/io/qwindowspipereader.cpp
index cca6e80810..bef6097043 100644
--- a/src/corelib/io/qwindowspipereader.cpp
+++ b/src/corelib/io/qwindowspipereader.cpp
@@ -213,7 +213,8 @@ void QWindowsPipeReader::startAsyncRead()
// We get notified by the QWinOverlappedIoNotifier - even in the synchronous case.
return;
} else {
- switch (GetLastError()) {
+ const DWORD dwError = GetLastError();
+ switch (dwError) {
case ERROR_IO_PENDING:
// This is not an error. We're getting notified, when data arrives.
return;
@@ -223,16 +224,19 @@ void QWindowsPipeReader::startAsyncRead()
// didn't fit into the pipe's system buffer.
// We're getting notified by the QWinOverlappedIoNotifier.
break;
+ case ERROR_BROKEN_PIPE:
case ERROR_PIPE_NOT_CONNECTED:
{
// It may happen, that the other side closes the connection directly
// after writing data. Then we must set the appropriate socket state.
+ readSequenceStarted = false;
pipeBroken = true;
emit pipeClosed();
return;
}
default:
- emit winError(GetLastError(), QLatin1String("QWindowsPipeReader::startAsyncRead"));
+ readSequenceStarted = false;
+ emit winError(dwError, QLatin1String("QWindowsPipeReader::startAsyncRead"));
return;
}
}
diff --git a/src/corelib/itemmodels/qabstractitemmodel_p.h b/src/corelib/itemmodels/qabstractitemmodel_p.h
index c672888992..e44931a16b 100644
--- a/src/corelib/itemmodels/qabstractitemmodel_p.h
+++ b/src/corelib/itemmodels/qabstractitemmodel_p.h
@@ -95,7 +95,7 @@ public:
void itemsAboutToBeMoved(const QModelIndex &srcParent, int srcFirst, int srcLast, const QModelIndex &destinationParent, int destinationChild, Qt::Orientation);
void itemsMoved(const QModelIndex &srcParent, int srcFirst, int srcLast, const QModelIndex &destinationParent, int destinationChild, Qt::Orientation orientation);
bool allowMove(const QModelIndex &srcParent, int srcFirst, int srcLast, const QModelIndex &destinationParent, int destinationChild, Qt::Orientation orientation);
-
+
inline QModelIndex createIndex(int row, int column, void *data = 0) const {
return q_func()->createIndex(row, column, data);
}
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index 8ff4aa7c54..590d127094 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -577,8 +577,12 @@ void QCoreApplication::flush()
\a argc must be greater than zero and \a argv must contain at least
one valid character string.
*/
-QCoreApplication::QCoreApplication(int &argc, char **argv, int _internal)
-: QObject(*new QCoreApplicationPrivate(argc, argv, _internal))
+QCoreApplication::QCoreApplication(int &argc, char **argv
+#ifndef Q_QDOC
+ , int _internal
+#endif
+ )
+ : QObject(*new QCoreApplicationPrivate(argc, argv, _internal))
{
init();
QCoreApplicationPrivate::eventDispatcher->startingUp();
@@ -698,7 +702,17 @@ bool QCoreApplication::testAttribute(Qt::ApplicationAttribute attribute)
return QCoreApplicationPrivate::testAttribute(attribute);
}
-/*!/
+
+/*!
+ \property QCoreApplication::quitLockEnabled
+
+ Returns true if the use of the QEventLoopLocker feature can cause the
+ application to quit, otherwise returns false.
+
+ \sa QEventLoopLocker
+*/
+
+/*!
Returns true if the use of the QEventLoopLocker feature can cause the
application to quit, otherwise returns false.
@@ -2220,7 +2234,7 @@ void QCoreApplication::installNativeEventFilter(QAbstractNativeEventFilter *filt
}
/*!
- Removes an event filter object \a obj from this object. The
+ Removes an event \a filterObject from this object. The
request is ignored if such an event filter has not been installed.
All event filters for this object are automatically removed when
@@ -2232,12 +2246,12 @@ void QCoreApplication::installNativeEventFilter(QAbstractNativeEventFilter *filt
\sa installNativeEventFilter()
\since 5.0
*/
-void QCoreApplication::removeNativeEventFilter(QAbstractNativeEventFilter *filterObj)
+void QCoreApplication::removeNativeEventFilter(QAbstractNativeEventFilter *filterObject)
{
QAbstractEventDispatcher *eventDispatcher = QAbstractEventDispatcher::instance();
- if (!filterObj || !eventDispatcher)
+ if (!filterObject || !eventDispatcher)
return;
- eventDispatcher->removeNativeEventFilter(filterObj);
+ eventDispatcher->removeNativeEventFilter(filterObject);
}
/*!
diff --git a/src/corelib/kernel/qcoreapplication.h b/src/corelib/kernel/qcoreapplication.h
index 46eab4e740..b65f0cd314 100644
--- a/src/corelib/kernel/qcoreapplication.h
+++ b/src/corelib/kernel/qcoreapplication.h
@@ -85,7 +85,11 @@ public:
GuiServer // # deprecated
};
- QCoreApplication(int &argc, char **argv, int = ApplicationFlags);
+ QCoreApplication(int &argc, char **argv
+#ifndef Q_QDOC
+ , int = ApplicationFlags
+#endif
+ );
~QCoreApplication();
diff --git a/src/corelib/kernel/qcoreevent.cpp b/src/corelib/kernel/qcoreevent.cpp
index 71690ba90b..c0292ee984 100644
--- a/src/corelib/kernel/qcoreevent.cpp
+++ b/src/corelib/kernel/qcoreevent.cpp
@@ -270,7 +270,6 @@ QT_BEGIN_NAMESPACE
\omitvalue MacGLClearDrawable
\omitvalue NetworkReplyUpdated
\omitvalue FutureCallOut
- \omitvalue UpdateSoftKeys
\omitvalue NativeGesture
*/
diff --git a/src/corelib/kernel/qcoreevent.h b/src/corelib/kernel/qcoreevent.h
index d30f93f9f3..6cce838649 100644
--- a/src/corelib/kernel/qcoreevent.h
+++ b/src/corelib/kernel/qcoreevent.h
@@ -256,8 +256,6 @@ public:
RequestSoftwareInputPanel = 199,
CloseSoftwareInputPanel = 200,
- UpdateSoftKeys = 201, // Internal for compressing soft key updates
-
WinIdChange = 203,
#ifndef QT_NO_GESTURES
Gesture = 198,
diff --git a/src/corelib/kernel/qeventdispatcher_blackberry.cpp b/src/corelib/kernel/qeventdispatcher_blackberry.cpp
index b2ec574c89..4be1d73b7a 100644
--- a/src/corelib/kernel/qeventdispatcher_blackberry.cpp
+++ b/src/corelib/kernel/qeventdispatcher_blackberry.cpp
@@ -67,7 +67,7 @@ struct bpsIOHandlerData {
fd_set *exceptfds;
};
-static int bpsIOReadyDomain = -1;
+static int bpsUnblockDomain = -1;
static int bpsIOHandler(int fd, int io_events, void *data)
{
@@ -103,13 +103,13 @@ static int bpsIOHandler(int fd, int io_events, void *data)
qEventDispatcherDebug << "Sending bpsIOReadyDomain event";
// create IO ready event
bps_event_t *event;
- int result = bps_event_create(&event, bpsIOReadyDomain, 0, NULL, NULL);
+ int result = bps_event_create(&event, bpsUnblockDomain, 0, NULL, NULL);
if (result != BPS_SUCCESS) {
qWarning("QEventDispatcherBlackberryPrivate::QEventDispatcherBlackberry: bps_event_create() failed");
return BPS_FAILURE;
}
- // post IO ready event to our thread
+ // post unblock event to our thread
result = bps_push_event(event);
if (result != BPS_SUCCESS) {
qWarning("QEventDispatcherBlackberryPrivate::QEventDispatcherBlackberry: bps_push_event() failed");
@@ -129,31 +129,33 @@ QEventDispatcherBlackberryPrivate::QEventDispatcherBlackberryPrivate()
if (result != BPS_SUCCESS)
qFatal("QEventDispatcherBlackberryPrivate::QEventDispatcherBlackberry: bps_initialize() failed");
- // get domain for IO ready events - ignoring race condition here for now
- if (bpsIOReadyDomain == -1) {
- bpsIOReadyDomain = bps_register_domain();
- if (bpsIOReadyDomain == -1)
+ bps_channel = bps_channel_get_active();
+
+ // get domain for IO ready and wake up events - ignoring race condition here for now
+ if (bpsUnblockDomain == -1) {
+ bpsUnblockDomain = bps_register_domain();
+ if (bpsUnblockDomain == -1)
qWarning("QEventDispatcherBlackberryPrivate::QEventDispatcherBlackberry: bps_register_domain() failed");
}
-
- // Register thread_pipe[0] with bps
- int io_events = BPS_IO_INPUT;
- result = bps_add_fd(thread_pipe[0], io_events, &bpsIOHandler, ioData.data());
- if (result != BPS_SUCCESS)
- qWarning() << Q_FUNC_INFO << "bps_add_fd() failed";
}
QEventDispatcherBlackberryPrivate::~QEventDispatcherBlackberryPrivate()
{
- // Unregister thread_pipe[0] from bps
- const int result = bps_remove_fd(thread_pipe[0]);
- if (result != BPS_SUCCESS)
- qWarning() << Q_FUNC_INFO << "bps_remove_fd() failed";
-
// we're done using BPS
bps_shutdown();
}
+int QEventDispatcherBlackberryPrivate::initThreadWakeUp()
+{
+ return -1; // no fd's used
+}
+
+int QEventDispatcherBlackberryPrivate::processThreadWakeUp(int nsel)
+{
+ Q_UNUSED(nsel);
+ return wakeUps.fetchAndStoreRelaxed(0);
+}
+
/////////////////////////////////////////////////////////////////////////////
QEventDispatcherBlackberry::QEventDispatcherBlackberry(QObject *parent)
@@ -317,7 +319,7 @@ int QEventDispatcherBlackberry::select(int nfds, fd_set *readfds, fd_set *writef
if (!event) // In case of !event, we break out of the loop to let Qt process the timers
break; // (since timeout has expired) and socket notifiers that are now ready.
- if (bps_event_get_domain(event) == bpsIOReadyDomain) {
+ if (bps_event_get_domain(event) == bpsUnblockDomain) {
timeoutTotal = 0; // in order to immediately drain the event queue of native events
event = 0; // (especially touch move events) we don't break out here
}
@@ -339,6 +341,21 @@ int QEventDispatcherBlackberry::select(int nfds, fd_set *readfds, fd_set *writef
return d->ioData->count;
}
+void QEventDispatcherBlackberry::wakeUp()
+{
+ Q_D(QEventDispatcherBlackberry);
+ if (d->wakeUps.testAndSetAcquire(0, 1)) {
+ bps_event_t *event;
+ if (bps_event_create(&event, bpsUnblockDomain, 0, 0, 0) == BPS_SUCCESS) {
+ if (bps_channel_push_event(d->bps_channel, event) == BPS_SUCCESS)
+ return;
+ else
+ bps_event_destroy(event);
+ }
+ qWarning("QEventDispatcherBlackberryPrivate::wakeUp failed");
+ }
+}
+
int QEventDispatcherBlackberry::ioEvents(int fd)
{
int io_events = 0;
diff --git a/src/corelib/kernel/qeventdispatcher_blackberry_p.h b/src/corelib/kernel/qeventdispatcher_blackberry_p.h
index 84cdf9e2dd..79ed21dbf2 100644
--- a/src/corelib/kernel/qeventdispatcher_blackberry_p.h
+++ b/src/corelib/kernel/qeventdispatcher_blackberry_p.h
@@ -71,6 +71,8 @@ public:
void registerSocketNotifier(QSocketNotifier *notifier);
void unregisterSocketNotifier(QSocketNotifier *notifier);
+ void wakeUp();
+
protected:
QEventDispatcherBlackberry(QEventDispatcherBlackberryPrivate &dd, QObject *parent = 0);
@@ -89,6 +91,10 @@ public:
QEventDispatcherBlackberryPrivate();
~QEventDispatcherBlackberryPrivate();
+ int initThreadWakeUp();
+ int processThreadWakeUp(int nsel);
+
+ int bps_channel;
QScopedPointer<bpsIOHandlerData> ioData;
};
diff --git a/src/corelib/kernel/qeventdispatcher_unix.cpp b/src/corelib/kernel/qeventdispatcher_unix.cpp
index 44715b0553..6c2a610a56 100644
--- a/src/corelib/kernel/qeventdispatcher_unix.cpp
+++ b/src/corelib/kernel/qeventdispatcher_unix.cpp
@@ -110,7 +110,7 @@ QEventDispatcherUNIXPrivate::QEventDispatcherUNIXPrivate()
bool pipefail = false;
// initialize the common parts of the event loop
-#if defined(Q_OS_NACL)
+#if defined(Q_OS_NACL) || defined (Q_OS_BLACKBERRY)
// do nothing.
#elif defined(Q_OS_INTEGRITY)
// INTEGRITY doesn't like a "select" on pipes, so use socketpair instead
@@ -157,7 +157,7 @@ QEventDispatcherUNIXPrivate::QEventDispatcherUNIXPrivate()
QEventDispatcherUNIXPrivate::~QEventDispatcherUNIXPrivate()
{
-#if defined(Q_OS_NACL)
+#if defined(Q_OS_NACL) || defined (Q_OS_BLACKBERRY)
// do nothing.
#elif defined(Q_OS_VXWORKS)
close(thread_pipe[0]);
@@ -211,8 +211,8 @@ int QEventDispatcherUNIXPrivate::doSelect(QEventLoop::ProcessEventsFlags flags,
FD_ZERO(&sn_vec[2].select_fds);
}
- FD_SET(thread_pipe[0], &sn_vec[0].select_fds);
- highest = qMax(highest, thread_pipe[0]);
+ int wakeUpFd = initThreadWakeUp();
+ highest = qMax(highest, wakeUpFd);
nsel = q->select(highest + 1,
&sn_vec[0].select_fds,
@@ -271,25 +271,7 @@ int QEventDispatcherUNIXPrivate::doSelect(QEventLoop::ProcessEventsFlags flags,
}
}
- // some other thread woke us up... consume the data on the thread pipe so that
- // select doesn't immediately return next time
- int nevents = 0;
- if (nsel > 0 && FD_ISSET(thread_pipe[0], &sn_vec[0].select_fds)) {
-#if defined(Q_OS_VXWORKS)
- char c[16];
- ::read(thread_pipe[0], c, sizeof(c));
- ::ioctl(thread_pipe[0], FIOFLUSH, 0);
-#else
- char c[16];
- while (::read(thread_pipe[0], c, sizeof(c)) > 0)
- ;
-#endif
- if (!wakeUps.testAndSetRelease(1, 0)) {
- // hopefully, this is dead code
- qWarning("QEventDispatcherUNIX: internal error, wakeUps.testAndSetRelease(1, 0) failed!");
- }
- ++nevents;
- }
+ int nevents = processThreadWakeUp(nsel);
// activate socket notifiers
if (! (flags & QEventLoop::ExcludeSocketNotifiers) && nsel > 0 && sn_highest >= 0) {
@@ -307,6 +289,35 @@ int QEventDispatcherUNIXPrivate::doSelect(QEventLoop::ProcessEventsFlags flags,
return (nevents + q->activateSocketNotifiers());
}
+int QEventDispatcherUNIXPrivate::initThreadWakeUp()
+{
+ FD_SET(thread_pipe[0], &sn_vec[0].select_fds);
+ return thread_pipe[0];
+}
+
+int QEventDispatcherUNIXPrivate::processThreadWakeUp(int nsel)
+{
+ if (nsel > 0 && FD_ISSET(thread_pipe[0], &sn_vec[0].select_fds)) {
+ // some other thread woke us up... consume the data on the thread pipe so that
+ // select doesn't immediately return next time
+#if defined(Q_OS_VXWORKS)
+ char c[16];
+ ::read(thread_pipe[0], c, sizeof(c));
+ ::ioctl(thread_pipe[0], FIOFLUSH, 0);
+#else
+ char c[16];
+ while (::read(thread_pipe[0], c, sizeof(c)) > 0)
+ ;
+#endif
+ if (!wakeUps.testAndSetRelease(1, 0)) {
+ // hopefully, this is dead code
+ qWarning("QEventDispatcherUNIX: internal error, wakeUps.testAndSetRelease(1, 0) failed!");
+ }
+ return 1;
+ }
+ return 0;
+}
+
QEventDispatcherUNIX::QEventDispatcherUNIX(QObject *parent)
: QAbstractEventDispatcher(*new QEventDispatcherUNIXPrivate, parent)
{ }
diff --git a/src/corelib/kernel/qeventdispatcher_unix_p.h b/src/corelib/kernel/qeventdispatcher_unix_p.h
index 0c5d06ddd1..98ea19ced8 100644
--- a/src/corelib/kernel/qeventdispatcher_unix_p.h
+++ b/src/corelib/kernel/qeventdispatcher_unix_p.h
@@ -144,6 +144,8 @@ public:
~QEventDispatcherUNIXPrivate();
int doSelect(QEventLoop::ProcessEventsFlags flags, timeval *timeout);
+ virtual int initThreadWakeUp();
+ virtual int processThreadWakeUp(int nsel);
bool mainThread;
int thread_pipe[2];
diff --git a/src/corelib/kernel/qmath.h b/src/corelib/kernel/qmath.h
index e76c2da57c..c5aa90e519 100644
--- a/src/corelib/kernel/qmath.h
+++ b/src/corelib/kernel/qmath.h
@@ -192,10 +192,58 @@ inline qreal qPow(qreal x, qreal y)
return pow(x, y);
}
+#ifndef M_E
+#define M_E (2.7182818284590452354)
+#endif
+
+#ifndef M_LOG2E
+#define M_LOG2E (1.4426950408889634074)
+#endif
+
+#ifndef M_LOG10E
+#define M_LOG10E (0.43429448190325182765)
+#endif
+
+#ifndef M_LN2
+#define M_LN2 (0.69314718055994530942)
+#endif
+
+#ifndef M_LN10
+#define M_LN10 (2.30258509299404568402)
+#endif
+
#ifndef M_PI
#define M_PI (3.14159265358979323846)
#endif
+#ifndef M_PI_2
+#define M_PI_2 (1.57079632679489661923)
+#endif
+
+#ifndef M_PI_4
+#define M_PI_4 (0.78539816339744830962)
+#endif
+
+#ifndef M_1_PI
+#define M_1_PI (0.31830988618379067154)
+#endif
+
+#ifndef M_2_PI
+#define M_2_PI (0.63661977236758134308)
+#endif
+
+#ifndef M_2_SQRTPI
+#define M_2_SQRTPI (1.12837916709551257390)
+#endif
+
+#ifndef M_SQRT2
+#define M_SQRT2 (1.41421356237309504880)
+#endif
+
+#ifndef M_SQRT1_2
+#define M_SQRT1_2 (0.70710678118654752440)
+#endif
+
inline qreal qFastSin(qreal x)
{
int si = int(x * (0.5 * QT_SINE_TABLE_SIZE / M_PI)); // Would be more accurate with qRound, but slower.
diff --git a/src/corelib/kernel/qmimedata.cpp b/src/corelib/kernel/qmimedata.cpp
index f48d1c7576..bbc9577b8c 100644
--- a/src/corelib/kernel/qmimedata.cpp
+++ b/src/corelib/kernel/qmimedata.cpp
@@ -192,13 +192,10 @@ QVariant QMimeDataPrivate::retrieveTypedData(const QString &format, QVariant::Ty
case QVariant::ByteArray:
case QVariant::Color:
return data.toByteArray();
- break;
case QVariant::String:
return data.toString().toUtf8();
- break;
case QVariant::Url:
return data.toUrl().toEncoded();
- break;
case QVariant::List: {
// has to be list of URLs
QByteArray result;
diff --git a/src/corelib/thread/qfutureinterface.cpp b/src/corelib/thread/qfutureinterface.cpp
index ce9eb143d7..e85f632fdf 100644
--- a/src/corelib/thread/qfutureinterface.cpp
+++ b/src/corelib/thread/qfutureinterface.cpp
@@ -419,6 +419,16 @@ bool QFutureInterfaceBase::referenceCountIsOne() const
return d->refCount.load() == 1;
}
+bool QFutureInterfaceBase::refT() const
+{
+ return d->refCount.refT();
+}
+
+bool QFutureInterfaceBase::derefT() const
+{
+ return d->refCount.derefT();
+}
+
QFutureInterfaceBasePrivate::QFutureInterfaceBasePrivate(QFutureInterfaceBase::State initialState)
: refCount(1), m_progressValue(0), m_progressMinimum(0), m_progressMaximum(0),
state(initialState), pendingResults(0),
diff --git a/src/corelib/thread/qfutureinterface.h b/src/corelib/thread/qfutureinterface.h
index b7bf779412..3cbb9506ec 100644
--- a/src/corelib/thread/qfutureinterface.h
+++ b/src/corelib/thread/qfutureinterface.h
@@ -130,6 +130,8 @@ public:
protected:
bool referenceCountIsOne() const;
+ bool refT() const;
+ bool derefT() const;
public:
#ifndef QFUTURE_TEST
@@ -148,13 +150,17 @@ class QFutureInterface : public QFutureInterfaceBase
public:
QFutureInterface(State initialState = NoState)
: QFutureInterfaceBase(initialState)
- { }
+ {
+ refT();
+ }
QFutureInterface(const QFutureInterface &other)
: QFutureInterfaceBase(other)
- { }
+ {
+ refT();
+ }
~QFutureInterface()
{
- if (referenceCountIsOne())
+ if (!derefT())
resultStore().clear();
}
@@ -163,7 +169,8 @@ public:
QFutureInterface &operator=(const QFutureInterface &other)
{
- if (referenceCountIsOne())
+ other.refT();
+ if (!derefT())
resultStore().clear();
QFutureInterfaceBase::operator=(other);
return *this;
diff --git a/src/corelib/thread/qfutureinterface_p.h b/src/corelib/thread/qfutureinterface_p.h
index a9081d4c89..ece5e56768 100644
--- a/src/corelib/thread/qfutureinterface_p.h
+++ b/src/corelib/thread/qfutureinterface_p.h
@@ -129,7 +129,31 @@ class QFutureInterfaceBasePrivate
public:
QFutureInterfaceBasePrivate(QFutureInterfaceBase::State initialState);
- QAtomicInt refCount;
+ // When the last QFuture<T> reference is removed, we need to make
+ // sure that data stored in the ResultStore is cleaned out.
+ // Since QFutureInterfaceBasePrivate can be shared between QFuture<T>
+ // and QFuture<void> objects, we use a separate ref. counter
+ // to keep track of QFuture<T> objects.
+ class RefCount
+ {
+ public:
+ inline RefCount(int r = 0, int rt = 0)
+ : m_refCount(r), m_refCountT(rt) {}
+ // Default ref counter for QFIBP
+ inline bool ref() { return m_refCount.ref(); }
+ inline bool deref() { return m_refCount.deref(); }
+ inline int load() const { return m_refCount.load(); }
+ // Ref counter for type T
+ inline bool refT() { return m_refCountT.ref(); }
+ inline bool derefT() { return m_refCountT.deref(); }
+ inline int loadT() const { return m_refCountT.load(); }
+
+ private:
+ QAtomicInt m_refCount;
+ QAtomicInt m_refCountT;
+ };
+
+ RefCount refCount;
mutable QMutex m_mutex;
QWaitCondition waitCondition;
QList<QFutureCallOutInterface *> outputConnections;
diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp
index 7d18e93dce..56dc0fade9 100644
--- a/src/corelib/tools/qdatetime.cpp
+++ b/src/corelib/tools/qdatetime.cpp
@@ -93,47 +93,67 @@ static inline QDate fixedDate(int y, int m, int d)
return result;
}
-static inline qint64 julianDayFromDate(qint64 year, int month, int day)
+static inline qint64 floordiv(qint64 a, qint64 b)
{
- // Gregorian calendar
- // Algorithm from Henry F. Fliegel and Thomas C. Van Flandern
+ return (a - (a < 0 ? b-1 : 0)) / b;
+}
+static inline qint64 floordiv(qint64 a, int b)
+{
+ return (a - (a < 0 ? b-1 : 0)) / b;
+}
+
+static inline int floordiv(int a, int b)
+{
+ return (a - (a < 0 ? b-1 : 0)) / b;
+}
+
+static inline qint64 julianDayFromDate(int year, int month, int day)
+{
+ // Adjust for no year 0
if (year < 0)
++year;
- return (1461 * (year + 4800 + (month - 14) / 12)) / 4
- + (367 * (month - 2 - 12 * ((month - 14) / 12))) / 12
- - (3 * ((year + 4900 + (month - 14) / 12) / 100)) / 4
- + day - 32075;
+/*
+ * Math from The Calendar FAQ at http://www.tondering.dk/claus/cal/julperiod.php
+ * This formula is correct for all julian days, when using mathematical integer
+ * division (round to negative infinity), not c++11 integer division (round to zero)
+ */
+ int a = floordiv(14 - month, 12);
+ qint64 y = (qint64)year + 4800 - a;
+ int m = month + 12 * a - 3;
+ return day + floordiv(153 * m + 2, 5) + 365 * y + floordiv(y, 4) - floordiv(y, 100) + floordiv(y, 400) - 32045;
}
-static void getDateFromJulianDay(qint64 julianDay, int *year, int *month, int *day)
+static void getDateFromJulianDay(qint64 julianDay, int *yearp, int *monthp, int *dayp)
{
- int y, m, d;
+/*
+ * Math from The Calendar FAQ at http://www.tondering.dk/claus/cal/julperiod.php
+ * This formula is correct for all julian days, when using mathematical integer
+ * division (round to negative infinity), not c++11 integer division (round to zero)
+ */
+ qint64 a = julianDay + 32044;
+ qint64 b = floordiv(4 * a + 3, 146097);
+ int c = a - floordiv(146097 * b, 4);
- // Gregorian calendar
- // This algorithm is from Henry F. Fliegel and Thomas C. Van Flandern
- qint64 ell, n, i, j; //TODO These will need to be bigger to prevent overflow!!!
- ell = julianDay + 68569;
- n = (4 * ell) / 146097;
- ell = ell - (146097 * n + 3) / 4;
- i = (4000 * (ell + 1)) / 1461001;
- ell = ell - (1461 * i) / 4 + 31;
- j = (80 * ell) / 2447;
- d = ell - (2447 * j) / 80;
- ell = j / 11;
- m = j + 2 - (12 * ell);
- y = 100 * (n - 49) + i + ell;
+ int d = floordiv(4 * c + 3, 1461);
+ int e = c - floordiv(1461 * d, 4);
+ int m = floordiv(5 * e + 2, 153);
- if (y<= 0)
- --y;
+ int day = e - floordiv(153 * m + 2, 5) + 1;
+ int month = m + 3 - 12 * floordiv(m, 10);
+ int year = 100 * b + d - 4800 + floordiv(m, 10);
- if (year)
- *year = y;
- if (month)
- *month = m;
- if (day)
- *day = d;
+ // Adjust for no year 0
+ if (year <= 0)
+ --year ;
+
+ if (yearp)
+ *yearp = year;
+ if (monthp)
+ *monthp = month;
+ if (dayp)
+ *dayp = day;
}
@@ -225,14 +245,8 @@ static QString fmtDateTime(const QString& f, const QTime* dt = 0, const QDate* d
QDate::toJulianDay() and can be set using QDate::fromJulianDay().
The range of dates able to be stored by QDate as a Julian Day number is
- limited for convenience from std::numeric_limits<qint64>::min() / 2 to
- std::numeric_limits<qint64>::max() / 2, which on most platforms means
- from around 2.5 quadrillion BCE to around 2.5 quadrillion CE, effectively
- covering the full range of astronomical time. The range of Julian Days
- able to be accurately converted to and from valid YMD form Dates is
- restricted to 1 January 4800 BCE to 31 December 1400000 CE due to
- shortcomings in the available conversion formulas. Conversions outside this
- range are not guaranteed to be correct. This may change in the future.
+ for technical reasons limited to between -784350574879 and 784354017364,
+ which means from before 2 billion BCE to after 2 billion CE.
\sa QTime, QDateTime, QDateEdit, QDateTimeEdit, QCalendarWidget
*/
@@ -859,9 +873,6 @@ QString QDate::toString(const QString& format) const
If the specified date is invalid, the QDate object is set to be
invalid.
- Note that any date before 4800 BCE or after about 1.4 million CE
- may not be accurately stored.
-
\sa isValid()
*/
bool QDate::setDate(int year, int month, int day)
@@ -882,9 +893,6 @@ bool QDate::setDate(int year, int month, int day)
Returns 0 if the date is invalid.
- Note that any date before 4800 BCE or after about 1.4 million CE
- may not be accurately stored.
-
\sa year(), month(), day(), isValid()
*/
void QDate::getDate(int *year, int *month, int *day)
@@ -2100,14 +2108,8 @@ int QTime::elapsed() const
QDate::toJulianDay() and can be set using QDate::fromJulianDay().
The range of dates able to be stored by QDate as a Julian Day number is
- limited for convenience from std::numeric_limits<qint64>::min() / 2 to
- std::numeric_limits<qint64>::max() / 2, which on most platforms means
- from around 2.5 quadrillion BCE to around 2.5 quadrillion CE, effectively
- covering the full range of astronomical time. The range of Julian Days
- able to be accurately converted to and from valid YMD form Dates is
- restricted to 1 January 4800 BCE to 31 December 1400000 CE due to
- shortcomings in the available conversion formulas. Conversions outside this
- range are not guaranteed to be correct. This may change in the future.
+ for technical reasons limited to between -784350574879 and 784354017364,
+ which means from before 2 billion BCE to after 2 billion CE.
\section2
Use of System Timezone
@@ -2418,7 +2420,7 @@ void QDateTime::setMSecsSinceEpoch(qint64 msecs)
QDateTimePrivate::Spec oldSpec = d->spec;
- int ddays = msecs / MSECS_PER_DAY;
+ qint64 ddays = msecs / MSECS_PER_DAY;
msecs %= MSECS_PER_DAY;
if (msecs < 0) {
// negative
@@ -3391,10 +3393,11 @@ QDateTime QDateTime::fromString(const QString& s, Qt::DateFormat f)
int year;
QStringList timeParts = parts.at(3).split(QLatin1Char(':'));
if ((timeParts.count() == 3) || (timeParts.count() == 2)) {
+ // Year is after time, e.g. "Sun Dec 1 13:02:00 1974"
year = parts.at(4).toInt(&ok);
if (!ok)
return QDateTime();
- } else {
+ } else { // Year is before time, e.g. "Sun Dec 1 1974 13:02:00"
timeParts = parts.at(4).split(QLatin1Char(':'));
if ((timeParts.count() != 3) && (timeParts.count() != 2))
return QDateTime();
@@ -3743,7 +3746,8 @@ static bool hasUnquotedAP(const QString &f)
for (int i=0; i<max; ++i) {
if (f.at(i) == quote) {
inquote = !inquote;
- } else if (!inquote && f.at(i).toUpper() == QLatin1Char('A')) {
+ } else if (!inquote && f.at(i).toUpper() == QLatin1Char('A')
+ && i + 1 < max && f.at(i + 1).toUpper() == QLatin1Char('P')) {
return true;
}
}
diff --git a/src/corelib/tools/qdatetime.h b/src/corelib/tools/qdatetime.h
index ed7d8adb5f..22db5a4830 100644
--- a/src/corelib/tools/qdatetime.h
+++ b/src/corelib/tools/qdatetime.h
@@ -121,8 +121,8 @@ QT_DEPRECATED inline bool setYMD(int y, int m, int d)
private:
static inline qint64 nullJd() { return std::numeric_limits<qint64>::min(); }
- static inline qint64 minJd() { return std::numeric_limits<qint64>::min() / 2; }
- static inline qint64 maxJd() { return (std::numeric_limits<qint64>::max()) / 2; }
+ static inline qint64 minJd() { return Q_INT64_C(-784350574879); }
+ static inline qint64 maxJd() { return Q_INT64_C( 784354017364); }
qint64 jd;
diff --git a/src/corelib/tools/qmap.cpp b/src/corelib/tools/qmap.cpp
index dea87c6b63..7c33d60750 100644
--- a/src/corelib/tools/qmap.cpp
+++ b/src/corelib/tools/qmap.cpp
@@ -50,7 +50,7 @@
QT_BEGIN_NAMESPACE
-const QMapDataBase QMapDataBase::shared_null = { Q_REFCOUNT_INITIALIZE_STATIC, 0, { 0, 0, 0 } };
+const QMapDataBase QMapDataBase::shared_null = { Q_REFCOUNT_INITIALIZE_STATIC, 0, { 0, 0, 0 }, 0 };
const QMapNodeBase *QMapNodeBase::nextNode() const
{
@@ -177,6 +177,12 @@ void QMapDataBase::freeNodeAndRebalance(QMapNodeBase *z)
QMapNodeBase *x_parent;
if (y->left == 0) {
x = y->right;
+ if (y == mostLeftNode) {
+ if (x)
+ mostLeftNode = x; // It cannot have (left) children due the red black invariant.
+ else
+ mostLeftNode = y->parent();
+ }
} else {
if (y->right == 0) {
x = y->left;
@@ -290,6 +296,13 @@ void QMapDataBase::freeNodeAndRebalance(QMapNodeBase *z)
--size;
}
+void QMapDataBase::recalcMostLeftNode()
+{
+ mostLeftNode = &header;
+ while (mostLeftNode->left)
+ mostLeftNode = mostLeftNode->left;
+}
+
static inline int qMapAlignmentThreshold()
{
// malloc on 32-bit platforms should return pointers that are 8-byte
@@ -324,6 +337,8 @@ QMapNodeBase *QMapDataBase::createNode(int alloc, int alignment, QMapNodeBase *p
if (parent) {
if (left) {
parent->left = node;
+ if (parent == mostLeftNode)
+ mostLeftNode = node;
} else {
parent->right = node;
}
@@ -352,6 +367,7 @@ QMapDataBase *QMapDataBase::createData()
d->header.p = 0;
d->header.left = 0;
d->header.right = 0;
+ d->mostLeftNode = &(d->header);
return d;
}
diff --git a/src/corelib/tools/qmap.h b/src/corelib/tools/qmap.h
index 642cf82f08..d44a79473d 100644
--- a/src/corelib/tools/qmap.h
+++ b/src/corelib/tools/qmap.h
@@ -173,11 +173,13 @@ struct Q_CORE_EXPORT QMapDataBase
QtPrivate::RefCount ref;
int size;
QMapNodeBase header;
+ QMapNodeBase *mostLeftNode;
void rotateLeft(QMapNodeBase *x);
void rotateRight(QMapNodeBase *x);
void rebalance(QMapNodeBase *x);
void freeNodeAndRebalance(QMapNodeBase *z);
+ void recalcMostLeftNode();
QMapNodeBase *createNode(int size, int alignment, QMapNodeBase *parent, bool left);
void freeTree(QMapNodeBase *root, int alignment);
@@ -197,8 +199,8 @@ struct QMapData : public QMapDataBase
const Node *end() const { return static_cast<const Node *>(&header); }
Node *end() { return static_cast<Node *>(&header); }
- const Node *begin() const { if (root()) return root()->minimumNode(); return end(); }
- Node *begin() { if (root()) return root()->minimumNode(); return end(); }
+ const Node *begin() const { if (root()) return static_cast<const Node*>(mostLeftNode); return end(); }
+ Node *begin() { if (root()) return static_cast<Node*>(mostLeftNode); return end(); }
void deleteNode(Node *z);
Node *findNode(const Key &akey) const;
@@ -555,6 +557,7 @@ inline QMap<Key, T>::QMap(const QMap<Key, T> &other)
if (other.d->header.left) {
d->header.left = static_cast<Node *>(other.d->header.left)->copy(d);
d->header.left->setParent(&d->header);
+ d->recalcMostLeftNode();
}
}
}
@@ -780,6 +783,7 @@ Q_OUTOFLINE_TEMPLATE void QMap<Key, T>::detach_helper()
if (!d->ref.deref())
d->destroy();
d = x;
+ d->recalcMostLeftNode();
}
template <class Key, class T>
@@ -935,7 +939,7 @@ Q_OUTOFLINE_TEMPLATE QMap<Key, T>::QMap(const std::map<Key, T> &other)
typename std::map<Key,T>::const_iterator it = other.end();
while (it != other.begin()) {
--it;
- insert((*it).first, (*it).second);
+ d->createNode((*it).first, (*it).second, d->begin(), true); // insert on most left node.
}
}
@@ -946,7 +950,7 @@ Q_OUTOFLINE_TEMPLATE std::map<Key, T> QMap<Key, T>::toStdMap() const
const_iterator it = end();
while (it != begin()) {
--it;
- map.insert(std::pair<Key, T>(it.key(), it.value()));
+ map.insert(map.begin(), std::pair<Key, T>(it.key(), it.value()));
}
return map;
}
diff --git a/src/corelib/tools/qregexp.cpp b/src/corelib/tools/qregexp.cpp
index e87e5efc1f..7aea083788 100644
--- a/src/corelib/tools/qregexp.cpp
+++ b/src/corelib/tools/qregexp.cpp
@@ -1324,14 +1324,11 @@ Q_CORE_EXPORT QString qt_regexp_toCanonical(const QString &pattern, QRegExp::Pat
#ifndef QT_NO_REGEXP_WILDCARD
case QRegExp::Wildcard:
return wc2rx(pattern, false);
- break;
case QRegExp::WildcardUnix:
return wc2rx(pattern, true);
- break;
#endif
case QRegExp::FixedString:
return QRegExp::escape(pattern);
- break;
case QRegExp::W3CXmlSchema11:
default:
return pattern;
diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h
index 94733f77da..2c688db507 100644
--- a/src/corelib/tools/qvector.h
+++ b/src/corelib/tools/qvector.h
@@ -252,7 +252,7 @@ void QVector<T>::defaultConstruct(T *from, T *to)
new (from++) T();
}
} else {
- ::memset(from, 0, (to - from) * sizeof(T));
+ ::memset(static_cast<void *>(from), 0, (to - from) * sizeof(T));
}
}
@@ -267,7 +267,7 @@ void QVector<T>::copyConstruct(const T *srcFrom, const T *srcTo, T *dstFrom)
while (srcFrom != srcTo)
new (dstFrom++) T(*srcFrom++);
} else {
- ::memcpy(dstFrom, srcFrom, (srcTo - srcFrom) * sizeof(T));
+ ::memcpy(static_cast<void *>(dstFrom), static_cast<const void *>(srcFrom), (srcTo - srcFrom) * sizeof(T));
}
}
@@ -467,7 +467,7 @@ void QVector<T>::reallocData(const int asize, const int aalloc, QArrayData::Allo
new (dst++) T(*srcBegin++);
}
} else {
- ::memcpy(static_cast<void *>(dst), srcBegin, (srcEnd - srcBegin) * sizeof(T));
+ ::memcpy(static_cast<void *>(dst), static_cast<void *>(srcBegin), (srcEnd - srcBegin) * sizeof(T));
dst += srcEnd - srcBegin;
// destruct unused / not moved data
diff --git a/src/dbus/qdbusdemarshaller.cpp b/src/dbus/qdbusdemarshaller.cpp
index c25e7a33ec..31e3fe2bdb 100644
--- a/src/dbus/qdbusdemarshaller.cpp
+++ b/src/dbus/qdbusdemarshaller.cpp
@@ -300,7 +300,6 @@ QVariant QDBusDemarshaller::toVariantInternal()
// I hope you never dereference this pointer!
return QVariant::fromValue<void *>(ptr);
- break;
};
}
diff --git a/src/gui/accessible/qaccessible.cpp b/src/gui/accessible/qaccessible.cpp
index feaf468c54..61f1773d70 100644
--- a/src/gui/accessible/qaccessible.cpp
+++ b/src/gui/accessible/qaccessible.cpp
@@ -41,8 +41,6 @@
#include "qaccessible.h"
-#ifndef QT_NO_ACCESSIBILITY
-
#include "qaccessibleplugin.h"
#include "qaccessibleobject.h"
#include "qaccessiblebridge.h"
@@ -1265,4 +1263,3 @@ QDebug operator<<(QDebug d, const QAccessibleEvent &ev)
QT_END_NAMESPACE
-#endif
diff --git a/src/gui/accessible/qaccessible.h b/src/gui/accessible/qaccessible.h
index 08c0952a5a..1fb6c65482 100644
--- a/src/gui/accessible/qaccessible.h
+++ b/src/gui/accessible/qaccessible.h
@@ -58,8 +58,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-#ifndef QT_NO_ACCESSIBILITY
-
class QAccessibleInterface;
class QAccessibleEvent;
class QWindow;
@@ -678,8 +676,6 @@ inline void QAccessible::updateAccessibility(QObject *object, int child, Event r
}
#endif
-#endif // QT_NO_ACCESSIBILITY
-
QT_END_NAMESPACE
QT_END_HEADER
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index 25999b7d06..9da360bc26 100644
--- a/src/gui/image/qimage.cpp
+++ b/src/gui/image/qimage.cpp
@@ -4915,43 +4915,33 @@ int QImage::metric(PaintDeviceMetric metric) const
switch (metric) {
case PdmWidth:
return d->width;
- break;
case PdmHeight:
return d->height;
- break;
case PdmWidthMM:
return qRound(d->width * 1000 / d->dpmx);
- break;
case PdmHeightMM:
return qRound(d->height * 1000 / d->dpmy);
- break;
case PdmNumColors:
return d->colortable.size();
- break;
case PdmDepth:
return d->depth;
- break;
case PdmDpiX:
return qRound(d->dpmx * 0.0254);
- break;
case PdmDpiY:
return qRound(d->dpmy * 0.0254);
- break;
case PdmPhysicalDpiX:
return qRound(d->dpmx * 0.0254);
- break;
case PdmPhysicalDpiY:
return qRound(d->dpmy * 0.0254);
- break;
default:
qWarning("QImage::metric(): Unhandled metric type %d", metric);
diff --git a/src/gui/image/qpnghandler.cpp b/src/gui/image/qpnghandler.cpp
index 2307ceb7ae..8434282178 100644
--- a/src/gui/image/qpnghandler.cpp
+++ b/src/gui/image/qpnghandler.cpp
@@ -849,13 +849,6 @@ bool Q_INTERNAL_WIN_NO_THROW QPNGImageWriter::writeImage(const QImage& image, vo
png_set_gAMA(png_ptr, info_ptr, 1.0/gamma);
}
- png_color_8 sig_bit;
- sig_bit.red = 8;
- sig_bit.green = 8;
- sig_bit.blue = 8;
- sig_bit.alpha = image.hasAlphaChannel() ? 8 : 0;
- png_set_sBIT(png_ptr, info_ptr, &sig_bit);
-
if (image.format() == QImage::Format_MonoLSB)
png_set_packswap(png_ptr);
diff --git a/src/gui/itemmodels/qstandarditemmodel.cpp b/src/gui/itemmodels/qstandarditemmodel.cpp
index 6e919eb0b2..fdd00fe980 100644
--- a/src/gui/itemmodels/qstandarditemmodel.cpp
+++ b/src/gui/itemmodels/qstandarditemmodel.cpp
@@ -2935,7 +2935,7 @@ QMimeData *QStandardItemModel::mimeData(const QModelIndexList &indexes) const
return data;
QByteArray encoded;
QDataStream stream(&encoded, QIODevice::WriteOnly);
-
+
QSet<QStandardItem*> itemsSet;
QStack<QStandardItem*> stack;
itemsSet.reserve(indexes.count());
@@ -2945,7 +2945,7 @@ QMimeData *QStandardItemModel::mimeData(const QModelIndexList &indexes) const
itemsSet << item;
stack.push(item);
}
-
+
//remove duplicates childrens
{
QSet<QStandardItem *> seen;
@@ -2954,7 +2954,7 @@ QMimeData *QStandardItemModel::mimeData(const QModelIndexList &indexes) const
if (seen.contains(itm))
continue;
seen.insert(itm);
-
+
const QVector<QStandardItem*> &childList = itm->d_func()->children;
for (int i = 0; i < childList.count(); ++i) {
QStandardItem *chi = childList.at(i);
@@ -2968,17 +2968,17 @@ QMimeData *QStandardItemModel::mimeData(const QModelIndexList &indexes) const
}
}
}
-
+
stack.reserve(itemsSet.count());
foreach (QStandardItem *item, itemsSet) {
stack.push(item);
}
-
+
//stream everything recursively
while (!stack.isEmpty()) {
QStandardItem *item = stack.pop();
if(itemsSet.contains(item)) { //if the item is selection 'top-level', strem its position
- stream << item->row() << item->column();
+ stream << item->row() << item->column();
}
if(item) {
stream << *item << item->columnCount() << item->d_ptr->children.count();
@@ -2996,7 +2996,7 @@ QMimeData *QStandardItemModel::mimeData(const QModelIndexList &indexes) const
/* \internal
Used by QStandardItemModel::dropMimeData
- stream out an item and his children
+ stream out an item and his children
*/
void QStandardItemModelPrivate::decodeDataRecursive(QDataStream &stream, QStandardItem *item)
{
@@ -3004,9 +3004,9 @@ void QStandardItemModelPrivate::decodeDataRecursive(QDataStream &stream, QStanda
stream >> *item;
stream >> colCount >> childCount;
item->setColumnCount(colCount);
-
+
int childPos = childCount;
-
+
while(childPos > 0) {
childPos--;
QStandardItem *child = createItem();
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index 64d2f8001f..efb34ffe9f 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -105,6 +105,7 @@ QPointF QGuiApplicationPrivate::lastCursorPosition(0.0, 0.0);
bool QGuiApplicationPrivate::tabletState = false;
QWindow *QGuiApplicationPrivate::tabletPressTarget = 0;
+QWindow *QGuiApplicationPrivate::currentMouseWindow = 0;
QPlatformIntegration *QGuiApplicationPrivate::platform_integration = 0;
QPlatformTheme *QGuiApplicationPrivate::platform_theme = 0;
@@ -455,7 +456,19 @@ void QGuiApplicationPrivate::showModalWindow(QWindow *modal)
{
self->modalWindowList.prepend(modal);
- QEvent e(QEvent::WindowBlocked);
+ // Send leave for currently entered window if it should be blocked
+ if (currentMouseWindow && (currentMouseWindow->windowType() & Qt::Popup) != Qt::Popup) {
+ bool shouldBeBlocked = self->isWindowBlocked(currentMouseWindow);
+ if (shouldBeBlocked) {
+ // Remove the new window from modalWindowList temporarily so leave can go through
+ self->modalWindowList.removeFirst();
+ QEvent e(QEvent::Leave);
+ QGuiApplication::sendEvent(currentMouseWindow, &e);
+ currentMouseWindow = 0;
+ self->modalWindowList.prepend(modal);
+ }
+ }
+
QWindowList windows = QGuiApplication::topLevelWindows();
for (int i = 0; i < windows.count(); ++i) {
QWindow *window = windows.at(i);
@@ -470,7 +483,6 @@ void QGuiApplicationPrivate::hideModalWindow(QWindow *window)
{
self->modalWindowList.removeAll(window);
- QEvent e(QEvent::WindowUnblocked);
QWindowList windows = QGuiApplication::topLevelWindows();
for (int i = 0; i < windows.count(); ++i) {
QWindow *window = windows.at(i);
@@ -1410,6 +1422,8 @@ void QGuiApplicationPrivate::processEnterEvent(QWindowSystemInterfacePrivate::En
return;
}
+ currentMouseWindow = e->enter;
+
QEvent event(QEvent::Enter);
QCoreApplication::sendSpontaneousEvent(e->enter.data(), &event);
}
@@ -1423,6 +1437,8 @@ void QGuiApplicationPrivate::processLeaveEvent(QWindowSystemInterfacePrivate::Le
return;
}
+ currentMouseWindow = 0;
+
QEvent event(QEvent::Leave);
QCoreApplication::sendSpontaneousEvent(e->leave.data(), &event);
}
diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h
index 44a9275688..c9eb672220 100644
--- a/src/gui/kernel/qguiapplication_p.h
+++ b/src/gui/kernel/qguiapplication_p.h
@@ -189,6 +189,7 @@ public:
static QPointF lastCursorPosition;
static bool tabletState;
static QWindow *tabletPressTarget;
+ static QWindow *currentMouseWindow;
#ifndef QT_NO_CLIPBOARD
static QClipboard *qt_clipboard;
diff --git a/src/gui/kernel/qplatformintegration.cpp b/src/gui/kernel/qplatformintegration.cpp
index cf55c59bab..5259ed9164 100644
--- a/src/gui/kernel/qplatformintegration.cpp
+++ b/src/gui/kernel/qplatformintegration.cpp
@@ -195,6 +195,10 @@ QPlatformServices *QPlatformIntegration::services() const
\value BufferQueueingOpenGL The OpenGL implementation on the platform will queue
up buffers when swapBuffers() is called and block only when its buffer pipeline
is full, rather than block immediately.
+
+ \value MultipleWindows The platform supports multiple QWindows, i.e. does some kind
+ of compositing either client or server side. Some platforms might only support a
+ single fullscreen window.
*/
diff --git a/src/gui/kernel/qplatformintegration.h b/src/gui/kernel/qplatformintegration.h
index 7e8888407c..b4c8ebff5a 100644
--- a/src/gui/kernel/qplatformintegration.h
+++ b/src/gui/kernel/qplatformintegration.h
@@ -83,11 +83,12 @@ class Q_GUI_EXPORT QPlatformIntegration
public:
enum Capability {
ThreadedPixmaps = 1,
- OpenGL = 2,
- ThreadedOpenGL = 3,
- SharedGraphicsCache = 4,
- BufferQueueingOpenGL = 5,
- WindowMasks = 6
+ OpenGL,
+ ThreadedOpenGL,
+ SharedGraphicsCache,
+ BufferQueueingOpenGL,
+ WindowMasks,
+ MultipleWindows
};
virtual ~QPlatformIntegration() { }
diff --git a/src/gui/kernel/qplatformmenu.h b/src/gui/kernel/qplatformmenu.h
index 64f738b331..7e7ccdb294 100644
--- a/src/gui/kernel/qplatformmenu.h
+++ b/src/gui/kernel/qplatformmenu.h
@@ -102,6 +102,7 @@ public:
virtual void setText(const QString &text) = 0;
virtual void setEnabled(bool enabled) = 0;
+ virtual void setVisible(bool visible) = 0;
virtual QPlatformMenuItem *menuItemAt(int position) const = 0;
virtual QPlatformMenuItem *menuItemForTag(quintptr tag) const = 0;
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp
index 4f1610cb21..d845be3d01 100644
--- a/src/gui/kernel/qwindow.cpp
+++ b/src/gui/kernel/qwindow.cpp
@@ -214,6 +214,8 @@ QWindow::~QWindow()
{
if (QGuiApplicationPrivate::focus_window == this)
QGuiApplicationPrivate::focus_window = 0;
+ if (QGuiApplicationPrivate::currentMouseWindow == this)
+ QGuiApplicationPrivate::currentMouseWindow = 0;
QGuiApplicationPrivate::window_list.removeAll(this);
destroy();
}
@@ -939,9 +941,24 @@ void QWindow::setMinimumSize(const QSize &size)
QSize adjustedSize = QSize(qBound(0, size.width(), QWINDOWSIZE_MAX), qBound(0, size.height(), QWINDOWSIZE_MAX));
if (d->minimumSize == adjustedSize)
return;
+ QSize oldSize = d->minimumSize;
d->minimumSize = adjustedSize;
if (d->platformWindow && isTopLevel())
d->platformWindow->propagateSizeHints();
+ if (d->minimumSize.width() != oldSize.width())
+ emit minimumWidthChanged(d->minimumSize.width());
+ if (d->minimumSize.height() != oldSize.height())
+ emit minimumHeightChanged(d->minimumSize.height());
+}
+
+void QWindow::setMinimumWidth(int w)
+{
+ setMinimumSize(QSize(w, minimumHeight()));
+}
+
+void QWindow::setMinimumHeight(int h)
+{
+ setMinimumSize(QSize(minimumWidth(), h));
}
/*!
@@ -957,9 +974,24 @@ void QWindow::setMaximumSize(const QSize &size)
QSize adjustedSize = QSize(qBound(0, size.width(), QWINDOWSIZE_MAX), qBound(0, size.height(), QWINDOWSIZE_MAX));
if (d->maximumSize == adjustedSize)
return;
+ QSize oldSize = d->maximumSize;
d->maximumSize = adjustedSize;
if (d->platformWindow && isTopLevel())
d->platformWindow->propagateSizeHints();
+ if (d->maximumSize.width() != oldSize.width())
+ emit maximumWidthChanged(d->maximumSize.width());
+ if (d->maximumSize.height() != oldSize.height())
+ emit maximumHeightChanged(d->maximumSize.height());
+}
+
+void QWindow::setMaximumWidth(int w)
+{
+ setMaximumSize(QSize(w, maximumHeight()));
+}
+
+void QWindow::setMaximumHeight(int h)
+{
+ setMaximumSize(QSize(maximumWidth(), h));
}
/*!
@@ -1058,6 +1090,26 @@ void QWindow::setGeometry(const QRect &rect)
*/
/*!
+ \property QWindow::minimumWidth
+ \brief the minimum width of the window's geometry
+*/
+
+/*!
+ \property QWindow::minimumHeight
+ \brief the minimum height of the window's geometry
+*/
+
+/*!
+ \property QWindow::maximumWidth
+ \brief the maximum width of the window's geometry
+*/
+
+/*!
+ \property QWindow::maximumHeight
+ \brief the maximum height of the window's geometry
+*/
+
+/*!
Returns the geometry of the window, excluding its window frame.
\sa frameMargins(), frameGeometry()
@@ -1445,6 +1497,8 @@ bool QWindow::close()
if (QGuiApplicationPrivate::focus_window == this)
QGuiApplicationPrivate::focus_window = 0;
+ if (QGuiApplicationPrivate::currentMouseWindow == this)
+ QGuiApplicationPrivate::currentMouseWindow = 0;
QGuiApplicationPrivate::window_list.removeAll(this);
destroy();
diff --git a/src/gui/kernel/qwindow.h b/src/gui/kernel/qwindow.h
index 62268cd88a..4832adfb63 100644
--- a/src/gui/kernel/qwindow.h
+++ b/src/gui/kernel/qwindow.h
@@ -104,6 +104,10 @@ class Q_GUI_EXPORT QWindow : public QObject, public QSurface
Q_PROPERTY(QPoint pos READ pos WRITE setPos)
Q_PROPERTY(QSize size READ size WRITE resize)
Q_PROPERTY(QRect geometry READ geometry WRITE setGeometry)
+ Q_PROPERTY(int minimumWidth READ minimumWidth WRITE setMinimumWidth NOTIFY minimumWidthChanged)
+ Q_PROPERTY(int minimumHeight READ minimumHeight WRITE setMinimumHeight NOTIFY minimumHeightChanged)
+ Q_PROPERTY(int maximumWidth READ maximumWidth WRITE setMaximumWidth NOTIFY maximumWidthChanged)
+ Q_PROPERTY(int maximumHeight READ maximumHeight WRITE setMaximumHeight NOTIFY maximumHeightChanged)
Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged)
Q_PROPERTY(Qt::ScreenOrientation contentOrientation READ contentOrientation WRITE reportContentOrientationChange NOTIFY contentOrientationChanged)
#ifndef QT_NO_CURSOR
@@ -170,6 +174,11 @@ public:
bool isExposed() const;
+ int minimumWidth() const { return minimumSize().width(); }
+ int minimumHeight() const { return minimumSize().height(); }
+ int maximumWidth() const { return maximumSize().width(); }
+ int maximumHeight() const { return maximumSize().height(); }
+
QSize minimumSize() const;
QSize maximumSize() const;
QSize baseSize() const;
@@ -273,6 +282,11 @@ public Q_SLOTS:
setGeometry(QRect(x(), y(), width(), arg));
}
+ void setMinimumWidth(int w);
+ void setMinimumHeight(int h);
+ void setMaximumWidth(int w);
+ void setMaximumHeight(int h);
+
Q_SIGNALS:
void screenChanged(QScreen *screen);
void windowModalityChanged(Qt::WindowModality windowModality);
@@ -283,6 +297,11 @@ Q_SIGNALS:
void widthChanged(int arg);
void heightChanged(int arg);
+ void minimumWidthChanged(int arg);
+ void minimumHeightChanged(int arg);
+ void maximumWidthChanged(int arg);
+ void maximumHeightChanged(int arg);
+
void visibleChanged(bool arg);
void contentOrientationChanged(Qt::ScreenOrientation orientation);
diff --git a/src/gui/kernel/qwindow_p.h b/src/gui/kernel/qwindow_p.h
index 159f05d1a5..bce6a4ff04 100644
--- a/src/gui/kernel/qwindow_p.h
+++ b/src/gui/kernel/qwindow_p.h
@@ -80,6 +80,7 @@ public:
, positionPolicy(WindowFrameExclusive)
, contentOrientation(Qt::PrimaryOrientation)
, windowOrientation(Qt::PrimaryOrientation)
+ , minimumSize(0, 0)
, maximumSize(QWINDOWSIZE_MAX, QWINDOWSIZE_MAX)
, modality(Qt::NonModal)
, blockedByModalWindow(false)
diff --git a/src/gui/opengl/qopenglframebufferobject.cpp b/src/gui/opengl/qopenglframebufferobject.cpp
index ef8e420c27..380ada37e0 100644
--- a/src/gui/opengl/qopenglframebufferobject.cpp
+++ b/src/gui/opengl/qopenglframebufferobject.cpp
@@ -349,7 +349,6 @@ bool QOpenGLFramebufferObjectPrivate::checkFramebufferStatus(QOpenGLContext *ctx
case GL_NO_ERROR:
case GL_FRAMEBUFFER_COMPLETE:
return true;
- break;
case GL_FRAMEBUFFER_UNSUPPORTED:
qDebug("QOpenGLFramebufferObject: Unsupported framebuffer format.");
break;
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp
index 7070e5732d..0cfe953e43 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -7498,8 +7498,11 @@ start_lengthVariant:
l.setLineWidth(lineWidth);
height += leading;
+
+ // Make sure lines are positioned on whole pixels
+ height = qCeil(height);
l.setPosition(QPointF(0., height));
- height += l.height();
+ height += textLayout.engine()->lines[l.lineNumber()].height().toReal();
width = qMax(width, l.naturalTextWidth());
if (!dontclip && !brect && height >= r.height())
break;
diff --git a/src/gui/painting/qpathclipper.cpp b/src/gui/painting/qpathclipper.cpp
index 8cf57a8987..4b53257832 100644
--- a/src/gui/painting/qpathclipper.cpp
+++ b/src/gui/painting/qpathclipper.cpp
@@ -1630,7 +1630,6 @@ QPainterPath QPathClipper::clip(Operation operation)
result.addRect(subjectBounds);
return result;
}
- break;
case BoolAnd:
return clipPath;
case BoolOr:
diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp
index bdcf166243..fa4e7a75bc 100644
--- a/src/gui/text/qfontengine.cpp
+++ b/src/gui/text/qfontengine.cpp
@@ -1370,7 +1370,9 @@ bool QFontEngineMulti::stringToCMap(const QChar *str, int len,
bool surrogate = (str[i].isHighSurrogate() && i < len-1 && str[i+1].isLowSurrogate());
uint ucs4 = surrogate ? QChar::surrogateToUcs4(str[i], str[i+1]) : str[i].unicode();
if (glyphs->glyphs[glyph_pos] == 0 && str[i].category() != QChar::Separator_Line) {
- QGlyphLayoutInstance tmp = glyphs->instance(glyph_pos);
+ QGlyphLayoutInstance tmp;
+ if (!(flags & GlyphIndicesOnly))
+ tmp = glyphs->instance(glyph_pos);
for (int x=1; x < engines.size(); ++x) {
if (engines.at(x) == 0 && !shouldLoadFontEngineForCharacter(x, ucs4))
continue;
@@ -1400,9 +1402,8 @@ bool QFontEngineMulti::stringToCMap(const QChar *str, int len,
}
// ensure we use metrics from the 1st font when we use the fallback image.
- if (!glyphs->glyphs[glyph_pos]) {
+ if (!(flags & GlyphIndicesOnly) && !glyphs->glyphs[glyph_pos])
glyphs->setInstance(glyph_pos, tmp);
- }
}
if (surrogate)
diff --git a/src/gui/text/qsyntaxhighlighter.cpp b/src/gui/text/qsyntaxhighlighter.cpp
index 7baf55caea..f183e1eb20 100644
--- a/src/gui/text/qsyntaxhighlighter.cpp
+++ b/src/gui/text/qsyntaxhighlighter.cpp
@@ -119,18 +119,14 @@ void QSyntaxHighlighterPrivate::applyFormatChanges()
formatsChanged = true;
}
- QTextCharFormat emptyFormat;
-
- QTextLayout::FormatRange r;
- r.start = -1;
-
int i = 0;
while (i < formatChanges.count()) {
+ QTextLayout::FormatRange r;
- while (i < formatChanges.count() && formatChanges.at(i) == emptyFormat)
+ while (i < formatChanges.count() && formatChanges.at(i) == r.format)
++i;
- if (i >= formatChanges.count())
+ if (i == formatChanges.count())
break;
r.start = i;
@@ -139,9 +135,7 @@ void QSyntaxHighlighterPrivate::applyFormatChanges()
while (i < formatChanges.count() && formatChanges.at(i) == r.format)
++i;
- if (i >= formatChanges.count())
- break;
-
+ Q_ASSERT(i <= formatChanges.count());
r.length = i - r.start;
if (preeditAreaLength != 0) {
@@ -153,21 +147,6 @@ void QSyntaxHighlighterPrivate::applyFormatChanges()
ranges << r;
formatsChanged = true;
- r.start = -1;
- }
-
- if (r.start != -1) {
- r.length = formatChanges.count() - r.start;
-
- if (preeditAreaLength != 0) {
- if (r.start >= preeditAreaStart)
- r.start += preeditAreaLength;
- else if (r.start + r.length >= preeditAreaStart)
- r.length += preeditAreaLength;
- }
-
- ranges << r;
- formatsChanged = true;
}
if (formatsChanged) {
diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp
index a0a92897c5..0ca8e8d9a6 100644
--- a/src/gui/text/qtextlayout.cpp
+++ b/src/gui/text/qtextlayout.cpp
@@ -916,7 +916,7 @@ QRectF QTextLayout::boundingRect() const
QFixed lineWidth = si.width < QFIXED_MAX ? qMax(si.width, si.textWidth) : si.textWidth;
xmax = qMax(xmax, si.x+lineWidth);
// ### shouldn't the ascent be used in ymin???
- ymax = qMax(ymax, si.y+si.height());
+ ymax = qMax(ymax, si.y+si.height().ceil());
}
return QRectF(xmin.toReal(), ymin.toReal(), (xmax-xmin).toReal(), (ymax-ymin).toReal());
}
@@ -1466,7 +1466,7 @@ qreal QTextLine::descent() const
*/
qreal QTextLine::height() const
{
- return eng->lines[index].height().toReal();
+ return eng->lines[index].height().ceil().toReal();
}
/*!
diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp
index 51076c6c22..34496cb380 100644
--- a/src/network/access/qhttpnetworkconnectionchannel.cpp
+++ b/src/network/access/qhttpnetworkconnectionchannel.cpp
@@ -296,7 +296,6 @@ bool QHttpNetworkConnectionChannel::sendRequest()
// premature eof happened
connection->d_func()->emitReplyError(socket, reply, QNetworkReply::UnknownNetworkError);
return false;
- break;
} else if (readPointer == 0 || currentReadSize == 0) {
// nothing to read currently, break the loop
break;
diff --git a/src/network/access/qhttpnetworkrequest.cpp b/src/network/access/qhttpnetworkrequest.cpp
index e9a66287f9..ef65efddca 100644
--- a/src/network/access/qhttpnetworkrequest.cpp
+++ b/src/network/access/qhttpnetworkrequest.cpp
@@ -83,31 +83,22 @@ QByteArray QHttpNetworkRequestPrivate::methodName() const
switch (operation) {
case QHttpNetworkRequest::Get:
return "GET";
- break;
case QHttpNetworkRequest::Head:
return "HEAD";
- break;
case QHttpNetworkRequest::Post:
return "POST";
- break;
case QHttpNetworkRequest::Options:
return "OPTIONS";
- break;
case QHttpNetworkRequest::Put:
return "PUT";
- break;
case QHttpNetworkRequest::Delete:
return "DELETE";
- break;
case QHttpNetworkRequest::Trace:
return "TRACE";
- break;
case QHttpNetworkRequest::Connect:
return "CONNECT";
- break;
case QHttpNetworkRequest::Custom:
return customVerb;
- break;
default:
break;
}
diff --git a/src/network/access/qnetworkrequest.cpp b/src/network/access/qnetworkrequest.cpp
index 6d036ad491..b7d8dbbb20 100644
--- a/src/network/access/qnetworkrequest.cpp
+++ b/src/network/access/qnetworkrequest.cpp
@@ -979,53 +979,41 @@ static int name_to_month(const char* month_str)
switch (month_str[1]) {
case 'a':
return 1;
- break;
case 'u':
switch (month_str[2] ) {
case 'n':
return 6;
- break;
case 'l':
return 7;
- break;
}
}
break;
case 'F':
return 2;
- break;
case 'M':
switch (month_str[2] ) {
case 'r':
return 3;
- break;
case 'y':
return 5;
- break;
}
break;
case 'A':
switch (month_str[1]) {
case 'p':
return 4;
- break;
case 'u':
return 8;
- break;
}
break;
case 'O':
return 10;
- break;
case 'S':
return 9;
- break;
case 'N':
return 11;
- break;
case 'D':
return 12;
- break;
}
return 0;
diff --git a/src/network/kernel/qnetworkproxy.cpp b/src/network/kernel/qnetworkproxy.cpp
index adaefac440..aa16be2b4a 100644
--- a/src/network/kernel/qnetworkproxy.cpp
+++ b/src/network/kernel/qnetworkproxy.cpp
@@ -253,6 +253,9 @@ public:
, httpSocketEngineHandler(0)
#endif
{
+#ifdef QT_USE_SYSTEM_PROXIES
+ setApplicationProxyFactory(new QSystemConfigurationProxyFactory);
+#endif
#ifndef QT_NO_SOCKS5
socks5SocketEngineHandler = new QSocks5SocketEngineHandler();
#endif
@@ -1557,10 +1560,9 @@ void QNetworkProxyFactory::setApplicationProxyFactory(QNetworkProxyFactory *fact
\li On Windows platforms, this function may take several seconds to
execute depending on the configuration of the user's system.
- \li On BlackBerry, this function ignores network configuration specified
- in \a query. Only UrlRequest quieries are supported. SOCKS is not supported.
- The proxy information is retrieved only for the default configuration.
- Also, PAC and exclusion lists are currently not supported.
+ \li On BlackBerry, only UrlRequest queries are supported. SOCKS is
+ not supported. The proxy credentials are only retrieved for the
+ default configuration.
\endlist
*/
diff --git a/src/network/kernel/qnetworkproxy_blackberry.cpp b/src/network/kernel/qnetworkproxy_blackberry.cpp
index c257f085ff..2743b90404 100644
--- a/src/network/kernel/qnetworkproxy_blackberry.cpp
+++ b/src/network/kernel/qnetworkproxy_blackberry.cpp
@@ -79,11 +79,34 @@ QList<QNetworkProxy> QNetworkProxyFactory::systemProxyForQuery(const QNetworkPro
netstatus_proxy_details_t details;
memset(&details, 0, sizeof(netstatus_proxy_details_t));
+
+#if BPS_VERSION >= 3001001
+
+ QByteArray bUrl(url.toEncoded());
+ QString sInterface(query.networkConfiguration().name());
+ QByteArray bInterface;
+ if (!sInterface.isEmpty()) {
+ if (query.networkConfiguration().type() != QNetworkConfiguration::InternetAccessPoint) {
+ qWarning("Unsupported configuration type: %d", query.networkConfiguration().type());
+ return QList<QNetworkProxy>() << QNetworkProxy(QNetworkProxy::NoProxy);
+ }
+ bInterface = sInterface.toUtf8();
+ }
+
+ if (netstatus_get_proxy_details_for_url(bUrl.constData(), (bInterface.isEmpty() ? NULL : bInterface.constData()), &details) != BPS_SUCCESS) {
+ qWarning("netstatus_get_proxy_details_for_url failed! errno: %d", errno);
+ return QList<QNetworkProxy>() << QNetworkProxy(QNetworkProxy::NoProxy);
+ }
+
+#else
+
if (netstatus_get_proxy_details(&details) != BPS_SUCCESS) {
qWarning("netstatus_get_proxy_details failed! errno: %d", errno);
return QList<QNetworkProxy>() << QNetworkProxy(QNetworkProxy::NoProxy);
}
+#endif
+
if (details.http_proxy_host == NULL) { // No proxy
netstatus_free_proxy_details(&details);
return QList<QNetworkProxy>() << QNetworkProxy(QNetworkProxy::NoProxy);
diff --git a/src/network/socket/socket.pri b/src/network/socket/socket.pri
index 3429275a67..0204a92999 100644
--- a/src/network/socket/socket.pri
+++ b/src/network/socket/socket.pri
@@ -60,3 +60,7 @@ integrity: {
DEFINES += QT_LOCALSOCKET_TCP
}
+
+contains(QT_CONFIG, system-proxies) {
+ DEFINES += QT_USE_SYSTEM_PROXIES
+}
diff --git a/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp b/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp
index 469ac59dcf..ec2f1b02af 100644
--- a/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp
+++ b/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp
@@ -339,8 +339,8 @@ void QGLTextureGlyphCache::fillTexture(const Coord &c, glyph_t glyph, QFixed sub
if (!ctx->d_ptr->workaround_brokenAlphaTexSubImage_init) {
// don't know which driver versions exhibit this bug, so be conservative for now
- const QByteArray versionString(reinterpret_cast<const char*>(glGetString(GL_VERSION)));
- ctx->d_ptr->workaround_brokenAlphaTexSubImage = versionString.indexOf("NVIDIA") >= 0;
+ const QByteArray vendorString(reinterpret_cast<const char*>(glGetString(GL_VENDOR)));
+ ctx->d_ptr->workaround_brokenAlphaTexSubImage = vendorString.indexOf("NVIDIA") >= 0;
ctx->d_ptr->workaround_brokenAlphaTexSubImage_init = true;
}
diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp
index 413c7f5410..a5c2d1c8b2 100644
--- a/src/opengl/qglframebufferobject.cpp
+++ b/src/opengl/qglframebufferobject.cpp
@@ -393,7 +393,6 @@ bool QGLFramebufferObjectPrivate::checkFramebufferStatus() const
case GL_NO_ERROR:
case GL_FRAMEBUFFER_COMPLETE:
return true;
- break;
case GL_FRAMEBUFFER_UNSUPPORTED:
qDebug("QGLFramebufferObject: Unsupported framebuffer format.");
break;
diff --git a/src/platformsupport/dnd/qsimpledrag.cpp b/src/platformsupport/dnd/qsimpledrag.cpp
index d8ef17ede3..18e6b97e3c 100644
--- a/src/platformsupport/dnd/qsimpledrag.cpp
+++ b/src/platformsupport/dnd/qsimpledrag.cpp
@@ -253,8 +253,19 @@ void QBasicDrag::updateCursor(Qt::DropAction action)
}
QCursor *cursor = qApp->overrideCursor();
- if (cursor && cursorShape != cursor->shape()) {
- qApp->changeOverrideCursor(QCursor(cursorShape));
+ QPixmap pixmap = m_drag->dragCursor(action);
+ if (!cursor) {
+ qApp->changeOverrideCursor((pixmap.isNull()) ? QCursor(cursorShape) : QCursor(pixmap));
+ } else {
+ if (!pixmap.isNull()) {
+ if ((cursor->pixmap().cacheKey() != pixmap.cacheKey())) {
+ qApp->changeOverrideCursor(QCursor(pixmap));
+ }
+ } else {
+ if (cursorShape != cursor->shape()) {
+ qApp->changeOverrideCursor(QCursor(cursorShape));
+ }
+ }
}
updateAction(action);
}
diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
index 8306a47e4f..66ca2d37fa 100644
--- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
+++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
@@ -79,8 +79,8 @@ static const char *languageForWritingSystem[] = {
"my", // Myanmar
"ka", // Georgian
"km", // Khmer
- "zh-cn", // SimplifiedChinese
- "zh-tw", // TraditionalChinese
+ "zh-Hans", // SimplifiedChinese
+ "zh-Hant", // TraditionalChinese
"ja", // Japanese
"ko", // Korean
"vi", // Vietnamese
diff --git a/src/platformsupport/linuxaccessibility/atspiadaptor.cpp b/src/platformsupport/linuxaccessibility/atspiadaptor.cpp
index f69e2365d8..6926f546a2 100644
--- a/src/platformsupport/linuxaccessibility/atspiadaptor.cpp
+++ b/src/platformsupport/linuxaccessibility/atspiadaptor.cpp
@@ -1023,7 +1023,11 @@ void AtSpiAdaptor::notify(QAccessibleEvent *event)
case QAccessible::TextCaretMoved: {
if (sendObject || sendObject_text_caret_moved) {
QAIPointer iface = QAIPointer(event->accessibleInterface());
- Q_ASSERT(iface->textInterface());
+ if (!iface->textInterface()) {
+ qWarning() << "Sending TextCaretMoved from object that does not implement text interface: " << iface << iface->object();
+ return;
+ }
+
QString path = pathForInterface(iface);
QDBusVariant cursorData;
int pos = iface->textInterface()->cursorPosition();
@@ -1503,7 +1507,7 @@ QString AtSpiAdaptor::pathForObject(QObject *object) const
qAtspiDebug() << "AtSpiAdaptor::pathForObject: warning: creating path with QAction as object.";
}
quintptr uintptr = reinterpret_cast<quintptr>(object);
- if (!m_handledObjects.contains(uintptr))
+ if (!m_handledObjects.contains(uintptr) || m_handledObjects.value(uintptr) == 0)
m_handledObjects[uintptr] = QPointer<QObject>(object);
return QLatin1String(QSPI_OBJECT_PATH_PREFIX) + QString::number(uintptr);
}
diff --git a/src/plugins/accessible/qaccessiblebase.pri b/src/plugins/accessible/qaccessiblebase.pri
deleted file mode 100644
index 95c1fad13a..0000000000
--- a/src/plugins/accessible/qaccessiblebase.pri
+++ /dev/null
@@ -1,2 +0,0 @@
-target.path += $$[QT_INSTALL_PLUGINS]/accessible
-INSTALLS += target
diff --git a/src/plugins/accessible/widgets/itemviews.cpp b/src/plugins/accessible/widgets/itemviews.cpp
index 0aeff6e1a3..301838997f 100644
--- a/src/plugins/accessible/widgets/itemviews.cpp
+++ b/src/plugins/accessible/widgets/itemviews.cpp
@@ -79,8 +79,7 @@ int QAccessibleTable::logicalIndex(const QModelIndex &index) const
return -1;
int vHeader = verticalHeader() ? 1 : 0;
int hHeader = horizontalHeader() ? 1 : 0;
- // row * number columns + column + 1 for one based counting
- return (index.row() + hHeader)*(index.model()->columnCount() + vHeader) + (index.column() + vHeader) + 1;
+ return (index.row() + hHeader)*(index.model()->columnCount() + vHeader) + (index.column() + vHeader);
}
QAccessibleInterface *QAccessibleTable::childFromLogical(int logicalIndex) const
@@ -88,7 +87,6 @@ QAccessibleInterface *QAccessibleTable::childFromLogical(int logicalIndex) const
if (!view()->model())
return 0;
- logicalIndex--; // one based counting ftw
int vHeader = verticalHeader() ? 1 : 0;
int hHeader = horizontalHeader() ? 1 : 0;
@@ -376,16 +374,20 @@ int QAccessibleTable::indexOfChild(const QAccessibleInterface *iface) const
{
if (!view()->model())
return -1;
+ QSharedPointer<QAccessibleInterface> parent(iface->parent());
+ if (parent->object() != view())
+ return -1;
+
Q_ASSERT(iface->role() != QAccessible::TreeItem); // should be handled by tree class
if (iface->role() == QAccessible::Cell || iface->role() == QAccessible::ListItem) {
const QAccessibleTableCell* cell = static_cast<const QAccessibleTableCell*>(iface);
- return logicalIndex(cell->m_index) - 1;
+ return logicalIndex(cell->m_index);
} else if (iface->role() == QAccessible::ColumnHeader){
const QAccessibleTableHeaderCell* cell = static_cast<const QAccessibleTableHeaderCell*>(iface);
return cell->index + (verticalHeader() ? 1 : 0);
} else if (iface->role() == QAccessible::RowHeader){
const QAccessibleTableHeaderCell* cell = static_cast<const QAccessibleTableHeaderCell*>(iface);
- return (cell->index+1) * (view()->model()->rowCount()+1);
+ return (cell->index + 1) * (view()->model()->rowCount() + 1);
} else if (iface->role() == QAccessible::Pane) {
return 0; // corner button
} else {
@@ -424,8 +426,7 @@ QAccessibleInterface *QAccessibleTable::parent() const
QAccessibleInterface *QAccessibleTable::child(int index) const
{
- // Fixme: get rid of the +1 madness
- return childFromLogical(index + 1);
+ return childFromLogical(index);
}
void *QAccessibleTable::interface_cast(QAccessible::InterfaceType t)
@@ -470,9 +471,8 @@ QAccessibleInterface *QAccessibleTree::childAt(int x, int y) const
int row = treeView->d_func()->viewIndex(index) + (horizontalHeader() ? 1 : 0);
int column = index.column();
- int i = row * view()->model()->columnCount() + column + 1;
- Q_ASSERT(i > view()->model()->columnCount());
- return child(i - 1);
+ int i = row * view()->model()->columnCount() + column;
+ return child(i);
}
int QAccessibleTree::childCount() const
@@ -521,7 +521,11 @@ int QAccessibleTree::indexOfChild(const QAccessibleInterface *iface) const
{
if (!view()->model())
return -1;
- if (iface->role() == QAccessible::TreeItem) {
+ QSharedPointer<QAccessibleInterface> parent(iface->parent());
+ if (parent->object() != view())
+ return -1;
+
+ if (iface->role() == QAccessible::TreeItem) {
const QAccessibleTableCell* cell = static_cast<const QAccessibleTableCell*>(iface);
const QTreeView *treeView = qobject_cast<const QTreeView*>(view());
Q_ASSERT(treeView);
@@ -534,7 +538,7 @@ int QAccessibleTree::indexOfChild(const QAccessibleInterface *iface) const
return index;
} else if (iface->role() == QAccessible::ColumnHeader){
const QAccessibleTableHeaderCell* cell = static_cast<const QAccessibleTableHeaderCell*>(iface);
- //qDebug() << "QAccessibleTree::indexOfChild header " << cell->index << "is: " << cell->index + 1;
+ //qDebug() << "QAccessibleTree::indexOfChild header " << cell->index;
return cell->index;
} else {
qWarning() << "WARNING QAccessibleTable::indexOfChild invalid child"
@@ -846,7 +850,7 @@ void QAccessibleTableHeaderCell::setText(QAccessible::Text, const QString &)
bool QAccessibleTableHeaderCell::isValid() const
{
- return view && view->model() && (index > 0)
+ return view && view->model() && (index >= 0)
&& ((orientation == Qt::Horizontal) ? (index < view->model()->columnCount()) : (index < view->model()->rowCount()));
}
diff --git a/src/plugins/accessible/widgets/qaccessiblewidgets.cpp b/src/plugins/accessible/widgets/qaccessiblewidgets.cpp
index eac31b8068..9d0d3f0145 100644
--- a/src/plugins/accessible/widgets/qaccessiblewidgets.cpp
+++ b/src/plugins/accessible/widgets/qaccessiblewidgets.cpp
@@ -592,11 +592,6 @@ int QAccessibleDockWidget::indexOfChild(const QAccessibleInterface *child) const
return -1;
}
-QAccessible::Role QAccessibleDockWidget::role() const
-{
- return QAccessible::Window;
-}
-
QRect QAccessibleDockWidget::rect() const
{
QRect rect;
diff --git a/src/plugins/accessible/widgets/qaccessiblewidgets.h b/src/plugins/accessible/widgets/qaccessiblewidgets.h
index ec2583235f..b309d59c54 100644
--- a/src/plugins/accessible/widgets/qaccessiblewidgets.h
+++ b/src/plugins/accessible/widgets/qaccessiblewidgets.h
@@ -275,7 +275,6 @@ public:
int indexOfChild(const QAccessibleInterface *child) const;
int childCount() const;
QRect rect () const;
- QAccessible::Role role() const;
QDockWidget *dockWidget() const;
};
diff --git a/src/plugins/accessible/widgets/simplewidgets.cpp b/src/plugins/accessible/widgets/simplewidgets.cpp
index bb90061a7e..9bdb1decde 100644
--- a/src/plugins/accessible/widgets/simplewidgets.cpp
+++ b/src/plugins/accessible/widgets/simplewidgets.cpp
@@ -53,6 +53,7 @@
#include <qgroupbox.h>
#include <qlcdnumber.h>
#include <qlineedit.h>
+#include <private/qlineedit_p.h>
#include <qstyle.h>
#include <qstyleoption.h>
#include <qtextdocument.h>
@@ -672,10 +673,20 @@ int QAccessibleLineEdit::cursorPosition() const
return lineEdit()->cursorPosition();
}
-QRect QAccessibleLineEdit::characterRect(int /*offset*/) const
+QRect QAccessibleLineEdit::characterRect(int offset) const
{
- // QLineEdit doesn't hand out character rects
- return QRect();
+ int x = lineEdit()->d_func()->control->cursorToX(offset);
+ int y;
+ lineEdit()->getTextMargins(0, &y, 0, 0);
+ QFontMetrics fm(lineEdit()->font());
+ const QString ch = text(offset, offset + 1);
+ if (ch.isEmpty())
+ return QRect();
+ int w = fm.width(ch);
+ int h = fm.height();
+ QRect r(x, y, w, h);
+ r.moveTo(lineEdit()->mapToGlobal(r.topLeft()));
+ return r;
}
int QAccessibleLineEdit::selectionCount() const
diff --git a/src/plugins/accessible/widgets/widgets.pro b/src/plugins/accessible/widgets/widgets.pro
index 3bf7dede56..afabbac9bc 100644
--- a/src/plugins/accessible/widgets/widgets.pro
+++ b/src/plugins/accessible/widgets/widgets.pro
@@ -1,9 +1,9 @@
TARGET = qtaccessiblewidgets
+
+PLUGIN_TYPE = accessible
load(qt_plugin)
-include (../qaccessiblebase.pri)
QT += core-private gui-private widgets-private
-DESTDIR = $$QT.gui.plugins/accessible
QTDIR_build:REQUIRES += "contains(QT_CONFIG, accessibility)"
diff --git a/src/plugins/bearer/blackberry/blackberry.pro b/src/plugins/bearer/blackberry/blackberry.pro
index 5d4cf29554..220a506d90 100644
--- a/src/plugins/bearer/blackberry/blackberry.pro
+++ b/src/plugins/bearer/blackberry/blackberry.pro
@@ -1,4 +1,6 @@
TARGET = qbbbearer
+
+PLUGIN_TYPE = bearer
load(qt_plugin)
QT = core-private network-private
@@ -15,7 +17,3 @@ SOURCES += qbbengine.cpp \
main.cpp
OTHER_FILES += blackberry.json
-
-DESTDIR = $$QT.network.plugins/bearer
-target.path += $$[QT_INSTALL_PLUGINS]/bearer
-INSTALLS += target
diff --git a/src/plugins/bearer/blackberry/qbbengine.cpp b/src/plugins/bearer/blackberry/qbbengine.cpp
index 79452aeae5..d64a8fe20f 100644
--- a/src/plugins/bearer/blackberry/qbbengine.cpp
+++ b/src/plugins/bearer/blackberry/qbbengine.cpp
@@ -316,15 +316,14 @@ void QBBEngine::updateConfiguration(const char *interface)
const QString id = idForName(name);
- const int numberOfIpAddresses = netstatus_interface_get_num_ip_addresses(details);
- const bool isConnected = netstatus_interface_is_connected(details);
const netstatus_interface_type_t type = netstatus_interface_get_type(details);
+ const netstatus_ip_status_t ipStatus = netstatus_interface_get_ip_status(details);
netstatus_free_interface_details(&details);
QNetworkConfiguration::StateFlags state = QNetworkConfiguration::Defined;
- if (isConnected && (numberOfIpAddresses > 0))
+ if (ipStatus == NETSTATUS_IP_STATUS_OK)
state |= QNetworkConfiguration::Active;
QMutexLocker locker(&mutex);
diff --git a/src/plugins/bearer/connman/connman.pro b/src/plugins/bearer/connman/connman.pro
index 679637b37f..99d9b367f2 100644
--- a/src/plugins/bearer/connman/connman.pro
+++ b/src/plugins/bearer/connman/connman.pro
@@ -1,4 +1,6 @@
TARGET = qconnmanbearer
+
+PLUGIN_TYPE = bearer
load(qt_plugin)
QT = core network-private dbus
@@ -17,7 +19,3 @@ SOURCES += main.cpp \
OTHER_FILES += connman.json
-DESTDIR = $$QT.network.plugins/bearer
-target.path += $$[QT_INSTALL_PLUGINS]/bearer
-INSTALLS += target
-
diff --git a/src/plugins/bearer/corewlan/corewlan.pro b/src/plugins/bearer/corewlan/corewlan.pro
index b60dac907c..481b75c8ab 100644
--- a/src/plugins/bearer/corewlan/corewlan.pro
+++ b/src/plugins/bearer/corewlan/corewlan.pro
@@ -1,4 +1,6 @@
TARGET = qcorewlanbearer
+
+PLUGIN_TYPE = bearer
load(qt_plugin)
QT = core-private network-private
@@ -20,7 +22,3 @@ SOURCES += main.cpp \
OBJECTIVE_SOURCES += qcorewlanengine.mm
OTHER_FILES += corewlan.json
-
-DESTDIR = $$QT.network.plugins/bearer
-target.path += $$[QT_INSTALL_PLUGINS]/bearer
-INSTALLS += target
diff --git a/src/plugins/bearer/generic/generic.pro b/src/plugins/bearer/generic/generic.pro
index e66c5b2c7a..a1da0dddda 100644
--- a/src/plugins/bearer/generic/generic.pro
+++ b/src/plugins/bearer/generic/generic.pro
@@ -1,4 +1,6 @@
TARGET = qgenericbearer
+
+PLUGIN_TYPE = bearer
load(qt_plugin)
QT = core-private network-private
@@ -12,7 +14,3 @@ SOURCES += qgenericengine.cpp \
main.cpp
OTHER_FILES += generic.json
-
-DESTDIR = $$QT.network.plugins/bearer
-target.path += $$[QT_INSTALL_PLUGINS]/bearer
-INSTALLS += target
diff --git a/src/plugins/bearer/nativewifi/nativewifi.pro b/src/plugins/bearer/nativewifi/nativewifi.pro
index 3124d58ff2..4382cd08cd 100644
--- a/src/plugins/bearer/nativewifi/nativewifi.pro
+++ b/src/plugins/bearer/nativewifi/nativewifi.pro
@@ -1,4 +1,6 @@
TARGET = qnativewifibearer
+
+PLUGIN_TYPE = bearer
load(qt_plugin)
QT = core-private network-private
@@ -13,7 +15,3 @@ SOURCES += main.cpp \
../qnetworksession_impl.cpp
OTHER_FILES += nativewifi.json
-
-DESTDIR = $$QT.network.plugins/bearer
-target.path += $$[QT_INSTALL_PLUGINS]/bearer
-INSTALLS += target
diff --git a/src/plugins/bearer/networkmanager/networkmanager.pro b/src/plugins/bearer/networkmanager/networkmanager.pro
index c1c6664897..4f299e22f2 100644
--- a/src/plugins/bearer/networkmanager/networkmanager.pro
+++ b/src/plugins/bearer/networkmanager/networkmanager.pro
@@ -1,4 +1,6 @@
TARGET = qnmbearer
+
+PLUGIN_TYPE = bearer
load(qt_plugin)
QT = core network-private dbus
@@ -16,7 +18,3 @@ SOURCES += main.cpp \
../qnetworksession_impl.cpp
OTHER_FILES += networkmanager.json
-
-DESTDIR = $$QT.network.plugins/bearer
-target.path += $$[QT_INSTALL_PLUGINS]/bearer
-INSTALLS += target
diff --git a/src/plugins/bearer/nla/nla.pro b/src/plugins/bearer/nla/nla.pro
index 29e98953b1..56c06a57b1 100644
--- a/src/plugins/bearer/nla/nla.pro
+++ b/src/plugins/bearer/nla/nla.pro
@@ -1,4 +1,6 @@
TARGET = qnlabearer
+
+PLUGIN_TYPE = bearer
load(qt_plugin)
QT = core core-private network network-private
@@ -19,7 +21,3 @@ SOURCES += main.cpp \
../qnetworksession_impl.cpp
OTHER_FILES += nla.json
-
-DESTDIR = $$QT.network.plugins/bearer
-target.path += $$[QT_INSTALL_PLUGINS]/bearer
-INSTALLS += target
diff --git a/src/plugins/generic/evdevkeyboard/evdevkeyboard.pro b/src/plugins/generic/evdevkeyboard/evdevkeyboard.pro
index aa85fdcb06..97b827b779 100644
--- a/src/plugins/generic/evdevkeyboard/evdevkeyboard.pro
+++ b/src/plugins/generic/evdevkeyboard/evdevkeyboard.pro
@@ -1,9 +1,7 @@
TARGET = qevdevkeyboardplugin
-load(qt_plugin)
-DESTDIR = $$QT.gui.plugins/generic
-target.path = $$[QT_INSTALL_PLUGINS]/generic
-INSTALLS += target
+PLUGIN_TYPE = generic
+load(qt_plugin)
QT += core-private platformsupport-private gui-private
diff --git a/src/plugins/generic/evdevmouse/evdevmouse.pro b/src/plugins/generic/evdevmouse/evdevmouse.pro
index fd7d0fee6a..c1356593df 100644
--- a/src/plugins/generic/evdevmouse/evdevmouse.pro
+++ b/src/plugins/generic/evdevmouse/evdevmouse.pro
@@ -1,9 +1,7 @@
TARGET = qevdevmouseplugin
-load(qt_plugin)
-DESTDIR = $$QT.gui.plugins/generic
-target.path = $$[QT_INSTALL_PLUGINS]/generic
-INSTALLS += target
+PLUGIN_TYPE = generic
+load(qt_plugin)
QT += core-private platformsupport-private gui-private
diff --git a/src/plugins/generic/evdevtablet/evdevtablet.pro b/src/plugins/generic/evdevtablet/evdevtablet.pro
index 841d7b96f7..066819be33 100644
--- a/src/plugins/generic/evdevtablet/evdevtablet.pro
+++ b/src/plugins/generic/evdevtablet/evdevtablet.pro
@@ -1,9 +1,7 @@
TARGET = qevdevtabletplugin
-load(qt_plugin)
-DESTDIR = $$QT.gui.plugins/generic
-target.path = $$[QT_INSTALL_PLUGINS]/generic
-INSTALLS += target
+PLUGIN_TYPE = generic
+load(qt_plugin)
SOURCES = main.cpp
diff --git a/src/plugins/generic/evdevtouch/evdevtouch.pro b/src/plugins/generic/evdevtouch/evdevtouch.pro
index a47d00fbf0..2c1d6913ad 100644
--- a/src/plugins/generic/evdevtouch/evdevtouch.pro
+++ b/src/plugins/generic/evdevtouch/evdevtouch.pro
@@ -1,9 +1,7 @@
TARGET = qevdevtouchplugin
-load(qt_plugin)
-DESTDIR = $$QT.gui.plugins/generic
-target.path = $$[QT_INSTALL_PLUGINS]/generic
-INSTALLS += target
+PLUGIN_TYPE = generic
+load(qt_plugin)
SOURCES = main.cpp
diff --git a/src/plugins/generic/meego/meego.pro b/src/plugins/generic/meego/meego.pro
index 692ace485f..b8845418e8 100644
--- a/src/plugins/generic/meego/meego.pro
+++ b/src/plugins/generic/meego/meego.pro
@@ -1,10 +1,7 @@
TARGET = qmeegointegration
-load(qt_plugin)
-
-QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/generic
-target.path = $$[QT_INSTALL_PLUGINS]/generic
-INSTALLS += target
+PLUGIN_TYPE = generic
+load(qt_plugin)
SOURCES = qmeegointegration.cpp \
main.cpp \
diff --git a/src/plugins/generic/tslib/tslib.pro b/src/plugins/generic/tslib/tslib.pro
index 9046e18f77..ab0645d89a 100644
--- a/src/plugins/generic/tslib/tslib.pro
+++ b/src/plugins/generic/tslib/tslib.pro
@@ -1,9 +1,7 @@
TARGET = qtslibplugin
-load(qt_plugin)
-DESTDIR = $$QT.gui.plugins/generic
-target.path = $$[QT_INSTALL_PLUGINS]/generic
-INSTALLS += target
+PLUGIN_TYPE = generic
+load(qt_plugin)
HEADERS = qtslib.h
diff --git a/src/plugins/imageformats/gif/gif.pro b/src/plugins/imageformats/gif/gif.pro
index b85ee984ac..d5acfedff7 100644
--- a/src/plugins/imageformats/gif/gif.pro
+++ b/src/plugins/imageformats/gif/gif.pro
@@ -1,11 +1,9 @@
TARGET = qgif
+
+PLUGIN_TYPE = imageformats
load(qt_plugin)
include(../../../gui/image/qgifhandler.pri)
SOURCES += $$PWD/main.cpp
HEADERS += $$PWD/main.h
OTHER_FILES += gif.json
-
-DESTDIR = $$QT.gui.plugins/imageformats
-target.path += $$[QT_INSTALL_PLUGINS]/imageformats
-INSTALLS += target
diff --git a/src/plugins/imageformats/ico/ico.pro b/src/plugins/imageformats/ico/ico.pro
index 242e42b869..48bfd6b344 100644
--- a/src/plugins/imageformats/ico/ico.pro
+++ b/src/plugins/imageformats/ico/ico.pro
@@ -1,4 +1,6 @@
TARGET = qico
+
+PLUGIN_TYPE = imageformats
load(qt_plugin)
QTDIR_build:REQUIRES = "!contains(QT_CONFIG, no-ico)"
@@ -7,7 +9,3 @@ HEADERS += qicohandler.h main.h
SOURCES += main.cpp \
qicohandler.cpp
OTHER_FILES += ico.json
-
-DESTDIR = $$QT.gui.plugins/imageformats
-target.path += $$[QT_INSTALL_PLUGINS]/imageformats
-INSTALLS += target
diff --git a/src/plugins/imageformats/jpeg/jpeg.pro b/src/plugins/imageformats/jpeg/jpeg.pro
index f2a41129d5..35153eb59c 100644
--- a/src/plugins/imageformats/jpeg/jpeg.pro
+++ b/src/plugins/imageformats/jpeg/jpeg.pro
@@ -1,4 +1,6 @@
TARGET = qjpeg
+
+PLUGIN_TYPE = imageformats
load(qt_plugin)
QT += core-private
@@ -9,7 +11,3 @@ include(../../../gui/image/qjpeghandler.pri)
SOURCES += main.cpp
HEADERS += main.h
OTHER_FILES += jpeg.json
-
-DESTDIR = $$QT.gui.plugins/imageformats
-target.path += $$[QT_INSTALL_PLUGINS]/imageformats
-INSTALLS += target
diff --git a/src/plugins/platforminputcontexts/ibus/ibus.pro b/src/plugins/platforminputcontexts/ibus/ibus.pro
index 8c8ab52c3c..033d5a4d5c 100644
--- a/src/plugins/platforminputcontexts/ibus/ibus.pro
+++ b/src/plugins/platforminputcontexts/ibus/ibus.pro
@@ -1,7 +1,7 @@
TARGET = ibusplatforminputcontextplugin
-load(qt_plugin)
-QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/platforminputcontexts
+PLUGIN_TYPE = platforminputcontexts
+load(qt_plugin)
QT += dbus gui-private
SOURCES += $$PWD/qibusplatforminputcontext.cpp \
@@ -16,6 +16,3 @@ HEADERS += $$PWD/qibusplatforminputcontext.h \
$$PWD/qibustypes.h
OTHER_FILES += $$PWD/ibus.json
-
-target.path += $$[QT_INSTALL_PLUGINS]/platforminputcontexts
-INSTALLS += target
diff --git a/src/plugins/platforminputcontexts/maliit/maliit.pro b/src/plugins/platforminputcontexts/maliit/maliit.pro
index 4174072c2b..dec6833196 100644
--- a/src/plugins/platforminputcontexts/maliit/maliit.pro
+++ b/src/plugins/platforminputcontexts/maliit/maliit.pro
@@ -1,7 +1,7 @@
TARGET = maliitplatforminputcontextplugin
-load(qt_plugin)
-QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/platforminputcontexts
+PLUGIN_TYPE = platforminputcontexts
+load(qt_plugin)
QT += dbus gui-private
SOURCES += $$PWD/qmaliitplatforminputcontext.cpp \
@@ -16,6 +16,3 @@ HEADERS += $$PWD/qmaliitplatforminputcontext.h \
$$PWD/contextadaptor.h
OTHER_FILES += $$PWD/maliit.json
-
-target.path += $$[QT_INSTALL_PLUGINS]/platforminputcontexts
-INSTALLS += target
diff --git a/src/plugins/platforms/cocoa/cocoa.pro b/src/plugins/platforms/cocoa/cocoa.pro
index 106664a6b0..3ea5dc2d1c 100644
--- a/src/plugins/platforms/cocoa/cocoa.pro
+++ b/src/plugins/platforms/cocoa/cocoa.pro
@@ -1,6 +1,7 @@
TARGET = qcocoa
+
+PLUGIN_TYPE = platforms
load(qt_plugin)
-DESTDIR = $$QT.gui.plugins/platforms
OBJECTIVE_SOURCES += main.mm \
qcocoaintegration.mm \
@@ -91,8 +92,6 @@ QT += core-private gui-private platformsupport-private
}
OTHER_FILES += cocoa.json
-target.path += $$[QT_INSTALL_PLUGINS]/platforms
-INSTALLS += target
# Build the release libqcocoa.dylib only, skip the debug version.
# The Qt plugin loader will dlopen both if found, causing duplicate
diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.h b/src/plugins/platforms/cocoa/qcocoaintegration.h
index d465d47e12..ea43bbbc10 100644
--- a/src/plugins/platforms/cocoa/qcocoaintegration.h
+++ b/src/plugins/platforms/cocoa/qcocoaintegration.h
@@ -128,7 +128,9 @@ private:
QAbstractEventDispatcher *mEventDispatcher;
QScopedPointer<QPlatformInputContext> mInputContext;
+#ifndef QT_NO_ACCESSIBILITY
QScopedPointer<QPlatformAccessibility> mAccessibility;
+#endif
QScopedPointer<QPlatformTheme> mPlatformTheme;
QList<QCocoaScreen *> mScreens;
QCocoaClipboard *mCocoaClipboard;
diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm
index b069446c50..481055aae4 100644
--- a/src/plugins/platforms/cocoa/qcocoaintegration.mm
+++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm
@@ -180,7 +180,9 @@ QCocoaIntegration::QCocoaIntegration()
: mFontDb(new QCoreTextFontDatabase())
, mEventDispatcher(new QCocoaEventDispatcher())
, mInputContext(new QCocoaInputContext)
+#ifndef QT_NO_ACCESSIBILITY
, mAccessibility(new QPlatformAccessibility)
+#endif
, mCocoaClipboard(new QCocoaClipboard)
, mCocoaDrag(new QCocoaDrag)
, mNativeInterface(new QCocoaNativeInterface)
@@ -302,11 +304,15 @@ void QCocoaIntegration::updateScreens()
bool QCocoaIntegration::hasCapability(QPlatformIntegration::Capability cap) const
{
switch (cap) {
- case ThreadedPixmaps: return true;
- case OpenGL : return true;
- case ThreadedOpenGL : return true;
- case BufferQueueingOpenGL: return true;
- default: return QPlatformIntegration::hasCapability(cap);
+ case ThreadedPixmaps:
+ case OpenGL:
+ case ThreadedOpenGL:
+ case BufferQueueingOpenGL:
+ case WindowMasks:
+ case MultipleWindows:
+ return true;
+ default:
+ return QPlatformIntegration::hasCapability(cap);
}
}
@@ -349,7 +355,11 @@ QPlatformInputContext *QCocoaIntegration::inputContext() const
QPlatformAccessibility *QCocoaIntegration::accessibility() const
{
+#ifndef QT_NO_ACCESSIBILITY
return mAccessibility.data();
+#else
+ return 0;
+#endif
}
QPlatformClipboard *QCocoaIntegration::clipboard() const
diff --git a/src/plugins/platforms/cocoa/qcocoamenu.h b/src/plugins/platforms/cocoa/qcocoamenu.h
index 38952a2e5d..3afe089225 100644
--- a/src/plugins/platforms/cocoa/qcocoamenu.h
+++ b/src/plugins/platforms/cocoa/qcocoamenu.h
@@ -70,6 +70,7 @@ public:
void removeMenuItem(QPlatformMenuItem *menuItem);
void syncMenuItem(QPlatformMenuItem *menuItem);
void setEnabled(bool enabled);
+ void setVisible(bool visible);
void syncSeparatorsCollapsible(bool enable);
void syncModalState(bool modal);
diff --git a/src/plugins/platforms/cocoa/qcocoamenu.mm b/src/plugins/platforms/cocoa/qcocoamenu.mm
index 4d35b3202e..36d5c81f34 100644
--- a/src/plugins/platforms/cocoa/qcocoamenu.mm
+++ b/src/plugins/platforms/cocoa/qcocoamenu.mm
@@ -268,6 +268,12 @@ void QCocoaMenu::setParentItem(QCocoaMenuItem *item)
void QCocoaMenu::setEnabled(bool enabled)
{
m_enabled = enabled;
+ syncModalState(!m_enabled);
+}
+
+void QCocoaMenu::setVisible(bool visible)
+{
+ [m_nativeItem setSubmenu:(visible ? m_nativeMenu : nil)];
}
QPlatformMenuItem *QCocoaMenu::menuItemAt(int position) const
diff --git a/src/plugins/platforms/cocoa/qcocoamenuitem.mm b/src/plugins/platforms/cocoa/qcocoamenuitem.mm
index 150d3eef7d..d78ff73bb6 100644
--- a/src/plugins/platforms/cocoa/qcocoamenuitem.mm
+++ b/src/plugins/platforms/cocoa/qcocoamenuitem.mm
@@ -263,7 +263,7 @@ NSMenuItem *QCocoaMenuItem::sync()
// [m_native setHidden:YES];
// [m_native setHidden:NO];
[m_native setHidden: !m_isVisible];
-
+ [m_native setEnabled: m_enabled];
QString text = m_text;
QKeySequence accel = m_shortcut;
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.h b/src/plugins/platforms/cocoa/qcocoawindow.h
index d5dbe58de9..db3a20c2be 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.h
+++ b/src/plugins/platforms/cocoa/qcocoawindow.h
@@ -107,6 +107,7 @@ public:
void lower();
void propagateSizeHints();
void setOpacity(qreal level);
+ void setMask(const QRegion &region);
bool setKeyboardGrabEnabled(bool grab);
bool setMouseGrabEnabled(bool grab);
QMargins frameMargins() const;
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm
index b9ad35600e..de6e7dc43e 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.mm
+++ b/src/plugins/platforms/cocoa/qcocoawindow.mm
@@ -509,6 +509,16 @@ void QCocoaWindow::setOpacity(qreal level)
[m_nsWindow setAlphaValue:level];
}
+void QCocoaWindow::setMask(const QRegion &region)
+{
+ if (m_nsWindow) {
+ [m_nsWindow setOpaque:NO];
+ [m_nsWindow setBackgroundColor:[NSColor clearColor]];
+ }
+
+ [m_contentView setMaskRegion:&region];
+}
+
bool QCocoaWindow::setKeyboardGrabEnabled(bool grab)
{
if (!m_nsWindow)
@@ -703,11 +713,6 @@ void QCocoaWindow::setNSWindow(NSWindow *window)
name:nil // Get all notifications
object:m_nsWindow];
- // ### Accept touch events by default.
- // Beware that enabling touch events has a negative impact on the overall performance.
- // We probably need a QWindowSystemInterface API to enable/disable touch events.
- [m_contentView setAcceptsTouchEvents:YES];
-
[window setContentView:m_contentView];
}
diff --git a/src/plugins/platforms/cocoa/qnsview.h b/src/plugins/platforms/cocoa/qnsview.h
index 32e140f9ff..246d311f7b 100644
--- a/src/plugins/platforms/cocoa/qnsview.h
+++ b/src/plugins/platforms/cocoa/qnsview.h
@@ -54,6 +54,8 @@ QT_END_NAMESPACE
@interface QNSView : NSView <NSTextInputClient> {
CGImageRef m_cgImage;
+ CGImageRef m_maskImage;
+ uchar *m_maskData;
QWindow *m_window;
QCocoaWindow *m_platformWindow;
Qt::MouseButtons m_buttons;
@@ -68,6 +70,7 @@ QT_END_NAMESPACE
- (id)initWithQWindow:(QWindow *)window platformWindow:(QCocoaWindow *) platformWindow;
- (void)setImage:(QImage *)image;
+- (void)setMaskRegion:(const QRegion *)region;
- (void)drawRect:(NSRect)dirtyRect;
- (void)updateGeometry;
- (void)windowNotification : (NSNotification *) windowNotification;
diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm
index 33d0fb4bae..d62913a7af 100644
--- a/src/plugins/platforms/cocoa/qnsview.mm
+++ b/src/plugins/platforms/cocoa/qnsview.mm
@@ -75,6 +75,8 @@ static QTouchDevice *touchDevice = 0;
self = [super initWithFrame : NSMakeRect(0,0, 300,300)];
if (self) {
m_cgImage = 0;
+ m_maskImage = 0;
+ m_maskData = 0;
m_window = 0;
m_buttons = Qt::NoButton;
m_sendKeyEvent = false;
@@ -93,6 +95,10 @@ static QTouchDevice *touchDevice = 0;
{
CGImageRelease(m_cgImage);
m_cgImage = 0;
+ CGImageRelease(m_maskImage);
+ m_maskImage = 0;
+ delete[] m_maskData;
+ m_maskData = 0;
m_window = 0;
[super dealloc];
}
@@ -205,47 +211,86 @@ static QTouchDevice *touchDevice = 0;
}
}
-- (void) setImage:(QImage *)image
+static CGImageRef qt_mac_toCGImage(QImage *qImage, bool isMask, uchar **dataCopy)
{
- CGImageRelease(m_cgImage);
-
- int width = image->width();
- int height = image->height();
+ int width = qImage->width();
+ int height = qImage->height();
if (width <= 0 || height <= 0) {
qWarning() << Q_FUNC_INFO <<
"setting invalid size" << width << "x" << height << "for qnsview image";
- m_cgImage = 0;
- return;
+ return 0;
}
- const uchar *imageData = image->bits();
- int bitDepth = image->depth();
+ const uchar *imageData = qImage->bits();
+ if (dataCopy) {
+ delete[] *dataCopy;
+ *dataCopy = new uchar[qImage->byteCount()];
+ memcpy(*dataCopy, imageData, qImage->byteCount());
+ }
+ int bitDepth = qImage->depth();
int colorBufferSize = 8;
- int bytesPrLine = image->bytesPerLine();
-
- CGColorSpaceRef cgColourSpaceRef = CGColorSpaceCreateDeviceRGB();
+ int bytesPrLine = qImage->bytesPerLine();
CGDataProviderRef cgDataProviderRef = CGDataProviderCreateWithData(
NULL,
- imageData,
- image->byteCount(),
+ dataCopy ? *dataCopy : imageData,
+ qImage->byteCount(),
NULL);
- m_cgImage = CGImageCreate(width,
- height,
- colorBufferSize,
- bitDepth,
- bytesPrLine,
- cgColourSpaceRef,
- kCGBitmapByteOrder32Little | kCGImageAlphaNoneSkipFirst,
- cgDataProviderRef,
- NULL,
- false,
- kCGRenderingIntentDefault);
+ CGImageRef cgImage = 0;
+ if (isMask) {
+ cgImage = CGImageMaskCreate(width,
+ height,
+ colorBufferSize,
+ bitDepth,
+ bytesPrLine,
+ cgDataProviderRef,
+ NULL,
+ false);
+ } else {
+ CGColorSpaceRef cgColourSpaceRef = CGColorSpaceCreateDeviceRGB();
+ cgImage = CGImageCreate(width,
+ height,
+ colorBufferSize,
+ bitDepth,
+ bytesPrLine,
+ cgColourSpaceRef,
+ kCGBitmapByteOrder32Little | kCGImageAlphaNoneSkipFirst,
+ cgDataProviderRef,
+ NULL,
+ false,
+ kCGRenderingIntentDefault);
+ CGColorSpaceRelease(cgColourSpaceRef);
+ }
+ return cgImage;
+}
- CGColorSpaceRelease(cgColourSpaceRef);
+- (void) setImage:(QImage *)image
+{
+ CGImageRelease(m_cgImage);
+ m_cgImage = qt_mac_toCGImage(image, false, 0);
+}
+
+- (void) setMaskRegion:(const QRegion *)region
+{
+ if (m_maskImage)
+ CGImageRelease(m_maskImage);
+ if (region->isEmpty()) {
+ m_maskImage = 0;
+ }
+ const QRect &rect = qt_mac_toQRect([self frame]);
+ QImage maskImage(rect.size(), QImage::Format_RGB888);
+ maskImage.fill(Qt::white);
+ QPainter p(&maskImage);
+ p.setRenderHint(QPainter::Antialiasing);
+ p.setClipRegion(*region);
+ p.fillRect(rect, QBrush(Qt::black));
+ p.end();
+
+ maskImage = maskImage.convertToFormat(QImage::Format_Indexed8);
+ m_maskImage = qt_mac_toCGImage(&maskImage, true, &m_maskData);
}
- (void) drawRect:(NSRect)dirtyRect
@@ -263,13 +308,19 @@ static QTouchDevice *touchDevice = 0;
CGContextTranslateCTM(cgContext, 0, dy);
CGContextScaleCTM(cgContext, 1, -1);
+ CGImageRef subMask = 0;
+ if (m_maskImage) {
+ subMask = CGImageCreateWithImageInRect(m_maskImage, dirtyCGRect);
+ CGContextClipToMask(cgContext, dirtyCGRect, subMask);
+ }
+
CGImageRef subImage = CGImageCreateWithImageInRect(m_cgImage, dirtyCGRect);
CGContextDrawImage(cgContext,dirtyCGRect,subImage);
CGContextRestoreGState(cgContext);
CGImageRelease(subImage);
-
+ CGImageRelease(subMask);
}
- (BOOL) isFlipped
diff --git a/src/plugins/platforms/cocoa/qprintengine_mac.mm b/src/plugins/platforms/cocoa/qprintengine_mac.mm
index f2c567f0eb..94c89ad8db 100644
--- a/src/plugins/platforms/cocoa/qprintengine_mac.mm
+++ b/src/plugins/platforms/cocoa/qprintengine_mac.mm
@@ -795,13 +795,15 @@ QVariant QMacPrintEngine::property(PrintEnginePropertyKey key) const
if (d->hasCustomPageMargins) {
margins << d->leftMargin << d->topMargin
<< d->rightMargin << d->bottomMargin;
- } else {
+ } else if (!d->hasCustomPaperSize) {
PMPaperMargins paperMargins;
PMPaper paper;
PMGetPageFormatPaper(d->format(), &paper);
PMPaperGetMargins(paper, &paperMargins);
margins << paperMargins.left << paperMargins.top
<< paperMargins.right << paperMargins.bottom;
+ } else {
+ margins << 0 << 0 << 0 << 0;
}
ret = margins;
break;
diff --git a/src/plugins/platforms/directfb/directfb.pro b/src/plugins/platforms/directfb/directfb.pro
index 85821662a0..29c5ebd99b 100644
--- a/src/plugins/platforms/directfb/directfb.pro
+++ b/src/plugins/platforms/directfb/directfb.pro
@@ -1,6 +1,7 @@
TARGET = qdirectfb
+
+PLUGIN_TYPE = platforms
load(qt_plugin)
-DESTDIR = $$QT.gui.plugins/platforms
QT += core-private gui-private platformsupport-private
@@ -46,7 +47,5 @@ contains(QT_CONFIG, directfb_egl) {
CONFIG += qpa/genericunixfontdatabase
-target.path += $$[QT_INSTALL_PLUGINS]/platforms
-INSTALLS += target
OTHER_FILES += directfb.json
diff --git a/src/plugins/platforms/eglfs/eglfs.pro b/src/plugins/platforms/eglfs/eglfs.pro
index f22ccc55d2..1223b6b133 100644
--- a/src/plugins/platforms/eglfs/eglfs.pro
+++ b/src/plugins/platforms/eglfs/eglfs.pro
@@ -1,10 +1,10 @@
TARGET = qeglfs
+
+PLUGIN_TYPE = platforms
load(qt_plugin)
QT += core-private gui-private platformsupport-private
-DESTDIR = $$QT.gui.plugins/platforms
-
#DEFINES += QEGL_EXTRA_DEBUG
#Avoid X11 header collision
@@ -44,9 +44,6 @@ INCLUDEPATH += $$PWD
CONFIG += egl qpa/genericunixfontdatabase
-target.path += $$[QT_INSTALL_PLUGINS]/platforms
-INSTALLS += target
-
RESOURCES += cursor.qrc
OTHER_FILES += \
diff --git a/src/plugins/platforms/eglfs/qeglfswindow.cpp b/src/plugins/platforms/eglfs/qeglfswindow.cpp
index 036b26a165..32d20e6aaa 100644
--- a/src/plugins/platforms/eglfs/qeglfswindow.cpp
+++ b/src/plugins/platforms/eglfs/qeglfswindow.cpp
@@ -89,8 +89,9 @@ void QEglFSWindow::create()
m_window = hooks->createNativeWindow(hooks->screenSize(), m_format);
m_surface = eglCreateWindowSurface(display, config, m_window, NULL);
if (m_surface == EGL_NO_SURFACE) {
+ EGLint error = eglGetError();
eglTerminate(display);
- qFatal("EGL Error : Could not create the egl surface: error = 0x%x\n", eglGetError());
+ qFatal("EGL Error : Could not create the egl surface: error = 0x%x\n", error);
}
}
diff --git a/src/plugins/platforms/kms/kms.pro b/src/plugins/platforms/kms/kms.pro
index 2e8af5ba9d..57191d8d97 100644
--- a/src/plugins/platforms/kms/kms.pro
+++ b/src/plugins/platforms/kms/kms.pro
@@ -1,8 +1,9 @@
TARGET = qkms
+
+PLUGIN_TYPE = platforms
load(qt_plugin)
QT += core-private gui-private platformsupport-private opengl-private
-DESTDIR = $$QT.gui.plugins/platforms
DEFINES += MESA_EGL_NO_X11_HEADERS
@@ -36,8 +37,5 @@ HEADERS = qkmsintegration.h \
qkmsudevdrmhandler.h \
qkmsvthandler.h
-target.path += $$[QT_INSTALL_PLUGINS]/platforms
-INSTALLS += target
-
OTHER_FILES += \
kms.json
diff --git a/src/plugins/platforms/linuxfb/linuxfb.pro b/src/plugins/platforms/linuxfb/linuxfb.pro
index 9834dea7d5..2482a64469 100644
--- a/src/plugins/platforms/linuxfb/linuxfb.pro
+++ b/src/plugins/platforms/linuxfb/linuxfb.pro
@@ -1,7 +1,7 @@
TARGET = qlinuxfb
-load(qt_plugin)
-DESTDIR = $$QT.gui.plugins/platforms
+PLUGIN_TYPE = platforms
+load(qt_plugin)
QT += core-private gui-private platformsupport-private
@@ -10,7 +10,4 @@ HEADERS = qlinuxfbintegration.h qlinuxfbscreen.h
CONFIG += qpa/genericunixfontdatabase
-target.path += $$[QT_INSTALL_PLUGINS]/platforms
-INSTALLS += target
-
OTHER_FILES += linuxfb.json
diff --git a/src/plugins/platforms/minimal/minimal.pro b/src/plugins/platforms/minimal/minimal.pro
index 6430ccde75..9c3d37269c 100644
--- a/src/plugins/platforms/minimal/minimal.pro
+++ b/src/plugins/platforms/minimal/minimal.pro
@@ -1,8 +1,9 @@
TARGET = qminimal
+
+PLUGIN_TYPE = platforms
load(qt_plugin)
QT += core-private gui-private platformsupport-private
-DESTDIR = $$QT.gui.plugins/platforms
SOURCES = main.cpp \
qminimalintegration.cpp \
@@ -11,6 +12,3 @@ HEADERS = qminimalintegration.h \
qminimalbackingstore.h
OTHER_FILES += minimal.json
-
-target.path += $$[QT_INSTALL_PLUGINS]/platforms
-INSTALLS += target
diff --git a/src/plugins/platforms/minimal/qminimalintegration.cpp b/src/plugins/platforms/minimal/qminimalintegration.cpp
index 6a2db91e34..e9fab6d87c 100644
--- a/src/plugins/platforms/minimal/qminimalintegration.cpp
+++ b/src/plugins/platforms/minimal/qminimalintegration.cpp
@@ -74,6 +74,7 @@ bool QMinimalIntegration::hasCapability(QPlatformIntegration::Capability cap) co
{
switch (cap) {
case ThreadedPixmaps: return true;
+ case MultipleWindows: return true;
default: return QPlatformIntegration::hasCapability(cap);
}
}
diff --git a/src/plugins/platforms/minimalegl/minimalegl.pro b/src/plugins/platforms/minimalegl/minimalegl.pro
index 22e3729ed7..23a6ad9708 100644
--- a/src/plugins/platforms/minimalegl/minimalegl.pro
+++ b/src/plugins/platforms/minimalegl/minimalegl.pro
@@ -1,10 +1,10 @@
TARGET = qminimalegl
+
+PLUGIN_TYPE = platforms
load(qt_plugin)
QT += core-private gui-private platformsupport-private
-DESTDIR = $$QT.gui.plugins/platforms
-
#DEFINES += QEGL_EXTRA_DEBUG
#DEFINES += Q_OPENKODE
@@ -25,8 +25,5 @@ HEADERS = qminimaleglintegration.h \
CONFIG += egl qpa/genericunixfontdatabase
-target.path += $$[QT_INSTALL_PLUGINS]/platforms
-INSTALLS += target
-
OTHER_FILES += \
minimalegl.json
diff --git a/src/plugins/platforms/openwfd/openwf.pro b/src/plugins/platforms/openwfd/openwf.pro
index d913a84411..1b177cba04 100644
--- a/src/plugins/platforms/openwfd/openwf.pro
+++ b/src/plugins/platforms/openwfd/openwf.pro
@@ -1,7 +1,7 @@
TARGET = qopenwf
+PLUGIN_TYPE = platforms
load(qt_plugin)
-QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/platforms
QT += core-private gui-private platformsupport-private
@@ -36,6 +36,3 @@ SOURCES += \
LIBS += -lWFD -lgbm -lGLESv2 -lEGL
-target.path += $$[QT_INSTALL_PLUGINS]/platforms
-INSTALLS += target
-
diff --git a/src/plugins/platforms/qnx/qnx.pro b/src/plugins/platforms/qnx/qnx.pro
index dc16016af3..30c95b1620 100644
--- a/src/plugins/platforms/qnx/qnx.pro
+++ b/src/plugins/platforms/qnx/qnx.pro
@@ -1,7 +1,5 @@
TARGET = qnx
-include(../../qpluginbase.pri)
-QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/platforms
QT += platformsupport platformsupport-private
# Uncomment this to build with support for IMF once it becomes available in the BBNDK
@@ -138,5 +136,5 @@ QMAKE_CXXFLAGS += -I./private
include (../../../platformsupport/eglconvenience/eglconvenience.pri)
include (../../../platformsupport/fontdatabases/fontdatabases.pri)
-target.path += $$[QT_INSTALL_PLUGINS]/platforms
-INSTALLS += target
+PLUGIN_TYPE = platforms
+load(qt_plugin)
diff --git a/src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp b/src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp
index b8ec91d488..11babe3aaa 100644
--- a/src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp
+++ b/src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp
@@ -71,7 +71,10 @@ QQnxRasterBackingStore::~QQnxRasterBackingStore()
QPaintDevice *QQnxRasterBackingStore::paintDevice()
{
- return m_platformWindow->renderBuffer().image();
+ if (m_platformWindow->hasBuffers())
+ return m_platformWindow->renderBuffer().image();
+
+ return 0;
}
void QQnxRasterBackingStore::flush(QWindow *window, const QRegion &region, const QPoint &offset)
diff --git a/src/plugins/platforms/qnx/qqnxwindow.cpp b/src/plugins/platforms/qnx/qqnxwindow.cpp
index 097b5788f6..c668a8867d 100644
--- a/src/plugins/platforms/qnx/qqnxwindow.cpp
+++ b/src/plugins/platforms/qnx/qqnxwindow.cpp
@@ -374,10 +374,22 @@ QQnxBuffer &QQnxWindow::renderBuffer()
// Check if render buffer is invalid
if (m_currentBufferIndex == -1) {
+ // check if there are any buffers available
+ int bufferCount = 0;
+ int result = screen_get_window_property_iv(m_window, SCREEN_PROPERTY_RENDER_BUFFER_COUNT, &bufferCount);
+
+ if (result != 0) {
+ qFatal("QQnxWindow: failed to query window buffer count, errno=%d", errno);
+ }
+
+ if (bufferCount != MAX_BUFFER_COUNT) {
+ qFatal("QQnxWindow: invalid buffer count. Expected = %d, got = %d", MAX_BUFFER_COUNT, bufferCount);
+ }
+
// Get all buffers available for rendering
errno = 0;
screen_buffer_t buffers[MAX_BUFFER_COUNT];
- int result = screen_get_window_property_pv(m_window, SCREEN_PROPERTY_RENDER_BUFFERS, (void **)buffers);
+ result = screen_get_window_property_pv(m_window, SCREEN_PROPERTY_RENDER_BUFFERS, (void **)buffers);
if (result != 0) {
qFatal("QQnxWindow: failed to query window buffers, errno=%d", errno);
}
diff --git a/src/plugins/platforms/windows/accessible/iaccessible2.cpp b/src/plugins/platforms/windows/accessible/iaccessible2.cpp
index 6acfd6e602..03bb94db8f 100644
--- a/src/plugins/platforms/windows/accessible/iaccessible2.cpp
+++ b/src/plugins/platforms/windows/accessible/iaccessible2.cpp
@@ -1493,13 +1493,26 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::QueryService(REFGUID guidServic
*iface = 0;
accessibleDebug("QWindowsIA2Accessible::QS(): %s", IIDToString(riid).constData());
- if (guidService == IID_IAccessible && riid == IID_IAccessible2) {
- // The conditions for entering here should be ok (from _dicoveringInterfaces in IAccessible2.idl)
- *iface = static_cast<IAccessible2*>(this);
- } else if (guidService == IID_IAccessible && (riid == IID_IAccessible || riid == IID_IUnknown || riid == IID_IDispatch)) {
- // The above conditions works with AccProbe and NVDA.
- *iface = static_cast<IAccessible*>(this);
- } else if (riid == IID_IAccessibleApplication) {
+
+ if (guidService == IID_IAccessible) {
+ if (riid == IID_IServiceProvider) {
+ // do not end up calling QueryInterface for IID_IServiceProvider
+ *iface = 0;
+ } else if (riid == IID_IAccessible || riid == IID_IUnknown || riid == IID_IDispatch) {
+ // The above conditions works with AccProbe and NVDA.
+ *iface = static_cast<IAccessible*>(this);
+ } else {
+ // According to _dicoveringInterfaces Discovery of Interfaces, we should really only
+ // enter here if riid == IID_IAccessible2, but some screen readers does not like that,
+ // and other servers seems to have realized that. (Chrome and Mozilla for instance,
+ // calls QueryInterface more or less in the same way)
+
+ // For instance, accProbe discovers IID_IAccessibleTable2 by a QueryService only.
+ return QueryInterface(riid, iface);
+ }
+ }
+
+ if (riid == IID_IAccessibleApplication) {
*iface = new AccessibleApplication;
return S_OK;
}
diff --git a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
index 87cb224d49..9e5578d35d 100644
--- a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
+++ b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
@@ -43,12 +43,9 @@
#include "qwindowscontext.h"
#include "qwindowswindow.h"
+#include "qwindowsintegration.h"
#include "qwindowstheme.h" // Color conversion helpers
-#include <QtWidgets/QColorDialog>
-#include <QtWidgets/QFontDialog>
-#include <QtWidgets/QFileDialog>
-
#include <QtGui/QGuiApplication>
#include <QtGui/QColor>
@@ -60,6 +57,7 @@
#include <QtCore/QSharedPointer>
#include <QtCore/QObject>
#include <QtCore/QThread>
+#include <QtCore/QSysInfo>
#include <QtCore/private/qsystemlibrary_p.h>
#include "qtwindows_additional.h"
@@ -384,9 +382,10 @@ void eatMouseMove()
\class QWindowsNativeDialogBase
\brief Base class for Windows native dialogs.
- Base clases for native dialogs that mimick the
- behaviour of their QDialog counterparts as close as
- possible.
+ Base classes for native dialogs (using the CLSID-based
+ dialog interfaces "IFileDialog", etc. available from Windows
+ Vista on) that mimick the behaviour of their QDialog
+ counterparts as close as possible.
A major difference is that there is only an exec(), which
is a modal, blocking call; there is no non-blocking show().
@@ -862,12 +861,45 @@ int QWindowsNativeFileDialogBase::itemPaths(IShellItemArray *items,
return itemCount;
}
-// Copy a string to an Utf16 buffer.
-static inline void toBuffer(const QString &what, WCHAR **ptr)
+// Split a list of name filters into description and actual filters
+struct FilterSpec
+{
+ QString description;
+ QString filter;
+};
+
+static QList<FilterSpec> filterSpecs(const QStringList &filters,
+ bool hideFilterDetails,
+ int *totalStringLength)
{
- const int length = 1 + what.size();
- memcpy(*ptr, what.utf16(), length * sizeof(WCHAR));
- *ptr += length;
+ QList<FilterSpec> result;
+ result.reserve(filters.size());
+ *totalStringLength = 0;
+
+ const QRegExp filterSeparatorRE(QStringLiteral("[;\\s]+"));
+ const QString separator = QStringLiteral(";");
+ Q_ASSERT(filterSeparatorRE.isValid());
+ // Split filter specification as 'Texts (*.txt[;] *.doc)'
+ // into description and filters specification as '*.txt;*.doc'
+ foreach (const QString &filterString, filters) {
+ const int openingParenPos = filterString.lastIndexOf(QLatin1Char('('));
+ const int closingParenPos = openingParenPos != -1 ?
+ filterString.indexOf(QLatin1Char(')'), openingParenPos + 1) : -1;
+ FilterSpec filterSpec;
+ filterSpec.filter = closingParenPos == -1 ?
+ QString(QLatin1Char('*')) :
+ filterString.mid(openingParenPos + 1, closingParenPos - openingParenPos - 1).trimmed();
+ filterSpec.filter.replace(filterSeparatorRE, separator);
+ filterSpec.description = filterString;
+ if (hideFilterDetails && openingParenPos != -1) { // Do not show pattern in description
+ filterSpec.description.truncate(openingParenPos);
+ while (filterSpec.description.endsWith(QLatin1Char(' ')))
+ filterSpec.description.truncate(filterSpec.description.size() - 1);
+ }
+ *totalStringLength += filterSpec.filter.size() + filterSpec.description.size();
+ result.push_back(filterSpec);
+ }
+ return result;
}
void QWindowsNativeFileDialogBase::setNameFilters(const QStringList &filters)
@@ -875,48 +907,30 @@ void QWindowsNativeFileDialogBase::setNameFilters(const QStringList &filters)
/* Populates an array of COMDLG_FILTERSPEC from list of filters,
* store the strings in a flat, contiguous buffer. */
m_nameFilters = filters;
- const int size = filters.size();
int totalStringLength = 0;
- for (int i = 0; i < size; ++i)
- totalStringLength += filters.at(i).size();
+ const QList<FilterSpec> specs = filterSpecs(filters, m_hideFiltersDetails, &totalStringLength);
+ const int size = specs.size();
- QScopedArrayPointer<WCHAR> buffer(new WCHAR[totalStringLength * 2 + 2 * size]);
+ QScopedArrayPointer<WCHAR> buffer(new WCHAR[totalStringLength + 2 * size]);
QScopedArrayPointer<COMDLG_FILTERSPEC> comFilterSpec(new COMDLG_FILTERSPEC[size]);
const QString matchesAll = QStringLiteral(" (*)");
- const QRegExp filterSeparatorRE(QStringLiteral("[;\\s]+"));
- const QString separator = QStringLiteral(";");
- Q_ASSERT(filterSeparatorRE.isValid());
-
WCHAR *ptr = buffer.data();
// Split filter specification as 'Texts (*.txt[;] *.doc)'
// into description and filters specification as '*.txt;*.doc'
+
for (int i = 0; i < size; ++i) {
- QString filterString = filters.at(i);
- const int openingParenPos = filterString.lastIndexOf(QLatin1Char('('));
- const int closingParenPos = openingParenPos != -1 ?
- filterString.indexOf(QLatin1Char(')'), openingParenPos + 1) : -1;
- QString filterSpec = closingParenPos == -1 ?
- QString(QLatin1Char('*')) :
- filterString.mid(openingParenPos + 1, closingParenPos - openingParenPos - 1).trimmed();
- filterSpec.replace(filterSeparatorRE, separator);
- if (m_hideFiltersDetails) {
- // Do not show pattern in description
- if (openingParenPos != -1) {
- filterString.truncate(openingParenPos);
- while (filterString.endsWith(QLatin1Char(' ')))
- filterString.truncate(filterString.size() - 1);
- }
- } else {
- // Display glitch: 'All files (*)' shows up as 'All files (*) (*)'
- if (filterString.endsWith(matchesAll))
- filterString.truncate(filterString.size() - matchesAll.size());
- }
+ // Display glitch (CLSID only): 'All files (*)' shows up as 'All files (*) (*)'
+ QString description = specs[i].description;
+ if (!m_hideFiltersDetails && description.endsWith(matchesAll))
+ description.truncate(description.size() - matchesAll.size());
// Add to buffer.
comFilterSpec[i].pszName = ptr;
- toBuffer(filterString, &ptr);
+ ptr += description.toWCharArray(ptr);
+ *ptr++ = 0;
comFilterSpec[i].pszSpec = ptr;
- toBuffer(filterSpec, &ptr);
+ ptr += specs[i].filter.toWCharArray(ptr);
+ *ptr++ = 0;
}
m_fileDialog->SetFileTypes(size, comFilterSpec.data());
@@ -947,9 +961,23 @@ void QWindowsNativeFileDialogBase::setLabelText(QFileDialogOptions::DialogLabel
}
}
+// Return the index of the selected filter, accounting for QFileDialog
+// sometimes stripping the filter specification depending on the
+// hideFilterDetails setting.
+static int indexOfNameFilter(const QStringList &filters, const QString &needle)
+{
+ const int index = filters.indexOf(needle);
+ if (index >= 0)
+ return index;
+ for (int i = 0; i < filters.size(); ++i)
+ if (filters.at(i).startsWith(needle))
+ return i;
+ return -1;
+}
+
void QWindowsNativeFileDialogBase::selectNameFilter(const QString &filter)
{
- const int index = m_nameFilters.indexOf(filter);
+ const int index = indexOfNameFilter(m_nameFilters, filter);
if (index >= 0) {
m_fileDialog->SetFileTypeIndex(index + 1); // one-based.
} else {
@@ -1270,6 +1298,380 @@ QString QWindowsFileDialogHelper::selectedNameFilter() const
return QString();
}
+#ifndef Q_OS_WINCE
+
+/*!
+ \class QWindowsXpNativeFileDialog
+ \brief Native Windows directory dialog for Windows XP using SHlib-functions.
+
+ Uses the synchronous GetOpenFileNameW(), GetSaveFileNameW() from ComDlg32
+ or SHBrowseForFolder() for directories.
+
+ \internal
+ \sa QWindowsXpFileDialogHelper
+
+ \ingroup qt-lighthouse-win
+*/
+
+class QWindowsXpNativeFileDialog : public QWindowsNativeDialogBase
+{
+ Q_OBJECT
+public:
+ typedef QSharedPointer<QFileDialogOptions> OptionsPtr;
+
+ static QWindowsXpNativeFileDialog *create(const OptionsPtr &options);
+
+ virtual void setWindowTitle(const QString &t) { m_title = t; }
+ virtual void exec(HWND owner = 0);
+ virtual QPlatformDialogHelper::DialogCode result() const { return m_result; }
+
+ void setDirectory(const QString &d) { m_directory = d; }
+ QString directory() const { return m_directory; }
+ void selectFile(const QString &f) { m_initialFile = f; }
+ QStringList selectedFiles() const { return m_selectedFiles; }
+ void setNameFilters(const QStringList &n) { m_nameFilters = n; }
+ void selectNameFilter(const QString &f);
+ QString selectedNameFilter() const { return m_selectedNameFilter; }
+
+ int existingDirCallback(HWND hwnd, UINT uMsg, LPARAM lParam);
+
+public slots:
+ virtual void close() {}
+
+private:
+ typedef BOOL (APIENTRY *PtrGetOpenFileNameW)(LPOPENFILENAMEW);
+ typedef BOOL (APIENTRY *PtrGetSaveFileNameW)(LPOPENFILENAMEW);
+
+ explicit QWindowsXpNativeFileDialog(const OptionsPtr &options);
+ void populateOpenFileName(OPENFILENAME *ofn, HWND owner) const;
+ QStringList execExistingDir(HWND owner);
+ QStringList execFileNames(HWND owner, int *selectedFilterIndex) const;
+
+ const OptionsPtr m_options;
+ QString m_title;
+ QString m_directory;
+ QString m_initialFile;
+ QStringList m_selectedFiles;
+ QString m_selectedNameFilter;
+ QStringList m_nameFilters;
+ QPlatformDialogHelper::DialogCode m_result;
+
+ static PtrGetOpenFileNameW m_getOpenFileNameW;
+ static PtrGetSaveFileNameW m_getSaveFileNameW;
+};
+
+QWindowsXpNativeFileDialog::PtrGetOpenFileNameW QWindowsXpNativeFileDialog::m_getOpenFileNameW = 0;
+QWindowsXpNativeFileDialog::PtrGetSaveFileNameW QWindowsXpNativeFileDialog::m_getSaveFileNameW = 0;
+
+QWindowsXpNativeFileDialog *QWindowsXpNativeFileDialog::create(const OptionsPtr &options)
+{
+ // GetOpenFileNameW() GetSaveFileName() are resolved
+ // dynamically as not to create a dependency on Comdlg32, which
+ // is used on XP only.
+ if (!m_getOpenFileNameW) {
+ QSystemLibrary library(QStringLiteral("Comdlg32"));
+ m_getOpenFileNameW = (PtrGetOpenFileNameW)(library.resolve("GetOpenFileNameW"));
+ m_getSaveFileNameW = (PtrGetSaveFileNameW)(library.resolve("GetSaveFileNameW"));
+ }
+ if (m_getOpenFileNameW && m_getSaveFileNameW)
+ return new QWindowsXpNativeFileDialog(options);
+ return 0;
+}
+
+QWindowsXpNativeFileDialog::QWindowsXpNativeFileDialog(const OptionsPtr &options) :
+ m_options(options), m_result(QPlatformDialogHelper::Rejected)
+{
+ const QStringList nameFilters = m_options->nameFilters();
+ if (!nameFilters.isEmpty())
+ setNameFilters(nameFilters);
+ const QString initialDirectory = m_options->initialDirectory();
+ if (!initialDirectory.isEmpty())
+ setDirectory(initialDirectory);
+ const QString initialNameFilter = m_options->initiallySelectedNameFilter();
+ if (!initialNameFilter.isEmpty())
+ selectNameFilter(initialNameFilter);
+ const QStringList selectedFiles = m_options->initiallySelectedFiles();
+ if (!selectedFiles.isEmpty())
+ selectFile(selectedFiles.front());
+ setWindowTitle(m_options->windowTitle());
+}
+
+void QWindowsXpNativeFileDialog::selectNameFilter(const QString &f)
+{
+ const int index = indexOfNameFilter(m_nameFilters, f);
+ if (index >= 0)
+ m_selectedNameFilter = m_nameFilters.at(index);
+}
+
+void QWindowsXpNativeFileDialog::exec(HWND owner)
+{
+ int selectedFilterIndex = -1;
+ m_selectedFiles = m_options->fileMode() == QFileDialogOptions::DirectoryOnly ?
+ execExistingDir(owner) : execFileNames(owner, &selectedFilterIndex);
+ QWindowsDialogs::eatMouseMove();
+ if (m_selectedFiles.isEmpty()) {
+ m_result = QPlatformDialogHelper::Rejected;
+ emit rejected();
+ } else {
+ if (selectedFilterIndex >= 0 && selectedFilterIndex < m_nameFilters.size()) {
+ m_selectedNameFilter = m_nameFilters.at(selectedFilterIndex);
+ } else {
+ m_selectedNameFilter.clear();
+ }
+ m_directory = QFileInfo(m_selectedFiles.front()).absolutePath();
+ m_result = QPlatformDialogHelper::Accepted;
+ emit accepted();
+ }
+}
+
+// Callback for QWindowsNativeXpFileDialog directory dialog.
+// MFC Directory Dialog. Contrib: Steve Williams (minor parts from Scott Powers)
+
+static int CALLBACK xpFileDialogGetExistingDirCallbackProc(HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData)
+{
+ QWindowsXpNativeFileDialog *dialog = reinterpret_cast<QWindowsXpNativeFileDialog *>(lpData);
+ return dialog->existingDirCallback(hwnd, uMsg, lParam);
+}
+
+#ifdef Q_CC_MINGW
+typedef ITEMIDLIST *qt_LpItemIdList;
+#else
+typedef PIDLIST_ABSOLUTE qt_LpItemIdList;
+#endif
+
+int QWindowsXpNativeFileDialog::existingDirCallback(HWND hwnd, UINT uMsg, LPARAM lParam)
+{
+ switch (uMsg) {
+ case BFFM_INITIALIZED:
+ if (!m_initialFile.isEmpty())
+ SendMessage(hwnd, BFFM_SETSELECTION, TRUE, LPARAM(m_initialFile.utf16()));
+ break;
+ case BFFM_SELCHANGED: {
+ wchar_t path[MAX_PATH];
+ const bool ok = SHGetPathFromIDList(reinterpret_cast<qt_LpItemIdList>(lParam), path)
+ && path[0];
+ SendMessage(hwnd, BFFM_ENABLEOK, ok ? 1 : 0, 1);
+ }
+ break;
+ }
+ return 0;
+}
+
+QStringList QWindowsXpNativeFileDialog::execExistingDir(HWND owner)
+{
+ BROWSEINFO bi;
+ wchar_t initPath[MAX_PATH];
+ initPath[0] = 0;
+ bi.hwndOwner = owner;
+ bi.pidlRoot = NULL;
+ //### This does not seem to be respected? - the dialog always displays "Browse for folder"
+ bi.lpszTitle = (wchar_t*)m_title.utf16();
+ bi.pszDisplayName = initPath;
+ bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_STATUSTEXT | BIF_NEWDIALOGSTYLE;
+ bi.lpfn = xpFileDialogGetExistingDirCallbackProc;
+ bi.lParam = LPARAM(this);
+ QStringList selectedFiles;
+ if (qt_LpItemIdList pItemIDList = SHBrowseForFolder(&bi)) {
+ wchar_t path[MAX_PATH];
+ path[0] = 0;
+ if (SHGetPathFromIDList(pItemIDList, path) && path[0])
+ selectedFiles.push_back(QDir::cleanPath(QString::fromWCharArray(path)));
+ IMalloc *pMalloc;
+ if (SHGetMalloc(&pMalloc) == NOERROR) {
+ pMalloc->Free(pItemIDList);
+ pMalloc->Release();
+ }
+ }
+ return selectedFiles;
+}
+
+// Return an allocated wchar_t array from a QString, reserve more memory if desired.
+static wchar_t *qStringToWCharArray(const QString &s, size_t reserveSize = 0)
+{
+ const size_t stringSize = s.size();
+ wchar_t *result = new wchar_t[qMax(stringSize + 1, reserveSize)];
+ s.toWCharArray(result);
+ result[stringSize] = 0;
+ return result;
+}
+
+// Open/Save files
+void QWindowsXpNativeFileDialog::populateOpenFileName(OPENFILENAME *ofn, HWND owner) const
+{
+ ZeroMemory(ofn, sizeof(OPENFILENAME));
+ ofn->lStructSize = sizeof(OPENFILENAME);
+ ofn->hwndOwner = owner;
+
+ // Create a buffer with the filter strings.
+ int totalStringLength = 0;
+ QList<FilterSpec> specs =
+ filterSpecs(m_options->nameFilters(), m_options->options() & QFileDialogOptions::HideNameFilterDetails, &totalStringLength);
+ const int size = specs.size();
+ wchar_t *ptr = new wchar_t[totalStringLength + 2 * size + 1];
+ ofn->lpstrFilter = ptr;
+ foreach (const FilterSpec &spec, specs) {
+ ptr += spec.description.toWCharArray(ptr);
+ *ptr++ = 0;
+ ptr += spec.filter.toWCharArray(ptr);
+ *ptr++ = 0;
+ }
+ *ptr = 0;
+ const int nameFilterIndex = indexOfNameFilter(m_nameFilters, m_selectedNameFilter);
+ if (nameFilterIndex >= 0)
+ ofn->nFilterIndex = nameFilterIndex + 1; // 1..n based.
+ // lpstrFile receives the initial selection and is the buffer
+ // for the target. If it contains any invalid character, the dialog
+ // will not show.
+ ofn->nMaxFile = 65535;
+ const QString initiallySelectedFile =
+ QDir::toNativeSeparators(m_initialFile).remove(QLatin1Char('<')).
+ remove(QLatin1Char('>')).remove(QLatin1Char('"')).remove(QLatin1Char('|'));
+ ofn->lpstrFile = qStringToWCharArray(initiallySelectedFile, ofn->nMaxFile);
+ ofn->lpstrInitialDir = qStringToWCharArray(QDir::toNativeSeparators(m_directory));
+ ofn->lpstrTitle = (wchar_t*)m_title.utf16();
+ // Determine lpstrDefExt. Note that the current MSDN docs document this
+ // member wrong. It should rather be documented as "the default extension
+ // if no extension was given and if the current filter does not have an
+ // extension (e.g (*)). If the current filter has an extension, use
+ // the extension of the current filter".
+ if (m_options->acceptMode() == QFileDialogOptions::AcceptSave) {
+ QString defaultSuffix = m_options->defaultSuffix();
+ if (defaultSuffix.startsWith(QLatin1Char('.')))
+ defaultSuffix.remove(0, 1);
+ if (!defaultSuffix.isEmpty())
+ ofn->lpstrDefExt = qStringToWCharArray(defaultSuffix);
+ }
+ // Flags.
+ ofn->Flags = (OFN_NOCHANGEDIR | OFN_HIDEREADONLY | OFN_EXPLORER | OFN_PATHMUSTEXIST);
+ if (m_options->fileMode() == QFileDialogOptions::ExistingFile
+ || m_options->fileMode() == QFileDialogOptions::ExistingFiles)
+ ofn->Flags |= (OFN_FILEMUSTEXIST);
+ if (m_options->fileMode() == QFileDialogOptions::ExistingFiles)
+ ofn->Flags |= (OFN_ALLOWMULTISELECT);
+ if (!(m_options->options() & QFileDialogOptions::DontConfirmOverwrite))
+ ofn->Flags |= OFN_OVERWRITEPROMPT;
+}
+
+QStringList QWindowsXpNativeFileDialog::execFileNames(HWND owner, int *selectedFilterIndex) const
+{
+ *selectedFilterIndex = -1;
+ OPENFILENAME ofn;
+ populateOpenFileName(&ofn, owner);
+ QStringList result;
+ const bool isSave = m_options->acceptMode() == QFileDialogOptions::AcceptSave;
+ if (isSave ? m_getSaveFileNameW(&ofn) : m_getOpenFileNameW(&ofn)) {
+ *selectedFilterIndex = ofn.nFilterIndex - 1;
+ result.push_back(QDir::cleanPath(QString::fromWCharArray(ofn.lpstrFile)));
+ // For multiselection, the first item is the path followed
+ // by "\0<file1>\0<file2>\0\0".
+ if (ofn.Flags & (OFN_ALLOWMULTISELECT)) {
+ wchar_t *ptr = ofn.lpstrFile + result.front().size() + 1;
+ if (*ptr) {
+ const QString path = result.takeAt(0) + QLatin1Char('/');
+ while (*ptr) {
+ const QString fileName = QString::fromWCharArray(ptr);
+ result.push_back(path + fileName);
+ ptr += fileName.size() + 1;
+ } // extract multiple files
+ } // has multiple files
+ } // multiple flag set
+ }
+ delete [] ofn.lpstrFile;
+ delete [] ofn.lpstrInitialDir;
+ delete [] ofn.lpstrFilter;
+ delete [] ofn.lpstrDefExt;
+ return result;
+}
+
+/*!
+ \class QWindowsXpFileDialogHelper
+ \brief Dialog helper using QWindowsXpNativeFileDialog
+
+ \sa QWindowsXpNativeFileDialog
+ \internal
+ \ingroup qt-lighthouse-win
+*/
+
+class QWindowsXpFileDialogHelper : public QWindowsDialogHelperBase<QPlatformFileDialogHelper>
+{
+public:
+ QWindowsXpFileDialogHelper() {}
+ virtual bool supportsNonModalDialog() const { return false; }
+
+ virtual bool defaultNameFilterDisables() const
+ { return true; }
+ virtual void setDirectory(const QString &directory);
+ virtual QString directory() const;
+ virtual void selectFile(const QString &filename);
+ virtual QStringList selectedFiles() const;
+ virtual void setFilter() {}
+ virtual void setNameFilters(const QStringList &);
+ virtual void selectNameFilter(const QString &);
+ virtual QString selectedNameFilter() const;
+
+private:
+ virtual QWindowsNativeDialogBase *createNativeDialog();
+ inline QWindowsXpNativeFileDialog *nativeFileDialog() const
+ { return static_cast<QWindowsXpNativeFileDialog *>(nativeDialog()); }
+};
+
+QWindowsNativeDialogBase *QWindowsXpFileDialogHelper::createNativeDialog()
+{
+ if (QWindowsNativeDialogBase *result = QWindowsXpNativeFileDialog::create(options())) {
+ QObject::connect(result, SIGNAL(accepted()), this, SIGNAL(accept()));
+ QObject::connect(result, SIGNAL(rejected()), this, SIGNAL(reject()));
+ return result;
+ }
+ return 0;
+}
+
+void QWindowsXpFileDialogHelper::setDirectory(const QString &directory)
+{
+ if (QWindowsXpNativeFileDialog *nfd = nativeFileDialog())
+ nfd->setDirectory(directory);
+}
+
+QString QWindowsXpFileDialogHelper::directory() const
+{
+ if (const QWindowsXpNativeFileDialog *nfd = nativeFileDialog())
+ return nfd->directory();
+ return QString();
+}
+
+void QWindowsXpFileDialogHelper::selectFile(const QString &filename)
+{
+ if (QWindowsXpNativeFileDialog *nfd = nativeFileDialog())
+ nfd->selectFile(filename);
+}
+
+QStringList QWindowsXpFileDialogHelper::selectedFiles() const
+{
+ if (const QWindowsXpNativeFileDialog *nfd = nativeFileDialog())
+ return nfd->selectedFiles();
+ return QStringList();
+}
+
+void QWindowsXpFileDialogHelper::setNameFilters(const QStringList &n)
+{
+ if (QWindowsXpNativeFileDialog *nfd = nativeFileDialog())
+ nfd->setNameFilters(n);
+}
+
+void QWindowsXpFileDialogHelper::selectNameFilter(const QString &f)
+{
+ if (QWindowsXpNativeFileDialog *nfd = nativeFileDialog())
+ nfd->selectNameFilter(f);
+}
+
+QString QWindowsXpFileDialogHelper::selectedNameFilter() const
+{
+ if (const QWindowsXpNativeFileDialog *nfd = nativeFileDialog())
+ return nfd->selectedNameFilter();
+ return QString();
+}
+
+#endif // Q_OS_WINCE
+
/*!
\class QWindowsNativeColorDialog
\brief Native Windows color dialog.
@@ -1399,10 +1801,11 @@ namespace QWindowsDialogs {
// QWindowsDialogHelperBase creation functions
bool useHelper(QPlatformTheme::DialogType type)
{
+ if (QWindowsIntegration::instance()->options() & QWindowsIntegration::NoNativeDialogs)
+ return false;
switch (type) {
case QPlatformTheme::FileDialog:
- return true;
- break;
+ return QSysInfo::windowsVersion() >= QSysInfo::WV_XP;
case QPlatformTheme::ColorDialog:
#ifdef USE_NATIVE_COLOR_DIALOG
return true;
@@ -1417,9 +1820,20 @@ bool useHelper(QPlatformTheme::DialogType type)
QPlatformDialogHelper *createHelper(QPlatformTheme::DialogType type)
{
+ if (QWindowsIntegration::instance()->options() & QWindowsIntegration::NoNativeDialogs)
+ return 0;
switch (type) {
case QPlatformTheme::FileDialog:
+#ifndef Q_OS_WINCE
+ if (QWindowsIntegration::instance()->options() & QWindowsIntegration::XpNativeDialogs
+ || QSysInfo::windowsVersion() == QSysInfo::WV_XP) {
+ return new QWindowsXpFileDialogHelper();
+ }
+ if (QSysInfo::windowsVersion() > QSysInfo::WV_XP)
+ return new QWindowsFileDialogHelper();
+#else
return new QWindowsFileDialogHelper();
+#endif // Q_OS_WINCE
case QPlatformTheme::ColorDialog:
#ifdef USE_NATIVE_COLOR_DIALOG
return new QWindowsColorDialogHelper();
diff --git a/src/plugins/platforms/windows/qwindowsdrag.cpp b/src/plugins/platforms/windows/qwindowsdrag.cpp
index f74b2140f6..805046c715 100644
--- a/src/plugins/platforms/windows/qwindowsdrag.cpp
+++ b/src/plugins/platforms/windows/qwindowsdrag.cpp
@@ -301,9 +301,15 @@ public:
STDMETHOD(GiveFeedback)(DWORD dwEffect);
private:
- typedef QMap <Qt::DropAction, HCURSOR> ActionCursorMap;
-
- inline void clearCursors();
+ class DragCursorHandle {
+ Q_DISABLE_COPY(DragCursorHandle)
+ public:
+ DragCursorHandle(HCURSOR c, quint64 k) : cursor(c), cacheKey(k) {}
+ ~DragCursorHandle() { DestroyCursor(cursor); }
+ HCURSOR cursor;
+ quint64 cacheKey;
+ };
+ typedef QMap <Qt::DropAction, QSharedPointer<DragCursorHandle> > ActionCursorMap;
QWindowsDrag *m_drag;
Qt::MouseButtons m_currentButtons;
@@ -322,7 +328,7 @@ QWindowsOleDropSource::QWindowsOleDropSource(QWindowsDrag *drag) :
QWindowsOleDropSource::~QWindowsOleDropSource()
{
- clearCursors();
+ m_cursors.clear();
if (QWindowsContext::verboseOLE)
qDebug("%s", __FUNCTION__);
}
@@ -347,10 +353,14 @@ void QWindowsOleDropSource::createCursors()
QPixmap cpm = drag->dragCursor(action);
if (cpm.isNull())
cpm = m_drag->defaultCursor(action);
+ QSharedPointer<DragCursorHandle> cursorHandler = m_cursors.value(action);
+ if (!cursorHandler.isNull() && cpm.cacheKey() == cursorHandler->cacheKey)
+ continue;
if (cpm.isNull()) {
qWarning("%s: Unable to obtain drag cursor for %d.", __FUNCTION__, action);
continue;
}
+
int w = cpm.width();
int h = cpm.height();
@@ -380,23 +390,14 @@ void QWindowsOleDropSource::createCursors()
const int hotX = hasPixmap ? qMax(0,newHotSpot.x()) : 0;
const int hotY = hasPixmap ? qMax(0,newHotSpot.y()) : 0;
- if (const HCURSOR sysCursor = QWindowsCursor::createPixmapCursor(newCursor, hotX, hotY))
- m_cursors.insert(actions.at(cnum), sysCursor);
+ if (const HCURSOR sysCursor = QWindowsCursor::createPixmapCursor(newCursor, hotX, hotY)) {
+ m_cursors.insert(action, QSharedPointer<DragCursorHandle>(new DragCursorHandle(sysCursor, cpm.cacheKey())));
+ }
}
if (QWindowsContext::verboseOLE)
qDebug("%s %d cursors", __FUNCTION__, m_cursors.size());
}
-void QWindowsOleDropSource::clearCursors()
-{
- if (!m_cursors.isEmpty()) {
- const ActionCursorMap::const_iterator cend = m_cursors.constEnd();
- for (ActionCursorMap::const_iterator it = m_cursors.constBegin(); it != cend; ++it)
- DestroyCursor(it.value());
- m_cursors.clear();
- }
-}
-
//---------------------------------------------------------------------
// IUnknown Methods
//---------------------------------------------------------------------
@@ -488,9 +489,14 @@ QWindowsOleDropSource::GiveFeedback(DWORD dwEffect)
if (QWindowsContext::verboseOLE > 2)
qDebug("%s dwEffect=%lu, action=%d", __FUNCTION__, dwEffect, action);
+ QSharedPointer<DragCursorHandle> cursorHandler = m_cursors.value(action);
+ quint64 currentCacheKey = m_drag->currentDrag()->dragCursor(action).cacheKey();
+ if (cursorHandler.isNull() || currentCacheKey != cursorHandler->cacheKey)
+ createCursors();
+
const ActionCursorMap::const_iterator it = m_cursors.constFind(action);
if (it != m_cursors.constEnd()) {
- SetCursor(it.value());
+ SetCursor(it.value()->cursor);
return ResultFromScode(S_OK);
}
@@ -595,6 +601,9 @@ QT_ENSURE_STACK_ALIGNED_FOR_SSE STDMETHODIMP
QWindowsOleDropTarget::DragEnter(LPDATAOBJECT pDataObj, DWORD grfKeyState,
POINTL pt, LPDWORD pdwEffect)
{
+ if (IDropTargetHelper* dh = QWindowsDrag::instance()->dropHelper())
+ dh->DragEnter(reinterpret_cast<HWND>(m_window->winId()), pDataObj, reinterpret_cast<POINT*>(&pt), *pdwEffect);
+
if (QWindowsContext::verboseOLE)
qDebug("%s widget=%p key=%lu, pt=%ld,%ld", __FUNCTION__, m_window, grfKeyState, pt.x, pt.y);
@@ -608,6 +617,9 @@ QWindowsOleDropTarget::DragEnter(LPDATAOBJECT pDataObj, DWORD grfKeyState,
QT_ENSURE_STACK_ALIGNED_FOR_SSE STDMETHODIMP
QWindowsOleDropTarget::DragOver(DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect)
{
+ if (IDropTargetHelper* dh = QWindowsDrag::instance()->dropHelper())
+ dh->DragOver(reinterpret_cast<POINT*>(&pt), *pdwEffect);
+
QWindow *dragOverWindow = findDragOverWindow(pt);
if (QWindowsContext::verboseOLE)
qDebug("%s widget=%p key=%lu, pt=%ld,%ld", __FUNCTION__, dragOverWindow, grfKeyState, pt.x, pt.y);
@@ -628,6 +640,9 @@ QWindowsOleDropTarget::DragOver(DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect)
QT_ENSURE_STACK_ALIGNED_FOR_SSE STDMETHODIMP
QWindowsOleDropTarget::DragLeave()
{
+ if (IDropTargetHelper* dh = QWindowsDrag::instance()->dropHelper())
+ dh->DragLeave();
+
if (QWindowsContext::verboseOLE)
qDebug().nospace() <<__FUNCTION__ << ' ' << m_window;
@@ -640,9 +655,12 @@ QWindowsOleDropTarget::DragLeave()
#define KEY_STATE_BUTTON_MASK (MK_LBUTTON | MK_MBUTTON | MK_RBUTTON)
QT_ENSURE_STACK_ALIGNED_FOR_SSE STDMETHODIMP
-QWindowsOleDropTarget::Drop(LPDATAOBJECT /*pDataObj*/, DWORD grfKeyState,
+QWindowsOleDropTarget::Drop(LPDATAOBJECT pDataObj, DWORD grfKeyState,
POINTL pt, LPDWORD pdwEffect)
{
+ if (IDropTargetHelper* dh = QWindowsDrag::instance()->dropHelper())
+ dh->Drop(pDataObj, reinterpret_cast<POINT*>(&pt), *pdwEffect);
+
QWindow *dropWindow = findDragOverWindow(pt);
if (QWindowsContext::verboseOLE)
@@ -700,6 +718,7 @@ QWindowsOleDropTarget::Drop(LPDATAOBJECT /*pDataObj*/, DWORD grfKeyState,
return NOERROR;
}
+
/*!
\class QWindowsDrag
\brief Windows drag implementation.
@@ -707,12 +726,15 @@ QWindowsOleDropTarget::Drop(LPDATAOBJECT /*pDataObj*/, DWORD grfKeyState,
\ingroup qt-lighthouse-win
*/
-QWindowsDrag::QWindowsDrag() : m_dropDataObject(0)
+QWindowsDrag::QWindowsDrag() :
+ m_dropDataObject(0), m_cachedDropTargetHelper(0)
{
}
QWindowsDrag::~QWindowsDrag()
{
+ if (m_cachedDropTargetHelper)
+ m_cachedDropTargetHelper->Release();
}
/*!
@@ -726,6 +748,18 @@ QMimeData *QWindowsDrag::dropData()
return &m_dropData;
}
+/*!
+ \brief May be used to handle extended cursors functionality for drags from outside the app.
+*/
+IDropTargetHelper* QWindowsDrag::dropHelper() {
+ if (!m_cachedDropTargetHelper) {
+ CoCreateInstance(CLSID_DragDropHelper, 0, CLSCTX_INPROC_SERVER,
+ IID_IDropTargetHelper,
+ reinterpret_cast<void**>(&m_cachedDropTargetHelper));
+ }
+ return m_cachedDropTargetHelper;
+}
+
QPixmap QWindowsDrag::defaultCursor(Qt::DropAction action) const
{
switch (action) {
diff --git a/src/plugins/platforms/windows/qwindowsdrag.h b/src/plugins/platforms/windows/qwindowsdrag.h
index ab06545884..d3bfd36955 100644
--- a/src/plugins/platforms/windows/qwindowsdrag.h
+++ b/src/plugins/platforms/windows/qwindowsdrag.h
@@ -47,6 +47,8 @@
#include <qpa/qplatformdrag.h>
#include <QtGui/QPixmap>
+struct IDropTargetHelper;
+
QT_BEGIN_NAMESPACE
class QWindowsDropMimeData : public QWindowsInternalMimeData {
public:
@@ -100,12 +102,16 @@ public:
void releaseDropDataObject();
QMimeData *dropData();
+ IDropTargetHelper* dropHelper();
+
QPixmap defaultCursor(Qt::DropAction action) const;
private:
QWindowsDropMimeData m_dropData;
IDataObject *m_dropDataObject;
+ IDropTargetHelper* m_cachedDropTargetHelper;
+
mutable QPixmap m_copyDragCursor;
mutable QPixmap m_moveDragCursor;
mutable QPixmap m_linkDragCursor;
diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp
index b7309c3f7c..a02f0cd494 100644
--- a/src/plugins/platforms/windows/qwindowsintegration.cpp
+++ b/src/plugins/platforms/windows/qwindowsintegration.cpp
@@ -279,6 +279,12 @@ static inline unsigned parseOptions(const QStringList &paramList)
} else if (param.endsWith(QLatin1String("native"))) {
options |= QWindowsIntegration::FontDatabaseNative;
}
+ } else if (param.startsWith(QLatin1String("dialogs="))) {
+ if (param.endsWith(QLatin1String("xp"))) {
+ options |= QWindowsIntegration::XpNativeDialogs;
+ } else if (param.endsWith(QLatin1String("none"))) {
+ options |= QWindowsIntegration::NoNativeDialogs;
+ }
} else if (param == QLatin1String("gl=gdi")) {
options |= QWindowsIntegration::DisableArb;
}
@@ -332,6 +338,8 @@ bool QWindowsIntegration::hasCapability(QPlatformIntegration::Capability cap) co
#endif // !QT_NO_OPENGL
case WindowMasks:
return true;
+ case MultipleWindows:
+ return true;
default:
return QPlatformIntegration::hasCapability(cap);
}
diff --git a/src/plugins/platforms/windows/qwindowsintegration.h b/src/plugins/platforms/windows/qwindowsintegration.h
index ca47dabb4b..abf663c052 100644
--- a/src/plugins/platforms/windows/qwindowsintegration.h
+++ b/src/plugins/platforms/windows/qwindowsintegration.h
@@ -56,7 +56,9 @@ public:
enum Options { // Options to be passed on command line.
FontDatabaseFreeType = 0x1,
FontDatabaseNative = 0x2,
- DisableArb = 0x4
+ DisableArb = 0x4,
+ NoNativeDialogs = 0x8,
+ XpNativeDialogs = 0x10
};
explicit QWindowsIntegration(const QStringList &paramList);
diff --git a/src/plugins/platforms/windows/qwindowstheme.cpp b/src/plugins/platforms/windows/qwindowstheme.cpp
index d9de911914..2fb905d23b 100644
--- a/src/plugins/platforms/windows/qwindowstheme.cpp
+++ b/src/plugins/platforms/windows/qwindowstheme.cpp
@@ -509,6 +509,7 @@ QPixmap QWindowsTheme::standardPixmap(StandardPixmap sp, const QSizeF &size) con
case TrashIcon:
resourceId = 191;
break;
+#ifndef Q_OS_WINCE
case MessageBoxInformation:
iconName = IDI_INFORMATION;
break;
@@ -538,6 +539,7 @@ QPixmap QWindowsTheme::standardPixmap(StandardPixmap sp, const QSizeF &size) con
}
}
break;
+#endif
default:
break;
}
diff --git a/src/plugins/platforms/windows/windows.pro b/src/plugins/platforms/windows/windows.pro
index 1527f0e496..ca356e1276 100644
--- a/src/plugins/platforms/windows/windows.pro
+++ b/src/plugins/platforms/windows/windows.pro
@@ -1,4 +1,6 @@
TARGET = windows
+
+PLUGIN_TYPE = platforms
load(qt_plugin)
QT *= core-private
@@ -6,7 +8,6 @@ QT *= gui-private
QT *= platformsupport-private
INCLUDEPATH += ../../../3rdparty/harfbuzz/src
-QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/platforms
# Note: OpenGL32 must precede Gdi32 as it overwrites some functions.
LIBS *= -lole32
@@ -172,6 +173,3 @@ contains(QT_CONFIG, freetype) {
OTHER_FILES += windows.json
contains(QT_CONFIG, accessibility):include(accessible/accessible.pri)
-
-target.path += $$[QT_INSTALL_PLUGINS]/platforms
-INSTALLS += target
diff --git a/src/plugins/platforms/xcb/qxcbcursor.cpp b/src/plugins/platforms/xcb/qxcbcursor.cpp
index 0510c1db5b..c1cfbd02d6 100644
--- a/src/plugins/platforms/xcb/qxcbcursor.cpp
+++ b/src/plugins/platforms/xcb/qxcbcursor.cpp
@@ -508,16 +508,16 @@ xcb_cursor_t QXcbCursor::createBitmapCursor(QCursor *cursor)
return c;
}
-void QXcbCursor::queryPointer(xcb_connection_t *conn, xcb_window_t *rootWin, QPoint *pos, int *keybMask)
+void QXcbCursor::queryPointer(QXcbConnection *c, xcb_window_t *rootWin, QPoint *pos, int *keybMask)
{
if (pos)
*pos = QPoint();
- xcb_screen_iterator_t it = xcb_setup_roots_iterator(xcb_get_setup(conn));
+ xcb_screen_iterator_t it = xcb_setup_roots_iterator(c->setup());
while (it.rem) {
xcb_window_t root = it.data->root;
- xcb_query_pointer_cookie_t cookie = xcb_query_pointer(conn, root);
+ xcb_query_pointer_cookie_t cookie = xcb_query_pointer(c->xcb_connection(), root);
xcb_generic_error_t *err = 0;
- xcb_query_pointer_reply_t *reply = xcb_query_pointer_reply(conn, cookie, &err);
+ xcb_query_pointer_reply_t *reply = xcb_query_pointer_reply(c->xcb_connection(), cookie, &err);
if (!err && reply) {
if (pos)
*pos = QPoint(reply->root_x, reply->root_y);
@@ -537,17 +537,16 @@ void QXcbCursor::queryPointer(xcb_connection_t *conn, xcb_window_t *rootWin, QPo
QPoint QXcbCursor::pos() const
{
QPoint p;
- queryPointer(xcb_connection(), 0, &p);
+ queryPointer(connection(), 0, &p);
return p;
}
void QXcbCursor::setPos(const QPoint &pos)
{
- xcb_connection_t *conn = xcb_connection();
xcb_window_t root;
- queryPointer(conn, &root, 0);
- xcb_warp_pointer(conn, XCB_NONE, root, 0, 0, 0, 0, pos.x(), pos.y());
- xcb_flush(conn);
+ queryPointer(connection(), &root, 0);
+ xcb_warp_pointer(xcb_connection(), XCB_NONE, root, 0, 0, 0, 0, pos.x(), pos.y());
+ xcb_flush(xcb_connection());
}
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/xcb/qxcbcursor.h b/src/plugins/platforms/xcb/qxcbcursor.h
index 9726c5955a..4c74034988 100644
--- a/src/plugins/platforms/xcb/qxcbcursor.h
+++ b/src/plugins/platforms/xcb/qxcbcursor.h
@@ -56,7 +56,7 @@ public:
QPoint pos() const;
void setPos(const QPoint &pos);
- static void queryPointer(xcb_connection_t *conn, xcb_window_t *rootWin, QPoint *pos, int *keybMask = 0);
+ static void queryPointer(QXcbConnection *c, xcb_window_t *rootWin, QPoint *pos, int *keybMask = 0);
private:
xcb_cursor_t createFontCursor(int cshape);
diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp
index 5170ff9e10..2ffe53c04b 100644
--- a/src/plugins/platforms/xcb/qxcbintegration.cpp
+++ b/src/plugins/platforms/xcb/qxcbintegration.cpp
@@ -216,6 +216,7 @@ bool QXcbIntegration::hasCapability(QPlatformIntegration::Capability cap) const
#endif
case ThreadedOpenGL: return false;
case WindowMasks: return true;
+ case MultipleWindows: return true;
default: return QPlatformIntegration::hasCapability(cap);
}
}
@@ -275,8 +276,8 @@ QPlatformServices *QXcbIntegration::services() const
Qt::KeyboardModifiers QXcbIntegration::queryKeyboardModifiers() const
{
int keybMask = 0;
- QXcbConnection* conn = m_connections.at(0);
- QXcbCursor::queryPointer(conn->xcb_connection(), 0, 0, &keybMask);
+ QXcbConnection *conn = m_connections.at(0);
+ QXcbCursor::queryPointer(conn, 0, 0, &keybMask);
return conn->keyboard()->translateModifiers(keybMask);
}
diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp
index 2a36fb7369..fa5f5f43d0 100644
--- a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp
+++ b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp
@@ -53,6 +53,8 @@
#if defined(XCB_USE_EGL)
#include "QtPlatformSupport/private/qeglplatformcontext_p.h"
+#elif defined (XCB_USE_GLX)
+#include "qglxintegration.h"
#endif
QT_BEGIN_NAMESPACE
@@ -68,6 +70,7 @@ public:
insert("connection",QXcbNativeInterface::Connection);
insert("screen",QXcbNativeInterface::Screen);
insert("eglcontext",QXcbNativeInterface::EglContext);
+ insert("glxcontext",QXcbNativeInterface::GLXContext);
}
};
@@ -91,6 +94,9 @@ void *QXcbNativeInterface::nativeResourceForContext(const QByteArray &resourceSt
case EglContext:
result = eglContextForContext(context);
break;
+ case GLXContext:
+ result = glxContextForContext(context);
+ break;
default:
break;
}
@@ -191,4 +197,17 @@ void * QXcbNativeInterface::eglContextForContext(QOpenGLContext *context)
#endif
}
+void *QXcbNativeInterface::glxContextForContext(QOpenGLContext *context)
+{
+ Q_ASSERT(context);
+#if defined(XCB_USE_GLX)
+ QGLXContext *glxPlatformContext = static_cast<QGLXContext *>(context->handle());
+ return glxPlatformContext->glxContext();
+#else
+ Q_UNUSED(context);
+ return 0;
+#endif
+
+}
+
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.h b/src/plugins/platforms/xcb/qxcbnativeinterface.h
index 1223fdc39c..c15d00255a 100644
--- a/src/plugins/platforms/xcb/qxcbnativeinterface.h
+++ b/src/plugins/platforms/xcb/qxcbnativeinterface.h
@@ -58,7 +58,8 @@ public:
Connection,
Screen,
GraphicsDevice,
- EglContext
+ EglContext,
+ GLXContext
};
QXcbNativeInterface();
@@ -76,6 +77,7 @@ public:
void *screenForWindow(QWindow *window);
void *graphicsDeviceForWindow(QWindow *window);
static void *eglContextForContext(QOpenGLContext *context);
+ static void *glxContextForContext(QOpenGLContext *context);
private:
const QByteArray m_genericEventFilterType;
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp
index 48754b0a60..eab18e2435 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.cpp
+++ b/src/plugins/platforms/xcb/qxcbwindow.cpp
@@ -542,16 +542,18 @@ void QXcbWindow::show()
propagateSizeHints();
// update WM_TRANSIENT_FOR
- if (window()->transientParent() && isTransient(window())) {
- QXcbWindow *transientXcbParent = static_cast<QXcbWindow *>(window()->transientParent()->handle());
- if (transientXcbParent) {
- // ICCCM 4.1.2.6
- xcb_window_t parentWindow = transientXcbParent->xcb_window();
-
- // todo: set transient for group (wm_client_leader) if no parent, a la qwidget_x11.cpp
+ if (isTransient(window())) {
+ xcb_window_t transientXcbParent = 0;
+ if (const QWindow *tp = window()->transientParent())
+ 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.
+ if (!transientXcbParent)
+ transientXcbParent = static_cast<QXcbScreen *>(screen())->clientLeader();
+ if (transientXcbParent) { // ICCCM 4.1.2.6
Q_XCB_CALL(xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, m_window,
XCB_ATOM_WM_TRANSIENT_FOR, XCB_ATOM_WINDOW, 32,
- 1, &parentWindow));
+ 1, &transientXcbParent));
}
}
diff --git a/src/plugins/platforms/xcb/xcb.pro b/src/plugins/platforms/xcb/xcb.pro
index 58521686aa..34f7c74675 100644
--- a/src/plugins/platforms/xcb/xcb.pro
+++ b/src/plugins/platforms/xcb/xcb.pro
@@ -1,7 +1,7 @@
TARGET = xcb
+PLUGIN_TYPE = platforms
load(qt_plugin)
-QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/platforms
QT += core-private gui-private platformsupport-private
@@ -110,6 +110,3 @@ LIBS += -ldbus-1
}
OTHER_FILES += xcb.json
-
-target.path += $$[QT_INSTALL_PLUGINS]/platforms
-INSTALLS += target
diff --git a/src/plugins/printsupport/cocoa/cocoa.pro b/src/plugins/printsupport/cocoa/cocoa.pro
index 477715a8e2..4e99b4a8f5 100644
--- a/src/plugins/printsupport/cocoa/cocoa.pro
+++ b/src/plugins/printsupport/cocoa/cocoa.pro
@@ -1,6 +1,7 @@
TARGET = cocoaprintersupport
+
+PLUGIN_TYPE = printsupport
load(qt_plugin)
-DESTDIR = $$QT.gui.plugins/printsupport
QT += gui-private printsupport-private
LIBS += -framework Cocoa
@@ -8,6 +9,3 @@ LIBS += -framework Cocoa
SOURCES += main.cpp
OTHER_FILES += cocoa.json
-
-target.path += $$[QT_INSTALL_PLUGINS]/printsupport
-INSTALLS += target
diff --git a/src/plugins/printsupport/cups/cups.pro b/src/plugins/printsupport/cups/cups.pro
index f23ad3fb5e..bd0b6af114 100644
--- a/src/plugins/printsupport/cups/cups.pro
+++ b/src/plugins/printsupport/cups/cups.pro
@@ -1,6 +1,7 @@
TARGET = cupsprintersupport
+
+PLUGIN_TYPE = printsupport
load(qt_plugin)
-DESTDIR = $$QT.gui.plugins/printsupport
QT += core-private gui-private printsupport printsupport-private
@@ -14,6 +15,3 @@ HEADERS += qcupsprintersupport_p.h \
qcupsprintengine_p.h
OTHER_FILES += cups.json
-
-target.path += $$[QT_INSTALL_PLUGINS]/printsupport
-INSTALLS += target
diff --git a/src/plugins/printsupport/windows/windows.pro b/src/plugins/printsupport/windows/windows.pro
index 3c5f22d411..5e8738554c 100644
--- a/src/plugins/printsupport/windows/windows.pro
+++ b/src/plugins/printsupport/windows/windows.pro
@@ -1,11 +1,12 @@
-TARGET = windows
+TARGET = windowsprintersupport
+
+PLUGIN_TYPE = printsupport
load(qt_plugin)
QT *= core-private
QT *= gui-private
QT *= printsupport-private
-QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/printsupport
INCLUDEPATH *= $$QT_SOURCE_TREE/src/printsupport/kernel
SOURCES += \
@@ -17,6 +18,4 @@ HEADERS += \
OTHER_FILES += windows.json
-target.path += $$[QT_INSTALL_PLUGINS]/printsupport
-INSTALLS += target
LIBS += -lwinspool -lcomdlg32
diff --git a/src/plugins/qpluginbase.pri b/src/plugins/qpluginbase.pri
deleted file mode 100644
index b22a527761..0000000000
--- a/src/plugins/qpluginbase.pri
+++ /dev/null
@@ -1 +0,0 @@
-load(qt_plugin)
diff --git a/src/plugins/sqldrivers/qsqldriverbase.pri b/src/plugins/sqldrivers/qsqldriverbase.pri
index 45638fcd4f..17424f6764 100644
--- a/src/plugins/sqldrivers/qsqldriverbase.pri
+++ b/src/plugins/sqldrivers/qsqldriverbase.pri
@@ -1,8 +1,6 @@
-load(qt_plugin)
QT = core sql-private
-DESTDIR = $$QT.sql.plugins/sqldrivers
-target.path += $$[QT_INSTALL_PLUGINS]/sqldrivers
-INSTALLS += target
+PLUGIN_TYPE = sqldrivers
+load(qt_plugin)
DEFINES += QT_NO_CAST_TO_ASCII QT_NO_CAST_FROM_ASCII
diff --git a/src/printsupport/kernel/qprintengine_pdf.cpp b/src/printsupport/kernel/qprintengine_pdf.cpp
index 3e343176ba..c4bcb697f5 100644
--- a/src/printsupport/kernel/qprintengine_pdf.cpp
+++ b/src/printsupport/kernel/qprintengine_pdf.cpp
@@ -213,6 +213,7 @@ void QPdfPrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &va
d->topMargin = margins.at(1).toReal();
d->rightMargin = margins.at(2).toReal();
d->bottomMargin = margins.at(3).toReal();
+ d->pageMarginsSet = true;
break;
}
default:
@@ -298,8 +299,11 @@ QVariant QPdfPrintEngine::property(PrintEnginePropertyKey key) const
case PPK_PageMargins:
{
QList<QVariant> margins;
- margins << d->leftMargin << d->topMargin
- << d->rightMargin << d->bottomMargin;
+ if (d->printerPaperSize == QPrinter::Custom && !d->pageMarginsSet)
+ margins << 0 << 0 << 0 << 0;
+ else
+ margins << d->leftMargin << d->topMargin
+ << d->rightMargin << d->bottomMargin;
ret = margins;
break;
}
@@ -353,6 +357,7 @@ QPdfPrintEnginePrivate::QPdfPrintEnginePrivate(QPrinter::PrinterMode m)
pageOrder(QPrinter::FirstPageFirst),
paperSource(QPrinter::Auto),
printerPaperSize(QPrinter::A4),
+ pageMarginsSet(false),
fd(-1)
{
resolution = 72;
diff --git a/src/printsupport/kernel/qprintengine_pdf_p.h b/src/printsupport/kernel/qprintengine_pdf_p.h
index 36df233f72..2d70c4619e 100644
--- a/src/printsupport/kernel/qprintengine_pdf_p.h
+++ b/src/printsupport/kernel/qprintengine_pdf_p.h
@@ -151,7 +151,7 @@ private:
QPrinter::PaperSize printerPaperSize;
QSizeF customPaperSize; // in postscript points
-
+ bool pageMarginsSet;
int fd;
};
diff --git a/src/printsupport/kernel/qprintengine_win.cpp b/src/printsupport/kernel/qprintengine_win.cpp
index 28e0363d6e..200b5fd102 100644
--- a/src/printsupport/kernel/qprintengine_win.cpp
+++ b/src/printsupport/kernel/qprintengine_win.cpp
@@ -1540,13 +1540,17 @@ QVariant QWin32PrintEngine::property(PrintEnginePropertyKey key) const
case PPK_PageMargins:
{
QList<QVariant> margins;
- QRect pageMargins(d->getPageMargins());
+ if (d->has_custom_paper_size && !d->pageMarginsSet) {
+ margins << 0 << 0 << 0 << 0;
+ } else {
+ QRect pageMargins(d->getPageMargins());
- // specified in 1/100 mm
- margins << (mmToInches(pageMargins.left()/100.0) * 72)
- << (mmToInches(pageMargins.top()/100.0) * 72)
- << (mmToInches(pageMargins.width()/100.0) * 72)
- << (mmToInches(pageMargins.height()/100.0) * 72);
+ // specified in 1/100 mm
+ margins << (mmToInches(pageMargins.left()/100.0) * 72)
+ << (mmToInches(pageMargins.top()/100.0) * 72)
+ << (mmToInches(pageMargins.width()/100.0) * 72)
+ << (mmToInches(pageMargins.height()/100.0) * 72);
+ }
value = margins;
break;
}
diff --git a/src/sql/kernel/qsql.qdoc b/src/sql/kernel/qsql.qdoc
index 3b0e848af1..b3afe82245 100644
--- a/src/sql/kernel/qsql.qdoc
+++ b/src/sql/kernel/qsql.qdoc
@@ -31,7 +31,6 @@
\brief The QSql namespace contains miscellaneous identifiers used throughout
the Qt SQL library.
- \inheaderfile QtSql
\ingroup database
diff --git a/src/sql/models/qsqlrelationaldelegate.h b/src/sql/models/qsqlrelationaldelegate.h
index 439dde2662..52a19dbb0a 100644
--- a/src/sql/models/qsqlrelationaldelegate.h
+++ b/src/sql/models/qsqlrelationaldelegate.h
@@ -82,17 +82,6 @@ QWidget *createEditor(QWidget *aParent,
return combo;
}
-void setEditorData(QWidget *editor, const QModelIndex &index) const
-{
- const QSqlRelationalTableModel *sqlModel = qobject_cast<const QSqlRelationalTableModel *>(index.model());
- QComboBox *combo = qobject_cast<QComboBox *>(editor);
- if (!sqlModel || !combo) {
- QItemDelegate::setEditorData(editor, index);
- return;
- }
- combo->setCurrentIndex(combo->findText(sqlModel->data(index).toString()));
-}
-
void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
{
if (!index.isValid())
diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp
index 729ae49aaf..55e6f9b622 100644
--- a/src/testlib/qtestcase.cpp
+++ b/src/testlib/qtestcase.cpp
@@ -1202,12 +1202,15 @@ Q_TESTLIB_EXPORT bool printAvailableFunctions = false;
Q_TESTLIB_EXPORT QStringList testFunctions;
Q_TESTLIB_EXPORT QStringList testTags;
-static void qPrintTestSlots(FILE *stream)
+static void qPrintTestSlots(FILE *stream, const char *filter = 0)
{
for (int i = 0; i < QTest::currentTestObject->metaObject()->methodCount(); ++i) {
QMetaMethod sl = QTest::currentTestObject->metaObject()->method(i);
- if (isValidSlot(sl))
- fprintf(stream, "%s\n", sl.methodSignature().constData());
+ if (isValidSlot(sl)) {
+ const QByteArray signature = sl.methodSignature();
+ if (!filter || QString::fromLatin1(signature).contains(QLatin1String(filter), Qt::CaseInsensitive))
+ fprintf(stream, "%s\n", signature.constData());
+ }
}
}
@@ -1569,9 +1572,10 @@ Q_TESTLIB_EXPORT void qtest_qParseArgs(int argc, char *argv[], bool qml)
qsnprintf(buf + off, qMin(512 - off, 3), "()"); // append "()"
int idx = QTest::currentTestObject->metaObject()->indexOfMethod(buf);
if (idx < 0 || !isValidSlot(QTest::currentTestObject->metaObject()->method(idx))) {
- fprintf(stderr, "Unknown testfunction: '%s'\n", buf);
- fprintf(stderr, "Available testfunctions:\n");
- qPrintTestSlots(stderr);
+ fprintf(stderr, "Unknown test function: '%s'. Possible matches:\n", buf);
+ buf[off] = 0;
+ qPrintTestSlots(stderr, buf);
+ fprintf(stderr, "\n%s -functions\nlists all available test functions.\n", argv[0]);
exit(1);
}
testFuncs[testFuncCount].set(idx, data);
diff --git a/src/testlib/qtestlog.cpp b/src/testlib/qtestlog.cpp
index c56a00237b..a337a81959 100644
--- a/src/testlib/qtestlog.cpp
+++ b/src/testlib/qtestlog.cpp
@@ -238,6 +238,12 @@ namespace QTest {
return false;
}
+// don't warn about qInstallMsgHandler
+#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 406) && !defined(Q_CC_INTEL)
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#endif
+
static void messageHandler(QtMsgType type, const char *msg)
{
static QBasicAtomicInt counter = Q_BASIC_ATOMIC_INITIALIZER(QTest::maxWarnings);
@@ -287,6 +293,10 @@ namespace QTest {
break;
}
}
+
+#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 406) && !defined(Q_CC_INTEL)
+# pragma GCC diagnostic pop
+#endif
}
void QTestLog::enterTestFunction(const char* function)
diff --git a/src/testlib/qtestsystem.h b/src/testlib/qtestsystem.h
index 2f3f499d47..094570bb8c 100644
--- a/src/testlib/qtestsystem.h
+++ b/src/testlib/qtestsystem.h
@@ -45,7 +45,9 @@
#include <QtTest/qtestcase.h>
#include <QtCore/qcoreapplication.h>
#include <QtCore/qelapsedtimer.h>
-#include <QtGui/QWindow>
+#ifdef QT_GUI_LIB
+# include <QtGui/QWindow>
+#endif
#ifdef QT_WIDGETS_LIB
# include <QtWidgets/QWidget>
#endif
@@ -69,6 +71,7 @@ namespace QTest
} while (timer.elapsed() < ms);
}
+#ifdef QT_GUI_LIB
inline static bool qWaitForWindowActive(QWindow *window, int timeout = 1000)
{
QElapsedTimer timer;
@@ -112,6 +115,7 @@ namespace QTest
}
return window->isExposed();
}
+#endif
#ifdef QT_WIDGETS_LIB
inline static bool qWaitForWindowActive(QWidget *widget, int timeout = 1000)
diff --git a/src/tools/bootstrap/bootstrap.pri b/src/tools/bootstrap/bootstrap.pri
index 7d3b9969fe..2b64b291b9 100644
--- a/src/tools/bootstrap/bootstrap.pri
+++ b/src/tools/bootstrap/bootstrap.pri
@@ -7,7 +7,6 @@ CONFIG += exceptions_off
DEFINES += \
QT_BOOTSTRAPPED \
QT_LITE_UNICODE \
- QT_TEXTCODEC \
QT_NO_CAST_FROM_ASCII \
QT_NO_CAST_TO_ASCII \
QT_NO_CODECS \
diff --git a/src/tools/bootstrap/bootstrap.pro b/src/tools/bootstrap/bootstrap.pro
index 19c0005bcc..07c4a10573 100644
--- a/src/tools/bootstrap/bootstrap.pro
+++ b/src/tools/bootstrap/bootstrap.pro
@@ -114,6 +114,7 @@ macx: {
../../corelib/kernel/qcore_mac.cpp
LIBS += -framework CoreServices
}
+*-g++*: QMAKE_CXXFLAGS += -ffunction-sections
if(contains(QT_CONFIG, zlib)|cross_compile):include(../../3rdparty/zlib.pri)
else:include(../../3rdparty/zlib_dependency.pri)
diff --git a/src/tools/rcc/rcc.cpp b/src/tools/rcc/rcc.cpp
index 10d7c093fc..969b644d84 100644
--- a/src/tools/rcc/rcc.cpp
+++ b/src/tools/rcc/rcc.cpp
@@ -535,7 +535,7 @@ bool RCCResourceLibrary::interpretResourceFile(QIODevice *inputDevice,
child,
language,
country,
- RCCFileInfo::NoFlags,
+ child.isDir() ? RCCFileInfo::Directory : RCCFileInfo::NoFlags,
compressLevel,
compressThreshold)
);
diff --git a/src/widgets/dialogs/qdialog.cpp b/src/widgets/dialogs/qdialog.cpp
index 261039009c..7b47f4e135 100644
--- a/src/widgets/dialogs/qdialog.cpp
+++ b/src/widgets/dialogs/qdialog.cpp
@@ -516,11 +516,6 @@ int QDialog::exec()
setAttribute(Qt::WA_ShowModal, true);
setResult(0);
- bool showSystemDialogFullScreen = false;
- if (showSystemDialogFullScreen) {
- setWindowFlags(windowFlags() | Qt::WindowSoftkeysVisibleHint);
- setWindowState(Qt::WindowFullScreen);
- }
show();
QPointer<QDialog> guard = this;
diff --git a/src/widgets/dialogs/qerrormessage.cpp b/src/widgets/dialogs/qerrormessage.cpp
index a7c257b300..fa240ccaf3 100644
--- a/src/widgets/dialogs/qerrormessage.cpp
+++ b/src/widgets/dialogs/qerrormessage.cpp
@@ -66,10 +66,6 @@ extern bool qt_wince_is_mobile(); //defined in qguifunctions_wince.cpp
extern bool qt_wince_is_high_dpi(); //defined in qguifunctions_wince.cpp
#endif
-#if defined(QT_SOFTKEYS_ENABLED)
-#include <qaction.h>
-#endif
-
QT_BEGIN_NAMESPACE
class QErrorMessagePrivate : public QDialogPrivate
@@ -80,9 +76,6 @@ public:
QCheckBox * again;
QTextEdit * errors;
QLabel * icon;
-#ifdef QT_SOFTKEYS_ENABLED
- QAction *okAction;
-#endif
QQueue<QPair<QString, QString> > pending;
QSet<QString> doNotShow;
QSet<QString> doNotShowType;
@@ -245,12 +238,6 @@ QErrorMessage::QErrorMessage(QWidget * parent)
d->again->setChecked(true);
grid->addWidget(d->again, 1, 1, Qt::AlignTop);
d->ok = new QPushButton(this);
-#ifdef QT_SOFTKEYS_ENABLED
- d->okAction = new QAction(d->ok);
- d->okAction->setSoftKeyRole(QAction::PositiveSoftKey);
- connect(d->okAction, SIGNAL(triggered()), this, SLOT(accept()));
- addAction(d->okAction);
-#endif
#if defined(Q_OS_WINCE)
@@ -402,9 +389,6 @@ void QErrorMessagePrivate::retranslateStrings()
{
again->setText(QErrorMessage::tr("&Show this message again"));
ok->setText(QErrorMessage::tr("&OK"));
-#ifdef QT_SOFTKEYS_ENABLED
- okAction->setText(ok->text());
-#endif
}
QT_END_NAMESPACE
diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp
index d9d318765d..9a2e32b631 100644
--- a/src/widgets/dialogs/qfiledialog.cpp
+++ b/src/widgets/dialogs/qfiledialog.cpp
@@ -552,7 +552,7 @@ void QFileDialogPrivate::helperPrepareShow(QPlatformDialogHelper *)
directory.absolutePath() :
QString());
options->setInitiallySelectedNameFilter(q->selectedNameFilter());
- options->setInitiallySelectedFiles(q->selectedFiles());
+ options->setInitiallySelectedFiles(userSelectedFiles());
}
void QFileDialogPrivate::helperDone(QDialog::DialogCode code, QPlatformDialogHelper *)
@@ -1009,6 +1009,24 @@ QStringList QFileDialogPrivate::typedFiles() const
return addDefaultSuffixToFiles(files);
}
+// Return selected files without defaulting to the root of the file system model
+// used for initializing QFileDialogOptions for native dialogs. The default is
+// not suitable for native dialogs since it mostly equals directory().
+QStringList QFileDialogPrivate::userSelectedFiles() const
+{
+ if (nativeDialogInUse)
+ return addDefaultSuffixToFiles(selectedFiles_sys());
+
+ QStringList files;
+ foreach (const QModelIndex &index, qFileDialogUi->listView->selectionModel()->selectedRows())
+ files.append(index.data(QFileSystemModel::FilePathRole).toString());
+
+ if (files.isEmpty() && !lineEdit()->text().isEmpty())
+ files = typedFiles();
+
+ return files;
+}
+
QStringList QFileDialogPrivate::addDefaultSuffixToFiles(const QStringList filesToFix) const
{
QStringList files;
@@ -1046,19 +1064,13 @@ QStringList QFileDialogPrivate::addDefaultSuffixToFiles(const QStringList filesT
QStringList QFileDialog::selectedFiles() const
{
Q_D(const QFileDialog);
- if (d->nativeDialogInUse)
- return d->addDefaultSuffixToFiles(d->selectedFiles_sys());
- QModelIndexList indexes = d->qFileDialogUi->listView->selectionModel()->selectedRows();
- QStringList files;
- for (int i = 0; i < indexes.count(); ++i)
- files.append(indexes.at(i).data(QFileSystemModel::FilePathRole).toString());
-
- if (files.isEmpty() && !d->lineEdit()->text().isEmpty())
- files = d->typedFiles();
- const FileMode fm = fileMode();
- if (files.isEmpty() && !(fm == ExistingFile || fm == ExistingFiles))
- files.append(d->rootIndex().data(QFileSystemModel::FilePathRole).toString());
+ QStringList files = d->userSelectedFiles();
+ if (files.isEmpty()) {
+ const FileMode fm = fileMode();
+ if (fm != ExistingFile && fm != ExistingFiles)
+ files.append(d->rootIndex().data(QFileSystemModel::FilePathRole).toString());
+ }
return files;
}
@@ -1201,9 +1213,11 @@ void QFileDialog::selectNameFilter(const QString &filter)
d->selectNameFilter_sys(filter);
return;
}
- int i;
+ int i = -1;
if (testOption(HideNameFilterDetails)) {
- i = d->qFileDialogUi->fileTypeCombo->findText(qt_strip_filters(qt_make_filter_list(filter)).first());
+ const QStringList filters = qt_strip_filters(qt_make_filter_list(filter));
+ if (!filters.isEmpty())
+ i = d->qFileDialogUi->fileTypeCombo->findText(filters.first());
} else {
i = d->qFileDialogUi->fileTypeCombo->findText(filter);
}
@@ -1770,7 +1784,7 @@ QString QFileDialog::getOpenFileName(QWidget *parent,
// create a qt dialog
QFileDialog dialog(args);
- if (selectedFilter)
+ if (selectedFilter && !selectedFilter->isEmpty())
dialog.selectNameFilter(*selectedFilter);
if (dialog.exec() == QDialog::Accepted) {
if (selectedFilter)
@@ -1855,7 +1869,7 @@ QStringList QFileDialog::getOpenFileNames(QWidget *parent,
// create a qt dialog
QFileDialog dialog(args);
- if (selectedFilter)
+ if (selectedFilter && !selectedFilter->isEmpty())
dialog.selectNameFilter(*selectedFilter);
if (dialog.exec() == QDialog::Accepted) {
if (selectedFilter)
@@ -1942,7 +1956,7 @@ QString QFileDialog::getSaveFileName(QWidget *parent,
// create a qt dialog
QFileDialog dialog(args);
dialog.setAcceptMode(AcceptSave);
- if (selectedFilter)
+ if (selectedFilter && !selectedFilter->isEmpty())
dialog.selectNameFilter(*selectedFilter);
if (dialog.exec() == QDialog::Accepted) {
if (selectedFilter)
diff --git a/src/widgets/dialogs/qfiledialog_p.h b/src/widgets/dialogs/qfiledialog_p.h
index b13f36a4d6..592c4a0ac6 100644
--- a/src/widgets/dialogs/qfiledialog_p.h
+++ b/src/widgets/dialogs/qfiledialog_p.h
@@ -128,6 +128,7 @@ public:
static QString workingDirectory(const QString &path);
static QString initialSelection(const QString &path);
QStringList typedFiles() const;
+ QStringList userSelectedFiles() const;
QStringList addDefaultSuffixToFiles(const QStringList filesToFix) const;
bool removeDirectory(const QString &path);
void setLabelTextControl(QFileDialog::DialogLabel label, const QString &text);
diff --git a/src/widgets/dialogs/qprogressdialog.cpp b/src/widgets/dialogs/qprogressdialog.cpp
index fe7aeae558..fbbc4191bc 100644
--- a/src/widgets/dialogs/qprogressdialog.cpp
+++ b/src/widgets/dialogs/qprogressdialog.cpp
@@ -57,10 +57,6 @@
#include <private/qdialog_p.h>
#include <limits.h>
-#if defined(QT_SOFTKEYS_ENABLED)
-#include <qaction.h>
-#endif
-
QT_BEGIN_NAMESPACE
// If the operation is expected to take this long (as predicted by
@@ -81,9 +77,6 @@ public:
#ifndef QT_NO_SHORTCUT
escapeShortcut(0),
#endif
-#ifdef QT_SOFTKEYS_ENABLED
- cancelAction(0),
-#endif
useDefaultCancelText(false)
{
}
@@ -110,9 +103,6 @@ public:
#ifndef QT_NO_SHORTCUT
QShortcut *escapeShortcut;
#endif
-#ifdef QT_SOFTKEYS_ENABLED
- QAction *cancelAction;
-#endif
bool useDefaultCancelText;
QPointer<QObject> receiverToDisconnectOnClose;
QByteArray memberToDisconnectOnClose;
@@ -443,16 +433,7 @@ void QProgressDialog::setCancelButton(QPushButton *cancelButton)
int h = qMax(isVisible() ? height() : 0, sizeHint().height());
resize(w, h);
if (cancelButton)
-#if !defined(QT_SOFTKEYS_ENABLED)
cancelButton->show();
-#else
- {
- d->cancelAction = new QAction(cancelButton->text(), cancelButton);
- d->cancelAction->setSoftKeyRole(QAction::NegativeSoftKey);
- connect(d->cancelAction, SIGNAL(triggered()), this, SIGNAL(canceled()));
- addAction(d->cancelAction);
- }
-#endif
}
/*!
@@ -471,9 +452,6 @@ void QProgressDialog::setCancelButtonText(const QString &cancelButtonText)
if (!cancelButtonText.isNull()) {
if (d->cancel) {
d->cancel->setText(cancelButtonText);
-#ifdef QT_SOFTKEYS_ENABLED
- d->cancelAction->setText(cancelButtonText);
-#endif
} else {
setCancelButton(new QPushButton(cancelButtonText, this));
}
diff --git a/src/widgets/dialogs/qwizard.cpp b/src/widgets/dialogs/qwizard.cpp
index 58aa474368..7f1cb09225 100644
--- a/src/widgets/dialogs/qwizard.cpp
+++ b/src/widgets/dialogs/qwizard.cpp
@@ -75,10 +75,6 @@ extern bool qt_wince_is_mobile(); //defined in qguifunctions_wce.cpp
#include <string.h> // for memset()
-#ifdef QT_SOFTKEYS_ENABLED
-#include "qaction.h"
-#endif
-
QT_BEGIN_NAMESPACE
// These fudge terms were needed a few places to obtain pixel-perfect results
@@ -565,12 +561,9 @@ public:
, maximumWidth(QWIDGETSIZE_MAX)
, maximumHeight(QWIDGETSIZE_MAX)
{
- for (int i = 0; i < QWizard::NButtons; ++i) {
+ for (int i = 0; i < QWizard::NButtons; ++i)
btns[i] = 0;
-#ifdef QT_SOFTKEYS_ENABLED
- softKeys[i] = 0;
-#endif
- }
+
#if !defined(QT_NO_STYLE_WINDOWSVISTA)
if (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA
&& (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based))
@@ -657,9 +650,6 @@ public:
QLabel *titleLabel;
QLabel *subTitleLabel;
QWizardRuler *bottomRuler;
-#ifdef QT_SOFTKEYS_ENABLED
- mutable QAction *softKeys[QWizard::NButtons];
-#endif
QVBoxLayout *pageVBoxLayout;
QHBoxLayout *buttonLayout;
@@ -1387,28 +1377,6 @@ bool QWizardPrivate::ensureButton(QWizard::WizardButton which) const
if (which < QWizard::NStandardButtons)
pushButton->setText(buttonDefaultText(wizStyle, which, this));
-#ifdef QT_SOFTKEYS_ENABLED
- QAction *softKey = new QAction(pushButton->text(), pushButton);
- QAction::SoftKeyRole softKeyRole;
- switch(which) {
- case QWizard::NextButton:
- case QWizard::FinishButton:
- case QWizard::CancelButton:
- softKeyRole = QAction::NegativeSoftKey;
- break;
- case QWizard::BackButton:
- case QWizard::CommitButton:
- case QWizard::HelpButton:
- case QWizard::CustomButton1:
- case QWizard::CustomButton2:
- case QWizard::CustomButton3:
- default:
- softKeyRole = QAction::PositiveSoftKey;
- break;
- }
- softKey->setSoftKeyRole(softKeyRole);
- softKeys[which] = softKey;
-#endif
connectButton(which);
}
return true;
@@ -1422,10 +1390,6 @@ void QWizardPrivate::connectButton(QWizard::WizardButton which) const
} else {
QObject::connect(btns[which], SIGNAL(clicked()), q, SLOT(_q_emitCustomButtonClicked()));
}
-
-#ifdef QT_SOFTKEYS_ENABLED
- QObject::connect(softKeys[which], SIGNAL(triggered()), btns[which], SIGNAL(clicked()));
-#endif
}
void QWizardPrivate::updateButtonTexts()
@@ -1439,9 +1403,6 @@ void QWizardPrivate::updateButtonTexts()
btns[i]->setText(buttonCustomTexts.value(i));
else if (i < QWizard::NStandardButtons)
btns[i]->setText(buttonDefaultText(wizStyle, i, this));
-#ifdef QT_SOFTKEYS_ENABLED
- softKeys[i]->setText(btns[i]->text());
-#endif
}
}
}
@@ -1686,19 +1647,6 @@ void QWizardPrivate::_q_updateButtonStates()
}
#endif
-#ifdef QT_SOFTKEYS_ENABLED
- QAbstractButton *wizardButton;
- for (int i = 0; i < QWizard::NButtons; ++i) {
- wizardButton = btns[i];
- if (wizardButton && !wizardButton->testAttribute(Qt::WA_WState_Hidden)) {
- wizardButton->hide();
- q->addAction(softKeys[i]);
- } else {
- q->removeAction(softKeys[i]);
- }
- }
-#endif
-
enableUpdates();
}
diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp
index 8cb6d70d15..0308fb44a9 100644
--- a/src/widgets/itemviews/qabstractitemview.cpp
+++ b/src/widgets/itemviews/qabstractitemview.cpp
@@ -62,7 +62,6 @@
#include <qaccessible.h>
#include <qaccessible2.h>
#endif
-#include <private/qsoftkeymanager_p.h>
#ifndef QT_NO_GESTURE
# include <qscroller.h>
#endif
@@ -95,9 +94,6 @@ QAbstractItemViewPrivate::QAbstractItemViewPrivate()
dropIndicatorPosition(QAbstractItemView::OnItem),
defaultDropAction(Qt::IgnoreAction),
#endif
-#ifdef QT_SOFTKEYS_ENABLED
- doneSoftKey(0),
-#endif
autoScroll(true),
autoScrollMargin(16),
autoScrollCount(0),
@@ -139,10 +135,6 @@ void QAbstractItemViewPrivate::init()
viewport->setBackgroundRole(QPalette::Base);
q->setAttribute(Qt::WA_InputMethodEnabled);
-
-#ifdef QT_SOFTKEYS_ENABLED
- doneSoftKey = QSoftKeyManager::createKeyedAction(QSoftKeyManager::DoneSoftKey, Qt::Key_Back, q);
-#endif
}
void QAbstractItemViewPrivate::setHoverIndex(const QPersistentModelIndex &index)
@@ -1611,11 +1603,6 @@ bool QAbstractItemView::event(QEvent *event)
case QEvent::FontChange:
d->doDelayedItemsLayout(); // the size of the items will change
break;
-#ifdef QT_SOFTKEYS_ENABLED
- case QEvent::LanguageChange:
- d->doneSoftKey->setText(QSoftKeyManager::standardSoftKeyText(QSoftKeyManager::DoneSoftKey));
- break;
-#endif
default:
break;
}
@@ -2197,11 +2184,6 @@ void QAbstractItemView::focusOutEvent(QFocusEvent *event)
Q_D(QAbstractItemView);
QAbstractScrollArea::focusOutEvent(event);
d->viewport->update();
-
-#ifdef QT_SOFTKEYS_ENABLED
- if(!hasEditFocus())
- removeAction(d->doneSoftKey);
-#endif
}
/*!
@@ -2226,23 +2208,12 @@ void QAbstractItemView::keyPressEvent(QKeyEvent *event)
if (QApplication::keypadNavigationEnabled()) {
if (!hasEditFocus()) {
setEditFocus(true);
-#ifdef QT_SOFTKEYS_ENABLED
- // If we can't keypad navigate to any direction, there is no sense to add
- // "Done" softkey, since it basically does nothing when there is
- // only one widget in screen
- if(QWidgetPrivate::canKeypadNavigate(Qt::Horizontal)
- || QWidgetPrivate::canKeypadNavigate(Qt::Vertical))
- addAction(d->doneSoftKey);
-#endif
return;
}
}
break;
case Qt::Key_Back:
if (QApplication::keypadNavigationEnabled() && hasEditFocus()) {
-#ifdef QT_SOFTKEYS_ENABLED
- removeAction(d->doneSoftKey);
-#endif
setEditFocus(false);
} else {
event->ignore();
diff --git a/src/widgets/itemviews/qabstractitemview_p.h b/src/widgets/itemviews/qabstractitemview_p.h
index 5fa658d4b0..99d064ddba 100644
--- a/src/widgets/itemviews/qabstractitemview_p.h
+++ b/src/widgets/itemviews/qabstractitemview_p.h
@@ -402,10 +402,6 @@ public:
Qt::DropAction defaultDropAction;
#endif
-#ifdef QT_SOFTKEYS_ENABLED
- QAction *doneSoftKey;
-#endif
-
QString keyboardInput;
QElapsedTimer keyboardInputTime;
diff --git a/src/widgets/itemviews/qcolumnview.cpp b/src/widgets/itemviews/qcolumnview.cpp
index ec5f2d5655..a320e6134a 100644
--- a/src/widgets/itemviews/qcolumnview.cpp
+++ b/src/widgets/itemviews/qcolumnview.cpp
@@ -365,14 +365,12 @@ QModelIndex QColumnView::moveCursor(CursorAction cursorAction, Qt::KeyboardModif
return (current.parent());
else
return current;
- break;
case MoveRight:
if (model()->hasChildren(current))
return model()->index(0, 0, current);
else
return current.sibling(current.row() + 1, current.column());
- break;
default:
break;
diff --git a/src/widgets/itemviews/qfileiconprovider.cpp b/src/widgets/itemviews/qfileiconprovider.cpp
index 70750c6006..43cf8afb79 100644
--- a/src/widgets/itemviews/qfileiconprovider.cpp
+++ b/src/widgets/itemviews/qfileiconprovider.cpp
@@ -53,10 +53,6 @@
#include <qpa/qplatformtheme.h>
#if defined(Q_OS_WIN)
-#if defined(_WIN32_IE)
-# undef _WIN32_IE
-#endif
-# define _WIN32_IE 0x0500
# include <qt_windows.h>
# include <commctrl.h>
# include <objbase.h>
@@ -72,7 +68,7 @@ QT_BEGIN_NAMESPACE
\class QFileIconProvider
\inmodule QtWidgets
-
+
\brief The QFileIconProvider class provides file icons for the QDirModel and the QFileSystemModel classes.
*/
diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp
index 08f10defb8..e7e3a58670 100644
--- a/src/widgets/itemviews/qheaderview.cpp
+++ b/src/widgets/itemviews/qheaderview.cpp
@@ -1349,6 +1349,8 @@ void QHeaderView::setSortIndicator(int logicalIndex, Qt::SortOrder order)
// This is so that people can set the position of the sort indicator before the fill the model
int old = d->sortIndicatorSection;
+ if (old == logicalIndex && order == d->sortIndicatorOrder)
+ return;
d->sortIndicatorSection = logicalIndex;
d->sortIndicatorOrder = order;
diff --git a/src/widgets/itemviews/qitemeditorfactory.cpp b/src/widgets/itemviews/qitemeditorfactory.cpp
index 5f24c3ea1b..09e59579b8 100644
--- a/src/widgets/itemviews/qitemeditorfactory.cpp
+++ b/src/widgets/itemviews/qitemeditorfactory.cpp
@@ -560,7 +560,7 @@ void QExpandingLineEdit::updateMinimumWidth()
QStyleOptionFrameV2 opt;
initStyleOption(&opt);
-
+
int minWidth = style()->sizeFromContents(QStyle::CT_LineEdit, &opt, QSize(width, 0).
expandedTo(QApplication::globalStrut()), this).width();
setMinimumWidth(minWidth);
diff --git a/src/widgets/itemviews/qstyleditemdelegate.cpp b/src/widgets/itemviews/qstyleditemdelegate.cpp
index fa5a62805f..6a330fc7cb 100644
--- a/src/widgets/itemviews/qstyleditemdelegate.cpp
+++ b/src/widgets/itemviews/qstyleditemdelegate.cpp
@@ -538,9 +538,9 @@ void QStyledItemDelegate::updateEditorGeometry(QWidget *editor,
QStyleOptionViewItem opt = option;
initStyleOption(&opt, index);
- // let the editor take up all available space
+ // let the editor take up all available space
//if the editor is not a QLineEdit
- //or it is in a QTableView
+ //or it is in a QTableView
#if !defined(QT_NO_TABLEVIEW) && !defined(QT_NO_LINEEDIT)
if (qobject_cast<QExpandingLineEdit*>(editor) && !qobject_cast<const QTableView*>(widget))
opt.showDecorationSelected = editor->style()->styleHint(QStyle::SH_ItemView_ShowDecorationSelected, 0, editor);
diff --git a/src/widgets/itemviews/qtableview.cpp b/src/widgets/itemviews/qtableview.cpp
index 80abb050ee..d84dc608b9 100644
--- a/src/widgets/itemviews/qtableview.cpp
+++ b/src/widgets/itemviews/qtableview.cpp
@@ -2198,7 +2198,7 @@ int QTableView::sizeHintForRow(int row) const
option.rect.setX(columnViewportPosition(index.column()));
option.rect.setWidth(columnWidth(index.column()));
}
-
+
QWidget *editor = d->editorForIndex(index).widget.data();
if (editor && d->persistent.contains(editor)) {
hint = qMax(hint, editor->sizeHint().height());
@@ -2206,7 +2206,7 @@ int QTableView::sizeHintForRow(int row) const
int max = editor->maximumSize().height();
hint = qBound(min, hint, max);
}
-
+
hint = qMax(hint, itemDelegate(index)->sizeHint(option, index).height());
}
@@ -2251,7 +2251,7 @@ int QTableView::sizeHintForColumn(int column) const
if (d->verticalHeader->isSectionHidden(logicalRow))
continue;
index = d->model->index(logicalRow, column, d->root);
-
+
QWidget *editor = d->editorForIndex(index).widget.data();
if (editor && d->persistent.contains(editor)) {
hint = qMax(hint, editor->sizeHint().width());
@@ -2259,7 +2259,7 @@ int QTableView::sizeHintForColumn(int column) const
int max = editor->maximumSize().width();
hint = qBound(min, hint, max);
}
-
+
hint = qMax(hint, itemDelegate(index)->sizeHint(option, index).width());
}
diff --git a/src/widgets/itemviews/qtreeview.cpp b/src/widgets/itemviews/qtreeview.cpp
index ece5b21ae2..bcaf8dc2c3 100644
--- a/src/widgets/itemviews/qtreeview.cpp
+++ b/src/widgets/itemviews/qtreeview.cpp
@@ -1716,7 +1716,7 @@ void QTreeView::drawRow(QPainter *painter, const QStyleOptionViewItem &option,
// we have to split the focus rect into two rects
if (allColumnsShowFocus && !option.showDecorationSelected
&& header->sectionsMoved() && (header->visualIndex(0) != 0)) {
- QRect sectionRect(0, y, header->sectionPosition(0), height);
+ QRect sectionRect(0, y, header->sectionPosition(0), height);
o.rect = style()->visualRect(layoutDirection(), d->viewport->rect(), sectionRect);
style()->drawPrimitive(QStyle::PE_FrameFocusRect, &o, painter);
}
diff --git a/src/widgets/itemviews/qtreewidget.cpp b/src/widgets/itemviews/qtreewidget.cpp
index 5305f64cc9..f689e87f8d 100644
--- a/src/widgets/itemviews/qtreewidget.cpp
+++ b/src/widgets/itemviews/qtreewidget.cpp
@@ -1477,7 +1477,7 @@ QTreeWidgetItem::QTreeWidgetItem(QTreeWidgetItem *parent, QTreeWidgetItem *after
/*!
Destroys this tree widget item.
-
+
The item will be removed from \l{QTreeWidget}s to which it has
been added. This makes it safe to delete an item at any time.
diff --git a/src/widgets/itemviews/qtreewidgetitemiterator.cpp b/src/widgets/itemviews/qtreewidgetitemiterator.cpp
index 0108b80dcf..c1e2bd8b77 100644
--- a/src/widgets/itemviews/qtreewidgetitemiterator.cpp
+++ b/src/widgets/itemviews/qtreewidgetitemiterator.cpp
@@ -52,7 +52,7 @@ QT_BEGIN_NAMESPACE
\class QTreeWidgetItemIterator
\ingroup model-view
\inmodule QtWidgets
-
+
\brief The QTreeWidgetItemIterator class provides a way to iterate over the
items in a QTreeWidget instance.
diff --git a/src/widgets/kernel/kernel.pri b/src/widgets/kernel/kernel.pri
index b2f05e3cab..4d3d7c4e0a 100644
--- a/src/widgets/kernel/kernel.pri
+++ b/src/widgets/kernel/kernel.pri
@@ -33,8 +33,6 @@ HEADERS += \
kernel/qstandardgestures_p.h \
kernel/qgesturerecognizer.h \
kernel/qgesturemanager_p.h \
- kernel/qsoftkeymanager_p.h \
- kernel/qsoftkeymanager_common_p.h \
kernel/qdesktopwidget_qpa_p.h \
kernel/qwidgetwindow_qpa_p.h
@@ -59,7 +57,6 @@ SOURCES += \
kernel/qstandardgestures.cpp \
kernel/qgesturerecognizer.cpp \
kernel/qgesturemanager.cpp \
- kernel/qsoftkeymanager.cpp \
kernel/qdesktopwidget.cpp \
kernel/qwidgetsvariant.cpp \
kernel/qapplication_qpa.cpp \
diff --git a/src/widgets/kernel/qaction.cpp b/src/widgets/kernel/qaction.cpp
index e835f927d0..64b856ea96 100644
--- a/src/widgets/kernel/qaction.cpp
+++ b/src/widgets/kernel/qaction.cpp
@@ -81,9 +81,8 @@ static QString qt_strippedText(QString s)
QActionPrivate::QActionPrivate() : group(0), enabled(1), forceDisabled(0),
visible(1), forceInvisible(0), checkable(0), checked(0), separator(0), fontSet(false),
- forceEnabledInSoftkeys(false), menuActionSoftkeys(false),
iconVisibleInMenu(-1),
- menuRole(QAction::TextHeuristicRole), softKeyRole(QAction::NoSoftKey),
+ menuRole(QAction::TextHeuristicRole),
priority(QAction::NormalPriority)
{
#ifndef QT_NO_SHORTCUT
@@ -280,27 +279,7 @@ void QActionPrivate::setShortcutEnabled(bool enable, QShortcutMap &map)
File menu in your menubar and the File menu has a submenu, setting the
MenuRole for the actions in that submenu have no effect. They will never be moved.
*/
-#ifndef qdoc
-/*! \since 4.6
- \enum QAction::SoftKeyRole
-
- This enum describes how an action should be placed in the softkey bar. Currently this enum only
- has an effect on the Symbian platform.
-
- \value NoSoftKey This action should not be used as a softkey
- \value PositiveSoftKey This action is used to describe a softkey with a positive or non-destructive
- role such as Ok, Select, or Options.
- \value NegativeSoftKey This action is used to describe a soft ey with a negative or destructive role
- role such as Cancel, Discard, or Close.
- \value SelectSoftKey This action is used to describe a role that selects a particular item or widget
- in the application.
-
- Actions with a softkey role defined are only visible in the softkey bar when the widget containing
- the action has focus. If no widget currently has focus, the softkey framework will traverse up the
- widget parent hierarchy looking for a widget containing softkey actions.
- */
-#endif
/*!
Constructs an action with \a parent. If \a parent is an action
group the action will be automatically inserted into the group.
@@ -1287,34 +1266,6 @@ QAction::MenuRole QAction::menuRole() const
return d->menuRole;
}
-#ifndef qdoc
-/*!
- \property QAction::softKeyRole
- \brief the action's softkey role
- \since 4.6
-
- This indicates what type of role this action describes in the softkey framework
- on platforms where such a framework is supported. Currently this is only
- supported on the Symbian platform.
-
- The softkey role can be changed any time.
-*/
-void QAction::setSoftKeyRole(SoftKeyRole softKeyRole)
-{
- Q_D(QAction);
- if (d->softKeyRole == softKeyRole)
- return;
-
- d->softKeyRole = softKeyRole;
- d->sendDataChanged();
-}
-
-QAction::SoftKeyRole QAction::softKeyRole() const
-{
- Q_D(const QAction);
- return d->softKeyRole;
-}
-#endif
/*!
\property QAction::iconVisibleInMenu
\brief Whether or not an action should show an icon in a menu
diff --git a/src/widgets/kernel/qaction.h b/src/widgets/kernel/qaction.h
index e149975de7..6a3c0bee68 100644
--- a/src/widgets/kernel/qaction.h
+++ b/src/widgets/kernel/qaction.h
@@ -66,9 +66,6 @@ class Q_WIDGETS_EXPORT QAction : public QObject
Q_DECLARE_PRIVATE(QAction)
Q_ENUMS(MenuRole)
-#ifndef qdoc
- Q_ENUMS(SoftKeyRole)
-#endif
Q_ENUMS(Priority)
Q_PROPERTY(bool checkable READ isCheckable WRITE setCheckable NOTIFY changed)
Q_PROPERTY(bool checked READ isChecked WRITE setChecked DESIGNABLE isCheckable NOTIFY toggled)
@@ -87,9 +84,6 @@ class Q_WIDGETS_EXPORT QAction : public QObject
#endif
Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY changed)
Q_PROPERTY(MenuRole menuRole READ menuRole WRITE setMenuRole NOTIFY changed)
-#ifndef qdoc
- Q_PROPERTY(SoftKeyRole softKeyRole READ softKeyRole WRITE setSoftKeyRole NOTIFY changed)
-#endif
Q_PROPERTY(bool iconVisibleInMenu READ isIconVisibleInMenu WRITE setIconVisibleInMenu NOTIFY changed)
Q_PROPERTY(Priority priority READ priority WRITE setPriority)
@@ -97,10 +91,6 @@ public:
// note this is copied into qplatformmenu.h, which must stay in sync
enum MenuRole { NoRole = 0, TextHeuristicRole, ApplicationSpecificRole, AboutQtRole,
AboutRole, PreferencesRole, QuitRole };
-#ifndef qdoc
- enum SoftKeyRole {
- NoSoftKey, PositiveSoftKey, NegativeSoftKey, SelectSoftKey };
-#endif
enum Priority { LowPriority = 0,
NormalPriority = 128,
HighPriority = 256};
@@ -178,10 +168,6 @@ public:
void setMenuRole(MenuRole menuRole);
MenuRole menuRole() const;
-#ifndef qdoc
- void setSoftKeyRole(SoftKeyRole softKeyRole);
- SoftKeyRole softKeyRole() const;
-#endif
void setIconVisibleInMenu(bool visible);
bool isIconVisibleInMenu() const;
diff --git a/src/widgets/kernel/qaction_p.h b/src/widgets/kernel/qaction_p.h
index 6e25427b31..32c55e6de2 100644
--- a/src/widgets/kernel/qaction_p.h
+++ b/src/widgets/kernel/qaction_p.h
@@ -106,13 +106,9 @@ public:
uint separator : 1;
uint fontSet : 1;
- //for soft keys management
- uint forceEnabledInSoftkeys : 1;
- uint menuActionSoftkeys : 1;
int iconVisibleInMenu : 3; // Only has values -1, 0, and 1
QAction::MenuRole menuRole;
- QAction::SoftKeyRole softKeyRole;
QAction::Priority priority;
QList<QWidget *> widgets;
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index 3e0f803f5d..efa52456e8 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -902,7 +902,6 @@ bool QApplication::compressEvent(QEvent *event, QObject *receiver, QPostEventLis
|| event->type() == QEvent::Resize
|| event->type() == QEvent::Move
|| event->type() == QEvent::LanguageChange
- || event->type() == QEvent::UpdateSoftKeys
|| event->type() == QEvent::InputMethod)) {
for (QPostEventList::const_iterator it = postedEvents->constBegin(); it != postedEvents->constEnd(); ++it) {
const QPostEvent &cur = *it;
@@ -917,8 +916,6 @@ bool QApplication::compressEvent(QEvent *event, QObject *receiver, QPostEventLis
((QMoveEvent *)(cur.event))->p = ((QMoveEvent *)event)->p;
} else if (cur.event->type() == QEvent::LanguageChange) {
;
- } else if (cur.event->type() == QEvent::UpdateSoftKeys) {
- ;
} else if ( cur.event->type() == QEvent::InputMethod ) {
*(QInputMethodEvent *)(cur.event) = *(QInputMethodEvent *)event;
} else {
diff --git a/src/widgets/kernel/qsoftkeymanager.cpp b/src/widgets/kernel/qsoftkeymanager.cpp
deleted file mode 100644
index 64ee6b0f2e..0000000000
--- a/src/widgets/kernel/qsoftkeymanager.cpp
+++ /dev/null
@@ -1,270 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qapplication.h"
-#include "qevent.h"
-#include "qbitmap.h"
-#include "private/qsoftkeymanager_p.h"
-#include "private/qaction_p.h"
-#include "private/qsoftkeymanager_common_p.h"
-
-#ifndef QT_NO_SOFTKEYMANAGER
-QT_BEGIN_NAMESPACE
-
-QSoftKeyManager *QSoftKeyManagerPrivate::self = 0;
-
-QString QSoftKeyManager::standardSoftKeyText(StandardSoftKey standardKey)
-{
- QString softKeyText;
- switch (standardKey) {
- case OkSoftKey:
- softKeyText = QSoftKeyManager::tr("Ok");
- break;
- case SelectSoftKey:
- softKeyText = QSoftKeyManager::tr("Select");
- break;
- case DoneSoftKey:
- softKeyText = QSoftKeyManager::tr("Done");
- break;
- case MenuSoftKey:
- softKeyText = QSoftKeyManager::tr("Options");
- break;
- case CancelSoftKey:
- softKeyText = QSoftKeyManager::tr("Cancel");
- break;
- default:
- break;
- };
-
- return softKeyText;
-}
-
-QSoftKeyManager *QSoftKeyManager::instance()
-{
- if (!QSoftKeyManagerPrivate::self)
- QSoftKeyManagerPrivate::self = new QSoftKeyManager;
-
- return QSoftKeyManagerPrivate::self;
-}
-
-QSoftKeyManager::QSoftKeyManager() :
- QObject(*(new QSoftKeyManagerPrivate), 0)
-{
-}
-
-QAction *QSoftKeyManager::createAction(StandardSoftKey standardKey, QWidget *actionWidget)
-{
- QAction *action = new QAction(standardSoftKeyText(standardKey), actionWidget);
- QAction::SoftKeyRole softKeyRole = QAction::NoSoftKey;
- switch (standardKey) {
- case MenuSoftKey: // FALL-THROUGH
- QActionPrivate::get(action)->menuActionSoftkeys = true;
- case OkSoftKey:
- case SelectSoftKey:
- case DoneSoftKey:
- softKeyRole = QAction::PositiveSoftKey;
- break;
- case CancelSoftKey:
- softKeyRole = QAction::NegativeSoftKey;
- break;
- }
- action->setSoftKeyRole(softKeyRole);
- action->setVisible(false);
- setForceEnabledInSoftkeys(action);
- return action;
-}
-
-/*! \internal
-
- Creates a QAction and registers the 'triggered' signal to send the given key event to
- \a actionWidget as a convenience.
-
-*/
-QAction *QSoftKeyManager::createKeyedAction(StandardSoftKey standardKey, Qt::Key key, QWidget *actionWidget)
-{
-#ifndef QT_NO_ACTION
- QScopedPointer<QAction> action(createAction(standardKey, actionWidget));
-
- connect(action.data(), SIGNAL(triggered()), QSoftKeyManager::instance(), SLOT(sendKeyEvent()));
- connect(action.data(), SIGNAL(destroyed(QObject*)), QSoftKeyManager::instance(), SLOT(cleanupHash(QObject*)));
- QSoftKeyManager::instance()->d_func()->keyedActions.insert(action.data(), key);
- return action.take();
-#endif //QT_NO_ACTION
-}
-
-void QSoftKeyManager::cleanupHash(QObject *obj)
-{
- Q_D(QSoftKeyManager);
- QAction *action = qobject_cast<QAction*>(obj);
- d->keyedActions.remove(action);
-}
-
-void QSoftKeyManager::sendKeyEvent()
-{
- Q_D(QSoftKeyManager);
- QAction *action = qobject_cast<QAction*>(sender());
-
- if (!action)
- return;
-
- Qt::Key keyToSend = d->keyedActions.value(action, Qt::Key_unknown);
-
- if (keyToSend != Qt::Key_unknown)
- QApplication::postEvent(action->parentWidget(),
- new QKeyEvent(QEvent::KeyPress, keyToSend, Qt::NoModifier));
-}
-
-void QSoftKeyManager::updateSoftKeys()
-{
- QSoftKeyManager::instance()->d_func()->pendingUpdate = true;
- QEvent *event = new QEvent(QEvent::UpdateSoftKeys);
- QApplication::postEvent(QSoftKeyManager::instance(), event);
-}
-
-bool QSoftKeyManager::appendSoftkeys(const QWidget &source, int level)
-{
- Q_D(QSoftKeyManager);
- bool ret = false;
- foreach(QAction *action, source.actions()) {
- if (action->softKeyRole() != QAction::NoSoftKey
- && (action->isVisible() || isForceEnabledInSofkeys(action))) {
- d->requestedSoftKeyActions.insert(level, action);
- ret = true;
- }
- }
- return ret;
-}
-
-
-static bool isChildOf(const QWidget *c, const QWidget *p)
-{
- while (c) {
- if (c == p)
- return true;
- c = c->parentWidget();
- }
- return false;
-}
-
-QWidget *QSoftKeyManager::softkeySource(QWidget *previousSource, bool& recursiveMerging)
-{
- Q_D(QSoftKeyManager);
- QWidget *source = NULL;
- if (!previousSource) {
- // Initial source is primarily focuswidget and secondarily activeWindow
- QWidget *focus = QApplication::focusWidget();
- QWidget *popup = QApplication::activePopupWidget();
- if (popup) {
- if (isChildOf(focus, popup))
- source = focus;
- else
- source = popup;
- }
- if (!source) {
- QWidget *modal = QApplication::activeModalWidget();
- if (modal) {
- if (isChildOf(focus, modal))
- source = focus;
- else
- source = modal;
- }
- }
- if (!source) {
- source = focus;
- if (!source)
- source = QApplication::activeWindow();
- }
- } else {
- // Softkey merging is based on four criterias
- // 1. Implicit merging is used whenever focus widget does not specify any softkeys
- bool implicitMerging = d->requestedSoftKeyActions.isEmpty();
- // 2. Explicit merging with parent is used whenever WA_MergeSoftkeys widget attribute is set
- bool explicitMerging = previousSource->testAttribute(Qt::WA_MergeSoftkeys);
- // 3. Explicit merging with all parents
- recursiveMerging |= previousSource->testAttribute(Qt::WA_MergeSoftkeysRecursively);
- // 4. Implicit and explicit merging always stops at window boundary
- bool merging = (implicitMerging || explicitMerging || recursiveMerging) && !previousSource->isWindow();
-
- source = merging ? previousSource->parentWidget() : NULL;
- }
- return source;
-}
-
-bool QSoftKeyManager::handleUpdateSoftKeys()
-{
- Q_D(QSoftKeyManager);
- int level = 0;
- d->requestedSoftKeyActions.clear();
- bool recursiveMerging = false;
- QWidget *source = softkeySource(NULL, recursiveMerging);
- d->initialSoftKeySource = source;
- while (source) {
- if (appendSoftkeys(*source, level))
- ++level;
- source = softkeySource(source, recursiveMerging);
- }
-
- d->updateSoftKeys_sys();
- d->pendingUpdate = false;
- return true;
-}
-
-void QSoftKeyManager::setForceEnabledInSoftkeys(QAction *action)
-{
- QActionPrivate::get(action)->forceEnabledInSoftkeys = true;
-}
-
-bool QSoftKeyManager::isForceEnabledInSofkeys(QAction *action)
-{
- return QActionPrivate::get(action)->forceEnabledInSoftkeys;
-}
-
-bool QSoftKeyManager::event(QEvent *e)
-{
-#ifndef QT_NO_ACTION
- if (e->type() == QEvent::UpdateSoftKeys)
- return handleUpdateSoftKeys();
-#endif //QT_NO_ACTION
- return false;
-}
-
-QT_END_NAMESPACE
-#endif //QT_NO_SOFTKEYMANAGER
diff --git a/src/widgets/kernel/qsoftkeymanager_common_p.h b/src/widgets/kernel/qsoftkeymanager_common_p.h
deleted file mode 100644
index 27e1b869ae..0000000000
--- a/src/widgets/kernel/qsoftkeymanager_common_p.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QSOFTKEYMANAGER_COMMON_P_H
-#define QSOFTKEYMANAGER_COMMON_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <private/qobject_p.h>
-
-QT_BEGIN_HEADER
-
-#ifndef QT_NO_SOFTKEYMANAGER
-
-QT_BEGIN_NAMESPACE
-
-class QSoftKeyManagerPrivate : public QObjectPrivate
-{
- Q_DECLARE_PUBLIC(QSoftKeyManager)
-
-public:
- virtual void updateSoftKeys_sys() {}
-
-protected:
- static QSoftKeyManager *self;
- QHash<QAction*, Qt::Key> keyedActions;
- QMultiHash<int, QAction*> requestedSoftKeyActions;
- QWidget *initialSoftKeySource;
- bool pendingUpdate;
-};
-
-QT_END_NAMESPACE
-
-#endif //QT_NO_SOFTKEYMANAGER
-
-QT_END_HEADER
-
-#endif // QSOFTKEYMANAGER_COMMON_P_H
diff --git a/src/widgets/kernel/qsoftkeymanager_p.h b/src/widgets/kernel/qsoftkeymanager_p.h
deleted file mode 100644
index a80088d33c..0000000000
--- a/src/widgets/kernel/qsoftkeymanager_p.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QSOFTKEYMANAGER_P_H
-#define QSOFTKEYMANAGER_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtCore/qobject.h>
-#include "QtWidgets/qaction.h"
-
-QT_BEGIN_HEADER
-
-#ifndef QT_NO_SOFTKEYMANAGER
-QT_BEGIN_NAMESPACE
-
-class QSoftKeyManagerPrivate;
-
-class Q_AUTOTEST_EXPORT QSoftKeyManager : public QObject
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(QSoftKeyManager)
-
-public:
-
- enum StandardSoftKey {
- OkSoftKey,
- SelectSoftKey,
- DoneSoftKey,
- MenuSoftKey,
- CancelSoftKey
- };
-
- static void updateSoftKeys();
-
- static QAction *createAction(StandardSoftKey standardKey, QWidget *actionWidget);
- static QAction *createKeyedAction(StandardSoftKey standardKey, Qt::Key key, QWidget *actionWidget);
- static QString standardSoftKeyText(StandardSoftKey standardKey);
- static void setForceEnabledInSoftkeys(QAction *action);
- static bool isForceEnabledInSofkeys(QAction *action);
-
-protected:
- bool event(QEvent *e);
-
-private:
- QSoftKeyManager();
- static QSoftKeyManager *instance();
- bool appendSoftkeys(const QWidget &source, int level);
- QWidget *softkeySource(QWidget *previousSource, bool& recursiveMerging);
- bool handleUpdateSoftKeys();
-
-private Q_SLOTS:
- void cleanupHash(QObject* obj);
- void sendKeyEvent();
-
-private:
- Q_DISABLE_COPY(QSoftKeyManager)
-};
-
-QT_END_NAMESPACE
-#endif //QT_NO_SOFTKEYMANAGER
-
-QT_END_HEADER
-
-#endif //QSOFTKEYMANAGER_P_H
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index 07dab9e784..2feb797985 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -77,7 +77,6 @@
#include "private/qstylesheetstyle_p.h"
#include "private/qstyle_p.h"
#include "qfileinfo.h"
-#include "private/qsoftkeymanager_p.h"
#include <QtGui/qinputmethod.h>
#include <private/qgraphicseffect_p.h>
@@ -906,30 +905,6 @@ void QWidget::setAutoFillBackground(bool enabled)
\sa QEvent, QPainter, QGridLayout, QBoxLayout
- \section1 Softkeys
-
- Since Qt 4.6, Softkeys are usually physical keys on a device that have a corresponding label or
- other visual representation on the screen that is generally located next to its
- physical counterpart. They are most often found on mobile phone platforms. In
- modern touch based user interfaces it is also possible to have softkeys that do
- not correspond to any physical keys. Softkeys differ from other onscreen labels
- in that they are contextual.
-
- In Qt, contextual softkeys are added to a widget by calling addAction() and
- passing a \c QAction with a softkey role set on it. When the widget
- containing the softkey actions has focus, its softkeys should appear in
- the user interface. Softkeys are discovered by traversing the widget
- hierarchy so it is possible to define a single set of softkeys that are
- present at all times by calling addAction() for a given top level widget.
-
- On some platforms, this concept overlaps with \c QMenuBar such that if no
- other softkeys are found and the top level widget is a QMainWindow containing
- a QMenuBar, the menubar actions may appear on one of the softkeys.
-
- Note: Currently softkeys are only supported on the Symbian Platform.
-
- \sa addAction(), QAction, QMenuBar
-
*/
QWidgetMapper *QWidgetPrivate::mapper = 0; // widget with wid
@@ -7956,9 +7931,6 @@ bool QWidget::event(QEvent *event)
}
break;
case QEvent::FocusIn:
-#ifdef QT_SOFTKEYS_ENABLED
- QSoftKeyManager::updateSoftKeys();
-#endif
focusInEvent((QFocusEvent*)event);
d->updateWidgetTransform();
break;
@@ -8109,12 +8081,6 @@ bool QWidget::event(QEvent *event)
if (w && w->isVisible() && !w->isWindow())
QApplication::sendEvent(w, event);
}
-
-#ifdef QT_SOFTKEYS_ENABLED
- if (isWindow())
- QSoftKeyManager::updateSoftKeys();
-#endif
-
break; }
case QEvent::LanguageChange:
@@ -8199,9 +8165,6 @@ bool QWidget::event(QEvent *event)
case QEvent::ActionAdded:
case QEvent::ActionRemoved:
case QEvent::ActionChanged:
-#ifdef QT_SOFTKEYS_ENABLED
- QSoftKeyManager::updateSoftKeys();
-#endif
actionEvent((QActionEvent*)event);
break;
#endif
diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp
index 900818d5c6..b49441beba 100644
--- a/src/widgets/kernel/qwidgetwindow.cpp
+++ b/src/widgets/kernel/qwidgetwindow.cpp
@@ -234,14 +234,20 @@ void QWidgetWindow::handleEnterLeaveEvent(QEvent *event)
while (enterParent->parent())
enterParent = enterParent->parent();
if (thisParent == enterParent) {
+ QGuiApplicationPrivate::currentMouseWindow = enterWindow;
enter = enterWindow->widget();
QWindowSystemInterfacePrivate::removeWindowSystemEvent(systemEvent);
}
}
}
- QWidget *leave = qt_last_mouse_receiver ? qt_last_mouse_receiver.data() : m_widget;
- QApplicationPrivate::dispatchEnterLeave(enter, leave);
- qt_last_mouse_receiver = enter;
+ // Enter-leave between sibling widgets is ignored when there is a mousegrabber - this makes
+ // both native and non-native widgets work similarly.
+ // When mousegrabbing, leaves are only generated if leaving the parent window.
+ if (!enter || !QWidget::mouseGrabber()) {
+ QWidget *leave = qt_last_mouse_receiver ? qt_last_mouse_receiver.data() : m_widget;
+ QApplicationPrivate::dispatchEnterLeave(enter, leave);
+ qt_last_mouse_receiver = enter;
+ }
} else {
QApplicationPrivate::dispatchEnterLeave(m_widget, 0);
qt_last_mouse_receiver = m_widget;
diff --git a/src/widgets/statemachine/qguistatemachine.cpp b/src/widgets/statemachine/qguistatemachine.cpp
index 98d4098634..8c66ec4051 100644
--- a/src/widgets/statemachine/qguistatemachine.cpp
+++ b/src/widgets/statemachine/qguistatemachine.cpp
@@ -69,7 +69,6 @@ static QEvent *cloneEvent(QEvent *e)
return new QEvent(*e);
case QEvent::Leave:
return new QEvent(*e);
- break;
case QEvent::Paint:
Q_ASSERT_X(false, "cloneEvent()", "not implemented");
break;
@@ -443,9 +442,6 @@ static QEvent *cloneEvent(QEvent *e)
break;
#endif
- case QEvent::UpdateSoftKeys:
- return new QEvent(*e);
-
case QEvent::User:
case QEvent::MaxUser:
Q_ASSERT_X(false, "cloneEvent()", "not implemented");
diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp
index 990245a113..2b6d843723 100644
--- a/src/widgets/styles/qcommonstyle.cpp
+++ b/src/widgets/styles/qcommonstyle.cpp
@@ -1081,13 +1081,9 @@ void QCommonStylePrivate::startAnimation(QStyleAnimation *animation) const
/*! \internal */
void QCommonStylePrivate::stopAnimation(const QObject *target) const
{
- QStyleAnimation *animation = animations.value(target);
- if (animation) {
- if (animation->state() == QAbstractAnimation::Stopped)
- animations.take(target)->deleteLater();
- else
- animation->stop();
- }
+ QStyleAnimation *animation = animations.take(target);
+ if (animation && animation->state() != QAbstractAnimation::Stopped)
+ animation->stop();
}
/*! \internal */
@@ -2777,7 +2773,6 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt,
return widget->style()->subElementRect(QStyle::SE_FrameContents, opt, widget);
else
return subElementRect(QStyle::SE_FrameContents, opt, widget);
- break;
case QFrame::WinPanel:
frameWidth = 2;
diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm
index f1d513bc23..83895b64b0 100644
--- a/src/widgets/styles/qmacstyle_mac.mm
+++ b/src/widgets/styles/qmacstyle_mac.mm
@@ -5399,7 +5399,7 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
QStyleOptionGroupBox groupBox(*gb);
groupBox.state |= QStyle::State_Mini; // Force mini-sized checkbox to go with small-sized label
bool didModifySubControls = false;
- if ((widget && !widget->testAttribute(Qt::WA_SetFont))
+ if ((!widget || !widget->testAttribute(Qt::WA_SetFont))
&& QApplication::desktopSettingsAware()) {
groupBox.subControls = groupBox.subControls & ~SC_GroupBoxLabel;
didModifySubControls = true;
@@ -5434,7 +5434,8 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
case CC_ToolButton:
if (const QStyleOptionToolButton *tb
= qstyleoption_cast<const QStyleOptionToolButton *>(opt)) {
- if (widget && qobject_cast<QToolBar *>(widget->parentWidget())) {
+
+ if (QStyleHelper::hasAncestor(opt->styleObject, QAccessible::ToolBar)) {
if (tb->subControls & SC_ToolButtonMenu) {
QStyleOption arrowOpt(0);
arrowOpt.rect = proxy()->subControlRect(cc, tb, SC_ToolButtonMenu, widget);
@@ -6030,7 +6031,7 @@ QRect QMacStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex *op
break;
case CC_ToolButton:
ret = QCommonStyle::subControlRect(cc, opt, sc, widget);
- if (sc == SC_ToolButtonMenu && widget && !qobject_cast<QToolBar*>(widget->parentWidget())) {
+ if (sc == SC_ToolButtonMenu && !QStyleHelper::hasAncestor(opt->styleObject, QAccessible::ToolBar)) {
ret.adjust(-1, 0, 0, 0);
}
break;
@@ -6176,7 +6177,7 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
// Do this by add enough space around the contents so that rounded
// borders (including highlighting when active) will show.
sz.rwidth() += QMacStylePrivate::PushButtonLeftOffset + QMacStylePrivate::PushButtonRightOffset + 12;
- sz.rheight() += QMacStylePrivate::PushButtonTopOffset + QMacStylePrivate::PushButtonBottomOffset;
+ sz.rheight() += 4;
break;
case QStyle::CT_MenuItem:
if (const QStyleOptionMenuItem *mi = qstyleoption_cast<const QStyleOptionMenuItem *>(opt)) {
diff --git a/src/widgets/styles/qstyleanimation.cpp b/src/widgets/styles/qstyleanimation.cpp
index d81532f8a5..0138996e33 100644
--- a/src/widgets/styles/qstyleanimation.cpp
+++ b/src/widgets/styles/qstyleanimation.cpp
@@ -163,4 +163,49 @@ bool QProgressStyleAnimation::isUpdateNeeded() const
return false;
}
+QNumberStyleAnimation::QNumberStyleAnimation(QObject *target) :
+ QStyleAnimation(target), _start(0.0), _end(1.0), _prev(0.0)
+{
+ setDuration(250);
+}
+
+qreal QNumberStyleAnimation::startValue() const
+{
+ return _start;
+}
+
+void QNumberStyleAnimation::setStartValue(qreal value)
+{
+ _start = value;
+}
+
+qreal QNumberStyleAnimation::endValue() const
+{
+ return _end;
+}
+
+void QNumberStyleAnimation::setEndValue(qreal value)
+{
+ _end = value;
+}
+
+qreal QNumberStyleAnimation::currentValue() const
+{
+ qreal step = qreal(currentTime() - delay()) / (duration() - delay());
+ return _start + qMax(qreal(0), step) * (_end - _start);
+}
+
+bool QNumberStyleAnimation::isUpdateNeeded() const
+{
+ if (QStyleAnimation::isUpdateNeeded()) {
+ qreal current = currentValue();
+ if (!qFuzzyCompare(_prev, current))
+ {
+ _prev = current;
+ return true;
+ }
+ }
+ return false;
+}
+
QT_END_NAMESPACE
diff --git a/src/widgets/styles/qstyleanimation_p.h b/src/widgets/styles/qstyleanimation_p.h
index 3188eebebc..d9869533ef 100644
--- a/src/widgets/styles/qstyleanimation_p.h
+++ b/src/widgets/styles/qstyleanimation_p.h
@@ -110,6 +110,30 @@ private:
mutable int _step;
};
+class QNumberStyleAnimation : public QStyleAnimation
+{
+ Q_OBJECT
+
+public:
+ QNumberStyleAnimation(QObject *target);
+
+ qreal startValue() const;
+ void setStartValue(qreal value);
+
+ qreal endValue() const;
+ void setEndValue(qreal value);
+
+ qreal currentValue() const;
+
+protected:
+ bool isUpdateNeeded() const;
+
+private:
+ qreal _start;
+ qreal _end;
+ mutable qreal _prev;
+};
+
QT_END_NAMESPACE
#endif // QSTYLEANIMATION_P_H
diff --git a/src/widgets/styles/qstylehelper.cpp b/src/widgets/styles/qstylehelper.cpp
index e23db2b637..8d67683eae 100644
--- a/src/widgets/styles/qstylehelper.cpp
+++ b/src/widgets/styles/qstylehelper.cpp
@@ -86,6 +86,23 @@ qreal dpiScaled(qreal value)
#endif
}
+// Searches for an ancestor of a particular accessible role
+bool hasAncestor(QObject *obj, QAccessible::Role role)
+{
+ bool found = false;
+#ifndef QT_NO_ACCESSIBILITY
+ QObject *parent = obj ? obj->parent() : 0;
+ while (parent && !found) {
+ QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(parent);
+ if (iface && iface->role() == role)
+ found = true;
+ delete iface;
+ parent = parent->parent();
+ }
+#endif // QT_NO_ACCESSIBILITY
+ return found;
+}
+
#ifndef QT_NO_DIAL
diff --git a/src/widgets/styles/qstylehelper_p.h b/src/widgets/styles/qstylehelper_p.h
index e47722bd9f..ab6a97e59a 100644
--- a/src/widgets/styles/qstylehelper_p.h
+++ b/src/widgets/styles/qstylehelper_p.h
@@ -44,6 +44,7 @@
#include <QtCore/qstring.h>
#include <QtGui/qpolygon.h>
#include <QtCore/qstringbuilder.h>
+#include <QtGui/qaccessible.h>
#ifndef QSTYLEHELPER_P_H
#define QSTYLEHELPER_P_H
@@ -81,6 +82,7 @@ namespace QStyleHelper
void drawBorderPixmap(const QPixmap &pixmap, QPainter *painter, const QRect &rect,
int left = 0, int top = 0, int right = 0,
int bottom = 0);
+ bool hasAncestor(QObject *obj, QAccessible::Role role);
}
diff --git a/src/widgets/styles/qwindowsvistastyle.cpp b/src/widgets/styles/qwindowsvistastyle.cpp
index 87c67dc84b..b20e6f5ea5 100644
--- a/src/widgets/styles/qwindowsvistastyle.cpp
+++ b/src/widgets/styles/qwindowsvistastyle.cpp
@@ -151,12 +151,36 @@ inline QObject *styleObject(const QStyleOption *option) {
return option ? option->styleObject : 0;
}
+/* \internal
+ Checks if we can animate on a style option
+*/
bool canAnimate(const QStyleOption *option) {
return option
&& option->styleObject
&& !option->styleObject->property("_q_no_animation").toBool();
}
+/* \internal
+ Used by animations to clone a styleoption and shift its offset
+*/
+QStyleOption *clonedAnimationStyleOption(const QStyleOption*option) {
+ QStyleOption *styleOption = 0;
+ if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider*>(option))
+ styleOption = new QStyleOptionSlider(*slider);
+ else if (const QStyleOptionSpinBox *spinbox = qstyleoption_cast<const QStyleOptionSpinBox*>(option))
+ styleOption = new QStyleOptionSpinBox(*spinbox);
+ else if (const QStyleOptionGroupBox *groupBox = qstyleoption_cast<const QStyleOptionGroupBox*>(option))
+ styleOption = new QStyleOptionGroupBox(*groupBox);
+ else if (const QStyleOptionComboBox *combo = qstyleoption_cast<const QStyleOptionComboBox*>(option))
+ styleOption = new QStyleOptionComboBox(*combo);
+ else if (const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton*>(option))
+ styleOption = new QStyleOptionButton(*button);
+ else
+ styleOption = new QStyleOption(*option);
+ styleOption->rect = QRect(QPoint(0,0), option->rect.size());
+ return styleOption;
+}
+
/*!
\class QWindowsVistaStyle
@@ -402,14 +426,8 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt
doTransition = false;
if (doTransition) {
- QStyleOption *styleOption = 0;
- if (const QStyleOptionGroupBox *combo = qstyleoption_cast<const QStyleOptionGroupBox*>(option))
- styleOption = new QStyleOptionGroupBox(*combo);
- else
- styleOption = new QStyleOption(*option);
-
+ QStyleOption *styleOption = clonedAnimationStyleOption(option);
styleOption->state = (QStyle::State)oldState;
- styleOption->rect = QRect(QPoint(0,0), newRect.size());
QWindowsVistaAnimation *anim = qobject_cast<QWindowsVistaAnimation *>(d->animation(styleObject));
QWindowsVistaTransition *t = new QWindowsVistaTransition(styleObject);
@@ -975,16 +993,8 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption
QWindowsVistaTransition *t = new QWindowsVistaTransition(styleObject);
QWindowsVistaAnimation *anim = qobject_cast<QWindowsVistaAnimation *>(d->animation(styleObject));
- QStyleOption *styleOption = 0;
- if (const QStyleOptionComboBox *combo = qstyleoption_cast<const QStyleOptionComboBox*>(option))
- styleOption = new QStyleOptionComboBox(*combo);
- else if (const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton*>(option))
- styleOption = new QStyleOptionButton(*button);
- else
- styleOption = new QStyleOption(*option);
-
+ QStyleOption *styleOption = clonedAnimationStyleOption(option);
styleOption->state = (QStyle::State)oldState;
- styleOption->rect = QRect(QPoint(0,0), newRect.size());
QImage startImage(option->rect.size(), QImage::Format_ARGB32_Premultiplied);
startImage.fill(0);
@@ -1664,6 +1674,7 @@ void QWindowsVistaStyle::drawComplexControl(ComplexControl control, const QStyle
}
if (doTransition) {
+
QImage startImage(option->rect.size(), QImage::Format_ARGB32_Premultiplied);
startImage.fill(0);
QPainter startPainter(&startImage);
@@ -1676,15 +1687,7 @@ void QWindowsVistaStyle::drawComplexControl(ComplexControl control, const QStyle
QWindowsVistaTransition *t = new QWindowsVistaTransition(styleObject);
// Draw the image that ends the animation by using the current styleoption
- QStyleOptionComplex *styleOption = 0;
- if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider*>(option))
- styleOption = new QStyleOptionSlider(*slider);
- else if (const QStyleOptionSpinBox *spinbox = qstyleoption_cast<const QStyleOptionSpinBox*>(option))
- styleOption = new QStyleOptionSpinBox(*spinbox);
- else
- styleOption = new QStyleOptionComplex(*option);
-
- styleOption->rect = QRect(QPoint(0,0), option->rect.size());
+ QStyleOptionComplex *styleOption = qstyleoption_cast<QStyleOptionComplex*>(clonedAnimationStyleOption(option));
styleObject->setProperty("_q_no_animation", true);
diff --git a/src/widgets/util/qsystemtrayicon_win.cpp b/src/widgets/util/qsystemtrayicon_win.cpp
index 108e65a2d1..896d5c2213 100644
--- a/src/widgets/util/qsystemtrayicon_win.cpp
+++ b/src/widgets/util/qsystemtrayicon_win.cpp
@@ -42,12 +42,18 @@
#include "qsystemtrayicon_p.h"
#ifndef QT_NO_SYSTEMTRAYICON
-#ifndef _WIN32_WINNT
-#define _WIN32_WINNT 0x0600
+#if defined(_WIN32_WINNT) && _WIN32_WINNT < 0x0600
+# undef _WIN32_WINNT
+#endif
+#if !defined(_WIN32_WINNT)
+# define _WIN32_WINNT 0x0600
#endif
-#ifndef _WIN32_IE
-#define _WIN32_IE 0x600
+#if defined(_WIN32_IE) && _WIN32_IE < 0x0600
+# undef _WIN32_IE
+#endif
+#if !defined(_WIN32_IE)
+# define _WIN32_IE 0x0600 //required for NOTIFYICONDATA_V2_SIZE
#endif
#include <private/qsystemlibrary_p.h>
diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp
index 74b3dc77d3..f22fc196a2 100644
--- a/src/widgets/widgets/qcombobox.cpp
+++ b/src/widgets/widgets/qcombobox.cpp
@@ -64,7 +64,6 @@
#include <private/qcombobox_p.h>
#include <private/qabstractitemmodel_p.h>
#include <private/qabstractscrollarea_p.h>
-#include <private/qsoftkeymanager_p.h>
#include <qdebug.h>
#if defined(Q_WS_MAC) && !defined(QT_NO_EFFECTS) && !defined(QT_NO_STYLE_MAC)
#include <private/qcore_mac_p.h>
@@ -561,13 +560,6 @@ void QComboBoxPrivateContainer::setItemView(QAbstractItemView *itemView)
#endif
connect(view, SIGNAL(destroyed()),
this, SLOT(viewDestroyed()));
-
-#ifdef QT_SOFTKEYS_ENABLED
- selectAction = QSoftKeyManager::createKeyedAction(QSoftKeyManager::SelectSoftKey, Qt::Key_Select, itemView);
- cancelAction = QSoftKeyManager::createKeyedAction(QSoftKeyManager::CancelSoftKey, Qt::Key_Escape, itemView);
- addAction(selectAction);
- addAction(cancelAction);
-#endif
}
/*!
@@ -617,11 +609,6 @@ void QComboBoxPrivateContainer::changeEvent(QEvent *e)
view->setMouseTracking(combo->style()->styleHint(QStyle::SH_ComboBox_ListMouseTracking, &opt, combo) ||
combo->style()->styleHint(QStyle::SH_ComboBox_Popup, &opt, combo));
setFrameStyle(combo->style()->styleHint(QStyle::SH_ComboBox_PopupFrameStyle, &opt, combo));
-#ifdef QT_SOFTKEYS_ENABLED
- } else if (e->type() == QEvent::LanguageChange) {
- selectAction->setText(QSoftKeyManager::standardSoftKeyText(QSoftKeyManager::SelectSoftKey));
- cancelAction->setText(QSoftKeyManager::standardSoftKeyText(QSoftKeyManager::CancelSoftKey));
-#endif
}
QWidget::changeEvent(e);
@@ -822,6 +809,14 @@ QStyleOptionComboBox QComboBoxPrivateContainer::comboStyleOption() const
*/
/*!
+ \fn void QComboBox::currentTextChanged(const QString &text)
+ \since 5.0
+
+ This signal is sent whenever currentText changes. The new value
+ is passed as \a text.
+*/
+
+/*!
Constructs a combobox with the given \a parent, using the default
model QStandardItemModel.
*/
@@ -980,9 +975,12 @@ void QComboBoxPrivate::_q_dataChanged(const QModelIndex &topLeft, const QModelIn
}
if (currentIndex.row() >= topLeft.row() && currentIndex.row() <= bottomRight.row()) {
+ const QString text = q->itemText(currentIndex.row());
if (lineEdit) {
- lineEdit->setText(q->itemText(currentIndex.row()));
+ lineEdit->setText(text);
updateLineEditGeometry();
+ } else {
+ emit q->currentTextChanged(text);
}
q->update();
}
@@ -1242,7 +1240,11 @@ void QComboBoxPrivate::_q_emitCurrentIndexChanged(const QModelIndex &index)
{
Q_Q(QComboBox);
emit q->currentIndexChanged(index.row());
- emit q->currentIndexChanged(itemText(index));
+ const QString text = itemText(index);
+ emit q->currentIndexChanged(text);
+ // signal lineEdit.textChanged already connected to signal currentTextChanged, so don't emit double here
+ if (!lineEdit)
+ emit q->currentTextChanged(text);
#ifndef QT_NO_ACCESSIBILITY
QAccessibleEvent event(q, QAccessible::NameChanged);
QAccessible::updateAccessibility(&event);
@@ -1714,6 +1716,7 @@ void QComboBox::setLineEdit(QLineEdit *edit)
connect(d->lineEdit, SIGNAL(returnPressed()), this, SLOT(_q_returnPressed()));
connect(d->lineEdit, SIGNAL(editingFinished()), this, SLOT(_q_editingFinished()));
connect(d->lineEdit, SIGNAL(textChanged(QString)), this, SIGNAL(editTextChanged(QString)));
+ connect(d->lineEdit, SIGNAL(textChanged(QString)), this, SIGNAL(currentTextChanged(QString)));
d->lineEdit->setFrame(false);
d->lineEdit->setContextMenuPolicy(Qt::NoContextMenu);
d->lineEdit->setFocusProxy(this);
@@ -2001,6 +2004,17 @@ void QComboBox::setCurrentIndex(int index)
d->setCurrentIndex(mi);
}
+void QComboBox::setCurrentText(const QString &text)
+{
+ if (isEditable()) {
+ setEditText(text);
+ } else {
+ const int i = findText(text);
+ if (i > -1)
+ setCurrentIndex(i);
+ }
+}
+
void QComboBoxPrivate::setCurrentIndex(const QModelIndex &mi)
{
Q_Q(QComboBox);
@@ -2034,7 +2048,11 @@ void QComboBoxPrivate::setCurrentIndex(const QModelIndex &mi)
by the line edit. Otherwise, it is the value of the current item or
an empty string if the combo box is empty or no current item is set.
- \sa editable
+ The setter setCurrentText() simply calls setEditText() if the combo box is editable.
+ Otherwise, if there is a matching text in the list, currentIndex is set to the
+ corresponding index.
+
+ \sa editable, setEditText()
*/
QString QComboBox::currentText() const
{
diff --git a/src/widgets/widgets/qcombobox.h b/src/widgets/widgets/qcombobox.h
index f1f1b133cb..bce6c98f2c 100644
--- a/src/widgets/widgets/qcombobox.h
+++ b/src/widgets/widgets/qcombobox.h
@@ -66,7 +66,7 @@ class Q_WIDGETS_EXPORT QComboBox : public QWidget
Q_ENUMS(SizeAdjustPolicy)
Q_PROPERTY(bool editable READ isEditable WRITE setEditable)
Q_PROPERTY(int count READ count)
- Q_PROPERTY(QString currentText READ currentText USER true)
+ Q_PROPERTY(QString currentText READ currentText WRITE setCurrentText NOTIFY currentTextChanged USER true)
Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentIndexChanged)
Q_PROPERTY(int maxVisibleItems READ maxVisibleItems WRITE setMaxVisibleItems)
Q_PROPERTY(int maxCount READ maxCount WRITE setMaxCount)
@@ -211,6 +211,7 @@ public Q_SLOTS:
void clearEditText();
void setEditText(const QString &text);
void setCurrentIndex(int index);
+ void setCurrentText(const QString &text);
Q_SIGNALS:
void editTextChanged(const QString &);
@@ -220,6 +221,7 @@ Q_SIGNALS:
void highlighted(const QString &);
void currentIndexChanged(int index);
void currentIndexChanged(const QString &);
+ void currentTextChanged(const QString &);
protected:
void focusInEvent(QFocusEvent *e);
diff --git a/src/widgets/widgets/qcombobox_p.h b/src/widgets/widgets/qcombobox_p.h
index eaf218283d..c51e6bb388 100644
--- a/src/widgets/widgets/qcombobox_p.h
+++ b/src/widgets/widgets/qcombobox_p.h
@@ -254,10 +254,6 @@ private:
QAbstractItemView *view;
QComboBoxPrivateScroller *top;
QComboBoxPrivateScroller *bottom;
-#ifdef QT_SOFTKEYS_ENABLED
- QAction *selectAction;
- QAction *cancelAction;
-#endif
};
class QComboMenuDelegate : public QAbstractItemDelegate
diff --git a/src/widgets/widgets/qdialogbuttonbox.cpp b/src/widgets/widgets/qdialogbuttonbox.cpp
index d25332a077..f20fc522ba 100644
--- a/src/widgets/widgets/qdialogbuttonbox.cpp
+++ b/src/widgets/widgets/qdialogbuttonbox.cpp
@@ -255,31 +255,6 @@ static const uint layouts[2][5][14] =
}
};
-#if defined(QT_SOFTKEYS_ENABLED) && !defined(QT_NO_ACTION)
-class QDialogButtonEnabledProxy : public QObject
-{
-public:
- QDialogButtonEnabledProxy(QObject *parent, QWidget *src, QAction *trg) : QObject(parent), source(src), target(trg)
- {
- source->installEventFilter(this);
- target->setEnabled(source->isEnabled());
- }
- ~QDialogButtonEnabledProxy()
- {
- source->removeEventFilter(this);
- }
- bool eventFilter(QObject *object, QEvent *event)
- {
- if (object == source && event->type() == QEvent::EnabledChange) {
- target->setEnabled(source->isEnabled());
- }
- return false;
- };
-private:
- QWidget *source;
- QAction *target;
-};
-#endif
class QDialogButtonBoxPrivate : public QWidgetPrivate
{
@@ -290,9 +265,6 @@ public:
QList<QAbstractButton *> buttonLists[QDialogButtonBox::NRoles];
QHash<QPushButton *, QDialogButtonBox::StandardButton> standardButtonHash;
-#ifdef QT_SOFTKEYS_ENABLED
- QHash<QAbstractButton *, QAction *> softKeyActions;
-#endif
Qt::Orientation orientation;
QDialogButtonBox::ButtonLayout layoutPolicy;
@@ -312,9 +284,6 @@ public:
void addButtonsToLayout(const QList<QAbstractButton *> &buttonList, bool reverse);
void retranslateStrings();
const char *standardButtonText(QDialogButtonBox::StandardButton sbutton) const;
-#if defined(QT_SOFTKEYS_ENABLED) && !defined(QT_NO_ACTION)
- QAction *createSoftKey(QAbstractButton *button, QDialogButtonBox::ButtonRole role);
-#endif
};
QDialogButtonBoxPrivate::QDialogButtonBoxPrivate(Qt::Orientation orient)
@@ -577,62 +546,10 @@ void QDialogButtonBoxPrivate::addButton(QAbstractButton *button, QDialogButtonBo
QObject::connect(button, SIGNAL(clicked()), q, SLOT(_q_handleButtonClicked()));
QObject::connect(button, SIGNAL(destroyed()), q, SLOT(_q_handleButtonDestroyed()));
buttonLists[role].append(button);
-#if defined(QT_SOFTKEYS_ENABLED) && !defined(QT_NO_ACTION)
- QAction *action = createSoftKey(button, role);
- softKeyActions.insert(button, action);
- new QDialogButtonEnabledProxy(action, button, action);
-#endif
if (doLayout)
layoutButtons();
}
-#if defined(QT_SOFTKEYS_ENABLED) && !defined(QT_NO_ACTION)
-QAction* QDialogButtonBoxPrivate::createSoftKey(QAbstractButton *button, QDialogButtonBox::ButtonRole role)
-{
- Q_Q(QDialogButtonBox);
- QAction::SoftKeyRole softkeyRole;
-
- QAction *action = new QAction(button->text(), button);
-
- switch (role) {
- case ApplyRole:
- case AcceptRole:
- case YesRole:
- case ActionRole:
- case HelpRole:
- softkeyRole = QAction::PositiveSoftKey;
- break;
- case RejectRole:
- case DestructiveRole:
- case NoRole:
- case ResetRole:
- softkeyRole = QAction::NegativeSoftKey;
- break;
- default:
- break;
- }
- QObject::connect(action, SIGNAL(triggered()), button, SIGNAL(clicked()));
- action->setSoftKeyRole(softkeyRole);
-
-
- QWidget *dialog = 0;
- QWidget *p = q;
- while (p && !p->isWindow()) {
- p = p->parentWidget();
- if ((dialog = qobject_cast<QDialog *>(p)))
- break;
- }
-
- if (dialog) {
- dialog->addAction(action);
- } else {
- q->addAction(action);
- }
-
- return action;
-}
-#endif
-
void QDialogButtonBoxPrivate::createStandardButtons(QDialogButtonBox::StandardButtons buttons)
{
uint i = QDialogButtonBox::FirstButton;
@@ -724,11 +641,6 @@ void QDialogButtonBoxPrivate::retranslateStrings()
if (buttonText) {
QPushButton *button = it.key();
button->setText(QDialogButtonBox::tr(buttonText));
-#if defined(QT_SOFTKEYS_ENABLED) && !defined(QT_NO_ACTION)
- QAction *action = softKeyActions.value(button, 0);
- if (action)
- action->setText(button->text());
-#endif
}
++it;
}
@@ -921,11 +833,6 @@ void QDialogButtonBox::setOrientation(Qt::Orientation orientation)
void QDialogButtonBox::clear()
{
Q_D(QDialogButtonBox);
-#ifdef QT_SOFTKEYS_ENABLED
- // Delete softkey actions as they have the buttons as parents
- qDeleteAll(d->softKeyActions.values());
- d->softKeyActions.clear();
-#endif
// Remove the created standard buttons, they should be in the other lists, which will
// do the deletion
d->standardButtonHash.clear();
@@ -1003,13 +910,6 @@ void QDialogButtonBox::removeButton(QAbstractButton *button)
}
}
}
-#if defined(QT_SOFTKEYS_ENABLED) && !defined(QT_NO_ACTION)
- QAction *action = d->softKeyActions.value(button, 0);
- if (action) {
- d->softKeyActions.remove(button);
- delete action;
- }
-#endif
if (!d->internalRemove)
button->setParent(0);
}
@@ -1080,11 +980,6 @@ QPushButton *QDialogButtonBox::addButton(StandardButton button)
void QDialogButtonBox::setStandardButtons(StandardButtons buttons)
{
Q_D(QDialogButtonBox);
-#ifdef QT_SOFTKEYS_ENABLED
- // Delete softkey actions since they have the buttons as parents
- qDeleteAll(d->softKeyActions.values());
- d->softKeyActions.clear();
-#endif
// Clear out all the old standard buttons, then recreate them.
qDeleteAll(d->standardButtonHash.keys());
d->standardButtonHash.clear();
@@ -1242,38 +1137,9 @@ bool QDialogButtonBox::event(QEvent *event)
}
if (!hasDefault && firstAcceptButton)
firstAcceptButton->setDefault(true);
-#ifdef QT_SOFTKEYS_ENABLED
- if (dialog)
- setFixedSize(0,0);
-#endif
}else if (event->type() == QEvent::LanguageChange) {
d->retranslateStrings();
}
-#if defined(QT_SOFTKEYS_ENABLED) && !defined(QT_NO_ACTION)
- else if (event->type() == QEvent::ParentChange) {
- QWidget *dialog = 0;
- QWidget *p = this;
- while (p && !p->isWindow()) {
- p = p->parentWidget();
- if ((dialog = qobject_cast<QDialog *>(p)))
- break;
- }
-
- // If the parent changes, then move the softkeys
- for (QHash<QAbstractButton *, QAction *>::const_iterator it = d->softKeyActions.constBegin();
- it != d->softKeyActions.constEnd(); ++it) {
- QAction *current = it.value();
- QList<QWidget *> widgets = current->associatedWidgets();
- foreach (QWidget *w, widgets)
- w->removeAction(current);
- if (dialog)
- dialog->addAction(current);
- else
- addAction(current);
- }
- }
-#endif
-
return QWidget::event(event);
}
diff --git a/src/widgets/widgets/qlineedit.h b/src/widgets/widgets/qlineedit.h
index 71ffbf2847..f18fd4a34b 100644
--- a/src/widgets/widgets/qlineedit.h
+++ b/src/widgets/widgets/qlineedit.h
@@ -225,6 +225,7 @@ public:
private:
friend class QAbstractSpinBox;
+ friend class QAccessibleLineEdit;
#ifdef QT_KEYPAD_NAVIGATION
friend class QDateTimeEdit;
#endif
diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp
index ffded7839f..fe7e444e86 100644
--- a/src/widgets/widgets/qmenu.cpp
+++ b/src/widgets/widgets/qmenu.cpp
@@ -69,7 +69,6 @@
#include "qpushbutton.h"
#include <private/qpushbutton_p.h>
#include <private/qaction_p.h>
-#include <private/qsoftkeymanager_p.h>
#include <private/qguiapplication_p.h>
QT_BEGIN_NAMESPACE
@@ -158,15 +157,6 @@ void QMenuPrivate::init()
QObject::connect(platformMenu, SIGNAL(aboutToShow()), q, SIGNAL(aboutToShow()));
QObject::connect(platformMenu, SIGNAL(aboutToHide()), q, SIGNAL(aboutToHide()));
}
-
-#ifdef QT_SOFTKEYS_ENABLED
- selectAction = QSoftKeyManager::createKeyedAction(QSoftKeyManager::SelectSoftKey, Qt::Key_Select, q);
- cancelAction = QSoftKeyManager::createKeyedAction(QSoftKeyManager::CancelSoftKey, Qt::Key_Back, q);
- selectAction->setPriority(QAction::HighPriority);
- cancelAction->setPriority(QAction::HighPriority);
- q->addAction(selectAction);
- q->addAction(cancelAction);
-#endif
}
int QMenuPrivate::scrollerHeight() const
@@ -1674,12 +1664,6 @@ void QMenu::clear()
QList<QAction*> acts = actions();
for(int i = 0; i < acts.size(); i++) {
-#ifdef QT_SOFTKEYS_ENABLED
- Q_D(QMenu);
- // Lets not touch to our internal softkey actions
- if(acts[i] == d->selectAction || acts[i] == d->cancelAction)
- continue;
-#endif
removeAction(acts[i]);
if (acts[i]->parent() == this && acts[i]->d_func()->widgets.isEmpty())
delete acts[i];
@@ -2383,13 +2367,6 @@ QMenu::event(QEvent *e)
}
return true;
#endif
-#ifdef QT_SOFTKEYS_ENABLED
- case QEvent::LanguageChange: {
- d->selectAction->setText(QSoftKeyManager::standardSoftKeyText(QSoftKeyManager::SelectSoftKey));
- d->cancelAction->setText(QSoftKeyManager::standardSoftKeyText(QSoftKeyManager::CancelSoftKey));
- }
- break;
-#endif
default:
break;
}
diff --git a/src/widgets/widgets/qmenubar.cpp b/src/widgets/widgets/qmenubar.cpp
index e53dc2cac2..35c665bb25 100644
--- a/src/widgets/widgets/qmenubar.cpp
+++ b/src/widgets/widgets/qmenubar.cpp
@@ -70,10 +70,6 @@
extern bool qt_wince_is_mobile(); //defined in qguifunctions_wce.cpp
#endif
-#ifdef QT_SOFTKEYS_ENABLED
-#include <private/qsoftkeymanager_p.h>
-#endif
-
QT_BEGIN_NAMESPACE
class QMenuBarExtension : public QToolButton
@@ -719,9 +715,6 @@ void QMenuBarPrivate::init()
#endif
q->setBackgroundRole(QPalette::Button);
oldWindow = oldParent = 0;
-#ifdef QT_SOFTKEYS_ENABLED
- menuBarAction = 0;
-#endif
handleReparent();
q->setMouseTracking(q->style()->styleHint(QStyle::SH_MenuBar_MouseTracking, 0, q));
@@ -1285,6 +1278,8 @@ void QMenuBar::actionEvent(QActionEvent *e)
}
} else if (menu) {
menu->setText(e->action()->text());
+ menu->setVisible(e->action()->isVisible());
+ menu->setEnabled(e->action()->isEnabled());
d->platformMenuBar->syncMenu(menu);
}
}
@@ -1403,11 +1398,6 @@ void QMenuBar::changeEvent(QEvent *e)
|| e->type() == QEvent::ApplicationFontChange) {
d->itemsDirty = true;
d->updateGeometries();
-#ifdef QT_SOFTKEYS_ENABLED
- } else if (e->type() == QEvent::LanguageChange) {
- if (d->menuBarAction)
- d->menuBarAction->setText(QSoftKeyManager::standardSoftKeyText(QSoftKeyManager::MenuSoftKey));
-#endif
}
QWidget::changeEvent(e);
diff --git a/src/widgets/widgets/qmenubar_p.h b/src/widgets/widgets/qmenubar_p.h
index 4960c60f83..0f08a4e414 100644
--- a/src/widgets/widgets/qmenubar_p.h
+++ b/src/widgets/widgets/qmenubar_p.h
@@ -188,9 +188,6 @@ public:
void wceRefresh();
bool wceEmitSignals(QList<QWceMenuAction*> actions, uint command);
#endif
-#ifdef QT_SOFTKEYS_ENABLED
- QAction *menuBarAction;
-#endif
};
#endif // QT_NO_MENUBAR