From e37616bbad5cadf07f6002f02da880c2630154cb Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Fri, 27 Dec 2013 16:58:31 +0100 Subject: QFileDialog::setDirectory() and directory() should be symmetric QFileDialog::setDirectory() calls options->setInitialDirectory(). Then QFileDialogPrivate::helperPrepareShow() calls it again with the result of QFileDialog::directory(). Assuming there are cases where that's actually necessary, we need QFileDialog::directory() to return the same one which was previously set in setDirectory(). Task-number: QTBUG-35779 Change-Id: Iac1f88c770ff1ef06a7f884f9a42d72674c967ba Reviewed-by: Friedemann Kleint --- src/widgets/dialogs/qfiledialog.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp index da026d23a6..cd95b824a6 100644 --- a/src/widgets/dialogs/qfiledialog.cpp +++ b/src/widgets/dialogs/qfiledialog.cpp @@ -1004,7 +1004,11 @@ void QFileDialog::setDirectory(const QString &directory) QDir QFileDialog::directory() const { Q_D(const QFileDialog); - return QDir(d->nativeDialogInUse ? d->directory_sys().toLocalFile() : d->rootPath()); + if (d->nativeDialogInUse) { + QString dir = d->directory_sys().toLocalFile(); + return QDir(dir.isEmpty() ? d->options->initialDirectory().toLocalFile() : dir); + } + return d->rootPath(); } /*! -- cgit v1.2.3 From 63fd793fc32a8dd85a6d6ce1cfe3811ff99888f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Martins?= Date: Sun, 5 Jan 2014 14:11:11 +0000 Subject: Fix include guard typo. Change-Id: If9400eb5965c739334b3638731e7c80834de72b8 Reviewed-by: David Faure --- src/corelib/codecs/cp949codetbl_p.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/codecs/cp949codetbl_p.h b/src/corelib/codecs/cp949codetbl_p.h index 336b0b75a1..2a62b3c6c7 100644 --- a/src/corelib/codecs/cp949codetbl_p.h +++ b/src/corelib/codecs/cp949codetbl_p.h @@ -40,7 +40,7 @@ ****************************************************************************/ #ifndef CP949CODETBL_P_H -#define CP494CODETBL_P_H +#define CP949CODETBL_P_H // // W A R N I N G @@ -645,4 +645,4 @@ static const unsigned short cp949_icode_to_unicode[] = { 0xd7a2, 0xd7a3 }; -#endif // CP494CODETBL_P_H +#endif // CP949CODETBL_P_H -- cgit v1.2.3 From bd5cea5ba8458ab3d34700999654dbd7d7174084 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Mon, 30 Dec 2013 17:09:12 +0100 Subject: Resurrect QGLWidget::renderPixmap() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This function has been completely broken since Qt 5.0. Unfortunately the autotest's verification steps were somewhat faulty so returning a null pixmap from renderPixmap() did not trigger a failure. The implementation is now done with framebuffer objects and pixel readback. This is not ideal performance-wise, but is the only option. In Qt 4 pixmaps were often backed by platform dependent native pixmaps that could be used as rendering targets for OpenGL content. This is not an option anymore since pixmaps are raster backed on all the major platforms. Task-number: QTBUG-33186 Change-Id: I8f558e33bf7967ac3be439fd5a3eac07b6444be5 Reviewed-by: Jørgen Lind --- src/opengl/qgl.cpp | 103 +++++++++++++++++++++----------------- src/opengl/qgl_p.h | 1 + src/opengl/qgl_qpa.cpp | 3 ++ tests/auto/opengl/qgl/tst_qgl.cpp | 6 ++- 4 files changed, 65 insertions(+), 48 deletions(-) diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index b1fbe2ac71..40a8b1921c 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -2975,6 +2975,10 @@ bool QGLContext::areSharing(const QGLContext *context1, const QGLContext *contex Returns \c true if the paint device of this context is a pixmap; otherwise returns \c false. + + Since Qt 5 the paint device is never actually a pixmap. renderPixmap() is + however still simulated using framebuffer objects and readbacks, and this + function will return \c true in this case. */ /*! @@ -3143,7 +3147,7 @@ QGLFormat QGLContext::requestedFormat() const bool QGLContext::deviceIsPixmap() const { Q_D(const QGLContext); - return d->paintDevice->devType() == QInternal::Pixmap; + return !d->readback_target_size.isEmpty(); } @@ -3885,7 +3889,9 @@ void QGLWidget::setFormat(const QGLFormat &format) void QGLWidget::updateGL() { - if (updatesEnabled() && testAttribute(Qt::WA_Mapped)) + Q_D(QGLWidget); + const bool targetIsOffscreen = !d->glcx->d_ptr->readback_target_size.isEmpty(); + if (updatesEnabled() && (testAttribute(Qt::WA_Mapped) || targetIsOffscreen)) glDraw(); } @@ -4041,20 +4047,28 @@ void QGLWidget::paintEvent(QPaintEvent *) You can use this method on both visible and invisible QGLWidget objects. - This method will create a pixmap and a temporary QGLContext to - render on the pixmap. It will then call initializeGL(), - resizeGL(), and paintGL() on this context. Finally, the widget's - original GL context is restored. + Internally the function renders into a framebuffer object and performs pixel + readback. This has a performance penalty, meaning that this function is not + suitable to be called at a high frequency. + + After creating and binding the framebuffer object, the function will call + initializeGL(), resizeGL(), and paintGL(). On the next normal update + initializeGL() and resizeGL() will be triggered again since the size of the + destination pixmap and the QGLWidget's size may differ. - The size of the pixmap will be \a w pixels wide and \a h pixels - high unless one of these parameters is 0 (the default), in which - case the pixmap will have the same size as the widget. + The size of the pixmap will be \a w pixels wide and \a h pixels high unless + one of these parameters is 0 (the default), in which case the pixmap will + have the same size as the widget. - If \a useContext is true, this method will try to be more - efficient by using the existing GL context to render the pixmap. - The default is false. Only use true if you understand the risks. - Note that under Windows a temporary context has to be created - and usage of the \e useContext parameter is not supported. + Care must be taken when using framebuffer objects in paintGL() in + combination with this function. To switch back to the default framebuffer, + use QGLFramebufferObject::bindDefault(). Binding FBO 0 is wrong since + renderPixmap() uses a custom framebuffer instead of the one provided by the + windowing system. + + \a useContext is ignored. Historically this parameter enabled the usage of + the existing GL context. This is not supported anymore since additional + contexts are never created. Overlays are not rendered onto the pixmap. @@ -4069,43 +4083,31 @@ void QGLWidget::paintEvent(QPaintEvent *) QPixmap QGLWidget::renderPixmap(int w, int h, bool useContext) { + Q_UNUSED(useContext); Q_D(QGLWidget); + QSize sz = size(); if ((w > 0) && (h > 0)) sz = QSize(w, h); - QPixmap pm(sz); - - d->glcx->doneCurrent(); - - bool success = true; - - if (useContext && isValid() && d->renderCxPm(&pm)) - return pm; - - QGLFormat fmt = d->glcx->requestedFormat(); - fmt.setDirectRendering(false); // Direct is unlikely to work - fmt.setDoubleBuffer(false); // We don't need dbl buf - - QGLContext* ocx = d->glcx; - ocx->doneCurrent(); - d->glcx = new QGLContext(fmt, &pm); - d->glcx->create(); - - if (d->glcx->isValid()) + QPixmap pm; + if (d->glcx->isValid()) { + d->glcx->makeCurrent(); + QGLFramebufferObject fbo(sz, QGLFramebufferObject::CombinedDepthStencil); + fbo.bind(); + d->glcx->setInitialized(false); + uint prevDefaultFbo = d->glcx->d_ptr->default_fbo; + d->glcx->d_ptr->default_fbo = fbo.handle(); + d->glcx->d_ptr->readback_target_size = sz; updateGL(); - else - success = false; - - delete d->glcx; - d->glcx = ocx; - - ocx->makeCurrent(); - - if (success) { - return pm; + fbo.release(); + pm = QPixmap::fromImage(fbo.toImage()); + d->glcx->d_ptr->default_fbo = prevDefaultFbo; + d->glcx->setInitialized(false); + d->glcx->d_ptr->readback_target_size = QSize(); } - return QPixmap(); + + return pm; } /*! @@ -4164,14 +4166,23 @@ void QGLWidget::glDraw() if (d->glcx->deviceIsPixmap()) glDrawBuffer(GL_FRONT); #endif + QSize readback_target_size = d->glcx->d_ptr->readback_target_size; if (!d->glcx->initialized()) { glInit(); const qreal scaleFactor = (window() && window()->windowHandle()) ? window()->windowHandle()->devicePixelRatio() : 1.0; - resizeGL(d->glcx->device()->width() * scaleFactor, d->glcx->device()->height() * scaleFactor); // New context needs this "resize" + int w, h; + if (readback_target_size.isEmpty()) { + w = d->glcx->device()->width() * scaleFactor; + h = d->glcx->device()->height() * scaleFactor; + } else { + w = readback_target_size.width(); + h = readback_target_size.height(); + } + resizeGL(w, h); // New context needs this "resize" } paintGL(); - if (doubleBuffer()) { + if (doubleBuffer() && readback_target_size.isEmpty()) { if (d->autoSwap) swapBuffers(); } else { diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h index 484c3ea2d9..22fc3f4ad0 100644 --- a/src/opengl/qgl_p.h +++ b/src/opengl/qgl_p.h @@ -270,6 +270,7 @@ public: uint workaround_brokenAlphaTexSubImage_init : 1; QPaintDevice *paintDevice; + QSize readback_target_size; QColor transpColor; QGLContext *q_ptr; QGLFormat::OpenGLVersionFlags version_flags; diff --git a/src/opengl/qgl_qpa.cpp b/src/opengl/qgl_qpa.cpp index 6e698bf939..8b66c891bb 100644 --- a/src/opengl/qgl_qpa.cpp +++ b/src/opengl/qgl_qpa.cpp @@ -138,6 +138,9 @@ bool QGLContext::chooseContext(const QGLContext* shareContext) { Q_D(QGLContext); if(!d->paintDevice || d->paintDevice->devType() != QInternal::Widget) { + // Unlike in Qt 4, the only possible target is a widget backed by an OpenGL-based + // QWindow. Pixmaps in particular are not supported anymore as paint devices since + // starting from Qt 5 QPixmap is raster-backed on almost all platforms. d->valid = false; }else { QWidget *widget = static_cast(d->paintDevice); diff --git a/tests/auto/opengl/qgl/tst_qgl.cpp b/tests/auto/opengl/qgl/tst_qgl.cpp index 38c92c7610..1ec1d88802 100644 --- a/tests/auto/opengl/qgl/tst_qgl.cpp +++ b/tests/auto/opengl/qgl/tst_qgl.cpp @@ -1380,12 +1380,13 @@ void tst_QGL::glWidgetRenderPixmap() { RenderPixmapWidget *w = new RenderPixmapWidget; - QPixmap pm = w->renderPixmap(100, 100, false); + QSize pmSize = QSize(100, 100); + QPixmap pm = w->renderPixmap(pmSize.width(), pmSize.height(), false); delete w; QImage fb = pm.toImage().convertToFormat(QImage::Format_RGB32); - QImage reference(fb.size(), QImage::Format_RGB32); + QImage reference(pmSize, QImage::Format_RGB32); reference.fill(0xffff0000); QFUZZY_COMPARE_IMAGES(fb, reference); @@ -2011,6 +2012,7 @@ void tst_QGL::textureCleanup() QGLWidget w; w.resize(200,200); w.show(); + QTest::qWaitForWindowExposed(&w); w.makeCurrent(); // Test pixmaps which have been loaded via QPixmapCache are removed from the texture cache -- cgit v1.2.3 From bf32528f4b08b31bf25af6e2e4cb9b8edb7654cd Mon Sep 17 00:00:00 2001 From: James Turner Date: Mon, 16 Dec 2013 13:08:29 +0000 Subject: Add support for OpenType (.otf) fonts FreeType already has support for the file format, so simply ensure they are picked up by the generic database. (Other backends, such as Windows, already had support) [ChangeLog][QtGui] Qt's generic font database now adds OpenType fonts (.otf). Change-Id: Ief5a3329e66b8066aad284172afd004f2cdfaebb Reviewed-by: Konstantin Ritt Reviewed-by: Sean Harmer Reviewed-by: Lars Knoll --- src/platformsupport/fontdatabases/basic/qbasicfontdatabase.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/platformsupport/fontdatabases/basic/qbasicfontdatabase.cpp b/src/platformsupport/fontdatabases/basic/qbasicfontdatabase.cpp index be0164d8eb..33f3601b97 100644 --- a/src/platformsupport/fontdatabases/basic/qbasicfontdatabase.cpp +++ b/src/platformsupport/fontdatabases/basic/qbasicfontdatabase.cpp @@ -103,7 +103,8 @@ void QBasicFontDatabase::populateFontDatabase() QDir dir(fontpath); dir.setNameFilters(QStringList() << QLatin1String("*.ttf") << QLatin1String("*.ttc") << QLatin1String("*.pfa") - << QLatin1String("*.pfb")); + << QLatin1String("*.pfb") + << QLatin1String("*.otf")); dir.refresh(); for (int i = 0; i < int(dir.count()); ++i) { const QByteArray file = QFile::encodeName(dir.absoluteFilePath(dir[i])); -- cgit v1.2.3 From e5bfb9719bc76ca5bd73c5d7503cd2335cabb5fc Mon Sep 17 00:00:00 2001 From: David Faure Date: Sun, 29 Dec 2013 10:07:24 +0100 Subject: QTestLib: use QT_MESSAGE_PATTERN when showing debug output This makes debugging much more convenient, being able to see e.g. the method name where qDebug is used. Note that this doesn't break ignored messages, since qMessageFormatString is only called after the test for ignored messages. Change-Id: I7fc96e3f19efe48ac3a30fdd63e5b495c0d86e02 Reviewed-by: Kai Koehne Reviewed-by: Jason McDonald --- src/testlib/qtestlog.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/testlib/qtestlog.cpp b/src/testlib/qtestlog.cpp index 60f3630709..bbca5b94e5 100644 --- a/src/testlib/qtestlog.cpp +++ b/src/testlib/qtestlog.cpp @@ -56,6 +56,8 @@ QT_BEGIN_NAMESPACE +Q_CORE_EXPORT QString qMessageFormatString(QtMsgType type, const QMessageLogContext &context, const QString& msg); + static void saveCoverageTool(const char * appname, bool testfailed, bool installedTestCoverage) { #ifdef __COVERAGESCANNER__ @@ -230,7 +232,7 @@ namespace QTest { return false; } - static void messageHandler(QtMsgType type, const QMessageLogContext & /*context*/, const QString &message) + static void messageHandler(QtMsgType type, const QMessageLogContext & context, const QString &message) { static QBasicAtomicInt counter = Q_BASIC_ATOMIC_INITIALIZER(QTest::maxWarnings); @@ -245,6 +247,9 @@ namespace QTest { // the message is expected, so just swallow it. return; + msg = qMessageFormatString(type, context, message).toLocal8Bit(); + msg.chop(1); // remove trailing newline + if (type != QtFatalMsg) { if (counter.load() <= 0) return; -- cgit v1.2.3 From c719c38403f70f1d1aec6445381336c6845e2af7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 6 Jan 2014 14:07:40 +0100 Subject: Don't define MAC_OS_X_VERSION_MIN_REQUIRED on iOS Lack of the define is commonly used (and recommended by Apple) as a way to distinguish iOS from OS X. Task-number: QTBUG-35888 Change-Id: I5f3327e001c0af630984fbfde780d9b0c3e30754 Reviewed-by: Simon Hausmann Reviewed-by: Jake Petroules --- src/corelib/global/qsystemdetection.h | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/corelib/global/qsystemdetection.h b/src/corelib/global/qsystemdetection.h index 7b1c32663b..0431e10133 100644 --- a/src/corelib/global/qsystemdetection.h +++ b/src/corelib/global/qsystemdetection.h @@ -210,14 +210,17 @@ #ifdef Q_OS_DARWIN # include -# if !defined(__MAC_OS_X_VERSION_MIN_REQUIRED) || __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_6 -# undef __MAC_OS_X_VERSION_MIN_REQUIRED -# define __MAC_OS_X_VERSION_MIN_REQUIRED __MAC_10_6 -# endif # include -# if !defined(MAC_OS_X_VERSION_MIN_REQUIRED) || MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_6 -# undef MAC_OS_X_VERSION_MIN_REQUIRED -# define MAC_OS_X_VERSION_MIN_REQUIRED MAC_OS_X_VERSION_10_6 +# +# ifdef Q_OS_OSX +# if !defined(__MAC_OS_X_VERSION_MIN_REQUIRED) || __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_6 +# undef __MAC_OS_X_VERSION_MIN_REQUIRED +# define __MAC_OS_X_VERSION_MIN_REQUIRED __MAC_10_6 +# endif +# if !defined(MAC_OS_X_VERSION_MIN_REQUIRED) || MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_6 +# undef MAC_OS_X_VERSION_MIN_REQUIRED +# define MAC_OS_X_VERSION_MIN_REQUIRED MAC_OS_X_VERSION_10_6 +# endif # endif # # // Numerical checks are preferred to named checks, but to be safe -- cgit v1.2.3 From df56ef165198801cd6c9ed1bf0d44a967cd62f18 Mon Sep 17 00:00:00 2001 From: John Layt Date: Sat, 7 Dec 2013 23:33:01 +0100 Subject: QprintDialog - Fix loss of page settings. If you click on the properties button and change the page settings and click OK, then click properties a second time and click cancel, then your original changes are forgotten. Ensure the properties dialog is only deleted if the OK button has never been clicked. Change-Id: I81be8a2c941eeec36c03647d7fea8f498154930a Reviewed-by: Andy Shaw --- src/printsupport/dialogs/qprintdialog_unix.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/printsupport/dialogs/qprintdialog_unix.cpp b/src/printsupport/dialogs/qprintdialog_unix.cpp index a903d170f2..2ec1088bb4 100644 --- a/src/printsupport/dialogs/qprintdialog_unix.cpp +++ b/src/printsupport/dialogs/qprintdialog_unix.cpp @@ -929,7 +929,7 @@ void QUnixPrintWidgetPrivate::_q_btnPropertiesClicked() if (!propertiesDialog) setupPrinterProperties(); propertiesDialog->exec(); - if (propertiesDialog->result() == QDialog::Rejected) { + if (!propertiesDialogShown && propertiesDialog->result() == QDialog::Rejected) { // If properties dialog was rejected the dialog is deleted and // the properties are set to defaults when printer is setup delete propertiesDialog; -- cgit v1.2.3 From ba3804004afb96c9fdea32b967d658f1ffb61a22 Mon Sep 17 00:00:00 2001 From: John Layt Date: Sun, 8 Dec 2013 16:39:49 +0100 Subject: QPageSetupWidget - Fix input of Custom paper size Currently if selecting the Custom paper size in the page setup widget the custom size inputs are not enabled to allow you to actually enter your custom size. Fix the handling of custom paper size to allow manual size entry and fix orientation change. Change-Id: I73b521976ca13c0164441a724bb277c19205d7c9 Reviewed-by: Andy Shaw --- src/printsupport/dialogs/qpagesetupdialog_unix.cpp | 82 ++++++++++++---------- src/printsupport/dialogs/qpagesetupdialog_unix_p.h | 2 +- 2 files changed, 47 insertions(+), 37 deletions(-) diff --git a/src/printsupport/dialogs/qpagesetupdialog_unix.cpp b/src/printsupport/dialogs/qpagesetupdialog_unix.cpp index c1b9828a23..6801863a3a 100644 --- a/src/printsupport/dialogs/qpagesetupdialog_unix.cpp +++ b/src/printsupport/dialogs/qpagesetupdialog_unix.cpp @@ -472,58 +472,68 @@ void QPageSetupWidget::selectPdfPsPrinter(const QPrinter *p) // Updates size/preview after the combobox has been changed. void QPageSetupWidget::_q_paperSizeChanged() { - QVariant val = widget.paperSize->itemData(widget.paperSize->currentIndex()); - int index = m_printer->pageSize(); - if (val.type() == QVariant::Int) { - index = val.toInt(); - } - if (m_blockSignals) return; m_blockSignals = true; - QPrinter::PaperSize size = QPrinter::PaperSize(index); - QPrinter::Orientation orientation = widget.portrait->isChecked() - ? QPrinter::Portrait - : QPrinter::Landscape; - - bool custom = size == QPrinter::Custom; - -#if !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY) - custom = custom && m_cups && (m_printer->paperName() == QLatin1String("Custom")); -#endif - - widget.paperWidth->setEnabled(custom); - widget.paperHeight->setEnabled(custom); - widget.widthLabel->setEnabled(custom); - widget.heightLabel->setEnabled(custom); - if (custom) { - m_paperSize.setWidth( widget.paperWidth->value() * m_currentMultiplier); - m_paperSize.setHeight( widget.paperHeight->value() * m_currentMultiplier); - m_pagePreview->setPaperSize(m_paperSize); - } else { - Q_ASSERT(m_printer); -#if !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY) - if (m_cups && QCUPSSupport::isAvailable()) { // combobox is filled with cups based data + bool custom = false; + QVariant val = widget.paperSize->itemData(widget.paperSize->currentIndex()); + QPrinter::Orientation orientation = widget.portrait->isChecked() ? QPrinter::Portrait : QPrinter::Landscape; + + if (m_cups) { + // OutputFormat == NativeFormat, data is QString Cups paper name + QByteArray cupsPageSize = val.toByteArray(); + custom = (cupsPageSize == QByteArrayLiteral("Custom")); +#ifndef QT_NO_CUPS + if (!custom) { QCUPSSupport cups; - QByteArray cupsPageSize = widget.paperSize->itemData(widget.paperSize->currentIndex()).toByteArray(); - m_paperSize = cups.paperRect(cupsPageSize).size(); - if (orientation == QPrinter::Landscape) - m_paperSize = QSizeF(m_paperSize.height(), m_paperSize.width()); // swap + cups.setCurrentPrinter(m_printer->printerName()); + m_paperSize = sizeForOrientation(orientation, cups.paperRect(cupsPageSize).size()); } - else #endif + } else { + // OutputFormat == PdfFormat, data is QPrinter::PageSize + QPrinter::PaperSize size = QPrinter::PaperSize(val.toInt()); + custom = size == QPrinter::Custom; + if (!custom) m_paperSize = qt_printerPaperSize(orientation, size, QPrinter::Point, 1); + } - m_pagePreview->setPaperSize(m_paperSize); + if (custom) { + // Convert input custom size Units to Points + m_paperSize = QSizeF(widget.paperWidth->value() * m_currentMultiplier, + widget.paperHeight->value() * m_currentMultiplier); + } else { + // Display standard size Points as Units widget.paperWidth->setValue(m_paperSize.width() / m_currentMultiplier); widget.paperHeight->setValue(m_paperSize.height() / m_currentMultiplier); } + + m_pagePreview->setPaperSize(m_paperSize); + + widget.paperWidth->setEnabled(custom); + widget.paperHeight->setEnabled(custom); + widget.widthLabel->setEnabled(custom); + widget.heightLabel->setEnabled(custom); + m_blockSignals = false; } void QPageSetupWidget::_q_pageOrientationChanged() { - if (QPrinter::PaperSize(widget.paperSize->currentIndex()) == QPrinter::Custom) { + bool custom = false; + QVariant val = widget.paperSize->itemData(widget.paperSize->currentIndex()); + + if (m_cups) { + // OutputFormat == NativeFormat, data is QString Cups paper name + QByteArray cupsPageSize = val.toByteArray(); + custom = (cupsPageSize == QByteArrayLiteral("Custom")); + } else { + // OutputFormat == PdfFormat, data is QPrinter::PageSize + QPrinter::PaperSize size = QPrinter::PaperSize(val.toInt()); + custom = size == QPrinter::Custom; + } + + if (custom) { double tmp = widget.paperWidth->value(); widget.paperWidth->setValue(widget.paperHeight->value()); widget.paperHeight->setValue(tmp); diff --git a/src/printsupport/dialogs/qpagesetupdialog_unix_p.h b/src/printsupport/dialogs/qpagesetupdialog_unix_p.h index b96d300ab9..4245c3ae5f 100644 --- a/src/printsupport/dialogs/qpagesetupdialog_unix_p.h +++ b/src/printsupport/dialogs/qpagesetupdialog_unix_p.h @@ -94,7 +94,7 @@ private: qreal m_topMargin; qreal m_rightMargin; qreal m_bottomMargin; - QSizeF m_paperSize; + QSizeF m_paperSize; // In QPrinter::Point qreal m_currentMultiplier; bool m_blockSignals; bool m_cups; -- cgit v1.2.3 From f956ffa9ccdee471752913f8ae5c7e7f57435b8a Mon Sep 17 00:00:00 2001 From: John Layt Date: Mon, 6 Jan 2014 13:18:40 +0100 Subject: QPagedPaintDevice - Fix size of ISO B9 page The ISO B9 page size is 44 x 62 mm, not 33 x 62 mm. Task-number: QTBUG-35966 Change-Id: Ieb2dcd120c51bd7a8997151f2470775ea0b89e08 Reviewed-by: Gunnar Sletta --- src/gui/painting/qpagedpaintdevice.cpp | 4 ++-- src/printsupport/kernel/qprinter.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gui/painting/qpagedpaintdevice.cpp b/src/gui/painting/qpagedpaintdevice.cpp index f41d1830fd..b95b3e3503 100644 --- a/src/gui/painting/qpagedpaintdevice.cpp +++ b/src/gui/painting/qpagedpaintdevice.cpp @@ -71,7 +71,7 @@ static const struct { {125, 176}, // B6 {88, 125}, // B7 {62, 88}, // B8 - {33, 62}, // B9 + {44, 62}, // B9 {163, 229}, // C5E {105, 241}, // US Common {110, 220}, // DLE @@ -133,7 +133,7 @@ QPagedPaintDevice::~QPagedPaintDevice() \value B6 125 x 176 mm \value B7 88 x 125 mm \value B8 62 x 88 mm - \value B9 33 x 62 mm + \value B9 44 x 62 mm \value B10 31 x 44 mm \value C5E 163 x 229 mm \value Comm10E 105 x 241 mm, U.S. Common 10 Envelope diff --git a/src/printsupport/kernel/qprinter.cpp b/src/printsupport/kernel/qprinter.cpp index 5eb840c52a..f23708045d 100644 --- a/src/printsupport/kernel/qprinter.cpp +++ b/src/printsupport/kernel/qprinter.cpp @@ -92,7 +92,7 @@ static const float qt_paperSizes[][2] = { {125, 176}, // B6 {88, 125}, // B7 {62, 88}, // B8 - {33, 62}, // B9 + {44, 62}, // B9 {163, 229}, // C5E {105, 241}, // US Common {110, 220}, // DLE @@ -448,7 +448,7 @@ void QPrinterPrivate::setProperty(QPrintEngine::PrintEnginePropertyKey key, cons \value B6 125 x 176 mm \value B7 88 x 125 mm \value B8 62 x 88 mm - \value B9 33 x 62 mm + \value B9 44 x 62 mm \value B10 31 x 44 mm \value C5E 163 x 229 mm \value Comm10E 105 x 241 mm, U.S. Common 10 Envelope -- cgit v1.2.3 From e48aa2a4027d52f8ca3eed5087e8438d0f931518 Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Wed, 1 Jan 2014 17:22:17 +0100 Subject: Support discovery of key evdev devices. Change-Id: Iac2751b51fb0af9fba181c26ad788f25eb0b02f7 Done-with: Andrew den Exter Reviewed-by: Laszlo Agocs --- src/platformsupport/devicediscovery/qdevicediscovery_udev.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/platformsupport/devicediscovery/qdevicediscovery_udev.cpp b/src/platformsupport/devicediscovery/qdevicediscovery_udev.cpp index ac902b4140..8a0a0f43ac 100644 --- a/src/platformsupport/devicediscovery/qdevicediscovery_udev.cpp +++ b/src/platformsupport/devicediscovery/qdevicediscovery_udev.cpp @@ -130,8 +130,10 @@ QStringList QDeviceDiscovery::scanConnectedDevices() udev_enumerate_add_match_property(ue, "ID_INPUT_TOUCHPAD", "1"); if (m_types & Device_Touchscreen) udev_enumerate_add_match_property(ue, "ID_INPUT_TOUCHSCREEN", "1"); - if (m_types & Device_Keyboard) + if (m_types & Device_Keyboard) { udev_enumerate_add_match_property(ue, "ID_INPUT_KEYBOARD", "1"); + udev_enumerate_add_match_property(ue, "ID_INPUT_KEY", "1"); + } if (m_types & Device_Tablet) udev_enumerate_add_match_property(ue, "ID_INPUT_TABLET", "1"); @@ -242,6 +244,9 @@ bool QDeviceDiscovery::checkDeviceType(udev_device *dev) } } + if ((m_types & Device_Keyboard) && (qstrcmp(udev_device_get_property_value(dev, "ID_INPUT_KEY"), "1") == 0 )) + return true; + if ((m_types & Device_Mouse) && (qstrcmp(udev_device_get_property_value(dev, "ID_INPUT_MOUSE"), "1") == 0)) return true; -- cgit v1.2.3 From 702bda5cc9138d31cfe6ed25ead2edfda1fa623d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 6 Jan 2014 15:06:01 +0100 Subject: iOS: Use in-place string renaming to rename main() instead of ld Processing the object file with ld strips away debug information for the main() function, resulting in the debugger not being able to break on specific lines of the function. It also causes issues when externing sybols in main's object file. We revert back to the approach of using the strings in-line in the object file (which is why we keep the name the same length, 'qtmn'). Task-number: QTBUG-35553 Change-Id: I8b0acee36f48ecfefa2e4fd008a842365713d985 Reviewed-by: Simon Hausmann --- mkspecs/macx-ios-clang/features/qt.prf | 7 +-- mkspecs/macx-ios-clang/rename_main.sh | 63 ++++++++++++++++++++++++ src/plugins/platforms/ios/qioseventdispatcher.mm | 4 +- 3 files changed, 66 insertions(+), 8 deletions(-) create mode 100755 mkspecs/macx-ios-clang/rename_main.sh diff --git a/mkspecs/macx-ios-clang/features/qt.prf b/mkspecs/macx-ios-clang/features/qt.prf index 9202a70a5a..04ebb1208a 100644 --- a/mkspecs/macx-ios-clang/features/qt.prf +++ b/mkspecs/macx-ios-clang/features/qt.prf @@ -42,12 +42,7 @@ equals(TEMPLATE, app):contains(QT, gui(-private)?) { !isEmpty(QMAKE_PRE_LINK): \ QMAKE_PRE_LINK += ";" - QMAKE_PRE_LINK += \ - "for f in $(find $${objects_dir} -name '*.o'); do" \ - "(nm $f | grep -q 'T _main' && cp $f $f.original" \ - "&& ld -r -alias _main _qt_main -unexported_symbol _main $f.original -o $f)" \ - "|| true" \ - "; done" + QMAKE_PRE_LINK += $$QMAKESPEC/rename_main.sh $${objects_dir} } } diff --git a/mkspecs/macx-ios-clang/rename_main.sh b/mkspecs/macx-ios-clang/rename_main.sh new file mode 100755 index 0000000000..b30eb160d0 --- /dev/null +++ b/mkspecs/macx-ios-clang/rename_main.sh @@ -0,0 +1,63 @@ +#!/bin/bash + +############################################################################# +## +## Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). +## Contact: http://www.qt-project.org/legal +## +## This file is the build configuration utility of the Qt Toolkit. +## +## $QT_BEGIN_LICENSE:LGPL$ +## Commercial License Usage +## Licensees holding valid commercial Qt licenses may use this file in +## accordance with the commercial license agreement provided with the +## Software or, alternatively, in accordance with the terms contained in +## a written agreement between you and Digia. For licensing terms and +## conditions see http://qt.digia.com/licensing. For further information +## use the contact form at http://qt.digia.com/contact-us. +## +## GNU Lesser General Public License Usage +## Alternatively, this file may be used under the terms of the GNU Lesser +## General Public License version 2.1 as published by the Free Software +## Foundation and appearing in the file LICENSE.LGPL included in the +## packaging of this file. Please review the following information to +## ensure the GNU Lesser General Public License version 2.1 requirements +## will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +## +## In addition, as a special exception, Digia gives you certain additional +## rights. These rights are described in the Digia Qt LGPL Exception +## version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +## +## GNU General Public License Usage +## Alternatively, this file may be used under the terms of the GNU +## General Public License version 3.0 as published by the Free Software +## Foundation and appearing in the file LICENSE.GPL included in the +## packaging of this file. Please review the following information to +## ensure the GNU General Public License version 3.0 requirements will be +## met: http://www.gnu.org/copyleft/gpl.html. +## +## +## $QT_END_LICENSE$ +## +############################################################################# + +if [ $# -eq 0 ]; then + echo "usage: $0 " +else + for f in $(find $1 -name '*.o'); do + # Skip object files without the _main symbol + nm $f | grep -q 'T _main$' || continue + + echo "Found main() in ${f#$1/}" + + strings -t d - $f | grep '_main\(\.eh\)\?$' | while read match; do + offset=$(echo $match | cut -d ' ' -f 1) + symbol=$(echo $match | cut -d ' ' -f 2) + + echo " Renaming '$symbol' at offset $offset to '${symbol/main/qtmn}'" + + # In-place rename the string (keeping the same length) + printf '_qtmn' | dd of=$f bs=1 seek=$offset conv=notrunc >/dev/null 2>&1 + done + done +fi \ No newline at end of file diff --git a/src/plugins/platforms/ios/qioseventdispatcher.mm b/src/plugins/platforms/ios/qioseventdispatcher.mm index f93c6cc3a7..821599d113 100644 --- a/src/plugins/platforms/ios/qioseventdispatcher.mm +++ b/src/plugins/platforms/ios/qioseventdispatcher.mm @@ -246,7 +246,7 @@ enum SetJumpResult // user our main wrapper. Since the symbol is weak, it will not // get used or cause a clash in the normal Qt application usecase, // where we rename main to qt_main. -extern "C" int __attribute__((weak)) qt_main(int argc, char *argv[]) +extern "C" int __attribute__((weak)) qtmn(int argc, char *argv[]) { Q_UNUSED(argc); Q_UNUSED(argv); @@ -265,7 +265,7 @@ static void __attribute__((noinline, noreturn)) user_main_trampoline() strcpy(argv[i], [arg cStringUsingEncoding:[NSString defaultCStringEncoding]]); } - int exitCode = qt_main(argc, argv); + int exitCode = qtmn(argc, argv); delete[] argv; qEventDispatcherDebug() << "Returned from main with exit code " << exitCode; -- cgit v1.2.3 From 183a3ca2ec5b81771cddec104baf37540661ac96 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Mon, 6 Jan 2014 13:10:25 +0100 Subject: Cocoa: fix gnu emacs style shortcut for action in menu The regression was introduced in bdebec4e2ef79f1771d2dcc22f9a919eb4487567. Cocoa QPA plugin only could handle the shortcut with one key sequence, not the multiple key sequences. We just let Qt to handle those cases. Task-number: QTBUG-33627 Change-Id: I3898308d9f4ecda8bd716d8b286f05f9f311774a Reviewed-by: Gabriel de Dietrich --- src/widgets/kernel/qshortcut.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/widgets/kernel/qshortcut.cpp b/src/widgets/kernel/qshortcut.cpp index f7f7cf1039..dcf6aed591 100644 --- a/src/widgets/kernel/qshortcut.cpp +++ b/src/widgets/kernel/qshortcut.cpp @@ -279,13 +279,12 @@ static bool correctActionContext(Qt::ShortcutContext context, QAction *a, QWidge // (and reaches this point), then the menu item itself has been disabled. // This occurs at the QPA level on Mac, were we disable all the Cocoa menus // when showing a modal window. - Q_UNUSED(menu); - continue; -#else + if (a->shortcut().count() <= 1) + continue; +#endif QAction *a = menu->menuAction(); if (correctActionContext(context, a, active_window)) return true; -#endif } else #endif if (correctWidgetContext(context, w, active_window)) -- cgit v1.2.3 From 3b2143bdf79d84d79a1a1163212b8deaebb13820 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Tue, 7 Jan 2014 08:13:51 +0100 Subject: Revert "Skip tst_QMenu::QTBUG_10735_crashWithDialog() on Mac OS X" This test doesn't fail any more. This reverts commit 6f21509ac006cf8cd82d3b35b1016a4f9a0c0f89. Task-number: QTBUG-23677 Change-Id: Idc094ce0c90b8d3ba0a75d93ccef8da4801605c7 Reviewed-by: Sergio Ahumada Reviewed-by: Gabriel de Dietrich --- tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp index 9e181c0676..f7dff7bc57 100644 --- a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp +++ b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp @@ -1019,10 +1019,6 @@ private: void tst_QMenu::QTBUG_10735_crashWithDialog() { -#ifdef Q_OS_MAC - QSKIP("Test currently hangs on Mac OS X, see QTBUG-23677"); -#endif - MyMenu menu; QTimer::singleShot(1000, &menu, SLOT(activateLastAction())); -- cgit v1.2.3 From dbaff44ff1ebf04c5d2533f7a345db09cd55b00d Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Tue, 7 Jan 2014 08:33:33 +0100 Subject: test: fix tst_QPushButton::sizeHint() with Mac style on Mac OS X The style name should be macintosh, not mac. This also reverts commit 2f46ea9fd677ffff3592b096db4aecdaaaa2b5aa. Task-number: QTBUG-23680 Change-Id: I7fd06da165ca5bc99801c13af13fdb3d35119566 Reviewed-by: Sergio Ahumada Reviewed-by: Gabriel de Dietrich --- tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp b/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp index 75c826c4cc..d336d00b3e 100644 --- a/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp +++ b/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp @@ -566,7 +566,7 @@ void tst_QPushButton::sizeHint_data() QTest::newRow("gtk") << QString::fromLatin1("gtk"); #endif #if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC) - QTest::newRow("mac") << QString::fromLatin1("mac"); + QTest::newRow("macintosh") << QString::fromLatin1("macintosh"); #endif #if !defined(QT_NO_STYLE_FUSION) QTest::newRow("fusion") << QString::fromLatin1("fusion"); @@ -589,11 +589,6 @@ void tst_QPushButton::sizeHint() { QFETCH(QString, stylename); -#ifdef Q_OS_MAC - if (stylename == "mac") - QSKIP("QStyleFactory cannot create the Mac style, see QTBUG-23680"); -#endif - QStyle *style = QStyleFactory::create(stylename); if (!style) QFAIL(qPrintable(QString::fromLatin1("Cannot create style: %1").arg(stylename))); -- cgit v1.2.3 From 35f2a61426dab80af464b0aa24d41a070b4c145c Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Tue, 7 Jan 2014 08:57:34 +0100 Subject: QKeySequence: return Qt::Key_unknown with invalid modifiers on OS X This also fixes the auto test, tst_QKeySequence::parseString() with Win+A and Simon+G. [ChangeLog][QtGui][OS X][QKeySequence] return Qt::Key_unknown with invalid modifiers on OS X Task-number: QTBUG-24406 Change-Id: Ie90393c9691f443c7c359cb3a487609a9691bc44 Reviewed-by: Gabriel de Dietrich --- src/gui/kernel/qkeysequence.cpp | 3 +-- tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp | 5 ----- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp index ead248074e..5770b76f1f 100644 --- a/src/gui/kernel/qkeysequence.cpp +++ b/src/gui/kernel/qkeysequence.cpp @@ -1075,7 +1075,7 @@ int QKeySequencePrivate::decodeString(const QString &str, QKeySequence::Sequence sl = accel; } } -#else +#endif int i = 0; int lastI = 0; while ((i = sl.indexOf(QLatin1Char('+'), i + 1)) != -1) { @@ -1110,7 +1110,6 @@ int QKeySequencePrivate::decodeString(const QString &str, QKeySequence::Sequence } lastI = i + 1; } -#endif int p = accel.lastIndexOf(QLatin1Char('+'), str.length() - 2); // -2 so that Ctrl++ works if(p > 0) diff --git a/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp b/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp index 19fcb6ea9f..bd7bd3a464 100644 --- a/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp +++ b/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp @@ -606,11 +606,6 @@ void tst_QKeySequence::parseString() QFETCH( QString, strSequence ); QFETCH( QKeySequence, keycode ); -#ifdef Q_OS_MAC - QEXPECT_FAIL("Win+A", "QTBUG-24406 - This test fails on OSX", Abort); - QEXPECT_FAIL("Simon+G", "QTBUG-24406 - This test fails on OSX", Abort); -#endif - QCOMPARE( QKeySequence(strSequence).toString(), keycode.toString() ); QVERIFY( QKeySequence(strSequence) == keycode ); } -- cgit v1.2.3 From 805954119958d660cfc156681c7e3fb7ca7c0b44 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Tue, 7 Jan 2014 13:49:08 +0100 Subject: Stabilize one function in tst_qpauseanimation.cpp Under load the timing may go wrong. Change-Id: Iaa947fb9adcfccd2568337adbb17094996cce827 Reviewed-by: Friedemann Kleint --- .../auto/corelib/animation/qpauseanimation/tst_qpauseanimation.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/auto/corelib/animation/qpauseanimation/tst_qpauseanimation.cpp b/tests/auto/corelib/animation/qpauseanimation/tst_qpauseanimation.cpp index 55a2bc7882..529069552b 100644 --- a/tests/auto/corelib/animation/qpauseanimation/tst_qpauseanimation.cpp +++ b/tests/auto/corelib/animation/qpauseanimation/tst_qpauseanimation.cpp @@ -259,14 +259,14 @@ void tst_QPauseAnimation::pauseResume() animation.pause(); QVERIFY(animation.state() == QAbstractAnimation::Paused); animation.start(); - QTest::qWait(300); - QVERIFY(animation.state() == QAbstractAnimation::Stopped); + QTRY_COMPARE(animation.state(), QAbstractAnimation::Stopped); #ifdef Q_OS_WIN if (animation.m_updateCurrentTimeCount != 3) QEXPECT_FAIL("", winTimerError, Abort); #endif - QCOMPARE(animation.m_updateCurrentTimeCount, 3); + QVERIFY2(animation.m_updateCurrentTimeCount >= 3, qPrintable( + QString::fromLatin1("animation.m_updateCurrentTimeCount = %1").arg(animation.m_updateCurrentTimeCount))); } void tst_QPauseAnimation::sequentialPauseGroup() -- cgit v1.2.3 From 183b862fe0bf89cb329706f29b6b421c73e20d3e Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 19 Dec 2013 16:13:16 +0100 Subject: make the pkg-config error message more precise while the meaning of the error message is actually pretty obvious from the context, some people apparently expect an equivalence with their package manager's terminology. Change-Id: Ie7a31887bf5086e5d1d7de7e339a6d08571a4d01 Reviewed-by: Robin Burchell Reviewed-by: Joerg Bornemann --- mkspecs/features/link_pkgconfig.prf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkspecs/features/link_pkgconfig.prf b/mkspecs/features/link_pkgconfig.prf index 4e36b7c83c..44d1a4c045 100644 --- a/mkspecs/features/link_pkgconfig.prf +++ b/mkspecs/features/link_pkgconfig.prf @@ -7,7 +7,7 @@ for(ever) { libvar = LIBS$$pkgsfx for(PKGCONFIG_LIB, $$list($$unique($$pkgvar))) { # don't proceed if the .pro asks for a package we don't have! - !packagesExist($$PKGCONFIG_LIB):error("Package $$PKGCONFIG_LIB not found") + !packagesExist($$PKGCONFIG_LIB): error("$$PKGCONFIG_LIB development package not found") PKGCONFIG_CFLAGS = $$system($$PKG_CONFIG --cflags $$PKGCONFIG_LIB) -- cgit v1.2.3 From 65a676372c533e8b35117081ec0aa1a94e1500e5 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 16 Dec 2013 14:25:55 +0100 Subject: do not look for mkspecs/ directories in project trees MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit this pretty surprising behavior would interfere with building the examples from an installed qt tree with qmakes from other qt builds. .qmake.conf (and .qmake.cache) files provide a possibility to explicitly "anchor" project roots, so there is no point in having a second, even more magic way to do it. Task-number: QTBUG-35485 Change-Id: I8fd4fda67cabafdf55e7a98282dcdfaffb4a405e Reviewed-by: Tor Arne Vestbø --- qmake/library/qmakeevaluator.cpp | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/qmake/library/qmakeevaluator.cpp b/qmake/library/qmakeevaluator.cpp index f46eb75670..e17ac16e96 100644 --- a/qmake/library/qmakeevaluator.cpp +++ b/qmake/library/qmakeevaluator.cpp @@ -1118,28 +1118,7 @@ bool QMakeEvaluator::prepareProject(const QString &inDir) } no_cache: - // Look for mkspecs/ in source and build. First to win determines the root. - QString sdir = inDir; QString dir = m_outputDir; - while (dir != m_buildRoot) { - if ((dir != sdir && QFileInfo(sdir, QLatin1String("mkspecs")).isDir()) - || QFileInfo(dir, QLatin1String("mkspecs")).isDir()) { - if (dir != sdir) - m_sourceRoot = sdir; - m_buildRoot = dir; - break; - } - if (dir == superdir) - break; - QFileInfo qsdfi(sdir); - QFileInfo qdfi(dir); - if (qsdfi.isRoot() || qdfi.isRoot()) - break; - sdir = qsdfi.path(); - dir = qdfi.path(); - } - - dir = m_outputDir; forever { QString stashfile = dir + QLatin1String("/.qmake.stash"); if (dir == (!superdir.isEmpty() ? superdir : m_buildRoot) || m_vfs->exists(stashfile)) { -- cgit v1.2.3 From 6112f8938c962e49b9277ef7152bf1303789ade7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Tue, 7 Jan 2014 11:41:03 +0100 Subject: Make QRubberBand transparent on Mac OS X Restore Q_WS_MAC code path. Task-number: QTBUG-35987 Change-Id: I1ad50dd93e9c7116963e09d94ad114bcb6a1c31f Reviewed-by: Liang Qi Reviewed-by: Friedemann Kleint --- src/widgets/widgets/qrubberband.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/widgets/widgets/qrubberband.cpp b/src/widgets/widgets/qrubberband.cpp index 112a9b66cd..ea58d45e46 100644 --- a/src/widgets/widgets/qrubberband.cpp +++ b/src/widgets/widgets/qrubberband.cpp @@ -86,7 +86,7 @@ void QRubberBand::initStyleOption(QStyleOptionRubberBand *option) const return; option->initFrom(this); option->shape = d_func()->shape; -#ifndef Q_WS_MAC +#ifndef Q_OS_MAC option->opaque = true; #else option->opaque = windowFlags() & RUBBERBAND_WINDOW_TYPE; -- cgit v1.2.3 From 2b3f293d892c5268bd2a07ed17fa9fc5adacbd76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Str=C3=B8mme?= Date: Thu, 12 Dec 2013 16:03:12 +0100 Subject: Android: Refactor the InputType mapping code. - Fix issue where input flags and classes where wrongly mixed. - Adds DATETIME class (support for Qt::ImhDate/Qt::ImhTime). - Adds TYPE_NUMBER_VARIATION_PASSWORD for API level > 10. Task-number: QTBUG-35198 Change-Id: I794159ca7c19d38b0b97521448cef0f5112ee8ba Reviewed-by: BogDan Vatra --- .../qtproject/qt5/android/QtActivityDelegate.java | 76 ++++++++++++---------- 1 file changed, 41 insertions(+), 35 deletions(-) diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java index 07b517d3d0..d8c560933f 100644 --- a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java +++ b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java @@ -242,50 +242,56 @@ public class QtActivityDelegate int imeOptions = android.view.inputmethod.EditorInfo.IME_ACTION_DONE; int inputType = android.text.InputType.TYPE_CLASS_TEXT; - if ((inputHints & ImhMultiLine) != 0) { - inputType = android.text.InputType.TYPE_CLASS_TEXT | android.text.InputType.TYPE_TEXT_FLAG_MULTI_LINE; - imeOptions = android.view.inputmethod.EditorInfo.IME_FLAG_NO_ENTER_ACTION; - } - - if (((inputHints & ImhNoAutoUppercase) != 0 || (inputHints & ImhPreferUppercase) != 0) - && (inputHints & ImhLowercaseOnly) == 0) { - initialCapsMode = android.text.TextUtils.CAP_MODE_SENTENCES; - } - - if ((inputHints & ImhUppercaseOnly) != 0) - initialCapsMode = android.text.TextUtils.CAP_MODE_CHARACTERS; - - if ((inputHints & ImhHiddenText) != 0) - inputType = android.text.InputType.TYPE_TEXT_VARIATION_PASSWORD; - - if ((inputHints & ImhPreferNumbers) != 0) + if ((inputHints & (ImhPreferNumbers | ImhDigitsOnly | ImhFormattedNumbersOnly)) != 0) { inputType = android.text.InputType.TYPE_CLASS_NUMBER; + if ((inputHints & ImhFormattedNumbersOnly) != 0) { + inputType |= (android.text.InputType.TYPE_NUMBER_FLAG_DECIMAL + | android.text.InputType.TYPE_NUMBER_FLAG_SIGNED); + } - if ((inputHints & ImhDigitsOnly) != 0) - inputType = android.text.InputType.TYPE_CLASS_NUMBER; + if (Build.VERSION.SDK_INT > 10 && (inputHints & ImhHiddenText) != 0) + inputType |= 0x10; + } else if ((inputHints & ImhDialableCharactersOnly) != 0) { + inputType = android.text.InputType.TYPE_CLASS_PHONE; + } else if ((inputHints & (ImhDate | ImhTime)) != 0) { + inputType = android.text.InputType.TYPE_CLASS_DATETIME; + if ((inputHints & ImhDate) != 0) + inputType |= android.text.InputType.TYPE_DATETIME_VARIATION_DATE; + if ((inputHints & ImhTime) != 0) + inputType |= android.text.InputType.TYPE_DATETIME_VARIATION_TIME; + } else { // CLASS_TEXT + if ((inputHints & ImhHiddenText) != 0) { + inputType |= android.text.InputType.TYPE_TEXT_VARIATION_PASSWORD; + } else if ((inputHints & (ImhNoAutoUppercase | ImhNoPredictiveText | ImhSensitiveData)) != 0) { + inputType |= android.text.InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD; + } - if ((inputHints & ImhFormattedNumbersOnly) != 0) { - inputType = android.text.InputType.TYPE_CLASS_NUMBER - | android.text.InputType.TYPE_NUMBER_FLAG_DECIMAL - | android.text.InputType.TYPE_NUMBER_FLAG_SIGNED; - } + if ((inputHints & ImhEmailCharactersOnly) != 0) + inputType |= android.text.InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS; - if ((inputHints & ImhDialableCharactersOnly) != 0) - inputType = android.text.InputType.TYPE_CLASS_PHONE; + if ((inputHints & ImhUrlCharactersOnly) != 0) { + inputType |= android.text.InputType.TYPE_TEXT_VARIATION_URI; + imeOptions = android.view.inputmethod.EditorInfo.IME_ACTION_GO; + } - if ((inputHints & ImhEmailCharactersOnly) != 0) - inputType = android.text.InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS; + if ((inputHints & ImhMultiLine) != 0) + inputType |= android.text.InputType.TYPE_TEXT_FLAG_MULTI_LINE; - if ((inputHints & ImhUrlCharactersOnly) != 0) { - inputType = android.text.InputType.TYPE_TEXT_VARIATION_URI; - imeOptions = android.view.inputmethod.EditorInfo.IME_ACTION_GO; - } + if ((inputHints & ImhUppercaseOnly) != 0) { + initialCapsMode |= android.text.TextUtils.CAP_MODE_CHARACTERS; + inputType |= android.text.InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS; + } else if ((inputHints & ImhLowercaseOnly) == 0 && (inputHints & ImhNoAutoUppercase) == 0) { + initialCapsMode |= android.text.TextUtils.CAP_MODE_SENTENCES; + inputType |= android.text.InputType.TYPE_TEXT_FLAG_CAP_SENTENCES; + } - if ((inputHints & ImhNoPredictiveText) != 0) { - //android.text.InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS | android.text.InputType.TYPE_CLASS_TEXT; - inputType = android.text.InputType.TYPE_CLASS_TEXT | android.text.InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD; + if ((inputHints & ImhNoPredictiveText) != 0 || (inputHints & ImhSensitiveData) != 0) + inputType |= android.text.InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS; } + if ((inputHints & ImhMultiLine) != 0) + imeOptions = android.view.inputmethod.EditorInfo.IME_FLAG_NO_ENTER_ACTION; + m_editText.setInitialCapsMode(initialCapsMode); m_editText.setImeOptions(imeOptions); m_editText.setInputType(inputType); -- cgit v1.2.3 From 46b397d67f4f5e623364d73648478de623381b01 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Mon, 6 Jan 2014 10:04:23 +0100 Subject: fix detection for multiple VS installations In the case of multiple VS installations, a static variable wasn't initialized. That led to wrong values in subsequent calls of the detection function. [ChangeLog][qtbase][qmake] fix detection for multiple VS installations Task-number: QTBUG-35530 Change-Id: I3fc23bc99679fff640f39578a7074d16fe923334 Reviewed-by: Andy Shaw --- qmake/generators/win32/msvc_vcproj.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp index fbc2f6b0a6..f86c8512d4 100644 --- a/qmake/generators/win32/msvc_vcproj.cpp +++ b/qmake/generators/win32/msvc_vcproj.cpp @@ -149,8 +149,10 @@ DotNET which_dotnet_version() const QString productPath = installPaths.value(dotNetCombo[i].version); if (productPath.isEmpty()) continue; - if (path.startsWith(productPath, Qt::CaseInsensitive)) - return dotNetCombo[i].version; + if (path.startsWith(productPath, Qt::CaseInsensitive)) { + current_version = dotNetCombo[i].version; + return current_version; + } } } -- cgit v1.2.3 From f0f6c1d0edd8c71530b8e47b61d70aa55a0c6a0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Martins?= Date: Wed, 8 Jan 2014 20:19:59 +0000 Subject: Fix evdevtouch build with -qtnamespace Change-Id: Ibac69cfa44eff33d8cc172fc16cf105fff4c12b1 Reviewed-by: Giuseppe D'Angelo Reviewed-by: Robin Burchell --- src/platformsupport/input/evdevtouch/qevdevtouch_p.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/platformsupport/input/evdevtouch/qevdevtouch_p.h b/src/platformsupport/input/evdevtouch/qevdevtouch_p.h index dbd401c297..d0ea839f51 100644 --- a/src/platformsupport/input/evdevtouch/qevdevtouch_p.h +++ b/src/platformsupport/input/evdevtouch/qevdevtouch_p.h @@ -48,13 +48,14 @@ #include #include +#if !defined(QT_NO_MTDEV) +struct mtdev; +#endif + QT_BEGIN_NAMESPACE class QSocketNotifier; class QEvdevTouchScreenData; -#if !defined(QT_NO_MTDEV) -struct mtdev; -#endif class QEvdevTouchScreenHandler : public QObject { -- cgit v1.2.3 From 131a511194935554357972c99c325c7202077560 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 7 Jan 2014 10:55:49 +0200 Subject: Ensure that the Qt5Core library does not contain "QTMETADATA ". In the event the plugin loader encounters it due to some configuration problem, it is otherwise detected as a plugin causing a crash when trying to read the meta data. Task-number: QTBUG-35970 Change-Id: I34182b3a61125e3b192dfd4b1dc03bd1e98c693e Reviewed-by: Lars Knoll --- src/corelib/plugin/qlibrary.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/corelib/plugin/qlibrary.cpp b/src/corelib/plugin/qlibrary.cpp index 77de4d594e..468f759189 100644 --- a/src/corelib/plugin/qlibrary.cpp +++ b/src/corelib/plugin/qlibrary.cpp @@ -256,7 +256,8 @@ static bool findPatternUnloaded(const QString &library, QLibraryPrivate *lib) */ bool hasMetaData = false; long pos = 0; - const char pattern[] = "QTMETADATA "; + char pattern[] = "qTMETADATA "; + pattern[0] = 'Q'; // Ensure the pattern "QTMETADATA" is not found in this library should QPluginLoader ever encounter it. const ulong plen = qstrlen(pattern); #if defined (Q_OF_ELF) && defined(Q_CC_GNU) int r = QElfParser().parse(filedata, fdlen, library, lib, &pos, &fdlen); -- cgit v1.2.3 From b4c28856f16c164a5a774722a379bbe34a45527c Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 9 Jan 2014 09:33:17 +0100 Subject: Windows: Silence warning in QWindowsFileDialogHelper::selectFile(). The function is invoked from the QFileDialog constructor in save file mode when passing a non-existing file. Task-number: QTBUG-35703 Change-Id: I5c13efb9b6789404b28739f6ce88ed87b594b6e4 Reviewed-by: Joerg Bornemann --- src/plugins/platforms/windows/qwindowsdialoghelpers.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp index 7ba48fe0cb..497d0975af 100644 --- a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp +++ b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp @@ -1633,8 +1633,8 @@ void QWindowsFileDialogHelper::selectFile(const QUrl &fileName) if (QWindowsContext::verboseDialogs) qDebug("%s %s" , __FUNCTION__, qPrintable(fileName.toString())); - if (QWindowsNativeFileDialogBase *nfd = nativeFileDialog()) - nfd->selectFile(fileName.toLocalFile()); // ## should use QUrl::fileName() once it exists + if (hasNativeDialog()) // Might be invoked from the QFileDialog constructor. + nativeFileDialog()->selectFile(fileName.toLocalFile()); // ## should use QUrl::fileName() once it exists } QList QWindowsFileDialogHelper::selectedFiles() const -- cgit v1.2.3 From 08127d93b4ffad36d66e53ff754e3d9a354d00b5 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 7 Jan 2014 15:23:01 +0100 Subject: don't make msvc see digraphs Task-number: QTBUG-35816 Change-Id: I996a86233f771d6a466c5c5eb6116df14cd00dbd Reviewed-by: Olivier Goffart Reviewed-by: Stephen Kelly Reviewed-by: Marc Mutz --- src/corelib/global/qtypeinfo.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/global/qtypeinfo.h b/src/corelib/global/qtypeinfo.h index 58736ac2b8..5837c8d94e 100644 --- a/src/corelib/global/qtypeinfo.h +++ b/src/corelib/global/qtypeinfo.h @@ -207,7 +207,7 @@ Q_DECLARE_TYPEINFO_BODY(QFlags, Q_PRIMITIVE_TYPE); #define Q_DECLARE_SHARED_STL(TYPE) \ QT_END_NAMESPACE \ namespace std { \ - template<> inline void swap(QT_PREPEND_NAMESPACE(TYPE) &value1, QT_PREPEND_NAMESPACE(TYPE) &value2) \ + template<> inline void swap< QT_PREPEND_NAMESPACE(TYPE) >(QT_PREPEND_NAMESPACE(TYPE) &value1, QT_PREPEND_NAMESPACE(TYPE) &value2) \ { value1.swap(value2); } \ } \ QT_BEGIN_NAMESPACE -- cgit v1.2.3 From 7c03f00a4ea6da72e0064ecb659c4c4bc3c8083b Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Mon, 6 Jan 2014 17:30:45 +0100 Subject: GTK FileDialog: don't convert QUrl to QString prematurely File dialog APIs are being converted to QUrls as much as possible. Task-number: QTBUG-35947 Task-number: QTBUG-35948 Change-Id: I98d86249ac5018c3b7439065ae6ad7f1c7422a08 Reviewed-by: Frederik Gladhorn --- src/plugins/platformthemes/gtk2/qgtk2dialoghelpers.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/plugins/platformthemes/gtk2/qgtk2dialoghelpers.cpp b/src/plugins/platformthemes/gtk2/qgtk2dialoghelpers.cpp index e8758da1c7..f85fe0839f 100644 --- a/src/plugins/platformthemes/gtk2/qgtk2dialoghelpers.cpp +++ b/src/plugins/platformthemes/gtk2/qgtk2dialoghelpers.cpp @@ -419,12 +419,11 @@ void QGtk2FileDialogHelper::applyOptions() if (!nameFilters.isEmpty()) setNameFilters(nameFilters); - const QString initialDirectory = opts->initialDirectory().toLocalFile(); - if (!initialDirectory.isEmpty()) - setDirectory(initialDirectory); + if (opts->initialDirectory().isLocalFile()) + setDirectory(opts->initialDirectory()); foreach (const QUrl &filename, opts->initiallySelectedFiles()) - selectFile(filename.toLocalFile()); + selectFile(filename); const QString initialNameFilter = opts->initiallySelectedNameFilter(); if (!initialNameFilter.isEmpty()) -- cgit v1.2.3 From 62c4e288a11769bde45c9c74d731ed8628303f19 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Thu, 9 Jan 2014 10:48:41 +0100 Subject: Mitigate performance regression in isExpandedEntityValueTooLarge(). 46a8885ae486e238a39efa5119c2714f328b08e4 fixed a security issue [1], but also caused a large performance regression. This patch improves the performance from ~98 seconds to ~.1 second for 1000 entities, using the benchmark in the bug report: "0": 0 msecs per iteration (total: 0, iterations: 1) "250": 1,547 msecs per iteration (total: 1,547, iterations: 1) "500": 12,254 msecs per iteration (total: 12,254, iterations: 1) "750": 45,506 msecs per iteration (total: 45,506, iterations: 1) "1000": 98,112 msecs per iteration (total: 98,112, iterations: 1) "0": 0 msecs per iteration (total: 0, iterations: 1) "250": 6 msecs per iteration (total: 6, iterations: 1) "500": 25 msecs per iteration (total: 25, iterations: 1) "750": 58 msecs per iteration (total: 58, iterations: 1) "1000": 102 msecs per iteration (total: 102, iterations: 1) [1] http://lists.qt-project.org/pipermail/announce/2013-December/000036.html Task-number: QTBUG-35919 Change-Id: I6a6a1a6b606a8033a8f66e294cb55bbd8bdb8a03 Reviewed-by: Richard J. Moore --- src/xml/sax/qxml.cpp | 85 +++++++++++++++++++++++++++++++++++----------------- 1 file changed, 57 insertions(+), 28 deletions(-) diff --git a/src/xml/sax/qxml.cpp b/src/xml/sax/qxml.cpp index f3a1e479f2..1b05e049f1 100644 --- a/src/xml/sax/qxml.cpp +++ b/src/xml/sax/qxml.cpp @@ -44,6 +44,7 @@ #include "qbuffer.h" #include "qregexp.h" #include "qmap.h" +#include "qhash.h" #include "qstack.h" #include @@ -424,6 +425,10 @@ private: int stringValueLen; QString emptyStr; + QHash literalEntitySizes; + // The entity at (QMap) times. + QHash > referencesToOtherEntities; + QHash expandedSizes; // The limit to the amount of times the DTD parsing functions can be called // for the DTD currently being parsed. static const int dtdRecursionLimit = 2; @@ -3444,6 +3449,10 @@ bool QXmlSimpleReader::parse(const QXmlInputSource *input, bool incremental) { Q_D(QXmlSimpleReader); + d->literalEntitySizes.clear(); + d->referencesToOtherEntities.clear(); + d->expandedSizes.clear(); + if (incremental) { d->initIncrementalParsing(); } else { @@ -6659,43 +6668,63 @@ bool QXmlSimpleReaderPrivate::parseChoiceSeq() bool QXmlSimpleReaderPrivate::isExpandedEntityValueTooLarge(QString *errorMessage) { - QMap literalEntitySizes; - // The entity at (QMap) times. - QMap > referencesToOtherEntities; - QMap expandedSizes; + QString entityNameBuffer; // For every entity, check how many times all entity names were referenced in its value. - foreach (QString toSearch, entities.keys()) { - // The amount of characters that weren't entity names, but literals, like 'X'. - QString leftOvers = entities.value(toSearch); - // How many times was entityName referenced by toSearch? - foreach (QString entityName, entities.keys()) { - for (int i = 0; i < leftOvers.size() && i != -1; ) { - i = leftOvers.indexOf(QString::fromLatin1("&%1;").arg(entityName), i); - if (i != -1) { - leftOvers.remove(i, entityName.size() + 2); - // The entityName we're currently trying to find was matched in this string; increase our count. - ++referencesToOtherEntities[toSearch][entityName]; + for (QMap::const_iterator toSearchIt = entities.constBegin(); + toSearchIt != entities.constEnd(); + ++toSearchIt) { + const QString &toSearch = toSearchIt.key(); + + // Don't check the same entities twice. + if (!literalEntitySizes.contains(toSearch)) { + // The amount of characters that weren't entity names, but literals, like 'X'. + QString leftOvers = entities.value(toSearch); + // How many times was entityName referenced by toSearch? + for (QMap::const_iterator referencedIt = entities.constBegin(); + referencedIt != entities.constEnd(); + ++referencedIt) { + const QString &entityName = referencedIt.key(); + + for (int i = 0; i < leftOvers.size() && i != -1; ) { + entityNameBuffer = QLatin1Char('&') + entityName + QLatin1Char(';'); + + i = leftOvers.indexOf(entityNameBuffer, i); + if (i != -1) { + leftOvers.remove(i, entityName.size() + 2); + // The entityName we're currently trying to find was matched in this string; increase our count. + ++referencesToOtherEntities[toSearch][entityName]; + } } } + literalEntitySizes[toSearch] = leftOvers.size(); } - literalEntitySizes[toSearch] = leftOvers.size(); } - foreach (QString entity, referencesToOtherEntities.keys()) { - expandedSizes[entity] = literalEntitySizes[entity]; - foreach (QString referenceTo, referencesToOtherEntities.value(entity).keys()) { - const int references = referencesToOtherEntities.value(entity).value(referenceTo); - // The total size of an entity's value is the expanded size of all of its referenced entities, plus its literal size. - expandedSizes[entity] += expandedSizes[referenceTo] * references + literalEntitySizes[referenceTo] * references; - } + for (QHash >::const_iterator entityIt = referencesToOtherEntities.constBegin(); + entityIt != referencesToOtherEntities.constEnd(); + ++entityIt) { + const QString &entity = entityIt.key(); + + QHash::iterator expandedIt = expandedSizes.find(entity); + if (expandedIt == expandedSizes.end()) { + expandedIt = expandedSizes.insert(entity, literalEntitySizes.value(entity)); + for (QHash::const_iterator referenceIt = entityIt->constBegin(); + referenceIt != entityIt->constEnd(); + ++referenceIt) { + const QString &referenceTo = referenceIt.key(); + const int references = referencesToOtherEntities.value(entity).value(referenceTo); + // The total size of an entity's value is the expanded size of all of its referenced entities, plus its literal size. + *expandedIt += expandedSizes.value(referenceTo) * references + literalEntitySizes.value(referenceTo) * references; + } - if (expandedSizes[entity] > entityCharacterLimit) { - if (errorMessage) { - *errorMessage = QString::fromLatin1("The XML entity \"%1\" expands too a string that is too large to process (%2 characters > %3)."); - *errorMessage = (*errorMessage).arg(entity).arg(expandedSizes[entity]).arg(entityCharacterLimit); + if (*expandedIt > entityCharacterLimit) { + if (errorMessage) { + *errorMessage = QString::fromLatin1("The XML entity \"%1\" expands to a string that is too large to process (%2 characters > %3).") + .arg(entity, *expandedIt, entityCharacterLimit); + } + return true; } - return true; } } return false; -- cgit v1.2.3 From c07c9bcf4a645df3a7ec400ec8fe1298129eff79 Mon Sep 17 00:00:00 2001 From: John Layt Date: Sun, 29 Dec 2013 20:25:30 +0100 Subject: QPdfPaintEngine - Remove postscript flag Remove a now unneeded postscript flag. Change-Id: I307e4a64aa7ba4eed396530ffbf3bca5ae73e9c2 Reviewed-by: Gunnar Sletta --- src/gui/painting/qpdf.cpp | 6 ++---- src/gui/painting/qpdf_p.h | 1 - 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp index c05f47c59d..147fa3f561 100644 --- a/src/gui/painting/qpdf.cpp +++ b/src/gui/painting/qpdf.cpp @@ -1486,7 +1486,6 @@ QPdfEnginePrivate::QPdfEnginePrivate() leftMargin(10), topMargin(10), rightMargin(10), bottomMargin(10) // ~3.5 mm { resolution = 1200; - postscript = false; currentObject = 1; currentPage = 0; stroker.stream = 0; @@ -1520,7 +1519,6 @@ bool QPdfEngine::begin(QPaintDevice *pdev) d->ownsDevice = true; } - d->postscript = false; d->currentObject = 1; d->currentPage = new QPdfPage; @@ -2506,8 +2504,8 @@ void QPdfEnginePrivate::drawTextItem(const QPointF &p, const QTextItemInt &ti) QFontEngine::FaceId face_id = fe->faceId(); bool noEmbed = false; if (face_id.filename.isEmpty() - || (!postscript && ((fe->fsType & 0x200) /* bitmap embedding only */ - || (fe->fsType == 2) /* no embedding allowed */))) { + || fe->fsType & 0x200 /* bitmap embedding only */ + || fe->fsType == 2 /* no embedding allowed */) { *currentPage << "Q\n"; q->QPaintEngine::drawTextItem(p, ti); *currentPage << "q\n"; diff --git a/src/gui/painting/qpdf_p.h b/src/gui/painting/qpdf_p.h index 54530d0f78..ae2d4b00ac 100644 --- a/src/gui/painting/qpdf_p.h +++ b/src/gui/painting/qpdf_p.h @@ -250,7 +250,6 @@ public: void newPage(); - bool postscript; int currentObject; QPdfPage* currentPage; -- cgit v1.2.3 From d76f05e955205c3764dd184a8583ed785fc51b33 Mon Sep 17 00:00:00 2001 From: John Layt Date: Sat, 28 Dec 2013 12:02:43 +0100 Subject: QPdfWriter - Fix setting of margins The setting of margins wasn't being passed to the base class, so calling margins() wouldn't return the new values. Change-Id: I86c30f28fb0430f4b9d6e180a59cad354b489289 Reviewed-by: Gunnar Sletta --- src/gui/painting/qpdfwriter.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/painting/qpdfwriter.cpp b/src/gui/painting/qpdfwriter.cpp index a783aad66a..27fb8b1646 100644 --- a/src/gui/painting/qpdfwriter.cpp +++ b/src/gui/painting/qpdfwriter.cpp @@ -209,6 +209,8 @@ void QPdfWriter::setMargins(const Margins &m) { Q_D(QPdfWriter); + QPagedPaintDevice::setMargins(m); + const qreal multiplier = 72./25.4; d->engine->d_func()->leftMargin = m.left*multiplier; d->engine->d_func()->rightMargin = m.right*multiplier; -- cgit v1.2.3 From c8a8e0fb18c7c7cb6cf445dc9595eaf69f3cd126 Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Mon, 6 Jan 2014 14:04:32 +0100 Subject: zlib: rename z_errmsg symbol to avoid name clash when linking statically Task-number: QTBUG-35301 Change-Id: I298fba7270ee49d4e2dfc624b18aa13ce25864be Reviewed-by: Konstantin Ritt Reviewed-by: aavit Reviewed-by: Oswald Buddenhagen --- src/3rdparty/zlib/zconf.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/3rdparty/zlib/zconf.h b/src/3rdparty/zlib/zconf.h index dc52489bc2..d01f20bc07 100644 --- a/src/3rdparty/zlib/zconf.h +++ b/src/3rdparty/zlib/zconf.h @@ -107,6 +107,7 @@ # define zcfree z_zcfree # define zlibCompileFlags z_zlibCompileFlags # define zlibVersion z_zlibVersion +# define z_errmsg z_z_errmsg /* all zlib typedefs in zlib.h and zconf.h */ # define Byte z_Byte -- cgit v1.2.3 From eaedc04d90fdfc28cc9de96a32635bf327769086 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 13 Dec 2013 15:34:29 -0800 Subject: Autotest: Fix QDateTime failure if the test got run West of Greenwich There was a comment about the test failing for max() because of an overflow. That happens if you're at UTC or ahead of it (to the East of the Prime Meridian), which is how this test usually gets run (UTC, Europe/Oslo, Europe/Helsinki, Pacific/Auckland). But if you're behind UTC (to the West of the Prime Meridian), then the overflow happens for min(). Change-Id: Iebba49d1303e9f18f5038f5cf23c77bf83e5fd4b Reviewed-by: Robin Burchell --- .../auto/corelib/tools/qdatetime/tst_qdatetime.cpp | 44 +++++++++++++++++++++- 1 file changed, 42 insertions(+), 2 deletions(-) diff --git a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp index 6c80c5ff47..5d1fe0784f 100644 --- a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp +++ b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp @@ -61,6 +61,7 @@ public: static QString str( int y, int month, int d, int h, int min, int s ); static QDateTime dt( const QString& str ); public slots: + void initTestCase(); void init(); private slots: void ctor(); @@ -150,6 +151,7 @@ private slots: void invalid() const; private: + enum { LocalTimeIsUtc = 0, LocalTimeAheadOfUtc = 1, LocalTimeBehindUtc = -1} localTimeType; bool europeanTimeZone; QDate defDate() const { return QDate(1900, 1, 1); } QTime defTime() const { return QTime(0, 0, 0); } @@ -169,6 +171,42 @@ tst_QDateTime::tst_QDateTime() uint x1 = QDateTime(QDate(1990, 1, 1), QTime()).toTime_t(); uint x2 = QDateTime(QDate(1990, 6, 1), QTime()).toTime_t(); europeanTimeZone = (x1 == 631148400 && x2 == 644191200); + + QDateTime dt1 = QDateTime::fromTime_t(0); + QDateTime dt2 = QDateTime::fromTime_t(181 * 86400); // six months later, Jul 1 + if (dt1.date().year() < 1970 || dt2.date().month() < 7) { + localTimeType = LocalTimeBehindUtc; + } else if (dt1.time().hour() > 0 || dt1.date().day() > 1) { + localTimeType = LocalTimeAheadOfUtc; + } else if (dt2.time().hour() > 0 || dt2.date().day() > 1) { + localTimeType = LocalTimeAheadOfUtc; + } else { + localTimeType = LocalTimeIsUtc; + } +} + +void tst_QDateTime::initTestCase() +{ + // Never construct a message like this in an i18n context... + const char *typemsg1, *typemsg2 = "and therefore not"; + switch (localTimeType) { + case LocalTimeIsUtc: + typemsg1 = "exactly"; + break; + case LocalTimeBehindUtc: + typemsg1 = "behind"; + break; + case LocalTimeAheadOfUtc: + typemsg1 = "ahead of"; + typemsg2 = europeanTimeZone ? "and is" : "but isn't"; + break; + } + + qDebug() << "Current local time detected to be" + << typemsg1 + << "UTC" + << typemsg2 + << "the Central European timezone"; } void tst_QDateTime::init() @@ -610,8 +648,10 @@ void tst_QDateTime::fromMSecsSinceEpoch() QDateTime dtUtc = QDateTime::fromMSecsSinceEpoch(msecs, Qt::UTC); QDateTime dtOffset = QDateTime::fromMSecsSinceEpoch(msecs, Qt::OffsetFromUTC, 60*60); - // LocalTime will overflow for max - if (msecs != std::numeric_limits::max()) + // LocalTime will overflow for min or max, depending on whether you're + // East or West of Greenwich. The test passes at GMT. + if (localTimeType == LocalTimeIsUtc + || msecs != std::numeric_limits::max() * localTimeType) QCOMPARE(dtLocal, utc); QCOMPARE(dtUtc, utc); -- cgit v1.2.3 From bbcdfb324b473373d37c005e2e005f0870cc74ce Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 20 Dec 2013 10:44:03 -0800 Subject: Fix file descriptor leak in the perf event counter We opened the counter at every start(), even if we had already started before. Some of the benchlib's options caused it to start() and stop() over and over again, like -minimumvalue and -minimumtotal, which could leak to fd exhaustion (EMFILE). Change-Id: Ifeb7cca65c758877be600dc22928bea74f499934 Reviewed-by: Robin Burchell Reviewed-by: Jason McDonald --- src/testlib/qbenchmarkperfevents.cpp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/testlib/qbenchmarkperfevents.cpp b/src/testlib/qbenchmarkperfevents.cpp index acc11b09ac..30a0d3ea9c 100644 --- a/src/testlib/qbenchmarkperfevents.cpp +++ b/src/testlib/qbenchmarkperfevents.cpp @@ -515,16 +515,18 @@ void QBenchmarkPerfEventsMeasurer::start() { initPerf(); - // pid == 0 -> attach to the current process - // cpu == -1 -> monitor on all CPUs - // group_fd == -1 -> this is the group leader - // flags == 0 -> reserved, must be zero - fd = perf_event_open(&attr, 0, -1, -1, 0); if (fd == -1) { - perror("QBenchmarkPerfEventsMeasurer::start: perf_event_open"); - exit(1); - } else { - ::fcntl(fd, F_SETFD, FD_CLOEXEC); + // pid == 0 -> attach to the current process + // cpu == -1 -> monitor on all CPUs + // group_fd == -1 -> this is the group leader + // flags == 0 -> reserved, must be zero + fd = perf_event_open(&attr, 0, -1, -1, 0); + if (fd == -1) { + perror("QBenchmarkPerfEventsMeasurer::start: perf_event_open"); + exit(1); + } else { + ::fcntl(fd, F_SETFD, FD_CLOEXEC); + } } // enable the counter -- cgit v1.2.3 From f4d3196e4f5d2f89f2d6564157402a78d454cca2 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 3 Jan 2014 13:58:13 -0200 Subject: Fix function-not-used warnings detected by Clang 3.4 These functions have been turned to static (although inline), which means they need to be used or marked as possibly unused. qglobal.h:712:37: error: unused function 'qFuzzyCompare' [-Werror,-Wunused-function] Change-Id: Ie2ee713d26c86e0574b579c1ea42b9404c3d2035 Reviewed-by: Oswald Buddenhagen --- src/corelib/global/qglobal.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 6ec244dbee..9db48354b3 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -706,13 +706,13 @@ typedef void (*QFunctionPointer)(); # define Q_UNIMPLEMENTED() qWarning("%s:%d: %s: Unimplemented code.", __FILE__, __LINE__, Q_FUNC_INFO) #endif -Q_DECL_CONSTEXPR static inline bool qFuzzyCompare(double p1, double p2) Q_REQUIRED_RESULT; +Q_DECL_CONSTEXPR static inline bool qFuzzyCompare(double p1, double p2) Q_REQUIRED_RESULT Q_DECL_UNUSED; Q_DECL_CONSTEXPR static inline bool qFuzzyCompare(double p1, double p2) { return (qAbs(p1 - p2) * 1000000000000. <= qMin(qAbs(p1), qAbs(p2))); } -Q_DECL_CONSTEXPR static inline bool qFuzzyCompare(float p1, float p2) Q_REQUIRED_RESULT; +Q_DECL_CONSTEXPR static inline bool qFuzzyCompare(float p1, float p2) Q_REQUIRED_RESULT Q_DECL_UNUSED; Q_DECL_CONSTEXPR static inline bool qFuzzyCompare(float p1, float p2) { return (qAbs(p1 - p2) * 100000.f <= qMin(qAbs(p1), qAbs(p2))); @@ -721,7 +721,7 @@ Q_DECL_CONSTEXPR static inline bool qFuzzyCompare(float p1, float p2) /*! \internal */ -Q_DECL_CONSTEXPR static inline bool qFuzzyIsNull(double d) Q_REQUIRED_RESULT; +Q_DECL_CONSTEXPR static inline bool qFuzzyIsNull(double d) Q_REQUIRED_RESULT Q_DECL_UNUSED; Q_DECL_CONSTEXPR static inline bool qFuzzyIsNull(double d) { return qAbs(d) <= 0.000000000001; @@ -730,7 +730,7 @@ Q_DECL_CONSTEXPR static inline bool qFuzzyIsNull(double d) /*! \internal */ -Q_DECL_CONSTEXPR static inline bool qFuzzyIsNull(float f) Q_REQUIRED_RESULT; +Q_DECL_CONSTEXPR static inline bool qFuzzyIsNull(float f) Q_REQUIRED_RESULT Q_DECL_UNUSED; Q_DECL_CONSTEXPR static inline bool qFuzzyIsNull(float f) { return qAbs(f) <= 0.00001f; @@ -741,7 +741,7 @@ Q_DECL_CONSTEXPR static inline bool qFuzzyIsNull(float f) check whether the actual value is 0 or close to 0, but whether it is binary 0, disregarding sign. */ -static inline bool qIsNull(double d) Q_REQUIRED_RESULT; +static inline bool qIsNull(double d) Q_REQUIRED_RESULT Q_DECL_UNUSED; static inline bool qIsNull(double d) { union U { @@ -758,7 +758,7 @@ static inline bool qIsNull(double d) check whether the actual value is 0 or close to 0, but whether it is binary 0, disregarding sign. */ -static inline bool qIsNull(float f) Q_REQUIRED_RESULT; +static inline bool qIsNull(float f) Q_REQUIRED_RESULT Q_DECL_UNUSED; static inline bool qIsNull(float f) { union U { -- cgit v1.2.3 From 17da13baaa9b86d0e77383e3796f80e8ac5700f9 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 3 Jan 2014 14:21:32 -0200 Subject: Fix unused function warnings in qtriangulator.cpp qIntersectionPoint with ints wasn't used, qDot was only used in debug mode. Found by Clang 3.4. Change-Id: I4b5699f75eb88331df54bf5a289133914d80b299 Reviewed-by: Robin Burchell Reviewed-by: Gunnar Sletta --- src/gui/opengl/qtriangulator.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/gui/opengl/qtriangulator.cpp b/src/gui/opengl/qtriangulator.cpp index 77da009bf5..839ec9e96f 100644 --- a/src/gui/opengl/qtriangulator.cpp +++ b/src/gui/opengl/qtriangulator.cpp @@ -201,10 +201,12 @@ static inline qint64 qCross(const QPodPoint &u, const QPodPoint &v) return qint64(u.x) * qint64(v.y) - qint64(u.y) * qint64(v.x); } +#ifdef Q_TRIANGULATOR_DEBUG static inline qint64 qDot(const QPodPoint &u, const QPodPoint &v) { return qint64(u.x) * qint64(v.x) + qint64(u.y) * qint64(v.y); } +#endif // Return positive value if 'p' is to the right of the line 'v1'->'v2', negative if left of the // line and zero if exactly on the line. @@ -249,13 +251,6 @@ static inline QIntersectionPoint qIntersectionPoint(const QPodPoint &point) return p; } -static inline QIntersectionPoint qIntersectionPoint(int x, int y) -{ - // upperLeft = (x, y), xOffset = 0/1, yOffset = 0/1. - QIntersectionPoint p = {{x, y}, {0, 1}, {0, 1}}; - return p; -} - static QIntersectionPoint qIntersectionPoint(const QPodPoint &u1, const QPodPoint &u2, const QPodPoint &v1, const QPodPoint &v2) { QIntersectionPoint result = {{0, 0}, {0, 0}, {0, 0}}; -- cgit v1.2.3 From 52441ecd44d1feb049a152d5e585e89a910a5cd2 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 3 Jan 2014 14:26:55 -0200 Subject: Remove unused member m_eglApi It's not used anywhere. Found by Clang 3.4: qeglplatformcontext_p.h:80:13: error: private field 'm_eglApi' is not used [-Werror,-Wunused-private-field] Change-Id: I37ce240a9d07ef570e0814de366dbb7cd13ad714 Reviewed-by: Robin Burchell --- src/platformsupport/eglconvenience/qeglplatformcontext.cpp | 4 ++-- src/platformsupport/eglconvenience/qeglplatformcontext_p.h | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/platformsupport/eglconvenience/qeglplatformcontext.cpp b/src/platformsupport/eglconvenience/qeglplatformcontext.cpp index 714ad8a17e..716b01b4d9 100644 --- a/src/platformsupport/eglconvenience/qeglplatformcontext.cpp +++ b/src/platformsupport/eglconvenience/qeglplatformcontext.cpp @@ -71,19 +71,19 @@ static inline void bindApi(const QSurfaceFormat &format) QEGLPlatformContext::QEGLPlatformContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, EGLDisplay display, EGLenum eglApi) : m_eglDisplay(display) - , m_eglApi(eglApi) , m_eglConfig(q_configFromGLFormat(display, format)) { init(format, share); + Q_UNUSED(eglApi); } QEGLPlatformContext::QEGLPlatformContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, EGLDisplay display, EGLConfig config, EGLenum eglApi) : m_eglDisplay(display) - , m_eglApi(eglApi) , m_eglConfig(config) { init(format, share); + Q_UNUSED(eglApi); } void QEGLPlatformContext::init(const QSurfaceFormat &format, QPlatformOpenGLContext *share) diff --git a/src/platformsupport/eglconvenience/qeglplatformcontext_p.h b/src/platformsupport/eglconvenience/qeglplatformcontext_p.h index 952f5a856a..7c05894246 100644 --- a/src/platformsupport/eglconvenience/qeglplatformcontext_p.h +++ b/src/platformsupport/eglconvenience/qeglplatformcontext_p.h @@ -77,7 +77,6 @@ private: EGLContext m_eglContext; EGLContext m_shareContext; EGLDisplay m_eglDisplay; - EGLenum m_eglApi; EGLConfig m_eglConfig; QSurfaceFormat m_format; }; -- cgit v1.2.3 From 47a0d64dcf1f3351e39d1dae8fc3a317ffc03c5e Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 3 Jan 2014 14:31:31 -0200 Subject: Fix QtWidget function-unused warnings found by Clang 3.4 qwidgetbackingstore.cpp:72:20: error: unused function 'qRectIntersects' [-Werror,-Wunused-function] Change-Id: Ia3afe8f0547fa86804093281db89efabe68b34a1 Reviewed-by: Robin Burchell --- src/widgets/kernel/qwidgetbackingstore.cpp | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/widgets/kernel/qwidgetbackingstore.cpp b/src/widgets/kernel/qwidgetbackingstore.cpp index 02fa80bef6..4a94cd6cb8 100644 --- a/src/widgets/kernel/qwidgetbackingstore.cpp +++ b/src/widgets/kernel/qwidgetbackingstore.cpp @@ -66,15 +66,6 @@ QT_BEGIN_NAMESPACE extern QRegion qt_dirtyRegion(QWidget *); -/* - A version of QRect::intersects() that does not normalize the rects. -*/ -static inline bool qRectIntersects(const QRect &r1, const QRect &r2) -{ - return (qMax(r1.left(), r2.left()) <= qMin(r1.right(), r2.right()) - && qMax(r1.top(), r2.top()) <= qMin(r1.bottom(), r2.bottom())); -} - /** * Flushes the contents of the \a backingStore into the screen area of \a widget. * \a tlwOffset is the position of the top level widget relative to the window surface. -- cgit v1.2.3 From e0a21c71f469f91843aa1250aec23e672778870d Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 9 Jan 2014 17:25:09 -0800 Subject: Don't check if a file exists before opening it If the file doesn't exist, open() will fail. But open() might fail even if the file exists(), which would lead to bad follow-up code. In any case, this saves one unnecessary stat(2). Change-Id: Ic99507c9dc07a4387ee6a4fe9c24830fca54e095 Reviewed-by: Robin Burchell --- .../platforminputcontexts/compose/generator/qtablegenerator.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp b/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp index dad34e121b..11545b16c3 100644 --- a/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp +++ b/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp @@ -227,8 +227,7 @@ QByteArray TableGenerator::readLocaleAliases(const QByteArray &locale) { QFile aliases(systemComposeDir() + QLatin1String("/locale.alias")); QByteArray fullLocaleName; - if (aliases.exists()) { - aliases.open(QIODevice::ReadOnly); + if (aliases.open(QIODevice::ReadOnly)) { while (!aliases.atEnd()) { char l[1024]; int read = aliases.readLine(l, sizeof(l)); @@ -267,8 +266,7 @@ QByteArray TableGenerator::readLocaleAliases(const QByteArray &locale) bool TableGenerator::processFile(QString composeFileName) { QFile composeFile(composeFileName); - if (composeFile.exists()) { - composeFile.open(QIODevice::ReadOnly); + if (composeFile.open(QIODevice::ReadOnly)) { parseComposeFile(&composeFile); return true; } -- cgit v1.2.3 From eb5c0f4b1266702c016b032e281bb92a3a642da6 Mon Sep 17 00:00:00 2001 From: Tasuku Suzuki Date: Tue, 26 Nov 2013 09:39:10 +0900 Subject: Make qtbase compile with QT_NO_XMLSTREAMWRITER Change-Id: I6d2447ba0875117e8a50d1aa3133bd5ea098d51a Reviewed-by: Oswald Buddenhagen --- src/tools/qdoc/qdoc.pro | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/tools/qdoc/qdoc.pro b/src/tools/qdoc/qdoc.pro index 55e32dd4a3..b020bfe9a4 100644 --- a/src/tools/qdoc/qdoc.pro +++ b/src/tools/qdoc/qdoc.pro @@ -1,3 +1,8 @@ +!force_bootstrap { + load(qfeatures) + requires(!contains(QT_DISABLED_FEATURES, xmlstreamwriter)) +} + option(host_build) QT = core xml -- cgit v1.2.3 From b088e4827f427189334e8a1c5b4f2b8b0b713fc2 Mon Sep 17 00:00:00 2001 From: Gatis Paeglis Date: Tue, 5 Nov 2013 12:06:28 +0100 Subject: Fix bug on X11 with WA_TranslucentBackground and native child windows. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The native child windows need to inherit the parent's visual in order to have a translucent background as well. Surface with type QSurface::OpenGLSurface should not be forced to use the parent window's visual - the parent visual for instance, might not even be GL capable. Changing WA_TranslucentBackground during runtime is not supported, for two reasons: 1) Other platform plugins seem not to support it 2) It would require recreating X windows. Task-number: QTBUG-29625 Change-Id: Ic1474dd2de99069027481c7db6bf865f9b8d616d Reviewed-by: Jørgen Lind --- src/plugins/platforms/xcb/qxcbwindow.cpp | 6 +++++- src/widgets/kernel/qwidget_qpa.cpp | 7 ++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index e2c6932992..f46bed77d6 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -280,8 +280,12 @@ void QXcbWindow::create() if (parent()) { xcb_parent_id = static_cast(parent())->xcb_window(); m_embedded = parent()->window()->type() == Qt::ForeignWindow; - } + QSurfaceFormat parentFormat = parent()->window()->requestedFormat(); + if (window()->surfaceType() != QSurface::OpenGLSurface && parentFormat.hasAlpha()) { + window()->setFormat(parentFormat); + } + } m_format = window()->requestedFormat(); #if (defined(XCB_USE_GLX) || defined(XCB_USE_EGL)) && defined(XCB_USE_XLIB) diff --git a/src/widgets/kernel/qwidget_qpa.cpp b/src/widgets/kernel/qwidget_qpa.cpp index 3281e0c6f7..0fd794cc02 100644 --- a/src/widgets/kernel/qwidget_qpa.cpp +++ b/src/widgets/kernel/qwidget_qpa.cpp @@ -118,11 +118,12 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO win->resize(q->size()); win->setScreen(QGuiApplication::screens().value(topData()->screenIndex, 0)); - if (q->testAttribute(Qt::WA_TranslucentBackground)) { - QSurfaceFormat format; + QSurfaceFormat format = win->requestedFormat(); + if ((flags & Qt::Window) && win->surfaceType() != QSurface::OpenGLSurface + && q->testAttribute(Qt::WA_TranslucentBackground)) { format.setAlphaBufferSize(8); - win->setFormat(format); } + win->setFormat(format); if (QWidget *nativeParent = q->nativeParentWidget()) { if (nativeParent->windowHandle()) { -- cgit v1.2.3