diff options
author | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2013-01-03 14:20:01 +0100 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2013-01-04 11:12:05 +0100 |
commit | ca2f44680cb97e7a7c46ee0ab26654822fe65e2d (patch) | |
tree | b9d85ad8ec1b18a6aa56b7657812cf3791bdf72e /src/gui | |
parent | 28a21d98ef8d880a6dd86ee19dd803424bb5eae1 (diff) | |
parent | 83188c6499ccdc87c0a2c468bb497e287f5db369 (diff) |
Merge branch 'stable' into dev
Conflicts:
examples/widgets/painting/shared/shared.pri
src/corelib/tools/qharfbuzz_p.h
src/corelib/tools/qunicodetools.cpp
src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp
src/plugins/platforms/windows/qwindowsfontdatabase.cpp
Change-Id: Ibc9860abf570e5ce8b052fb88feb73ec35e64bd3
Diffstat (limited to 'src/gui')
43 files changed, 314 insertions, 321 deletions
diff --git a/src/gui/accessible/qaccessible.cpp b/src/gui/accessible/qaccessible.cpp index 28a3afbbf0..a32f771bd0 100644 --- a/src/gui/accessible/qaccessible.cpp +++ b/src/gui/accessible/qaccessible.cpp @@ -56,6 +56,8 @@ QT_BEGIN_NAMESPACE +#ifndef QT_NO_ACCESSIBILITY + /*! \class QAccessible \brief The QAccessible class provides enums and static functions @@ -440,23 +442,19 @@ QAccessible::RootObjectHandler QAccessible::rootObjectHandler = 0; static bool accessibility_active = false; static bool cleanupAdded = false; -#ifndef QT_NO_ACCESSIBILITY static QPlatformAccessibility *platformAccessibility() { QPlatformIntegration *pfIntegration = QGuiApplicationPrivate::platformIntegration(); return pfIntegration ? pfIntegration->accessibility() : 0; } -#endif /*! \internal */ void QAccessible::cleanup() { -#ifndef QT_NO_ACCESSIBILITY if (QPlatformAccessibility *pfAccessibility = platformAccessibility()) pfAccessibility->cleanup(); -#endif } static void qAccessibleCleanup() @@ -617,10 +615,8 @@ QAccessibleInterface *QAccessible::queryAccessibleInterface(QObject *object) mo = mo->superClass(); } -#ifndef QT_NO_ACCESSIBILITY if (object == qApp) return new QAccessibleApplication; -#endif return 0; } @@ -660,10 +656,8 @@ void QAccessible::setRootObject(QObject *object) return; } -#ifndef QT_NO_ACCESSIBILITY if (QPlatformAccessibility *pfAccessibility = platformAccessibility()) pfAccessibility->setRootObject(object); -#endif } /*! @@ -695,10 +689,8 @@ void QAccessible::updateAccessibility(QAccessibleEvent *event) if (!isActive()) return; -#ifndef QT_NO_ACCESSIBILITY if (QPlatformAccessibility *pfAccessibility = platformAccessibility()) pfAccessibility->notifyAccessibilityUpdate(event); -#endif } #if QT_DEPRECATED_SINCE(5, 0) @@ -1552,5 +1544,7 @@ QDebug operator<<(QDebug d, const QAccessibleEvent &ev) #endif +#endif // QT_NO_ACCESSIBILITY + QT_END_NAMESPACE diff --git a/src/gui/accessible/qaccessible.h b/src/gui/accessible/qaccessible.h index 5f61634ba2..5bcf9e7d0d 100644 --- a/src/gui/accessible/qaccessible.h +++ b/src/gui/accessible/qaccessible.h @@ -57,6 +57,7 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE +#ifndef QT_NO_ACCESSIBILITY class QAccessibleInterface; class QAccessibleEvent; @@ -676,6 +677,8 @@ 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/accessible/qaccessible2.cpp b/src/gui/accessible/qaccessible2.cpp index 7f871f9c5a..f21c74e74f 100644 --- a/src/gui/accessible/qaccessible2.cpp +++ b/src/gui/accessible/qaccessible2.cpp @@ -439,6 +439,19 @@ QString QAccessibleTextInterface::textAtOffset(int offset, QAccessible2::Boundar */ /*! + \fn QVariant QAccessibleValueInterface::minimumStepSize() const + + Returns the minimum step size for the accessible. + This is the smalles increment that makes sense when changing the value. + When programatically changing the value it should always be a multiple + of the minimum step size. + + Some tools use this value even when the setCurrentValue does not + perform any action. Progress bars for example are read-only but + should return their range divided by 100. +*/ + +/*! \class QAccessibleImageInterface \inmodule QtGui \ingroup accessibility diff --git a/src/gui/accessible/qaccessible2.h b/src/gui/accessible/qaccessible2.h index 6006e7846c..04c9091a79 100644 --- a/src/gui/accessible/qaccessible2.h +++ b/src/gui/accessible/qaccessible2.h @@ -117,6 +117,7 @@ public: virtual void setCurrentValue(const QVariant &value) = 0; virtual QVariant maximumValue() const = 0; virtual QVariant minimumValue() const = 0; + virtual QVariant minimumStepSize() const = 0; }; class Q_GUI_EXPORT QAccessibleTableCellInterface diff --git a/src/gui/accessible/qaccessibleobject.cpp b/src/gui/accessible/qaccessibleobject.cpp index bc108980cf..2bd5a00afb 100644 --- a/src/gui/accessible/qaccessibleobject.cpp +++ b/src/gui/accessible/qaccessibleobject.cpp @@ -165,6 +165,8 @@ QAccessibleInterface *QAccessibleObject::childAt(int x, int y) const Q_ASSERT(childIface); if (childIface->rect().contains(x,y)) { return childIface; + } else { + delete childIface; } } return 0; diff --git a/src/gui/doc/qtgui.qdocconf b/src/gui/doc/qtgui.qdocconf index cf324ad8ac..a46aa9b3d1 100644 --- a/src/gui/doc/qtgui.qdocconf +++ b/src/gui/doc/qtgui.qdocconf @@ -3,25 +3,25 @@ include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf) project = QtGui description = Qt GUI Reference Documentation url = http://qt-project.org/doc/qtgui -version = 5.0.0 +version = 5.0.1 examplesinstallpath = gui qhp.projects = QtGui qhp.QtGui.file = qtgui.qhp -qhp.QtGui.namespace = org.qt-project.qtgui.500 +qhp.QtGui.namespace = org.qt-project.qtgui.501 qhp.QtGui.virtualFolder = qtgui qhp.QtGui.indexTitle = Qt GUI qhp.QtGui.indexRoot = -qhp.QtGui.filterAttributes = qtgui 5.0.0 qtrefdoc -qhp.QtGui.customFilters.Qt.name = Qtgui 5.0.0 -qhp.QtGui.customFilters.Qt.filterAttributes = qtgui 5.0.0 +qhp.QtGui.filterAttributes = qtgui 5.0.1 qtrefdoc +qhp.QtGui.customFilters.Qt.name = Qtgui 5.0.1 +qhp.QtGui.customFilters.Qt.filterAttributes = qtgui 5.0.1 qhp.QtGui.subprojects = classes qhp.QtGui.subprojects.classes.title = C++ Classes -qhp.QtGui.subprojects.classes.indexTitle = Qt GUI C++ Classes +qhp.QtGui.subprojects.classes.indexTitle = Qt GUI C++ API qhp.QtGui.subprojects.classes.selectors = class fake:headerfile qhp.QtGui.subprojects.classes.sortPages = true @@ -40,9 +40,10 @@ depends += \ headerdirs += .. sourcedirs += .. \ - ../../../examples/gui/doc + ../../../examples/gui/doc/src exampledirs += ../../../examples/gui \ snippets -imagedirs += images +imagedirs += images \ + ../../../examples/gui/doc/images diff --git a/src/gui/doc/src/dnd.qdoc b/src/gui/doc/src/dnd.qdoc index a4eb77469b..ad48d7b5c7 100644 --- a/src/gui/doc/src/dnd.qdoc +++ b/src/gui/doc/src/dnd.qdoc @@ -41,9 +41,11 @@ \tableofcontents This document describes the basic drag and drop mechanism and - outlines the approach used to enable it in custom widgets. Drag - and drop operations are also supported by Qt's item views and by - the graphics view framework. More information is available in + outlines the approach used to enable it in custom controls. Drag + and drop operations are also supported by many of Qt's controls, + such as the item views and graphics view framework, as well as + editing controls for Qt Widgets and Qt Quick. More information + about item views and graphics view is available in \l{Using drag and drop with item views} and \l{Graphics View Framework}. @@ -56,22 +58,31 @@ \section1 Configuration - The QApplication object provides some properties that are related + The QStyleHints object provides some properties that are related to drag and drop operations: \list - \li \l{QApplication::startDragTime} describes the amount of time in + \li \l{QStyleHints::startDragTime()} describes the amount of time in milliseconds that the user must hold down a mouse button over an object before a drag will begin. - \li \l{QApplication::startDragDistance} indicates how far the user has to + \li \l{QStyleHints::startDragDistance()} indicates how far the user has to move the mouse while holding down a mouse button before the movement - will be interpreted as dragging. Use of high values for this quantity - prevents accidental dragging when the user only meant to click on an - object. + will be interpreted as dragging. + \li \l{QStyleHints::startDragVelocity()} indicates how fast (in pixels/second) + the user has to move the mouse to start a drag. A value of \c 0 means + that there is no such limit. \endlist - These quantities provide sensible default values for you to use if you - provide drag and drop support in your widgets. + These quantities provide sensible default values that are compliant with + the underlying windowing system for you to use if you + provide drag and drop support in your controls. + + \section1 Drag and Drop in Qt Quick + + The rest of the document focuses mainly on how to implement drag and drop + in C++. For using drag and drop inside a Qt Quick scene, please read the + documentation for the Qt Quick \l{Drag}, \l{DragEvent} and \l{DropArea} items. + There is also an example \l{quick/draganddrop}{available}. \section1 Dragging @@ -335,7 +346,7 @@ the clipboard. To access this, you need to obtain a QClipboard object from the QApplication object: - \snippet widgets/charactermap/mainwindow.cpp 3 + \snippet ../widgets/widgets/charactermap/mainwindow.cpp 3 The QMimeData class is used to represent data that is transferred to and from the clipboard. To put data on the clipboard, you can use the @@ -350,7 +361,7 @@ For example, we can copy the contents of a QLineEdit to the clipboard with the following code: - \snippet widgets/charactermap/mainwindow.cpp 11 + \snippet ../widgets/widgets/charactermap/mainwindow.cpp 11 Data with different MIME types can also be put on the clipboard. Construct a QMimeData object and set data with setData() function in diff --git a/src/gui/doc/src/richtext.qdoc b/src/gui/doc/src/richtext.qdoc index b4ba4ba6c4..448c42631b 100644 --- a/src/gui/doc/src/richtext.qdoc +++ b/src/gui/doc/src/richtext.qdoc @@ -851,7 +851,7 @@ \contentspage richtext.html Contents \previouspage Common Rich Text Editing Tasks - Qt's text widgets are able to display rich text, specified using a subset of \l{HTML 4} + Qt's text widgets are able to display rich text, specified using a subset of \l {http://www.w3.org/TR/html401/}{HTML 4} markup. Widgets that use QTextDocument, such as QLabel and QTextEdit, are able to display rich text specified in this way. @@ -863,7 +863,7 @@ setting a label's \l{QLabel::}{text} property with the string \c{"<b>Hello</b> <i>Qt!</i>"} will result in the label displaying text like this: \b{Hello} \e{Qt!} - When HTML markup is used for text, Qt follows the rules defined by the \l{HTML 4} + When HTML markup is used for text, Qt follows the rules defined by the \l{http://www.w3.org/TR/html401/}{HTML 4} specification. This includes default properties for text layout, such as the direction of the text flow (left-to-right) which can be changed by applying the \l{#Block Attributes}{\c dir} attribute to blocks of text. diff --git a/src/gui/gui.pro b/src/gui/gui.pro index 301d704e2e..058cfe92ec 100644 --- a/src/gui/gui.pro +++ b/src/gui/gui.pro @@ -1,6 +1,8 @@ TARGET = QtGui QT = core-private -MODULE_CONFIG = opengl + +MODULE_CONFIG = needs_qpa_plugin +contains(QT_CONFIG, opengl.*):MODULE_CONFIG += opengl DEFINES += QT_NO_USING_NAMESPACE diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index c40ca1545a..dbc33719e2 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -4213,6 +4213,7 @@ QImage QImage::mirrored(bool horizontal, bool vertical) const result.d->colortable = d->colortable; result.d->has_alpha_clut = d->has_alpha_clut; + result.d->devicePixelRatio = d->devicePixelRatio; if (depth() == 1) w = (w+7)/8; diff --git a/src/gui/image/qimageiohandler.cpp b/src/gui/image/qimageiohandler.cpp index 8ec2dea431..36757a6f34 100644 --- a/src/gui/image/qimageiohandler.cpp +++ b/src/gui/image/qimageiohandler.cpp @@ -514,6 +514,8 @@ int QImageIOHandler::nextImageDelay() const return 0; } +#ifndef QT_NO_IMAGEFORMATPLUGIN + /*! Constructs an image plugin with the given \a parent. This is invoked automatically by the moc generated code that exports the plugin. @@ -554,4 +556,6 @@ QImageIOPlugin::~QImageIOPlugin() \sa keys() */ +#endif // QT_NO_IMAGEFORMATPLUGIN + QT_END_NAMESPACE diff --git a/src/gui/image/qimageiohandler.h b/src/gui/image/qimageiohandler.h index 62f7ba1163..1f94099478 100644 --- a/src/gui/image/qimageiohandler.h +++ b/src/gui/image/qimageiohandler.h @@ -114,6 +114,8 @@ private: Q_DISABLE_COPY(QImageIOHandler) }; +#ifndef QT_NO_IMAGEFORMATPLUGIN + #define QImageIOHandlerFactoryInterface_iid "org.qt-project.Qt.QImageIOHandlerFactoryInterface" class Q_GUI_EXPORT QImageIOPlugin : public QObject @@ -136,6 +138,8 @@ public: Q_DECLARE_OPERATORS_FOR_FLAGS(QImageIOPlugin::Capabilities) +#endif // QT_NO_IMAGEFORMATPLUGIN + QT_END_NAMESPACE QT_END_HEADER diff --git a/src/gui/image/qimagereader.cpp b/src/gui/image/qimagereader.cpp index a27a7710f6..7e6d937c9f 100644 --- a/src/gui/image/qimagereader.cpp +++ b/src/gui/image/qimagereader.cpp @@ -151,7 +151,7 @@ QT_BEGIN_NAMESPACE -#ifndef QT_NO_LIBRARY +#ifndef QT_NO_IMAGEFORMATPLUGIN Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, (QImageIOHandlerFactoryInterface_iid, QLatin1String("/imageformats"))) #endif @@ -223,23 +223,23 @@ static QImageIOHandler *createReadHandlerHelper(QIODevice *device, QByteArray form = format.toLower(); QImageIOHandler *handler = 0; + QByteArray suffix; -#ifndef QT_NO_LIBRARY +#ifndef QT_NO_IMAGEFORMATPLUGIN typedef QMultiMap<int, QString> PluginKeyMap; // check if we have plugins that support the image format QFactoryLoader *l = loader(); const PluginKeyMap keyMap = l->keyMap(); -#endif - QByteArray suffix; #ifdef QIMAGEREADER_DEBUG qDebug() << "QImageReader::createReadHandler( device =" << (void *)device << ", format =" << format << ")," << keyMap.values().size() << "plugins available: " << keyMap.values(); #endif -#ifndef QT_NO_LIBRARY int suffixPluginIndex = -1; +#endif // QT_NO_IMAGEFORMATPLUGIN + if (device && format.isEmpty() && autoDetectImageFormat && !ignoresFormatAndExtension) { // if there's no format, see if \a device is a file, and if so, find // the file suffix and find support for that format among our plugins. @@ -249,6 +249,7 @@ static QImageIOHandler *createReadHandlerHelper(QIODevice *device, qDebug() << "QImageReader::createReadHandler: device is a file:" << file->fileName(); #endif if (!(suffix = QFileInfo(file->fileName()).suffix().toLower().toLatin1()).isEmpty()) { +#ifndef QT_NO_IMAGEFORMATPLUGIN const int index = keyMap.key(QString::fromLatin1(suffix), -1); if (index != -1) { #ifdef QIMAGEREADER_DEBUG @@ -257,17 +258,17 @@ static QImageIOHandler *createReadHandlerHelper(QIODevice *device, #endif suffixPluginIndex = index; } +#endif // QT_NO_IMAGEFORMATPLUGIN } } } -#endif // QT_NO_LIBRARY QByteArray testFormat = !form.isEmpty() ? form : suffix; if (ignoresFormatAndExtension) testFormat = QByteArray(); -#ifndef QT_NO_LIBRARY +#ifndef QT_NO_IMAGEFORMATPLUGIN if (suffixPluginIndex != -1) { // check if the plugin that claims support for this format can load // from this device with this format. @@ -322,7 +323,7 @@ static QImageIOHandler *createReadHandlerHelper(QIODevice *device, device->seek(pos); } -#endif // QT_NO_LIBRARY +#endif // QT_NO_IMAGEFORMATPLUGIN // if we don't have a handler yet, check if we have built-in support for // the format @@ -369,7 +370,7 @@ static QImageIOHandler *createReadHandlerHelper(QIODevice *device, #endif } -#ifndef QT_NO_LIBRARY +#ifndef QT_NO_IMAGEFORMATPLUGIN if (!handler && (autoDetectImageFormat || ignoresFormatAndExtension)) { // check if any of our plugins recognize the file from its contents. const qint64 pos = device ? device->pos() : 0; @@ -389,7 +390,7 @@ static QImageIOHandler *createReadHandlerHelper(QIODevice *device, if (device && !device->isSequential()) device->seek(pos); } -#endif // QT_NO_LIBRARY +#endif // QT_NO_IMAGEFORMATPLUGIN if (!handler && (autoDetectImageFormat || ignoresFormatAndExtension)) { // check if any of our built-in handlers recognize the file from its @@ -1235,7 +1236,7 @@ bool QImageReader::read(QImage *image) } // successful read; check for "@2x" file name suffix and set device pixel ratio. - if (QFileInfo(fileName()).baseName().endsWith("@2x")) { + if (QFileInfo(fileName()).baseName().endsWith(QLatin1String("@2x"))) { image->setDevicePixelRatio(2.0); } @@ -1429,7 +1430,7 @@ QByteArray QImageReader::imageFormat(QIODevice *device) return format; } -#ifndef QT_NO_LIBRARY +#ifndef QT_NO_IMAGEFORMATPLUGIN void supportedImageHandlerFormats(QFactoryLoader *loader, QImageIOPlugin::Capability cap, QSet<QByteArray> *result); @@ -1471,9 +1472,9 @@ QList<QByteArray> QImageReader::supportedImageFormats() for (int i = 0; i < _qt_NumFormats; ++i) formats << _qt_BuiltInFormats[i].extension; -#ifndef QT_NO_LIBRARY +#ifndef QT_NO_IMAGEFORMATPLUGIN supportedImageHandlerFormats(loader(), QImageIOPlugin::CanRead, &formats); -#endif // QT_NO_LIBRARY +#endif // QT_NO_IMAGEFORMATPLUGIN QList<QByteArray> sortedFormats; for (QSet<QByteArray>::ConstIterator it = formats.constBegin(); it != formats.constEnd(); ++it) diff --git a/src/gui/image/qimagewriter.cpp b/src/gui/image/qimagewriter.cpp index 8e5fd5faec..6085a0e465 100644 --- a/src/gui/image/qimagewriter.cpp +++ b/src/gui/image/qimagewriter.cpp @@ -124,7 +124,7 @@ QT_BEGIN_NAMESPACE -#ifndef QT_NO_LIBRARY +#ifndef QT_NO_IMAGEFORMATPLUGIN Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, (QImageIOHandlerFactoryInterface_iid, QLatin1String("/imageformats"))) #endif @@ -136,7 +136,7 @@ static QImageIOHandler *createWriteHandlerHelper(QIODevice *device, QByteArray suffix; QImageIOHandler *handler = 0; -#ifndef QT_NO_LIBRARY +#ifndef QT_NO_IMAGEFORMATPLUGIN typedef QMultiMap<int, QString> PluginKeyMap; // check if any plugins can write the image @@ -151,7 +151,7 @@ static QImageIOHandler *createWriteHandlerHelper(QIODevice *device, // this allows plugins to override our built-in handlers. if (QFile *file = qobject_cast<QFile *>(device)) { if (!(suffix = QFileInfo(file->fileName()).suffix().toLower().toLatin1()).isEmpty()) { -#ifndef QT_NO_LIBRARY +#ifndef QT_NO_IMAGEFORMATPLUGIN const int index = keyMap.key(QString::fromLatin1(suffix), -1); if (index != -1) suffixPluginIndex = index; @@ -162,7 +162,7 @@ static QImageIOHandler *createWriteHandlerHelper(QIODevice *device, QByteArray testFormat = !form.isEmpty() ? form : suffix; -#ifndef QT_NO_LIBRARY +#ifndef QT_NO_IMAGEFORMATPLUGIN if (suffixPluginIndex != -1) { // when format is missing, check if we can find a plugin for the // suffix. @@ -173,7 +173,7 @@ static QImageIOHandler *createWriteHandlerHelper(QIODevice *device, handler = plugin->create(device, suffix); } } -#endif // QT_NO_LIBRARY +#endif // QT_NO_IMAGEFORMATPLUGIN // check if any built-in handlers can write the image if (!handler && !testFormat.isEmpty()) { @@ -214,7 +214,7 @@ static QImageIOHandler *createWriteHandlerHelper(QIODevice *device, } } -#ifndef QT_NO_LIBRARY +#ifndef QT_NO_IMAGEFORMATPLUGIN if (!testFormat.isEmpty()) { const int keyCount = keyMap.keys().size(); for (int i = 0; i < keyCount; ++i) { @@ -226,7 +226,7 @@ static QImageIOHandler *createWriteHandlerHelper(QIODevice *device, } } } -#endif // QT_NO_LIBRARY +#endif // QT_NO_IMAGEFORMATPLUGIN if (!handler) return 0; @@ -655,7 +655,7 @@ bool QImageWriter::supportsOption(QImageIOHandler::ImageOption option) const } -#ifndef QT_NO_LIBRARY +#ifndef QT_NO_IMAGEFORMATPLUGIN void supportedImageHandlerFormats(QFactoryLoader *loader, QImageIOPlugin::Capability cap, QSet<QByteArray> *result) @@ -677,7 +677,7 @@ void supportedImageHandlerFormats(QFactoryLoader *loader, result->insert(key); } } -#endif // QT_NO_LIBRARY +#endif // QT_NO_IMAGEFORMATPLUGIN /*! Returns the list of image formats supported by QImageWriter. @@ -729,9 +729,9 @@ QList<QByteArray> QImageWriter::supportedImageFormats() formats << "gif"; #endif -#ifndef QT_NO_LIBRARY +#ifndef QT_NO_IMAGEFORMATPLUGIN supportedImageHandlerFormats(loader(), QImageIOPlugin::CanWrite, &formats); -#endif // QT_NO_LIBRARY +#endif // QT_NO_IMAGEFORMATPLUGIN QList<QByteArray> sortedFormats; for (QSet<QByteArray>::ConstIterator it = formats.constBegin(); it != formats.constEnd(); ++it) diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index fb14490a24..72e95c996c 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -60,6 +60,7 @@ #include <QtCore/private/qthread_p.h> #include <QtCore/qdir.h> #include <QtDebug> +#include "qaccessible.h" #include <qpalette.h> #include <qscreen.h> #include "qsessionmanager.h" @@ -1065,7 +1066,8 @@ QGuiApplicationPrivate::~QGuiApplicationPrivate() QPixmapCache::clear(); - delete platform_theme; + delete platform_theme; + platform_theme = 0; delete platform_integration; platform_integration = 0; delete m_gammaTables.load(); @@ -1183,6 +1185,9 @@ QPlatformNativeInterface *QGuiApplication::platformNativeInterface() */ int QGuiApplication::exec() { +#ifndef QT_NO_ACCESSIBILITY + QAccessible::setRootObject(qApp); +#endif return QCoreApplication::exec(); } diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp index 66baa3db95..83e7b30a52 100644 --- a/src/gui/kernel/qkeysequence.cpp +++ b/src/gui/kernel/qkeysequence.cpp @@ -349,7 +349,7 @@ void Q_GUI_EXPORT qt_set_sequence_auto_mnemonic(bool b) { qt_sequence_no_mnemoni \section1 GNU Emacs Style Key Sequences - Key sequences similar to those used in \l{GNU Emacs}, allowing up to four + Key sequences similar to those used in \l{http://www.gnu.org/software/emacs/}{GNU Emacs}, allowing up to four key codes, can be created by using the multiple argument constructor, or by passing a human-readable string of comma-separated key sequences. diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp index d2de6aa125..f16f29718d 100644 --- a/src/gui/kernel/qopenglcontext.cpp +++ b/src/gui/kernel/qopenglcontext.cpp @@ -121,7 +121,7 @@ QMutex QOpenGLContextPrivate::makeCurrentTrackerMutex; \l{OpenGL documentation}. For an example of how to use QOpenGLContext see the - \l{gui/openglwindow}{OpenGL Window} example. + \l{OpenGL Window Example}{OpenGL Window} example. \section1 Thread affinity diff --git a/src/gui/kernel/qplatformcursor.h b/src/gui/kernel/qplatformcursor.h index 138c5fdb58..babb91d9fd 100644 --- a/src/gui/kernel/qplatformcursor.h +++ b/src/gui/kernel/qplatformcursor.h @@ -92,7 +92,9 @@ public: // input methods virtual void pointerEvent(const QMouseEvent & event) { Q_UNUSED(event); } +#ifndef QT_NO_CURSOR virtual void changeCursor(QCursor * windowCursor, QWindow * window) = 0; +#endif virtual QPoint pos() const; virtual void setPos(const QPoint &pos); diff --git a/src/gui/kernel/qplatformdialoghelper.cpp b/src/gui/kernel/qplatformdialoghelper.cpp index 79f1bd1b49..0ef08227a4 100644 --- a/src/gui/kernel/qplatformdialoghelper.cpp +++ b/src/gui/kernel/qplatformdialoghelper.cpp @@ -205,7 +205,7 @@ QColorDialogStaticData::QColorDialogStaticData() : customSet(false) void QColorDialogStaticData::readSettings() { #ifndef QT_NO_SETTINGS - const QSettings settings(QSettings::UserScope, QStringLiteral("Trolltech")); + const QSettings settings(QSettings::UserScope, QStringLiteral("QtProject")); for (int i = 0; i < int(CustomColorCount); ++i) { const QVariant v = settings.value(QStringLiteral("Qt/customColors/") + QString::number(i)); if (v.isValid()) @@ -218,7 +218,7 @@ void QColorDialogStaticData::writeSettings() const { #ifndef QT_NO_SETTINGS if (!customSet) { - QSettings settings(QSettings::UserScope, QStringLiteral("Trolltech")); + QSettings settings(QSettings::UserScope, QStringLiteral("QtProject")); for (int i = 0; i < int(CustomColorCount); ++i) settings.setValue(QStringLiteral("Qt/customColors/") + QString::number(i), customRgb[i]); } diff --git a/src/gui/kernel/qplatformnativeinterface.cpp b/src/gui/kernel/qplatformnativeinterface.cpp index 925b2ad3de..cf487b2235 100644 --- a/src/gui/kernel/qplatformnativeinterface.cpp +++ b/src/gui/kernel/qplatformnativeinterface.cpp @@ -100,6 +100,12 @@ QPlatformNativeInterface::NativeResourceForContextFunction QPlatformNativeInterf return 0; } +QPlatformNativeInterface::NativeResourceForScreenFunction QPlatformNativeInterface::nativeResourceFunctionForScreen(const QByteArray &resource) +{ + Q_UNUSED(resource); + return 0; +} + QPlatformNativeInterface::NativeResourceForWindowFunction QPlatformNativeInterface::nativeResourceFunctionForWindow(const QByteArray &resource) { Q_UNUSED(resource); diff --git a/src/gui/kernel/qplatformnativeinterface.h b/src/gui/kernel/qplatformnativeinterface.h index cbf997bec4..8dd661f67e 100644 --- a/src/gui/kernel/qplatformnativeinterface.h +++ b/src/gui/kernel/qplatformnativeinterface.h @@ -78,10 +78,12 @@ public: typedef void * (*NativeResourceForIntegrationFunction)(); typedef void * (*NativeResourceForContextFunction)(QOpenGLContext *context); + typedef void * (*NativeResourceForScreenFunction)(QScreen *screen); typedef void * (*NativeResourceForWindowFunction)(QWindow *window); typedef void * (*NativeResourceForBackingStoreFunction)(QBackingStore *backingStore); virtual NativeResourceForIntegrationFunction nativeResourceFunctionForIntegration(const QByteArray &resource); virtual NativeResourceForContextFunction nativeResourceFunctionForContext(const QByteArray &resource); + virtual NativeResourceForScreenFunction nativeResourceFunctionForScreen(const QByteArray &resource); virtual NativeResourceForWindowFunction nativeResourceFunctionForWindow(const QByteArray &resource); virtual NativeResourceForBackingStoreFunction nativeResourceFunctionForBackingStore(const QByteArray &resource); diff --git a/src/gui/kernel/qplatformwindow.cpp b/src/gui/kernel/qplatformwindow.cpp index 25b863c9a3..82547b04ec 100644 --- a/src/gui/kernel/qplatformwindow.cpp +++ b/src/gui/kernel/qplatformwindow.cpp @@ -247,7 +247,12 @@ void QPlatformWindow::setParent(const QPlatformWindow *parent) } /*! - Reimplement to set the window title to \a title + Reimplement to set the window title to \a title. + + The implementation might want to append the application display name to + the window title, like Windows and Linux do. + + \sa QGuiApplication::applicationDisplayName() */ void QPlatformWindow::setWindowTitle(const QString &title) { Q_UNUSED(title); } @@ -331,31 +336,6 @@ void QPlatformWindow::handleContentOrientationChange(Qt::ScreenOrientation orien } /*! - Request a different orientation of the platform window. - - This tells the window manager how the window wants to be rotated in order - to be displayed, and how input events should be translated. - - As an example, a portrait compositor might rotate the window by 90 degrees, - if the window is in landscape. It will also rotate input coordinates from - portrait to landscape such that top right in portrait gets mapped to top - left in landscape. - - If the implementation doesn't support the requested orientation it should - signal this by returning an actual supported orientation. - - If the implementation doesn't support rotating the window at all it should - return Qt::PrimaryOrientation, this is also the default value. - - \sa QWindow::requestWindowOrientation() -*/ -Qt::ScreenOrientation QPlatformWindow::requestWindowOrientation(Qt::ScreenOrientation orientation) -{ - Q_UNUSED(orientation); - return Qt::PrimaryOrientation; -} - -/*! Reimplement this function in subclass to return the device pixel ratio for the window. This is the ratio between physical pixels and device-independent pixels. @@ -469,9 +449,6 @@ bool QPlatformWindow::frameStrutEventsEnabled() const QPlatformWindow is also the way QPA defines how native child windows should be supported through the setParent function. - The only way to retrieve a QPlatformOpenGLContext in QPA is by calling the glContext() function - on QPlatformWindow. - \section1 Implementation Aspects \list 1 diff --git a/src/gui/kernel/qplatformwindow.h b/src/gui/kernel/qplatformwindow.h index 607c8e4035..5d7323ae2b 100644 --- a/src/gui/kernel/qplatformwindow.h +++ b/src/gui/kernel/qplatformwindow.h @@ -115,7 +115,6 @@ public: virtual void requestActivateWindow(); virtual void handleContentOrientationChange(Qt::ScreenOrientation orientation); - virtual Qt::ScreenOrientation requestWindowOrientation(Qt::ScreenOrientation orientation); virtual qreal devicePixelRatio() const; diff --git a/src/gui/kernel/qshortcutmap.cpp b/src/gui/kernel/qshortcutmap.cpp index 43f37a900f..839cbf37e7 100644 --- a/src/gui/kernel/qshortcutmap.cpp +++ b/src/gui/kernel/qshortcutmap.cpp @@ -679,7 +679,7 @@ void QShortcutMap::dispatchEvent(QKeyEvent *e) #if defined(DEBUG_QSHORTCUTMAP) qDebug().nospace() << "QShortcutMap::dispatchEvent(): Sending QShortcutEvent(\"" - << (QString)next->keyseq << "\", " << next->id << ", " + << next->keyseq.toString() << "\", " << next->id << ", " << (bool)(enabledShortcuts>1) << ") to object(" << next->owner << ')'; #endif QShortcutEvent se(next->keyseq, next->id, enabledShortcuts>1); diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index aaf2b25ad4..b6d592e050 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -89,23 +89,16 @@ QT_BEGIN_NAMESPACE buffers to support double and triple buffering, as well as depth and stencil buffers. To release a window's memory resources, call the destroy() function. - \section1 Window and content orientation - - QWindow has reportContentOrientationChange() and - requestWindowOrientation() that can be used to specify the - layout of the window contents in relation to the screen. The - window orientation determines the actual buffer layout of the - window, and the windowing system uses this value to rotate the - window before it ends up on the display, and to ensure that input - coordinates are in the correct coordinate space relative to the - application. - - On the other hand, the content orientation is simply a hint to the - windowing system about which orientation the window contents are in. - It's useful when you wish to keep the same buffer layout, but rotate - the contents instead, especially when doing rotation animations - between different orientations. The windowing system might use this - value to determine the layout of system popups or dialogs. + \section1 Content orientation + + QWindow has reportContentOrientationChange() that can be used to specify + the layout of the window contents in relation to the screen. The content + orientation is simply a hint to the windowing system about which + orientation the window contents are in. It's useful when you wish to keep + the same window size, but rotate the contents instead, especially when + doing rotation animations between different orientations. The windowing + system might use this value to determine the layout of system popups or + dialogs. \section1 Visibility and Windowing system exposure. @@ -661,9 +654,11 @@ void QWindow::lower() void QWindow::setOpacity(qreal level) { Q_D(QWindow); - if (d->platformWindow) { + if (level == d->opacity) // #fixme: Add property for 5.1 + return; + d->opacity = level; + if (d->platformWindow) d->platformWindow->setOpacity(level); - } } /*! @@ -743,8 +738,6 @@ bool QWindow::isActive() const to compute the necessary transform. The default value is Qt::PrimaryOrientation - - \sa requestOrientation(), QScreen::orientation() */ void QWindow::reportContentOrientationChange(Qt::ScreenOrientation orientation) { @@ -766,46 +759,6 @@ Qt::ScreenOrientation QWindow::contentOrientation() const } /*! - Requests the given window \a orientation. - - The window \a orientation specifies how the window should be rotated - by the window manager in order to be displayed. Input events will - be correctly mapped to the given \a orientation. - - The return value is false if the system doesn't support the given - \a orientation (for example when requesting a portrait orientation - on a device that only handles landscape buffers, typically a desktop - system). - - If the return value is false, call \l orientation() to get the actual - supported orientation. - - \sa orientation(), reportContentOrientationChange(), QScreen::orientation() -*/ -bool QWindow::requestOrientation(Qt::ScreenOrientation orientation) -{ - Q_D(QWindow); - if (!d->platformWindow) - create(); - Q_ASSERT(d->platformWindow); - d->windowOrientation = d->platformWindow->requestWindowOrientation(orientation); - return d->windowOrientation == orientation; -} - -/*! - Returns the actual window orientation. - - The default value is Qt::PrimaryOrientation. - - \sa requestOrientation() -*/ -Qt::ScreenOrientation QWindow::orientation() const -{ - Q_D(const QWindow); - return d->windowOrientation; -} - -/*! Returns the ratio between physical pixels and device-independent pixels for the window. This value is dependent on the screen the window is on, and may change when the window is moved. @@ -983,11 +936,59 @@ void QWindow::setMinimumSize(const QSize &size) emit minimumHeightChanged(d->minimumSize.height()); } +/*! + \property QWindow::x + \brief the x position of the window's geometry +*/ +void QWindow::setX(int arg) +{ + if (x() != arg) + setGeometry(QRect(arg, y(), width(), height())); +} + +/*! + \property QWindow::y + \brief the y position of the window's geometry +*/ +void QWindow::setY(int arg) +{ + if (y() != arg) + setGeometry(QRect(x(), arg, width(), height())); +} + +/*! + \property QWindow::width + \brief the width of the window's geometry +*/ +void QWindow::setWidth(int arg) +{ + if (width() != arg) + setGeometry(QRect(x(), y(), arg, height())); +} + +/*! + \property QWindow::height + \brief the height of the window's geometry +*/ +void QWindow::setHeight(int arg) +{ + if (height() != arg) + setGeometry(QRect(x(), y(), width(), arg)); +} + +/*! + \property QWindow::minimumWidth + \brief the minimum width of the window's geometry +*/ void QWindow::setMinimumWidth(int w) { setMinimumSize(QSize(w, minimumHeight())); } +/*! + \property QWindow::minimumHeight + \brief the minimum height of the window's geometry +*/ void QWindow::setMinimumHeight(int h) { setMinimumSize(QSize(minimumWidth(), h)); @@ -1016,11 +1017,19 @@ void QWindow::setMaximumSize(const QSize &size) emit maximumHeightChanged(d->maximumSize.height()); } +/*! + \property QWindow::maximumWidth + \brief the maximum width of the window's geometry +*/ void QWindow::setMaximumWidth(int w) { setMaximumSize(QSize(w, maximumHeight())); } +/*! + \property QWindow::maximumHeight + \brief the maximum height of the window's geometry +*/ void QWindow::setMaximumHeight(int h) { setMaximumSize(QSize(maximumWidth(), h)); @@ -1069,13 +1078,15 @@ void QWindow::setSizeIncrement(const QSize &size) } /*! - \fn void QWindow::setGeometry(int posx, int posy, int w, int h) - Sets the geometry of the window, excluding its window frame, to a rectangle constructed from \a posx, \a posy, \a w and \a h. \sa geometry() */ +void QWindow::setGeometry(int posx, int posy, int w, int h) +{ + setGeometry(QRect(posx, posy, w, h)); +} /*! \brief Sets the geometry of the window, excluding its window frame, to \a rect. @@ -1107,46 +1118,6 @@ void QWindow::setGeometry(const QRect &rect) } /*! - \property QWindow::x - \brief the x position of the window's geometry -*/ - -/*! - \property QWindow::y - \brief the y position of the window's geometry -*/ - -/*! - \property QWindow::width - \brief the width of the window's geometry -*/ - -/*! - \property QWindow::height - \brief the height of the window's geometry -*/ - -/*! - \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() @@ -1221,18 +1192,24 @@ void QWindow::setFramePosition(const QPoint &point) } /*! - \fn void QWindow::setPosition(const QPoint &pt) \brief set the position of the window on the desktop to \a pt \sa position() */ +void QWindow::setPosition(const QPoint &pt) +{ + setGeometry(QRect(pt, size())); +} /*! - \fn void QWindow::setPosition(int posx, int posy) \brief set the position of the window on the desktop to \a posx, \a posy \sa position() */ +void QWindow::setPosition(int posx, int posy) +{ + setPosition(QPoint(posx, posy)); +} /*! \fn QPoint QWindow::position() const @@ -1249,13 +1226,15 @@ void QWindow::setFramePosition(const QPoint &point) */ /*! - \fn void QWindow::resize(int w, int h) - set the size of the window, excluding any window frame, to a QSize constructed from width \a w and height \a h \sa size(), geometry() */ +void QWindow::resize(int w, int h) +{ + resize(QSize(w, h)); +} /*! \brief set the size of the window, excluding any window frame, to \a newSize diff --git a/src/gui/kernel/qwindow.h b/src/gui/kernel/qwindow.h index 229275d7c7..c1a8e7971a 100644 --- a/src/gui/kernel/qwindow.h +++ b/src/gui/kernel/qwindow.h @@ -113,35 +113,6 @@ class Q_GUI_EXPORT QWindow : public QObject, public QSurface Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged) Q_PROPERTY(Qt::ScreenOrientation contentOrientation READ contentOrientation WRITE reportContentOrientationChange NOTIFY contentOrientationChanged) - // ------------------------------------------------------------------------ - // Temporary backwards-compatibility properties to be removed ASAP - Q_PROPERTY(QString windowTitle READ windowTitle WRITE setWindowTitle) - Q_PROPERTY(QString windowFilePath READ windowFilePath WRITE setWindowFilePath) - Q_PROPERTY(QIcon windowIcon READ windowIcon WRITE setWindowIcon) - Q_PROPERTY(Qt::WindowModality windowModality READ windowModality WRITE setWindowModality NOTIFY windowModalityChanged) - -public: - - Qt::WindowModality windowModality() const { return modality(); } - void setWindowModality(Qt::WindowModality wm) { setModality(wm); } - void setWindowFlags(Qt::WindowFlags f) { setFlags(f); } - Qt::WindowFlags windowFlags() const { return flags(); } - Qt::WindowType windowType() const { return type(); } - QString windowTitle() const { return title(); } - void requestActivateWindow() { requestActivate(); } - bool requestWindowOrientation(Qt::ScreenOrientation o) { return requestOrientation(o); } - Qt::ScreenOrientation windowOrientation() const { return orientation(); } - void setWindowFilePath(const QString &fp) { setFilePath(fp); } - QString windowFilePath() const { return filePath(); } - void setWindowIcon(const QIcon &i) { setIcon(i); } - QIcon windowIcon() const { return icon(); } - void setWindowTitle(const QString &t) { setTitle(t); } - -Q_SIGNALS: - void windowModalityChanged(Qt::WindowModality windowModality); - // End of temporary backwards-compatibility properties - // ------------------------------------------------------------------------ - public: explicit QWindow(QScreen *screen = 0); @@ -186,9 +157,6 @@ public: qreal devicePixelRatio() const; - bool requestOrientation(Qt::ScreenOrientation orientation); - Qt::ScreenOrientation orientation() const; - Qt::WindowState windowState() const; void setWindowState(Qt::WindowState state); @@ -204,10 +172,10 @@ 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(); } + inline int minimumWidth() const { return minimumSize().width(); } + inline int minimumHeight() const { return minimumSize().height(); } + inline int maximumWidth() const { return maximumSize().width(); } + inline int maximumHeight() const { return maximumSize().height(); } QSize minimumSize() const; QSize maximumSize() const; @@ -219,7 +187,7 @@ public: void setBaseSize(const QSize &size); void setSizeIncrement(const QSize &size); - void setGeometry(int posx, int posy, int w, int h) { setGeometry(QRect(posx, posy, w, h)); } + void setGeometry(int posx, int posy, int w, int h); void setGeometry(const QRect &rect); QRect geometry() const; @@ -237,18 +205,11 @@ public: inline QSize size() const { return geometry().size(); } inline QPoint position() const { return geometry().topLeft(); } - inline void setPosition(const QPoint &pt) { setGeometry(QRect(pt, size())); } - inline void setPosition(int posx, int posy) { setPosition(QPoint(posx, posy)); } - -// Temporary backwards-compatible accessors for the benefit of Declarative -// to be removed ASAP - inline void setFramePos(const QPoint &pt) { setFramePosition(pt); } - inline void setPos(const QPoint &pt) { setPosition(pt); } - inline void setPos(int posx, int posy) { setPosition(posx, posy); } -// end of temporary accessors + void setPosition(const QPoint &pt); + void setPosition(int posx, int posy); void resize(const QSize &newSize); - inline void resize(int w, int h) { resize(QSize(w, h)); } + void resize(int w, int h); void setFilePath(const QString &filePath); QString filePath() const; @@ -295,29 +256,10 @@ public Q_SLOTS: void setTitle(const QString &); - void setX(int arg) - { - if (x() != arg) - setGeometry(QRect(arg, y(), width(), height())); - } - - void setY(int arg) - { - if (y() != arg) - setGeometry(QRect(x(), arg, width(), height())); - } - - void setWidth(int arg) - { - if (width() != arg) - setGeometry(QRect(x(), y(), arg, height())); - } - - void setHeight(int arg) - { - if (height() != arg) - setGeometry(QRect(x(), y(), width(), arg)); - } + void setX(int arg); + void setY(int arg); + void setWidth(int arg); + void setHeight(int arg); void setMinimumWidth(int w); void setMinimumHeight(int h); diff --git a/src/gui/kernel/qwindow_p.h b/src/gui/kernel/qwindow_p.h index fcc5540185..305888d02c 100644 --- a/src/gui/kernel/qwindow_p.h +++ b/src/gui/kernel/qwindow_p.h @@ -89,7 +89,7 @@ public: , receivedExpose(false) , positionPolicy(WindowFrameExclusive) , contentOrientation(Qt::PrimaryOrientation) - , windowOrientation(Qt::PrimaryOrientation) + , opacity(qreal(1.0)) , minimumSize(0, 0) , maximumSize(QWINDOWSIZE_MAX, QWINDOWSIZE_MAX) , modality(Qt::NonModal) @@ -136,7 +136,7 @@ public: bool receivedExpose; PositionPolicy positionPolicy; Qt::ScreenOrientation contentOrientation; - Qt::ScreenOrientation windowOrientation; + qreal opacity; QSize minimumSize; QSize maximumSize; diff --git a/src/gui/math3d/qmatrix4x4.cpp b/src/gui/math3d/qmatrix4x4.cpp index 4e35d49118..e0f401bc10 100644 --- a/src/gui/math3d/qmatrix4x4.cpp +++ b/src/gui/math3d/qmatrix4x4.cpp @@ -45,6 +45,8 @@ #include <QtGui/qmatrix.h> #include <QtGui/qtransform.h> +#include <cmath> + QT_BEGIN_NAMESPACE #ifndef QT_NO_MATRIX4X4 @@ -1456,27 +1458,29 @@ void QMatrix4x4::frustum(float left, float right, float bottom, float top, float /*! Multiplies this matrix by another that applies a perspective - projection. The field of view will be \a angle degrees within - a window with a given \a aspect ratio. The projection will - have the specified \a nearPlane and \a farPlane clipping planes. + projection. The vertical field of view will be \a verticalAngle degrees + within a window with a given \a aspectRatio that determines the horizontal + field of view. + The projection will have the specified \a nearPlane and \a farPlane clipping + planes which are the distances from the viewer to the corresponding planes. \sa ortho(), frustum() */ -void QMatrix4x4::perspective(float angle, float aspect, float nearPlane, float farPlane) +void QMatrix4x4::perspective(float verticalAngle, float aspectRatio, float nearPlane, float farPlane) { // Bail out if the projection volume is zero-sized. - if (nearPlane == farPlane || aspect == 0.0f) + if (nearPlane == farPlane || aspectRatio == 0.0f) return; // Construct the projection. QMatrix4x4 m(1); - float radians = (angle / 2.0f) * M_PI / 180.0f; + float radians = (verticalAngle / 2.0f) * M_PI / 180.0f; float sine = sinf(radians); if (sine == 0.0f) return; float cotan = cosf(radians) / sine; float clip = farPlane - nearPlane; - m.m[0][0] = cotan / aspect; + m.m[0][0] = cotan / aspectRatio; m.m[1][0] = 0.0f; m.m[2][0] = 0.0f; m.m[3][0] = 0.0f; diff --git a/src/gui/math3d/qmatrix4x4.h b/src/gui/math3d/qmatrix4x4.h index bbad04b8b1..df98f0291a 100644 --- a/src/gui/math3d/qmatrix4x4.h +++ b/src/gui/math3d/qmatrix4x4.h @@ -146,7 +146,7 @@ public: void ortho(const QRectF& rect); void ortho(float left, float right, float bottom, float top, float nearPlane, float farPlane); void frustum(float left, float right, float bottom, float top, float nearPlane, float farPlane); - void perspective(float angle, float aspect, float nearPlane, float farPlane); + void perspective(float verticalAngle, float aspectRatio, float nearPlane, float farPlane); #ifndef QT_NO_VECTOR3D void lookAt(const QVector3D& eye, const QVector3D& center, const QVector3D& up); #endif diff --git a/src/gui/math3d/qquaternion.cpp b/src/gui/math3d/qquaternion.cpp index 3f39fa43c3..2ccdd315d3 100644 --- a/src/gui/math3d/qquaternion.cpp +++ b/src/gui/math3d/qquaternion.cpp @@ -45,6 +45,8 @@ #include <QtCore/qvariant.h> #include <QtCore/qdebug.h> +#include <cmath> + QT_BEGIN_NAMESPACE #ifndef QT_NO_QUATERNION diff --git a/src/gui/opengl/opengl.pri b/src/gui/opengl/opengl.pri index c241354e9c..2256f201d2 100644 --- a/src/gui/opengl/opengl.pri +++ b/src/gui/opengl/opengl.pri @@ -46,5 +46,3 @@ contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles2) { opengl/qtriangulator.cpp } - -#INCLUDEPATH += ../3rdparty/harfbuzz/src diff --git a/src/gui/opengl/qopenglpaintdevice.cpp b/src/gui/opengl/qopenglpaintdevice.cpp index b2ffac69ca..79e692b8cf 100644 --- a/src/gui/opengl/qopenglpaintdevice.cpp +++ b/src/gui/opengl/qopenglpaintdevice.cpp @@ -63,11 +63,47 @@ QT_BEGIN_NAMESPACE \ingroup painting-3D + The QOpenGLPaintDevice uses the current QOpenGL context to render + QPainter draw commands. It requires OpenGL (ES) 2.0 support or + higher. + + \section1 Performance + + The QOpenGLPaintDevice is almost always hardware accelerated and + has the potential of being much faster than software + rasterization. However, it is more sensitive to state changes, and + therefore requires the drawing commands to be carefully ordered to + achieve optimal performance. + + \section1 Antialiasing and Quality + + Antialiasing in the OpenGL paint engine is done using + multisampling. Most hardware require significantly more memory to + do multisampling and the resulting quality is not on par with the + quality of the software paint engine. The OpenGL paint engine's + strenght lies in its performance, not its visual rendering + quality. + + \section1 State Changes + When painting to a QOpenGLPaintDevice using QPainter, the state of - the current OpenGL context will be altered by the paint engine to reflect - its needs. Applications should not rely upon the OpenGL state being reset - to its original conditions, particularly the current shader program, - OpenGL viewport, texture units, and drawing modes. + the current OpenGL context will be altered by the paint engine to + reflect its needs. Applications should not rely upon the OpenGL + state being reset to its original conditions, particularly the + current shader program, OpenGL viewport, texture units, and + drawing modes. + + \section1 Mixing QPainter and OpenGL + + When intermixing QPainter and OpenGL, it is important to notify + QPainter that the OpenGL state may have been cluttered so it can + restore its internal state. This is acheived by calling \l + QPainter::beginNativePainting() before starting the OpenGL + rendering and calling \l QPainter::endNativePainting() after + finishing. + + \sa {OpenGL Window Example} + */ class QOpenGLPaintDevicePrivate diff --git a/src/gui/painting/qcolor.cpp b/src/gui/painting/qcolor.cpp index 72ca7ad8a8..e7d68f6df8 100644 --- a/src/gui/painting/qcolor.cpp +++ b/src/gui/painting/qcolor.cpp @@ -503,7 +503,7 @@ QString QColor::name() const \li #RRGGBB \li #RRRGGGBBB \li #RRRRGGGGBBBB - \li A name from the list of colors defined in the list of \l{SVG color keyword names} + \li A name from the list of colors defined in the list of \l{http://www.w3.org/TR/SVG/types.html#ColorKeywords}{SVG color keyword names} provided by the World Wide Web Consortium; for example, "steelblue" or "gainsboro". These color names work on all platforms. Note that these color names are \e not the same as defined by the Qt::GlobalColor enums, e.g. "green" and Qt::green does not diff --git a/src/gui/painting/qdrawhelper_ssse3.cpp b/src/gui/painting/qdrawhelper_ssse3.cpp index 09e0516dcb..9f80c70fcc 100644 --- a/src/gui/painting/qdrawhelper_ssse3.cpp +++ b/src/gui/painting/qdrawhelper_ssse3.cpp @@ -60,7 +60,7 @@ inline static void blend_pixel(quint32 &dst, const quint32 src) shift (4, 8, 12). Checking the alignment inside the loop is unfortunatelly way too slow. */ #define BLENDING_LOOP(palignrOffset, length)\ - for (; x < length-3; x += 4) { \ + for (; x-minusOffsetToAlignSrcOn16Bytes < length-7; x += 4) { \ const __m128i srcVectorLastLoaded = _mm_load_si128((__m128i *)&src[x - minusOffsetToAlignSrcOn16Bytes + 4]);\ const __m128i srcVector = _mm_alignr_epi8(srcVectorLastLoaded, srcVectorPrevLoaded, palignrOffset); \ const __m128i srcVectorAlpha = _mm_and_si128(srcVector, alphaMask); \ diff --git a/src/gui/painting/qmath_p.h b/src/gui/painting/qmath_p.h index c710ee462a..bc7bb320b7 100644 --- a/src/gui/painting/qmath_p.h +++ b/src/gui/painting/qmath_p.h @@ -61,6 +61,7 @@ QT_BEGIN_NAMESPACE static const qreal Q_PI = qreal(3.14159265358979323846); // pi static const qreal Q_2PI = qreal(6.28318530717958647693); // 2*pi static const qreal Q_PI2 = qreal(1.57079632679489661923); // pi/2 +static const qreal Q_MM_PER_INCH = 25.4; inline int qIntSqrtInt(int v) { diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 46648fe297..0e9129f8c0 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -4588,7 +4588,7 @@ void QSpanData::setupMatrix(const QTransform &matrix, int bilin) txop = inv.type(); bilinear = bilin; - const bool affine = !m13 && !m23; + const bool affine = inv.isAffine(); fast_matrix = affine && m11 * m11 + m21 * m21 < 1e4 && m12 * m12 + m22 * m22 < 1e4 diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp index e87e6eb83b..5714645728 100644 --- a/src/gui/text/qfontdatabase.cpp +++ b/src/gui/text/qfontdatabase.cpp @@ -273,27 +273,15 @@ struct QtFontFoundry QtFontStyle *QtFontFoundry::style(const QtFontStyle::Key &key, const QString &styleName, bool create) { int pos = 0; - if (count) { - // if styleName for searching first if possible - if (!styleName.isEmpty()) { - for (; pos < count; pos++) { - if (styles[pos]->styleName == styleName) - return styles[pos]; - } - } - int low = 0; - int high = count; - pos = count / 2; - while (high > low) { + for (; pos < count; pos++) { + bool hasStyleName = !styleName.isEmpty(); // search styleName first if available + if (hasStyleName && !styles[pos]->styleName.isEmpty()) { + if (styles[pos]->styleName == styleName) + return styles[pos]; + } else { if (styles[pos]->key == key) return styles[pos]; - if (styles[pos]->key < key) - low = pos + 1; - else - high = pos; - pos = (high + low) / 2; } - pos = low; } if (!create) return 0; @@ -308,7 +296,6 @@ QtFontStyle *QtFontFoundry::style(const QtFontStyle::Key &key, const QString &st QtFontStyle *style = new QtFontStyle(key); style->styleName = styleName; - memmove(styles + pos + 1, styles + pos, (count-pos)*sizeof(QtFontStyle *)); styles[pos] = style; count++; return styles[pos]; @@ -594,7 +581,7 @@ QtFontFamily *QFontDatabasePrivate::family(const QString &f, bool create) if (res < 0) pos++; - // qDebug("adding family %s at %d total=%d", f.latin1(), pos, count); + // qDebug() << "adding family " << f.toLatin1() << " at " << pos << " total=" << count; if (!(count % 8)) { QtFontFamily **newFamilies = (QtFontFamily **) realloc(families, diff --git a/src/gui/text/qfontdatabase_qpa.cpp b/src/gui/text/qfontdatabase_qpa.cpp index 366f995790..70a8af0b66 100644 --- a/src/gui/text/qfontdatabase_qpa.cpp +++ b/src/gui/text/qfontdatabase_qpa.cpp @@ -52,7 +52,8 @@ QT_BEGIN_NAMESPACE -Q_GUI_EXPORT void qt_registerFont(const QString &familyName, const QString &foundryname, int weight, +Q_GUI_EXPORT void qt_registerFont(const QString &familyName, const QString &stylename, + const QString &foundryname, int weight, QFont::Style style, int stretch, bool antialiased, bool scalable, int pixelSize, bool fixedPitch, const QSupportedWritingSystems &writingSystems, void *handle) @@ -75,7 +76,7 @@ Q_GUI_EXPORT void qt_registerFont(const QString &familyName, const QString &fou } QtFontFoundry *foundry = f->foundry(foundryname, true); - QtFontStyle *fontStyle = foundry->style(styleKey, QString(), true); + QtFontStyle *fontStyle = foundry->style(styleKey, stylename, true); fontStyle->smoothScalable = scalable; fontStyle->antialiased = antialiased; QtFontSize *size = fontStyle->pixelSize(pixelSize ? pixelSize : SMOOTH_SCALABLE, true); diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp index b9a7e69c9d..aa9879882b 100644 --- a/src/gui/text/qfontengine_ft.cpp +++ b/src/gui/text/qfontengine_ft.cpp @@ -588,6 +588,16 @@ static void convertRGBToARGB_V(const uchar *src, uint *dst, int width, int heigh } } +static void convertGRAYToARGB(const uchar *src, uint *dst, int width, int height, int src_pitch) { + for (int y = 0; y < height; ++y) { + int readpos = (y * src_pitch); + int writepos = (y * width); + for (int x = 0; x < width; ++x) { + dst[writepos + x] = (0xFF << 24) + (src[readpos + x] << 16) + (src[readpos + x] << 8) + src[readpos + x]; + } + } +} + static void convoluteBitmap(const uchar *src, uchar *dst, int width, int height, int pitch) { // convolute the bitmap with a triangle filter to get rid of color fringes @@ -1016,7 +1026,7 @@ QFontEngineFT::Glyph *QFontEngineFT::loadGlyph(QGlyphSet *set, uint glyph, bitmap.rows = info.height*vfactor; bitmap.width = hpixels; bitmap.pitch = format == Format_Mono ? (((info.width + 31) & ~31) >> 3) : ((bitmap.width + 3) & ~3); - if (!hsubpixel && vfactor == 1) + if (!hsubpixel && vfactor == 1 && format != Format_A32) bitmap.buffer = glyph_buffer; else bitmap.buffer = new uchar[bitmap.rows*bitmap.pitch]; @@ -1047,6 +1057,8 @@ QFontEngineFT::Glyph *QFontEngineFT::loadGlyph(QGlyphSet *set, uint glyph, delete [] convoluted; } else if (vfactor != 1) { convertRGBToARGB_V(bitmap.buffer, (uint *)glyph_buffer, info.width, info.height, bitmap.pitch, subpixelType != QFontEngineFT::Subpixel_VRGB, true); + } else if (format == Format_A32 && bitmap.pixel_mode == FT_PIXEL_MODE_GRAY) { + convertGRAYToARGB(bitmap.buffer, (uint *)glyph_buffer, info.width, info.height, bitmap.pitch); } if (bitmap.buffer != glyph_buffer) diff --git a/src/gui/text/qplatformfontdatabase.cpp b/src/gui/text/qplatformfontdatabase.cpp index f3e573e313..903b1e4c3d 100644 --- a/src/gui/text/qplatformfontdatabase.cpp +++ b/src/gui/text/qplatformfontdatabase.cpp @@ -47,7 +47,8 @@ QT_BEGIN_NAMESPACE -extern void qt_registerFont(const QString &familyname, const QString &foundryname, int weight, +extern void qt_registerFont(const QString &familyname, const QString &stylename, + const QString &foundryname, int weight, QFont::Style style, int stretch, bool antialiased, bool scalable, int pixelSize, bool fixedPitch, const QSupportedWritingSystems &writingSystems, void *hanlde); @@ -89,7 +90,7 @@ void QPlatformFontDatabase::registerQPF2Font(const QByteArray &dataArray, void * } } QFont::Stretch stretch = QFont::Unstretched; - registerFont(fontName,QString(),fontWeight,fontStyle,stretch,true,false,pixelSize,false,writingSystems,handle); + registerFont(fontName,QString(),QString(),fontWeight,fontStyle,stretch,true,false,pixelSize,false,writingSystems,handle); } } else { qDebug() << "header verification of QPF2 font failed. maybe it is corrupt?"; @@ -117,7 +118,8 @@ void QPlatformFontDatabase::registerQPF2Font(const QByteArray &dataArray, void * \sa registerQPF2Font() */ -void QPlatformFontDatabase::registerFont(const QString &familyname, const QString &foundryname, QFont::Weight weight, +void QPlatformFontDatabase::registerFont(const QString &familyname, const QString &stylename, + const QString &foundryname, QFont::Weight weight, QFont::Style style, QFont::Stretch stretch, bool antialiased, bool scalable, int pixelSize, bool fixedPitch, const QSupportedWritingSystems &writingSystems, void *usrPtr) @@ -125,7 +127,7 @@ void QPlatformFontDatabase::registerFont(const QString &familyname, const QStrin if (scalable) pixelSize = 0; - qt_registerFont(familyname, foundryname, weight, style, + qt_registerFont(familyname, stylename, foundryname, weight, style, stretch, antialiased, scalable, pixelSize, fixedPitch, writingSystems, usrPtr); } diff --git a/src/gui/text/qplatformfontdatabase.h b/src/gui/text/qplatformfontdatabase.h index fe7782be8f..7d9834fa37 100644 --- a/src/gui/text/qplatformfontdatabase.h +++ b/src/gui/text/qplatformfontdatabase.h @@ -116,7 +116,8 @@ public: //callback static void registerQPF2Font(const QByteArray &dataArray, void *handle); - static void registerFont(const QString &familyname, const QString &foundryname, QFont::Weight weight, + static void registerFont(const QString &familyname, const QString &stylename, + const QString &foundryname, QFont::Weight weight, QFont::Style style, QFont::Stretch stretch, bool antialiased, bool scalable, int pixelSize, bool fixedPitch, const QSupportedWritingSystems &writingSystems, void *handle); diff --git a/src/gui/text/text.pri b/src/gui/text/text.pri index face6f248f..436b7c7aec 100644 --- a/src/gui/text/text.pri +++ b/src/gui/text/text.pri @@ -85,5 +85,3 @@ SOURCES += \ HEADERS += \ text/qplatformfontdatabase.h - -INCLUDEPATH += ../3rdparty/harfbuzz/src diff --git a/src/gui/util/qdesktopservices.cpp b/src/gui/util/qdesktopservices.cpp index ca284eecd5..94a3343164 100644 --- a/src/gui/util/qdesktopservices.cpp +++ b/src/gui/util/qdesktopservices.cpp @@ -250,6 +250,8 @@ void QDesktopServices::unsetUrlHandler(const QString &scheme) /*! \enum QDesktopServices::StandardLocation \since 4.4 + \obsolete + Use QStandardPaths::StandardLocation This enum describes the different locations that can be queried by QDesktopServices::storageLocation and QDesktopServices::displayName. |