diff options
Diffstat (limited to 'src')
72 files changed, 601 insertions, 309 deletions
diff --git a/src/3rdparty/sha3/KeccakF-1600-opt64.c b/src/3rdparty/sha3/KeccakF-1600-opt64.c index 7bd442ef69..a547bb5a89 100755..100644 --- a/src/3rdparty/sha3/KeccakF-1600-opt64.c +++ b/src/3rdparty/sha3/KeccakF-1600-opt64.c @@ -328,7 +328,7 @@ static void KeccakPermutation(unsigned char *state) KeccakPermutationOnWords((UINT64*)state); } -#if 0 // Unused in the Qt configuration +#if (PLATFORM_BYTE_ORDER == IS_BIG_ENDIAN) static void fromBytesToWord(UINT64 *word, const UINT8 *bytes) { unsigned int i; @@ -449,7 +449,7 @@ static void KeccakAbsorb(unsigned char *state, const unsigned char *data, unsign #endif } -#if 0 // Unused in the Qt configuration +#if (PLATFORM_BYTE_ORDER == IS_BIG_ENDIAN) static void fromWordToBytes(UINT8 *bytes, const UINT64 word) { unsigned int i; diff --git a/src/3rdparty/sqlite.pri b/src/3rdparty/sqlite.pri index 58d4ddd9a1..072502c8e9 100644 --- a/src/3rdparty/sqlite.pri +++ b/src/3rdparty/sqlite.pri @@ -1,6 +1,7 @@ CONFIG(release, debug|release):DEFINES *= NDEBUG DEFINES += SQLITE_OMIT_LOAD_EXTENSION SQLITE_OMIT_COMPLETE SQLITE_ENABLE_FTS3 SQLITE_ENABLE_FTS3_PARENTHESIS SQLITE_ENABLE_RTREE !contains(CONFIG, largefile):DEFINES += SQLITE_DISABLE_LFS +contains(QT_CONFIG, posix_fallocate):DEFINES += HAVE_POSIX_FALLOCATE=1 winrt: DEFINES += SQLITE_OS_WINRT INCLUDEPATH += $$PWD/sqlite SOURCES += $$PWD/sqlite/sqlite3.c diff --git a/src/android/java/AndroidManifest.xml b/src/android/java/AndroidManifest.xml index cfad4553ee..defbe502ef 100644 --- a/src/android/java/AndroidManifest.xml +++ b/src/android/java/AndroidManifest.xml @@ -1,6 +1,6 @@ <?xml version='1.0' encoding='utf-8'?> <manifest package="org.qtproject.example" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.0" android:versionCode="1" android:installLocation="auto"> - <application android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="@string/app_name"> + <application android:hardwareAccelerated="true" android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="@string/app_name"> <activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|locale|fontScale|keyboard|keyboardHidden|navigation" android:name="org.qtproject.qt5.android.bindings.QtActivity" android:label="@string/app_name" diff --git a/src/corelib/doc/qtcore.qdocconf b/src/corelib/doc/qtcore.qdocconf index 9ab66c6645..fa5afb033c 100644 --- a/src/corelib/doc/qtcore.qdocconf +++ b/src/corelib/doc/qtcore.qdocconf @@ -26,7 +26,7 @@ qhp.QtCore.subprojects.classes.sortPages = true tagfile = ../../../doc/qtcore/qtcore.tags -depends += qtgui qtwidgets qtnetwork qtdoc qtquick qtlinguist qtdesigner qtconcurrent qtxml +depends += qtgui qtwidgets qtnetwork qtdoc qtquick qtlinguist qtdesigner qtconcurrent qtxml qmake headerdirs += .. diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index f72d27c2e5..041b522023 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -76,7 +76,7 @@ #include <CoreServices/CoreServices.h> #endif -#if defined(Q_OS_ANDROID) +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) #include <private/qjni_p.h> #endif @@ -2400,7 +2400,7 @@ typedef uint SeedStorageType; typedef QThreadStorage<SeedStorageType *> SeedStorage; Q_GLOBAL_STATIC(SeedStorage, randTLS) // Thread Local Storage for seed value -#elif defined(Q_OS_ANDROID) +#elif defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) typedef QThreadStorage<QJNIObjectPrivate> AndroidRandomStorage; Q_GLOBAL_STATIC(AndroidRandomStorage, randomTLS) #endif @@ -2436,7 +2436,7 @@ void qsrand(uint seed) //global static object, fallback to srand(seed) srand(seed); } -#elif defined(Q_OS_ANDROID) +#elif defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) if (randomTLS->hasLocalData()) { randomTLS->localData().callMethod<void>("setSeed", "(J)V", jlong(seed)); return; @@ -2492,7 +2492,7 @@ int qrand() //global static object, fallback to rand() return rand(); } -#elif defined(Q_OS_ANDROID) +#elif defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) AndroidRandomStorage *randomStorage = randomTLS(); if (!randomStorage) return rand(); diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp index 624f45caaf..a60bcde30d 100644 --- a/src/corelib/io/qdir.cpp +++ b/src/corelib/io/qdir.cpp @@ -85,10 +85,10 @@ static QString driveSpec(const QString &path) //************* QDirPrivate QDirPrivate::QDirPrivate(const QString &path, const QStringList &nameFilters_, QDir::SortFlags sort_, QDir::Filters filters_) : QSharedData() + , fileListsInitialized(false) , nameFilters(nameFilters_) , sort(sort_) , filters(filters_) - , fileListsInitialized(false) { setPath(path.isEmpty() ? QString::fromLatin1(".") : path); @@ -108,10 +108,10 @@ QDirPrivate::QDirPrivate(const QString &path, const QStringList &nameFilters_, Q QDirPrivate::QDirPrivate(const QDirPrivate ©) : QSharedData(copy) + , fileListsInitialized(false) , nameFilters(copy.nameFilters) , sort(copy.sort) , filters(copy.filters) - , fileListsInitialized(false) , dirEntry(copy.dirEntry) , metaData(copy.metaData) { diff --git a/src/corelib/io/qdir_p.h b/src/corelib/io/qdir_p.h index efcac439cd..bf7726db2f 100644 --- a/src/corelib/io/qdir_p.h +++ b/src/corelib/io/qdir_p.h @@ -73,16 +73,16 @@ public: void resolveAbsoluteEntry() const; + mutable bool fileListsInitialized; + mutable QStringList files; + mutable QFileInfoList fileInfos; + QStringList nameFilters; QDir::SortFlags sort; QDir::Filters filters; QScopedPointer<QAbstractFileEngine> fileEngine; - mutable bool fileListsInitialized; - mutable QStringList files; - mutable QFileInfoList fileInfos; - QFileSystemEntry dirEntry; mutable QFileSystemEntry absoluteDirEntry; mutable QFileSystemMetaData metaData; diff --git a/src/corelib/io/qfiledevice.cpp b/src/corelib/io/qfiledevice.cpp index f25933816a..d2c8d37d4a 100644 --- a/src/corelib/io/qfiledevice.cpp +++ b/src/corelib/io/qfiledevice.cpp @@ -53,9 +53,9 @@ QT_BEGIN_NAMESPACE static const int QFILE_WRITEBUFFER_SIZE = 16384; QFileDevicePrivate::QFileDevicePrivate() - : fileEngine(0), lastWasWrite(false), - writeBuffer(QFILE_WRITEBUFFER_SIZE), error(QFile::NoError), - cachedSize(0) + : fileEngine(0), + writeBuffer(QFILE_WRITEBUFFER_SIZE), cachedSize(0), + error(QFile::NoError), lastWasWrite(false) { } diff --git a/src/corelib/io/qfiledevice_p.h b/src/corelib/io/qfiledevice_p.h index 4c9cf7b627..79d8427c0d 100644 --- a/src/corelib/io/qfiledevice_p.h +++ b/src/corelib/io/qfiledevice_p.h @@ -70,21 +70,22 @@ protected: virtual QAbstractFileEngine *engine() const; - QFileDevice::FileHandleFlags handleFlags; - - mutable QAbstractFileEngine *fileEngine; - bool lastWasWrite; - QRingBuffer writeBuffer; inline bool ensureFlushed() const; bool putCharHelper(char c); - QFileDevice::FileError error; void setError(QFileDevice::FileError err); void setError(QFileDevice::FileError err, const QString &errorString); void setError(QFileDevice::FileError err, int errNum); + mutable QAbstractFileEngine *fileEngine; + QRingBuffer writeBuffer; mutable qint64 cachedSize; + + QFileDevice::FileHandleFlags handleFlags; + QFileDevice::FileError error; + + bool lastWasWrite; }; inline bool QFileDevicePrivate::ensureFlushed() const diff --git a/src/corelib/io/qtextstream_p.h b/src/corelib/io/qtextstream_p.h index d5d5288426..ac6529e195 100644 --- a/src/corelib/io/qtextstream_p.h +++ b/src/corelib/io/qtextstream_p.h @@ -88,6 +88,21 @@ class QTextStreamPrivate { Q_DECLARE_PUBLIC(QTextStream) public: + // streaming parameters + class Params + { + public: + void reset(); + + int realNumberPrecision; + int integerBase; + int fieldWidth; + QChar padChar; + QTextStream::FieldAlignment fieldAlignment; + QTextStream::RealNumberNotation realNumberNotation; + QTextStream::NumberFlags numberFlags; + }; + QTextStreamPrivate(QTextStream *q_ptr); ~QTextStreamPrivate(); void reset(); @@ -97,7 +112,6 @@ public: #ifndef QT_NO_QOBJECT QDeviceClosedNotifier deviceClosedNotifier; #endif - bool deleteDevice; // string QString *string; @@ -110,6 +124,24 @@ public: QTextCodec::ConverterState readConverterState; QTextCodec::ConverterState writeConverterState; QTextCodec::ConverterState *readConverterSavedState; +#endif + + QString writeBuffer; + QString readBuffer; + int readBufferOffset; + int readConverterSavedStateOffset; //the offset between readBufferStartDevicePos and that start of the buffer + qint64 readBufferStartDevicePos; + + Params params; + + // status + QTextStream::Status status; + QLocale locale; + QTextStream *q_ptr; + + int lastTokenSize; + bool deleteDevice; +#ifndef QT_NO_TEXTCODEC bool autoDetectUnicode; #endif @@ -128,7 +160,6 @@ public: inline void consume(int nchars); void saveConverterState(qint64 newPos); void restoreToSavedConverterState(); - int lastTokenSize; // Return value type for getNumber() enum NumberParsingStatus { @@ -150,34 +181,6 @@ public: bool fillReadBuffer(qint64 maxBytes = -1); void resetReadBuffer(); void flushWriteBuffer(); - QString writeBuffer; - QString readBuffer; - int readBufferOffset; - int readConverterSavedStateOffset; //the offset between readBufferStartDevicePos and that start of the buffer - qint64 readBufferStartDevicePos; - - // streaming parameters - class Params - { - public: - void reset(); - - int realNumberPrecision; - int integerBase; - int fieldWidth; - QChar padChar; - QTextStream::FieldAlignment fieldAlignment; - QTextStream::RealNumberNotation realNumberNotation; - QTextStream::NumberFlags numberFlags; - }; - Params params; - - // status - QTextStream::Status status; - - QLocale locale; - - QTextStream *q_ptr; }; QT_END_NAMESPACE diff --git a/src/corelib/json/qjsonobject.cpp b/src/corelib/json/qjsonobject.cpp index afc0d5f71f..27e51cf4ac 100644 --- a/src/corelib/json/qjsonobject.cpp +++ b/src/corelib/json/qjsonobject.cpp @@ -783,6 +783,8 @@ QJsonObject::const_iterator QJsonObject::constFind(const QString &key) const /*! \class QJsonObject::const_iterator \inmodule QtCore + \ingroup json + \since 5.0 \brief The QJsonObject::const_iterator class provides an STL-style const iterator for QJsonObject. QJsonObject::const_iterator allows you to iterate over a QJsonObject. diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 29c5a3dd24..50d4583dea 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -1949,7 +1949,7 @@ void QObjectPrivate::setParent_helper(QObject *o) } } } - if (!isDeletingChildren && declarativeData && QAbstractDeclarativeData::parentChanged) + if (!wasDeleted && !isDeletingChildren && declarativeData && QAbstractDeclarativeData::parentChanged) QAbstractDeclarativeData::parentChanged(declarativeData, q, o); } diff --git a/src/corelib/plugin/qplugin.qdoc b/src/corelib/plugin/qplugin.qdoc index eacfe995ae..0a94077d95 100644 --- a/src/corelib/plugin/qplugin.qdoc +++ b/src/corelib/plugin/qplugin.qdoc @@ -109,6 +109,6 @@ the required plugins to your build. For example: \snippet code/doc_src_qplugin.pro 3 + \sa {Static Plugins}, {How to Create Qt Plugins}, {qmake-getting-started}{Getting Started with qmake} - \sa {Static Plugins}, {How to Create Qt Plugins}, {Using qmake} */ diff --git a/src/corelib/tools/qalgorithms.qdoc b/src/corelib/tools/qalgorithms.qdoc index cd389470a4..412b9cf3b2 100644 --- a/src/corelib/tools/qalgorithms.qdoc +++ b/src/corelib/tools/qalgorithms.qdoc @@ -49,9 +49,9 @@ iterators they accept. For example, qFill() accepts two \l {forward iterators}. The iterator types required are specified for each algorithm. If an iterator of the wrong type is passed (for - example, if QList::ConstIterator is passed as an \l {output - iterator}), you will always get a compiler error, although not - necessarily a very informative one. + example, if QList::ConstIterator is passed as an + \l {Output Iterators}{output iterator}), you will always get a + compiler error, although not necessarily a very informative one. Some algorithms have special requirements on the value type stored in the containers. For example, @@ -99,7 +99,7 @@ \section2 Output Iterators - An \e{output iterator} is an iterator that can be used for + An output iterator is an iterator that can be used for writing data sequentially to a container or to some output stream. It must provide the following operators: unary \c{*} for writing a value (i.e., \c{*it = val}) and prefix \c{++} for diff --git a/src/corelib/tools/qeasingcurve.cpp b/src/corelib/tools/qeasingcurve.cpp index 5daf067c71..2708901866 100644 --- a/src/corelib/tools/qeasingcurve.cpp +++ b/src/corelib/tools/qeasingcurve.cpp @@ -432,14 +432,14 @@ struct BezierEase : public QEasingCurveFunction qreal p3x, p3y; }; - bool _init; - bool _valid; QVector<SingleCubicBezier> _curves; - int _curveCount; QVector<qreal> _intervals; + int _curveCount; + bool _init; + bool _valid; BezierEase() - : QEasingCurveFunction(InOut), _init(false), _valid(false), _curves(10), _intervals(10) + : QEasingCurveFunction(InOut), _curves(10), _intervals(10), _init(false), _valid(false) { } void init() diff --git a/src/corelib/tools/qlocale_blackberry.cpp b/src/corelib/tools/qlocale_blackberry.cpp index 48faa73070..c2c3476b0a 100644 --- a/src/corelib/tools/qlocale_blackberry.cpp +++ b/src/corelib/tools/qlocale_blackberry.cpp @@ -60,7 +60,7 @@ static const char ppsRegionLocalePath[] = "/pps/services/locale/settings"; static const char ppsLanguageLocalePath[] = "/pps/services/confstr/_CS_LOCALE"; static const char ppsHourFormatPath[] = "/pps/system/settings"; -static const size_t ppsBufferSize = 256; +static const int MAX_PPS_SIZE = 16000; QBBSystemLocaleData::QBBSystemLocaleData() : languageNotifier(0) @@ -186,9 +186,24 @@ QByteArray QBBSystemLocaleData::readPpsValue(const char *ppsObject, int ppsFd) if (!ppsObject || ppsFd == -1) return result; - char buffer[ppsBufferSize]; + // PPS objects are of unknown size, but must be read all at once. + // Relying on the file size may not be a good idea since the size may change before reading. + // Let's try with an initial size (512), and if the buffer is too small try with bigger one, + // until we succeed or until other non buffer-size-related error occurs. + // Using QVarLengthArray means the first try (of size == 512) uses a buffer on the stack - no allocation necessary. + // Hopefully that covers most use cases. + int bytes; + QVarLengthArray<char, 512> buffer; + for (;;) { + errno = 0; + bytes = qt_safe_read(ppsFd, buffer.data(), buffer.capacity() - 1); + const bool bufferIsTooSmall = (bytes == -1 && errno == EMSGSIZE && buffer.capacity() < MAX_PPS_SIZE); + if (!bufferIsTooSmall) + break; + + buffer.resize(qMin(buffer.capacity()*2, MAX_PPS_SIZE)); + } - int bytes = qt_safe_read(ppsFd, buffer, ppsBufferSize - 1); // This method is called in the ctor(), so do not use qWarning to log warnings // if qt_safe_read fails to read the pps file // since the user code may install a message handler that invokes QLocale API again @@ -202,7 +217,7 @@ QByteArray QBBSystemLocaleData::readPpsValue(const char *ppsObject, int ppsFd) pps_decoder_t ppsDecoder; pps_decoder_initialize(&ppsDecoder, 0); - if (pps_decoder_parse_pps_str(&ppsDecoder, buffer) == PPS_DECODER_OK) { + if (pps_decoder_parse_pps_str(&ppsDecoder, buffer.data()) == PPS_DECODER_OK) { pps_decoder_push(&ppsDecoder, 0); const char *ppsBuff; if (pps_decoder_get_string(&ppsDecoder, ppsObject, &ppsBuff) == PPS_DECODER_OK) { diff --git a/src/corelib/tools/qregexp.cpp b/src/corelib/tools/qregexp.cpp index 88499ad9d9..d2b5adc974 100644 --- a/src/corelib/tools/qregexp.cpp +++ b/src/corelib/tools/qregexp.cpp @@ -1045,12 +1045,12 @@ public: #endif private: - uint c; // character classes QVector<QRegExpCharClassRange> r; // character ranges - bool n; // negative? #ifndef QT_NO_REGEXP_OPTIM QVector<int> occ1; // first-occurrence array #endif + uint c; // character classes + bool n; // negative? }; #else struct QRegExpCharClass diff --git a/src/corelib/tools/qregularexpression.cpp b/src/corelib/tools/qregularexpression.cpp index d5bd1dff00..e1cf82bb8c 100644 --- a/src/corelib/tools/qregularexpression.cpp +++ b/src/corelib/tools/qregularexpression.cpp @@ -813,8 +813,9 @@ struct QRegularExpressionPrivate : QSharedData int captureIndexForName(const QString &name) const; - QString pattern; + // sizeof(QSharedData) == 4, so start our members with an enum QRegularExpression::PatternOptions patternOptions; + QString pattern; // *All* of the following members are set managed while holding this mutex, // except for isDirty which is set to true by QRegularExpression setters @@ -889,7 +890,7 @@ QRegularExpression::QRegularExpression(QRegularExpressionPrivate &dd) \internal */ QRegularExpressionPrivate::QRegularExpressionPrivate() - : pattern(), patternOptions(0), + : patternOptions(0), pattern(), mutex(), compiledPattern(0), studyData(0), errorString(0), errorOffset(-1), @@ -919,7 +920,7 @@ QRegularExpressionPrivate::~QRegularExpressionPrivate() */ QRegularExpressionPrivate::QRegularExpressionPrivate(const QRegularExpressionPrivate &other) : QSharedData(other), - pattern(other.pattern), patternOptions(other.patternOptions), + patternOptions(other.patternOptions), pattern(other.pattern), mutex(), compiledPattern(0), studyData(0), errorString(0), diff --git a/src/corelib/tools/qtimeline.cpp b/src/corelib/tools/qtimeline.cpp index 976c03aef4..3619c9e986 100644 --- a/src/corelib/tools/qtimeline.cpp +++ b/src/corelib/tools/qtimeline.cpp @@ -53,13 +53,17 @@ class QTimeLinePrivate : public QObjectPrivate Q_DECLARE_PUBLIC(QTimeLine) public: inline QTimeLinePrivate() - : startTime(0), duration(1000), startFrame(0), endFrame(0), + : easingCurve(QEasingCurve::InOutSine), + startTime(0), duration(1000), startFrame(0), endFrame(0), updateInterval(1000 / 25), totalLoopCount(1), currentLoopCount(0), currentTime(0), timerId(0), - direction(QTimeLine::Forward), easingCurve(QEasingCurve::InOutSine), + direction(QTimeLine::Forward), state(QTimeLine::NotRunning) { } + QElapsedTimer timer; + QEasingCurve easingCurve; + int startTime; int duration; int startFrame; @@ -70,10 +74,8 @@ public: int currentTime; int timerId; - QElapsedTimer timer; QTimeLine::Direction direction; - QEasingCurve easingCurve; QTimeLine::State state; inline void setState(QTimeLine::State newState) { diff --git a/src/corelib/tools/qtimezoneprivate.cpp b/src/corelib/tools/qtimezoneprivate.cpp index 08a5ce0861..ee34469c03 100644 --- a/src/corelib/tools/qtimezoneprivate.cpp +++ b/src/corelib/tools/qtimezoneprivate.cpp @@ -596,9 +596,11 @@ QUtcTimeZonePrivate::QUtcTimeZonePrivate(const QByteArray &zoneId, int offsetSec } QUtcTimeZonePrivate::QUtcTimeZonePrivate(const QUtcTimeZonePrivate &other) - : QTimeZonePrivate(other), m_offsetFromUtc(other.m_offsetFromUtc), m_name(other.m_name), - m_abbreviation(other.m_abbreviation), m_country(other.m_country), - m_comment(other.m_comment) + : QTimeZonePrivate(other), m_name(other.m_name), + m_abbreviation(other.m_abbreviation), + m_comment(other.m_comment), + m_country(other.m_country), + m_offsetFromUtc(other.m_offsetFromUtc) { } diff --git a/src/corelib/tools/qtimezoneprivate_p.h b/src/corelib/tools/qtimezoneprivate_p.h index 108aec2654..4fbb3ff6e0 100644 --- a/src/corelib/tools/qtimezoneprivate_p.h +++ b/src/corelib/tools/qtimezoneprivate_p.h @@ -203,11 +203,11 @@ private: const QString &abbreviation, QLocale::Country country, const QString &comment); - int m_offsetFromUtc; QString m_name; QString m_abbreviation; - QLocale::Country m_country; QString m_comment; + QLocale::Country m_country; + int m_offsetFromUtc; }; #ifdef QT_USE_ICU diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index ae63b8bc32..a474d70190 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -727,6 +727,12 @@ QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos, Example: \snippet code/src_gui_kernel_qevent.cpp 0 + + \note On platforms that support scrolling \l{phase()}{phases}, the delta may be null when: + \list + \li scrolling is about to begin, but the distance did not yet change (Qt::ScrollBegin), + \li or scrolling has ended and the distance did not change anymore (Qt::ScrollEnd). + \endlist */ /*! @@ -749,6 +755,12 @@ QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos, Example: \snippet code/src_gui_kernel_qevent.cpp 0 + + \note On platforms that support scrolling \l{phase()}{phases}, the delta may be null when: + \list + \li scrolling is about to begin, but the distance did not yet change (Qt::ScrollBegin), + \li or scrolling has ended and the distance did not change anymore (Qt::ScrollEnd). + \endlist */ /*! @@ -848,6 +860,9 @@ QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos, \since 5.2 Returns the scrolling phase of this wheel event. + + \note The Qt::ScrollBegin and Qt::ScrollEnd phases are currently + supported only on Mac OS X. */ @@ -2281,6 +2296,7 @@ QTabletEvent::~QTabletEvent() #endif // QT_NO_TABLETEVENT +#ifndef QT_NO_GESTURES /*! \class QNativeGestureEvent \since 5.2 @@ -2395,6 +2411,7 @@ QNativeGestureEvent::QNativeGestureEvent(Qt::NativeGestureType type, const QPoin Returns the position of the gesture as a QPointF, relative to the window that received the event. */ +#endif // QT_NO_GESTURES #ifndef QT_NO_DRAGANDDROP /*! diff --git a/src/gui/opengl/qopenglengineshadersource_p.h b/src/gui/opengl/qopenglengineshadersource_p.h index 869bd057f2..ba72de3fb0 100644 --- a/src/gui/opengl/qopenglengineshadersource_p.h +++ b/src/gui/opengl/qopenglengineshadersource_p.h @@ -238,7 +238,7 @@ static const char* const qopenglslPositionWithRadialGradientBrushVertexShader = uniform mediump vec2 halfViewportSize; \n\ uniform highp mat3 brushTransform; \n\ uniform highp vec2 fmp; \n\ - uniform highp vec3 bradius; \n\ + uniform mediump vec3 bradius; \n\ varying highp float b; \n\ varying highp vec2 A; \n\ void setPosition(void) \n\ @@ -264,7 +264,7 @@ static const char* const qopenglslRadialGradientBrushSrcFragmentShader = "\n\ uniform highp float sqrfr; \n\ varying highp float b; \n\ varying highp vec2 A; \n\ - uniform highp vec3 bradius; \n\ + uniform mediump vec3 bradius; \n\ lowp vec4 srcPixel() \n\ { \n\ highp float c = sqrfr-dot(A, A); \n\ diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index 6345ed7682..08b0491ddc 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -2878,6 +2878,10 @@ QFixed QTextEngine::calculateTabWidth(int item, QFixed x) const if (item.position > tabSectionEnd || item.position <= si.position) continue; shape(i); // first, lets make sure relevant text is already shaped + if (item.analysis.flags == QScriptAnalysis::Object) { + length += item.width; + continue; + } QGlyphLayout glyphs = this->shapedGlyphs(&item); const int end = qMin(item.position + item.num_glyphs, tabSectionEnd) - item.position; for (int i=0; i < end; i++) diff --git a/src/network/doc/src/ssl.qdoc b/src/network/doc/src/ssl.qdoc index 7c6ba1155f..e1bb1b9316 100644 --- a/src/network/doc/src/ssl.qdoc +++ b/src/network/doc/src/ssl.qdoc @@ -36,7 +36,7 @@ the Secure Sockets Layer (SSL) protocol, using the OpenSSL Toolkit (\l{http://www.openssl.org/}) to perform encryption and protocol handling. - See the \l{General Qt Requirements} page for information about the + See the \l {openssl-v1later}{OpenSSL Compatibility} page for information about the versions of OpenSSL that are known to work with Qt. \section1 Enabling and Disabling SSL Support diff --git a/src/opengl/gl2paintengineex/qglengineshadersource_p.h b/src/opengl/gl2paintengineex/qglengineshadersource_p.h index 65fbada48f..05d923ca17 100644 --- a/src/opengl/gl2paintengineex/qglengineshadersource_p.h +++ b/src/opengl/gl2paintengineex/qglengineshadersource_p.h @@ -238,7 +238,7 @@ static const char* const qglslPositionWithRadialGradientBrushVertexShader = "\n\ uniform mediump vec2 halfViewportSize; \n\ uniform highp mat3 brushTransform; \n\ uniform highp vec2 fmp; \n\ - uniform highp vec3 bradius; \n\ + uniform mediump vec3 bradius; \n\ varying highp float b; \n\ varying highp vec2 A; \n\ void setPosition(void) \n\ @@ -264,7 +264,7 @@ static const char* const qglslRadialGradientBrushSrcFragmentShader = "\n\ uniform highp float sqrfr; \n\ varying highp float b; \n\ varying highp vec2 A; \n\ - uniform highp vec3 bradius; \n\ + uniform mediump vec3 bradius; \n\ lowp vec4 srcPixel() \n\ { \n\ highp float c = sqrfr-dot(A, A); \n\ diff --git a/src/plugins/platforms/android/src/androidplatformplugin.cpp b/src/plugins/platforms/android/src/androidplatformplugin.cpp index 79e23c2d32..2cf5aa1e01 100644 --- a/src/plugins/platforms/android/src/androidplatformplugin.cpp +++ b/src/plugins/platforms/android/src/androidplatformplugin.cpp @@ -56,7 +56,7 @@ public: QPlatformIntegration *QAndroidPlatformIntegrationPlugin::create(const QString &key, const QStringList ¶mList) { Q_UNUSED(paramList); - if (key.toLower() == "android") + if (!key.compare(QLatin1String("android"), Qt::CaseInsensitive)) return new QAndroidPlatformIntegration(paramList); return 0; } diff --git a/src/plugins/platforms/android/src/qandroidinputcontext.cpp b/src/plugins/platforms/android/src/qandroidinputcontext.cpp index 8556e8ebf1..326972e71e 100644 --- a/src/plugins/platforms/android/src/qandroidinputcontext.cpp +++ b/src/plugins/platforms/android/src/qandroidinputcontext.cpp @@ -59,8 +59,8 @@ QT_BEGIN_NAMESPACE static QAndroidInputContext *m_androidInputContext = 0; -static char const *const QtNativeInputConnectionClassName = "org/qtproject/qt5/android/QtNativeInputConnection"; -static char const *const QtExtractedTextClassName = "org/qtproject/qt5/android/QtExtractedText"; +static char const *const QtNativeInputConnectionClassName = "org.qtproject.qt5.android.QtNativeInputConnection"; +static char const *const QtExtractedTextClassName = "org.qtproject.qt5.android.QtExtractedText"; static jclass m_extractedTextClass = 0; static jmethodID m_classConstructorMethodID = 0; static jfieldID m_partialEndOffsetFieldID = 0; diff --git a/src/plugins/platforms/android/src/qandroidplatformdialoghelpers.cpp b/src/plugins/platforms/android/src/qandroidplatformdialoghelpers.cpp index f379402e18..4c91e76e0f 100644 --- a/src/plugins/platforms/android/src/qandroidplatformdialoghelpers.cpp +++ b/src/plugins/platforms/android/src/qandroidplatformdialoghelpers.cpp @@ -184,7 +184,7 @@ static JNINativeMethod methods[] = { bool registerNatives(JNIEnv *env) { - jclass clazz = QtAndroid::findClass("org/qtproject/qt5/android/QtMessageDialogHelper", env); + jclass clazz = QtAndroid::findClass("org.qtproject.qt5.android.QtMessageDialogHelper", env); if (!clazz) { __android_log_print(ANDROID_LOG_FATAL, QtAndroid::qtTagText(), QtAndroid::classErrorMsgFmt() , "org/qtproject/qt5/android/QtMessageDialogHelper"); diff --git a/src/plugins/platforms/cocoa/main.mm b/src/plugins/platforms/cocoa/main.mm index b730514b12..dd063b5da0 100644 --- a/src/plugins/platforms/cocoa/main.mm +++ b/src/plugins/platforms/cocoa/main.mm @@ -61,8 +61,7 @@ QPlatformIntegration * QCocoaIntegrationPlugin::create(const QString& system, co Q_UNUSED(paramList); QCocoaAutoReleasePool pool; - - if (system.toLower() == "cocoa") + if (!system.compare(QLatin1String("cocoa"), Qt::CaseInsensitive)) return new QCocoaIntegration; return 0; diff --git a/src/plugins/platforms/cocoa/qcocoaglcontext.h b/src/plugins/platforms/cocoa/qcocoaglcontext.h index e1d4b602c9..30f1cdc278 100644 --- a/src/plugins/platforms/cocoa/qcocoaglcontext.h +++ b/src/plugins/platforms/cocoa/qcocoaglcontext.h @@ -75,6 +75,8 @@ public: bool isSharing() const; bool isValid() const; + void windowWasHidden(); + private: void setActiveWindow(QWindow *window); void updateSurfaceFormat(); diff --git a/src/plugins/platforms/cocoa/qcocoaglcontext.mm b/src/plugins/platforms/cocoa/qcocoaglcontext.mm index ba204236ee..8af90b13bf 100644 --- a/src/plugins/platforms/cocoa/qcocoaglcontext.mm +++ b/src/plugins/platforms/cocoa/qcocoaglcontext.mm @@ -165,6 +165,16 @@ QSurfaceFormat QCocoaGLContext::format() const return m_format; } +void QCocoaGLContext::windowWasHidden() +{ + // If the window is hidden, we need to unset the m_currentWindow + // variable so that succeeding makeCurrent's will not abort prematurely + // because of the optimization in setActiveWindow. + // Doing a full doneCurrent here is not preferable, because the GL context + // might be rendering in a different thread at this time. + m_currentWindow.clear(); +} + void QCocoaGLContext::swapBuffers(QPlatformSurface *surface) { QWindow *window = static_cast<QCocoaWindow *>(surface)->window(); diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index b5b9cec2be..1aace958ed 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -388,6 +388,8 @@ void QCocoaWindow::setVisible(bool visible) [m_contentView setHidden:NO]; } else { // qDebug() << "close" << this; + if (m_glContext) + m_glContext->windowWasHidden(); if (m_nsWindow) { if (m_hasModalSession) { QCocoaEventDispatcher *cocoaEventDispatcher = qobject_cast<QCocoaEventDispatcher *>(QGuiApplication::instance()->eventDispatcher()); diff --git a/src/plugins/platforms/cocoa/qprintengine_mac.mm b/src/plugins/platforms/cocoa/qprintengine_mac.mm index ee8d7ea157..f363b1772f 100644 --- a/src/plugins/platforms/cocoa/qprintengine_mac.mm +++ b/src/plugins/platforms/cocoa/qprintengine_mac.mm @@ -40,8 +40,7 @@ ****************************************************************************/ #include "qprintengine_mac_p.h" -#include <qdebug.h> -#include <qthread.h> +#include <quuid.h> #include <QtCore/qcoreapplication.h> #include <qpa/qplatformprintersupport.h> @@ -141,30 +140,51 @@ QMacPrintEnginePrivate::~QMacPrintEnginePrivate() void QMacPrintEnginePrivate::setPaperSize(QPrinter::PaperSize ps) { Q_Q(QMacPrintEngine); - QSizeF newSize = QPlatformPrinterSupport::convertPaperSizeToQSizeF(ps); - QCFType<CFArrayRef> formats; + if (hasCustomPaperSize) { + PMRelease(customPaper); + customPaper = 0; + } + hasCustomPaperSize = (ps == QPrinter::Custom); PMPrinter printer; - - if (PMSessionGetCurrentPrinter(session(), &printer) == noErr - && PMSessionCreatePageFormatList(session(), printer, &formats) == noErr) { - CFIndex total = CFArrayGetCount(formats); - PMPageFormat tmp; - PMRect paper; - for (CFIndex idx = 0; idx < total; ++idx) { - tmp = static_cast<PMPageFormat>( - const_cast<void *>(CFArrayGetValueAtIndex(formats, idx))); - PMGetUnadjustedPaperRect(tmp, &paper); - int wMM = int((paper.right - paper.left) / 72 * 25.4 + 0.5); - int hMM = int((paper.bottom - paper.top) / 72 * 25.4 + 0.5); - if (newSize.width() == wMM && newSize.height() == hMM) { - PMCopyPageFormat(tmp, format()); - // reset the orientation and resolution as they are lost in the copy. - q->setProperty(QPrintEngine::PPK_Orientation, orient); - if (PMSessionValidatePageFormat(session(), format(), kPMDontWantBoolean) != noErr) { - // Don't know, warn for the moment. - qWarning("QMacPrintEngine, problem setting format and resolution for this page size"); + if (PMSessionGetCurrentPrinter(session(), &printer) == noErr) { + if (ps != QPrinter::Custom) { + QSizeF newSize = QPlatformPrinterSupport::convertPaperSizeToQSizeF(ps); + QCFType<CFArrayRef> formats; + if (PMSessionCreatePageFormatList(session(), printer, &formats) == noErr) { + CFIndex total = CFArrayGetCount(formats); + PMPageFormat tmp; + PMRect paper; + for (CFIndex idx = 0; idx < total; ++idx) { + tmp = static_cast<PMPageFormat>(const_cast<void *>(CFArrayGetValueAtIndex(formats, idx))); + PMGetUnadjustedPaperRect(tmp, &paper); + int wMM = int((paper.right - paper.left) / 72 * 25.4 + 0.5); + int hMM = int((paper.bottom - paper.top) / 72 * 25.4 + 0.5); + if (newSize.width() == wMM && newSize.height() == hMM) { + PMCopyPageFormat(tmp, format()); + // reset the orientation and resolution as they are lost in the copy. + q->setProperty(QPrintEngine::PPK_Orientation, orient); + if (PMSessionValidatePageFormat(session(), format(), kPMDontWantBoolean) != noErr) { + // Don't know, warn for the moment. + qWarning("QMacPrintEngine, problem setting format and resolution for this page size"); + } + break; + } } - break; + } + } else { + QCFString paperId = QCFString::toCFStringRef(QUuid::createUuid().toString()); + PMPaperMargins paperMargins; + paperMargins.left = leftMargin; + paperMargins.top = topMargin; + paperMargins.right = rightMargin; + paperMargins.bottom = bottomMargin; + PMPaperCreateCustom(printer, paperId, QCFString("Custom size"), customSize.width(), customSize.height(), &paperMargins, &customPaper); + PMPageFormat tmp; + PMCreatePageFormatWithPMPaper(&tmp, customPaper); + PMCopyPageFormat(tmp, format()); + if (PMSessionValidatePageFormat(session(), format(), kPMDontWantBoolean) != noErr) { + // Don't know, warn for the moment. + qWarning("QMacPrintEngine, problem setting paper name"); } } } @@ -183,6 +203,11 @@ QPrinter::PaperSize QMacPrintEnginePrivate::paperSize() const void QMacPrintEnginePrivate::setPaperName(const QString &name) { Q_Q(QMacPrintEngine); + if (hasCustomPaperSize) { + PMRelease(customPaper); + customPaper = 0; + hasCustomPaperSize = false; + } PMPrinter printer; if (PMSessionGetCurrentPrinter(session(), &printer) == noErr) { @@ -419,6 +444,8 @@ void QMacPrintEnginePrivate::releaseSession() { PMSessionEndPageNoDialog(session()); PMSessionEndDocumentNoDialog(session()); + if (hasCustomPaperSize) + PMRelease(customPaper); [printInfo release]; printInfo = 0; } @@ -665,10 +692,10 @@ void QMacPrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &va { PMOrientation orientation; PMGetOrientation(d->format(), &orientation); - d->hasCustomPaperSize = true; d->customSize = value.toSizeF(); if (orientation != kPMPortrait) d->customSize = QSizeF(d->customSize.height(), d->customSize.width()); + d->setPaperSize(QPrinter::Custom); break; } case PPK_PageMargins: diff --git a/src/plugins/platforms/cocoa/qprintengine_mac_p.h b/src/plugins/platforms/cocoa/qprintengine_mac_p.h index 28183118d8..644a07184f 100644 --- a/src/plugins/platforms/cocoa/qprintengine_mac_p.h +++ b/src/plugins/platforms/cocoa/qprintengine_mac_p.h @@ -135,6 +135,7 @@ public: qreal rightMargin; qreal bottomMargin; QHash<QMacPrintEngine::PrintEnginePropertyKey, QVariant> valueCache; + PMPaper customPaper; QMacPrintEnginePrivate() : mode(QPrinter::ScreenResolution), state(QPrinter::Idle), orient(QPrinter::Portrait), printInfo(0), paintEngine(0), hasCustomPaperSize(false), hasCustomPageMargins(false) {} diff --git a/src/plugins/platforms/directfb/main.cpp b/src/plugins/platforms/directfb/main.cpp index 5ba1b0996b..423e33efd5 100644 --- a/src/plugins/platforms/directfb/main.cpp +++ b/src/plugins/platforms/directfb/main.cpp @@ -68,7 +68,7 @@ QPlatformIntegration * QDirectFbIntegrationPlugin::create(const QString& system, Q_UNUSED(paramList); QDirectFbIntegration *integration = 0; - if (system.toLower() == "directfb") + if (!system.compare(QLatin1String("directfb"), Qt::CaseInsensitive)) integration = new QDirectFbIntegration; QT_EGL_BACKEND_CREATE(system, integration) diff --git a/src/plugins/platforms/eglfs/main.cpp b/src/plugins/platforms/eglfs/main.cpp index d8e7a3792e..245f2a6236 100644 --- a/src/plugins/platforms/eglfs/main.cpp +++ b/src/plugins/platforms/eglfs/main.cpp @@ -55,7 +55,7 @@ public: QPlatformIntegration* QEglFSIntegrationPlugin::create(const QString& system, const QStringList& paramList) { Q_UNUSED(paramList); - if (system.toLower() == "eglfs") + if (!system.compare(QLatin1String("eglfs"), Qt::CaseInsensitive)) return new QEglFSIntegration; return 0; diff --git a/src/plugins/platforms/ios/plugin.mm b/src/plugins/platforms/ios/plugin.mm index efb1ad8d74..3505e39a0b 100644 --- a/src/plugins/platforms/ios/plugin.mm +++ b/src/plugins/platforms/ios/plugin.mm @@ -56,7 +56,7 @@ class QIOSIntegrationPlugin : public QPlatformIntegrationPlugin QPlatformIntegration * QIOSIntegrationPlugin::create(const QString& system, const QStringList& paramList) { Q_UNUSED(paramList); - if (system.toLower() == "ios") + if (!system.compare(QLatin1String("ios"), Qt::CaseInsensitive)) return new QIOSIntegration; return 0; diff --git a/src/plugins/platforms/ios/qiosapplicationdelegate.mm b/src/plugins/platforms/ios/qiosapplicationdelegate.mm index cf702c82af..9cf1047a6b 100644 --- a/src/plugins/platforms/ios/qiosapplicationdelegate.mm +++ b/src/plugins/platforms/ios/qiosapplicationdelegate.mm @@ -41,9 +41,14 @@ #include "qiosapplicationdelegate.h" +#include "qiosintegration.h" +#include "qiosservices.h" #include "qiosviewcontroller.h" #include "qioswindow.h" +#include <QtGui/private/qguiapplication_p.h> +#include <qpa/qplatformintegration.h> + #include <QtCore/QtCore> @implementation QIOSApplicationDelegate @@ -82,6 +87,21 @@ return YES; } +- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation +{ + Q_UNUSED(application); + Q_UNUSED(sourceApplication); + Q_UNUSED(annotation); + + if (!QGuiApplication::instance()) + return NO; + + QIOSIntegration *iosIntegration = static_cast<QIOSIntegration *>(QGuiApplicationPrivate::platformIntegration()); + QIOSServices *iosServices = static_cast<QIOSServices *>(iosIntegration->services()); + + return iosServices->handleUrl(QUrl::fromNSURL(url)); +} + - (void)dealloc { [window release]; diff --git a/src/plugins/platforms/ios/qiosscreen.mm b/src/plugins/platforms/ios/qiosscreen.mm index 57522cb1a3..96410952f9 100644 --- a/src/plugins/platforms/ios/qiosscreen.mm +++ b/src/plugins/platforms/ios/qiosscreen.mm @@ -189,6 +189,9 @@ void QIOSScreen::updateProperties() void QIOSScreen::updateStatusBarVisibility() { + if (!isQtApplication()) + return; + QWindow *focusWindow = QGuiApplication::focusWindow(); // If we don't have a focus window we leave the status @@ -199,20 +202,26 @@ void QIOSScreen::updateStatusBarVisibility() return; UIView *view = reinterpret_cast<UIView *>(focusWindow->handle()->winId()); + QIOSViewController *viewController = static_cast<QIOSViewController *>(view.viewController); + + bool currentStatusBarVisibility = [UIApplication sharedApplication].statusBarHidden; + if (viewController.prefersStatusBarHidden == currentStatusBarVisibility) + return; + #if QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_7_0) if (QSysInfo::MacintoshVersion >= QSysInfo::MV_IOS_7_0) { - [view.viewController setNeedsStatusBarAppearanceUpdate]; + [viewController setNeedsStatusBarAppearanceUpdate]; + dispatch_async(dispatch_get_main_queue(), ^{ + updateProperties(); + }); } else #endif { - bool wasHidden = [UIApplication sharedApplication].statusBarHidden; - QIOSViewController *viewController = static_cast<QIOSViewController *>(view.viewController); [[UIApplication sharedApplication] setStatusBarHidden:[viewController prefersStatusBarHidden] withAnimation:UIStatusBarAnimationNone]; - if ([UIApplication sharedApplication].statusBarHidden != wasHidden) - updateProperties(); + updateProperties(); } } diff --git a/src/plugins/platforms/ios/qiosservices.h b/src/plugins/platforms/ios/qiosservices.h index 692b3a0b99..aa39fbbed4 100644 --- a/src/plugins/platforms/ios/qiosservices.h +++ b/src/plugins/platforms/ios/qiosservices.h @@ -41,6 +41,8 @@ #ifndef QIOSSERVICES_H #define QIOSSERVICES_H + +#include <qurl.h> #include <qpa/qplatformservices.h> QT_BEGIN_NAMESPACE @@ -50,6 +52,11 @@ class QIOSServices : public QPlatformServices public: bool openUrl(const QUrl &url); bool openDocument(const QUrl &url); + + bool handleUrl(const QUrl &url); + +private: + QUrl m_handlingUrl; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/ios/qiosservices.mm b/src/plugins/platforms/ios/qiosservices.mm index 32203aeb71..0ac6c590ca 100644 --- a/src/plugins/platforms/ios/qiosservices.mm +++ b/src/plugins/platforms/ios/qiosservices.mm @@ -42,6 +42,7 @@ #include "qiosservices.h" #include <QtCore/qurl.h> +#include <QtGui/qdesktopservices.h> #import <UIKit/UIApplication.h> @@ -49,6 +50,9 @@ QT_BEGIN_NAMESPACE bool QIOSServices::openUrl(const QUrl &url) { + if (url == m_handlingUrl) + return false; + if (url.scheme().isEmpty()) return openDocument(url); @@ -66,4 +70,19 @@ bool QIOSServices::openDocument(const QUrl &url) return QPlatformServices::openDocument(url); } +/* Callback from iOS that the application should handle a URL */ +bool QIOSServices::handleUrl(const QUrl &url) +{ + QUrl previouslyHandling = m_handlingUrl; + m_handlingUrl = url; + + // FIXME: Add platform services callback from QDesktopServices::setUrlHandler + // so that we can warn the user if calling setUrlHandler without also setting + // up the matching keys in the Info.plist file (CFBundleURLTypes and friends). + bool couldHandle = QDesktopServices::openUrl(url); + + m_handlingUrl = previouslyHandling; + return couldHandle; +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/ios/qioswindow.h b/src/plugins/platforms/ios/qioswindow.h index a5e122bda1..d36a81180c 100644 --- a/src/plugins/platforms/ios/qioswindow.h +++ b/src/plugins/platforms/ios/qioswindow.h @@ -74,6 +74,8 @@ public: void handleContentOrientationChange(Qt::ScreenOrientation orientation); void setVisible(bool visible); + bool isExposed() const Q_DECL_OVERRIDE; + void raise() { raiseOrLower(true); } void lower() { raiseOrLower(false); } void requestActivateWindow(); diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm index 0dd810bdf6..7ab136e8b9 100644 --- a/src/plugins/platforms/ios/qioswindow.mm +++ b/src/plugins/platforms/ios/qioswindow.mm @@ -449,10 +449,18 @@ QT_BEGIN_NAMESPACE QIOSWindow::QIOSWindow(QWindow *window) : QPlatformWindow(window) , m_view([[QUIView alloc] initWithQIOSWindow:this]) - , m_normalGeometry(QPlatformWindow::geometry()) , m_windowLevel(0) { setParent(QPlatformWindow::parent()); + + // Resolve default window geometry in case it was not set before creating the + // platform window. This picks up eg. minimum-size if set, and defaults to + // the "maxmized" geometry (even though we're not in that window state). + // FIXME: Detect if we apply a maximized geometry and send a window state + // change event in that case. + m_normalGeometry = initialGeometry(window, QPlatformWindow::geometry(), + screen()->availableGeometry().width(), screen()->availableGeometry().height()); + setWindowState(window->windowState()); } @@ -579,6 +587,11 @@ void QIOSWindow::applyGeometry(const QRect &rect) [m_view layoutIfNeeded]; } +bool QIOSWindow::isExposed() const +{ + return window()->isVisible() && !window()->geometry().isEmpty(); +} + void QIOSWindow::setWindowState(Qt::WindowState state) { // Update the QWindow representation straight away, so that diff --git a/src/plugins/platforms/kms/main.cpp b/src/plugins/platforms/kms/main.cpp index db0582e694..3027e23c04 100644 --- a/src/plugins/platforms/kms/main.cpp +++ b/src/plugins/platforms/kms/main.cpp @@ -55,7 +55,7 @@ public: QPlatformIntegration *QKmsIntegrationPlugin::create(const QString& system, const QStringList& paramList) { Q_UNUSED(paramList); - if (system.toLower() == "kms") + if (!system.compare(QLatin1String("kms"), Qt::CaseInsensitive)) return new QKmsIntegration; return 0; diff --git a/src/plugins/platforms/linuxfb/main.cpp b/src/plugins/platforms/linuxfb/main.cpp index 579984d2fc..27aa91aefe 100644 --- a/src/plugins/platforms/linuxfb/main.cpp +++ b/src/plugins/platforms/linuxfb/main.cpp @@ -55,7 +55,7 @@ public: QPlatformIntegration* QLinuxFbIntegrationPlugin::create(const QString& system, const QStringList& paramList) { Q_UNUSED(paramList); - if (system.toLower() == "linuxfb") + if (!system.compare(QLatin1String("linuxfb"), Qt::CaseInsensitive)) return new QLinuxFbIntegration(paramList); return 0; diff --git a/src/plugins/platforms/minimal/main.cpp b/src/plugins/platforms/minimal/main.cpp index 7846b5b387..5e0388a0af 100644 --- a/src/plugins/platforms/minimal/main.cpp +++ b/src/plugins/platforms/minimal/main.cpp @@ -55,9 +55,8 @@ public: QPlatformIntegration *QMinimalIntegrationPlugin::create(const QString& system, const QStringList& paramList) { - Q_UNUSED(paramList); - if (system.toLower() == "minimal") - return new QMinimalIntegration; + if (!system.compare(QLatin1String("minimal"), Qt::CaseInsensitive)) + return new QMinimalIntegration(paramList); return 0; } diff --git a/src/plugins/platforms/minimal/qminimalbackingstore.cpp b/src/plugins/platforms/minimal/qminimalbackingstore.cpp index 3aac1bfe33..f58458cd31 100644 --- a/src/plugins/platforms/minimal/qminimalbackingstore.cpp +++ b/src/plugins/platforms/minimal/qminimalbackingstore.cpp @@ -41,6 +41,7 @@ #include "qminimalbackingstore.h" +#include "qminimalintegration.h" #include "qscreen.h" #include <QtCore/qdebug.h> #include <qpa/qplatformscreen.h> @@ -49,10 +50,9 @@ QT_BEGIN_NAMESPACE QMinimalBackingStore::QMinimalBackingStore(QWindow *window) - : QPlatformBackingStore(window),mDebug(false) + : QPlatformBackingStore(window) + , mDebug(QMinimalIntegration::instance()->options() & QMinimalIntegration::DebugBackingStore) { - if (QT_PREPEND_NAMESPACE(qgetenv)("QT_DEBUG_BACKINGSTORE").toInt() > 0) - mDebug = true; if (mDebug) qDebug() << "QMinimalBackingStore::QMinimalBackingStore:" << (quintptr)this; } diff --git a/src/plugins/platforms/minimal/qminimalbackingstore.h b/src/plugins/platforms/minimal/qminimalbackingstore.h index 5f1fd0f4d3..9265a09d18 100644 --- a/src/plugins/platforms/minimal/qminimalbackingstore.h +++ b/src/plugins/platforms/minimal/qminimalbackingstore.h @@ -60,7 +60,7 @@ public: private: QImage mImage; - bool mDebug; + const bool mDebug; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/minimal/qminimalintegration.cpp b/src/plugins/platforms/minimal/qminimalintegration.cpp index bb2c5f53c3..7f5c25f239 100644 --- a/src/plugins/platforms/minimal/qminimalintegration.cpp +++ b/src/plugins/platforms/minimal/qminimalintegration.cpp @@ -45,6 +45,7 @@ #include <QtGui/private/qpixmap_raster_p.h> #include <QtGui/private/qguiapplication_p.h> #include <qpa/qplatformwindow.h> +#include <qpa/qplatformfontdatabase.h> #if !defined(Q_OS_WIN) #include <QtPlatformSupport/private/qgenericunixeventdispatcher_p.h> @@ -56,8 +57,27 @@ QT_BEGIN_NAMESPACE -QMinimalIntegration::QMinimalIntegration() +static const char debugBackingStoreEnvironmentVariable[] = "QT_DEBUG_BACKINGSTORE"; + +static inline unsigned parseOptions(const QStringList ¶mList) +{ + unsigned options = 0; + foreach (const QString ¶m, paramList) { + if (param == QLatin1String("enable_fonts")) + options |= QMinimalIntegration::EnableFonts; + } + return options; +} + +QMinimalIntegration::QMinimalIntegration(const QStringList ¶meters) + : m_dummyFontDatabase(0) + , m_options(parseOptions(parameters)) { + if (qEnvironmentVariableIsSet(debugBackingStoreEnvironmentVariable) + && qgetenv(debugBackingStoreEnvironmentVariable).toInt() > 0) { + m_options |= DebugBackingStore | EnableFonts; + } + QMinimalScreen *mPrimaryScreen = new QMinimalScreen(); mPrimaryScreen->mGeometry = QRect(0, 0, 240, 320); @@ -67,6 +87,11 @@ QMinimalIntegration::QMinimalIntegration() screenAdded(mPrimaryScreen); } +QMinimalIntegration::~QMinimalIntegration() +{ + delete m_dummyFontDatabase; +} + bool QMinimalIntegration::hasCapability(QPlatformIntegration::Capability cap) const { switch (cap) { @@ -76,6 +101,24 @@ bool QMinimalIntegration::hasCapability(QPlatformIntegration::Capability cap) co } } +// Dummy font database that does not scan the fonts directory to be +// used for command line tools like qmlplugindump that do not create windows +// unless DebugBackingStore is activated. +class DummyFontDatabase : public QPlatformFontDatabase +{ +public: + virtual void populateFontDatabase() {} +}; + +QPlatformFontDatabase *QMinimalIntegration::fontDatabase() const +{ + if (m_options & EnableFonts) + return QPlatformIntegration::fontDatabase(); + if (!m_dummyFontDatabase) + m_dummyFontDatabase = new DummyFontDatabase; + return m_dummyFontDatabase; +} + QPlatformWindow *QMinimalIntegration::createPlatformWindow(QWindow *window) const { Q_UNUSED(window); @@ -102,4 +145,9 @@ QAbstractEventDispatcher *QMinimalIntegration::createEventDispatcher() const #endif } +QMinimalIntegration *QMinimalIntegration::instance() +{ + return static_cast<QMinimalIntegration *>(QGuiApplicationPrivate::platformIntegration()); +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/minimal/qminimalintegration.h b/src/plugins/platforms/minimal/qminimalintegration.h index 7dc01e1d51..a737057085 100644 --- a/src/plugins/platforms/minimal/qminimalintegration.h +++ b/src/plugins/platforms/minimal/qminimalintegration.h @@ -67,13 +67,28 @@ public: class QMinimalIntegration : public QPlatformIntegration { public: - QMinimalIntegration(); + enum Options { // Options to be passed on command line or determined from environment + DebugBackingStore = 0x1, + EnableFonts = 0x2 + }; + + explicit QMinimalIntegration(const QStringList ¶meters); + ~QMinimalIntegration(); bool hasCapability(QPlatformIntegration::Capability cap) const; + QPlatformFontDatabase *fontDatabase() const; QPlatformWindow *createPlatformWindow(QWindow *window) const; QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const; QAbstractEventDispatcher *createEventDispatcher() const; + + unsigned options() const { return m_options; } + + static QMinimalIntegration *instance(); + +private: + mutable QPlatformFontDatabase *m_dummyFontDatabase; + unsigned m_options; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/minimalegl/main.cpp b/src/plugins/platforms/minimalegl/main.cpp index c951bfb0dc..be85fa082e 100644 --- a/src/plugins/platforms/minimalegl/main.cpp +++ b/src/plugins/platforms/minimalegl/main.cpp @@ -63,7 +63,7 @@ QStringList QMinimalEglIntegrationPlugin::keys() const QPlatformIntegration* QMinimalEglIntegrationPlugin::create(const QString& system, const QStringList& paramList) { Q_UNUSED(paramList); - if (system.toLower() == "minimalegl") + if (!system.compare(QLatin1String("minimalegl"), Qt::CaseInsensitive)) return new QMinimalEglIntegration; return 0; diff --git a/src/plugins/platforms/offscreen/main.cpp b/src/plugins/platforms/offscreen/main.cpp index f48451d00d..e89116351b 100644 --- a/src/plugins/platforms/offscreen/main.cpp +++ b/src/plugins/platforms/offscreen/main.cpp @@ -56,7 +56,7 @@ public: QPlatformIntegration *QOffscreenIntegrationPlugin::create(const QString& system, const QStringList& paramList) { Q_UNUSED(paramList); - if (system.toLower() == "offscreen") + if (!system.compare(QLatin1String("offscreen"), Qt::CaseInsensitive)) return QOffscreenIntegration::createOffscreenIntegration(); return 0; diff --git a/src/plugins/platforms/openwfd/main.cpp b/src/plugins/platforms/openwfd/main.cpp index cea3c50e56..5f5d7594cd 100644 --- a/src/plugins/platforms/openwfd/main.cpp +++ b/src/plugins/platforms/openwfd/main.cpp @@ -54,7 +54,7 @@ public: QPlatformIntegration* QOpenWFDIntegrationPlugin::create(const QString& system, const QStringList& paramList) { Q_UNUSED(paramList); - if (system.toLower() == "openwfd") + if (!system.compare(QLatin1String("openwfd"), Qt::CaseInsensitive)) return new QOpenWFDIntegration; return 0; diff --git a/src/plugins/platforms/qnx/main.cpp b/src/plugins/platforms/qnx/main.cpp index fb81928625..50779d3e12 100644 --- a/src/plugins/platforms/qnx/main.cpp +++ b/src/plugins/platforms/qnx/main.cpp @@ -46,7 +46,7 @@ QT_BEGIN_NAMESPACE QPlatformIntegration *QQnxIntegrationPlugin::create(const QString& system, const QStringList& paramList) { - if (system.toLower() == QLatin1String("qnx")) + if (!system.compare(QLatin1String("qnx"), Qt::CaseInsensitive)) return new QQnxIntegration(paramList); return 0; diff --git a/src/plugins/platforms/qnx/qqnxfiledialoghelper.h b/src/plugins/platforms/qnx/qqnxfiledialoghelper.h index e7c68f6ff5..e83fc445d6 100644 --- a/src/plugins/platforms/qnx/qqnxfiledialoghelper.h +++ b/src/plugins/platforms/qnx/qqnxfiledialoghelper.h @@ -87,6 +87,9 @@ public: Q_SIGNALS: void dialogClosed(); +private Q_SLOTS: + void emitSignals(); + private: void setNameFilter(const QString &filter); void setNameFilters(const QStringList &filters); @@ -96,8 +99,8 @@ private: QFileDialogOptions::AcceptMode m_acceptMode; QString m_selectedFilter; - QPlatformDialogHelper::DialogCode m_result; #if defined(Q_OS_BLACKBERRY_TABLET) + QPlatformDialogHelper::DialogCode m_result; QList<QUrl> m_paths; #endif }; diff --git a/src/plugins/platforms/qnx/qqnxfiledialoghelper_bb10.cpp b/src/plugins/platforms/qnx/qqnxfiledialoghelper_bb10.cpp index dc841eb1a9..fa6e26977a 100644 --- a/src/plugins/platforms/qnx/qqnxfiledialoghelper_bb10.cpp +++ b/src/plugins/platforms/qnx/qqnxfiledialoghelper_bb10.cpp @@ -65,9 +65,9 @@ QQnxFileDialogHelper::QQnxFileDialogHelper(const QQnxIntegration *integration) m_integration(integration), m_dialog(new QQnxFilePicker), m_acceptMode(QFileDialogOptions::AcceptOpen), - m_selectedFilter(), - m_result(QPlatformDialogHelper::Rejected) + m_selectedFilter() { + connect(m_dialog, &QQnxFilePicker::closed, this, &QQnxFileDialogHelper::emitSignals); } QQnxFileDialogHelper::~QQnxFileDialogHelper() @@ -85,11 +85,6 @@ void QQnxFileDialogHelper::exec() QEventLoop loop; connect(m_dialog, SIGNAL(closed()), &loop, SLOT(quit())); loop.exec(); - - if (m_dialog->selectedFiles().isEmpty()) - Q_EMIT reject(); - else - Q_EMIT accept(); } bool QQnxFileDialogHelper::show(Qt::WindowFlags flags, Qt::WindowModality modality, QWindow *parent) @@ -197,6 +192,14 @@ QString QQnxFileDialogHelper::selectedNameFilter() const return m_selectedFilter; } +void QQnxFileDialogHelper::emitSignals() +{ + if (m_dialog->selectedFiles().isEmpty()) + Q_EMIT reject(); + else + Q_EMIT accept(); +} + void QQnxFileDialogHelper::setNameFilter(const QString &filter) { qFileDialogHelperDebug() << Q_FUNC_INFO << "filter =" << filter; diff --git a/src/plugins/platforms/qnx/qqnxfilepicker.cpp b/src/plugins/platforms/qnx/qqnxfilepicker.cpp index 5229d1f1f5..56c804a5b4 100644 --- a/src/plugins/platforms/qnx/qqnxfilepicker.cpp +++ b/src/plugins/platforms/qnx/qqnxfilepicker.cpp @@ -84,6 +84,9 @@ void QQnxFilePicker::open() if (m_invocationHandle) return; + // Clear any previous results + m_selectedFiles.clear(); + int errorCode = BPS_SUCCESS; errorCode = navigator_invoke_invocation_create(&m_invocationHandle); diff --git a/src/plugins/platforms/xcb/main.cpp b/src/plugins/platforms/xcb/main.cpp index e114827703..f21ea03cf5 100644 --- a/src/plugins/platforms/xcb/main.cpp +++ b/src/plugins/platforms/xcb/main.cpp @@ -54,7 +54,7 @@ public: QPlatformIntegration* QXcbIntegrationPlugin::create(const QString& system, const QStringList& parameters, int &argc, char **argv) { - if (system.toLower() == "xcb") + if (!system.compare(QLatin1String("xcb"), Qt::CaseInsensitive)) return new QXcbIntegration(parameters, argc, argv); return 0; diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index 96e6534b74..6fd2241f71 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -274,21 +274,22 @@ QXcbConnection::QXcbConnection(QXcbNativeInterface *nativeInterface, bool canGra XSetEventQueueOwner(dpy, XCBOwnsEventQueue); XSetErrorHandler(nullErrorHandler); m_xlib_display = dpy; -#ifdef XCB_USE_EGL - EGLDisplay eglDisplay = eglGetDisplay(dpy); - m_egl_display = eglDisplay; - EGLint major, minor; - eglBindAPI(EGL_OPENGL_ES_API); - m_has_egl = eglInitialize(eglDisplay,&major,&minor); -#endif //XCB_USE_EGL } #else + EGLNativeDisplayType dpy = EGL_DEFAULT_DISPLAY; m_connection = xcb_connect(m_displayName.constData(), &m_primaryScreen); #endif //XCB_USE_XLIB if (!m_connection || xcb_connection_has_error(m_connection)) qFatal("QXcbConnection: Could not connect to display %s", m_displayName.constData()); +#ifdef XCB_USE_EGL + EGLDisplay eglDisplay = eglGetDisplay(dpy); + m_egl_display = eglDisplay; + EGLint major, minor; + m_has_egl = eglInitialize(eglDisplay, &major, &minor); +#endif //XCB_USE_EGL + m_reader = new QXcbEventReader(this); m_reader->start(); diff --git a/src/printsupport/kernel/qprinter.cpp b/src/printsupport/kernel/qprinter.cpp index 819f9343f7..5eb840c52a 100644 --- a/src/printsupport/kernel/qprinter.cpp +++ b/src/printsupport/kernel/qprinter.cpp @@ -48,7 +48,6 @@ #include <qpa/qplatformprintersupport.h> #include "qprintengine.h" -#include "qprinterinfo.h" #include "qlist.h" #include <qcoreapplication.h> #include <qfileinfo.h> @@ -163,10 +162,39 @@ Q_PRINTSUPPORT_EXPORT QSizeF qt_printerPaperSize(QPrinter::Orientation orientati (qt_paperSizes[paperSize][height_index] * 72 / 25.4) / multiplier); } -void QPrinterPrivate::createDefaultEngines() +QPrinterInfo QPrinterPrivate::findValidPrinter(const QPrinterInfo &printer) { - QPlatformPrinterSupport *ps = QPlatformPrinterSupportPlugin::get(); - if (outputFormat == QPrinter::NativeFormat && ps) { + // Try find a valid printer to use, either the one given, the default or the first available + QPrinterInfo printerToUse = printer; + if (printerToUse.isNull()) { + printerToUse = QPrinterInfo::defaultPrinter(); + if (printerToUse.isNull()) { + QList<QPrinterInfo> availablePrinters = QPrinterInfo::availablePrinters(); + if (!availablePrinters.isEmpty()) + printerToUse = availablePrinters.at(0); + } + } + return printerToUse; +} + +void QPrinterPrivate::initEngines(QPrinter::OutputFormat format, const QPrinterInfo &printer) +{ + // Default to PdfFormat + outputFormat = QPrinter::PdfFormat; + QPlatformPrinterSupport *ps = 0; + QString printerName; + + // Only set NativeFormat if we have a valid plugin and printer to use + if (format == QPrinter::NativeFormat) { + ps = QPlatformPrinterSupportPlugin::get(); + QPrinterInfo printerToUse = findValidPrinter(printer); + if (ps && !printerToUse.isNull()) { + outputFormat = QPrinter::NativeFormat; + printerName = printerToUse.printerName(); + } + } + + if (outputFormat == QPrinter::NativeFormat) { printEngine = ps->createNativePrintEngine(printerMode); paintEngine = ps->createPaintEngine(printEngine, printerMode); } else { @@ -174,8 +202,38 @@ void QPrinterPrivate::createDefaultEngines() paintEngine = pdfEngine; printEngine = pdfEngine; } + use_default_engine = true; had_default_engines = true; + setProperty(QPrintEngine::PPK_PrinterName, printerName); + validPrinter = true; +} + +void QPrinterPrivate::changeEngines(QPrinter::OutputFormat format, const QPrinterInfo &printer) +{ + QPrintEngine *oldPrintEngine = printEngine; + const bool def_engine = use_default_engine; + + initEngines(format, printer); + + if (oldPrintEngine) { + foreach (QPrintEngine::PrintEnginePropertyKey key, m_properties.values()) { + QVariant prop; + // PPK_NumberOfCopies need special treatmeant since it in most cases + // will return 1, disregarding the actual value that was set + // PPK_PrinterName also needs special treatment as initEngines has set it already + if (key == QPrintEngine::PPK_NumberOfCopies) + prop = QVariant(q_ptr->copyCount()); + else if (key != QPrintEngine::PPK_PrinterName) + prop = oldPrintEngine->property(key); + + if (prop.isValid()) + setProperty(key, prop); + } + } + + if (def_engine) + delete oldPrintEngine; } #ifndef QT_NO_PRINTPREVIEWWIDGET @@ -205,15 +263,14 @@ void QPrinterPrivate::setPreviewMode(bool enable) } #endif // QT_NO_PRINTPREVIEWWIDGET -void QPrinterPrivate::addToManualSetList(QPrintEngine::PrintEnginePropertyKey key) +void QPrinterPrivate::setProperty(QPrintEngine::PrintEnginePropertyKey key, const QVariant &value) { - for (int c = 0; c < manualSetList.size(); ++c) { - if (manualSetList[c] == key) return; - } - manualSetList.append(key); + printEngine->setProperty(key, value); + m_properties.insert(key); } + /*! \class QPrinter \reentrant @@ -510,13 +567,7 @@ QPrinter::QPrinter(PrinterMode mode) : QPagedPaintDevice(), d_ptr(new QPrinterPrivate(this)) { - d_ptr->init(mode); - QPrinterInfo defPrn(QPrinterInfo::defaultPrinter()); - if (!defPrn.isNull()) { - setPrinterName(defPrn.printerName()); - } else if (QPrinterInfo::availablePrinters().isEmpty()) { - setOutputFormat(QPrinter::PdfFormat); - } + d_ptr->init(QPrinterInfo(), mode); } /*! @@ -528,11 +579,10 @@ QPrinter::QPrinter(const QPrinterInfo& printer, PrinterMode mode) : QPagedPaintDevice(), d_ptr(new QPrinterPrivate(this)) { - d_ptr->init(mode); - setPrinterName(printer.printerName()); + d_ptr->init(printer, mode); } -void QPrinterPrivate::init(QPrinter::PrinterMode mode) +void QPrinterPrivate::init(const QPrinterInfo &printer, QPrinter::PrinterMode mode) { if (!QCoreApplication::instance()) { qFatal("QPrinter: Must construct a QCoreApplication before a QPrinter"); @@ -540,14 +590,8 @@ void QPrinterPrivate::init(QPrinter::PrinterMode mode) } printerMode = mode; - outputFormat = QPrinter::NativeFormat; - createDefaultEngines(); -#ifndef QT_NO_PRINTPREVIEWWIDGET - previewEngine = 0; -#endif - realPrintEngine = 0; - realPaintEngine = 0; + initEngines(QPrinter::NativeFormat, printer); } /*! @@ -612,40 +656,30 @@ QPrinter::~QPrinter() \since 4.1 Sets the output format for this printer to \a format. + + If \a format is the same value as currently set then no change will be made. + + If \a format is NativeFormat then the printerName will be set to the default + printer. If there are no valid printers configured then no change will be made. + If you want to set NativeFormat with a specific printerName then use + setPrinterName(). + + \sa setPrinterName() */ void QPrinter::setOutputFormat(OutputFormat format) { Q_D(QPrinter); - if (d->validPrinter && d->outputFormat == format) - return; - d->outputFormat = format; - QPrintEngine *oldPrintEngine = d->printEngine; - const bool def_engine = d->use_default_engine; - d->printEngine = 0; - - d->createDefaultEngines(); + if (d->outputFormat == format) + return; - if (oldPrintEngine) { - for (int i = 0; i < d->manualSetList.size(); ++i) { - QPrintEngine::PrintEnginePropertyKey key = d->manualSetList[i]; - QVariant prop; - // PPK_NumberOfCopies need special treatmeant since it in most cases - // will return 1, disregarding the actual value that was set - if (key == QPrintEngine::PPK_NumberOfCopies) - prop = QVariant(copyCount()); - else - prop = oldPrintEngine->property(key); - if (prop.isValid()) - d->printEngine->setProperty(key, prop); - } + if (format == QPrinter::NativeFormat) { + QPrinterInfo printerToUse = d->findValidPrinter(); + if (!printerToUse.isNull()) + d->changeEngines(format, printerToUse); + } else { + d->changeEngines(format, QPrinterInfo()); } - - if (def_engine) - delete oldPrintEngine; - - if (d->outputFormat == QPrinter::PdfFormat) - d->validPrinter = true; } /*! @@ -683,30 +717,37 @@ QString QPrinter::printerName() const /*! Sets the printer name to \a name. - \sa printerName(), isValid() + If the \a name is empty then the output format will be set to PdfFormat. + + If the \a name is not a valid printer then no change will be made. + + If the \a name is a valid printer then the output format will be set to NativeFormat. + + \sa printerName(), isValid(), setOutputFormat() */ void QPrinter::setPrinterName(const QString &name) { Q_D(QPrinter); ABORT_IF_ACTIVE("QPrinter::setPrinterName"); - QList<QPrinterInfo> prnList = QPrinterInfo::availablePrinters(); + if (printerName() == name) + return; + if (name.isEmpty()) { - d->validPrinter = d->outputFormat == QPrinter::PdfFormat; - } else { - d->validPrinter = false; - for (int i = 0; i < prnList.size(); ++i) { - if (prnList[i].printerName() == name) { - d->validPrinter = true; - break; - } - } + setOutputFormat(QPrinter::PdfFormat); + return; } - d->printEngine->setProperty(QPrintEngine::PPK_PrinterName, name); - d->addToManualSetList(QPrintEngine::PPK_PrinterName); -} + QPrinterInfo printerToUse = QPrinterInfo::printerInfo(name); + if (printerToUse.isNull()) + return; + if (outputFormat() == QPrinter::PdfFormat) { + d->changeEngines(QPrinter::NativeFormat, printerToUse); + } else { + d->setProperty(QPrintEngine::PPK_PrinterName, name); + } +} /*! \since 4.4 @@ -774,8 +815,7 @@ void QPrinter::setOutputFileName(const QString &fileName) else if (fileName.isEmpty()) setOutputFormat(QPrinter::NativeFormat); - d->printEngine->setProperty(QPrintEngine::PPK_OutputFileName, fileName); - d->addToManualSetList(QPrintEngine::PPK_OutputFileName); + d->setProperty(QPrintEngine::PPK_OutputFileName, fileName); } @@ -810,8 +850,7 @@ void QPrinter::setPrintProgram(const QString &printProg) { Q_D(QPrinter); ABORT_IF_ACTIVE("QPrinter::setPrintProgram"); - d->printEngine->setProperty(QPrintEngine::PPK_PrinterProgram, printProg); - d->addToManualSetList(QPrintEngine::PPK_PrinterProgram); + d->setProperty(QPrintEngine::PPK_PrinterProgram, printProg); } @@ -841,8 +880,7 @@ void QPrinter::setDocName(const QString &name) { Q_D(QPrinter); ABORT_IF_ACTIVE("QPrinter::setDocName"); - d->printEngine->setProperty(QPrintEngine::PPK_DocumentName, name); - d->addToManualSetList(QPrintEngine::PPK_DocumentName); + d->setProperty(QPrintEngine::PPK_DocumentName, name); } @@ -872,8 +910,7 @@ void QPrinter::setCreator(const QString &creator) { Q_D(QPrinter); ABORT_IF_ACTIVE("QPrinter::setCreator"); - d->printEngine->setProperty(QPrintEngine::PPK_Creator, creator); - d->addToManualSetList(QPrintEngine::PPK_Creator); + d->setProperty(QPrintEngine::PPK_Creator, creator); } @@ -910,8 +947,7 @@ QPrinter::Orientation QPrinter::orientation() const void QPrinter::setOrientation(Orientation orientation) { Q_D(QPrinter); - d->printEngine->setProperty(QPrintEngine::PPK_Orientation, orientation); - d->addToManualSetList(QPrintEngine::PPK_Orientation); + d->setProperty(QPrintEngine::PPK_Orientation, orientation); } @@ -979,8 +1015,7 @@ void QPrinter::setPageSize(PageSize newPageSize) qWarning("QPrinter::setPaperSize: Illegal paper size %d", newPageSize); return; } - d->printEngine->setProperty(QPrintEngine::PPK_PaperSize, newPageSize); - d->addToManualSetList(QPrintEngine::PPK_PaperSize); + d->setProperty(QPrintEngine::PPK_PaperSize, newPageSize); d->hasUserSetPageSize = true; } @@ -1010,8 +1045,7 @@ void QPrinter::setPageSizeMM(const QSizeF &size) QPagedPaintDevice::setPageSizeMM(size); QSizeF s = size * 72./25.4; - d->printEngine->setProperty(QPrintEngine::PPK_CustomPaperSize, s); - d->addToManualSetList(QPrintEngine::PPK_CustomPaperSize); + d->setProperty(QPrintEngine::PPK_CustomPaperSize, s); d->hasUserSetPageSize = true; } @@ -1051,8 +1085,7 @@ void QPrinter::setPaperName(const QString &paperName) Q_D(QPrinter); if (d->paintEngine->type() != QPaintEngine::Pdf) ABORT_IF_ACTIVE("QPrinter::setPaperName"); - d->printEngine->setProperty(QPrintEngine::PPK_PaperName, paperName); - d->addToManualSetList(QPrintEngine::PPK_PaperName); + d->setProperty(QPrintEngine::PPK_PaperName, paperName); } /*! @@ -1088,8 +1121,7 @@ void QPrinter::setPageOrder(PageOrder pageOrder) Q_D(QPrinter); ABORT_IF_ACTIVE("QPrinter::setPageOrder"); - d->printEngine->setProperty(QPrintEngine::PPK_PageOrder, pageOrder); - d->addToManualSetList(QPrintEngine::PPK_PageOrder); + d->setProperty(QPrintEngine::PPK_PageOrder, pageOrder); } @@ -1117,8 +1149,7 @@ void QPrinter::setColorMode(ColorMode newColorMode) { Q_D(QPrinter); ABORT_IF_ACTIVE("QPrinter::setColorMode"); - d->printEngine->setProperty(QPrintEngine::PPK_ColorMode, newColorMode); - d->addToManualSetList(QPrintEngine::PPK_ColorMode); + d->setProperty(QPrintEngine::PPK_ColorMode, newColorMode); } @@ -1197,8 +1228,7 @@ void QPrinter::setNumCopies(int numCopies) { Q_D(QPrinter); ABORT_IF_ACTIVE("QPrinter::setNumCopies"); - d->printEngine->setProperty(QPrintEngine::PPK_NumberOfCopies, numCopies); - d->addToManualSetList(QPrintEngine::PPK_NumberOfCopies); + d->setProperty(QPrintEngine::PPK_NumberOfCopies, numCopies); } /*! @@ -1216,8 +1246,7 @@ void QPrinter::setCopyCount(int count) { Q_D(QPrinter); ABORT_IF_ACTIVE("QPrinter::setCopyCount;"); - d->printEngine->setProperty(QPrintEngine::PPK_CopyCount, count); - d->addToManualSetList(QPrintEngine::PPK_CopyCount); + d->setProperty(QPrintEngine::PPK_CopyCount, count); } /*! @@ -1286,8 +1315,7 @@ void QPrinter::setCollateCopies(bool collate) { Q_D(QPrinter); ABORT_IF_ACTIVE("QPrinter::setCollateCopies"); - d->printEngine->setProperty(QPrintEngine::PPK_CollateCopies, collate); - d->addToManualSetList(QPrintEngine::PPK_CollateCopies); + d->setProperty(QPrintEngine::PPK_CollateCopies, collate); } @@ -1316,8 +1344,7 @@ void QPrinter::setCollateCopies(bool collate) void QPrinter::setFullPage(bool fp) { Q_D(QPrinter); - d->printEngine->setProperty(QPrintEngine::PPK_FullPage, fp); - d->addToManualSetList(QPrintEngine::PPK_FullPage); + d->setProperty(QPrintEngine::PPK_FullPage, fp); } @@ -1355,8 +1382,7 @@ void QPrinter::setResolution(int dpi) { Q_D(QPrinter); ABORT_IF_ACTIVE("QPrinter::setResolution"); - d->printEngine->setProperty(QPrintEngine::PPK_Resolution, dpi); - d->addToManualSetList(QPrintEngine::PPK_Resolution); + d->setProperty(QPrintEngine::PPK_Resolution, dpi); } @@ -1385,8 +1411,7 @@ int QPrinter::resolution() const void QPrinter::setPaperSource(PaperSource source) { Q_D(QPrinter); - d->printEngine->setProperty(QPrintEngine::PPK_PaperSource, source); - d->addToManualSetList(QPrintEngine::PPK_PaperSource); + d->setProperty(QPrintEngine::PPK_PaperSource, source); } /*! @@ -1412,8 +1437,7 @@ QPrinter::PaperSource QPrinter::paperSource() const void QPrinter::setFontEmbeddingEnabled(bool enable) { Q_D(QPrinter); - d->printEngine->setProperty(QPrintEngine::PPK_FontEmbedding, enable); - d->addToManualSetList(QPrintEngine::PPK_FontEmbedding); + d->setProperty(QPrintEngine::PPK_FontEmbedding, enable); } /*! @@ -1484,8 +1508,7 @@ bool QPrinter::doubleSidedPrinting() const void QPrinter::setDuplex(DuplexMode duplex) { Q_D(QPrinter); - d->printEngine->setProperty(QPrintEngine::PPK_Duplex, duplex); - d->addToManualSetList(QPrintEngine::PPK_Duplex); + d->setProperty(QPrintEngine::PPK_Duplex, duplex); } /*! @@ -1613,8 +1636,7 @@ void QPrinter::setMargins(const Margins &m) QList<QVariant> margins; margins << (m.left * multiplier) << (m.top * multiplier) << (m.right * multiplier) << (m.bottom * multiplier); - d->printEngine->setProperty(QPrintEngine::PPK_PageMargins, margins); - d->addToManualSetList(QPrintEngine::PPK_PageMargins); + d->setProperty(QPrintEngine::PPK_PageMargins, margins); d->hasCustomPageMargins = true; } @@ -1685,8 +1707,7 @@ void QPrinter::setWinPageSize(int pageSize) { Q_D(QPrinter); ABORT_IF_ACTIVE("QPrinter::setWinPageSize"); - d->printEngine->setProperty(QPrintEngine::PPK_WindowsPageSize, pageSize); - d->addToManualSetList(QPrintEngine::PPK_WindowsPageSize); + d->setProperty(QPrintEngine::PPK_WindowsPageSize, pageSize); } /*! @@ -1834,8 +1855,7 @@ QString QPrinter::printerSelectionOption() const void QPrinter::setPrinterSelectionOption(const QString &option) { Q_D(QPrinter); - d->printEngine->setProperty(QPrintEngine::PPK_SelectionOption, option); - d->addToManualSetList(QPrintEngine::PPK_SelectionOption); + d->setProperty(QPrintEngine::PPK_SelectionOption, option); } #endif diff --git a/src/printsupport/kernel/qprinter_p.h b/src/printsupport/kernel/qprinter_p.h index 2bec44aae6..2357b9e944 100644 --- a/src/printsupport/kernel/qprinter_p.h +++ b/src/printsupport/kernel/qprinter_p.h @@ -59,8 +59,10 @@ #ifndef QT_NO_PRINTER #include "QtPrintSupport/qprinter.h" +#include "QtPrintSupport/qprinterinfo.h" #include "QtPrintSupport/qprintengine.h" #include "QtCore/qpointer.h" +#include "QtCore/qset.h" #include <limits.h> @@ -75,14 +77,19 @@ class Q_PRINTSUPPORT_EXPORT QPrinterPrivate Q_DECLARE_PUBLIC(QPrinter) public: QPrinterPrivate(QPrinter *printer) - : printEngine(0) - , paintEngine(0) - , q_ptr(printer) - , printRange(QPrinter::AllPages) - , use_default_engine(true) - , validPrinter(false) - , hasCustomPageMargins(false) - , hasUserSetPageSize(false) + : printEngine(0), + paintEngine(0), + realPrintEngine(0), + realPaintEngine(0), +#ifndef QT_NO_PRINTPREVIEWWIDGET + previewEngine(0), +#endif + q_ptr(printer), + printRange(QPrinter::AllPages), + use_default_engine(true), + validPrinter(false), + hasCustomPageMargins(false), + hasUserSetPageSize(false) { } @@ -90,15 +97,17 @@ public: } - void init(QPrinter::PrinterMode mode); + void init(const QPrinterInfo &printer, QPrinter::PrinterMode mode); - void createDefaultEngines(); + QPrinterInfo findValidPrinter(const QPrinterInfo &printer = QPrinterInfo()); + void initEngines(QPrinter::OutputFormat format, const QPrinterInfo &printer); + void changeEngines(QPrinter::OutputFormat format, const QPrinterInfo &printer); #ifndef QT_NO_PRINTPREVIEWWIDGET QList<const QPicture *> previewPages() const; void setPreviewMode(bool); #endif - void addToManualSetList(QPrintEngine::PrintEnginePropertyKey key); + void setProperty(QPrintEngine::PrintEnginePropertyKey key, const QVariant &value); QPrinter::PrinterMode printerMode; QPrinter::OutputFormat outputFormat; @@ -123,7 +132,7 @@ public: uint hasUserSetPageSize : 1; // Used to remember which properties have been manually set by the user. - QList<QPrintEngine::PrintEnginePropertyKey> manualSetList; + QSet<QPrintEngine::PrintEnginePropertyKey> m_properties; }; QT_END_NAMESPACE diff --git a/src/sql/doc/src/sql-driver.qdoc b/src/sql/doc/src/sql-driver.qdoc index 82dfa27e46..92727b2d1c 100644 --- a/src/sql/doc/src/sql-driver.qdoc +++ b/src/sql/doc/src/sql-driver.qdoc @@ -151,9 +151,8 @@ \snippet code/doc_src_sql-driver.qdoc 3 - After installing Qt, as described in the \l{Installing Qt for X11 - Platforms} document, you also need to install the plugin in the - standard location: + After installing Qt, you also need to install the plugin in the standard + location: \snippet code/doc_src_sql-driver.qdoc 4 @@ -478,8 +477,8 @@ \snippet code/doc_src_sql-driver.qdoc 13 - After installing Qt, as described in the \l{Installing Qt for X11 Platforms} document, - you also need to install the plugin in the standard location: + After installing Qt, you also need to install the plugin in the standard + location: \snippet code/doc_src_sql-driver.qdoc 14 @@ -565,8 +564,8 @@ \snippet code/doc_src_sql-driver.qdoc 18 - After installing Qt, as described in the \l{Installing Qt for X11 Platforms} document, - you also need to install the plugin in the standard location: + After installing Qt, you also need to install the plugin in the standard + location: \snippet code/doc_src_sql-driver.qdoc 19 @@ -640,8 +639,7 @@ \snippet code/doc_src_sql-driver.qdoc 21 - After installing Qt, as described in the \l{Installing Qt for X11 Platforms} document, - you also need to install the plugin in the standard location: + After installing Qt, you also need to install the plugin in the standard location: \snippet code/doc_src_sql-driver.qdoc 22 diff --git a/src/sql/drivers/ibase/qsql_ibase.cpp b/src/sql/drivers/ibase/qsql_ibase.cpp index 05e9a4aac8..98da296240 100644 --- a/src/sql/drivers/ibase/qsql_ibase.cpp +++ b/src/sql/drivers/ibase/qsql_ibase.cpp @@ -1445,7 +1445,7 @@ bool QIBaseDriver::open(const QString & db, const QString & user, const QString & password, const QString & host, - int /*port*/, + int port, const QString & connOpts) { Q_D(QIBaseDriver); @@ -1513,9 +1513,13 @@ bool QIBaseDriver::open(const QString & db, i += role.length(); } + QString portString; + if (port != -1) + portString = QStringLiteral("/%1").arg(port); + QString ldb; if (!host.isEmpty()) - ldb += host + QLatin1Char(':'); + ldb += host + portString + QLatin1Char(':'); ldb += db; isc_attach_database(d->status, 0, const_cast<char *>(ldb.toLocal8Bit().constData()), &d->ibase, i, ba.data()); @@ -1526,6 +1530,7 @@ bool QIBaseDriver::open(const QString & db, } setOpen(true); + setOpenError(false); return true; } diff --git a/src/sql/drivers/oci/qsql_oci.cpp b/src/sql/drivers/oci/qsql_oci.cpp index fe9ae42e6f..6843407e9c 100644 --- a/src/sql/drivers/oci/qsql_oci.cpp +++ b/src/sql/drivers/oci/qsql_oci.cpp @@ -2159,6 +2159,7 @@ bool QOCIDriver::hasFeature(DriverFeature f) const case SimpleLocking: case EventNotifications: case FinishQuery: + case CancelQuery: case MultipleResultSets: return false; case Unicode: diff --git a/src/sql/drivers/sqlite/qsql_sqlite.cpp b/src/sql/drivers/sqlite/qsql_sqlite.cpp index 3f93f34ee4..36a4b7d0c4 100644 --- a/src/sql/drivers/sqlite/qsql_sqlite.cpp +++ b/src/sql/drivers/sqlite/qsql_sqlite.cpp @@ -597,24 +597,32 @@ bool QSQLiteDriver::open(const QString & db, const QString &, const QString &, c if (isOpen()) close(); + + int timeOut = 5000; bool sharedCache = false; - int openMode = SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, timeOut=5000; - QStringList opts=QString(conOpts).remove(QLatin1Char(' ')).split(QLatin1Char(';')); - foreach(const QString &option, opts) { + bool openReadOnlyOption = false; + bool openUriOption = false; + + const QStringList opts = QString(conOpts).remove(QLatin1Char(' ')).split(QLatin1Char(';')); + foreach (const QString &option, opts) { if (option.startsWith(QLatin1String("QSQLITE_BUSY_TIMEOUT="))) { bool ok; - int nt = option.mid(21).toInt(&ok); + const int nt = option.mid(21).toInt(&ok); if (ok) timeOut = nt; - } - if (option == QLatin1String("QSQLITE_OPEN_READONLY")) - openMode = SQLITE_OPEN_READONLY; - if (option == QLatin1String("QSQLITE_OPEN_URI")) - openMode |= SQLITE_OPEN_URI; - if (option == QLatin1String("QSQLITE_ENABLE_SHARED_CACHE")) + } else if (option == QLatin1String("QSQLITE_OPEN_READONLY")) { + openReadOnlyOption = true; + } else if (option == QLatin1String("QSQLITE_OPEN_URI")) { + openUriOption = true; + } else if (option == QLatin1String("QSQLITE_ENABLE_SHARED_CACHE")) { sharedCache = true; + } } + int openMode = (openReadOnlyOption ? SQLITE_OPEN_READONLY : (SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE)); + if (openUriOption) + openMode |= SQLITE_OPEN_URI; + sqlite3_enable_shared_cache(sharedCache); if (sqlite3_open_v2(db.toUtf8().constData(), &d->access, openMode, NULL) == SQLITE_OK) { diff --git a/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp b/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp index 6dd88824b5..560b58817e 100644 --- a/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp +++ b/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp @@ -43,6 +43,7 @@ #include <qdatetime.h> #include <qdebug.h> #include <qfile.h> +#include <qfileinfo.h> #include <qstring.h> #include <qstringlist.h> #include <qtextstream.h> @@ -65,6 +66,7 @@ static QString parentClassName; static QString proxyFile; static QString adaptorFile; static QString inputFile; +static QDateTime classCreationTime; static bool skipNamespaces; static bool verbose; static bool includeMocs; @@ -216,10 +218,13 @@ static void parseCmdLine(QStringList args) static QDBusIntrospection::Interfaces readInput() { QFile input(inputFile); - if (inputFile.isEmpty() || inputFile == QLatin1String("-")) + if (inputFile.isEmpty() || inputFile == QLatin1String("-")) { input.open(stdin, QIODevice::ReadOnly); - else + classCreationTime = QDateTime::currentDateTime(); + } else { input.open(QIODevice::ReadOnly); + classCreationTime = QFileInfo(input).lastModified(); + } QByteArray data = input.readAll(); @@ -556,7 +561,7 @@ static void writeProxy(const QString &filename, const QDBusIntrospection::Interf } includeGuard = QString(QLatin1String("%1_%2")) .arg(includeGuard) - .arg(QDateTime::currentDateTime().toTime_t()); + .arg(classCreationTime.toTime_t()); hs << "#ifndef " << includeGuard << endl << "#define " << includeGuard << endl << endl; diff --git a/src/widgets/doc/src/qtwidgets-examples.qdoc b/src/widgets/doc/src/qtwidgets-examples.qdoc index 985aa24749..6ca15f25e5 100644 --- a/src/widgets/doc/src/qtwidgets-examples.qdoc +++ b/src/widgets/doc/src/qtwidgets-examples.qdoc @@ -127,7 +127,8 @@ /*! \ingroup all-examples - \title Graphicsview Examples + \target Graphicsview Examples + \title Graphics View Examples \brief Using the Graphics View framework. \page examples-graphicsview.html diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index a395785650..fc7bade9f7 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -5036,6 +5036,8 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP return; #endif // Q_WS_MAC + const bool asRoot = flags & DrawAsRoot; + bool onScreen = paintOnScreen(); Q_Q(QWidget); #ifndef QT_NO_GRAPHICSEFFECT @@ -5065,12 +5067,17 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP sharedPainter->restore(); } sourced->context = 0; + + // Native widgets need to be marked dirty on screen so painting will be done in correct context + // Same check as in the no effects case below. + if (backingStore && !onScreen && !asRoot && (q->internalWinId() || !q->nativeParentWidget()->isWindow())) + backingStore->markDirtyOnScreen(rgn, q, offset); + return; } } #endif //QT_NO_GRAFFICSEFFECT - const bool asRoot = flags & DrawAsRoot; const bool alsoOnScreen = flags & DrawPaintOnScreen; const bool recursive = flags & DrawRecursive; const bool alsoInvisible = flags & DrawInvisible; @@ -5084,7 +5091,6 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP subtractOpaqueChildren(toBePainted, q->rect()); if (!toBePainted.isEmpty()) { - bool onScreen = paintOnScreen(); if (!onScreen || alsoOnScreen) { //update the "in paint event" flag if (q->testAttribute(Qt::WA_WState_InPaintEvent)) diff --git a/src/widgets/widgets/qabstractscrollarea.cpp b/src/widgets/widgets/qabstractscrollarea.cpp index d8ee923f7a..db4ff8a2b7 100644 --- a/src/widgets/widgets/qabstractscrollarea.cpp +++ b/src/widgets/widgets/qabstractscrollarea.cpp @@ -167,7 +167,7 @@ QT_BEGIN_NAMESPACE QAbstractScrollAreaPrivate::QAbstractScrollAreaPrivate() :hbar(0), vbar(0), vbarpolicy(Qt::ScrollBarAsNeeded), hbarpolicy(Qt::ScrollBarAsNeeded), - shownOnce(false), sizeAdjustPolicy(QAbstractScrollArea::AdjustIgnored), + shownOnce(false), inResize(false), sizeAdjustPolicy(QAbstractScrollArea::AdjustIgnored), viewport(0), cornerWidget(0), left(0), top(0), right(0), bottom(0), xoffset(0), yoffset(0), viewportFilter(0) #ifdef Q_WS_WIN @@ -995,8 +995,12 @@ bool QAbstractScrollArea::event(QEvent *e) d->viewport->setMouseTracking(hasMouseTracking()); break; case QEvent::Resize: + if (!d->inResize) { + d->inResize = true; d->layoutChildren(); - break; + d->inResize = false; + } + break; case QEvent::Show: if (!d->shownOnce && d->sizeAdjustPolicy == QAbstractScrollArea::AdjustToContentsOnFirstShow) { d->sizeHint = QSize(); diff --git a/src/widgets/widgets/qabstractscrollarea_p.h b/src/widgets/widgets/qabstractscrollarea_p.h index 3093c2f812..2a4b20fe81 100644 --- a/src/widgets/widgets/qabstractscrollarea_p.h +++ b/src/widgets/widgets/qabstractscrollarea_p.h @@ -76,6 +76,7 @@ public: Qt::ScrollBarPolicy vbarpolicy, hbarpolicy; bool shownOnce; + bool inResize; mutable QSize sizeHint; QAbstractScrollArea::SizeAdjustPolicy sizeAdjustPolicy; diff --git a/src/widgets/widgets/qtoolbararealayout.cpp b/src/widgets/widgets/qtoolbararealayout.cpp index 94a1148ded..04ef6a80be 100644 --- a/src/widgets/widgets/qtoolbararealayout.cpp +++ b/src/widgets/widgets/qtoolbararealayout.cpp @@ -485,9 +485,12 @@ void QToolBarAreaLayoutInfo::moveToolBar(QToolBar *toolbar, int pos) QList<int> QToolBarAreaLayoutInfo::gapIndex(const QPoint &pos, int *minDistance) const { - int p = pick(o, pos); - if (rect.contains(pos)) { + // <pos> is in QToolBarAreaLayout coordinates. + // <item.pos> is in local dockarea coordinates (see ~20 lines below) + // Since we're comparing p with item.pos, we put them in the same coordinate system. + const int p = pick(o, pos - rect.topLeft()); + for (int j = 0; j < lines.count(); ++j) { const QToolBarAreaLayoutLine &line = lines.at(j); if (line.skip()) |