diff --git a/libs/flake/KoConnectionShapeFactory.h b/libs/flake/KoConnectionShapeFactory.h --- a/libs/flake/KoConnectionShapeFactory.h +++ b/libs/flake/KoConnectionShapeFactory.h @@ -28,6 +28,7 @@ class KoConnectionShapeFactory : public KoShapeFactoryBase { +Q_OBJECT public: KoConnectionShapeFactory(); ~KoConnectionShapeFactory() {} diff --git a/libs/flake/KoGradientBackground.cpp b/libs/flake/KoGradientBackground.cpp --- a/libs/flake/KoGradientBackground.cpp +++ b/libs/flake/KoGradientBackground.cpp @@ -137,7 +137,7 @@ if (brush.isOpaque() && styleStack.hasProperty(KoXmlNS::draw, "opacity")) { QString opacityPercent = styleStack.property(KoXmlNS::draw, "opacity"); if (! opacityPercent.isEmpty() && opacityPercent.right(1) == "%") { - float opacity = qMin(opacityPercent.left(opacityPercent.length() - 1).toDouble(), 100.0) / 100; + float opacity = qMin(opacityPercent.leftRef(opacityPercent.length() - 1).toDouble(), 100.0) / 100; QGradientStops stops; foreach(QGradientStop stop, d->gradient->stops()) { stop.second.setAlphaF(opacity); diff --git a/libs/flake/KoHatchBackground.cpp b/libs/flake/KoHatchBackground.cpp --- a/libs/flake/KoHatchBackground.cpp +++ b/libs/flake/KoHatchBackground.cpp @@ -179,7 +179,7 @@ QString style = styleStack.property(KoXmlNS::draw, "fill-hatch-name"); debugFlake << " hatch style is :" << style; - KoXmlElement* draw = context.stylesReader().drawStyles("hatch")[style]; + KoXmlElement* draw = context.stylesReader().drawStyles("hatch").value(style); if (draw) { debugFlake << "Hatch style found for:" << style; diff --git a/libs/flake/KoOdfGradientBackground.cpp b/libs/flake/KoOdfGradientBackground.cpp --- a/libs/flake/KoOdfGradientBackground.cpp +++ b/libs/flake/KoOdfGradientBackground.cpp @@ -165,13 +165,16 @@ if (styleStack.hasProperty(KoXmlNS::draw, "opacity")) { QString opacity = styleStack.property(KoXmlNS::draw, "opacity"); if (! opacity.isEmpty() && opacity.right(1) == "%") { - d->opacity = qMin(opacity.left(opacity.length() - 1).toDouble(), 100.0) / 100; + d->opacity = qMin(opacity.leftRef(opacity.length() - 1).toDouble(), 100.0) / 100; } } QString styleName = styleStack.property(KoXmlNS::draw, "fill-gradient-name"); - KoXmlElement * e = context.stylesReader().drawStyles("gradient")[styleName]; - return loadOdf(*e); + auto gradient = context.stylesReader().drawStyles("gradient"); + auto it = gradient.constFind(styleName); + if (it != gradient.constEnd() && it.value()) { + return loadOdf(*it.value()); + } } return false; diff --git a/libs/flake/KoPathShapeFactory.h b/libs/flake/KoPathShapeFactory.h --- a/libs/flake/KoPathShapeFactory.h +++ b/libs/flake/KoPathShapeFactory.h @@ -30,6 +30,7 @@ /// Factory for path shapes. class FLAKE_EXPORT KoPathShapeFactory : public KoShapeFactoryBase { +Q_OBJECT public: /// constructor explicit KoPathShapeFactory(const QStringList&); diff --git a/libs/flake/KoPatternBackground.cpp b/libs/flake/KoPatternBackground.cpp --- a/libs/flake/KoPatternBackground.cpp +++ b/libs/flake/KoPatternBackground.cpp @@ -140,7 +140,7 @@ KoPatternBackground::~KoPatternBackground() { - Q_D(KoPatternBackground); + //Q_D(KoPatternBackground); } void KoPatternBackground::setTransform(const QTransform &matrix) @@ -373,7 +373,7 @@ QString styleName = styleStack.property(KoXmlNS::draw, "fill-image-name"); - KoXmlElement* e = context.stylesReader().drawStyles("fill-image")[styleName]; + KoXmlElement* e = context.stylesReader().drawStyles("fill-image").value(styleName); if (! e) return false; diff --git a/libs/flake/KoResourceManager_p.cpp b/libs/flake/KoResourceManager_p.cpp --- a/libs/flake/KoResourceManager_p.cpp +++ b/libs/flake/KoResourceManager_p.cpp @@ -132,5 +132,4 @@ if (! m_resources.contains(key)) return; m_resources.remove(key); - QVariant empty; } diff --git a/libs/flake/KoShape.cpp b/libs/flake/KoShape.cpp --- a/libs/flake/KoShape.cpp +++ b/libs/flake/KoShape.cpp @@ -1633,7 +1633,7 @@ } else if (fill == "gradient") { QString styleName = KoShapePrivate::getStyleProperty("fill-gradient-name", context); - KoXmlElement *e = context.odfLoadingContext().stylesReader().drawStyles("gradient")[styleName]; + KoXmlElement *e = context.odfLoadingContext().stylesReader().drawStyles("gradient").value(styleName); QString style; if (e) { style = e->attributeNS(KoXmlNS::draw, "style", QString()); @@ -1729,7 +1729,7 @@ QString opacity = styleStack.property(KoXmlNS::draw, "shadow-opacity"); if (! opacity.isEmpty() && opacity.right(1) == "%") - shadowColor.setAlphaF(opacity.left(opacity.length() - 1).toFloat() / 100.0); + shadowColor.setAlphaF(opacity.leftRef(opacity.length() - 1).toFloat() / 100.0); shadow->setColor(shadowColor); shadow->setVisible(shadowStyle == "visible"); @@ -2171,7 +2171,7 @@ // This will loose data as odf can only save one set of contour wheras // svg loading and at least karbon editing can produce more than one // TODO, FIXME see if we can save more than one clipshape to odf - d->clipPath->clipPathShapes().first()->saveContourOdf(context, originalSize); + d->clipPath->clipPathShapes().constFirst()->saveContourOdf(context, originalSize); } } diff --git a/libs/flake/KoShapeContainer.cpp b/libs/flake/KoShapeContainer.cpp --- a/libs/flake/KoShapeContainer.cpp +++ b/libs/flake/KoShapeContainer.cpp @@ -97,7 +97,7 @@ if (d->model == 0) return; for(int i = d->model->shapes().count() - 1; i >= 0; --i) { - KoShape *shape = d->model->shapes()[i]; + KoShape *shape = d->model->shapes().at(i); d->model->remove(shape); shape->setParent(0); } diff --git a/libs/flake/KoShapeGroup.cpp b/libs/flake/KoShapeGroup.cpp --- a/libs/flake/KoShapeGroup.cpp +++ b/libs/flake/KoShapeGroup.cpp @@ -180,7 +180,7 @@ loadOdfAttributes(element, context, OdfMandatories | OdfStyle | OdfAdditionalAttributes | OdfCommonChildElements); KoXmlElement child; - QMap usedLayers; + QHash usedLayers; forEachElement(child, element) { KoShape * shape = KoShapeRegistry::instance()->createShapeFromOdf(child, context); if (shape) { @@ -194,7 +194,7 @@ KoShapeLayer *parent = 0; int maxUseCount = 0; // find most used layer and use this as parent for the group - for (QMap::const_iterator it(usedLayers.constBegin()); it != usedLayers.constEnd(); ++it) { + for (QHash::const_iterator it(usedLayers.constBegin()); it != usedLayers.constEnd(); ++it) { if (it.value() > maxUseCount) { maxUseCount = it.value(); parent = it.key(); diff --git a/libs/flake/KoShapeManager.cpp b/libs/flake/KoShapeManager.cpp --- a/libs/flake/KoShapeManager.cpp +++ b/libs/flake/KoShapeManager.cpp @@ -207,7 +207,7 @@ // This signal is used in the annotation shape. // FIXME: Is this really what we want? (and shouldn't it be called shapeDeleted()?) - shapeRemoved(shape); + emit shapeRemoved(shape); } void KoShapeManager::removeAdditional(KoShape *shape) diff --git a/libs/flake/KoShapeRegistry.cpp b/libs/flake/KoShapeRegistry.cpp --- a/libs/flake/KoShapeRegistry.cpp +++ b/libs/flake/KoShapeRegistry.cpp @@ -338,7 +338,7 @@ QMultiMap priorityMap = d->factoryMap.value(p); QList shapeFactories; // sort list by priority - foreach(KoShapeFactoryBase *f, priorityMap.values()) { + foreach(KoShapeFactoryBase *f, priorityMap) { shapeFactories.prepend(f); } diff --git a/libs/flake/KoToolBase.cpp b/libs/flake/KoToolBase.cpp --- a/libs/flake/KoToolBase.cpp +++ b/libs/flake/KoToolBase.cpp @@ -56,7 +56,7 @@ KoToolBase::~KoToolBase() { - Q_D(const KoToolBase); + //Q_D(const KoToolBase); // Enable this to easily generate action files for tools // if (d->actionCollection.size() > 0) { diff --git a/libs/flake/KoToolManager.cpp b/libs/flake/KoToolManager.cpp --- a/libs/flake/KoToolManager.cpp +++ b/libs/flake/KoToolManager.cpp @@ -888,7 +888,7 @@ void KoToolManager::addController(KoCanvasController *controller) { Q_ASSERT(controller); - if (d->canvasses.keys().contains(controller)) + if (d->canvasses.contains(controller)) return; d->setup(); d->attachCanvas(controller); @@ -915,12 +915,12 @@ void KoToolManager::updateShapeControllerBase(KoShapeBasedDocumentBase *shapeController, KoCanvasController *canvasController) { - if (!d->canvasses.keys().contains(canvasController)) + if (!d->canvasses.contains(canvasController)) return; QList canvasses = d->canvasses[canvasController]; foreach(CanvasData *canvas, canvasses) { - foreach(KoToolBase *tool, canvas->allTools.values()) { + foreach(KoToolBase *tool, canvas->allTools) { tool->updateShapeController(shapeController); } } diff --git a/libs/flake/commands/KoShapeReorderCommand.cpp b/libs/flake/commands/KoShapeReorderCommand.cpp --- a/libs/flake/commands/KoShapeReorderCommand.cpp +++ b/libs/flake/commands/KoShapeReorderCommand.cpp @@ -77,10 +77,10 @@ } } -static void prepare(KoShape *s, QMap > &newOrder, KoShapeManager *manager, KoShapeReorderCommand::MoveShapeType move) +static void prepare(KoShape *s, QHash > &newOrder, KoShapeManager *manager, KoShapeReorderCommand::MoveShapeType move) { KoShapeContainer *parent = s->parent(); - QMap >::iterator it(newOrder.find(parent)); + QHash >::iterator it(newOrder.find(parent)); if (it == newOrder.end()) { QList children; if (parent != 0) { @@ -127,7 +127,7 @@ { QList newIndexes; QList changedShapes; - QMap > newOrder; + QHash > newOrder; QList sortedShapes(shapes); qSort(sortedShapes.begin(), sortedShapes.end(), KoShape::compareShapeZIndex); if (move == BringToFront || move == LowerShape) { @@ -141,7 +141,7 @@ } } - QMap >::ConstIterator newIt(newOrder.constBegin()); + QHash >::ConstIterator newIt(newOrder.constBegin()); for (; newIt!= newOrder.constEnd(); ++newIt) { QList order(newIt.value()); order.removeAll(0); diff --git a/libs/flake/svg/SvgShapeFactory.h b/libs/flake/svg/SvgShapeFactory.h --- a/libs/flake/svg/SvgShapeFactory.h +++ b/libs/flake/svg/SvgShapeFactory.h @@ -26,6 +26,7 @@ /// Use this shape factory to load embedded svg files from odf class FLAKE_EXPORT SvgShapeFactory : public KoShapeFactoryBase { +Q_OBJECT public: SvgShapeFactory(); ~SvgShapeFactory(); diff --git a/libs/flake/svg/SvgStyleWriter.cpp b/libs/flake/svg/SvgStyleWriter.cpp --- a/libs/flake/svg/SvgStyleWriter.cpp +++ b/libs/flake/svg/SvgStyleWriter.cpp @@ -73,7 +73,6 @@ context.shapeWriter().addAttribute("fill", "none"); } - QBrush fill(Qt::NoBrush); QSharedPointer cbg = qSharedPointerDynamicCast(shape->background()); if (cbg) { context.shapeWriter().addAttribute("fill", cbg->color().name()); diff --git a/libs/flake/tests/TestKoShapeFactory.cpp b/libs/flake/tests/TestKoShapeFactory.cpp --- a/libs/flake/tests/TestKoShapeFactory.cpp +++ b/libs/flake/tests/TestKoShapeFactory.cpp @@ -67,11 +67,11 @@ void TestKoShapeFactory::testOdfElement() { KoShapeFactoryBase * factory = new KoPathShapeFactory(QStringList()); - QVERIFY(factory->odfElements().front().second.contains("path")); - QVERIFY(factory->odfElements().front().second.contains("line")); - QVERIFY(factory->odfElements().front().second.contains("polyline")); - QVERIFY(factory->odfElements().front().second.contains("polygon")); - QVERIFY(factory->odfElements().front().first == KoXmlNS::draw); + QVERIFY(factory->odfElements().constFirst().second.contains("path")); + QVERIFY(factory->odfElements().constFirst().second.contains("line")); + QVERIFY(factory->odfElements().constFirst().second.contains("polyline")); + QVERIFY(factory->odfElements().constFirst().second.contains("polygon")); + QVERIFY(factory->odfElements().constFirst().first == KoXmlNS::draw); QBuffer xmldevice; xmldevice.open(QIODevice::WriteOnly); diff --git a/libs/flake/tests/TestSnapStrategy.cpp b/libs/flake/tests/TestSnapStrategy.cpp --- a/libs/flake/tests/TestSnapStrategy.cpp +++ b/libs/flake/tests/TestSnapStrategy.cpp @@ -202,7 +202,6 @@ qreal paramSnapDistanceTwo = 8; KoPathShape pathShapeOne; - QVector firstSnapPointList; pathShapeOne.moveTo(QPointF(1,2)); pathShapeOne.lineTo(QPointF(2,2)); @@ -215,7 +214,6 @@ ShapeManager->addShape(&pathShapeOne); KoPathShape pathShapeTwo; - QVector secondSnapPointList; pathShapeTwo.moveTo(QPointF(1,1)); pathShapeTwo.lineTo(QPointF(2,2)); @@ -228,7 +226,6 @@ ShapeManager->addShape(&pathShapeTwo); KoPathShape pathShapeThree; - QVector thirdSnapPointList; pathShapeThree.moveTo(QPointF(5,5)); pathShapeThree.lineTo(QPointF(6,6)); pathShapeThree.lineTo(QPointF(7,7)); @@ -291,7 +288,6 @@ qreal paramSnapDistanceTwo = 8; KoPathShape pathShapeOne; - QVector firstSnapPointList; pathShapeOne.moveTo(QPointF(1,2)); pathShapeOne.lineTo(QPointF(2,2)); @@ -302,7 +298,6 @@ ShapeManager->addShape(&pathShapeOne); KoPathShape pathShapeTwo; - QVector secondSnapPointList; pathShapeTwo.moveTo(QPointF(1,1)); pathShapeTwo.lineTo(QPointF(2,2)); @@ -313,7 +308,6 @@ ShapeManager->addShape(&pathShapeTwo); KoPathShape pathShapeThree; - QVector thirdSnapPointList; pathShapeThree.moveTo(QPointF(5,5)); pathShapeThree.lineTo(QPointF(6,6)); pathShapeThree.lineTo(QPointF(7,7)); diff --git a/libs/flake/tools/KoCreateShapesTool.h b/libs/flake/tools/KoCreateShapesTool.h --- a/libs/flake/tools/KoCreateShapesTool.h +++ b/libs/flake/tools/KoCreateShapesTool.h @@ -39,6 +39,7 @@ */ class FLAKE_EXPORT KoCreateShapesTool : public KoInteractionTool { +Q_OBJECT public: /** * Create a new tool; typically not called by applications, only by the KoToolManager diff --git a/libs/flake/tools/KoPanTool.h b/libs/flake/tools/KoPanTool.h --- a/libs/flake/tools/KoPanTool.h +++ b/libs/flake/tools/KoPanTool.h @@ -33,6 +33,7 @@ */ class KoPanTool : public KoToolBase { +Q_OBJECT public: /** * Constructor. diff --git a/libs/flake/tools/KoPathSegmentChangeStrategy.cpp b/libs/flake/tools/KoPathSegmentChangeStrategy.cpp --- a/libs/flake/tools/KoPathSegmentChangeStrategy.cpp +++ b/libs/flake/tools/KoPathSegmentChangeStrategy.cpp @@ -82,7 +82,7 @@ m_segment.second()->point(), m_segmentParam); if (ipol.isValid()) { - move1 = move2 = ipol.controlPoints()[1] - m_segment.controlPoints()[1]; + move1 = move2 = ipol.controlPoints().at(1) - m_segment.controlPoints().at(1); } } else if (m_segment.degree() == 3) { diff --git a/libs/flake/tools/KoPathTool.cpp b/libs/flake/tools/KoPathTool.cpp --- a/libs/flake/tools/KoPathTool.cpp +++ b/libs/flake/tools/KoPathTool.cpp @@ -659,7 +659,7 @@ m_currentStrategy = 0; if (m_pointSelection.selectedShapes().count() == 1) - emit pathChanged(m_pointSelection.selectedShapes().first()); + emit pathChanged(m_pointSelection.selectedShapes().constFirst()); else emit pathChanged(0); } diff --git a/libs/flake/tools/KoZoomTool.h b/libs/flake/tools/KoZoomTool.h --- a/libs/flake/tools/KoZoomTool.h +++ b/libs/flake/tools/KoZoomTool.h @@ -32,6 +32,7 @@ /// \internal class KoZoomTool : public KoInteractionTool { +Q_OBJECT public: /** * Create a new tool; typically not called by applications, only by the KoToolManager diff --git a/libs/kundo2/kundo2stack.h b/libs/kundo2/kundo2stack.h --- a/libs/kundo2/kundo2stack.h +++ b/libs/kundo2/kundo2stack.h @@ -245,6 +245,7 @@ class KUNDO2_EXPORT KUndo2Stack : public KUndo2QStack { +Q_OBJECT public: explicit KUndo2Stack(QObject *parent = 0); diff --git a/libs/kundo2/kundo2stack.cpp b/libs/kundo2/kundo2stack.cpp --- a/libs/kundo2/kundo2stack.cpp +++ b/libs/kundo2/kundo2stack.cpp @@ -778,7 +778,7 @@ KUndo2Command* lastCmdInCurrent = curr; if (!lastcmd->mergeCommandsVector().isEmpty()) { - if (qAbs(lastcmd->mergeCommandsVector().last()->time().msecsTo(lastCmdInCurrent->endTime())) < int(m_timeT2 * 1000) && lastcmd != lastCmdInCurrent && lastcmd != curr) { + if (qAbs(lastcmd->mergeCommandsVector().constLast()->time().msecsTo(lastCmdInCurrent->endTime())) < int(m_timeT2 * 1000) && lastcmd != lastCmdInCurrent && lastcmd != curr) { if(lastcmd->timedMergeWith(curr)){ if (m_command_list.contains(curr)) { m_command_list.removeOne(curr); diff --git a/libs/pigment/KoColorConversionSystem.cpp b/libs/pigment/KoColorConversionSystem.cpp --- a/libs/pigment/KoColorConversionSystem.cpp +++ b/libs/pigment/KoColorConversionSystem.cpp @@ -360,7 +360,7 @@ QString KoColorConversionSystem::vertexToDot(KoColorConversionSystem::Vertex* v, const QString &options) const { - return QString(" \"%1\" -> \"%2\" %3\n").arg(v->srcNode->id()).arg(v->dstNode->id()).arg(options); + return QString(" \"%1\" -> \"%2\" %3\n").arg(v->srcNode->id(), v->dstNode->id(), options); } QString KoColorConversionSystem::toDot() const diff --git a/libs/pigment/KoColorDisplayRendererInterface.h b/libs/pigment/KoColorDisplayRendererInterface.h --- a/libs/pigment/KoColorDisplayRendererInterface.h +++ b/libs/pigment/KoColorDisplayRendererInterface.h @@ -94,6 +94,7 @@ */ class PIGMENTCMS_EXPORT KoDumbColorDisplayRenderer : public KoColorDisplayRendererInterface { +Q_OBJECT public: QColor toQColor(const KoColor &c) const; KoColor approximateFromRenderedQColor(const QColor &c) const; diff --git a/libs/pigment/KoColorSpace.cpp b/libs/pigment/KoColorSpace.cpp --- a/libs/pigment/KoColorSpace.cpp +++ b/libs/pigment/KoColorSpace.cpp @@ -118,7 +118,7 @@ qreal max = 1.0; if ((colorModelId().id()=="CMYKA" || colorModelId().id()=="LABA") && colorDepthId().id()=="F32") { //boundaries for cmyka/laba have trouble getting the max values for Float, and are pretty awkward in general. - max = this->channels()[0]->getUIMax(); + max = this->channels().at(0)->getUIMax(); } int samples = 5;//amount of samples in our color space. @@ -192,7 +192,7 @@ qreal max = 1.0; if ((colorModelId().id()=="CMYKA" || colorModelId().id()=="LABA") && colorDepthId().id()=="F32") { //boundaries for cmyka/laba have trouble getting the max values for Float, and are pretty awkward in general. - max = this->channels()[0]->getUIMax(); + max = this->channels().at(0)->getUIMax(); } QString name = KoColorSpaceRegistry::instance()->colorSpaceFactory("XYZAF16")->defaultProfile(); const KoColorSpace* xyzColorSpace = KoColorSpaceRegistry::instance()->colorSpace("XYZA", "F16", name); diff --git a/libs/pigment/KoColorSpaceAbstract.h b/libs/pigment/KoColorSpaceAbstract.h --- a/libs/pigment/KoColorSpaceAbstract.h +++ b/libs/pigment/KoColorSpaceAbstract.h @@ -166,7 +166,7 @@ if (scaleOnly && dynamic_cast(dstColorSpace)) { typedef typename _CSTrait::channels_type channels_type; - switch(dstColorSpace->channels()[0]->channelValueType()) + switch(dstColorSpace->channels().at(0)->channelValueType()) { case KoChannelInfo::UINT8: scalePixels<_CSTrait::pixelSize, 1, channels_type, quint8>(src, dst, numPixels); diff --git a/libs/pigment/KoCompositeOpRegistry.h b/libs/pigment/KoCompositeOpRegistry.h --- a/libs/pigment/KoCompositeOpRegistry.h +++ b/libs/pigment/KoCompositeOpRegistry.h @@ -20,6 +20,8 @@ #ifndef KOCOMPOSITEOPREGISTRY_H #define KOCOMPOSITEOPREGISTRY_H +// clazy:excludeall=non-pod-global-static + #include #include #include diff --git a/libs/pigment/colorspaces/KoAlphaColorSpace.cpp b/libs/pigment/colorspaces/KoAlphaColorSpace.cpp --- a/libs/pigment/colorspaces/KoAlphaColorSpace.cpp +++ b/libs/pigment/colorspaces/KoAlphaColorSpace.cpp @@ -306,7 +306,7 @@ QString KoAlphaColorSpace::channelValueText(const quint8 *pixel, quint32 channelIndex) const { Q_ASSERT(channelIndex < channelCount()); - quint32 channelPosition = channels()[channelIndex]->pos(); + quint32 channelPosition = channels().at(channelIndex)->pos(); return QString().setNum(pixel[channelPosition]); } @@ -314,7 +314,7 @@ QString KoAlphaColorSpace::normalisedChannelValueText(const quint8 *pixel, quint32 channelIndex) const { Q_ASSERT(channelIndex < channelCount()); - quint32 channelPosition = channels()[channelIndex]->pos(); + quint32 channelPosition = channels().at(channelIndex)->pos(); return QString().setNum(static_cast(pixel[channelPosition]) / UINT8_MAX); } diff --git a/libs/pigment/tests/CCSGraph.cpp b/libs/pigment/tests/CCSGraph.cpp --- a/libs/pigment/tests/CCSGraph.cpp +++ b/libs/pigment/tests/CCSGraph.cpp @@ -63,7 +63,7 @@ parser.showHelp(); exit(EXIT_FAILURE); } - QString outputFileName = parser.positionalArguments()[0]; + QString outputFileName = parser.positionalArguments().at(0); // Generate the graph QString dot; @@ -96,7 +96,7 @@ } QTextStream out(&file); out << dot; - QString cmd = QString("dot -T%1 %2 -o %3").arg(outputType).arg(file.fileName()).arg(outputFileName); + QString cmd = QString("dot -T%1 %2 -o %3").arg(outputType, file.fileName(), outputFileName); file.close(); if (QProcess::execute(cmd) != 0) { diff --git a/libs/pigment/tests/TestColorConversionSystem.cpp b/libs/pigment/tests/TestColorConversionSystem.cpp --- a/libs/pigment/tests/TestColorConversionSystem.cpp +++ b/libs/pigment/tests/TestColorConversionSystem.cpp @@ -56,8 +56,9 @@ for (int i = 0; i < listModels.count(); ++i) { const ModelDepthProfile& srcCS = listModels[i]; - for (const ModelDepthProfile& dstCS : listModels) { - QByteArray name = QString("Path: %1/%2 to %3/%4").arg(srcCS.model).arg(srcCS.depth).arg(dstCS.model).arg(dstCS.depth).toLocal8Bit(); + for (int j = 0; j < listModels.size(); ++j) { + const ModelDepthProfile& dstCS = listModels.at(j); + QByteArray name = QString("Path: %1/%2 to %3/%4").arg(srcCS.model, srcCS.depth, dstCS.model, dstCS.depth).toLocal8Bit(); QTest::newRow(name) << srcCS.model << srcCS.depth << srcCS.profile << dstCS.model << dstCS.depth << dstCS.profile << true; } } @@ -88,8 +89,9 @@ for (int i = 0; i < listModels.count(); ++i) { const ModelDepthProfile& srcCS = listModels[i]; - for (const ModelDepthProfile& dstCS : listModels) { - QByteArray name = QString("Path: %1/%2 to %3/%4").arg(srcCS.model).arg(srcCS.depth).arg(dstCS.model).arg(dstCS.depth).toLocal8Bit(); + for (int j = 0; j < listModels.size(); ++j) { + const ModelDepthProfile& dstCS = listModels.at(j); + QByteArray name = QString("Path: %1/%2 to %3/%4").arg(srcCS.model, srcCS.depth, dstCS.model, dstCS.depth).toLocal8Bit(); QTest::newRow(name) << srcCS.model << srcCS.depth << srcCS.profile << dstCS.model << dstCS.depth << dstCS.profile << true; } } diff --git a/libs/pigment/tests/TestFallBackColorTransformation.cpp b/libs/pigment/tests/TestFallBackColorTransformation.cpp --- a/libs/pigment/tests/TestFallBackColorTransformation.cpp +++ b/libs/pigment/tests/TestFallBackColorTransformation.cpp @@ -44,7 +44,7 @@ KoColorSpaceRegistry::instance()->rgb16(), dummy); QCOMPARE(fallback->parameters().size(), 1); - QCOMPARE(fallback->parameters()[0], QString("test")); + QCOMPARE(fallback->parameters().at(0), QString("test")); QCOMPARE(fallback->parameterId("test"), 1); QCOMPARE(fallback->parameterId("other"), 0); fallback->setParameter(0, -1); diff --git a/libs/pigment/tests/TestKoColor.cpp b/libs/pigment/tests/TestKoColor.cpp --- a/libs/pigment/tests/TestKoColor.cpp +++ b/libs/pigment/tests/TestKoColor.cpp @@ -52,10 +52,10 @@ KoColor kcu = KoColor::fromXML(elt.firstChildElement(), depthId.id(), QHash()); QVERIFY2(*(kc.colorSpace()) == *(kcu.colorSpace()), QString("Not identical color space (colorModelId = %1 depthId = %2) != (colorModelId = %3 depthId = %4) ") - .arg(kc.colorSpace()->colorModelId().id()) - .arg(kc.colorSpace()->colorDepthId().id()) - .arg(kcu.colorSpace()->colorModelId().id()) - .arg(kcu.colorSpace()->colorDepthId().id()).toLatin1()); + .arg(kc.colorSpace()->colorModelId().id(), + kc.colorSpace()->colorDepthId().id(), + kcu.colorSpace()->colorModelId().id(), + kcu.colorSpace()->colorDepthId().id()).toLatin1()); QVERIFY(cs->difference(kcu.data(), kc.data()) <= 1); } } diff --git a/libs/plugin/KoPluginLoader.cpp b/libs/plugin/KoPluginLoader.cpp --- a/libs/plugin/KoPluginLoader.cpp +++ b/libs/plugin/KoPluginLoader.cpp @@ -48,6 +48,7 @@ class KoPluginLoaderImpl : public QObject { +Q_OBJECT public: QStringList loadedDirectories; }; @@ -206,3 +207,4 @@ return list; } +#include "KoPluginLoader.moc" diff --git a/libs/text/BibliographyGenerator.cpp b/libs/text/BibliographyGenerator.cpp --- a/libs/text/BibliographyGenerator.cpp +++ b/libs/text/BibliographyGenerator.cpp @@ -119,7 +119,7 @@ { KoParagraphStyle *bibTemplateStyle = 0; BibliographyEntryTemplate bibEntryTemplate; - if (m_bibInfo->m_entryTemplate.keys().contains(cite->bibliographyType())) { + if (m_bibInfo->m_entryTemplate.contains(cite->bibliographyType())) { bibEntryTemplate = m_bibInfo->m_entryTemplate[cite->bibliographyType()]; diff --git a/libs/text/InsertNamedVariableAction_p.h b/libs/text/InsertNamedVariableAction_p.h --- a/libs/text/InsertNamedVariableAction_p.h +++ b/libs/text/InsertNamedVariableAction_p.h @@ -29,6 +29,7 @@ */ class InsertNamedVariableAction : public InsertInlineObjectActionBase { +Q_OBJECT public: InsertNamedVariableAction(KoCanvasBase *canvas, const KoInlineTextObjectManager *manager, const QString &name); diff --git a/libs/text/InsertTextLocator_p.h b/libs/text/InsertTextLocator_p.h --- a/libs/text/InsertTextLocator_p.h +++ b/libs/text/InsertTextLocator_p.h @@ -27,6 +27,7 @@ */ class InsertTextLocator : public InsertInlineObjectActionBase { +Q_OBJECT public: explicit InsertTextLocator(KoCanvasBase *canvas); diff --git a/libs/text/InsertTextReferenceAction_p.h b/libs/text/InsertTextReferenceAction_p.h --- a/libs/text/InsertTextReferenceAction_p.h +++ b/libs/text/InsertTextReferenceAction_p.h @@ -29,6 +29,7 @@ */ class InsertTextReferenceAction : public InsertInlineObjectActionBase { +Q_OBJECT public: InsertTextReferenceAction(KoCanvasBase *canvas, const KoInlineTextObjectManager *manager); diff --git a/libs/text/InsertVariableAction_p.h b/libs/text/InsertVariableAction_p.h --- a/libs/text/InsertVariableAction_p.h +++ b/libs/text/InsertVariableAction_p.h @@ -29,6 +29,7 @@ /// \internal class InsertVariableAction : public InsertInlineObjectActionBase { +Q_OBJECT public: InsertVariableAction(KoCanvasBase *base, KoInlineObjectFactoryBase *factory, const KoInlineObjectTemplate &templ); diff --git a/libs/text/KoBibliographyInfo.cpp b/libs/text/KoBibliographyInfo.cpp --- a/libs/text/KoBibliographyInfo.cpp +++ b/libs/text/KoBibliographyInfo.cpp @@ -43,7 +43,7 @@ KoBibliographyInfo::~KoBibliographyInfo() { - foreach (const BibliographyEntryTemplate &entryTemplate, m_entryTemplate.values()) { + foreach (const BibliographyEntryTemplate &entryTemplate, m_entryTemplate) { qDeleteAll(entryTemplate.indexEntries); } delete m_generator; @@ -119,7 +119,7 @@ m_indexTitleTemplate.saveOdf(writer); - foreach (const BibliographyEntryTemplate &entry, m_entryTemplate.values()) { + foreach (const BibliographyEntryTemplate &entry, m_entryTemplate) { entry.saveOdf(writer); } diff --git a/libs/text/KoFindStrategy.cpp b/libs/text/KoFindStrategy.cpp --- a/libs/text/KoFindStrategy.cpp +++ b/libs/text/KoFindStrategy.cpp @@ -28,6 +28,7 @@ class NonClosingFindDialog : public KFindDialog { +Q_OBJECT public: NonClosingFindDialog(QWidget *parent) : KFindDialog(parent) {} @@ -70,3 +71,4 @@ findDirection->select(cursor); return false; } +#include "KoFindStrategy.moc" diff --git a/libs/text/KoInlineCite.cpp b/libs/text/KoInlineCite.cpp --- a/libs/text/KoInlineCite.cpp +++ b/libs/text/KoInlineCite.cpp @@ -573,13 +573,13 @@ KoOdfBibliographyConfiguration *bibConfiguration = KoTextDocument(document).styleManager()->bibliographyConfiguration(); if (!bibConfiguration->numberedEntries()) { - d->label = QString("%1%2%3").arg(bibConfiguration->prefix()) - .arg(d->identifier) - .arg(bibConfiguration->suffix()); + d->label = QString("%1%2%3").arg(bibConfiguration->prefix(), + d->identifier, + bibConfiguration->suffix()); } else { - d->label = QString("%1%2%3").arg(bibConfiguration->prefix()) - .arg(QString::number(manager()->citationsSortedByPosition(true).indexOf(this) + 1)) - .arg(bibConfiguration->suffix()); + d->label = QString("%1%2%3").arg(bibConfiguration->prefix(), + QString::number(manager()->citationsSortedByPosition(true).indexOf(this) + 1), + bibConfiguration->suffix()); } Q_ASSERT(format.isCharFormat()); @@ -601,13 +601,13 @@ KoOdfBibliographyConfiguration *bibConfiguration = KoTextDocument(document).styleManager()->bibliographyConfiguration(); if (!bibConfiguration->numberedEntries()) { - d->label = QString("%1%2%3").arg(bibConfiguration->prefix()) - .arg(d->identifier) - .arg(bibConfiguration->suffix()); + d->label = QString("%1%2%3").arg(bibConfiguration->prefix(), + d->identifier, + bibConfiguration->suffix()); } else { - d->label = QString("%1%2%3").arg(bibConfiguration->prefix()) - .arg(QString::number(manager()->citationsSortedByPosition(true, document->firstBlock()).indexOf(this) + 1)) - .arg(bibConfiguration->suffix()); + d->label = QString("%1%2%3").arg(bibConfiguration->prefix(), + QString::number(manager()->citationsSortedByPosition(true, document->firstBlock()).indexOf(this) + 1), + bibConfiguration->suffix()); } QFont font(format.font(), pd); diff --git a/libs/text/KoNamedVariable.h b/libs/text/KoNamedVariable.h --- a/libs/text/KoNamedVariable.h +++ b/libs/text/KoNamedVariable.h @@ -28,6 +28,7 @@ */ class KoNamedVariable : public KoVariable { +Q_OBJECT public: /// return the name of this named variable QString name() const { diff --git a/libs/text/KoSectionModel.cpp b/libs/text/KoSectionModel.cpp --- a/libs/text/KoSectionModel.cpp +++ b/libs/text/KoSectionModel.cpp @@ -134,7 +134,7 @@ } KoSection *parent = static_cast(parentIdx.internalPointer()); - return createIndex(row, column, parent->children()[row]); + return createIndex(row, column, parent->children().at(row)); } QModelIndex KoSectionModel::parent(const QModelIndex &child) const diff --git a/libs/text/KoTextDebug.cpp b/libs/text/KoTextDebug.cpp --- a/libs/text/KoTextDebug.cpp +++ b/libs/text/KoTextDebug.cpp @@ -59,7 +59,6 @@ QStringList fontProps; // add only font properties here foreach(int id, properties.keys()) { - QString key, value; switch (id) { case QTextFormat::FontFamily: fontProps.append(properties[id].toString()); diff --git a/libs/text/KoTextEditor.cpp b/libs/text/KoTextEditor.cpp --- a/libs/text/KoTextEditor.cpp +++ b/libs/text/KoTextEditor.cpp @@ -532,7 +532,7 @@ QTextBlock block = d->caret.block(); if (d->caret.position() >= block.position() + block.length() - 1) return 0; // can't insert one at end of text - if (block.text()[ d->caret.position() - block.position()].isSpace()) + if (block.text().at( d->caret.position() - block.position()).isSpace()) return 0; // can't insert one on a whitespace as that does not indicate a word. KoTextLocator *tl = new KoTextLocator(); diff --git a/libs/text/KoTextEditor_p.h b/libs/text/KoTextEditor_p.h --- a/libs/text/KoTextEditor_p.h +++ b/libs/text/KoTextEditor_p.h @@ -214,7 +214,7 @@ block = block.document()->findBlock(start); QList cursors; - QList formats; + QVector formats; // now loop over all blocks that the selection contains and alter the text fragments where applicable. while (block.isValid() && block.position() < end) { QTextBlock::iterator iter = block.begin(); @@ -253,7 +253,7 @@ } block = block.next(); } - QList::Iterator iter = formats.begin(); + QVector::Iterator iter = formats.begin(); foreach(QTextCursor cursor, cursors) { cursor.setCharFormat(*iter); ++iter; diff --git a/libs/text/KoTextReference.h b/libs/text/KoTextReference.h --- a/libs/text/KoTextReference.h +++ b/libs/text/KoTextReference.h @@ -33,6 +33,7 @@ */ class KoTextReference : public KoVariable { +Q_OBJECT public: /** * Constructor; please don't use directly as the KoInlineTextObjectManager will supply an action diff --git a/libs/text/KoTextTableTemplate.h b/libs/text/KoTextTableTemplate.h --- a/libs/text/KoTextTableTemplate.h +++ b/libs/text/KoTextTableTemplate.h @@ -31,6 +31,7 @@ class KOTEXT_EXPORT KoTextTableTemplate : public QObject { +Q_OBJECT public: enum Property { StyleId = 0, diff --git a/libs/text/OdfTextTrackStyles.h b/libs/text/OdfTextTrackStyles.h --- a/libs/text/OdfTextTrackStyles.h +++ b/libs/text/OdfTextTrackStyles.h @@ -52,7 +52,7 @@ static OdfTextTrackStyles *instance(KoStyleManager *manager); private: - static QMap instances; + static QHash instances; explicit OdfTextTrackStyles(KoStyleManager *manager); diff --git a/libs/text/OdfTextTrackStyles.cpp b/libs/text/OdfTextTrackStyles.cpp --- a/libs/text/OdfTextTrackStyles.cpp +++ b/libs/text/OdfTextTrackStyles.cpp @@ -27,7 +27,7 @@ #include "TextDebug.h" -QMap OdfTextTrackStyles::instances; +QHash OdfTextTrackStyles::instances; OdfTextTrackStyles *OdfTextTrackStyles::instance(KoStyleManager *manager) { diff --git a/libs/text/changetracker/KoChangeTracker.cpp b/libs/text/changetracker/KoChangeTracker.cpp --- a/libs/text/changetracker/KoChangeTracker.cpp +++ b/libs/text/changetracker/KoChangeTracker.cpp @@ -462,7 +462,7 @@ int KoChangeTracker::getDeletedChanges(QVector& deleteVector) const { int numAppendedItems = 0; - foreach (KoChangeTrackerElement *element, d->changes.values()) { + foreach (KoChangeTrackerElement *element, d->changes) { if(element->getChangeType() == KoGenChange::DeleteChange && !element->acceptedRejected()) { deleteVector << element; numAppendedItems++; diff --git a/libs/text/commands/DeleteTableColumnCommand.h b/libs/text/commands/DeleteTableColumnCommand.h --- a/libs/text/commands/DeleteTableColumnCommand.h +++ b/libs/text/commands/DeleteTableColumnCommand.h @@ -43,7 +43,6 @@ QTextTable *m_table; int m_selectionColumn; int m_selectionColumnSpan; - int m_changeId; QVector m_deletedStyles; }; diff --git a/libs/text/opendocument/KoTextLoader.cpp b/libs/text/opendocument/KoTextLoader.cpp --- a/libs/text/opendocument/KoTextLoader.cpp +++ b/libs/text/opendocument/KoTextLoader.cpp @@ -719,7 +719,6 @@ KoXmlElement e; QList childElementsList; - QString generatedXmlString; KoXmlDocument doc; QXmlStreamReader reader; @@ -1268,7 +1267,6 @@ QVector spanStore; //temporary list to store spans until the entire table have been created KoXmlElement tblTag; int headingRowCounter = 0; - QList rowTags; forEachElement(tblTag, tableElem) { if (! tblTag.isNull()) { diff --git a/libs/text/opendocument/KoTextWriter_p.cpp b/libs/text/opendocument/KoTextWriter_p.cpp --- a/libs/text/opendocument/KoTextWriter_p.cpp +++ b/libs/text/opendocument/KoTextWriter_p.cpp @@ -398,8 +398,8 @@ xmlReader.setContent(rdfXmlData.data(), true); KoXmlElement mainElement = xmlReader.documentElement(); foreach (const Attribute &attributeNameNS, mainElement.attributeFullNames()) { - QString attributeName = QString("%1:%2").arg(KoXmlNS::nsURI2NS(attributeNameNS.first)) - .arg(attributeNameNS.second); + QString attributeName = QString("%1:%2").arg(KoXmlNS::nsURI2NS(attributeNameNS.first), + attributeNameNS.second); if (attributeName.startsWith(':')) attributeName.prepend("xml"); tagInfos->addAttribute(attributeName, mainElement.attribute(attributeNameNS.second)); @@ -530,7 +530,7 @@ KoInlineObject *inlineObject = textObjectManager ? textObjectManager->inlineTextObject(charFormat) : 0; // If we are in an inline object if (currentFragment.length() == 1 && inlineObject - && currentFragment.text()[0].unicode() == QChar::ObjectReplacementCharacter) { + && currentFragment.text().at(0).unicode() == QChar::ObjectReplacementCharacter) { bool saveInlineObject = true; if (KoTextMeta* z = dynamic_cast(inlineObject)) { diff --git a/libs/text/styles/KoCharacterStyle.cpp b/libs/text/styles/KoCharacterStyle.cpp --- a/libs/text/styles/KoCharacterStyle.cpp +++ b/libs/text/styles/KoCharacterStyle.cpp @@ -658,7 +658,7 @@ lineWeight = KoCharacterStyle::ThickLineWeight; else if (width.endsWith('%')) { lineWeight = KoCharacterStyle::PercentLineWeight; - lineWidth = width.mid(0, width.length() - 1).toDouble(); + lineWidth = width.midRef(0, width.length() - 1).toDouble(); } else if (width[width.length()-1].isNumber()) { lineWeight = KoCharacterStyle::LengthLineWeight; lineWidth = width.toDouble(); @@ -1506,7 +1506,7 @@ const QString fontSize(styleStack.property(KoXmlNS::fo, "font-size")); if (!fontSize.isEmpty()) { if (fontSize.endsWith('%')) { - setPercentageFontSize(fontSize.left(fontSize.length() - 1).toDouble()); + setPercentageFontSize(fontSize.leftRef(fontSize.length() - 1).toDouble()); } else { setFontPointSize(KoUnit::parseValue(fontSize)); } @@ -1693,7 +1693,7 @@ else { QRegExp re("(-?[\\d.]+)%.*"); if (re.exactMatch(textPosition)) { - int percent = re.capturedTexts()[1].toInt(); + int percent = re.capturedTexts().at(1).toInt(); if (percent > 0) setVerticalAlignment(QTextCharFormat::AlignSuperScript); else if (percent < 0) diff --git a/libs/text/styles/KoParagraphStyle.cpp b/libs/text/styles/KoParagraphStyle.cpp --- a/libs/text/styles/KoParagraphStyle.cpp +++ b/libs/text/styles/KoParagraphStyle.cpp @@ -1574,7 +1574,7 @@ tab.leaderWeight = KoCharacterStyle::ThickLineWeight; else if (width.endsWith('%')) { tab.leaderWeight = KoCharacterStyle::PercentLineWeight; - tab.leaderWidth = width.mid(0, width.length() - 1).toDouble(); + tab.leaderWidth = width.midRef(0, width.length() - 1).toDouble(); } else if (width[width.length()-1].isNumber()) { tab.leaderWeight = KoCharacterStyle::PercentLineWeight; tab.leaderWidth = 100 * width.toDouble(); diff --git a/libs/text/styles/tests/TestStyles.cpp b/libs/text/styles/tests/TestStyles.cpp --- a/libs/text/styles/tests/TestStyles.cpp +++ b/libs/text/styles/tests/TestStyles.cpp @@ -109,8 +109,8 @@ paragStyle.setTabPositions(tabs); QCOMPARE(paragStyle.tabPositions().count(), 2); - QCOMPARE(paragStyle.tabPositions()[0], tab); - QCOMPARE(paragStyle.tabPositions()[1], tab2); + QCOMPARE(paragStyle.tabPositions().at(0), tab); + QCOMPARE(paragStyle.tabPositions().at(1), tab2); } void TestStyles::testApplyParagraphStyle() diff --git a/libs/text/tests/TestKoInlineTextObjectManager.h b/libs/text/tests/TestKoInlineTextObjectManager.h --- a/libs/text/tests/TestKoInlineTextObjectManager.h +++ b/libs/text/tests/TestKoInlineTextObjectManager.h @@ -36,6 +36,7 @@ class DummyInlineObject : public KoInlineObject { +Q_OBJECT public: DummyInlineObject(bool propertyListener) diff --git a/libs/text/tests/TestKoTextEditor.cpp b/libs/text/tests/TestKoTextEditor.cpp --- a/libs/text/tests/TestKoTextEditor.cpp +++ b/libs/text/tests/TestKoTextEditor.cpp @@ -378,9 +378,7 @@ sectionStack.push(handle); } - foreach(KoSectionEnd *secEnd, secEndings) { - sectionStack.pop(); - } + sectionStack.resize(sectionStack.size() - secEndings.size()); curBlock = curBlock.next(); } diff --git a/libs/textlayout/KoTextDocumentLayout.cpp b/libs/textlayout/KoTextDocumentLayout.cpp --- a/libs/textlayout/KoTextDocumentLayout.cpp +++ b/libs/textlayout/KoTextDocumentLayout.cpp @@ -570,7 +570,7 @@ } QHash ranges = textRangeManager()->textRangesChangingWithin(effectiveDocument, pos, pos+length, pos, pos+length); - foreach(KoTextRange *range, ranges.values()) { + foreach(KoTextRange *range, ranges) { KoAnchorTextRange *anchorRange = dynamic_cast(range); if (anchorRange) { // We need some special treatment for anchors as they need to position their object during diff --git a/libs/textlayout/KoTextLayoutArea.cpp b/libs/textlayout/KoTextLayoutArea.cpp --- a/libs/textlayout/KoTextLayoutArea.cpp +++ b/libs/textlayout/KoTextLayoutArea.cpp @@ -283,7 +283,7 @@ xLeading = line.cursorToX(j, QTextLine::Leading); xTrailing = line.cursorToX(j, QTextLine::Trailing); QRectF rect(xLeading, line.y(), xTrailing-xLeading, line.height()); // TODO: at least height needs more work - result.append(KoCharAreaInfo(rect, block.text()[j])); + result.append(KoCharAreaInfo(rect, block.text().at(j))); } // TODO: perhaps only at end of paragraph (last qtextline) add linebreak, for in-paragraph linebreak diff --git a/libs/textlayout/KoTextShapeContainerModel.cpp b/libs/textlayout/KoTextShapeContainerModel.cpp --- a/libs/textlayout/KoTextShapeContainerModel.cpp +++ b/libs/textlayout/KoTextShapeContainerModel.cpp @@ -180,7 +180,6 @@ return; QPointF newPosition = child->position() + move/* + relation.anchor->offset()*/; - const QRectF parentShapeRect(QPointF(0, 0), child->parent()->size()); //warnTextLayout <<"proposeMove:" /*<< move <<" |"*/ << newPosition <<" |" << parentShapeRect; QTextLayout *layout = 0; diff --git a/libs/textlayout/tests/TestBlockLayout.cpp b/libs/textlayout/tests/TestBlockLayout.cpp --- a/libs/textlayout/tests/TestBlockLayout.cpp +++ b/libs/textlayout/tests/TestBlockLayout.cpp @@ -182,7 +182,6 @@ void TestBlockLayout::testFixedLineSpacing() { setupTest(QString("Line1")+QChar(0x2028)+"Line2"+QChar(0x2028)+"Line3"); - QTextCursor cursor(m_doc); KoParagraphStyle style; style.setFontPointSize(12.0); @@ -219,7 +218,6 @@ void TestBlockLayout::testPercentageLineSpacing() { setupTest(QString("Line1")+QChar(0x2028)+"Line2"+QChar(0x2028)+"Line3"); - QTextCursor cursor(m_doc); KoParagraphStyle style; style.setFontPointSize(12.0); @@ -252,7 +250,6 @@ void TestBlockLayout::testAdvancedLineSpacing() { setupTest("Line1\nLine2\nLine3\nLine4\nLine5\nLine6\nLine7"); - QTextCursor cursor(m_doc); KoParagraphStyle style; style.setFontPointSize(12.0); diff --git a/libs/widgets/CMakeLists.txt b/libs/widgets/CMakeLists.txt --- a/libs/widgets/CMakeLists.txt +++ b/libs/widgets/CMakeLists.txt @@ -79,6 +79,7 @@ KoToolBox.cpp KoToolBoxDocker.cpp KoToolBoxFactory.cpp + KoToolBoxLayout_p.cpp KoToolDocker.cpp KoModeBox.cpp diff --git a/libs/widgets/KoCsvImportDialog.cpp b/libs/widgets/KoCsvImportDialog.cpp --- a/libs/widgets/KoCsvImportDialog.cpp +++ b/libs/widgets/KoCsvImportDialog.cpp @@ -39,6 +39,7 @@ class KoCsvImportWidget : public QWidget, public Ui::KoCsvImportWidget { +Q_OBJECT public: explicit KoCsvImportWidget(QWidget* parent) : QWidget(parent) { setupUi(this); } }; @@ -281,7 +282,7 @@ void KoCsvImportDialog::Private::loadSettings() { KConfigGroup configGroup = KSharedConfig::openConfig()->group("CSVDialog Settings"); - textQuote = configGroup.readEntry("textQuote", "\"")[0]; + textQuote = configGroup.readEntry("textQuote", "\"").at(0); delimiter = configGroup.readEntry("delimiter", ","); ignoreDuplicates = configGroup.readEntry("ignoreDups", false); const QString codecText = configGroup.readEntry("codec", ""); @@ -782,3 +783,4 @@ d->fillTable(); } } +#include "KoCsvImportDialog.moc" diff --git a/libs/widgets/KoDocumentInfoDlg.cpp b/libs/widgets/KoDocumentInfoDlg.cpp --- a/libs/widgets/KoDocumentInfoDlg.cpp +++ b/libs/widgets/KoDocumentInfoDlg.cpp @@ -51,6 +51,7 @@ class KoPageWidgetItemAdapter : public KPageWidgetItem { +Q_OBJECT public: KoPageWidgetItemAdapter(KoPageWidgetItem *item) : KPageWidgetItem(item->widget(), item->name()) @@ -468,3 +469,4 @@ addPage(page); d->pages.append(page); } +#include "KoDocumentInfoDlg.moc" diff --git a/libs/widgets/KoIconToolTip.h b/libs/widgets/KoIconToolTip.h --- a/libs/widgets/KoIconToolTip.h +++ b/libs/widgets/KoIconToolTip.h @@ -25,7 +25,7 @@ class KoIconToolTip: public KoItemToolTip { - +Q_OBJECT public: KoIconToolTip() {} virtual ~KoIconToolTip() {} diff --git a/libs/widgets/KoLineStyleItemDelegate_p.h b/libs/widgets/KoLineStyleItemDelegate_p.h --- a/libs/widgets/KoLineStyleItemDelegate_p.h +++ b/libs/widgets/KoLineStyleItemDelegate_p.h @@ -24,6 +24,7 @@ /// The line style item delegate for rendering the styles class KoLineStyleItemDelegate : public QAbstractItemDelegate { +Q_OBJECT public: explicit KoLineStyleItemDelegate(QObject *parent = 0); ~KoLineStyleItemDelegate() {} diff --git a/libs/widgets/KoLineStyleModel_p.h b/libs/widgets/KoLineStyleModel_p.h --- a/libs/widgets/KoLineStyleModel_p.h +++ b/libs/widgets/KoLineStyleModel_p.h @@ -26,6 +26,7 @@ /// The line style model managing the style data class KoLineStyleModel : public QAbstractListModel { +Q_OBJECT public: explicit KoLineStyleModel(QObject *parent = 0); virtual ~KoLineStyleModel() {} diff --git a/libs/widgets/KoMarkerItemDelegate.h b/libs/widgets/KoMarkerItemDelegate.h --- a/libs/widgets/KoMarkerItemDelegate.h +++ b/libs/widgets/KoMarkerItemDelegate.h @@ -27,6 +27,7 @@ class KoMarkerItemDelegate : public QAbstractItemDelegate { +Q_OBJECT public: explicit KoMarkerItemDelegate(KoMarkerData::MarkerPosition position, QObject *parent = 0); virtual ~KoMarkerItemDelegate(); diff --git a/libs/widgets/KoMarkerModel.h b/libs/widgets/KoMarkerModel.h --- a/libs/widgets/KoMarkerModel.h +++ b/libs/widgets/KoMarkerModel.h @@ -27,6 +27,7 @@ class KoMarkerModel : public QAbstractListModel { +Q_OBJECT public: KoMarkerModel(const QList markers, KoMarkerData::MarkerPosition position, QObject *parent = 0); virtual ~KoMarkerModel(); diff --git a/libs/widgets/KoPositionSelector.cpp b/libs/widgets/KoPositionSelector.cpp --- a/libs/widgets/KoPositionSelector.cpp +++ b/libs/widgets/KoPositionSelector.cpp @@ -55,6 +55,7 @@ }; class RadioLayout : public QLayout { +Q_OBJECT public: RadioLayout(QWidget *parent) : QLayout(parent) @@ -231,3 +232,4 @@ painter.drawRect( QRect( d->topLeft->geometry().center(), d->bottomRight->geometry().center() ) ); painter.end(); } +#include "KoPositionSelector.moc" diff --git a/libs/widgets/KoResourceItemDelegate.h b/libs/widgets/KoResourceItemDelegate.h --- a/libs/widgets/KoResourceItemDelegate.h +++ b/libs/widgets/KoResourceItemDelegate.h @@ -26,6 +26,7 @@ /// The resource item delegate for rendering the resource preview class KoResourceItemDelegate : public QAbstractItemDelegate { +Q_OBJECT public: explicit KoResourceItemDelegate(QObject *parent = 0); virtual ~KoResourceItemDelegate() {} diff --git a/libs/widgets/KoResourcePopupAction.cpp b/libs/widgets/KoResourcePopupAction.cpp --- a/libs/widgets/KoResourcePopupAction.cpp +++ b/libs/widgets/KoResourcePopupAction.cpp @@ -111,7 +111,7 @@ * the only ones added are in KoResourcePopupAction constructor. */ int i = 0; while(d->menu->actions().size() > 0) { - d->menu->removeAction(d->menu->actions()[i]); + d->menu->removeAction(d->menu->actions().at(i)); ++i; } diff --git a/libs/widgets/KoResourceServerProvider.cpp b/libs/widgets/KoResourceServerProvider.cpp --- a/libs/widgets/KoResourceServerProvider.cpp +++ b/libs/widgets/KoResourceServerProvider.cpp @@ -173,7 +173,7 @@ KoResourcePaths::addResourceDir("ko_palettes", QDir::homePath() + QString("/.create/swatches")); d->patternServer = new KoResourceServerSimpleConstruction("ko_patterns", "*.pat:*.jpg:*.gif:*.png:*.tif:*.xpm:*.bmp" ); - if (!QFileInfo(d->patternServer->saveLocation()).exists()) { + if (!QFileInfo::exists(d->patternServer->saveLocation())) { QDir().mkpath(d->patternServer->saveLocation()); } @@ -184,7 +184,7 @@ } d->gradientServer = new GradientResourceServer("ko_gradients", "*.kgr:*.svg:*.ggr"); - if (!QFileInfo(d->gradientServer->saveLocation()).exists()) { + if (!QFileInfo::exists(d->gradientServer->saveLocation())) { QDir().mkpath(d->gradientServer->saveLocation()); } @@ -195,7 +195,7 @@ } d->paletteServer = new KoResourceServerSimpleConstruction("ko_palettes", "*.gpl:*.pal:*.act:*.aco:*.css:*.colors"); - if (!QFileInfo(d->paletteServer->saveLocation()).exists()) { + if (!QFileInfo::exists(d->paletteServer->saveLocation())) { QDir().mkpath(d->paletteServer->saveLocation()); } diff --git a/libs/widgets/KoRuler_p.h b/libs/widgets/KoRuler_p.h --- a/libs/widgets/KoRuler_p.h +++ b/libs/widgets/KoRuler_p.h @@ -23,6 +23,7 @@ class RulerTabChooser : public QWidget { +Q_OBJECT public: RulerTabChooser(QWidget *parent) : QWidget(parent), m_type(QTextOption::LeftTab), m_showTabs(false) {} virtual ~RulerTabChooser() {} diff --git a/libs/widgets/KoSliderCombo.cpp b/libs/widgets/KoSliderCombo.cpp --- a/libs/widgets/KoSliderCombo.cpp +++ b/libs/widgets/KoSliderCombo.cpp @@ -287,5 +287,21 @@ emit valueChanged(value, true); } +KoSliderComboContainer::~KoSliderComboContainer() {} + +void KoSliderComboContainer::mousePressEvent(QMouseEvent *e) +{ + QStyleOptionComboBox opt; + opt.init(m_parent); + opt.subControls = QStyle::SC_All; + opt.activeSubControls = QStyle::SC_ComboBoxArrow; + QStyle::SubControl sc = style()->hitTestComplexControl(QStyle::CC_ComboBox, &opt, + m_parent->mapFromGlobal(e->globalPos()), + m_parent); + if (sc == QStyle::SC_ComboBoxArrow) + setAttribute(Qt::WA_NoMouseReplay); + QMenu::mousePressEvent(e); +} + //have to include this because of Q_PRIVATE_SLOT #include diff --git a/libs/widgets/KoSliderCombo_p.h b/libs/widgets/KoSliderCombo_p.h --- a/libs/widgets/KoSliderCombo_p.h +++ b/libs/widgets/KoSliderCombo_p.h @@ -42,29 +42,16 @@ class KoSliderComboContainer : public QMenu { +Q_OBJECT public: KoSliderComboContainer(KoSliderCombo *parent) : QMenu(parent ), m_parent(parent) {} - + ~KoSliderComboContainer(); protected: virtual void mousePressEvent(QMouseEvent *e); private: KoSliderCombo *m_parent; }; -void KoSliderComboContainer::mousePressEvent(QMouseEvent *e) -{ - QStyleOptionComboBox opt; - opt.init(m_parent); - opt.subControls = QStyle::SC_All; - opt.activeSubControls = QStyle::SC_ComboBoxArrow; - QStyle::SubControl sc = style()->hitTestComplexControl(QStyle::CC_ComboBox, &opt, - m_parent->mapFromGlobal(e->globalPos()), - m_parent); - if (sc == QStyle::SC_ComboBoxArrow) - setAttribute(Qt::WA_NoMouseReplay); - QMenu::mousePressEvent(e); -} - class Q_DECL_HIDDEN KoSliderCombo::KoSliderComboPrivate { public: KoSliderCombo *thePublic; diff --git a/libs/widgets/KoStrokeConfigWidget.cpp b/libs/widgets/KoStrokeConfigWidget.cpp --- a/libs/widgets/KoStrokeConfigWidget.cpp +++ b/libs/widgets/KoStrokeConfigWidget.cpp @@ -68,6 +68,7 @@ class CapNJoinMenu : public QMenu { +Q_OBJECT public: CapNJoinMenu(QWidget *parent = 0); virtual QSize sizeHint() const; @@ -547,3 +548,4 @@ break; } } +#include "KoStrokeConfigWidget.moc" diff --git a/libs/widgets/KoToolBox.cpp b/libs/widgets/KoToolBox.cpp --- a/libs/widgets/KoToolBox.cpp +++ b/libs/widgets/KoToolBox.cpp @@ -135,7 +135,7 @@ KConfigGroup cfg = KSharedConfig::openConfig()->group("KoToolBox"); int iconSize = cfg.readEntry("iconSize", toolbuttonSize); button->setIconSize(QSize(iconSize, iconSize)); - foreach (Section *section, d->sections.values()) { + foreach (Section *section, d->sections) { section->setButtonSize(QSize(iconSize + BUTTON_MARGIN, iconSize + BUTTON_MARGIN)); } @@ -309,7 +309,7 @@ button->setIconSize(QSize(iconSize, iconSize)); } - foreach(Section *section, d->sections.values()) { + foreach(Section *section, d->sections) { section->setButtonSize(QSize(iconSize + BUTTON_MARGIN, iconSize + BUTTON_MARGIN)); } diff --git a/libs/widgets/KoToolBoxLayout_p.h b/libs/widgets/KoToolBoxLayout_p.h --- a/libs/widgets/KoToolBoxLayout_p.h +++ b/libs/widgets/KoToolBoxLayout_p.h @@ -31,6 +31,7 @@ class SectionLayout : public QLayout { +Q_OBJECT public: explicit SectionLayout(QWidget *parent) : QLayout(parent), m_orientation(Qt::Vertical) @@ -129,6 +130,7 @@ class Section : public QWidget { +Q_OBJECT public: enum SeparatorFlag { SeparatorTop = 0x0001,/* SeparatorBottom = 0x0002, SeparatorRight = 0x0004,*/ SeparatorLeft = 0x0008 @@ -201,18 +203,14 @@ class KoToolBoxLayout : public QLayout { +Q_OBJECT public: explicit KoToolBoxLayout(QWidget *parent) : QLayout(parent), m_orientation(Qt::Vertical), m_currentHeight(0) { setSpacing(6); } - - ~KoToolBoxLayout() - { - qDeleteAll( m_sections ); - m_sections.clear(); - } + ~KoToolBoxLayout(); QSize sizeHint() const { diff --git a/libs/widgets/KoToolBoxLayout_p.cpp b/libs/widgets/KoToolBoxLayout_p.cpp new file mode 100644 --- /dev/null +++ b/libs/widgets/KoToolBoxLayout_p.cpp @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2005-2009 Thomas Zander + * Copyright (c) 2009 Peter Simonsson + * Copyright (c) 2010 Cyrille Berger + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ +#include "KoToolBoxLayout_p.h" + +KoToolBoxLayout::~KoToolBoxLayout() +{ + qDeleteAll( m_sections ); + m_sections.clear(); +} diff --git a/libs/widgets/KoTriangleColorSelector.cpp b/libs/widgets/KoTriangleColorSelector.cpp --- a/libs/widgets/KoTriangleColorSelector.cpp +++ b/libs/widgets/KoTriangleColorSelector.cpp @@ -280,7 +280,7 @@ void KoTriangleColorSelector::tellColorChanged() { d->updateAllowed = false; - emit(colorChanged(color())); + emit colorChanged(color()); d->updateAllowed = true; } diff --git a/libs/widgets/tests/KoProgressUpdater_test.cpp b/libs/widgets/tests/KoProgressUpdater_test.cpp --- a/libs/widgets/tests/KoProgressUpdater_test.cpp +++ b/libs/widgets/tests/KoProgressUpdater_test.cpp @@ -63,7 +63,7 @@ class TestJob : public QThread { - +Q_OBJECT public: TestJob( QPointer updater, int steps = 10 ) @@ -286,3 +286,4 @@ } QTEST_GUILESS_MAIN(KoProgressUpdaterTest) +#include "KoProgressUpdater_test.moc" diff --git a/libs/widgets/tests/KoResourceTaggingTest.cpp b/libs/widgets/tests/KoResourceTaggingTest.cpp --- a/libs/widgets/tests/KoResourceTaggingTest.cpp +++ b/libs/widgets/tests/KoResourceTaggingTest.cpp @@ -49,7 +49,7 @@ { KoResourceServer* patServer = KoResourceServerProvider::instance()->patternServer(); KoResourceTagStore tagStore(patServer); - KoResource *res = patServer->resources().first(); + KoResource *res = patServer->resources().constFirst(); QVERIFY(res); QVERIFY(patServer->resourceByFilename(res->shortFilename()) == res); diff --git a/libs/widgets/tests/zoomhandler_test.cpp b/libs/widgets/tests/zoomhandler_test.cpp --- a/libs/widgets/tests/zoomhandler_test.cpp +++ b/libs/widgets/tests/zoomhandler_test.cpp @@ -27,14 +27,6 @@ #include "KoDpi.h" #include "KoUnit.h" -// Same as qfuzzycompare, but less precise because KoZoomHandler is a -// bit messy itself. -static inline bool fuzzyCompare(qreal p1, qreal p2) -{ - return qAbs(p1 - p2) < 0.0000001; -} - - void zoomhandler_test::testConstruction() { diff --git a/libs/widgetutils/KoGroupButton.h b/libs/widgetutils/KoGroupButton.h --- a/libs/widgetutils/KoGroupButton.h +++ b/libs/widgetutils/KoGroupButton.h @@ -35,8 +35,6 @@ class KOWIDGETUTILS_EXPORT KoGroupButton : public QToolButton { Q_OBJECT - Q_ENUMS( GroupPosition ) - Q_PROPERTY( GroupPosition groupPosition READ groupPosition WRITE setGroupPosition ) public: /** * Position of the button within the button group what affects the appearance. @@ -47,6 +45,10 @@ GroupRight, //!< The button is at the right of the group, so it would have rounded the right part GroupCenter //!< The button is on the center of the group, so it would have separators on both sides }; +private: + Q_ENUM( GroupPosition ) + Q_PROPERTY( GroupPosition groupPosition READ groupPosition WRITE setGroupPosition ) +public: explicit KoGroupButton(GroupPosition position, QWidget* parent = 0); diff --git a/libs/widgetutils/KoGroupButton.cpp b/libs/widgetutils/KoGroupButton.cpp --- a/libs/widgetutils/KoGroupButton.cpp +++ b/libs/widgetutils/KoGroupButton.cpp @@ -138,7 +138,7 @@ // messages so that translators can use Transcript for custom removal. // """ if (!actions().isEmpty()) { - QAction* action = actions().first(); + QAction* action = actions().constFirst(); setToolTip(i18nc("@info:tooltip of custom triple button", "%1", action->toolTip())); } } diff --git a/libs/widgetutils/KoProperties.cpp b/libs/widgetutils/KoProperties.cpp --- a/libs/widgetutils/KoProperties.cpp +++ b/libs/widgetutils/KoProperties.cpp @@ -69,7 +69,6 @@ if (!e.isNull()) { if (e.tagName() == "property") { const QString name = e.attribute("name"); - const QString type = e.attribute("type"); const QString value = e.text(); QDataStream in(QByteArray::fromBase64(value.toLatin1())); QVariant v; @@ -195,8 +194,10 @@ { if (d->properties.count() != other.d->properties.count()) return false; - foreach(const QString & key, d->properties.keys()) { - if (other.d->properties.value(key) != d->properties.value(key)) + QMapIterator i(d->properties); + while (i.hasNext()) { + i.next(); + if (other.d->properties.value(i.key()) != i.value()) return false; } return true;