From 3c657383c64ac09f46d3f6201b917531a6b5f2e8 Mon Sep 17 00:00:00 2001 From: Marcel Krems Date: Sun, 3 Feb 2013 04:19:32 +0100 Subject: Doc: Fixed value descriptions for enum QAbstractSocket::SocketError. Change-Id: I7ef5ff53ac838a7793852c1eadd9610e630cae43 Reviewed-by: Jerome Pasion --- src/network/socket/qabstractsocket.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp index 833c07dfe0..c19238d768 100644 --- a/src/network/socket/qabstractsocket.cpp +++ b/src/network/socket/qabstractsocket.cpp @@ -313,15 +313,15 @@ or the proxy server stopped responding in the authentication phase. \value ProxyNotFoundError The proxy address set with setProxy() (or the application proxy) was not found. - \value ProxyProtocolError The connection negotiation with the proxy server + \value ProxyProtocolError The connection negotiation with the proxy server failed, because the response from the proxy server could not be understood. \value OperationError An operation was attempted while the socket was in a state that did not permit it. - \value SslInternalError The SSL library being used reported a internal error, this is + \value SslInternalError The SSL library being used reported an internal error. This is probably the result of a bad installation or misconfiguration of the library. - \value SslInvalidUserDataError Invalid data(certificate, key, cypher, etc.) was + \value SslInvalidUserDataError Invalid data (certificate, key, cypher, etc.) was provided and its use resulted in an error in the SSL library. - \value TemporaryError A temporary error occurred(e.g., operation would block and socket + \value TemporaryError A temporary error occurred (e.g., operation would block and socket is non-blocking). \value UnknownSocketError An unidentified error occurred. -- cgit v1.2.3 From 8afd7b4675b2d5bfd0a00981095a6cac6c83e0a4 Mon Sep 17 00:00:00 2001 From: Sergio Martins Date: Mon, 18 Feb 2013 14:59:32 +0000 Subject: QNX: Print the buffer size before crashing, for debug purposes. Change-Id: I2d423ee3717bb09b7bb2c63f645e5315be1fa611 Reviewed-by: Sean Harmer --- src/plugins/platforms/qnx/qqnxwindow.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/plugins/platforms/qnx/qqnxwindow.cpp b/src/plugins/platforms/qnx/qqnxwindow.cpp index 2cee666e23..7c57f6a656 100644 --- a/src/plugins/platforms/qnx/qqnxwindow.cpp +++ b/src/plugins/platforms/qnx/qqnxwindow.cpp @@ -362,6 +362,7 @@ void QQnxWindow::setBufferSize(const QSize &size) errno = 0; result = screen_create_window_buffers(m_window, MAX_BUFFER_COUNT); if (result != 0) { + qWarning() << "QQnxWindow: Buffer size was" << size; qFatal("QQnxWindow: failed to create window buffers, errno=%d", errno); } -- cgit v1.2.3 From 4b42c91821b913aec32ab82d2d5e29ffa2f2a8ad Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 18 Feb 2013 11:27:24 +0100 Subject: QColorDialog/QFontDialog: Fix setOption(). Call setOptions() such that the option takes effect. Task-number: QTBUG-28817 Change-Id: Ibef834efc988d3ba49e88ea88ef475b1fd7fd98f Reviewed-by: J-P Nurmi Reviewed-by: Oliver Wolff --- src/widgets/dialogs/qcolordialog.cpp | 5 +++-- src/widgets/dialogs/qfontdialog.cpp | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/widgets/dialogs/qcolordialog.cpp b/src/widgets/dialogs/qcolordialog.cpp index 5adb4ba6da..af43ecc8df 100644 --- a/src/widgets/dialogs/qcolordialog.cpp +++ b/src/widgets/dialogs/qcolordialog.cpp @@ -1735,8 +1735,9 @@ QColor QColorDialog::selectedColor() const */ void QColorDialog::setOption(ColorDialogOption option, bool on) { - Q_D(QColorDialog); - d->options->setOption(static_cast(option), on); + const QColorDialog::ColorDialogOptions previousOptions = options(); + if (!(previousOptions & option) != !on) + setOptions(previousOptions ^ option); } /*! diff --git a/src/widgets/dialogs/qfontdialog.cpp b/src/widgets/dialogs/qfontdialog.cpp index 79aab3280f..4036dc80ab 100644 --- a/src/widgets/dialogs/qfontdialog.cpp +++ b/src/widgets/dialogs/qfontdialog.cpp @@ -853,8 +853,9 @@ QFont QFontDialog::selectedFont() const */ void QFontDialog::setOption(FontDialogOption option, bool on) { - Q_D(QFontDialog); - d->options->setOption(static_cast(option), on); + const QFontDialog::FontDialogOptions previousOptions = options(); + if (!(previousOptions & option) != !on) + setOptions(previousOptions ^ option); } /*! -- cgit v1.2.3 From 73d32873cf307a60bbe83f2c9e973236bccb4162 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Tue, 5 Feb 2013 10:06:51 +0100 Subject: Cocoa: Add QMdiSubWindow size grip back. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change all Q_WS_MAC -> Q_OS_MAC in qmdisubwindow.cpp Remove QEXPECT_FAIL from tst_qmdisubwindow.cpp. Task-number: QTBUG-29434, QTBUG-25297 Change-Id: I299b87ab994e2d5ba93d5bbae48de0df1ac1c9d6 Reviewed-by: Morten Johan Sørvig --- src/widgets/widgets/qmdisubwindow.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/widgets/widgets/qmdisubwindow.cpp b/src/widgets/widgets/qmdisubwindow.cpp index 13d0b180cc..02b3cc7ba2 100644 --- a/src/widgets/widgets/qmdisubwindow.cpp +++ b/src/widgets/widgets/qmdisubwindow.cpp @@ -160,7 +160,7 @@ #include #include #include -#if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC) +#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC) #include #endif #include @@ -304,7 +304,7 @@ static void showToolTip(QHelpEvent *helpEvent, QWidget *widget, const QStyleOpti Q_ASSERT(helpEvent->type() == QEvent::ToolTip); Q_ASSERT(widget); -#if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC) +#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC) // Native Mac windows don't show tool tip. if (qobject_cast(widget->style())) return; @@ -1079,7 +1079,7 @@ void QMdiSubWindowPrivate::updateCursor() { #ifndef QT_NO_CURSOR Q_Q(QMdiSubWindow); -#if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC) +#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC) if (qobject_cast(q->style())) return; #endif @@ -1499,7 +1499,7 @@ void QMdiSubWindowPrivate::processClickedSubControl() q->showNormal(); break; case QStyle::SC_TitleBarMinButton: -#if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC) +#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC) if (qobject_cast(q->style())) { if (q->isMinimized()) q->showNormal(); @@ -1516,7 +1516,7 @@ void QMdiSubWindowPrivate::processClickedSubControl() q->showNormal(); break; case QStyle::SC_TitleBarMaxButton: -#if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC) +#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC) if (qobject_cast(q->style())) { if (q->isMaximized()) q->showNormal(); @@ -1563,7 +1563,7 @@ QRegion QMdiSubWindowPrivate::getRegion(Operation operation) const } QRegion region; -#if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC) +#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC) if (qobject_cast(q->style())) return region; #endif @@ -1717,7 +1717,7 @@ int QMdiSubWindowPrivate::titleBarHeight(const QStyleOptionTitleBar &options) co } int height = q->style()->pixelMetric(QStyle::PM_TitleBarHeight, &options, q); -#if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC) +#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC) // ### Fix mac style, the +4 pixels hack is not necessary anymore if (qobject_cast(q->style())) height -= 4; @@ -1772,7 +1772,7 @@ bool QMdiSubWindowPrivate::drawTitleBarWhenMaximized() const if (isChildOfTabbedQMdiArea(q)) return false; -#if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC) || defined(Q_OS_WINCE_WM) +#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC) || defined(Q_OS_WINCE_WM) return true; #else if (q->style()->styleHint(QStyle::SH_Workspace_FillSpaceOnMaximize, 0, q)) @@ -2180,7 +2180,7 @@ void QMdiSubWindowPrivate::setSizeGrip(QSizeGrip *newSizeGrip) return; newSizeGrip->setFixedSize(newSizeGrip->sizeHint()); bool putSizeGripInLayout = layout ? true : false; -#if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC) +#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC) if (qobject_cast(q->style())) putSizeGripInLayout = false; #endif @@ -2263,7 +2263,7 @@ QMdiSubWindow::QMdiSubWindow(QWidget *parent, Qt::WindowFlags flags) d->titleBarPalette = d->desktopPalette(); d->font = QApplication::font("QMdiSubWindowTitleBar"); // We don't want the menu icon by default on mac. -#ifndef Q_WS_MAC +#ifndef Q_OS_MAC if (windowIcon().isNull()) d->menuIcon = style()->standardIcon(QStyle::SP_TitleBarMenuButton, 0, this); else @@ -2831,7 +2831,7 @@ bool QMdiSubWindow::event(QEvent *event) d->isMaximizeMode = false; d->isWidgetHiddenByUs = false; if (!parent()) { -#if !defined(QT_NO_SIZEGRIP) && defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC) +#if !defined(QT_NO_SIZEGRIP) && defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC) if (qobject_cast(style())) delete d->sizeGrip; #endif @@ -2926,7 +2926,7 @@ void QMdiSubWindow::showEvent(QShowEvent *showEvent) return; } -#if !defined(QT_NO_SIZEGRIP) && defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC) +#if !defined(QT_NO_SIZEGRIP) && defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC) if (qobject_cast(style()) && !d->sizeGrip && !(windowFlags() & Qt::FramelessWindowHint)) { d->setSizeGrip(new QSizeGrip(0)); @@ -3320,7 +3320,7 @@ void QMdiSubWindow::mouseMoveEvent(QMouseEvent *mouseEvent) hoverRegion += style()->subControlRect(QStyle::CC_TitleBar, &options, d->hoveredSubControl, this); } -#if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC) +#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC) if (qobject_cast(style()) && !hoverRegion.isEmpty()) hoverRegion += QRegion(0, 0, width(), d->titleBarHeight(options)); #endif @@ -3530,7 +3530,7 @@ QSize QMdiSubWindow::minimumSizeHint() const int sizeGripHeight = 0; if (d->sizeGrip && d->sizeGrip->isVisibleTo(const_cast(this))) sizeGripHeight = d->sizeGrip->height(); -#if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC) +#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC) else if (parent() && qobject_cast(style()) && !d->sizeGrip) sizeGripHeight = style()->pixelMetric(QStyle::PM_SizeGripSize, 0, this); #endif -- cgit v1.2.3 From 5d6916b4c1f6ea3b86cc3d820c433fec8a42fad0 Mon Sep 17 00:00:00 2001 From: Jerome Pasion Date: Thu, 14 Feb 2013 14:44:48 +0100 Subject: Doc: Removed reference to deprecated \badcode command. -QDoc doesn't differentiate between \badcode and \code. They both look the same in the output. Change-Id: Ifabd51b7e433a1c30cf30c267d3ce63dded1bd43 Reviewed-by: Leena Miettinen --- src/corelib/doc/src/threads-basics.qdoc | 3 +- src/dbus/qdbusargument.cpp | 3 +- src/tools/qdoc/doc/qdoc-manual.qdoc | 81 ++++----------------------------- src/widgets/widgets/qmdisubwindow.cpp | 3 +- 4 files changed, 15 insertions(+), 75 deletions(-) (limited to 'src') diff --git a/src/corelib/doc/src/threads-basics.qdoc b/src/corelib/doc/src/threads-basics.qdoc index dad41368c6..dd5267f0ba 100644 --- a/src/corelib/doc/src/threads-basics.qdoc +++ b/src/corelib/doc/src/threads-basics.qdoc @@ -269,7 +269,8 @@ This is the result of running the code: - \badcode + \code + //bad code hello from GUI thread 3079423696 hello from worker thread 3076111216 \endcode diff --git a/src/dbus/qdbusargument.cpp b/src/dbus/qdbusargument.cpp index 191eb5eea6..dab2daf90f 100644 --- a/src/dbus/qdbusargument.cpp +++ b/src/dbus/qdbusargument.cpp @@ -212,7 +212,8 @@ bool QDBusArgumentPrivate::checkReadAndDetach(QDBusArgumentPrivate *&d) The following example illustrates this wrong usage in context of a class that may contain invalid data: - \badcode + \code + //bad code // Wrongly marshall the MyTime data into a D-Bus argument QDBusArgument &operator<<(QDBusArgument &argument, const MyTime &mytime) { diff --git a/src/tools/qdoc/doc/qdoc-manual.qdoc b/src/tools/qdoc/doc/qdoc-manual.qdoc index 5254c46eb5..4d70faa968 100644 --- a/src/tools/qdoc/doc/qdoc-manual.qdoc +++ b/src/tools/qdoc/doc/qdoc-manual.qdoc @@ -243,7 +243,6 @@ \li \l {11-qdoc-commands-specialcontent.html#abstract-command} {\\abstract} \li \l {12-0-qdoc-commands-miscellaneous.html#annotatedlist-command} {\\annotatedlist} \li \l {04-qdoc-commands-textmarkup.html#b-command} {\\b} \span {class="newStuff"} {(new 5/3/2012)} - \li \l {06-qdoc-commands-includecodeinline.html#badcode-command} {\\badcode} \li \l {04-qdoc-commands-textmarkup.html#b-command} {\\bold} {(deprecated, use \\b)} \li \l {11-qdoc-commands-specialcontent.html#brief-command} {\\brief} \li \l {04-qdoc-commands-textmarkup.html#c-command} {\\c} @@ -1175,8 +1174,7 @@ snippets. It renders the code verbatim in a separate paragraph in the code font. - When processing any of the \\code, \l {badcode-command} - {\\badcode}, \l {newcode-command} {\\newcode} or \l + When processing any of the \\code, \l {newcode-command} {\\newcode} or \l {oldcode-command} {\\oldcode} commands, QDoc removes all indentation that is common for the verbatim code blocks within a \c{/}\c{*!} ... \c{*}\c{/} comment before it adds the standard @@ -1225,67 +1223,9 @@ See also \l {c-command} {\\c}, \l {07-0-qdoc-commands-includingexternalcode.html#quotefromfile-command} - {\\quotefromfile}, \l {badcode-command} {\\badcode}, \l - {newcode-command} {\\newcode} and \l {oldcode-command} + {\\quotefromfile}, \l{newcode-command} {\\newcode} and \l {oldcode-command} {\\oldcode}. - \target badcode-command - \section1 \\badcode - - The \\badcode and \\endcode commands delimit a snippet of code - that doesn't compile or is wrong for some other reason. - - The \\badcode command is similar to the \l {code-command} {\\code} - command, but it renders the code snippet using a grey font instead - of black. - - Like the \l {code-command} {\\code} command, this command begins - its code snippet on a new line rendered in the code font and with - the standard indentation. - - \code - / *! - The statement below is rendered using the - regular \\code command: - - \code - statusbar()->message(tr("Host %1 found").arg(hostName)); - \ endcode - - While the following statement is rendered using - the \\badcode command: - - \badcode - statusbar()->message(tr("Host" + hostName + " found")); - \ endcode - * / - \endcode - - QDoc renders this as: - - \quotation - The statement below is rendered using the - regular \\code command: - - \code - statusbar()->message(tr("Host %1 found").arg(hostName)); - \endcode - - While the following statement is rendered using - the \\badcode command: - - \badcode - statusbar()->message(tr("Host" + hostName + " found")); - \endcode - \endquotation - - Other QDoc commands are disabled within \\badcode... \\endcode, - and the special character '\\' is accepted and rendered like the - rest of the code. - - See also \l {code-command} {\\code}, \l {newcode-command} - {\\newcode} and \l {oldcode-command} {\\oldcode}. - \target newcode-command \section1 \\newcode @@ -1293,14 +1233,12 @@ show how to port a snippet of code to a new version of an API. The \\newcode command, and its companion the \\oldcode command, is - a convenience combination of the \l {code-command} {\\code} and \l - {badcode-command} {\\badcode} commands: The combination provides a - text relating the two code snippets to each other. The command - requires a preceding \\oldcode statement. - - Like the \l {code-command} {\\code} and \l {badcode-command} - {\\badcode} commands, the \\newcode command renders its code on a - new line in the documentation using a typewriter font and the + a convenience combination of the \l {code-command} {\\code} commands: + The combination provides a text relating the two code snippets to each + other. The command requires a preceding \\oldcode statement. + + Like the \l{code-command}{\\code} command, the \\newcode command renders its + code on a new line in the documentation using a typewriter font and the standard indentation. \code @@ -1339,7 +1277,7 @@ \\newcode statement; otherwise QDoc fails to parse the command and emits a warning. - See also \l {newcode-command} {\\newcode} and \l {badcode-command} {\\badcode}. + See also \l {newcode-command} {\\newcode}. \target qml-command \section1 \\qml @@ -8688,7 +8626,6 @@ \li \l {12-0-qdoc-commands-miscellaneous.html#annotatedlist-command} {\\annotatedlist} \li \l {04-qdoc-commands-textmarkup.html#b-command} {\\b} \span {class="newStuff"} {(new 5/3/2012)} \li \l { 22-qdoc-configuration-generalvariables.html#basedir-variable} {basedir} \span {class="newStuff"} {(experimental)} - \li \l {06-qdoc-commands-includecodeinline.html#badcode-command} {\\badcode} \li \l {04-qdoc-commands-textmarkup.html#b-command} {\\bold} \span {class="newStuff"} {(deprecated, use \\b)} \li \l {11-qdoc-commands-specialcontent.html#brief-command} {\\brief} \li \l {04-qdoc-commands-textmarkup.html#c-command} {\\c} diff --git a/src/widgets/widgets/qmdisubwindow.cpp b/src/widgets/widgets/qmdisubwindow.cpp index 02b3cc7ba2..01ee2528f3 100644 --- a/src/widgets/widgets/qmdisubwindow.cpp +++ b/src/widgets/widgets/qmdisubwindow.cpp @@ -2236,7 +2236,8 @@ void QMdiSubWindowPrivate::updateInternalWindowTitle() Note that only \l{QMdiSubWindow}s can be set as children of QMdiArea; you cannot, for instance, write: - \badcode + \code + //bad code QMdiArea mdiArea; QTextEdit editor(&mdiArea); // invalid child widget \endcode -- cgit v1.2.3 From 39b1bd8f45b9d1e0f2db0cd0d410d64422ffd992 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Tue, 19 Feb 2013 16:50:02 +0100 Subject: undef B0 to build on PPC (conflict with definition in termios.h) This is the same fix that was already done in qprinter.h /usr/include/bits/termios.h:122:#define B0 0000000 /* hang up */ so the compiler sees B0 as a numeric constant Task-number: QTBUG-29704 Change-Id: I2df5e1783f3142558cbc1606e0c61fcf636f2de8 Reviewed-by: David Faure (KDE) --- src/gui/painting/qpagedpaintdevice.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/gui/painting/qpagedpaintdevice.h b/src/gui/painting/qpagedpaintdevice.h index 02ed2583ee..b2b53d8038 100644 --- a/src/gui/painting/qpagedpaintdevice.h +++ b/src/gui/painting/qpagedpaintdevice.h @@ -48,6 +48,9 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE +#if defined(B0) +#undef B0 // Terminal hang-up. We assume that you do not want that. +#endif class QPagedPaintDevicePrivate; -- cgit v1.2.3 From c02a2f8e76bcad5814134414c4c860d64880ebcd Mon Sep 17 00:00:00 2001 From: Sergio Martins Date: Mon, 18 Feb 2013 19:43:29 +0000 Subject: QNX: Don't crash with 0 by 0 sized windows In the rare event of an invalid sized window, the application crashes because libscreen doesn't like creating empty buffers. Not creating the buffers at all would also be a solution, if we didn't have QPainter crashes due do null paint devices. Change-Id: I561d0082576b6226dd52129f9640952ba46273c8 Reviewed-by: Kevin Krammer Reviewed-by: Sean Harmer --- src/plugins/platforms/qnx/qqnxwindow.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/qnx/qqnxwindow.cpp b/src/plugins/platforms/qnx/qqnxwindow.cpp index 7c57f6a656..ab9c94772b 100644 --- a/src/plugins/platforms/qnx/qqnxwindow.cpp +++ b/src/plugins/platforms/qnx/qqnxwindow.cpp @@ -335,7 +335,11 @@ void QQnxWindow::setBufferSize(const QSize &size) // Set window buffer size errno = 0; - int val[2] = { size.width(), size.height() }; + + // libscreen fails when creating empty buffers + const QSize nonEmptySize = size.isEmpty() ? QSize(1, 1) : size; + + int val[2] = { nonEmptySize.width(), nonEmptySize.height() }; int result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_BUFFER_SIZE, val); if (result != 0) { qFatal("QQnxWindow: failed to set window buffer size, errno=%d", errno); @@ -381,7 +385,7 @@ void QQnxWindow::setBufferSize(const QSize &size) } // Cache new buffer size - m_bufferSize = size; + m_bufferSize = nonEmptySize; // Buffers were destroyed; reacquire them m_currentBufferIndex = -1; -- cgit v1.2.3 From eb09f9b82c249db096754d9cbeea3424149c1869 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Tue, 12 Feb 2013 16:36:40 +0100 Subject: moc: Error out when detecting unterminated macro usage Exhausting the symbol list while looking for the final right parenthesis means it is missing. Task-number: QTBUG-29308 Change-Id: Iccf5897b0f5eb719699fd12d6c8e4a16ff189d9b Reviewed-by: Simon Hausmann --- src/tools/moc/preprocessor.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/tools/moc/preprocessor.cpp b/src/tools/moc/preprocessor.cpp index 7430c4a86c..96b920b7cd 100644 --- a/src/tools/moc/preprocessor.cpp +++ b/src/tools/moc/preprocessor.cpp @@ -630,6 +630,8 @@ Symbols Preprocessor::macroExpandIdentifier(Preprocessor *that, SymbolStack &sym if (nesting < 0) break; + else if (!symbols.hasNext()) + that->error("missing ')' in macro usage"); } // empty VA_ARGS -- cgit v1.2.3 From 18f9eb797bffe8626f1edeca3c88f80dae0da8d7 Mon Sep 17 00:00:00 2001 From: Jan Arve Saether Date: Tue, 19 Feb 2013 15:02:24 +0100 Subject: QStackedLayout: Fix crash when focus widget is destroyed in hide() We also have to make sure that when moving back to a page that has a focusWidget(), the focus should go to the focusWidget() Task-number: QTBUG-18242 Change-Id: Ibfa7d6361c1a456480b2f1584a88ef4c4f405709 Reviewed-by: Friedemann Kleint --- src/widgets/kernel/qstackedlayout.cpp | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/widgets/kernel/qstackedlayout.cpp b/src/widgets/kernel/qstackedlayout.cpp index cb2711c636..f38f0a6f08 100644 --- a/src/widgets/kernel/qstackedlayout.cpp +++ b/src/widgets/kernel/qstackedlayout.cpp @@ -300,7 +300,9 @@ void QStackedLayout::setCurrentIndex(int index) parent->setUpdatesEnabled(false); } - QWidget *fw = parent ? parent->window()->focusWidget() : 0; + QPointer fw = parent ? parent->window()->focusWidget() : 0; + const bool focusWasOnOldPage = fw && (prev && prev->isAncestorOf(fw)); + if (prev) { prev->clearFocus(); if (d->stackingMode == StackOne) @@ -315,24 +317,25 @@ void QStackedLayout::setCurrentIndex(int index) // was somewhere on the outgoing widget. if (parent) { - if (fw && (prev && prev->isAncestorOf(fw))) { // focus was on old page + if (focusWasOnOldPage) { // look for the best focus widget we can find if (QWidget *nfw = next->focusWidget()) nfw->setFocus(); else { // second best: first child widget in the focus chain - QWidget *i = fw; - while ((i = i->nextInFocusChain()) != fw) { - if (((i->focusPolicy() & Qt::TabFocus) == Qt::TabFocus) - && !i->focusProxy() && i->isVisibleTo(next) && i->isEnabled() - && next->isAncestorOf(i)) { - i->setFocus(); - break; + if (QWidget *i = fw) { + while ((i = i->nextInFocusChain()) != fw) { + if (((i->focusPolicy() & Qt::TabFocus) == Qt::TabFocus) + && !i->focusProxy() && i->isVisibleTo(next) && i->isEnabled() + && next->isAncestorOf(i)) { + i->setFocus(); + break; + } } + // third best: incoming widget + if (i == fw ) + next->setFocus(); } - // third best: incoming widget - if (i == fw ) - next->setFocus(); } } } -- cgit v1.2.3 From 3f99983e76d359cb45b15ae96150d4cc798b61c7 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Tue, 22 Jan 2013 10:19:49 +0100 Subject: Fix focus handling of native child widgets in xcb. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: If4d596195624011142bff6853849a23064e478df Reviewed-by: Samuel Rødal (cherry picked from commit fc663b5f9aae16fe6a03160e3eb148a5f742ac58) --- src/gui/kernel/qwindow_p.h | 2 ++ src/plugins/platforms/xcb/qxcbconnection.cpp | 8 +++++++- src/plugins/platforms/xcb/qxcbconnection.h | 5 +++++ src/plugins/platforms/xcb/qxcbwindow.cpp | 14 +++++++++++++- src/widgets/kernel/qwidgetwindow.cpp | 18 +++++++++++++++++- 5 files changed, 44 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gui/kernel/qwindow_p.h b/src/gui/kernel/qwindow_p.h index ed34693faa..6933c892a0 100644 --- a/src/gui/kernel/qwindow_p.h +++ b/src/gui/kernel/qwindow_p.h @@ -120,6 +120,8 @@ public: return offset; } + virtual QWindow *eventReceiver() { Q_Q(QWindow); return q; } + QWindow::SurfaceType surfaceType; Qt::WindowFlags windowFlags; QWindow *parentWindow; diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index 7fc5847167..32de54562a 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -258,6 +258,7 @@ QXcbConnection::QXcbConnection(QXcbNativeInterface *nativeInterface, const char , has_randr_extension(false) , has_input_shape(false) , m_buttons(0) + , m_focusWindow(0) { #ifdef XCB_USE_XLIB Display *dpy = XOpenDisplay(m_displayName.constData()); @@ -418,7 +419,7 @@ break; if (QXcbWindow *platformWindow = platformWindowFromId(e->event)) { \ handled = QWindowSystemInterface::handleNativeEvent(platformWindow->window(), m_nativeInterface->genericEventFilterType(), event, &result); \ if (!handled) \ - m_keyboard->handler(platformWindow, e); \ + m_keyboard->handler(m_focusWindow, e); \ } \ } \ break; @@ -943,6 +944,11 @@ void QXcbEventReader::unlock() m_mutex.unlock(); } +void QXcbConnection::setFocusWindow(QXcbWindow *w) +{ + m_focusWindow = w; +} + void QXcbConnection::sendConnectionEvent(QXcbAtom::Atom a, uint id) { xcb_client_message_event_t event; diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h index 68d2b85f78..b499f75b78 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -385,6 +385,9 @@ public: Qt::MouseButtons buttons() const { return m_buttons; } + QXcbWindow *focusWindow() const { return m_focusWindow; } + void setFocusWindow(QXcbWindow *); + private slots: void processXcbEvents(); @@ -511,6 +514,8 @@ private: bool has_input_shape; Qt::MouseButtons m_buttons; + + QXcbWindow *m_focusWindow; }; #define DISPLAY_FROM_XCB(object) ((Display *)(object->connection()->xlib_display())) diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index b7668e6270..c0ddf5c0ae 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -403,6 +403,9 @@ QXcbWindow::~QXcbWindow() void QXcbWindow::destroy() { + if (connection()->focusWindow() == this) + connection()->setFocusWindow(0); + if (m_syncCounter && m_screen->syncRequestSupported()) Q_XCB_CALL(xcb_sync_destroy_counter(xcb_connection(), m_syncCounter)); if (m_window) { @@ -1473,6 +1476,11 @@ void QXcbWindow::handleUnmapNotifyEvent(const xcb_unmap_notify_event_t *event) void QXcbWindow::handleButtonPressEvent(const xcb_button_press_event_t *event) { + if (window() != QGuiApplication::focusWindow()) { + QWindow *w = static_cast(QObjectPrivate::get(window()))->eventReceiver(); + w->requestActivate(); + } + updateNetWmUserTime(event->time); QPoint local(event->event_x, event->event_y); @@ -1635,7 +1643,10 @@ void QXcbWindow::handlePropertyNotifyEvent(const xcb_property_notify_event_t *ev void QXcbWindow::handleFocusInEvent(const xcb_focus_in_event_t *) { - QWindowSystemInterface::handleWindowActivated(window()); + QWindow *w = window(); + w = static_cast(QObjectPrivate::get(w))->eventReceiver(); + connection()->setFocusWindow(static_cast(w->handle())); + QWindowSystemInterface::handleWindowActivated(w); } static bool focusInPeeker(xcb_generic_event_t *event) @@ -1651,6 +1662,7 @@ static bool focusInPeeker(xcb_generic_event_t *event) void QXcbWindow::handleFocusOutEvent(const xcb_focus_out_event_t *) { + connection()->setFocusWindow(0); // Do not set the active window to 0 if there is a FocusIn coming. // There is however no equivalent for XPutBackEvent so register a // callback for QXcbConnection instead. diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp index 462ebc605b..50b61beb05 100644 --- a/src/widgets/kernel/qwidgetwindow.cpp +++ b/src/widgets/kernel/qwidgetwindow.cpp @@ -39,6 +39,7 @@ ** ****************************************************************************/ +#include "private/qwindow_p.h" #include "qwidgetwindow_qpa_p.h" #include "private/qwidget_p.h" @@ -60,8 +61,23 @@ extern int openPopupCount; bool qt_replay_popup_mouse_event = false; extern bool qt_try_modal(QWidget *widget, QEvent::Type type); +class QWidgetWindowPrivate : public QWindowPrivate +{ + Q_DECLARE_PUBLIC(QWidgetWindow) +public: + QWindow *eventReceiver() { + Q_Q(QWidgetWindow); + QWindow *w = q; + while (w->parent() && qobject_cast(w) && qobject_cast(w->parent())) { + w = w->parent(); + } + return w; + } +}; + QWidgetWindow::QWidgetWindow(QWidget *widget) - : m_widget(widget) + : QWindow(*new QWidgetWindowPrivate(), 0) + , m_widget(widget) { updateObjectName(); connect(m_widget, &QObject::objectNameChanged, this, &QWidgetWindow::updateObjectName); -- cgit v1.2.3 From 7203e88084a313fb6e7a96b9080f965e3ffcd89f Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Mon, 18 Feb 2013 23:19:57 +0100 Subject: Don't enable HIDPI when rendering directly to PDF on Mac MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When rendering to PDF using the PDF paint engine on Mac it would consider it to be rendering as HIDPI when ScreenResolution was used. This would mean nothing was being rendered at all in the PDF as a result. Task-number: QTBUG-28709 Change-Id: Ieb97ca9d0b47f6b96debbcf5e05e96c39292e412 Reviewed-by: Morten Johan Sørvig --- src/gui/painting/qpainter.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index 0811b5282f..786136d203 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -229,7 +229,7 @@ QTransform QPainterPrivate::hidpiScaleTransform() const { #ifdef Q_OS_MAC // Limited feature introduction for Qt 5.0.0, remove ifdef in a later release. - if (device->physicalDpiX() == 0 || device->logicalDpiX() == 0) + if (device->devType() == QInternal::Printer || device->physicalDpiX() == 0 || device->logicalDpiX() == 0) return QTransform(); const qreal deviceScale = (device->physicalDpiX() / device->logicalDpiX()); if (deviceScale > 1.0) @@ -1843,7 +1843,7 @@ bool QPainter::begin(QPaintDevice *pd) #ifdef Q_OS_MAC // Limited feature introduction for Qt 5.0.0, remove ifdef in a later release. - const bool isHighDpi = (d->device->physicalDpiX() == 0 || d->device->logicalDpiX() == 0) ? + const bool isHighDpi = (pd->devType() == QInternal::Printer || d->device->physicalDpiX() == 0 || d->device->logicalDpiX() == 0) ? false : (d->device->physicalDpiX() / d->device->logicalDpiX() > 1); #else const bool isHighDpi = false; -- cgit v1.2.3 From 2f5b4d47f6da4702dc6bfd411289aedf612bed6a Mon Sep 17 00:00:00 2001 From: Laszlo Papp Date: Tue, 19 Feb 2013 23:52:48 +0000 Subject: Document the qintptr for public usage The QAbstractSocket API has been already using this as a return type. Hence, this has already been exposed to the public API users, anyhow. http://qt-project.org/doc/qt-5.0/qtnetwork/qabstractsocket.html#socketDescriptor A minor mistake has also been fixed in this commit at the quintptr section. Change-Id: I8143b3050428548ff6baee2e3a0bce4058ea8701 Reviewed-by: Thiago Macieira --- src/corelib/global/qglobal.cpp | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index a0c12b7b06..7fd9283579 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -642,12 +642,30 @@ Q_CORE_EXPORT void *qMemSet(void *dest, int c, size_t n); \sa Q_UINT64_C(), qint64, qulonglong */ +/*! + \typedef qintptr + \relates + + Integral type for representing pointers in a signed integer (useful for + hashing, etc.). + + Typedef for either qint32 or qint64. This type is guaranteed to + be the same size as a pointer on all platforms supported by Qt. On + a system with 32-bit pointers, qintptr is a typedef for qint32; + on a system with 64-bit pointers, qintptr is a typedef for + qint64. + + Note that qintptr is signed. Use quintptr for unsigned values. + + \sa qptrdiff, qint32, qint64 +*/ + /*! \typedef quintptr \relates - Integral type for representing a pointers (useful for hashing, - etc.). + Integral type for representing pointers in an unsigned integer (useful for + hashing, etc.). Typedef for either quint32 or quint64. This type is guaranteed to be the same size as a pointer on all platforms supported by Qt. On -- cgit v1.2.3 From dd30f3e65b7fb56f64c992dc5f341a9c5dba6c07 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 18 Feb 2013 15:19:41 +0100 Subject: Fix QDockWidget being unable to dock when initially floating. When setFloating(true) is called before show, frame strut events are not enabled for the native window (since there is none yet) in QDockWidgetPrivate::setWindowState(). In that case, do it in the show event handling. Task-number: QTBUG-29012 Change-Id: I93b679f20200c149d608a1bcc65b4936a035c6a0 Reviewed-by: J-P Nurmi --- src/widgets/widgets/qdockwidget.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/widgets/widgets/qdockwidget.cpp b/src/widgets/widgets/qdockwidget.cpp index c5694d9d8c..a2e363f991 100644 --- a/src/widgets/widgets/qdockwidget.cpp +++ b/src/widgets/widgets/qdockwidget.cpp @@ -1000,6 +1000,14 @@ void QDockWidgetPrivate::plug(const QRect &rect) setWindowState(false, false, rect); } +static void setFrameStrutEventsEnabled(const QWidget *w, bool enabled) +{ + if (const QWindow *window = w->windowHandle()) + if (QPlatformWindow *platformWindow = window->handle()) + if (platformWindow->frameStrutEventsEnabled() != enabled) + platformWindow->setFrameStrutEventsEnabled(enabled); +} + void QDockWidgetPrivate::setWindowState(bool floating, bool unplug, const QRect &rect) { Q_Q(QDockWidget); @@ -1053,9 +1061,7 @@ void QDockWidgetPrivate::setWindowState(bool floating, bool unplug, const QRect } if (floating && nativeDeco) - if (const QWindow *window = q->windowHandle()) - if (QPlatformWindow *platformWindow = window->handle()) - platformWindow->setFrameStrutEventsEnabled(true); + setFrameStrutEventsEnabled(q, true); resizer->setActive(QWidgetResizeHandler::Resize, !unplug && floating && !nativeDeco); } @@ -1391,6 +1397,8 @@ bool QDockWidget::event(QEvent *event) emit visibilityChanged(false); break; case QEvent::Show: + if (static_cast(QDockWidget::layout())->nativeWindowDeco(isFloating())) + setFrameStrutEventsEnabled(this, true); d->toggleViewAction->setChecked(true); emit visibilityChanged(geometry().right() >= 0 && geometry().bottom() >= 0); break; -- cgit v1.2.3 From 79498af6e44d8c44b681c1a857523d633d3aea3a Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Fri, 15 Feb 2013 14:44:18 +0100 Subject: Fix the default handling of cursor shape when there is no standard one MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When the cursor specified is a bitmap one we cannot cache it based on the shape as the pixmap set on the cursor may be different. Therefore we should always create a new cursor in this instance. Change-Id: I2c201590ff632490d76c1b423908ae32aa584eb6 Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/cocoa/qcocoacursor.mm | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/plugins/platforms/cocoa/qcocoacursor.mm b/src/plugins/platforms/cocoa/qcocoacursor.mm index 9b30351d70..b97531545f 100644 --- a/src/plugins/platforms/cocoa/qcocoacursor.mm +++ b/src/plugins/platforms/cocoa/qcocoacursor.mm @@ -96,10 +96,15 @@ void QCocoaCursor::changeCursor(QCursor *cursor, QWindow *window) break; case Qt::DragLinkCursor: [[NSCursor dragLinkCursor] set]; + break; default : { // No suitable OS cursor exist, use cursors provided // by Qt for the rest. Check for a cached cursor: NSCursor *cocoaCursor = m_cursors.value(cursor->shape()); + if (cocoaCursor && cursor->shape() == Qt::BitmapCursor) { + [cocoaCursor release]; + cocoaCursor = 0; + } if (cocoaCursor == 0) { cocoaCursor = createCursorData(cursor); if (cocoaCursor == 0) { -- cgit v1.2.3 From e47c2744e6cefa42fc70320e07d534742934f737 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Fri, 15 Feb 2013 14:51:48 +0100 Subject: Clean up the cached cursors inside the destructor of QCocoaCursor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I4e1222832efa29680b4e658a5c9109641599a2b9 Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/cocoa/qcocoacursor.h | 1 + src/plugins/platforms/cocoa/qcocoacursor.mm | 4 ++++ 2 files changed, 5 insertions(+) (limited to 'src') diff --git a/src/plugins/platforms/cocoa/qcocoacursor.h b/src/plugins/platforms/cocoa/qcocoacursor.h index f8829c53e6..dfa1fcff81 100644 --- a/src/plugins/platforms/cocoa/qcocoacursor.h +++ b/src/plugins/platforms/cocoa/qcocoacursor.h @@ -53,6 +53,7 @@ class QCocoaCursor : public QPlatformCursor { public: QCocoaCursor(); + ~QCocoaCursor(); virtual void changeCursor(QCursor * widgetCursor, QWindow * widget); virtual QPoint pos() const; diff --git a/src/plugins/platforms/cocoa/qcocoacursor.mm b/src/plugins/platforms/cocoa/qcocoacursor.mm index b97531545f..a36a855bcd 100644 --- a/src/plugins/platforms/cocoa/qcocoacursor.mm +++ b/src/plugins/platforms/cocoa/qcocoacursor.mm @@ -48,6 +48,10 @@ QT_BEGIN_NAMESPACE QCocoaCursor::QCocoaCursor() +{ +} + +QCocoaCursor::~QCocoaCursor() { // release cursors QHash::const_iterator i = m_cursors.constBegin(); -- cgit v1.2.3