diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/dialogs/qinputdialog.cpp | 6 | ||||
-rw-r--r-- | src/gui/itemviews/qitemeditorfactory.cpp | 16 | ||||
-rw-r--r-- | src/gui/painting/qpaintengine_raster.cpp | 2 | ||||
-rw-r--r-- | src/gui/painting/qpathclipper.cpp | 69 | ||||
-rw-r--r-- | src/gui/painting/qrasterizer.cpp | 2 | ||||
-rw-r--r-- | src/network/access/qhttpnetworkconnection.cpp | 3 | ||||
-rw-r--r-- | src/svg/qsvghandler.cpp | 1 |
7 files changed, 64 insertions, 35 deletions
diff --git a/src/gui/dialogs/qinputdialog.cpp b/src/gui/dialogs/qinputdialog.cpp index 8c0c2c7..e2c5742 100644 --- a/src/gui/dialogs/qinputdialog.cpp +++ b/src/gui/dialogs/qinputdialog.cpp @@ -1128,8 +1128,8 @@ void QInputDialog::done(int result) is \a parent. The dialog will be modal and uses the specified widget \a flags. - This function returns the text which has been entered in the line - edit. It will not return an empty string. + If the dialog is accepted, this function returns the text in the dialog's + line edit. If the dialog is rejected, a null QString is returned. Use this static function like this: @@ -1158,7 +1158,7 @@ QString QInputDialog::getText(QWidget *parent, const QString &title, const QStri if (ret) { return dialog.textValue(); } else { - return text; + return QString(); } } diff --git a/src/gui/itemviews/qitemeditorfactory.cpp b/src/gui/itemviews/qitemeditorfactory.cpp index c576e40..480a472 100644 --- a/src/gui/itemviews/qitemeditorfactory.cpp +++ b/src/gui/itemviews/qitemeditorfactory.cpp @@ -158,6 +158,10 @@ QByteArray QItemEditorFactory::valuePropertyName(QVariant::Type type) const */ QItemEditorFactory::~QItemEditorFactory() { + //we make sure we delete all the QItemEditorCreatorBase + //this has to be done only once, hence the QSet + QSet<QItemEditorCreatorBase*> set = creatorMap.values().toSet(); + qDeleteAll(set); } /*! @@ -170,8 +174,16 @@ QItemEditorFactory::~QItemEditorFactory() */ void QItemEditorFactory::registerEditor(QVariant::Type type, QItemEditorCreatorBase *creator) { - delete creatorMap.value(type, 0); - creatorMap[type] = creator; + QHash<QVariant::Type, QItemEditorCreatorBase *>::iterator it = creatorMap.find(type); + if (it != creatorMap.end()) { + QItemEditorCreatorBase *oldCreator = it.value(); + Q_ASSERT(oldCreator); + creatorMap.erase(it); + if (!creatorMap.values().contains(oldCreator)) + delete oldCreator; // if it is no more in use we can delete it + } + + creatorMap[type] = creator; } class QDefaultItemEditorFactory : public QItemEditorFactory diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 1d3e38e..78515ac 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -3996,7 +3996,7 @@ void QRasterPaintEnginePrivate::initializeRasterizer(QSpanData *data) const QClipData *c = clip(); if (c) { const QRect r(QPoint(c->xmin, c->ymin), - QPoint(c->xmax, c->ymax)); + QSize(c->xmax - c->xmin, c->ymax - c->ymin)); clipRect = clipRect.intersected(r); blend = data->blend; } else { diff --git a/src/gui/painting/qpathclipper.cpp b/src/gui/painting/qpathclipper.cpp index 9625b28..053955c 100644 --- a/src/gui/painting/qpathclipper.cpp +++ b/src/gui/painting/qpathclipper.cpp @@ -45,9 +45,6 @@ #include <private/qdatabuffer_p.h> #include <qmath.h> -#include <QImage> -#include <QPainter> - /** The algorithm is as follows: @@ -68,6 +65,20 @@ QT_BEGIN_NAMESPACE +static inline bool fuzzyIsNull(qreal d) +{ + if (sizeof(qreal) == sizeof(double)) + return qAbs(d) <= 1e-12; + else + return qAbs(d) <= 1e-5f; +} + +static inline bool comparePoints(const QPointF &a, const QPointF &b) +{ + return fuzzyIsNull(a.x() - b.x()) + && fuzzyIsNull(a.y() - b.y()); +} + //#define QDEBUG_CLIPPER static qreal dot(const QPointF &a, const QPointF &b) { @@ -105,8 +116,10 @@ private: bool QIntersectionFinder::beziersIntersect(const QBezier &one, const QBezier &two) const { - return (one.pt1() == two.pt1() && one.pt2() == two.pt2() && one.pt3() == two.pt3() && one.pt4() == two.pt4()) - || (one.pt1() == two.pt4() && one.pt2() == two.pt3() && one.pt3() == two.pt2() && one.pt4() == two.pt1()) + return (comparePoints(one.pt1(), two.pt1()) && comparePoints(one.pt2(), two.pt2()) + && comparePoints(one.pt3(), two.pt3()) && comparePoints(one.pt4(), two.pt4())) + || (comparePoints(one.pt1(), two.pt4()) && comparePoints(one.pt2(), two.pt3()) + && comparePoints(one.pt3(), two.pt2()) && comparePoints(one.pt4(), two.pt1())) || QBezier::findIntersections(one, two, 0); } @@ -118,17 +131,17 @@ bool QIntersectionFinder::linesIntersect(const QLineF &a, const QLineF &b) const const QPointF q1 = b.p1(); const QPointF q2 = b.p2(); - if (p1 == p2 || q1 == q2) + if (comparePoints(p1, p2) || comparePoints(q1, q2)) return false; - const bool p1_equals_q1 = (p1 == q1); - const bool p2_equals_q2 = (p2 == q2); + const bool p1_equals_q1 = comparePoints(p1, q1); + const bool p2_equals_q2 = comparePoints(p2, q2); if (p1_equals_q1 && p2_equals_q2) return true; - const bool p1_equals_q2 = (p1 == q2); - const bool p2_equals_q1 = (p2 == q1); + const bool p1_equals_q2 = comparePoints(p1, q2); + const bool p2_equals_q1 = comparePoints(p2, q1); if (p1_equals_q2 && p2_equals_q1) return true; @@ -184,8 +197,10 @@ bool QIntersectionFinder::linesIntersect(const QLineF &a, const QLineF &b) const void QIntersectionFinder::intersectBeziers(const QBezier &one, const QBezier &two, QVector<QPair<qreal, qreal> > &t, QDataBuffer<QIntersection> &intersections) { - if ((one.pt1() == two.pt1() && one.pt2() == two.pt2() && one.pt3() == two.pt3() && one.pt4() == two.pt4()) - || (one.pt1() == two.pt4() && one.pt2() == two.pt3() && one.pt3() == two.pt2() && one.pt4() == two.pt1())) { + if ((comparePoints(one.pt1(), two.pt1()) && comparePoints(one.pt2(), two.pt2()) + && comparePoints(one.pt3(), two.pt3()) && comparePoints(one.pt4(), two.pt4())) + || (comparePoints(one.pt1(), two.pt4()) && comparePoints(one.pt2(), two.pt3()) + && comparePoints(one.pt3(), two.pt2()) && comparePoints(one.pt4(), two.pt1()))) { return; } @@ -230,17 +245,17 @@ void QIntersectionFinder::intersectLines(const QLineF &a, const QLineF &b, QData const QPointF q1 = b.p1(); const QPointF q2 = b.p2(); - if (p1 == p2 || q1 == q2) + if (comparePoints(p1, p2) || comparePoints(q1, q2)) return; - const bool p1_equals_q1 = (p1 == q1); - const bool p2_equals_q2 = (p2 == q2); + const bool p1_equals_q1 = comparePoints(p1, q1); + const bool p2_equals_q2 = comparePoints(p2, q2); if (p1_equals_q1 && p2_equals_q2) return; - const bool p1_equals_q2 = (p1 == q2); - const bool p2_equals_q1 = (p2 == q1); + const bool p1_equals_q2 = comparePoints(p1, q2); + const bool p2_equals_q1 = comparePoints(p2, q1); if (p1_equals_q2 && p2_equals_q1) return; @@ -624,11 +639,11 @@ public: const qreal pivot = pivotComponents[depth & 1]; const qreal value = pointComponents[depth & 1]; - if (qFuzzyCompare(pivot, value)) { + if (fuzzyIsNull(pivot - value)) { const qreal pivot2 = pivotComponents[(depth + 1) & 1]; const qreal value2 = pointComponents[(depth + 1) & 1]; - if (qFuzzyCompare(pivot2, value2)) { + if (fuzzyIsNull(pivot2 - value2)) { if (node.id < 0) node.id = m_tree->nextId(); @@ -802,15 +817,15 @@ QWingedEdge::TraversalStatus QWingedEdge::next(const QWingedEdge::TraversalStatu static bool isLine(const QBezier &bezier) { - const bool equal_1_2 = bezier.pt1() == bezier.pt2(); - const bool equal_2_3 = bezier.pt2() == bezier.pt3(); - const bool equal_3_4 = bezier.pt3() == bezier.pt4(); + const bool equal_1_2 = comparePoints(bezier.pt1(), bezier.pt2()); + const bool equal_2_3 = comparePoints(bezier.pt2(), bezier.pt3()); + const bool equal_3_4 = comparePoints(bezier.pt3(), bezier.pt4()); // point? if (equal_1_2 && equal_2_3 && equal_3_4) return true; - if (bezier.pt1() == bezier.pt4()) + if (comparePoints(bezier.pt1(), bezier.pt4())) return equal_1_2 || equal_3_4; return (equal_1_2 && equal_3_4) || (equal_1_2 && equal_2_3) || (equal_2_3 && equal_3_4); @@ -844,14 +859,14 @@ void QPathSegments::addPath(const QPainterPath &path) else currentPoint = path.elementAt(i); - if (i > 0 && m_points.at(lastMoveTo) == currentPoint) + if (i > 0 && comparePoints(m_points.at(lastMoveTo), currentPoint)) current = lastMoveTo; else m_points << currentPoint; switch (path.elementAt(i).type) { case QPainterPath::MoveToElement: - if (hasMoveTo && last != lastMoveTo && m_points.at(last) != m_points.at(lastMoveTo)) + if (hasMoveTo && last != lastMoveTo && !comparePoints(m_points.at(last), m_points.at(lastMoveTo))) m_segments << Segment(m_pathId, last, lastMoveTo); hasMoveTo = true; last = lastMoveTo = current; @@ -879,7 +894,7 @@ void QPathSegments::addPath(const QPainterPath &path) } } - if (hasMoveTo && last != lastMoveTo && m_points.at(last) != m_points.at(lastMoveTo)) + if (hasMoveTo && last != lastMoveTo && !comparePoints(m_points.at(last), m_points.at(lastMoveTo))) m_segments << Segment(m_pathId, last, lastMoveTo); for (int i = firstSegment; i < m_segments.size(); ++i) { @@ -1357,7 +1372,7 @@ void QWingedEdge::addBezierEdge(const QBezier *bezier, const QPointF &a, const Q if (qFuzzyCompare(alphaA, alphaB)) return; - if (a == b) { + if (comparePoints(a, b)) { int v = insert(a); addBezierEdge(bezier, v, v, alphaA, alphaB, path); diff --git a/src/gui/painting/qrasterizer.cpp b/src/gui/painting/qrasterizer.cpp index 629b38e..58e4b4e 100644 --- a/src/gui/painting/qrasterizer.cpp +++ b/src/gui/painting/qrasterizer.cpp @@ -703,7 +703,7 @@ static inline qreal qRoundF(qreal v) void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width, bool squareCap) { - if (a == b || width == 0) + if (a == b || width == 0 || d->clipRect.isEmpty()) return; QPointF pa = a; diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp index cfce735..f0c694d 100644 --- a/src/network/access/qhttpnetworkconnection.cpp +++ b/src/network/access/qhttpnetworkconnection.cpp @@ -1020,7 +1020,8 @@ void QHttpNetworkConnectionPrivate::removeReply(QHttpNetworkReply *reply) for (int i = 0; i < channelCount; ++i) { if (channels[i].reply == reply) { channels[i].reply = 0; - closeChannel(i); + if (reply->d_func()->connectionCloseEnabled()) + closeChannel(i); QMetaObject::invokeMethod(q, "_q_startNextRequest", Qt::QueuedConnection); return; } diff --git a/src/svg/qsvghandler.cpp b/src/svg/qsvghandler.cpp index 44477e5..e2c1312 100644 --- a/src/svg/qsvghandler.cpp +++ b/src/svg/qsvghandler.cpp @@ -3378,6 +3378,7 @@ void QSvgHandler::init() { m_doc = 0; m_style = 0; + m_animEnd = 0; m_defaultCoords = LT_PX; m_defaultPen = QPen(Qt::black, 1, Qt::NoPen, Qt::FlatCap, Qt::SvgMiterJoin); m_defaultPen.setMiterLimit(4); |