From d0baa9b8dc9ed191903447032f1cf6afe9a2463e Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Fri, 12 Jun 2009 11:21:14 +1000 Subject: Set qreal to float for Symbian. Make sure we match the logic in qglobal.h. --- src/corelib/kernel/qmetatype.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/kernel/qmetatype.h b/src/corelib/kernel/qmetatype.h index 22214a4..687a070 100644 --- a/src/corelib/kernel/qmetatype.h +++ b/src/corelib/kernel/qmetatype.h @@ -89,7 +89,7 @@ public: // This logic must match the one in qglobal.h #if defined(QT_COORD_TYPE) QReal = 0, -#elif defined(QT_NO_FPU) || defined(QT_ARCH_ARM) || defined(QT_ARCH_WINDOWSCE) +#elif defined(QT_NO_FPU) || defined(QT_ARCH_ARM) || defined(QT_ARCH_WINDOWSCE) || defined(QT_ARCH_SYMBIAN) QReal = Float, #else QReal = Double, -- cgit v0.12 From f86dcade8716a0aee841ba05740887598633de17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Fri, 12 Jun 2009 10:24:34 +0200 Subject: Fixed clipping bug due to applying redirection offset twice. After change f0a4a37a5182660580fd361110d3fd51463221d8 the clip info stack already contains the redirection offset, so we don't need to apply it again. Reviewed-by: bnilsen --- src/gui/painting/qpainter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index 528c575..1094206 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -414,7 +414,7 @@ void QPainterPrivate::draw_helper(const QPainterPath &originalPath, DrawOperatio bool old_txinv = txinv; QTransform old_invMatrix = invMatrix; txinv = true; - invMatrix = state->redirectionMatrix.inverted(); + invMatrix = QTransform(); QPainterPath clipPath = q->clipPath(); QRectF r = clipPath.boundingRect().intersected(absPathRect); absPathRect = r.toAlignedRect(); -- cgit v0.12 From fd0ef21c295c316ccfebc833c011ed7a9fb5b3fc Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Fri, 12 Jun 2009 12:48:53 +0200 Subject: refactor some code removed qstrdup and used QByteArray to its full extent --- src/corelib/codecs/qtextcodec.cpp | 57 ++++++++++++++++++--------------------- 1 file changed, 26 insertions(+), 31 deletions(-) diff --git a/src/corelib/codecs/qtextcodec.cpp b/src/corelib/codecs/qtextcodec.cpp index 51ca43e..050c997 100644 --- a/src/corelib/codecs/qtextcodec.cpp +++ b/src/corelib/codecs/qtextcodec.cpp @@ -448,10 +448,10 @@ static const char * const tis_620locales[] = { // static const char * const tcvnlocales[] = { // "vi", "vi_VN", 0 }; -static bool try_locale_list(const char * const locale[], const char * lang) +static bool try_locale_list(const char * const locale[], const QByteArray &lang) { int i; - for(i=0; locale[i] && *locale[i] && strcmp(locale[i], lang); i++) + for(i=0; locale[i] && lang != locale[i]; i++) ; return locale[i] != 0; } @@ -503,13 +503,12 @@ static QTextCodec * ru_RU_hack(const char * i) { #endif #if !defined(Q_OS_WIN32) && !defined(Q_OS_WINCE) -static QTextCodec *checkForCodec(const char *name) { +static QTextCodec *checkForCodec(const QByteArray &name) { QTextCodec *c = QTextCodec::codecForName(name); if (!c) { - const char *at = strchr(name, '@'); - if (at) { - QByteArray n(name, at - name); - c = QTextCodec::codecForName(n.data()); + const int index = name.indexOf('@'); + if (index != -1) { + c = QTextCodec::codecForName(name.left(index)); } } return c; @@ -550,21 +549,19 @@ static void setupLocaleMapper() // definitely knows it, but since we cannot fully trust it, get ready // to fall back to environment variables. #if !defined(QT_NO_SETLOCALE) - char * ctype = qstrdup(setlocale(LC_CTYPE, 0)); + const QByteArray ctype = setlocale(LC_CTYPE, 0); #else - char * ctype = qstrdup(""); + const QByteArray ctype; #endif // Get the first nonempty value from $LC_ALL, $LC_CTYPE, and $LANG // environment variables. - char * lang = qstrdup(qgetenv("LC_ALL").constData()); - if (!lang || lang[0] == 0 || strcmp(lang, "C") == 0) { - if (lang) delete [] lang; - lang = qstrdup(qgetenv("LC_CTYPE").constData()); + QByteArray lang = qgetenv("LC_ALL"); + if (lang.isEmpty() || lang == "C") { + lang = qgetenv("LC_CTYPE"); } - if (!lang || lang[0] == 0 || strcmp(lang, "C") == 0) { - if (lang) delete [] lang; - lang = qstrdup(qgetenv("LANG").constData()); + if (lang.isEmpty() || lang == "C") { + lang = qgetenv("LANG"); } // Now try these in order: @@ -577,35 +574,35 @@ static void setupLocaleMapper() // 7. guess locale from lang // 1. CODESET from ctype if it contains a .CODESET part (e.g. en_US.ISO8859-15) - char * codeset = ctype ? strchr(ctype, '.') : 0; - if (codeset && *codeset == '.') - localeMapper = checkForCodec(codeset + 1); + int indexOfDot = ctype.indexOf('.'); + if (indexOfDot != -1) + localeMapper = checkForCodec( ctype.mid(indexOfDot + 1) ); // 2. CODESET from lang if it contains a .CODESET part - codeset = lang ? strchr(lang, '.') : 0; - if (!localeMapper && codeset && *codeset == '.') - localeMapper = checkForCodec(codeset + 1); + if (!localeMapper) { + indexOfDot = lang.indexOf('.'); + if (indexOfDot != -1) + localeMapper = checkForCodec( lang.mid(indexOfDot + 1) ); + } // 3. ctype (maybe the locale is named "ISO-8859-1" or something) - if (!localeMapper && ctype && *ctype != 0 && strcmp (ctype, "C") != 0) + if (!localeMapper && !ctype.isEmpty() && ctype != "C") localeMapper = checkForCodec(ctype); // 4. locale (ditto) - if (!localeMapper && lang && *lang != 0) + if (!localeMapper && !lang.isEmpty()) localeMapper = checkForCodec(lang); // 5. "@euro" - if ((!localeMapper && ctype && strstr(ctype, "@euro")) || (lang && strstr(lang, "@euro"))) + if ((!localeMapper && ctype.contains("@euro")) || lang.contains("@euro")) localeMapper = checkForCodec("ISO 8859-15"); // 6. guess locale from ctype unless ctype is "C" // 7. guess locale from lang - char * try_by_name = ctype; - if (ctype && *ctype != 0 && strcmp (ctype, "C") != 0) - try_by_name = lang; + const QByteArray &try_by_name = (!ctype.isEmpty() && ctype != "C") ? lang : ctype; // Now do the guessing. - if (lang && *lang && !localeMapper && try_by_name && *try_by_name) { + if (!lang.isEmpty() && !localeMapper && !try_by_name.isEmpty()) { if (try_locale_list(iso8859_15locales, lang)) localeMapper = QTextCodec::codecForName("ISO 8859-15"); else if (try_locale_list(iso8859_2locales, lang)) @@ -638,8 +635,6 @@ static void setupLocaleMapper() localeMapper = ru_RU_hack(lang); } - delete [] ctype; - delete [] lang; } // If everything failed, we default to 8859-1 -- cgit v0.12 From 814667587e6ab9dda754647f08fec969ed8434aa Mon Sep 17 00:00:00 2001 From: Prasanth Ullattil Date: Thu, 11 Jun 2009 15:59:33 +0200 Subject: Allow a maximum of 6 simultaneous HTTP connections to a server. Even though the standard mandates a maximum of 2 connections, most new browsers support atleast 6 connections. So we are also bumping the limit. Task-number: 251144 Reviewed-by: Markus Goetz Reviewed-by: Peter Hartmann --- src/network/access/qhttpnetworkconnection.cpp | 37 ++++++++++++++------------ src/network/access/qhttpnetworkconnection_p.h | 2 +- tests/auto/qnetworkreply/tst_qnetworkreply.cpp | 31 +++++++++++++++++++++ 3 files changed, 52 insertions(+), 18 deletions(-) diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp index abaa7fb..b40b4c8 100644 --- a/src/network/access/qhttpnetworkconnection.cpp +++ b/src/network/access/qhttpnetworkconnection.cpp @@ -64,7 +64,7 @@ QT_BEGIN_NAMESPACE -const int QHttpNetworkConnectionPrivate::channelCount = 2; +const int QHttpNetworkConnectionPrivate::channelCount = 6; QHttpNetworkConnectionPrivate::QHttpNetworkConnectionPrivate(const QString &hostName, quint16 port, bool encrypt) : hostName(hostName), port(port), encrypt(encrypt), @@ -74,6 +74,7 @@ QHttpNetworkConnectionPrivate::QHttpNetworkConnectionPrivate(const QString &host #endif { + channels = new Channel[channelCount]; } QHttpNetworkConnectionPrivate::~QHttpNetworkConnectionPrivate() @@ -82,6 +83,7 @@ QHttpNetworkConnectionPrivate::~QHttpNetworkConnectionPrivate() channels[i].socket->close(); delete channels[i].socket; } + delete []channels; } void QHttpNetworkConnectionPrivate::connectSignals(QAbstractSocket *socket) @@ -1090,25 +1092,26 @@ void QHttpNetworkConnectionPrivate::_q_disconnected() void QHttpNetworkConnectionPrivate::_q_startNextRequest() { - // send the current request again - if (channels[0].resendCurrent || channels[1].resendCurrent) { - int i = channels[0].resendCurrent ? 0:1; - QAbstractSocket *socket = channels[i].socket; - channels[i].resendCurrent = false; - channels[i].state = IdleState; - if (channels[i].reply) - sendRequest(socket); - return; + //resend the necessary ones. + for (int i = 0; i < channelCount; ++i) { + if (channels[i].resendCurrent) { + channels[i].resendCurrent = false; + channels[i].state = IdleState; + if (channels[i].reply) + sendRequest(channels[i].socket); + } } - // send the request using the idle socket - QAbstractSocket *socket = channels[0].socket; - if (isSocketBusy(socket)) { - socket = (isSocketBusy(channels[1].socket) ? 0 :channels[1].socket); + QAbstractSocket *socket = 0; + for (int i = 0; i < channelCount; ++i) { + QAbstractSocket *chSocket = channels[i].socket; + // send the request using the idle socket + if (!isSocketBusy(chSocket)) { + socket = chSocket; + break; + } } - - if (!socket) { + if (!socket) return; // this will be called after finishing current request. - } unqueueAndSendRequest(socket); } diff --git a/src/network/access/qhttpnetworkconnection_p.h b/src/network/access/qhttpnetworkconnection_p.h index 4603a55..b5f3593 100644 --- a/src/network/access/qhttpnetworkconnection_p.h +++ b/src/network/access/qhttpnetworkconnection_p.h @@ -250,7 +250,7 @@ public: {} }; static const int channelCount; - Channel channels[2]; // maximum of 2 socket connections to the server + Channel *channels; // parallel connections to the server bool pendingAuthSignal; // there is an incomplete authentication signal bool pendingProxyAuthSignal; // there is an incomplete proxy authentication signal diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp index 43b4ea9..a93d0b6 100644 --- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp @@ -243,6 +243,8 @@ private Q_SLOTS: void proxyChange(); void authorizationError_data(); void authorizationError(); + + void httpConnectionCount(); }; QT_BEGIN_NAMESPACE @@ -3665,5 +3667,34 @@ void tst_QNetworkReply::authorizationError() QCOMPARE(QString(reply->readAll()), httpBody); } +void tst_QNetworkReply::httpConnectionCount() +{ + QTcpServer server; + QVERIFY(server.listen()); + QCoreApplication::instance()->processEvents(); + + for (int i = 0; i < 10; i++) { + QNetworkRequest request (QUrl("http://127.0.0.1:" + QString::number(server.serverPort()) + "/" + QString::number(i))); + QNetworkReply* reply = manager.get(request); + reply->setParent(this); + } + + int pendingConnectionCount = 0; + QTime time; + time.start(); + + while(pendingConnectionCount != 6) { + QCoreApplication::instance()->processEvents(); + while (server.nextPendingConnection()) + pendingConnectionCount++; + + // at max. wait 10 sec + if (time.elapsed() > 10000) + break; + } + + QCOMPARE(pendingConnectionCount, 6); +} + QTEST_MAIN(tst_QNetworkReply) #include "tst_qnetworkreply.moc" -- cgit v0.12 From 9bbd0bed3afc44ece34119a9c563726b0e6298a8 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Fri, 12 Jun 2009 12:20:55 +0200 Subject: doc: Fixed several qdoc warnings. --- doc/src/qnamespace.qdoc | 11 ++- src/gui/graphicsview/qgraphicsitem.cpp | 122 ++++++++++++++++++------------- src/gui/graphicsview/qgraphicsview.cpp | 2 + src/gui/graphicsview/qgraphicswidget.cpp | 35 ++++++++- src/gui/kernel/qwidget.cpp | 4 +- 5 files changed, 116 insertions(+), 58 deletions(-) diff --git a/doc/src/qnamespace.qdoc b/doc/src/qnamespace.qdoc index 069541f..7772958 100644 --- a/doc/src/qnamespace.qdoc +++ b/doc/src/qnamespace.qdoc @@ -2674,11 +2674,14 @@ \enum Qt::TileRule \since 4.6 - This enum describes how to repeat or stretch the parts of an image when drawing. + This enum describes how to repeat or stretch the parts of an image + when drawing. \value Stretch Scale the image to fit to the available area. - \value Repeat Tile the image until there is no more space. May crop the last image. - \value Round Like Repeat, but scales the images down to ensure that the last image is not cropped. - \sa QPixmapBorders, qDrawBorderPixmap() + \value Repeat Tile the image until there is no more space. May crop + the last image. + + \value Round Like Repeat, but scales the images down to ensure that + the last image is not cropped. */ diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 43cbca1..e4f2a75 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -91,30 +91,33 @@ \snippet doc/src/snippets/code/src_gui_graphicsview_qgraphicsitem.cpp 0 - The boundingRect() function has many different purposes. QGraphicsScene - bases its item index on boundingRect(), and QGraphicsView uses it both for - culling invisible items, and for determining the area that needs to be - recomposed when drawing overlapping items. In addition, QGraphicsItem's - collision detection mechanisms use boundingRect() to provide an efficient - cut-off. The fine grained collision algorithm in collidesWithItem() is based - on calling shape(), which returns an accurate outline of the item's shape - as a QPainterPath. - - QGraphicsScene expects all items boundingRect() and shape() to remain - unchanged unless it is notified. If you want to change an item's geometry - in any way, you must first call prepareGeometryChange() to allow - QGraphicsScene to update its bookkeeping. + The boundingRect() function has many different purposes. + QGraphicsScene bases its item index on boundingRect(), and + QGraphicsView uses it both for culling invisible items, and for + determining the area that needs to be recomposed when drawing + overlapping items. In addition, QGraphicsItem's collision + detection mechanisms use boundingRect() to provide an efficient + cut-off. The fine grained collision algorithm in + collidesWithItem() is based on calling shape(), which returns an + accurate outline of the item's shape as a QPainterPath. + + QGraphicsScene expects all items boundingRect() and shape() to + remain unchanged unless it is notified. If you want to change an + item's geometry in any way, you must first call + prepareGeometryChange() to allow QGraphicsScene to update its + bookkeeping. Collision detection can be done in two ways: \list 1 - \o Reimplement shape() to return an accurate shape for your item, and rely - on the default implementation of collidesWithItem() to do shape-shape - intersection. This can be rather expensive if the shapes are complex. + \o Reimplement shape() to return an accurate shape for your item, + and rely on the default implementation of collidesWithItem() to do + shape-shape intersection. This can be rather expensive if the + shapes are complex. - \o Reimplement collidesWithItem() to provide your own custom item and shape - collision algorithm. + \o Reimplement collidesWithItem() to provide your own custom item + and shape collision algorithm. \endlist @@ -136,24 +139,28 @@ position, pos(). To change the item's transformation, you can pass a transformation matrix to setTransform() - Item transformations accumulate from parent to child, so if both a parent and child - item are rotated 90 degrees, the child's total transformation will be 180 degrees. - Similarly, if the item's parent is scaled to 2x its original size, its - children will also be twice as large. An item's transformation does not - affect its own local geometry; all geometry functions (e.g., contains(), + Item transformations accumulate from parent to child, so if both a + parent and child item are rotated 90 degrees, the child's total + transformation will be 180 degrees. Similarly, if the item's + parent is scaled to 2x its original size, its children will also + be twice as large. An item's transformation does not affect its + own local geometry; all geometry functions (e.g., contains(), update(), and all the mapping functions) still operate in local coordinates. For convenience, QGraphicsItem provides the functions - sceneTransform(), which returns the item's total transformation matrix - (including its position and all parents' positions and transformations), - and scenePos(), which returns its position in scene coordinates. To reset - an item's matrix, call resetTransform(). + sceneTransform(), which returns the item's total transformation + matrix (including its position and all parents' positions and + transformations), and scenePos(), which returns its position in + scene coordinates. To reset an item's matrix, call + resetTransform(). - Another way to apply transformation to an item is to use the , or set the - different transformation properties (transformOrigin, x/y/zRotation, x/yScale, - horizontal/verticalShear). Those properties come in addition to the base transformation + Another way to apply transformation to an item is to use the , or + set the different transformation properties (transformOrigin, + x/y/zRotation, x/yScale, horizontal/verticalShear). Those + properties come in addition to the base transformation - The order you set the transformation properties does not affect the resulting transformation - The resulting transformation is always computed in the following order + The order you set the transformation properties does not affect + the resulting transformation The resulting transformation is + always computed in the following order \code [Origin] [Base] [RotateX] [RotateY] [RotateZ] [Shear] [Scale] [-Origin] @@ -2538,8 +2545,8 @@ QPointF QGraphicsItem::pos() const \sa y() */ -/* - Set's the x coordinate of the item's position. Equivalent to +/*! + Set's the \a x coordinate of the item's position. Equivalent to calling setPos(x, y()). \sa x(), setPos() @@ -2557,8 +2564,8 @@ void QGraphicsItem::setX(qreal x) \sa x() */ -/* - Set's the y coordinate of the item's position. Equivalent to +/*! + Set's the \a y coordinate of the item's position. Equivalent to calling setPos(x(), y). \sa x(), setPos() @@ -2743,7 +2750,8 @@ QTransform QGraphicsItem::transform() const The default is 0 - \warning The value doesn't take in account any rotation set with the setTransform() method. + \warning The value doesn't take in account any rotation set with + the setTransform() method. \sa setXRotation(), {Transformations} */ @@ -3048,7 +3056,7 @@ void QGraphicsItem::setShear(qreal sh, qreal sv) /*! \since 4.6 - Returns the origin point using for transformation in item coordinate. + Returns the origin point used for transformation in item coordinate. The default is QPointF(0,0). @@ -6440,15 +6448,21 @@ QGraphicsObject::QGraphicsObject(QGraphicsItemPrivate &dd, QGraphicsItem *parent \property QGraphicsObject::parent \brief the parent of the item - \sa QGraphicsItem::setParentItem, QGraphicsItem::parentObject + \sa QGraphicsItem::setParentItem(), QGraphicsItem::parentObject() */ +/*! + \property QGraphicsObject::id + \brief the id of of the item + + \sa QGraphicsItem::opacity(), QGraphicsItem::setOpacity() +*/ /*! \property QGraphicsObject::opacity \brief the opacity of the item - \sa QGraphicsItem::setOpacity, QGraphicsItem::opacity + \sa QGraphicsItem::setOpacity(), QGraphicsItem::opacity() */ /*! @@ -6456,7 +6470,13 @@ QGraphicsObject::QGraphicsObject(QGraphicsItemPrivate &dd, QGraphicsItem *parent This signal gets emitted whenever the opacity of the item changes - \sa opacity + \sa QGraphicsItem::opacity() +*/ + +/*! + \fn QGraphicsObject::parentChanged() + + This signal gets emitted whenever the parent of the item changes */ /*! @@ -6465,7 +6485,7 @@ QGraphicsObject::QGraphicsObject(QGraphicsItemPrivate &dd, QGraphicsItem *parent Describes the items position. - \sa QGraphicsItem::setPos, QGraphicsItem::pos, positionChanged + \sa QGraphicsItem::setPos(), QGraphicsItem::pos() */ /*! @@ -6474,7 +6494,7 @@ QGraphicsObject::QGraphicsObject(QGraphicsItemPrivate &dd, QGraphicsItem *parent Describes the items x position. - \sa QGraphicsItem::setX, setPos, xChanged + \sa QGraphicsItem::setX(), setPos(), xChanged() */ /*! @@ -6482,7 +6502,7 @@ QGraphicsObject::QGraphicsObject(QGraphicsItemPrivate &dd, QGraphicsItem *parent This signal gets emitted whenever the x position of the item changes - \sa pos + \sa pos() */ /*! @@ -6491,15 +6511,15 @@ QGraphicsObject::QGraphicsObject(QGraphicsItemPrivate &dd, QGraphicsItem *parent Describes the items y position. - \sa QGraphicsItem::setY, setPos, yChanged + \sa QGraphicsItem::setY(), setPos(), yChanged() */ /*! \fn QGraphicsObject::yChanged() - This signal gets emitted whenever the y position of the item changes + This signal gets emitted whenever the y position of the item changes. - \sa pos + \sa pos() */ /*! @@ -6508,15 +6528,15 @@ QGraphicsObject::QGraphicsObject(QGraphicsItemPrivate &dd, QGraphicsItem *parent Describes the items z value. - \sa QGraphicsItem::setZValue, zValue, zChanged + \sa QGraphicsItem::setZValue(), zValue(), zChanged() */ /*! \fn QGraphicsObject::zChanged() - This signal gets emitted whenever the z value of the item changes + This signal gets emitted whenever the z value of the item changes. - \sa pos + \sa pos() */ @@ -6536,7 +6556,7 @@ QGraphicsObject::QGraphicsObject(QGraphicsItemPrivate &dd, QGraphicsItem *parent This signal gets emitted whenever the item get's enabled or disabled. - \sa enabled + \sa isEnabled() */ /*! diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp index a72aa5a..c94c1d7 100644 --- a/src/gui/graphicsview/qgraphicsview.cpp +++ b/src/gui/graphicsview/qgraphicsview.cpp @@ -217,6 +217,8 @@ static const int QGRAPHICSVIEW_PREALLOC_STYLE_OPTIONS = 503; // largest prime < minimizing the areas that require redrawing, which improves performance. A common side effect is that items that do draw with antialiasing can leave painting traces behind on the scene as they are moved. + + \omitvalue IndirectPainting */ /*! diff --git a/src/gui/graphicsview/qgraphicswidget.cpp b/src/gui/graphicsview/qgraphicswidget.cpp index 419277d..78bd062 100644 --- a/src/gui/graphicsview/qgraphicswidget.cpp +++ b/src/gui/graphicsview/qgraphicswidget.cpp @@ -1658,7 +1658,8 @@ bool QGraphicsWidget::isActiveWindow() const This property is only used for windows. - By default, if no title has been set, this property contains an empty string. + By default, if no title has been set, this property contains an + empty string. */ void QGraphicsWidget::setWindowTitle(const QString &title) { @@ -1721,6 +1722,38 @@ QGraphicsWidget *QGraphicsWidget::focusWidget() const return d->focusChild; } +/*! \property QGraphicsWidget::horizontalShear + \brief This property holds the horizontal shear value for the item. + */ + +/*! \property QGraphicsWidget::transformOrigin + \brief This property holds the origin point used for transformations + in item coordinates. + */ + +/*! \property QGraphicsWidget::verticalShear + \brief This property holds the vertical shear value for the item. + */ + +/*! \property QGraphicsWidget::xRotation + \brief This property holds the value for rotation around the x axis. + */ + +/*! \property QGraphicsWidget::xScale + \brief This property holds the scale factor for the x axis. + */ + +/*! \property QGraphicsWidget::yRotation + \brief This property holds the value for rotation around the y axis. + */ + +/*! \property QGraphicsWidget::yScale + \brief This property holds the scale factor for the y axis. + */ + +/*! \property QGraphicsWidget::zRotation + \brief This property holds the value for rotation around the z axis. + */ #ifndef QT_NO_SHORTCUT /*! diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 7b0bf1e..d5fdd93 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -5857,7 +5857,7 @@ QWidget *QWidget::focusWidget() const /*! Returns the next widget in this widget's focus chain. - \sa previousInFocusChain + \sa previousInFocusChain() */ QWidget *QWidget::nextInFocusChain() const { @@ -5867,7 +5867,7 @@ QWidget *QWidget::nextInFocusChain() const /*! Returns the previous widget in this widget's focus chain. - \sa nextInFocusChain + \sa nextInFocusChain() \since 4.6 */ -- cgit v0.12 From 957063e915281af895529a239fee3dd52e5f0b5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Fri, 12 Jun 2009 12:26:55 +0200 Subject: Fixed clipping bugs in GL 2 paint engine. Similar to what was done in f86dcade8716a0aee841ba05740887598633de17, we shouldn't multiply by the redirectionMatrix in replayClipOperations() as the clip info matrices already contain the redirectionMatrix. Reviewed-by: bnilsen --- src/gui/painting/qpaintengineex.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/gui/painting/qpaintengineex.cpp b/src/gui/painting/qpaintengineex.cpp index 67a3fa9..222e29f 100644 --- a/src/gui/painting/qpaintengineex.cpp +++ b/src/gui/painting/qpaintengineex.cpp @@ -149,15 +149,11 @@ void QPaintEngineExPrivate::replayClipOperations() QTransform transform = q->state()->matrix; - const QTransform &redirection = q->state()->redirectionMatrix; - for (int i = 0; i < clipInfo.size(); ++i) { const QPainterClipInfo &info = clipInfo.at(i); - QTransform combined = info.matrix * redirection; - - if (combined != q->state()->matrix) { - q->state()->matrix = combined; + if (info.matrix != q->state()->matrix) { + q->state()->matrix = info.matrix; q->transformChanged(); } -- cgit v0.12 From 426be37acb7b7fb0bbd58ff8ec18dac8ae650375 Mon Sep 17 00:00:00 2001 From: mae Date: Fri, 12 Jun 2009 12:40:35 +0200 Subject: Make repeated calls to QToolTip::hideText() still hide the text Previously the 300 msec hide timer was restarted every time hideText() was called. Reviewed-by: Thorbjorn Lindeijer --- src/gui/kernel/qtooltip.cpp | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/gui/kernel/qtooltip.cpp b/src/gui/kernel/qtooltip.cpp index 15a3dd2..2f97e7b 100644 --- a/src/gui/kernel/qtooltip.cpp +++ b/src/gui/kernel/qtooltip.cpp @@ -126,14 +126,15 @@ public: bool eventFilter(QObject *, QEvent *); - QBasicTimer hideTimer; + QBasicTimer hideTimer, expireTimer; + bool fadingOut; void reuseTip(const QString &text); void hideTip(); void hideTipImmediately(); void setTipRect(QWidget *w, const QRect &r); - void restartHideTimer(); + void restartExpireTimer(); bool tipChanged(const QPoint &pos, const QString &text, QObject *o); void placeTip(const QPoint &pos, QWidget *w); @@ -190,16 +191,17 @@ QTipLabel::QTipLabel(const QString &text, QWidget *w) reuseTip(text); } -void QTipLabel::restartHideTimer() +void QTipLabel::restartExpireTimer() { int time = 10000 + 40 * qMax(0, text().length()-100); - hideTimer.start(time, this); + expireTimer.start(time, this); + hideTimer.stop(); } void QTipLabel::reuseTip(const QString &text) { #ifndef QT_NO_STYLE_STYLESHEET - if (styleSheetParent) { + if (styleSheetParent){ disconnect(styleSheetParent, SIGNAL(destroyed()), QTipLabel::instance, SLOT(styleSheetParentDestroyed())); styleSheetParent = 0; @@ -213,7 +215,7 @@ void QTipLabel::reuseTip(const QString &text) if (fm.descent() == 2 && fm.ascent() >= 11) ++extra.rheight(); resize(sizeHint() + extra); - restartHideTimer(); + restartExpireTimer(); } void QTipLabel::paintEvent(QPaintEvent *ev) @@ -257,7 +259,8 @@ QTipLabel::~QTipLabel() void QTipLabel::hideTip() { - hideTimer.start(300, this); + if (!hideTimer.isActive()) + hideTimer.start(300, this); } void QTipLabel::hideTipImmediately() @@ -278,8 +281,10 @@ void QTipLabel::setTipRect(QWidget *w, const QRect &r) void QTipLabel::timerEvent(QTimerEvent *e) { - if (e->timerId() == hideTimer.timerId()){ + if (e->timerId() == hideTimer.timerId() + || e->timerId() == expireTimer.timerId()){ hideTimer.stop(); + expireTimer.stop(); #if defined(Q_WS_MAC) && !defined(QT_NO_EFFECTS) if (QApplication::isEffectEnabled(Qt::UI_FadeTooltip)){ // Fade out tip on mac (makes it invisible). -- cgit v0.12 From 6a408b6c6d00a76c74a4d612d85996d7ad3f03ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Fri, 12 Jun 2009 12:54:18 +0200 Subject: Fixed bug where QTransform::type() failed to compute the correct type. Since QTransform::type() now uses a switch based on m_dirty, we can't treat m_dirty as a bit mask anymore. Reviewed-by: Ariya --- src/gui/painting/qtransform.cpp | 15 ++++++++++----- tests/auto/qtransform/tst_qtransform.cpp | 7 +++++++ 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/gui/painting/qtransform.cpp b/src/gui/painting/qtransform.cpp index c00012a..16d60f8 100644 --- a/src/gui/painting/qtransform.cpp +++ b/src/gui/painting/qtransform.cpp @@ -420,7 +420,8 @@ QTransform &QTransform::translate(qreal dx, qreal dy) affine._dy += dy*affine._m22 + dx*affine._m12; break; } - m_dirty |= TxTranslate; + if (m_dirty < TxTranslate) + m_dirty = TxTranslate; return *this; } @@ -472,7 +473,8 @@ QTransform & QTransform::scale(qreal sx, qreal sy) affine._m22 *= sy; break; } - m_dirty |= TxScale; + if (m_dirty < TxScale) + m_dirty = TxScale; return *this; } @@ -529,7 +531,8 @@ QTransform & QTransform::shear(qreal sh, qreal sv) break; } } - m_dirty |= TxShear; + if (m_dirty < TxShear) + m_dirty = TxShear; return *this; } @@ -605,7 +608,8 @@ QTransform & QTransform::rotate(qreal a, Qt::Axis axis) break; } } - m_dirty |= TxRotate; + if (m_dirty < TxRotate) + m_dirty = TxRotate; } else { QTransform result; if (axis == Qt::YAxis) { @@ -677,7 +681,8 @@ QTransform & QTransform::rotateRadians(qreal a, Qt::Axis axis) break; } } - m_dirty |= TxRotate; + if (m_dirty < TxRotate) + m_dirty = TxRotate; } else { QTransform result; if (axis == Qt::YAxis) { diff --git a/tests/auto/qtransform/tst_qtransform.cpp b/tests/auto/qtransform/tst_qtransform.cpp index 74c405e..3b13a41 100644 --- a/tests/auto/qtransform/tst_qtransform.cpp +++ b/tests/auto/qtransform/tst_qtransform.cpp @@ -603,6 +603,13 @@ void tst_QTransform::types() 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 2.0f); QCOMPARE(m3.type(), QTransform::TxProject); + + QTransform m4; + m4.scale(5, 5); + m4.translate(4, 2); + m4.rotate(45); + + QCOMPARE(m4.type(), QTransform::TxRotate); } -- cgit v0.12 From 643e58248a22e54134c99d2ba70371f7f57b4040 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Fri, 12 Jun 2009 13:03:59 +0200 Subject: add streaming ops for scriptdebugger object deltas Needed for remote debugging. --- .../debugging/qscriptdebuggerobjectsnapshotdelta_p.h | 5 +++++ .../debugging/qscriptdebuggervalueproperty.cpp | 17 +++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/src/scripttools/debugging/qscriptdebuggerobjectsnapshotdelta_p.h b/src/scripttools/debugging/qscriptdebuggerobjectsnapshotdelta_p.h index e3ec541..546ed7f 100644 --- a/src/scripttools/debugging/qscriptdebuggerobjectsnapshotdelta_p.h +++ b/src/scripttools/debugging/qscriptdebuggerobjectsnapshotdelta_p.h @@ -60,6 +60,8 @@ QT_BEGIN_NAMESPACE +class QDataStream; + class Q_AUTOTEST_EXPORT QScriptDebuggerObjectSnapshotDelta { public: @@ -68,6 +70,9 @@ public: QScriptDebuggerValuePropertyList addedProperties; }; +Q_AUTOTEST_EXPORT QDataStream &operator<<(QDataStream &, const QScriptDebuggerObjectSnapshotDelta &); +Q_AUTOTEST_EXPORT QDataStream &operator>>(QDataStream &, QScriptDebuggerObjectSnapshotDelta &); + QT_END_NAMESPACE #endif diff --git a/src/scripttools/debugging/qscriptdebuggervalueproperty.cpp b/src/scripttools/debugging/qscriptdebuggervalueproperty.cpp index 723e304..51133bc 100644 --- a/src/scripttools/debugging/qscriptdebuggervalueproperty.cpp +++ b/src/scripttools/debugging/qscriptdebuggervalueproperty.cpp @@ -41,6 +41,7 @@ #include "qscriptdebuggervalueproperty_p.h" #include "qscriptdebuggervalue_p.h" +#include "qscriptdebuggerobjectsnapshotdelta_p.h" #include #include @@ -225,4 +226,20 @@ QDataStream &operator>>(QDataStream &in, QScriptDebuggerValueProperty &property) return in; } +QDataStream &operator<<(QDataStream &out, const QScriptDebuggerObjectSnapshotDelta &delta) +{ + out << delta.removedProperties; + out << delta.changedProperties; + out << delta.addedProperties; + return out; +} + +QDataStream &operator>>(QDataStream &in, QScriptDebuggerObjectSnapshotDelta &delta) +{ + in >> delta.removedProperties; + in >> delta.changedProperties; + in >> delta.addedProperties; + return in; +} + QT_END_NAMESPACE -- cgit v0.12 From d86ec1c4bec373090d85835f1bec44b025fa2fbc Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Fri, 12 Jun 2009 13:44:43 +0200 Subject: doc: Fixed several qdoc warnings. --- src/gui/painting/qdrawutil.cpp | 37 ++++++++++++++++++++++++++++++++----- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/src/gui/painting/qdrawutil.cpp b/src/gui/painting/qdrawutil.cpp index 4020593..29b922d 100644 --- a/src/gui/painting/qdrawutil.cpp +++ b/src/gui/painting/qdrawutil.cpp @@ -1046,9 +1046,19 @@ void qDrawItem(QPainter *p, Qt::GUIStyle gs, draw it, similar to \l{http://www.w3.org/TR/css3-background/} {CSS3 border-images}. - \sa qDrawBorderPixmap, Qt::TileRule, QTileRules + \sa Qt::TileRule, QTileRules */ +/*! \fn QMargins::QMargins(int margin) + Constructs a QMargins with the top, left, bottom, and + right margins set to \a margin. +*/ + +/*! \fn QMargins::QMargins(int topMargin, int leftMargin, int bottomMargin, int rightMargin) + Constructs a QMargins with the given \a topMargin, \a leftMargin, + \a bottomMargin, and \a rightMargin. + */ + /*! \class QTileRules \since 4.6 @@ -1056,20 +1066,37 @@ void qDrawItem(QPainter *p, Qt::GUIStyle gs, Holds the rules used to draw a pixmap or image split into nine segments, similar to \l{http://www.w3.org/TR/css3-background/}{CSS3 border-images}. - \sa qDrawBorderPixmap, Qt::TileRule, QMargins + \sa Qt::TileRule, QMargins */ +/*! \fn QTileRules::QTileRules(Qt::TileRule horizontalRule, Qt::TileRule verticalRule) + Constructs a QTileRules with the given \a horizontalRule and + \a verticalRule. + */ + +/*! \fn QTileRules::QTileRules(Qt::TileRule rule) + Constructs a QTileRules with the given \a rule used for both + the horizontal rule and the vertical rule. + */ + /*! - \fn qDrawBorderPixmap(QPainter *painter, const QRect &target, const QMargins &margins, const QPixmap &pixmap) + \fn void qDrawBorderPixmap(QPainter *painter, const QRect &target, const QMargins &margins, const QPixmap &pixmap) \since 4.6 + \relates QMargins Draws the given \a pixmap into the given \a target rectangle, using the given \a painter. The pixmap will be split into nine segments and drawn according to the \a margins structure. */ -static inline void qVerticalRepeat(QPainter *painter, const QRect &target, const QPixmap &pixmap, const QRect &source, - void (*drawPixmap)(QPainter*, const QRect&, const QPixmap&, const QRect&)) +static inline void qVerticalRepeat(QPainter *painter, + const QRect &target, + const QPixmap &pixmap, + const QRect &source, + void (*drawPixmap)(QPainter*, + const QRect&, + const QPixmap&, + const QRect&)) { const int x = target.x(); const int width = target.width(); -- cgit v0.12 From 8134541fc3229177ec7545fa0d3ea49eadc8f00c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Nilsen?= Date: Fri, 12 Jun 2009 13:27:57 +0200 Subject: QGraphicsItems are repainted when outside the view's exposed region. The problem was that we used QRect::isEmpty() on the item's bounding rect intersected with the exposed region's bounding rect as a criteria for whether the item should be drawn or not. This does not work as expected with partial updates, where the boundingRect() of the exposed region easily can cover the entire viewport area. The item should *only* be drawn if its bounding rect intersects with the exposed region (and not the exposed region's bounding rect). Auto-test included. --- src/gui/graphicsview/qgraphicsscene.cpp | 11 +++++---- tests/auto/qgraphicsview/tst_qgraphicsview.cpp | 34 ++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 5 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 55d8a1d..673fd23 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -5074,8 +5074,8 @@ void QGraphicsScenePrivate::drawSubtreeRecursive(QGraphicsItem *item, QPainter * } // Calculate the full transform for this item. - QRect viewBoundingRect; bool wasDirtyParentSceneTransform = false; + bool dontDrawItem = true; QTransform transform; if (item) { if (item->d_ptr->itemIsUntransformable()) { @@ -5091,15 +5091,17 @@ void QGraphicsScenePrivate::drawSubtreeRecursive(QGraphicsItem *item, QPainter * transform = item->d_ptr->sceneTransform; transform *= viewTransform; } - + QRectF brect = item->boundingRect(); // ### This does not take the clip into account. _q_adjustRect(&brect); - viewBoundingRect = transform.mapRect(brect).toRect(); + QRect viewBoundingRect = transform.mapRect(brect).toRect(); item->d_ptr->paintedViewBoundingRects.insert(widget, viewBoundingRect); viewBoundingRect.adjust(-1, -1, 1, 1); if (exposedRegion) - viewBoundingRect &= exposedRegion->boundingRect(); + dontDrawItem = !exposedRegion->intersects(viewBoundingRect); + else + dontDrawItem = viewBoundingRect.isEmpty(); } // Find and sort children. @@ -5154,7 +5156,6 @@ void QGraphicsScenePrivate::drawSubtreeRecursive(QGraphicsItem *item, QPainter * } bool childClip = (item && (item->d_ptr->flags & QGraphicsItem::ItemClipsChildrenToShape)); - bool dontDrawItem = !item || viewBoundingRect.isEmpty(); bool dontDrawChildren = item && dontDrawItem && childClip; childClip &= !dontDrawChildren && !children->isEmpty(); if (item && ((item->d_ptr->flags & QGraphicsItem::ItemHasNoContents) || invisibleButChildIgnoresParentOpacity)) diff --git a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp index 06b4a78..78d09ba 100644 --- a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp @@ -194,6 +194,7 @@ private slots: void mouseTracking(); void mouseTracking2(); void render(); + void exposeRegion(); // task specific tests below me void task172231_untransformableItems(); @@ -3323,6 +3324,39 @@ void tst_QGraphicsView::render() QCOMPARE(r4->paints, 2); } +void tst_QGraphicsView::exposeRegion() +{ + RenderTester *item = new RenderTester(QRectF(0, 0, 20, 20)); + QGraphicsScene scene; + scene.addItem(item); + + CustomView view; + view.setScene(&scene); + view.show(); +#ifdef Q_WS_X11 + qt_x11_wait_for_window_manager(&view); +#endif + QTest::qWait(125); + + item->paints = 0; + view.lastUpdateRegions.clear(); + + // Update a small area in the viewport's topLeft() and bottomRight(). + // (the boundingRect() of this area covers the entire viewport). + QWidget *viewport = view.viewport(); + QRegion expectedExposeRegion = QRect(0, 0, 5, 5); + expectedExposeRegion += QRect(viewport->rect().bottomRight() - QPoint(5, 5), QSize(5, 5)); + viewport->update(expectedExposeRegion); + qApp->processEvents(); + + // Make sure it triggers correct repaint on the view. + QCOMPARE(view.lastUpdateRegions.size(), 1); + QCOMPARE(view.lastUpdateRegions.at(0), expectedExposeRegion); + + // Make sure the item didn't get any repaints. + QCOMPARE(item->paints, 0); +} + void tst_QGraphicsView::task253415_reconnectUpdateSceneOnSceneChanged() { QGraphicsView view; -- cgit v0.12 From f2b93868f48a3e2d6e462ca8a051ab47eefef49d Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Fri, 12 Jun 2009 13:56:30 +0200 Subject: QMenu, QMenuBar: small cleanup Removed calls to the widget getters because we have the members directly in the private class. --- src/gui/kernel/qshortcut.cpp | 1 - src/gui/widgets/qdockwidget.cpp | 2 +- src/gui/widgets/qmenu.cpp | 4 ++-- src/gui/widgets/qmenu_p.h | 2 +- src/gui/widgets/qmenubar.cpp | 18 +++++++----------- src/gui/widgets/qsizegrip.cpp | 2 +- src/gui/widgets/qtoolbutton.cpp | 4 +--- 7 files changed, 13 insertions(+), 20 deletions(-) diff --git a/src/gui/kernel/qshortcut.cpp b/src/gui/kernel/qshortcut.cpp index 50b6e59..bced833 100644 --- a/src/gui/kernel/qshortcut.cpp +++ b/src/gui/kernel/qshortcut.cpp @@ -163,7 +163,6 @@ public: void QShortcutPrivate::redoGrab(QShortcutMap &map) { Q_Q(QShortcut); - QWidget *parent = q->parentWidget(); if (!parent) { qWarning("QShortcut: No widget parent defined"); return; diff --git a/src/gui/widgets/qdockwidget.cpp b/src/gui/widgets/qdockwidget.cpp index 30f9a87..e20fedd 100644 --- a/src/gui/widgets/qdockwidget.cpp +++ b/src/gui/widgets/qdockwidget.cpp @@ -1053,7 +1053,7 @@ void QDockWidgetPrivate::setWindowState(bool floating, bool unplug, const QRect if (floating != wasFloating) { emit q->topLevelChanged(floating); - if (!floating && q->parentWidget()) { + if (!floating && parent) { QMainWindowLayout *mwlayout = qobject_cast(q->parentWidget()->layout()); if (mwlayout) emit q->dockLocationChanged(mwlayout->dockWidgetArea(q)); diff --git a/src/gui/widgets/qmenu.cpp b/src/gui/widgets/qmenu.cpp index 7baea94..aa601cb 100644 --- a/src/gui/widgets/qmenu.cpp +++ b/src/gui/widgets/qmenu.cpp @@ -205,7 +205,6 @@ void QMenuPrivate::calcActionRects(QMap &actionRects, QList items = filterActions(q->actions()); int max_column_width = 0, dh = popupGeometry(QApplication::desktop()->screenNumber(q)).height(), ncols = 1, @@ -218,6 +217,7 @@ void QMenuPrivate::calcActionRects(QMap &actionRects, QList items = filteredActions(); for(int i = 0; i < items.count(); i++) { QAction *action = items.at(i); if (widgetItems.value(action)) @@ -348,7 +348,7 @@ void QMenuPrivate::updateActions() itemsDirty = 0; } -QList QMenuPrivate::filterActions(const QList &actions) const +QList QMenuPrivate::filteredActions() const { QList visibleActions; int i = 0; diff --git a/src/gui/widgets/qmenu_p.h b/src/gui/widgets/qmenu_p.h index f08283d..1dfe701 100644 --- a/src/gui/widgets/qmenu_p.h +++ b/src/gui/widgets/qmenu_p.h @@ -161,7 +161,7 @@ public: void calcActionRects(QMap &actionRects, QList &actionList) const; void updateActions(); QRect popupGeometry(int screen=-1) const; - QList filterActions(const QList &actions) const; + QList filteredActions() const; uint ncols : 4; //4 bits is probably plenty uint collapsibleSeparators : 1; diff --git a/src/gui/widgets/qmenubar.cpp b/src/gui/widgets/qmenubar.cpp index 51e38e6..68a0233 100644 --- a/src/gui/widgets/qmenubar.cpp +++ b/src/gui/widgets/qmenubar.cpp @@ -116,11 +116,9 @@ QSize QMenuBarExtension::sizeHint() const */ QAction *QMenuBarPrivate::actionAt(QPoint p) const { - Q_Q(const QMenuBar); - QList items = q->actions(); - for(int i = 0; i < items.size(); ++i) { - if(actionRect(items.at(i)).contains(p)) - return items.at(i); + for(int i = 0; i < actions.size(); ++i) { + if(actionRect(actions.at(i)).contains(p)) + return actions.at(i); } return 0; } @@ -259,9 +257,9 @@ void QMenuBarPrivate::updateGeometries() } q->updateGeometry(); #ifdef QT3_SUPPORT - if (q->parentWidget() != 0) { + if (parent) { QMenubarUpdatedEvent menubarUpdated(q); - QApplication::sendEvent(q->parentWidget(), &menubarUpdated); + QApplication::sendEvent(parent, &menubarUpdated); } #endif } @@ -413,15 +411,14 @@ void QMenuBarPrivate::calcActionRects(int max_width, int start, QMapstyle()->pixelMetric(QStyle::PM_MenuBarItemSpacing, 0, q); int max_item_height = 0, separator = -1, separator_start = 0, separator_len = 0; - QList items = q->actions(); //calculate size const QFontMetrics fm = q->fontMetrics(); const int hmargin = q->style()->pixelMetric(QStyle::PM_MenuBarHMargin, 0, q), vmargin = q->style()->pixelMetric(QStyle::PM_MenuBarVMargin, 0, q), icone = q->style()->pixelMetric(QStyle::PM_SmallIconSize, 0, q); - for(int i = 0; i < items.count(); i++) { - QAction *action = items.at(i); + for(int i = 0; i < actions.count(); i++) { + QAction *action = actions.at(i); if(!action->isVisible()) continue; @@ -534,7 +531,6 @@ void QMenuBarPrivate::_q_actionHovered() emit q->hovered(action); #ifndef QT_NO_ACCESSIBILITY if (QAccessible::isActive()) { - QList actions = q->actions(); int actionIndex = actions.indexOf(action); ++actionIndex; QAccessible::updateAccessibility(q, actionIndex, QAccessible::Focus); diff --git a/src/gui/widgets/qsizegrip.cpp b/src/gui/widgets/qsizegrip.cpp index 6458b15..244d34a 100644 --- a/src/gui/widgets/qsizegrip.cpp +++ b/src/gui/widgets/qsizegrip.cpp @@ -139,7 +139,7 @@ public: void QSizeGripPrivate::updateMacSizer(bool hide) const { Q_Q(const QSizeGrip); - if (QApplication::closingDown() || !q->parentWidget()) + if (QApplication::closingDown() || !parent) return; QWidget *topLevelWindow = qt_sizegrip_topLevelWidget(const_cast(q)); if(topLevelWindow && topLevelWindow->isWindow()) diff --git a/src/gui/widgets/qtoolbutton.cpp b/src/gui/widgets/qtoolbutton.cpp index 0eb6364..d26cf5b 100644 --- a/src/gui/widgets/qtoolbutton.cpp +++ b/src/gui/widgets/qtoolbutton.cpp @@ -104,10 +104,9 @@ public: #ifndef QT_NO_MENU bool QToolButtonPrivate::hasMenu() const { - Q_Q(const QToolButton); return ((defaultAction && defaultAction->menu()) || (menuAction && menuAction->menu()) - || q->actions().size() > (defaultAction ? 1 : 0)); + || actions.size() > (defaultAction ? 1 : 0)); } #endif @@ -882,7 +881,6 @@ void QToolButtonPrivate::popupTimerDone() } else { actualMenu = new QMenu(q); mustDeleteActualMenu = true; - QList actions = q->actions(); for(int i = 0; i < actions.size(); i++) actualMenu->addAction(actions.at(i)); } -- cgit v0.12