diff --git a/examples/DesignerWidget.h b/examples/DesignerWidget.h index a44fb1c6..e26e06e9 100644 --- a/examples/DesignerWidget.h +++ b/examples/DesignerWidget.h @@ -1,80 +1,80 @@ /* This file is part of the KDE project Copyright (C) 2015 by Adam Pigg 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.1 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. */ #ifndef KREPORTDESIGNERWIDGET_H #define KREPORTDESIGNERWIDGET_H #include #include #include #include #include #include class KReportDesigner; class QDomElement; class QMainWindow; class QScrollArea; //! KReportExample designer widget class ReportDesignerWidget : public QScrollArea { Q_OBJECT public: ReportDesignerWidget(QWidget *parent = nullptr); - ~ReportDesignerWidget(); + ~ReportDesignerWidget() override; //! Creates main toolbar for main window @a mainWindow //! @a mainWindow is required. To be called once. QToolBar* createMainToolBar(QMainWindow *mainWindow); //! Creates items toolbar for main window @a mainWindow //! @a mainWindow is required. To be called once. QToolBar* createItemsToolBar(QMainWindow *mainWindow); //! Creates a property editor dock widget for the main window @a mainWindow. //! The widget is added to the area @a area is it is not Qt::NoDockWidgetArea. //! @a mainWindow is required. To be called once. QDockWidget* createPropertyEditorDockWidget(QMainWindow *mainWindow, Qt::DockWidgetArea area = Qt::NoDockWidgetArea); //! @return current document QDomElement document() const; Q_SIGNALS: void designChanged(const QDomElement&); private Q_SLOTS: void slotItemInserted(const QString &itemId); void slotDesignerPropertySetChanged(); void designDirty(); private: KReportDesigner *m_reportDesigner; QPointer m_mainToolBar; QPointer m_itemToolBar; QPointer m_propertyDock; QPointer m_propertyEditor; }; #endif // KREPORTDESIGNERWIDGET_H diff --git a/examples/KReportExampleDataSource.h b/examples/KReportExampleDataSource.h index a0dc63fd..9c063254 100644 --- a/examples/KReportExampleDataSource.h +++ b/examples/KReportExampleDataSource.h @@ -1,71 +1,71 @@ /* This file is part of the KDE project Copyright (C) 2015 by Adam Pigg (adam@piggz.co.uk) 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.1 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. */ #ifndef KREPORTEXAMPLEDATA_H #define KREPORTEXAMPLEDATA_H #include #include #include #include class KReportExampleDataSource : public KReportDataSource { public: KReportExampleDataSource(); - ~KReportExampleDataSource(); - virtual QVariant value(const QString& field) const; - virtual QVariant value(int) const; - virtual QStringList fieldNames() const; - virtual QStringList fieldKeys() const; - virtual int fieldNumber(const QString& field) const; - virtual qint64 recordCount() const; - virtual qint64 at() const; - virtual bool moveLast(); - virtual bool moveFirst(); - virtual bool movePrevious(); - virtual bool moveNext(); - virtual bool close(); - virtual bool open(); + ~KReportExampleDataSource() override; + QVariant value(const QString &field) const override; + QVariant value(int) const override; + QStringList fieldNames() const override; + QStringList fieldKeys() const override; + int fieldNumber(const QString &field) const override; + qint64 recordCount() const override; + qint64 at() const override; + bool moveLast() override; + bool moveFirst() override; + bool movePrevious() override; + bool moveNext() override; + bool close() override; + bool open() override; - virtual QStringList scriptList() const; - virtual QString scriptCode(const QString &script) const; - - virtual QStringList dataSourceNames() const; + QStringList scriptList() const override; + QString scriptCode(const QString &script) const override; + + QStringList dataSourceNames() const override; private: struct Data { int id; QString devName; QString project; QString country; QString mobile; float lat; float lon; QString code; bool projectLead; }; QList m_testData; QStringList m_fieldNames; int m_currentRecord; }; #endif // KREPORTEXAMPLEDATA_H diff --git a/examples/window.h b/examples/window.h index c2bc0416..356765fa 100644 --- a/examples/window.h +++ b/examples/window.h @@ -1,63 +1,63 @@ /* This file is part of the KDE project Copyright (C) 2015 Jarosław Staniek 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.1 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. */ #ifndef KREPORTEXAMPLE_WINDOW_H #define KREPORTEXAMPLE_WINDOW_H #include "KReportExampleDataSource.h" #include #include #include #include #include #include class ReportDesignerWidget; /*! @short KReportExample application's main window */ class Window : public QMainWindow { Q_OBJECT public: Window(QWidget *parent = nullptr, Qt::WindowFlags flags = Qt::WindowFlags()); - virtual ~Window(); + ~Window() override; public Q_SLOTS: void showDesign(const QDomElement &design); protected: - void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE; + void closeEvent(QCloseEvent *event) override; private: void createMenus(); bool loadDocument(); ReportDesignerWidget *m_designerWidget; QMenu *m_fileMenu; QAction *m_exitAction; KReportView *m_reportView; QDomDocument m_document; int m_currentPage; }; #endif diff --git a/src/common/KReportAsyncItemBase.h b/src/common/KReportAsyncItemBase.h index 7ce8d61b..179bfe72 100644 --- a/src/common/KReportAsyncItemBase.h +++ b/src/common/KReportAsyncItemBase.h @@ -1,35 +1,35 @@ /* This file is part of the KDE project Copyright (C) 2011 Adam Pigg This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef KREPORTASYNCITEMBASE_H #define KREPORTASYNCITEMBASE_H #include "KReportItemBase.h" class KREPORT_EXPORT KReportAsyncItemBase : public KReportItemBase { Q_OBJECT public: - virtual int renderSimpleData(OROPage *page, OROSection *section, const QPointF &offset, const QVariant &data, KReportScriptHandler *script) = 0; + int renderSimpleData(OROPage *page, OROSection *section, const QPointF &offset, const QVariant &data, KReportScriptHandler *script) override = 0; Q_SIGNALS: void finishedRendering(); }; #endif // KREPORTASYNCITEMBASE_H diff --git a/src/common/KReportDataSource.cpp b/src/common/KReportDataSource.cpp index 9da7312a..ab5e1cad 100644 --- a/src/common/KReportDataSource.cpp +++ b/src/common/KReportDataSource.cpp @@ -1,163 +1,163 @@ /* This file is part of the KDE project * Copyright (C) 2007-2010 by Adam Pigg (adam@piggz.co.uk) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see . */ #include "KReportDataSource.h" #include #define KReportDataSortedFieldPrivateArgs(o) std::tie(o.field, o.order) class KReportDataSource::SortedField::Private { public: Private() {} Private(const Private& other) { KReportDataSortedFieldPrivateArgs((*this)) = KReportDataSortedFieldPrivateArgs(other); } QString field; Qt::SortOrder order = Qt::AscendingOrder; }; class KReportDataSource::Private { public: bool dummy = true; }; //==========KReportData::SortedField========== KReportDataSource::SortedField::SortedField() : d(new Private) { } KReportDataSource::SortedField::SortedField(const KReportDataSource::SortedField& other) : d(new Private(*other.d)) { } KReportDataSource::SortedField::~SortedField() { delete d; } KReportDataSource::SortedField & KReportDataSource::SortedField::operator=(const KReportDataSource::SortedField& other) { if (this != &other) { setField(other.field()); setOrder(other.order()); } return *this; } bool KReportDataSource::SortedField::operator==(const KReportDataSource::SortedField& other) const { return KReportDataSortedFieldPrivateArgs((*d)) == KReportDataSortedFieldPrivateArgs((*other.d)); } bool KReportDataSource::SortedField::operator!=(const KReportDataSource::SortedField& other) const { return KReportDataSortedFieldPrivateArgs((*d)) != KReportDataSortedFieldPrivateArgs((*other.d)); } QString KReportDataSource::SortedField::field() const { return d->field; } Qt::SortOrder KReportDataSource::SortedField::order() const { return d->order; } void KReportDataSource::SortedField::setField(const QString& field) { d->field = field; } void KReportDataSource::SortedField::setOrder(Qt::SortOrder order) { d->order = order; } //==========KReportData========== KReportDataSource::KReportDataSource() : d(new Private()) { } KReportDataSource::~KReportDataSource() { delete d; } QStringList KReportDataSource::fieldKeys() const { return fieldNames(); } QString KReportDataSource::sourceName() const { return QString(); } QString KReportDataSource::sourceClass() const { return QString(); } void KReportDataSource::setSorting(const QList &sorting) { Q_UNUSED(sorting); } void KReportDataSource::addCondition(const QString &field, const QVariant &value, const QString& relation) { Q_UNUSED(field); Q_UNUSED(value); Q_UNUSED(relation); } #ifdef KREPORT_SCRIPTING QStringList KReportDataSource::scriptList() const { return QStringList(); } QString KReportDataSource::scriptCode(const QString &script) const { Q_UNUSED(script); return QString(); } #endif QStringList KReportDataSource::dataSourceNames() const { return QStringList(); } QString KReportDataSource::dataSourceCaption(const QString &dataSourceName) const { return dataSourceName; } KReportDataSource* KReportDataSource::create(const QString &source) const { Q_UNUSED(source); - return 0; + return nullptr; } diff --git a/src/common/KReportDesign.h b/src/common/KReportDesign.h index b3f12360..883a011b 100644 --- a/src/common/KReportDesign.h +++ b/src/common/KReportDesign.h @@ -1,152 +1,152 @@ /* This file is part of the KDE project * Copyright (C) 2007-2010 by Adam Pigg * Copyright (C) 2011-2015 Jarosław Staniek * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see . */ #ifndef KREPORTDESIGN_H #define KREPORTDESIGN_H #include "kreport_export.h" #include "config-kreport.h" #include "KReportSection.h" #include class QPageSize; class QMarginsF; class QPageLayout; class KReportElement; //! The KReportDesignReadStatus represents status of reading a report design in .kreport format. /*! It is used by KReportDesign::setContent(). */ class KREPORT_EXPORT KReportDesignReadingStatus { public: //! Creates an empty status object. /*! For empty status objects isError() returns false. */ KReportDesignReadingStatus(); ~KReportDesignReadingStatus(); KReportDesignReadingStatus(const KReportDesignReadingStatus &other); KReportDesignReadingStatus& operator=(const KReportDesignReadingStatus &other); //! @return true if the status is error. //! Equivalent of errorLineNumber() >= 0 && errorColumnNumber() >= 0. bool isError() const; //! Error message suitable for displaying to the user, translated. QString errorMessage() const; //! Detailed error message, partially translated. QString errorDetails() const; //! Line number (counting from 0) in which the error occured. -1 if there is no error. int errorLineNumber() const; //! Column number (counting from 0) in which the error occured. -1 if there is no error. int errorColumnNumber() const; void setErrorMessage(const QString& msg); void setErrorDetails(const QString& details); void setErrorLineNumber(int line); void setErrorColumnNumber(int column); private: class Private; Private * const d; }; //! Sends information about the reading status @a status to debug output @a dbg. KREPORT_EXPORT QDebug operator<<(QDebug dbg, const KReportDesignReadingStatus& status); //! The KReportDesign class represents a report design in .kreport format class KREPORT_EXPORT KReportDesign { Q_DECLARE_TR_FUNCTIONS(KReportDesign) public: KReportDesign(); ~KReportDesign(); //! Reads the XML document in .kreport format from the string @a text //! @return true if the content was successfully parsed //! On failure false is returned and if @a status is provided, it is updated accordingly. - bool setContent(const QString &text, KReportDesignReadingStatus *status = 0); + bool setContent(const QString &text, KReportDesignReadingStatus *status = nullptr); //! Converts the report document back to its textual representation. QString toString(int indent = 1) const; //! @return title for this design QString title() const; //! Sets title for this design to @a title void setTitle(const QString &title); //! @return page layout for this design QPageLayout pageLayout() const; //! Sets the page layout to @a pageLayout //! @note Calling this method does not alter page layouts of existing KReportDesign objects. void setPageLayout(const QPageLayout &pageLayout); //! @return true if this design has section defined of type @a type bool hasSection(KReportSection::Type type) const; //! @return section of type @a type KReportSection section(KReportSection::Type type) const; //! Add section @a section. Previous section of the same type is removed from this design. void addSection(const KReportSection §ion); //! Creates and returns report element of type @a typeName //! On success @a errorMessage is cleared, on failure it is set to a nonempty value. KReportElement createElement(const QString &typeName, QString *errorMessage); //! @return default page layout that is used for creating new report designs /*! Attributes that are specified in the design format: - margins: by default equal to equivalent of 1cm in points (QPageLayout::Point). - mode: by default QPageLayout::StandardMode - orientation: by default QPageLayout::Portrait - pageSize: by default equal to default page size of the default printer (QPrinterInfo::defaultPrinter().defaultPageSize()). If there is no default printer, A4 size is used. Passing invalid page size restores defaults explained in documentation of QPageLayout defaultPageLayout(). @todo For KDE Plasma use information from the Locale by using readConfigNumEntry("PageSize", QPrinter::A4, m_pageSize, QPrinter::PageSize) from KLocalePrivate::initFormat() (klocale_kde.cpp) Other attributes are ignored by the design format. In particular units for margins and pageSize are always QPageLayout::Point. */ static QPageLayout defaultPageLayout(); //! Sets default page layout to @a pageLayout //! This information is used when a new report design is created. static void setDefaultPageLayout(const QPageLayout &pageLayout); #ifdef KREPORT_SCRIPTING //! @return text of the script program QString script() const; #endif private: Q_DISABLE_COPY(KReportDesign) class Private; Private * const d; }; #endif // KREPORTDESIGN_H diff --git a/src/common/KReportDesign_p.cpp b/src/common/KReportDesign_p.cpp index ff0f9335..d6796b43 100644 --- a/src/common/KReportDesign_p.cpp +++ b/src/common/KReportDesign_p.cpp @@ -1,458 +1,458 @@ /* This file is part of the KDE project * Copyright (C) 2001-2007 by OpenMFG, LLC * Copyright (C) 2007-2010 by Adam Pigg * Copyright (C) 2011-2015 Jarosław Staniek * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see . */ #include "KReportDesign_p.h" #include "KReportElement.h" #include "KReportUtils.h" #include "KReportPluginManager.h" #include "KReportPluginInterface.h" #include #include #include #include KReportDesign::Private::Private(KReportDesign *design) : q(design) , showGrid(DEFAULT_SHOW_GRID) , snapToGrid(DEFAULT_SNAP_TO_GRID) , gridDivisions(DEFAULT_GRID_DIVISIONS) , pageUnit(DEFAULT_UNIT) , sections(KReportSection::Detail) { memset(static_cast(sections.data()), 0, sizeof(void*) * sections.length()); pageLayout.setUnits(QPageLayout::Point); // initializate because of https://bugreports.qt.io/browse/QTBUG-47551 } KReportDesign::Private::~Private() { qDeleteAll(sections); } KReportDesignGlobal::KReportDesignGlobal() : defaultSectionHeight(CM_TO_POINT(2.0)) , defaultSectionBackgroundColor(Qt::white) { defaultPageLayout.setUnits(QPageLayout::Point); defaultPageLayout.setMargins(QMarginsF(DEFAULT_PAGE_MARGIN, DEFAULT_PAGE_MARGIN, DEFAULT_PAGE_MARGIN, DEFAULT_PAGE_MARGIN)); defaultPageLayout.setMode(QPageLayout::StandardMode); defaultPageLayout.setOrientation(DEFAULT_PAGE_ORIENTATION); } KReportSection::Type KReportDesignGlobal::sectionType(const QString& typeName) { initSectionTypes(); return sectionTypesForName.value(typeName); // returns InvalidType for invalid name } QString KReportDesignGlobal::sectionTypeName(KReportSection::Type sectionType) { initSectionTypes(); return sectionTypeNames.value(sectionType); } void KReportDesignGlobal::initSectionTypes() { if (!sectionTypesForName.isEmpty()) { return; } for (const SectionTypeInfo *info = sectionTypes; info->name; ++info) { sectionTypesForName.insert(QString::fromLatin1(info->name), info->type); sectionTypeNames.insert(info->type, QString::fromLatin1(info->name)); } } const KReportDesignGlobal::SectionTypeInfo KReportDesignGlobal::sectionTypes[] = { { KReportSection::InvalidType, "" }, { KReportSection::PageHeaderAny, "header-page-any" }, { KReportSection::PageHeaderEven, "header-page-even" }, { KReportSection::PageHeaderOdd, "header-page-odd" }, { KReportSection::PageHeaderFirst, "header-page-first" }, { KReportSection::PageHeaderLast, "header-page-last" }, { KReportSection::PageFooterAny, "footer-page-any" }, { KReportSection::PageFooterEven, "footer-page-even" }, { KReportSection::PageFooterOdd, "footer-page-odd" }, { KReportSection::PageFooterFirst, "footer-page-first" }, { KReportSection::PageFooterLast, "footer-page-last" }, { KReportSection::ReportHeader, "header-report" }, { KReportSection::ReportFooter, "footer-report" }, { KReportSection::GroupHeader, "group-header" }, { KReportSection::GroupFooter, "group-footer" }, { KReportSection::Detail, "detail" }, - { KReportSection::InvalidType, 0 } + { KReportSection::InvalidType, nullptr } }; Q_GLOBAL_STATIC(KReportDesignGlobal, s_global) //static KReportDesignGlobal* KReportDesignGlobal::self() { return s_global; } static void setStatus(KReportDesignReadingStatus *status, const QString& details, const QDomNode &node) { if (status) { status->setErrorDetails(details); status->setErrorLineNumber(node.lineNumber() == -1 ? 0 /* mark error */ : node.lineNumber()); status->setErrorColumnNumber(node.columnNumber() == -1 ? 0 /* mark error */ : node.columnNumber()); } } static bool checkElement(const QDomNode &node, KReportDesignReadingStatus *status) { if (node.isElement()) { return true; } setStatus(status, QString::fromLatin1("Element expected inside of <%1>") .arg(node.parentNode().toElement().tagName()), node); return false; } static void setNoAttributeStatus(const QDomElement &el, const char *attrName, KReportDesignReadingStatus *status) { setStatus(status, QString::fromLatin1("Attribute \"%1\" expected inside of <%1>") .arg(QLatin1String(attrName)).arg(el.tagName()), el); } #if 0 // TODO unused for now static bool checkAttribute(const QDomElement &el, const char *attrName, KReportDesignReadingStatus *status) { if (el.hasAttribute(QLatin1String(attrName))) { return true; } setNoAttributeStatus(el, attrName, status); return false; } #endif KReportSection KReportDesign::Private::processSectionElement(const QDomElement &el, KReportDesignReadingStatus *status) { const QString sectionTypeName = KReportUtils::attr(el, "report:section-type", QString()); KReportSection::Type sectionType = s_global->sectionType(sectionTypeName); if (sectionType == KReportSection::InvalidType) { setStatus(status, QString::fromLatin1("Invalid value of report:section-type=\"%1\" in element <%2>") .arg(sectionTypeName).arg(el.tagName()), el); return KReportSection(); } KReportSection section; section.setType(sectionType); qreal height = KReportUtils::attr(el, "svg:height", -1.0); if (height >= 0.0) { section.setHeight(height); } section.setBackgroundColor(QColor(KReportUtils::attr(el, "fo:background-color", QString()))); for (QDomNode node = el.firstChild(); !node.isNull(); node = node.nextSibling()) { if (!checkElement(node, status)) { return KReportSection(); } KReportElement element = processSectionElementChild(node.toElement(), status); if (!element.rect().isValid() || (status && status->isError())) { return KReportSection(); } section.addElement(element); } return section; } KReportPluginInterface* KReportDesign::Private::findPlugin(const QString &typeName, const QDomElement &el, KReportDesignReadingStatus *status) { KReportPluginInterface* plugin = KReportPluginManager::self()->plugin(typeName); if (!plugin) { setStatus(status, QString::fromLatin1("No such plugin \"%1\"").arg(typeName), el); - return 0; + return nullptr; } return plugin; } KReportElement KReportDesign::Private::processSectionElementChild(const QDomElement &el, KReportDesignReadingStatus *status) { const QByteArray name = el.tagName().toLatin1(); const char* elNamespace = "report:"; if (!name.startsWith(elNamespace)) { unexpectedElement(el, status); return KReportElement(); } const QByteArray reportElementName = name.mid(qstrlen(elNamespace)); //qDebug() << "Found Report Element:" << reportElementName; KReportPluginInterface *plugin = findPlugin(QLatin1String(reportElementName), el, status); if (!plugin) { return KReportElement(); } KReportElement element = plugin->createElement(); if (!plugin->loadElement(&element, el, status)) { return KReportElement(); } element.setName(KReportUtils::attr(el, "report:name", QString())); if (element.name().isEmpty()) { setNoAttributeStatus(el, "report:name", status); return KReportElement(); } return element; } bool KReportDesign::Private::processGroupElement(const QDomElement &el, KReportDesignReadingStatus *status) { Q_UNUSED(el); Q_UNUSED(status); //! @todo return true; } //! The report:detail element contains a single report:section child of type 'detail' //! and 0 or more report:group children. bool KReportDesign::Private::processDetailElement(const QDomElement &el, KReportDesignReadingStatus *status) { QDomElement sectionEl; for (QDomNode node = el.firstChild(); !node.isNull(); node = node.nextSibling()) { if (!checkElement(node, status)) { return false; } QDomElement childEl = node.toElement(); const QByteArray name = childEl.tagName().toLatin1(); if (name == "report:section") { if (!sectionEl.isNull()) { return false; } KReportSection section = processSectionElement(childEl, status); if (status && status->isError()) { return false; } if (section.type() != KReportSection::Detail) { setStatus(status, QString::fromLatin1("Only section of type \"detail\" allowed in "), el); return false; } q->addSection(section); } else if (name == "report:group") { if (!processGroupElement(childEl, status)) { return false; } } else { unexpectedElement(childEl, status); return false; } } // finally make sure we have one report:section (void)requiredChildElement(el, "report:section", status); if (status && status->isError()) { return false; } return true; } /*!
        
         *.. (up to 12 sections)
          
             // any number of groups
              *.. (group-header, group-footer)
            
          
        
     
 */
 bool KReportDesign::Private::processBodyElementChild(const QDomElement &el,
                                                      KReportDesignReadingStatus *status)
 {
     const QByteArray name = el.tagName().toLatin1();
     //kreportDebug() << name;
     if (name == "report:section") {
         KReportSection section = processSectionElement(el, status);
         if (status && status->isError()) {
             return false;
         }
         if (q->hasSection(section.type())) {
             setStatus(status, QString::fromLatin1("Could not add two sections of type \"%1\" "
                                                   "to the same report design")
                                 .arg(s_global->sectionTypeName(section.type())), el);
             return false;
         }
         if (section.type() == KReportSection::Detail) {
             setStatus(status,
                 QString::fromLatin1("Section of type \"detail\" not allowed in "), el);
             return false;
         }
         q->addSection(section);
 #if 0 //TODO
         if (section(KReportSectionData::sectionTypeFromString(sectiontype)) == 0) {
             insertSection(KReportSectionData::sectionTypeFromString(sectiontype));
             section(KReportSectionData::sectionTypeFromString(sectiontype))->initFromXML(sec);
         }
 #endif
     } else if (name == "report:detail") {
         if (!processDetailElement(el, status)) {
             return false;
         }
 #if 0 //TODO
         ReportSectionDetail * rsd = new ReportSectionDetail(this);
         rsd->initFromXML(&sec);
         setDetail(rsd);
 #endif
     }
     return true;
 }
 
 /* NOTE: don't translate these extremely detailed messages. */
 //! @todo Load page options
 bool KReportDesign::Private::processContentElementChild(const QDomElement &el,
                                                         KReportDesignReadingStatus *status)
 {
     const QByteArray name = el.tagName().toLatin1();
     QPageLayout defaultPageLayout = KReportDesign::defaultPageLayout();
     //kreportDebug() << name;
     if (name == "report:title") {
         title = el.text();
 #ifdef KREPORT_SCRIPTING
     } else if (name == "report:script") {
         script = el.firstChildElement().text();
         originalInterpreter = KReportUtils::attr(el, "report:script-interpreter", QString());
 #endif
     } else if (name == "report:grid") {
         showGrid = KReportUtils::attr(el, "report:grid-visible", DEFAULT_SHOW_GRID);
         snapToGrid = KReportUtils::attr(el, "report:grid-snap", DEFAULT_SNAP_TO_GRID);
         gridDivisions = KReportUtils::attr(el, "report:grid-divisions", DEFAULT_GRID_DIVISIONS);
         const QString pageUnitString = KReportUtils::attr(el, "report:page-unit", QString());
         bool found;
         pageUnit = KReportUnit::fromSymbol(pageUnitString, &found);
         if (!found) {
             pageUnit = DEFAULT_UNIT;
             if (!pageUnitString.isEmpty()) {
                 qWarning() << "Invalid page unit" << pageUnitString << "specified in" << name
                            << "element, defaulting to" << pageUnit.symbol();
             }
         }
     }
     else if (name == "report:page-style") { // see https://git.reviewboard.kde.org/r/115314
         const QByteArray pagetype = el.text().toLatin1();
         if (pagetype == "predefined") {
             pageLayout.setPageSize(
                         KReportUtils::pageSize(KReportUtils::attr(el, "report:page-size",
                                                QPageSize(DEFAULT_PAGE_SIZE).key())));
         } else if (pagetype.isEmpty() || pagetype == "custom") {
             QSizeF size(KReportUtils::attr(el, "fo:page-width", -1.0),
                         KReportUtils::attr(el, "fo:page-height", -1.0));
             if (size.isValid()) {
                 pageLayout.setPageSize(QPageSize(size, QPageSize::Point));
             } else {
                 pageLayout.setPageSize(defaultPageLayout.pageSize());
             }
         } else if (pagetype == "label") {
             //! @todo?
             pageLayout.setPageSize(defaultPageLayout.pageSize());
         }
         QMarginsF margins(KReportUtils::attr(el, "fo:margin-left", defaultPageLayout.margins().left()),
                  KReportUtils::attr(el, "fo:margin-top", defaultPageLayout.margins().top()),
                  KReportUtils::attr(el, "fo:margin-right", defaultPageLayout.margins().right()),
                  KReportUtils::attr(el, "fo:margin-bottom", defaultPageLayout.margins().bottom()));
         bool b = pageLayout.setMargins(margins);
         if (!b) {
             qWarning() << "Failed to set page margins to" << margins;
         }
         const QString s = KReportUtils::attr(el, "report:print-orientation", QString());
         if (s == QLatin1String("portrait")) {
             pageLayout.setOrientation(QPageLayout::Portrait);
         } else if (s == QLatin1String("landscape")) {
             pageLayout.setOrientation(QPageLayout::Landscape);
         }
         else {
             pageLayout.setOrientation(defaultPageLayout.orientation());
         }
     } else if (name == "report:body") {
         for (QDomNode node = el.firstChild(); !node.isNull(); node = node.nextSibling()) {
             if (!checkElement(node, status)) {
                 return false;
             }
             if (!processBodyElementChild(node.toElement(), status)) {
                 return false;
             }
         }
     }
     return true;
 }
 
 void KReportDesign::Private::unexpectedElement(const QDomElement &element,
                                                KReportDesignReadingStatus *status) const
 {
     setStatus(status, QString::fromLatin1("Unexpected child element <%1> found in <%2>")
           .arg(element.tagName()).arg(element.parentNode().toElement().tagName()), element);
 }
 
 QDomElement KReportDesign::Private::requiredChildElement(const QDomElement &parent,
                                                          const char* childElementName,
                                                          KReportDesignReadingStatus *status) const
 {
     const QDomElement result = parent.firstChildElement(QLatin1String(childElementName));
     if (result.isNull()) {
         setStatus(status, QString::fromLatin1("Child element <%1> not found in <%2>")
               .arg(QLatin1String(childElementName)).arg(parent.tagName()), parent);
     }
     return result;
 }
 
 /* NOTE: don't translate these extremely detailed messages. */
 bool KReportDesign::Private::processDocument(const QDomDocument &doc,
                                              KReportDesignReadingStatus *status)
 {
     const QDomElement rootEl = doc.documentElement();
     const QLatin1String rootElName("kexireport"); // legacy name kept for compatibility
     if (doc.doctype().name() != rootElName) {
         setStatus(status, QString::fromLatin1("Document type should be \"%1\"").arg(rootElName), rootEl);
         return false;
     }
     if (rootEl.tagName() != rootElName) {
         setStatus(status, QString::fromLatin1("Root element should be <%1>").arg(rootElName), rootEl);
         return false;
     }
     const QDomElement contentEl = requiredChildElement(rootEl, "report:content", status);
     if (status && status->isError()) {
         return false;
     }
     //! @todo check namespaces as in:
     //! 
 
 //    deleteDetail();
 
     for (QDomNode node = contentEl.firstChild(); !node.isNull(); node = node.nextSibling()) {
         if (!checkElement(node, status)) {
             return false;
         }
         if (!processContentElementChild(node.toElement(), status)) {
             return false;
         }
     }
 
     if (status) {
         *status = KReportDesignReadingStatus();
     }
     return true;
 }
diff --git a/src/common/KReportDetailSectionData.cpp b/src/common/KReportDetailSectionData.cpp
index 731a81b0..d7561988 100644
--- a/src/common/KReportDetailSectionData.cpp
+++ b/src/common/KReportDetailSectionData.cpp
@@ -1,123 +1,123 @@
 /* This file is part of the KDE project
  * Copyright (C) 2001-2007 by OpenMFG, LLC (info@openmfg.com)
  * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 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
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library.  If not, see .
  */
 
 #include "KReportDetailSectionData.h"
 #include "KReportSectionData.h"
 #include "KReportDocument.h"
 
 #include "kreport_debug.h"
 #include 
 
 KReportDetailSectionData::KReportDetailSectionData(QObject *parent)
  : QObject(parent)
 {
     m_pageBreak = BreakNone;
-    m_detailSection = 0;
+    m_detailSection = nullptr;
     m_valid = true;
 }
 
 KReportDetailSectionData::KReportDetailSectionData(const QDomElement &elemSource, KReportDocument *report)
  : QObject(report)
 {
     m_pageBreak = BreakNone;
-    m_detailSection = 0;
+    m_detailSection = nullptr;
     m_valid = false;
     //kreportDebug() << elemSource.tagName();
     if (elemSource.tagName() != QLatin1String("report:detail")) {
         return;
     }
 
     QDomNodeList sections = elemSource.childNodes();
 
     for (int nodeCounter = 0; nodeCounter < sections.count(); nodeCounter++) {
         QDomElement elemThis = sections.item(nodeCounter).toElement();
 
         if (elemThis.tagName() == QLatin1String("report:group")) {
             KReportDetailGroupSectionData * dgsd = new KReportDetailGroupSectionData();
 
             if ( elemThis.hasAttribute( QLatin1String("report:group-column") ) ) {
                 dgsd->m_column = elemThis.attribute( QLatin1String("report:group-column") );
             }
 
             if ( elemThis.hasAttribute( QLatin1String("report:group-page-break") ) ) {
                 QString s = elemThis.attribute( QLatin1String("report:group-page-break") );
                 if ( s == QLatin1String("after-footer") ) {
                     dgsd->m_pagebreak = KReportDetailGroupSectionData::BreakAfterGroupFooter;
                 } else if ( s == QLatin1String("before-header") ) {
                     dgsd->m_pagebreak = KReportDetailGroupSectionData::BreakBeforeGroupHeader;
                 } else {
                     dgsd->m_pagebreak = KReportDetailGroupSectionData::BreakNone;
                 }
             }
 
             if (elemThis.attribute(QLatin1String("report:group-sort"), QLatin1String("ascending")) == QLatin1String("ascending")) {
                 dgsd->m_sort = Qt::AscendingOrder;
             } else {
                 dgsd->m_sort = Qt::DescendingOrder;
             }
             
             for ( QDomElement e = elemThis.firstChildElement( QLatin1String("report:section") ); ! e.isNull(); e = e.nextSiblingElement( QLatin1String("report:section") ) ) {
                 QString s = e.attribute( QLatin1String("report:section-type") );
                 if ( s == QLatin1String("group-header") ) {
                     KReportSectionData * sd = new KReportSectionData(e, report);
                     if (sd->isValid()) {
                         dgsd->m_groupHeader = sd;
                     } else {
                         delete sd;
                     }
                 } else if ( s == QLatin1String("group-footer") ) {
                     KReportSectionData * sd = new KReportSectionData(e, report);
                     if (sd->isValid()) {
                         dgsd->m_groupFooter = sd;
                     } else {
                         delete sd;
                     }
                 }
             }
             m_groupList.append(dgsd);
             KReportDataSource::SortedField s;
             s.setField(dgsd->m_column);
             s.setOrder(dgsd->m_sort);
             m_sortedFields.append(s);
 	    
         } else if (elemThis.tagName() == QLatin1String("report:section") && elemThis.attribute(QLatin1String("report:section-type")) == QLatin1String("detail")) {
             KReportSectionData * sd = new KReportSectionData(elemThis, report);
             if (sd->isValid()) {
                 m_detailSection = sd;
             } else
                 delete sd;
         } else {
             kreportWarning() << "While parsing detail section encountered an unknown element: " << elemThis.tagName();
         }
     }
     
     m_valid = true;
 }
 
 KReportDetailSectionData::~KReportDetailSectionData()
 {
 }
 
 KReportDetailGroupSectionData::KReportDetailGroupSectionData()
 {
     m_pagebreak = BreakNone;
     m_sort = Qt::AscendingOrder;
-    m_groupHeader = 0;
-    m_groupFooter = 0;
+    m_groupHeader = nullptr;
+    m_groupFooter = nullptr;
 }
 
diff --git a/src/common/KReportDetailSectionData.h b/src/common/KReportDetailSectionData.h
index 6c1d8276..1f3d6b09 100644
--- a/src/common/KReportDetailSectionData.h
+++ b/src/common/KReportDetailSectionData.h
@@ -1,83 +1,83 @@
 /* This file is part of the KDE project
  * Copyright (C) 2001-2007 by OpenMFG, LLC (info@openmfg.com)
  * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 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
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library.  If not, see .
  */
 
 #ifndef KREPORTDETAILSECTIONDATA_H
 #define KREPORTDETAILSECTIONDATA_H
 
 #include 
 
 #include "KReportDataSource.h"
 
 class KReportSectionData;
 class KReportDetailGroupSectionData;
 class KReportDocument;
 
 class QDomElement;
 
 /**
 */
 class KReportDetailSectionData : public QObject
 {
     Q_OBJECT
 public:
-    explicit KReportDetailSectionData(QObject *parent = 0);
+    explicit KReportDetailSectionData(QObject *parent = nullptr);
     KReportDetailSectionData(const QDomElement &elemSource, KReportDocument *report);
-    ~KReportDetailSectionData();
+    ~KReportDetailSectionData() override;
 
     enum PageBreak {
         BreakNone = 0,
         BreakAtEnd = 1
     };
 
     QString m_name;
     int m_pageBreak;
     QList m_sortedFields;
 
     KReportSectionData * m_detailSection;
 
     QList m_groupList;
 
     bool isValid() const {
         return m_valid;
     }
 
 private:
     bool m_valid;
 };
 
 class KReportDetailGroupSectionData
 {
 public:
     KReportDetailGroupSectionData();
 
     enum PageBreak {
         BreakNone = 0,
         BreakAfterGroupFooter = 1,
         BreakBeforeGroupHeader = 2
     };
 
     //QString name;
     QString m_column;
     PageBreak m_pagebreak;
     Qt::SortOrder m_sort;
 
     KReportSectionData *m_groupHeader;
     KReportSectionData *m_groupFooter;
 };
 
 #endif
diff --git a/src/common/KReportDocument.cpp b/src/common/KReportDocument.cpp
index d4400f32..ac55b12a 100644
--- a/src/common/KReportDocument.cpp
+++ b/src/common/KReportDocument.cpp
@@ -1,384 +1,384 @@
 /* This file is part of the KDE project
  * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 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
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library.  If not, see .
  */
 
 #include "KReportDocument.h"
 #include "KReportUnit.h"
 #include "KReportDetailSectionData.h"
 #include "KReportItemBase.h"
 #include "KReportUtils_p.h"
 #include "KReportPageSize.h"
 
 #include 
 #include 
 #include "kreport_debug.h"
 
 class Q_DECL_HIDDEN KReportDocument::Private
 {
 public:
     bool valid;
     QString title;
     QString name;
     QString query;
 #ifdef KREPORT_SCRIPTING
     QString script;
     QString interpreter;
 #endif
     bool externalData;
     KReportPrivate::PageLayout pageLayout;
     QString pageSize;
     QString labelType;
 };
 
 void KReportDocument::init()
 {
-    m_pageHeaderFirst = m_pageHeaderOdd = m_pageHeaderEven = m_pageHeaderLast = m_pageHeaderAny = 0;
-    m_pageFooterFirst = m_pageFooterOdd = m_pageFooterEven = m_pageFooterLast = m_pageFooterAny = 0;
-    m_reportHeader = m_reportFooter = 0;
+    m_pageHeaderFirst = m_pageHeaderOdd = m_pageHeaderEven = m_pageHeaderLast = m_pageHeaderAny = nullptr;
+    m_pageFooterFirst = m_pageFooterOdd = m_pageFooterEven = m_pageFooterLast = m_pageFooterAny = nullptr;
+    m_reportHeader = m_reportFooter = nullptr;
 }
 
 KReportDocument::KReportDocument(QObject *parent)
         : QObject(parent),
-        m_detailSection(0),
+        m_detailSection(nullptr),
         d(new Private())
 {
     init();
     d->valid = true;
 }
 
 KReportDocument::KReportDocument(const QDomElement & elemSource, QObject *parent)
         : QObject(parent),
-        m_detailSection(0),
+        m_detailSection(nullptr),
         d(new Private())
 {
     d->valid = false;
     init();
     //kreportDebug();
     if (elemSource.tagName() != QLatin1String("report:content")) {
         kreportWarning() << "QDomElement is not  tag"
                    << elemSource.text();
         return;
     }
 
     QDomNodeList sections = elemSource.childNodes();
     for (int nodeCounter = 0; nodeCounter < sections.count(); nodeCounter++) {
         QDomElement elemThis = sections.item(nodeCounter).toElement();
         if (elemThis.tagName() == QLatin1String("report:title")) {
             d->title = elemThis.text();
 #ifdef KREPORT_SCRIPTING
         } else if (elemThis.tagName() == QLatin1String("report:script")) {
             d->script = elemThis.text();
             d->interpreter = elemThis.attribute(QLatin1String("report:script-interpreter"));
 #endif
         } else if (elemThis.tagName() == QLatin1String("report:page-style")) {            
             QString pagetype = elemThis.firstChild().nodeValue();
 
             //Full page mode is required to allow margins to be set to whatever the user has specified
             d->pageLayout.setMode(QPageLayout::FullPageMode);
             
             if (pagetype == QLatin1String("predefined")) {
                 setPageSize(elemThis.attribute(QLatin1String("report:page-size"), QLatin1String("A4")));
                 d->pageLayout.setPageSize(QPageSize(KReportPageSize::pageSize(pageSize())));
             } else if (pagetype == QLatin1String("custom")) {
                 QPageSize custom(QSize(elemThis.attribute(QLatin1String("report:custom-page-width"), QString()).toFloat() , elemThis.attribute(QLatin1String("report:custom-page-height"), QString()).toFloat()), QLatin1String("Custom"));
 
                 d->pageLayout.setPageSize(custom);
             } else if (pagetype == QLatin1String("label")) {
                 setLabelType(elemThis.firstChild().nodeValue());
             }
             //! @todo add config for default margins or add within templates support
             d->pageLayout.setUnits(QPageLayout::Point);
             d->pageLayout.setLeftMargin(KReportUnit::parseValue(elemThis.attribute(QLatin1String("fo:margin-left"), QLatin1String("1.0cm"))));
             d->pageLayout.setRightMargin(KReportUnit::parseValue(elemThis.attribute(QLatin1String("fo:margin-right"), QLatin1String("1.0cm"))));
             d->pageLayout.setTopMargin(KReportUnit::parseValue(elemThis.attribute(QLatin1String("fo:margin-top"), QLatin1String("1.0cm"))));
             d->pageLayout.setBottomMargin(KReportUnit::parseValue(elemThis.attribute(QLatin1String("fo:margin-bottom"), QLatin1String("1.0cm"))));
             d->pageLayout.setOrientation(elemThis.attribute(QLatin1String("report:print-orientation"), QLatin1String("portrait")) == QLatin1String("portrait") ? QPageLayout::Portrait : QPageLayout::Landscape);
         } else if (elemThis.tagName() == QLatin1String("report:body")) {
             QDomNodeList sectionlist = elemThis.childNodes();
             QDomNode sec;
 
             for (int s = 0; s < sectionlist.count(); ++s) {
                 sec = sectionlist.item(s);
                 if (sec.isElement()) {
                     QString sn = sec.nodeName().toLower();
                     //kreportDebug() << sn;
                     if (sn == QLatin1String("report:section")) {
                         KReportSectionData * sd = new KReportSectionData(sec.toElement(), this);
                         if (!sd->isValid()) {
                             kreportDebug() << "Invalid section";
                             delete sd;
                         } else {
                             //kreportDebug() << "Adding section of type " << sd->type();
                             switch (sd->type()) {
                             case KReportSectionData::PageHeaderFirst:
                                 m_pageHeaderFirst = sd;
                                 break;
                             case KReportSectionData::PageHeaderOdd:
                                 m_pageHeaderOdd = sd;
                                 break;
                             case KReportSectionData::PageHeaderEven:
                                 m_pageHeaderEven = sd;
                                 break;
                             case KReportSectionData::PageHeaderLast:
                                 m_pageHeaderLast = sd;
                                 break;
                             case KReportSectionData::PageHeaderAny:
                                 m_pageHeaderAny = sd;
                                 break;
                             case KReportSectionData::ReportHeader:
                                 m_reportHeader = sd;
                                 break;
                             case KReportSectionData::ReportFooter:
                                 m_reportFooter = sd;
                                 break;
                             case KReportSectionData::PageFooterFirst:
                                 m_pageFooterFirst = sd;
                                 break;
                             case KReportSectionData::PageFooterOdd:
                                 m_pageFooterOdd = sd;
                                 break;
                             case KReportSectionData::PageFooterEven:
                                 m_pageFooterEven = sd;
                                 break;
                             case KReportSectionData::PageFooterLast:
                                 m_pageFooterLast = sd;
                                 break;
                             case KReportSectionData::PageFooterAny:
                                 m_pageFooterAny = sd;
                                 break;
                             default:
                                 ;
                             }
                         }
 
                     } else if (sn == QLatin1String("report:detail")) {
                         KReportDetailSectionData * dsd = new KReportDetailSectionData(sec.toElement(), this);
 
                         if (dsd->isValid()) {
                             m_detailSection = dsd;
                         } else {
                             kreportDebug() << "Invalid detail section";
                             delete dsd;
                         }
                     }
                 } else {
                     kreportWarning() << "Encountered an unknown Element: "  << elemThis.tagName();
                 }
             }
         }
 
         d->valid = true;
     }
 }
 
 KReportDocument::~KReportDocument()
 {
     delete d;
 }
 
 QList KReportDocument::objects() const
 {
     QList obs;
     for (int i = 1; i <= KReportSectionData::PageFooterAny; i++) {
         KReportSectionData *sec = section((KReportSectionData::Section)i);
         if (sec) {
             obs << sec->objects();
         }
     }
 
     if (m_detailSection) {
         //kreportDebug() << "Number of groups: " << m_detailSection->m_groupList.count();
         foreach(KReportDetailGroupSectionData* g, m_detailSection->m_groupList) {
             if (g->m_groupHeader) {
                 obs << g->m_groupHeader->objects();
             }
             if (g->m_groupFooter) {
                 obs << g->m_groupFooter->objects();
             }
         }
         if (m_detailSection->m_detailSection)
             obs << m_detailSection->m_detailSection->objects();
     }
 
     /*kreportDebug() << "Object List:";
     foreach(KReportItemBase* o, obs) {
         kreportDebug() << o->entityName();
     }*/
     return obs;
 }
 
 KReportItemBase* KReportDocument::object(const QString& n) const
 {
     QList obs = objects();
 
     foreach(KReportItemBase* o, obs) {
         if (o->entityName() == n) {
             return o;
         }
     }
-    return 0;
+    return nullptr;
 }
 
 QList KReportDocument::sections() const
 {
     QList secs;
     for (int i = 0; i < 12 ; ++i) {
         KReportSectionData *sec = section((KReportSectionData::Section)(i + 1));
         if (sec) {
             secs << sec;
         }
     }
 
     if (m_detailSection) {
         //kreportDebug() << "Number of groups: " << m_detailSection->m_groupList.count();
         foreach(KReportDetailGroupSectionData* g, m_detailSection->m_groupList) {
             if (g->m_groupHeader) {
                 secs << g->m_groupHeader;
             }
             if (g->m_groupFooter) {
                 secs << g->m_groupFooter;
             }
         }
         if (m_detailSection->m_detailSection)
             secs << m_detailSection->m_detailSection;
     }
 
     return secs;
 }
 
 KReportSectionData* KReportDocument::section(const QString& sn) const
 {
     QList secs = sections();
 
     foreach(KReportSectionData *sec, secs) {
         if (sec->name() == sn) {
             return sec;
         }
     }
-    return 0;
+    return nullptr;
 }
 
 KReportSectionData* KReportDocument::section(KReportSectionData::Section s) const
 {
     KReportSectionData *sec;
     switch (s) {
     case KReportSectionData::PageHeaderAny:
         sec = m_pageHeaderAny;
         break;
     case KReportSectionData::PageHeaderEven:
         sec = m_pageHeaderEven;
         break;
     case KReportSectionData::PageHeaderOdd:
         sec = m_pageHeaderOdd;
         break;
     case KReportSectionData::PageHeaderFirst:
         sec = m_pageHeaderFirst;
         break;
     case KReportSectionData::PageHeaderLast:
         sec = m_pageHeaderLast;
         break;
     case KReportSectionData::PageFooterAny:
         sec = m_pageFooterAny;
         break;
     case KReportSectionData::PageFooterEven:
         sec = m_pageFooterEven;
         break;
     case KReportSectionData::PageFooterOdd:
         sec = m_pageFooterOdd;
         break;
     case KReportSectionData::PageFooterFirst:
         sec = m_pageFooterFirst;
         break;
     case KReportSectionData::PageFooterLast:
         sec = m_pageFooterLast;
         break;
     case KReportSectionData::ReportHeader:
         sec = m_reportHeader;
         break;
     case KReportSectionData::ReportFooter:
         sec = m_reportFooter;
         break;
     default:
-        sec = 0;
+        sec = nullptr;
     }
     return sec;
 }
 
 QPageLayout KReportDocument::pageLayout() const
 {
     return d->pageLayout;
 }
 
 bool KReportDocument::isValid() const
 {
     return d->valid;
 }
 
 QString KReportDocument::title() const
 {
     return d->title;
 }
 
 bool KReportDocument::externalData() const
 {
     return d->externalData;
 }
 
 QString KReportDocument::interpreter() const
 {
     return d->interpreter;
 }
 
 QString KReportDocument::name() const
 {
     return d->name;
 }
 
 void KReportDocument::setName(const QString& n)
 {
     d->name = n;
 }
 
 QString KReportDocument::query() const
 {
     return d->query;
 }
 
 QString KReportDocument::script() const
 {
     return d->script;
 }
 
 QString KReportDocument::pageSize()
 {
     return d->pageSize;
 }
 
 void KReportDocument::setPageSize(const QString& size)
 {
     d->pageSize = size;
 }
 
 QString KReportDocument::labelType() const
 {
     return d->labelType;
 }
 
 void KReportDocument::setLabelType(const QString& label)
 {
     d->labelType = label;
 }
 
diff --git a/src/common/KReportDocument.h b/src/common/KReportDocument.h
index 04892c60..f1f33931 100644
--- a/src/common/KReportDocument.h
+++ b/src/common/KReportDocument.h
@@ -1,136 +1,136 @@
 /* This file is part of the KDE project
  * Copyright (C) 2001-2007 by OpenMFG, LLC (info@openmfg.com)
  * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 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
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library.  If not, see .
  */
 
 #ifndef KREPORTDOCUMENT_H
 #define KREPORTDOCUMENT_H
 
 #include "config-kreport.h"
 #include "kreport_export.h"
 #include "KReportSectionData.h"
 
 #include 
 
 class KReportDetailSectionData;
 
 #ifdef KREPORT_SCRIPTING
 namespace Scripting
 {
 class Report;
 }
 #endif
 
 /**
 */
 class KREPORT_EXPORT KReportDocument : public QObject
 {
     Q_OBJECT
 
 public:
-    explicit KReportDocument(const QDomElement & elemSource, QObject *parent = 0);
-    explicit KReportDocument(QObject *parent = 0);
-    ~KReportDocument();
+    explicit KReportDocument(const QDomElement &elemSource, QObject *parent = nullptr);
+    explicit KReportDocument(QObject *parent = nullptr);
+    ~KReportDocument() override;
 
     bool isValid() const;
 
     /**
     \return a list of all objects in the report
     */
     QList objects() const;
 
     /**
     \return a report object given its name
     */
     KReportItemBase* object(const QString&) const;
 
     /**
     \return all the sections, including groups and detail
     */
     QList sections() const;
 
     /**
     \return a sectiondata given a section enum
     */
     KReportSectionData* section(KReportSectionData::Section) const;
 
     /**
     \return a sectiondata given its name
     */
     KReportSectionData* section(const QString&) const;
 
     QString query() const;
 #ifdef KREPORT_SCRIPTING
     QString script() const;
 
     QString interpreter() const;
 #endif
 
     bool externalData() const;
 
     KReportDetailSectionData* detail() const {
         return m_detailSection;
     }
 
     void setName(const QString&n);
     QString name() const;
 
     QString title() const;
 
     QPageLayout pageLayout() const;
     
     QString pageSize();
     void setPageSize(const QString &size);
     
 protected:
 
 
     KReportSectionData * m_pageHeaderFirst;
     KReportSectionData * m_pageHeaderOdd;
     KReportSectionData * m_pageHeaderEven;
     KReportSectionData * m_pageHeaderLast;
     KReportSectionData * m_pageHeaderAny;
 
     KReportSectionData * m_reportHeader;
     KReportSectionData * m_reportFooter;
 
     KReportSectionData * m_pageFooterFirst;
     KReportSectionData * m_pageFooterOdd;
     KReportSectionData * m_pageFooterEven;
     KReportSectionData * m_pageFooterLast;
     KReportSectionData * m_pageFooterAny;
 
     KReportDetailSectionData* m_detailSection;
 
 private:
     void init();
     
     friend class KReportPreRendererPrivate;
     friend class KReportPreRenderer;
 #ifdef KREPORT_SCRIPTING
     friend class KReportScriptHandler;
     friend class Scripting::Report;
 #endif
     
     //! TODO add support for labels
     QString labelType() const;
     void setLabelType(const QString &label);
     
     class Private;
     Private * const d;
 };
 
 #endif
diff --git a/src/common/KReportItemBase.h b/src/common/KReportItemBase.h
index 02020960..2cfec9dc 100644
--- a/src/common/KReportItemBase.h
+++ b/src/common/KReportItemBase.h
@@ -1,155 +1,155 @@
 /* This file is part of the KDE project
  * Copyright (C) 2007-2010 by Adam Pigg (adam@piggz.co.uk)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 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
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library.  If not, see .
  */
 
 #ifndef KREPORTITEMBASE_H
 #define KREPORTITEMBASE_H
 
 #include "config-kreport.h"
 #include "kreport_export.h"
 #include "KReportUnit.h"
 
 #include 
 #include 
 #include 
 
 class OROPage;
 class OROSection;
 class KReportSize;
 class KReportDataSource;
 class KReportLineStyle;
 
 #ifdef KREPORT_SCRIPTING
 class KReportScriptHandler;
 #else
 #define KReportScriptHandler void
 #endif
 
 class KProperty;
 class KPropertySet;
 
 class QDomElement;
 
 class KReportTextStyleData
 {
 public:
     QFont font;
     Qt::Alignment alignment;
     QColor backgroundColor;
     QColor foregroundColor;
     int backgroundOpacity;
 
 };
 
 /*
 class KReportLineStyle
 {
 public:
     int weight;
     QColor lineColor;
     Qt::PenStyle style;
 };
 */
 
 /**
 */
 class KREPORT_EXPORT KReportItemBase : public QObject
 {
     Q_OBJECT
 public:
 
     KReportItemBase();
-    virtual ~KReportItemBase();
+    ~KReportItemBase() override;
 
     /**
     @brief Return the item type as a string.  Required by all items
     @return Item type
     */
     virtual QString typeName() const = 0;
 
     /**
     @brief Render the item into a primitive which is used by the second stage renderer
     @return the height required by the object
     */
     virtual int renderSimpleData(OROPage *page, OROSection *section, const QPointF &offset, const QVariant &data, KReportScriptHandler *script);
 
     /**
     @brief Render a complex item that uses a sub query as a data source
     @return the height required by the object
     */
     virtual int renderReportData(OROPage *page, OROSection *section, const QPointF &offset, KReportDataSource *dataSource, KReportScriptHandler *script);
 
     /**
     @brief Override if the item supports a simple data source, such as a field
     @return The field name or expression for the data source
     */
     virtual QString itemDataSource() const;
 
     /**
     @brief Override if the item uses a sub query and linked fields, such as a chart or sub-report
     @return True if uses a sub query
     */
     virtual bool supportsSubQuery() const;
 
     KPropertySet* propertySet();
     const KPropertySet* propertySet() const;
 
     void setEntityName(const QString& n);
     QString entityName() const;
 
     virtual void setUnit(const KReportUnit& u);
 
     /**
      * @brief Return the size in points
      */
     QSizeF size() const;
 
     /**
      * @brief Return the position in points
      */
     QPointF position() const;
 
     void setPosition(const QPointF &pos);
     void setSize(const QSizeF &siz);
 
     qreal z() const;
     void setZ(qreal z);
 
     //Helper function to map between size/position units
     static QPointF scenePosition(const QPointF &pos);
     static QSizeF sceneSize(const QSizeF &size);
     static QPointF positionFromScene(const QPointF &pos);
     static QSizeF sizeFromScene(const QSizeF &size);
 
 protected:
     virtual void createProperties() = 0;
     bool parseReportRect(const QDomElement &elem);
     static bool parseReportTextStyleData(const QDomElement &, KReportTextStyleData*);
     static bool parseReportLineStyleData(const QDomElement &, KReportLineStyle*);
 
     KProperty *nameProperty();
     QString oldName() const;
     void setOldName(const QString &old);
 
     Q_SLOT virtual void propertyChanged(KPropertySet &s, KProperty &p);
 
 private:
     Q_DISABLE_COPY(KReportItemBase)
     class Private;
     Private * const d;
 };
 
 #endif
diff --git a/src/common/KReportItemLine.h b/src/common/KReportItemLine.h
index f956faa3..4d38221f 100644
--- a/src/common/KReportItemLine.h
+++ b/src/common/KReportItemLine.h
@@ -1,66 +1,67 @@
 /* This file is part of the KDE project
  * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 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
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library.  If not, see .
  */
 
 #ifndef KREPORTITEMLINE_H
 #define KREPORTITEMLINE_H
 
 #include "KReportItemBase.h"
 #include "kreport_export.h"
 
 class QDomNode;
 
 namespace Scripting
 {
 class Line;
 }
 
 /**
 */
 class  KReportItemLine : public KReportItemBase
 {
 Q_OBJECT
 public:
     KReportItemLine();
     explicit KReportItemLine(const QDomNode & element);
-    ~KReportItemLine();
+    ~KReportItemLine() override;
 
-    virtual QString typeName() const;
-    virtual int renderSimpleData(OROPage *page, OROSection *section, const QPointF &offset, const QVariant &data, KReportScriptHandler *script);
+    QString typeName() const override;
+    int renderSimpleData(OROPage *page, OROSection *section, const QPointF &offset,
+                         const QVariant &data, KReportScriptHandler *script) override;
 
-    virtual void setUnit(const KReportUnit&);
+    void setUnit(const KReportUnit&) override;
 
     QPointF startPosition() const;
     QPointF endPosition() const;
 
 protected:
     KProperty *m_start;
     KProperty *m_end;
     KProperty *m_lineColor;
     KProperty *m_lineWeight;
     KProperty *m_lineStyle;
 
     KReportLineStyle lineStyle() const;
     qreal weight() const;
     void setWeight(qreal w);
 
 private:
-    virtual void createProperties();
+    void createProperties() override;
 
     friend class Scripting::Line;
 };
 
 #endif
diff --git a/src/common/KReportPluginInterface.cpp b/src/common/KReportPluginInterface.cpp
index 219f4792..dbd8ab98 100644
--- a/src/common/KReportPluginInterface.cpp
+++ b/src/common/KReportPluginInterface.cpp
@@ -1,73 +1,73 @@
 /* This file is part of the KDE project
    Copyright (C) 2010 by Adam Pigg (adam@piggz.co.uk)
    Copyright (C) 2015 Jarosław Staniek 
 
    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.1 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 "KReportPluginInterface.h"
 #include "KReportPluginMetaData.h"
 #include "KReportUtils.h"
 #include "kreport_debug.h"
 
 #include 
 
 class Q_DECL_HIDDEN KReportPluginInterface::Private
 {
 public:
-    Private() : metaData(0) {}
+    Private() : metaData(nullptr) {}
     ~Private() {}
 
     const KReportPluginMetaData *metaData;
 };
 
 // ---
 
 KReportPluginInterface::KReportPluginInterface(QObject* parent, const QVariantList& args)
  : QObject(parent), d(new Private)
 {
     Q_UNUSED(args);
 }
 
 KReportPluginInterface::~KReportPluginInterface()
 {
     delete d;
 }
 
 const KReportPluginMetaData* KReportPluginInterface::metaData() const
 {
     return d->metaData;
 }
 
 void KReportPluginInterface::setMetaData(KReportPluginMetaData* metaData)
 {
     d->metaData = metaData;
 }
 
 bool KReportPluginInterface::loadElement(KReportElement *el, const QDomElement &dom, KReportDesignReadingStatus *status)
 {
     Q_ASSERT(el);
     Q_UNUSED(status);
     el->setName(KReportUtils::attr(dom, "report:name", QString()));
     el->setRect(KReportUtils::readRectAttributes(dom, el->rect()));
     el->setZ(KReportUtils::attr(dom, "report:z-index", el->z()));
 
     const QDomElement textStyleDom = dom.firstChildElement(QLatin1String("report:text-style"));
     el->setForegroundColor(KReportUtils::attr(textStyleDom, "fo:foreground-color", el->foregroundColor()));
     el->setBackgroundColor(KReportUtils::attr(textStyleDom, "fo:background-color", el->backgroundColor()));
     el->setBackgroundOpacity(KReportUtils::attrPercent(textStyleDom, "fo:background-opacity", el->backgroundOpacity()));
     return true;
 }
diff --git a/src/common/KReportPluginInterface.h b/src/common/KReportPluginInterface.h
index 25e463ba..1aef4407 100644
--- a/src/common/KReportPluginInterface.h
+++ b/src/common/KReportPluginInterface.h
@@ -1,80 +1,80 @@
 /* This file is part of the KDE project
    Copyright (C) 2010 by Adam Pigg (adam@piggz.co.uk)
    Copyright (C) 2015 Jarosław Staniek 
 
    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.1 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.
 */
 
 #ifndef KREPORTPLUGININTERFACE_H
 #define KREPORTPLUGININTERFACE_H
 
 #include "config-kreport.h"
 #include "kreport_export.h"
 #include "KReportElement.h"
 
 #include 
 
 class QGraphicsScene;
 class QDomNode;
 class QDomElement;
 class KReportPluginMetaData;
 class KReportDesignReadingStatus;
 class KReportDesigner;
 class KReportItemBase;
 
 //! Implementation of report plugin's entry point
 #define KREPORT_PLUGIN_FACTORY(class_name, name) \
     K_PLUGIN_FACTORY_WITH_JSON(class_name ## Factory, name, registerPlugin();)
 
 //! An interface for plugins delivering KReport elements
 class KREPORT_EXPORT KReportPluginInterface : public QObject
 {
     Q_OBJECT
 public:
-    explicit KReportPluginInterface(QObject *parent = 0,
+    explicit KReportPluginInterface(QObject *parent = nullptr,
                                      const QVariantList &args = QVariantList());
 
-    virtual ~KReportPluginInterface();
+    ~KReportPluginInterface() override;
 
     virtual QObject* createDesignerInstance(KReportDesigner *designer, QGraphicsScene * scene,
                                             const QPointF &pos) = 0;
 
     virtual QObject* createDesignerInstance(const QDomNode &element, KReportDesigner *designer,
                                             QGraphicsScene *scene) = 0;
 
     virtual QObject* createRendererInstance(const QDomNode &element) = 0;
 
     virtual KReportElement createElement() { return KReportElement(); } //!< @todo remove {}
 
     virtual bool loadElement(KReportElement *el, const QDomElement &dom, KReportDesignReadingStatus *status);
 
 #ifdef KREPORT_SCRIPTING
     virtual QObject* createScriptInstance(KReportItemBase* item) = 0;
 #endif
 
     //! @return information about the plugin
     const KReportPluginMetaData* metaData() const;
 
 private:
     friend class KReportPluginEntry;
     void setMetaData(KReportPluginMetaData* metaData);
 
     Q_DISABLE_COPY(KReportPluginInterface)
     class Private;
     Private * const d;
 };
 
 #endif // KREPORTPLUGININTERFACE_H
diff --git a/src/common/KReportPluginManager.cpp b/src/common/KReportPluginManager.cpp
index 1f7112bc..6503d77f 100644
--- a/src/common/KReportPluginManager.cpp
+++ b/src/common/KReportPluginManager.cpp
@@ -1,301 +1,301 @@
 /* This file is part of the KDE project
    Copyright (C) 2010 by Adam Pigg (adam@piggz.co.uk)
    Copyright (C) 2015-2016 Jarosław Staniek 
 
    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.1 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 "KReportPluginManager.h"
 #include "KReportPluginManagerPrivate.h"
 #include "KReportPluginMetaData.h"
 #include "KReportJsonTrader_p.h"
 #include "KReportUtils_p.h"
 
 #include "kreport_debug.h"
 #include 
 
 //Include the static items
 #include "../items/label/KReportLabelPlugin.h"
 #include "../items/check/KReportCheckBoxPlugin.h"
 #include "../items/field/KReportFieldPlugin.h"
 #include "../items/image/KReportImagePlugin.h"
 #include "../items/text/KReportTextPlugin.h"
 
 KReportPluginManager::Private::Private(KReportPluginManager *qq)
     : q(qq), m_parent(new QObject), m_findPlugins(true)
 {
 }
 
 // ---
 
 KReportPluginEntry::KReportPluginEntry()
-    : m_loader(0), m_interface(0), m_metaData(0)
+    : m_loader(nullptr), m_interface(nullptr), m_metaData(nullptr)
 {
 }
 
 KReportPluginEntry::KReportPluginEntry(KReportPluginInterface *staticInterface)
-    : m_loader(0), m_interface(staticInterface), m_metaData(0)
+    : m_loader(nullptr), m_interface(staticInterface), m_metaData(nullptr)
 {
 }
 
 KReportPluginEntry::~KReportPluginEntry()
 {
     delete m_metaData;
     delete m_interface;
 }
 
 KReportPluginInterface* KReportPluginEntry::plugin()
 {
     if (m_interface) {
         return m_interface;
     }
     if (!m_loader) {
         kreportWarning() << "No such plugin";
-        return 0;
+        return nullptr;
     }
     if (!m_loader->load()) {
         kreportWarning() << "Could not load plugin" << m_loader->fileName();
-        return 0;
+        return nullptr;
     }
     KPluginFactory *factory = qobject_cast(m_loader->instance());
     if (!factory) {
         kreportWarning() << "Could not create factory for plugin" << m_loader->fileName();
-        return 0;
+        return nullptr;
     }
     m_interface = factory->create();
     if (!m_interface) {
         kreportWarning() << "Could not create instance of plugin" << m_loader->fileName();
-        return 0;
+        return nullptr;
     }
     m_interface->setMetaData(m_metaData);
     return m_interface;
 }
 
 void KReportPluginEntry::setBuiltIn(bool set)
 {
     m_metaData->setBuiltIn(set);
 }
 
 void KReportPluginEntry::setStatic(bool set)
 {
     m_metaData->setStatic(set);
 }
 
 const KReportPluginMetaData *KReportPluginEntry::metaData() const
 {
     return m_metaData;
 }
 
 void KReportPluginEntry::setMetaData(KReportPluginMetaData *metaData)
 {
     delete m_metaData;
     m_metaData = metaData;
     if (m_interface) {
         m_interface->setMetaData(m_metaData);
     }
 }
 
 void KReportPluginEntry::setMetaData(const QJsonObject &metaData)
 {
     setMetaData(new KReportPluginMetaData(metaData));
 }
 
 void KReportPluginEntry::setMetaData(QPluginLoader *loader)
 {
     m_loader = loader;
     setMetaData(new KReportPluginMetaData(*m_loader));
 }
 
 // ---
 
 KReportPluginManager::Private::~Private()
 {
     delete m_parent;
 }
 
 template
 void KReportPluginManager::Private::addBuiltInPlugin(const QJsonObject &json)
 {
     KReportPluginEntry *entry = new KReportPluginEntry(new PluginClass(m_parent));
     QJsonObject j = json.value(QLatin1String("MetaData")).toObject();
     //kreportDebug() << j;
     entry->setMetaData(j);
     entry->setBuiltIn(true);
     if (entry->metaData()->id().isEmpty()) {
         kreportWarning() << "Plugin" << entry->metaData()->name() << "has no identifier so won't be added to manager";
         delete entry;
         return;
     }
     entry->setStatic(true);
     m_plugins.insert(entry->metaData()->id(), entry);
     m_pluginsByLegacyName.insert(entry->metaData()->value(QLatin1String("X-KDE-PluginInfo-LegacyName"), entry->metaData()->id()), entry);
 }
 
 #define KREPORT_ADD_BUILTIN_PLUGIN(name) \
     addBuiltInPlugin(KREPORT_STATIC_PLUGIN_METADATA(name))
 
 QMap* KReportPluginManager::Private::plugins()
 {
     if (m_findPlugins) {
         findPlugins();
     }
     return &m_plugins;
 }
 
 QMap* KReportPluginManager::Private::pluginsByLegacyName()
 {
     if (m_findPlugins) {
         findPlugins();
     }
     return &m_pluginsByLegacyName;
 }
 
 void KReportPluginManager::Private::findPlugins()
 {
     KREPORT_ADD_BUILTIN_PLUGIN(KReportLabelPlugin);
     KREPORT_ADD_BUILTIN_PLUGIN(KReportCheckBoxPlugin);
     KREPORT_ADD_BUILTIN_PLUGIN(KReportFieldPlugin);
     KREPORT_ADD_BUILTIN_PLUGIN(KReportImagePlugin);
     KREPORT_ADD_BUILTIN_PLUGIN(KReportTextPlugin);
 
     //kreportDebug() << "Load all plugins";
     const QList offers = KReportJsonTrader::self()->query(QLatin1String("KReport/Element"));
     const QString expectedVersion = QString::fromLatin1("%1.%2")
             .arg(KREPORT_STABLE_VERSION_MAJOR).arg(KREPORT_STABLE_VERSION_MINOR);
     foreach(QPluginLoader *loader, offers) {
         //QJsonObject json = loader->metaData();
         //kreportDebug() << json;
         //! @todo check version
         QScopedPointer entry(new KReportPluginEntry);
         entry->setMetaData(loader);
         const KReportPluginMetaData *metaData = entry->metaData();
         if (metaData->version() != expectedVersion) {
             kreportWarning() << "KReport element plugin with ID" << metaData->id()
                              << "(" << metaData->fileName() << ")"
                              << "has version" << metaData->version() << "but expected version is"
                              << expectedVersion
                              << "-- skipping it";
             continue;
         }
         if (m_plugins.contains(metaData->id())) {
             kreportWarning() << "KReport element plugin with ID" << metaData->id()
                              << "already found at"
                              << m_plugins.value(metaData->id())->metaData()->fileName()
                              << "-- skipping another at" << metaData->fileName();
             continue;
         }
         if (!KReportPrivate::setupPrivateIconsResourceWithMessage(
             QLatin1String(KREPORT_BASE_NAME_LOWER),
             QString::fromLatin1("icons/%1_%2.rcc")
                 .arg(metaData->id()).arg(KReportPrivate::supportedIconTheme),
             QtWarningMsg,
             QString::fromLatin1(":/icons/%1").arg(metaData->id())))
         {
             continue;
         }
         addEntry(entry.take());
     }
     m_findPlugins = false;
 }
 
 void KReportPluginManager::Private::addEntry(KReportPluginEntry *entry)
 {
     m_plugins.insert(entry->metaData()->id(), entry);
     const QString legacyName(entry->metaData()->value(QLatin1String("X-KDE-PluginInfo-LegacyName"), entry->metaData()->id()));
     if (!legacyName.isEmpty() && entry->metaData()->id().startsWith(QLatin1String("org.kde.kreport"))) {
         m_pluginsByLegacyName.insert(legacyName, entry);
     }
 }
 
 // ---
 
 //! Class for access to KReportPluginManager constructor
 class KReportPluginManagerSingleton
 {
 public:
     KReportPluginManager object;
 };
 
 
 KReportPluginManager::KReportPluginManager()
     : d(new Private(this))
 {
     KReportPrivate::setupPrivateIconsResourceWithMessage(
         QLatin1String(KREPORT_BASE_NAME_LOWER),
         QString::fromLatin1("icons/kreport_%1.rcc").arg(KReportPrivate::supportedIconTheme), QtFatalMsg);
 }
 
 KReportPluginManager::~KReportPluginManager()
 {
     delete d;
 }
 
 Q_GLOBAL_STATIC(KReportPluginManagerSingleton, s_self)
 
 KReportPluginManager* KReportPluginManager::self()
 {
     return &s_self->object;
 }
 
 QStringList KReportPluginManager::pluginIds() const
 {
     return d->plugins()->keys();
 }
 
 const KReportPluginMetaData *KReportPluginManager::pluginMetaData(const QString& id) const
 {
     KReportPluginEntry *entry = d->plugins()->value(id);
     if (!entry) {
-        return 0;
+        return nullptr;
     }
     return entry->metaData();
 }
 
 KReportPluginInterface* KReportPluginManager::plugin(const QString& id) const
 {
     KReportPluginEntry *entry;
 
     entry = d->plugins()->value(id);
 
     if (!entry) {
         entry = d->pluginsByLegacyName()->value(id);
     }
 
     if (!entry) {
-        return 0;
+        return nullptr;
     }
     return entry->plugin();
 }
 
 QList KReportPluginManager::createActions(QObject *parent)
 {
     Q_ASSERT(parent);
     const QMap *plugins = d->plugins();
     QList actList;
     foreach(KReportPluginEntry* plugin, *plugins) {
         const KReportPluginMetaData *metaData = plugin->metaData();
         if (metaData) {
             QAction *act = new QAction(QIcon::fromTheme(metaData->iconName()), metaData->name(), parent);
             act->setObjectName(metaData->id());
             act->setCheckable(true);
 
             //Store the order priority in the user data field
             act->setData(metaData->priority());
             actList << act;
         }
     }
     return actList;
 }
diff --git a/src/common/KReportPluginManager.h b/src/common/KReportPluginManager.h
index 6f98c08a..d0783c25 100644
--- a/src/common/KReportPluginManager.h
+++ b/src/common/KReportPluginManager.h
@@ -1,64 +1,64 @@
 /* This file is part of the KDE project
    Copyright (C) 2010 by Adam Pigg (adam@piggz.co.uk)
    Copyright (C) 2015 Jarosław Staniek 
 
    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.1 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.
 */
 
 #ifndef KREPORTPLUGINMANAGER_H
 #define KREPORTPLUGINMANAGER_H
 
 #include "config-kreport.h"
 #include "kreport_export.h"
 
 #include 
 #include 
 
 class KReportPluginMetaData;
 class KReportPluginInterface;
 
 class QStringList;
 class QAction;
 class QString;
 
 class KREPORT_EXPORT KReportPluginManager : public QObject
 {
     Q_OBJECT
     public:
         static KReportPluginManager* self();
 
         QStringList pluginIds() const;
 
         const KReportPluginMetaData *pluginMetaData(const QString& id) const;
 
         KReportPluginInterface* plugin(const QString& id) const;
 
         QList createActions(QObject *parent) Q_REQUIRED_RESULT;
 
     private:
         // class for access to the constructor
         friend class KReportPluginManagerSingleton;
 
         KReportPluginManager();
 
-        ~KReportPluginManager();
+        ~KReportPluginManager() override;
 
         Q_DISABLE_COPY(KReportPluginManager)
         class Private;
         Private *const d;
 };
 
 #endif // KREPORTPLUGINMANAGER_H
diff --git a/src/common/KReportRenderObjects.cpp b/src/common/KReportRenderObjects.cpp
index 3d2a63ac..afb37655 100644
--- a/src/common/KReportRenderObjects.cpp
+++ b/src/common/KReportRenderObjects.cpp
@@ -1,968 +1,968 @@
 /* This file is part of the KDE project
  * Copyright (C) 2001-2007 by OpenMFG, LLC (info@openmfg.com)
  * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 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
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library.  If not, see .
  */
 #include "KReportRenderObjects.h"
 #include "KReportUtils_p.h"
 
 #include "kreport_debug.h"
 
 // Helper functions
 static bool xLessThan(OROPrimitive* s1, OROPrimitive* s2)
 {
     return s1->position().x() < s2->position().x();
 }
 
 //
 // ORODocument
 //
 
 class Q_DECL_HIDDEN ORODocument::Private
 {
 public:
     Private();
     ~Private();
     QString title;
     QList pages;
     QList sections;
     KReportPrivate::PageLayout pageLayout;
 };
 
 ORODocument::Private::Private()
 {
 
 }
 
 ORODocument::Private::~Private()
 {
     qDeleteAll(pages);
     qDeleteAll(sections);
 }
 
 
 ORODocument::ORODocument(const QString& title) : d(new Private())
 {
     d->title = title;
 }
 
 ORODocument::~ORODocument()
 {
     delete d;
 }
 
 void ORODocument::setTitle(const QString &title)
 {
     d->title = title;
 }
 
 OROPage* ORODocument::page(int index)
 {
     return d->pages.value(index);
 }
 
 const OROPage * ORODocument::page(int index) const
 {
     return d->pages.value(index);
 }
 
 void ORODocument::addPage(OROPage* p)
 {
-    if (p == 0) {
+    if (p == nullptr) {
         return;
     }
 
-    if (p->document() != 0 && p->document() != this) {
+    if (p->document() != nullptr && p->document() != this) {
         return;
     }
 
     p->setDocument(this);
     d->pages.append(p);
 }
 
 OROSection* ORODocument::section(int pnum)
 {
     return d->sections.value(pnum);
 }
 
 const OROSection * ORODocument::section(int index) const
 {
     return d->sections.value(index);
 }
 
 
 void ORODocument::addSection(OROSection* s)
 {
-    if (s == 0)
+    if (s == nullptr)
         return;
 
-    if (s->document() != 0 && s->document() != this) {
+    if (s->document() != nullptr && s->document() != this) {
         return;
     }
     s->setDocument(this);
     d->sections.append(s);
 }
 
 void ORODocument::setPageLayout(const QPageLayout & options)
 {
     d->pageLayout = options;
 }
 
 void ORODocument::notifyChange(int pageNo)
 {
     emit(updated(pageNo));
 }
 
 QPageLayout ORODocument::pageLayout() const
 {
     return d->pageLayout;
 }
 
 int ORODocument::pageCount() const
 {
     return d->pages.count();
 }
 
 int ORODocument::sectionCount() const
 {
     return d->sections.count();
 }
 
 QString ORODocument::title() const
 {
     return d->title;
 }
 
 void ORODocument::removePage(OROPage* page)
 {
     d->pages.removeOne(page);
     delete page;
 }
 
 void ORODocument::takePage(OROPage* page)
 {
     d->pages.removeOne(page);
 }
 
 void ORODocument::removeSection(OROSection* section)
 {
     d->sections.removeOne(section);
     delete section;
 }
 
 void ORODocument::takeSection(OROSection* section)
 {
     d->sections.removeOne(section);
 }
 
 int ORODocument::pageIndex(const OROPage* page) const
 {
     return d->pages.indexOf(const_cast(page));
 }
 
 //
 // OROPage
 //
 class Q_DECL_HIDDEN OROPage::Private
 {
 public:
     Private();
     ~Private();
     ORODocument *document;
     QList primitives;
 };
 
 OROPage::Private::Private()
 {
 }
 
 OROPage::Private::~Private()
 {
     qDeleteAll(primitives);
 }
 
 OROPage::OROPage(ORODocument * pDocument)
         : d(new Private())
 {
     d->document = pDocument;
 }
 
 OROPage::~OROPage()
 {
     if (d->document) {
         d->document->takePage(this);
     }
     delete d;
 }
 
 int OROPage::pageNumber() const
 {
     if (d->document) {
         return d->document->pageIndex(this);
     }
     return -1;
 }
 
 OROPrimitive* OROPage::primitive(int index)
 {
     return d->primitives.value(index);
 }
 
 const OROPrimitive * OROPage::primitive(int index) const
 {
     return d->primitives.value(index);
 }
 
 
 void OROPage::insertPrimitive(OROPrimitive* p, int index)
 {
     //kreportDebug() << "Adding primitive" << p->type() << "to page" << page();
-    if (p == 0)
+    if (p == nullptr)
         return;
 
     p->setPage(this);
     if (index == -1) {
         d->primitives.append(p);
     } else {
         d->primitives.insert(index, p);
     }
 
 #if 0
 //TODO
     if (notify) {
         if (d->document) {
             d->document->notifyChange(pageNumber());
         }
     }
 #endif
 }
 
 ORODocument * OROPage::document()
 {
     return d->document;
 }
 
 const ORODocument * OROPage::document() const
 {
     return d->document;
 }
 
 int OROPage::primitiveCount() const
 {
     return d->primitives.count();
 }
 
 void OROPage::setDocument(ORODocument* doc)
 {
     d->document = doc;
 }
 
 void OROPage::removePrimitive(OROPrimitive* primitive)
 {
     d->primitives.removeOne(primitive);
     delete primitive;
 }
 
 void OROPage::takePrimitive(OROPrimitive* primitive)
 {
     d->primitives.removeOne(primitive);
 }
 
 //
 // OROSection
 //
 
 class Q_DECL_HIDDEN OROSection::Private
 {
 public:
     Private();
     ~Private();
     ORODocument * document;
     QList primitives;
     qint64 row = 0;
     int height = 0;
     KReportSectionData::Section type = KReportSectionData::None;
     QColor backgroundColor = Qt::white;
 };
 
 OROSection::Private::Private()
 {
 
 }
 
 OROSection::Private::~Private()
 {
     qDeleteAll(primitives);
     primitives.clear();
 }
 
 OROSection::OROSection(ORODocument* doc) : d(new Private())
 {
     d->document = doc;
 }
 
 OROSection::~OROSection()
 {
     if (d->document) {
         d->document->takeSection(this);
     }
 
     delete d;
 }
 
 OROPrimitive* OROSection::primitive(int index)
 {
     return d->primitives.value(index);
 }
 
 const OROPrimitive * OROSection::primitive(int index) const
 {
     return d->primitives.value(index);
 }
 
 void OROSection::addPrimitive(OROPrimitive* primitive)
 {
-    if (primitive == 0)
+    if (primitive == nullptr)
         return;
 
     d->primitives.append(primitive);
 }
 
 void OROSection::setHeight(int h)
 {
     d->height = h;
 }
 
 int OROSection::height() const
 {
     return d->height;
 }
 
 void OROSection::setBackgroundColor(const QColor& color)
 {
     d->backgroundColor = color;
 }
 
 QColor OROSection::backgroundColor() const
 {
     return d->backgroundColor;
 }
 
 void OROSection::sortPrimitives(Qt::Orientation orientation)
 {
     if (orientation == Qt::Horizontal) {
         qSort(d->primitives.begin(), d->primitives.end(), xLessThan);
     }
 }
 
 ORODocument * OROSection::document()
 {
     return d->document;
 }
 
 const ORODocument * OROSection::document() const
 {
     return d->document;
 }
 
 
 int OROSection::primitiveCount() const
 {
     return d->primitives.count();
 }
 
 void OROSection::setType(KReportSectionData::Section t)
 {
     d->type = t;
 }
 
 KReportSectionData::Section OROSection::type() const
 {
     return d->type;
 }
 
 void OROSection::setDocument(ORODocument* doc)
 {
     d->document = doc;
 }
 
 //
 // OROPrimitive
 //
 
 class Q_DECL_HIDDEN OROPrimitive::Private
 {
 public:
     OROPage * page = nullptr;
     QPointF position;
     QSizeF size;
 };
 
 OROPrimitive::OROPrimitive()
         : d(new Private())
 {
 }
 
 OROPrimitive::~OROPrimitive()
 {
    if (d->page) {
         d->page->takePrimitive(this);
     }
 
     delete d;
 }
 
 void OROPrimitive::setPosition(const QPointF& pos)
 {
     d->position = pos;
 }
 
 void OROPrimitive::setSize(const QSizeF & s)
 {
     d->size = s;
 }
 
 OROPage * OROPrimitive::page()
 {
     return d->page;
 }
 
 const OROPage * OROPrimitive::page() const
 {
     return d->page;
 }
 
 QPointF OROPrimitive::position() const
 {
     return d->position;
 }
 
 QSizeF OROPrimitive::size() const
 {
     return d->size;
 }
 
 void OROPrimitive::setPage(OROPage* page)
 {
     d->page = page;
 }
 
 //
 // OROTextBox
 //
 
 class Q_DECL_HIDDEN OROTextBox::Private
 {
 public:
     Private();
     ~Private();
     QString text;
     KReportTextStyleData textStyle;
     KReportLineStyle lineStyle;
     Qt::Alignment alignment;
     int flags; // Qt::AlignmentFlag and Qt::TextFlag OR'd
     bool wordWrap;
     bool canGrow;
     bool requiresPostProcessing;
 
 };
 
 OROTextBox::Private::Private()
 {
     flags = 0;
     wordWrap = false;
     canGrow = false;
     requiresPostProcessing = false;
 
     lineStyle.setColor(Qt::black);
     lineStyle.setWeight(0);
     lineStyle.setPenStyle(Qt::NoPen);
 }
 
 OROTextBox::Private::~Private()
 {
 }
 
 OROTextBox::OROTextBox() : d(new Private())
 {
 
 }
 
 OROTextBox::~OROTextBox()
 {
     delete d;
 }
 
 void OROTextBox::setText(const QString & s)
 {
     d->text = s;
 }
 
 void OROTextBox::setTextStyle(const KReportTextStyleData & ts)
 {
     d->textStyle = ts;
 }
 
 void OROTextBox::setLineStyle(const KReportLineStyle & ls)
 {
     d->lineStyle = ls;
 }
 
 void OROTextBox::setFont(const QFont & f)
 {
     d->textStyle.font = f;
 }
 
 void OROTextBox::setFlags(int f)
 {
     d->flags = f;
 }
 
 bool OROTextBox::canGrow() const
 {
     return d->canGrow;
 }
 
 int OROTextBox::flags() const
 {
     return d->flags;
 }
 
 KReportLineStyle OROTextBox::lineStyle() const
 {
     return d->lineStyle;
 }
 
 bool OROTextBox::requiresPostProcessing() const
 {
     return d->requiresPostProcessing;
 }
 
 void OROTextBox::setCanGrow(bool grow)
 {
     d->canGrow = grow;
 }
 
 void OROTextBox::setRequiresPostProcessing(bool pp)
 {
     d->requiresPostProcessing = pp;
 }
 
 void OROTextBox::setWordWrap(bool ww)
 {
     d->wordWrap = ww;
 }
 
 QString OROTextBox::text() const
 {
     return d->text;
 }
 
 KReportTextStyleData OROTextBox::textStyle() const
 {
     return d->textStyle;
 }
 
 bool OROTextBox::wordWrap() const
 {
     return d->wordWrap;
 }
 
 OROPrimitive* OROTextBox::clone() const
 {
     OROTextBox *theClone = new OROTextBox();
     theClone->setSize(size());
     theClone->setPosition(position());
     theClone->setText(text());
     theClone->setTextStyle(textStyle());
     theClone->setLineStyle(lineStyle());
     theClone->setFlags(flags());
     theClone->setCanGrow(canGrow());
     theClone->setWordWrap(wordWrap());
     theClone->setRequiresPostProcessing(requiresPostProcessing());
     return theClone;
 }
 
 
 //
 // OROLine
 //
 
 class Q_DECL_HIDDEN OROLine::Private
 {
 public:
     QPointF endPoint;
     KReportLineStyle lineStyle;
 };
 
 OROLine::OROLine() : d(new Private())
 {
 
 }
 
 OROLine::~OROLine()
 {
     delete d;
 }
 
 void OROLine::setStartPoint(const QPointF & p)
 {
     setPosition(p);
 }
 
 void OROLine::setEndPoint(const QPointF & p)
 {
     d->endPoint = p;
 }
 
 void OROLine::setLineStyle(const KReportLineStyle& style)
 {
     d->lineStyle = style;
 }
 
 QPointF OROLine::endPoint() const
 {
     return d->endPoint;
 }
 
 KReportLineStyle OROLine::lineStyle() const
 {
     return d->lineStyle;
 }
 
 OROPrimitive* OROLine::clone() const
 {
     OROLine *theClone = new OROLine();
     theClone->setStartPoint(position());
     theClone->setEndPoint(endPoint());
     theClone->setLineStyle(lineStyle());
     return theClone;
 }
 
 //
 // OROImage
 //
 
 class Q_DECL_HIDDEN OROImage::Private
 {
 public:
     QImage image;
     bool scaled;
     Qt::TransformationMode transformFlags;
     Qt::AspectRatioMode aspectFlags;
 };
 
 OROImage::OROImage() : d(new Private())
 {
     d->scaled = false;
     d->transformFlags = Qt::FastTransformation;
     d->aspectFlags = Qt::IgnoreAspectRatio;
 }
 
 OROImage::~OROImage()
 {
     delete d;
 }
 
 void OROImage::setImage(const QImage & img)
 {
     d->image = img;
 }
 
 void OROImage::setScaled(bool b)
 {
     d->scaled = b;
 }
 
 void OROImage::setTransformationMode(Qt::TransformationMode transformation)
 {
     d->transformFlags = transformation;
 }
 
 void OROImage::setAspectRatioMode(Qt::AspectRatioMode aspectRatioMode)
 {
     d->aspectFlags = aspectRatioMode;
 }
 
 Qt::AspectRatioMode OROImage::aspectRatioMode() const
 {
     return d->aspectFlags;
 }
 
 QImage OROImage::image() const
 {
     return d->image;
 }
 
 bool OROImage::isScaled() const
 {
     return d->scaled;
 }
 
 Qt::TransformationMode OROImage::transformationMode() const
 {
     return d->transformFlags;
 }
 
 OROPrimitive* OROImage::clone() const
 {
     OROImage *theClone = new OROImage();
     theClone->setSize(size());
     theClone->setPosition(position());
     theClone->setImage(image());
     theClone->setScaled(isScaled());
     theClone->setTransformationMode(transformationMode());
     theClone->setAspectRatioMode(aspectRatioMode());
     return theClone;
 }
 
 //
 // OROPicture
 //
 
 class Q_DECL_HIDDEN OROPicture::Private
 {
 public:
     QPicture picture;
 };
 
 OROPicture::OROPicture() : d(new Private())
 {
 
 }
 
 OROPicture::~OROPicture()
 {
     delete d;
 }
 
 OROPrimitive* OROPicture::clone() const
 {
     OROPicture *theClone = new OROPicture();
     theClone->setSize(size());
     theClone->setPosition(position());
 //     theClone->setPicture(*(picture()ddddddds));
     return theClone;
 }
 
 QPicture* OROPicture::picture()
 {
     return &d->picture;
 }
 
 void OROPicture::setPicture(const QPicture& p)
 {
     d->picture = p;
 }
 
 //
 // ORORect
 //
 
 class Q_DECL_HIDDEN ORORect::Private
 {
 public:
     QPen pen;
     QBrush brush;
 };
 
 ORORect::ORORect() : d(new Private())
 {
 }
 
 ORORect::~ORORect()
 {
     delete d;
 }
 
 void ORORect::setRect(const QRectF & r)
 {
     setPosition(r.topLeft());
     setSize(r.size());
 }
 
 void ORORect::setPen(const QPen & p)
 {
     d->pen = p;
 }
 
 void ORORect::setBrush(const QBrush & b)
 {
     d->brush = b;
 }
 
 QBrush ORORect::brush() const
 {
     return d->brush;
 }
 
 QPen ORORect::pen() const
 {
     return d->pen;
 }
 
 QRectF ORORect::rect() const
 {
     return QRectF(position(), size());
 }
 
 OROPrimitive* ORORect::clone() const
 {
     ORORect *theClone = new ORORect();
     theClone->setSize(size());
     theClone->setPosition(position());
     theClone->setPen(pen());
     theClone->setBrush(brush());
     return theClone;
 }
 //
 // OROEllipse
 //
 
 class Q_DECL_HIDDEN OROEllipse::Private
 {
 public:
     QPen pen;
     QBrush brush;
 };
 
 OROEllipse::OROEllipse() : d(new Private())
 {
 }
 
 OROEllipse::~OROEllipse()
 {
     delete d;
 }
 
 void OROEllipse::setRect(const QRectF & r)
 {
     setPosition(r.topLeft());
     setSize(r.size());
 }
 
 void OROEllipse::setPen(const QPen & p)
 {
     d->pen = p;
 }
 
 void OROEllipse::setBrush(const QBrush & b)
 {
     d->brush = b;
 }
 
 QBrush OROEllipse::brush() const
 {
     return d->brush;
 }
 
 QPen OROEllipse::pen() const
 {
     return d->pen;
 }
 
 QRectF OROEllipse::rect() const
 {
     return QRectF(position(), size());
 }
 
 OROPrimitive* OROEllipse::clone() const
 {
     OROEllipse *theClone = new OROEllipse();
     theClone->setSize(size());
     theClone->setPosition(position());
     theClone->setPen(pen());
     theClone->setBrush(brush());
     return theClone;
 }
 
 //
 // OROCheck
 //
 
 class Q_DECL_HIDDEN OROCheckBox::Private
 {
 public:
     OROCheckBox::Type checkType;
     bool value;
     KReportLineStyle lineStyle;
     QColor foregroundColor;
 };
 
 OROCheckBox::OROCheckBox() : d(new Private())
 {
     d->value = false;
 }
 
 OROCheckBox::~OROCheckBox()
 {
     delete d;
 }
 
 OROCheckBox::Type OROCheckBox::checkType() const
 {
     return d->checkType;
 }
 
 QColor OROCheckBox::foregroundColor() const
 {
     return d->foregroundColor;
 }
 
 KReportLineStyle OROCheckBox::lineStyle() const
 {
     return d->lineStyle;
 }
 
 void OROCheckBox::setForegroundColor(const QColor& fg)
 {
     d->foregroundColor = fg;
 }
 
 void OROCheckBox::setLineStyle(const KReportLineStyle& ls)
 {
     d->lineStyle = ls;
 }
 
 void OROCheckBox::setValue(bool v)
 {
     d->value = v;
 }
 
 bool OROCheckBox::value() const
 {
     return d->value;
 }
 
 void OROCheckBox::setCheckType(Type type)
 {
     if (type == Cross || type == Tick || type == Dot) {
         d->checkType = type;
     } else {
         d->checkType = Cross;
     }
 }
 
 OROPrimitive* OROCheckBox::clone() const
 {
     OROCheckBox *theClone = new OROCheckBox();
     theClone->setSize(size());
     theClone->setPosition(position());
     theClone->setLineStyle(lineStyle());
     theClone->setForegroundColor(foregroundColor());
     theClone->setValue(value());
     theClone->setCheckType(checkType());
     return theClone;
 }
diff --git a/src/common/KReportRenderObjects.h b/src/common/KReportRenderObjects.h
index b2a633d6..afb4de50 100644
--- a/src/common/KReportRenderObjects.h
+++ b/src/common/KReportRenderObjects.h
@@ -1,462 +1,462 @@
 /* This file is part of the KDE project
  * Copyright (C) 2001-2007 by OpenMFG, LLC (info@openmfg.com)
  * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 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
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library.  If not, see .
  */
 #ifndef KREPORTRENDEROBJECTS_H
 #define KREPORTRENDEROBJECTS_H
 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 
 #include "KReportDataSource.h"
 #include "KReportItemBase.h"
 #include "KReportSectionData.h"
 #include "KReportLineStyle.h"
 
 class ORODocument;
 class OROPage;
 class OROPrimitive;
 class OROTextBox;
 class OROLine;
 class OROImage;
 class OROSection;
 
 //
 // ORODocument
 // This object is a single document containing one or more OROPage elements
 //
 class KREPORT_EXPORT ORODocument : public QObject
 {
     Q_OBJECT
 
 public:
     explicit ORODocument(const QString &title = QString());
-    ~ORODocument();
+    ~ORODocument() override;
 
     QString title() const;
     void setTitle(const QString &title);
 
     
     /**
      * @brief Return the total number of pages in the document
      * 
      */
     int pageCount() const;
     
     /**
      * @brief Return a pointer to a given page
      * 
      * @param index page number to find
      * @return OROPage*
      */
     OROPage* page(int index);
     const OROPage* page(int index) const;
     
     /**
      * @brief Adds the supplied page to this document
      * 
      * Ownership of the page is tranferred the document
      * 
      * @param page an OROPage* to be added
      */
     void addPage(OROPage* page);
     
     /**
      * @brief Returns the index of the supplied page in the document
      * 
      * @param page OROPage* to find
      * @return int page index
      */
     int pageIndex(const OROPage* page) const;
     
     /**
      * @brief Removes the given page from the document
      * 
      * The page is also deleted
      * 
      * @param page OROPage* to delete
      */
     void removePage(OROPage* page);
 
     /**
      * @brief Takes the page from the document but does not delete it
      * 
      * @param page OROPage* to take from the document
      */
     void takePage(OROPage *page);
     
     /**
      * @brief Return the total number of sections in the document
      * 
      */
     int sectionCount() const;
     
     /**
      * @brief Return a pointer to a given section
      * 
      * @param index section number to find
      * @return OROSection*
      */
     OROSection* section(int index);
     const OROSection* section(int index) const;
     
     /**
      * @brief Adds the supplied sectin to the document
      * 
      * Ownership of the section is transferred to the document
      * 
      * @param section OROSection* to add to the document
      */
     void addSection(OROSection* section);
     
     /**
      * @brief Removes the supplied section from the document
      * 
      * The section will also be deleted
      * 
      * @param section OROSection* to remove and delete
      */
     void removeSection(OROSection *section);
     
     /**
      * @brief Takes the section from the document but does not delete it
      * 
      * @param page OROSection* to take from the document
      */
     void takeSection(OROSection *section);
     
     void setPageLayout(const QPageLayout &layout);
     QPageLayout pageLayout() const;
 
     void notifyChange(int pageNo);
     
 Q_SIGNALS:
     void updated(int pageNo);
     
 private:
     class Private;
     Private * const d;
 };
 
 //
 // OROPage
 // This object is a single page in a document and may contain zero or more
 // OROPrimitive objects all of which represent some form of mark to made on
 // a page.
 //
 class KREPORT_EXPORT OROPage
 {
 public:
-    explicit OROPage(ORODocument * doc = 0);
+    explicit OROPage(ORODocument * doc = nullptr);
     ~OROPage();
 
     ORODocument* document();
     const ORODocument* document() const;
     void setDocument(ORODocument *doc);
     
     int pageNumber() const; // returns this pages current page number
 
     int primitiveCount() const;
     
     OROPrimitive* primitive(int index);
     const OROPrimitive* primitive(int index) const;
     
     void insertPrimitive(OROPrimitive* primitive, int index = -1);
     void removePrimitive(OROPrimitive *primitive);
     void takePrimitive(OROPrimitive *primitive);
 
 private:
     class Private;
     Private * const d;
 };
 //
 // OROSection
 // This object is a single row in a document and may contain zero or more
 // OROPrimitives
 //
 class KREPORT_EXPORT OROSection
 {
 public:
-    explicit OROSection(ORODocument* doc = 0);
+    explicit OROSection(ORODocument* doc = nullptr);
     ~OROSection();
 
     void setHeight(int);
     int height() const;
 
     void setBackgroundColor(const QColor& color);
     QColor backgroundColor() const;
 
     ORODocument* document();
     const ORODocument* document() const;
     void setDocument(ORODocument *doc);
 
     void setType(KReportSectionData::Section t);
     KReportSectionData::Section type() const;
 
     int primitiveCount() const;
     OROPrimitive* primitive(int index);
     const OROPrimitive* primitive(int index) const;
     void addPrimitive(OROPrimitive* primitive);
     void sortPrimitives(Qt::Orientation orientation);
 
 private:
     class Private;
     Private * const d;
 };
 
 
 //
 // OROPrimitive
 // This object represents the basic primitive with a position and type.
 // Other primitives are subclasses with a defined type and any additional
 // information they require to define that primitive.
 //
 class KREPORT_EXPORT OROPrimitive
 {
 public:
     virtual ~OROPrimitive();
 
     OROPage* page();
     const OROPage* page() const;
     void setPage(OROPage *page);
 
     QPointF position() const;
     void setPosition(const QPointF &pos);
     
     QSizeF size() const;
     void setSize(const QSizeF &s);
 
     virtual OROPrimitive* clone() const = 0;
     
 protected:
     OROPrimitive();
     
 private:
     class Private;
     Private * const d;
 };
 
 //
 // OROTextBox
 // This is a text box primitive it defines a box region and text that will
 // be rendered inside that region. It also contains information for font
 // and positioning of the text.
 //
 class KREPORT_EXPORT OROTextBox : public OROPrimitive
 {
 public:
     OROTextBox();
-    virtual ~OROTextBox();
+    ~OROTextBox() override;
 
     QString text() const;
     void setText(const QString &text);
 
     KReportTextStyleData textStyle() const;
     void setTextStyle(const KReportTextStyleData&);
 
     KReportLineStyle lineStyle() const;
     void setLineStyle(const KReportLineStyle&);
 
     void setFont(const QFont &font);
 
     int flags() const;
     void setFlags(int flags);
 
-    virtual OROPrimitive* clone() const;
+    OROPrimitive* clone() const override;
 
     bool requiresPostProcessing() const;
     void setRequiresPostProcessing(bool pp);
 
     bool wordWrap() const;
     void setWordWrap(bool ww);
 
     bool canGrow() const;
     void setCanGrow(bool grow);
     
 private:
     class Private;
     Private * const d;
 };
 
 //
 // OROLine
 // This primitive defines a line with a width/weight.
 //
 class KREPORT_EXPORT OROLine : public OROPrimitive
 {
 public:
     OROLine();
-    virtual ~OROLine();
+    ~OROLine() override;
 
     QPointF startPoint() const {
         return position();
     };
     void setStartPoint(const QPointF &start);
 
     QPointF endPoint() const;
     void setEndPoint(const QPointF &end);
 
     KReportLineStyle lineStyle() const;
     void setLineStyle(const KReportLineStyle& style);
 
-    virtual OROPrimitive* clone() const;
+    OROPrimitive* clone() const override;
     
 private:
     class Private;
     Private * const d;
 };
 
 //
 // OROImage
 // This primitive defines an image
 //
 class KREPORT_EXPORT OROImage: public OROPrimitive
 {
 public:
     OROImage();
-    virtual ~OROImage();
+    ~OROImage() override;
 
     QImage image() const;
     void setImage(const QImage &img);
 
     bool isScaled() const;
     void setScaled(bool scaled);
 
     Qt::TransformationMode transformationMode() const;
     void setTransformationMode(Qt::TransformationMode transformation);
 
     Qt::AspectRatioMode aspectRatioMode() const;
     void setAspectRatioMode(Qt::AspectRatioMode aspect);
 
-    virtual OROPrimitive* clone() const;
+    OROPrimitive* clone() const override;
     
 private:
     class Private;
     Private * const d;
 };
 
 //
 // OROPicture
 // This primitive defines a picture
 //
 class KREPORT_EXPORT OROPicture: public OROPrimitive
 {
 public:
     OROPicture();
-    virtual ~OROPicture();
+    ~OROPicture() override;
 
     void setPicture(const QPicture& pic);
     QPicture* picture();
 
-    virtual OROPrimitive* clone() const;
+    OROPrimitive* clone() const override;
     
 private:
     class Private;
     Private * const d;
 
 };
 //
 // ORORect
 // This primitive defines a drawn rectangle
 //
 class KREPORT_EXPORT ORORect: public OROPrimitive
 {
 public:
     ORORect();
-    virtual ~ORORect();
+    ~ORORect() override;
 
     QRectF rect() const;
     void setRect(const QRectF &rectangle);
 
     QPen pen() const;
     void setPen(const QPen &pen);
 
     QBrush brush() const;
     void setBrush(const QBrush &brush);
 
-    virtual OROPrimitive* clone() const;
+    OROPrimitive* clone() const override;
     
 private:
     class Private;
     Private * const d;
 };
 
 //
 // ORORect
 // This primitive defines a drawn rectangle
 //
 class KREPORT_EXPORT OROEllipse: public OROPrimitive
 {
 public:
     OROEllipse();
-    virtual ~OROEllipse();
+    ~OROEllipse() override;
 
     QRectF rect() const;
     void setRect(const QRectF &rectangle);
 
     QPen pen() const;
     void setPen(const QPen &pen);
 
     QBrush brush() const;
     void setBrush(const QBrush &brush);
 
-    virtual OROPrimitive* clone() const;
+    OROPrimitive* clone() const override;
     
 private:
     class Private;
     Private * const d;
 };
 
 class KREPORT_EXPORT OROCheckBox : public OROPrimitive
 {
 public:
     enum Type {
         Cross = 1,
         Tick,
         Dot
     };
     
     OROCheckBox();
-    virtual ~OROCheckBox();
-    virtual OROPrimitive* clone() const;
+    ~OROCheckBox() override;
+    OROPrimitive* clone() const override;
 
     void setCheckType(Type type);
     Type checkType() const;
 
     void setValue(bool val);
     bool value() const;
 
     void setLineStyle(const KReportLineStyle& ls);
     KReportLineStyle lineStyle() const;
     
     void setForegroundColor(const QColor& fg);
     QColor foregroundColor() const;
 
 private:
     class Private;
     Private * const d;
 
 };
 
 #endif // __RENDEROBJECTS_H__
diff --git a/src/common/KReportSectionData.h b/src/common/KReportSectionData.h
index f136fefd..84f7a278 100644
--- a/src/common/KReportSectionData.h
+++ b/src/common/KReportSectionData.h
@@ -1,119 +1,119 @@
 /* This file is part of the KDE project
  * Copyright (C) 2001-2007 by OpenMFG, LLC (info@openmfg.com)
  * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
  * Copyright (C) 2010 Jarosław Staniek 
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 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
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library.  If not, see .
  */
 
 
 #ifndef KREPORTSECTIONDATA_H
 #define KREPORTSECTIONDATA_H
 
 #include 
 
 #include 
 
 class KReportItemBase;
 class KReportDocument;
 class QDomElement;
 
 namespace Scripting
 {
 class Section;
 }
 
 //
 // KReportSectionData is used to store the information about a specific
 // section.
 // A section has a name and optionally extra data. `name'
 // reportheader, reportfooter, pageheader, pagefooter, groupheader, groupfooter or detail.
 // In the case of pghead and pgfoot extra would contain the page
 // designation (firstpage, odd, even or lastpage).
 class KReportSectionData : public QObject
 {
     Q_OBJECT
 public:
     enum Section {
         None = 0,
         PageHeaderFirst = 1,
         PageHeaderOdd,
         PageHeaderEven,
         PageHeaderLast,
         PageHeaderAny,
         ReportHeader,
         ReportFooter,
         PageFooterFirst,
         PageFooterOdd,
         PageFooterEven,
         PageFooterLast,
         PageFooterAny,
         GroupHeader,
         GroupFooter,
         Detail
     };
 
-    explicit KReportSectionData(QObject* parent = 0);
+    explicit KReportSectionData(QObject* parent = nullptr);
     KReportSectionData(const QDomElement &, KReportDocument* report);
-    ~KReportSectionData();
+    ~KReportSectionData() override;
     KPropertySet* propertySet() const {
         return m_set;
     }
 
     bool isValid() const {
         return m_valid;
     }
 
     qreal height() const {
         return m_height->value().toDouble();
     }
 
     QList objects() const {
         return m_objects;
     }
 
     QString name() const;
 
     QColor backgroundColor() const {
         return m_backgroundColor->value().value();
     }
 
     Section type() const {
         return m_type;
     }
 
     static KReportSectionData::Section sectionTypeFromString(const QString& s);
     static QString sectionTypeString(KReportSectionData::Section s);
 protected:
     KPropertySet *m_set;
     KProperty *m_height;
     KProperty *m_backgroundColor;
 
 private:
     void createProperties(const QDomElement & elemSource);
 
     QList m_objects;
 
     Section m_type;
 
     static bool zLessThan(KReportItemBase* s1, KReportItemBase* s2);
     static bool xLessThan(KReportItemBase* s1, KReportItemBase* s2);
 
     bool m_valid;
 
     friend class Scripting::Section;
     friend class KReportDesignerSection;
 };
 
 #endif
diff --git a/src/common/KReportUnit.h b/src/common/KReportUnit.h
index 87ed739c..31d95a46 100644
--- a/src/common/KReportUnit.h
+++ b/src/common/KReportUnit.h
@@ -1,265 +1,265 @@
 /* This file is part of the KDE project
    Copyright (C) 1998, 1999 Reginald Stadlbauer 
    Copyright (C) 1998, 1999 Torben Weis 
    Copyright (C) 2004, Nicolas GOUTTE 
    Copyright (C) 2010 Thomas Zander 
    Copyright 2012 Friedrich W. H. Kossebau 
 
    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.
 */
 
 #ifndef KREPORTUNIT_H
 #define KREPORTUNIT_H
 
 #include  // for floor
 
 #include 
 #include 
 #include 
 
 #include "kreport_export.h"
 
 class QStringList;
 
 // 1 inch ^= 72 pt
 // 1 inch ^= 25.399956 mm (-pedantic ;p)
 // 1 pt = 1/12 pi
 // 1 pt ^= 0.0077880997 cc
 // 1 cc = 12 dd
 // Note: I don't use division but multiplication with the inverse value
 // because it's faster ;p (Werner)
 #define POINT_TO_MM(px) qreal((px)*0.352777167)
 #define MM_TO_POINT(mm) qreal((mm)*2.83465058)
 #define POINT_TO_CM(px) qreal((px)*0.0352777167)
 #define CM_TO_POINT(cm) qreal((cm)*28.3465058)
 #define POINT_TO_DM(px) qreal((px)*0.00352777167)
 #define DM_TO_POINT(dm) qreal((dm)*283.465058)
 #define POINT_TO_INCH(px) qreal((px)*0.01388888888889)
 #define INCH_TO_POINT(inch) qreal((inch)*72.0)
 #define MM_TO_INCH(mm) qreal((mm)*0.039370147)
 #define INCH_TO_MM(inch) qreal((inch)*25.399956)
 #define POINT_TO_PI(px) qreal((px)*0.083333333)
 #define POINT_TO_CC(px) qreal((px)*0.077880997)
 #define PI_TO_POINT(pi) qreal((pi)*12)
 #define CC_TO_POINT(cc) qreal((cc)*12.840103)
 /**
  * %KReport stores everything in pt (using "qreal") internally.
  * When displaying a value to the user, the value is converted to the user's unit
  * of choice, and rounded to a reasonable precision to avoid 0.999999
  *
  * For implementing the selection of a unit type in the UI use the *ForUi() methods.
  * They ensure the same order of the unit types in all places, with the order not
  * bound to the order in the enum (so ABI-compatible extension is possible) and
  * with the order and scope of listed types controlled by the @c ListOptions parameter.
  */
 class KREPORT_EXPORT KReportUnit
 {
 public:
     /** Length units supported by %KReport. */
     enum Type {
         Millimeter = 0,
         Point,  ///< Postscript point, 1/72th of an Inco
         Inch,
         Centimeter,
         Decimeter,
         Pica,
         Cicero,
         Pixel,
         TypeCount ///< @internal
     };
 
     /// Used to control the scope of the unit types listed in the UI
     enum ListOption {
         ListAll = 0,
         HidePixel = 1,
         HideMask = HidePixel
     };
      Q_DECLARE_FLAGS(ListOptions, ListOption)
 
     /** Construction requires initialization. The factor is for variable factor units like pixel */
     explicit KReportUnit(Type type = Point, qreal factor = 1.0);
     
     KReportUnit(const KReportUnit &other);
     
     ~KReportUnit();
 
     /// Assigns specified type and factor 1.0 to the object
     /// @param unit Type of unit
     KReportUnit& operator=(Type type);
     
     KReportUnit& operator=(const KReportUnit& other);
      
     bool operator!=(const KReportUnit &other) const;
 
     bool operator==(const KReportUnit &other) const;
 
     KReportUnit::Type type() const;
 
     void setFactor(qreal factor);
     
     qreal factor() const;
     
     /** Returns a KReportUnit instance with the type at the @p index of the UI list with the given @p listOptions. */
     static KReportUnit fromListForUi(int index, ListOptions listOptions = ListAll, qreal factor = 1.0);
 
     /// Convert a unit symbol string into a KReportUnit
     /// @param symbol symbol to convert
     /// @param ok if set, it will be true if the unit was known, false if unknown
-    static KReportUnit fromSymbol(const QString &symbol, bool *ok = 0);
+    static KReportUnit fromSymbol(const QString &symbol, bool *ok = nullptr);
 
     /**
      * Prepare ptValue to be displayed in pt
      * This method will round to 0.001 precision
      */
     static inline qreal toPoint(qreal ptValue)
     {
         // No conversion, only rounding (to 0.001 precision)
         return floor(ptValue * 1000.0) / 1000.0;
     }
 
     /**
      * Prepare ptValue to be displayed in mm
      * This method will round to 0.0001 precision, use POINT_TO_MM() for lossless conversion.
      */
     static inline qreal toMillimeter(qreal ptValue)
     {
         // "mm" values are rounded to 0.0001 millimeters
         return floor(POINT_TO_MM(ptValue) * 10000.0) / 10000.0;
     }
 
     /**
      * Prepare ptValue to be displayed in cm
      * This method will round to 0.0001 precision, use POINT_TO_CM() for lossless conversion.
      */
     static inline qreal toCentimeter(qreal ptValue)
     {
         return floor(POINT_TO_CM(ptValue) * 10000.0) / 10000.0;
     }
 
     /**
      * Prepare ptValue to be displayed in dm
      * This method will round to 0.0001 precision, use POINT_TO_DM() for lossless conversion.
      */
     static inline qreal toDecimeter(qreal ptValue)
     {
         return floor(POINT_TO_DM(ptValue) * 10000.0) / 10000.0;
     }
 
     /**
      * Prepare ptValue to be displayed in inch
      * This method will round to 0.00001 precision, use POINT_TO_INCH() for lossless conversion.
      */
     static inline qreal toInch(qreal ptValue)
     {
         // "in" values are rounded to 0.00001 inches
         return floor(POINT_TO_INCH(ptValue) * 100000.0) / 100000.0;
     }
 
     /**
      * Prepare ptValue to be displayed in pica
      * This method will round to 0.00001 precision, use POINT_TO_PI() for lossless conversion.
      */
     static inline qreal toPica(qreal ptValue)
     {
         // "pi" values are rounded to 0.00001 inches
         return floor(POINT_TO_PI(ptValue) * 100000.0) / 100000.0;
     }
 
     /**
      * Prepare ptValue to be displayed in cicero
      * This method will round to 0.00001 precision, use POINT_TO_CC() for lossless conversion.
      */
     static inline qreal toCicero(qreal ptValue)
     {
         // "cc" values are rounded to 0.00001 inches
         return floor(POINT_TO_CC(ptValue) * 100000.0) / 100000.0;
     }
 
     /**
      * convert the given value directly from one unit to another
      */
     static qreal convertFromUnitToUnit(qreal value, const KReportUnit &fromUnit, const KReportUnit &toUnit, qreal factor = 1.0);
 
 
     /**
      * This method is the one to use to display a value in a dialog
      * \return the value @p ptValue converted to unit and rounded, ready to be displayed
      */
     qreal toUserValue(qreal ptValue) const;
 
     /**
      * Convert the value @p ptValue to a given unit @p unit
      * Unlike KReportUnit::ptToUnit the return value remains unrounded, so that it can be used in complex calculation
      * \return the converted value
      */
     static qreal ptToUnit(qreal ptValue, const KReportUnit &unit);
 
     /// This method is the one to use to display a value in a dialog
     /// @return the value @p ptValue converted the unit and rounded, ready to be displayed
     QString toUserStringValue(qreal ptValue) const;
 
     /// This method is the one to use to read a value from a dialog
     /// @return the value converted to points for internal use
     qreal fromUserValue(qreal value) const;
 
     /// This method is the one to use to read a value from a dialog
     /// @param value value entered by the user
     /// @param ok if set, the pointed bool is set to true if the value could be
     /// converted to a qreal, and to false otherwise.
     /// @return the value converted to points for internal use
-    qreal fromUserValue(const QString &value, bool *ok = 0) const;
+    qreal fromUserValue(const QString &value, bool *ok = nullptr) const;
 
     /// Get the description string of the given unit
     static QString unitDescription(KReportUnit::Type type);
 
     /// Get the symbol string of the unit
     QString symbol() const;
 
     /// Returns the list of unit types for the UI, controlled with the given @p listOptions.
     static QStringList listOfUnitNameForUi(ListOptions listOptions = ListAll);
 
     /// Get the index of this unit in the list of unit types for the UI,
     /// if it is controlled with the given @p listOptions.
     int indexInListForUi(ListOptions listOptions = ListAll) const;
 
     /// Parses common %KReport and ODF values, like "10cm", "5mm" to pt.
     /// If no unit is specified, pt is assumed.
     static qreal parseValue(const QString &value, qreal defaultVal = 0.0);
 
     /// parse an angle to its value in degrees
     static qreal parseAngle(const QString &value, qreal defaultVal = 0.0);
 
     /**
      * Equal to symbol(): returns the symbol string of the unit.
      */
     inline QString toString() const
     {
         return symbol();
     }
         
 private:
     class Private;
     Private * const d;
 };
 
 #ifndef QT_NO_DEBUG_STREAM
 KREPORT_EXPORT QDebug operator<<(QDebug, const KReportUnit &);
 #endif
 
 Q_DECLARE_METATYPE(KReportUnit)
 Q_DECLARE_OPERATORS_FOR_FLAGS(KReportUnit::ListOptions)
 
 #endif
diff --git a/src/items/check/KReportCheckBoxPlugin.cpp b/src/items/check/KReportCheckBoxPlugin.cpp
index 45f2b20a..c172292c 100644
--- a/src/items/check/KReportCheckBoxPlugin.cpp
+++ b/src/items/check/KReportCheckBoxPlugin.cpp
@@ -1,64 +1,64 @@
 /* This file is part of the KDE project
    Copyright (C) 2010 by Adam Pigg (adam@piggz.co.uk)
 
    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.1 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 "KReportCheckBoxPlugin.h"
 #include "KReportItemCheck.h"
 #include "KReportDesignerItemCheckBox.h"
 #include "KReportPluginMetaData.h"
 #include "KReportScriptCheck.h"
 
 KREPORT_PLUGIN_FACTORY(KReportCheckBoxPlugin, "check.json")
 
 KReportCheckBoxPlugin::KReportCheckBoxPlugin(QObject *parent, const QVariantList &args)
     : KReportPluginInterface(parent, args)
 {
 }
 
 KReportCheckBoxPlugin::~KReportCheckBoxPlugin()
 {
 
 }
 
 QObject* KReportCheckBoxPlugin::createRendererInstance(const QDomNode& element)
 {
     return new KReportItemCheckBox(element);
 }
 
 QObject* KReportCheckBoxPlugin::createDesignerInstance(const QDomNode& element, KReportDesigner* designer, QGraphicsScene* scene)
 {
     return new KReportDesignerItemCheckBox(element, designer, scene);
 }
 
 QObject* KReportCheckBoxPlugin::createDesignerInstance(KReportDesigner* designer, QGraphicsScene* scene, const QPointF& pos)
 {
     return new KReportDesignerItemCheckBox(designer, scene, pos);
 }
 
 #ifdef KREPORT_SCRIPTING
 QObject* KReportCheckBoxPlugin::createScriptInstance(KReportItemBase* item)
 {
     KReportItemCheckBox *check = dynamic_cast(item);
     if (check) {
        return new Scripting::CheckBox(check);
     }
-    return 0;
+    return nullptr;
 }
 #endif
 
 #include "KReportCheckBoxPlugin.moc"
diff --git a/src/items/check/KReportCheckBoxPlugin.h b/src/items/check/KReportCheckBoxPlugin.h
index 27efa8df..364e0bf2 100644
--- a/src/items/check/KReportCheckBoxPlugin.h
+++ b/src/items/check/KReportCheckBoxPlugin.h
@@ -1,41 +1,43 @@
 /* This file is part of the KDE project
    Copyright (C) 2010 by Adam Pigg (adam@piggz.co.uk)
 
    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.1 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.
 */
 
 #ifndef KREPORTCHECKPLUGIN_H
 #define KREPORTCHECKPLUGIN_H
 
 #include "KReportStaticPluginInterface.h"
 
 KREPORT_DECLARE_STATIC_PLUGIN(KReportCheckBoxPlugin)
 
 class KReportCheckBoxPlugin : public KReportPluginInterface
 {
-    public:
-        explicit KReportCheckBoxPlugin(QObject *parent, const QVariantList &args = QVariantList());
-        virtual ~KReportCheckBoxPlugin();
-
-        virtual QObject* createRendererInstance(const QDomNode& element);
-        virtual QObject* createDesignerInstance(const QDomNode& element, KReportDesigner* , QGraphicsScene* scene);
-        virtual QObject* createDesignerInstance(KReportDesigner* , QGraphicsScene* scene, const QPointF& pos);
+public:
+    explicit KReportCheckBoxPlugin(QObject *parent, const QVariantList &args = QVariantList());
+    ~KReportCheckBoxPlugin() override;
+
+    QObject *createRendererInstance(const QDomNode &element) override;
+    QObject *createDesignerInstance(const QDomNode &element, KReportDesigner *designer,
+                                    QGraphicsScene *scene) override;
+    QObject *createDesignerInstance(KReportDesigner *designer, QGraphicsScene *scene,
+                                    const QPointF &pos) override;
 #ifdef KREPORT_SCRIPTING
-        virtual QObject* createScriptInstance(KReportItemBase* item);
+    QObject *createScriptInstance(KReportItemBase *item) override;
 #endif
 };
 
 #endif // KREPORTCHECKPLUGIN_H
diff --git a/src/items/check/KReportDesignerItemCheckBox.cpp b/src/items/check/KReportDesignerItemCheckBox.cpp
index 7c778be8..2ccc8ec3 100644
--- a/src/items/check/KReportDesignerItemCheckBox.cpp
+++ b/src/items/check/KReportDesignerItemCheckBox.cpp
@@ -1,183 +1,183 @@
 /* This file is part of the KDE project
  * Copyright (C) 2009-2010 by Adam Pigg (adam@piggz.co.uk)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 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
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library.  If not, see .
  */
 
 #include "KReportDesignerItemCheckBox.h"
 #include "KReportDesignerItemRectBase.h"
 #include "KReportDesigner.h"
 #include "KReportLineStyle.h"
 
 #include 
 #include 
 #include 
 #include 
 
 //
 // class ReportEntityCheck
 //
 
 void KReportDesignerItemCheckBox::init(QGraphicsScene *scene)
 {
     if (scene)
         scene->addItem(this);
 
     connect(propertySet(), SIGNAL(propertyChanged(KPropertySet&,KProperty&)),
             this, SLOT(slotPropertyChanged(KPropertySet&,KProperty&)));
 
     setZValue(z());
 }
 
 // methods (constructors)
 KReportDesignerItemCheckBox::KReportDesignerItemCheckBox(KReportDesigner* d, QGraphicsScene * scene, const QPointF &pos)
         : KReportDesignerItemRectBase(d, this)
 {
     Q_UNUSED(pos);
     init(scene);
     setSceneRect(properRect(*d, KREPORT_ITEM_CHECK_DEFAULT_WIDTH, KREPORT_ITEM_CHECK_DEFAULT_HEIGHT));
     nameProperty()->setValue(designer()->suggestEntityName(typeName()));
 }
 
 KReportDesignerItemCheckBox::KReportDesignerItemCheckBox(const QDomNode & element, KReportDesigner * d, QGraphicsScene * s)
         : KReportItemCheckBox(element), KReportDesignerItemRectBase(d, this)
 {
     init(s);
     setSceneRect(KReportItemBase::scenePosition(item()->position()), KReportItemBase::sceneSize(item()->size()));
 }
 
 KReportDesignerItemCheckBox* KReportDesignerItemCheckBox::clone()
 {
     QDomDocument d;
     QDomElement e = d.createElement(QLatin1String("clone"));
     QDomNode n;
     buildXML(&d, &e);
     n = e.firstChild();
-    return new KReportDesignerItemCheckBox(n, designer(), 0);
+    return new KReportDesignerItemCheckBox(n, designer(), nullptr);
 }
 
 // methods (deconstructor)
 KReportDesignerItemCheckBox::~KReportDesignerItemCheckBox()
 {}
 
 void KReportDesignerItemCheckBox::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget)
 {
     Q_UNUSED(option);
     Q_UNUSED(widget);
 
     // store any values we plan on changing so we can restore them
     QFont f = painter->font();
     QPen  p = painter->pen();
     QBrush b = painter->brush();
 
     painter->setBackgroundMode(Qt::OpaqueMode);
     painter->setRenderHint(QPainter::Antialiasing);
 
     painter->setPen(m_foregroundColor->value().value());
 
     if ((Qt::PenStyle)m_lineStyle->value().toInt() == Qt::NoPen || m_lineWeight->value().toInt() <= 0) {
         painter->setPen(QPen(Qt::lightGray));
     } else {
         painter->setPen(QPen(m_lineColor->value().value(), m_lineWeight->value().toInt(), (Qt::PenStyle)m_lineStyle->value().toInt()));
     }
 
     QSizeF sceneSize = this->sceneSize(size());
     qreal ox = sceneSize.width() / 5;
     qreal oy = sceneSize.height() / 5;
 
     //Checkbox Style
     if (m_checkStyle->value().toString() == QLatin1String("Cross")) {
         painter->drawRoundedRect(QGraphicsRectItem::rect(), sceneSize.width() / 10 , sceneSize.height() / 10);
 
         QPen lp;
         lp.setColor(m_foregroundColor->value().value());
         lp.setWidth(ox > oy ? oy : ox);
         painter->setPen(lp);
         painter->drawLine(ox, oy, sceneSize.width() - ox, sceneSize.height() - oy);
         painter->drawLine(ox, sceneSize.height() - oy, sceneSize.width() - ox, oy);
     } else if (m_checkStyle->value().toString() == QLatin1String("Dot")) {
         //Radio Style
         painter->drawEllipse(QGraphicsRectItem::rect());
 
         QBrush lb(m_foregroundColor->value().value());
         painter->setBrush(lb);
         painter->setPen(Qt::NoPen);
         painter->drawEllipse(rect().center(), sceneSize.width() / 2 - ox, sceneSize.height() / 2 - oy);
     } else {
         //Tickbox Style
         painter->drawRoundedRect(QGraphicsRectItem::rect(), sceneSize.width() / 10 , sceneSize.height() / 10);
 
         QPen lp;
         lp.setColor(m_foregroundColor->value().value());
         lp.setWidth(ox > oy ? oy : ox);
         painter->setPen(lp);
         painter->drawLine(ox, sceneSize.height() / 2, sceneSize.width() / 2, sceneSize.height() - oy);
         painter->drawLine(sceneSize.width() / 2, sceneSize.height() - oy, sceneSize.width() - ox, oy);
 
     }
 
     painter->setBackgroundMode(Qt::TransparentMode);
     painter->setPen(m_foregroundColor->value().value());
 
     // restore an values before we started just in case
     painter->setFont(f);
     painter->setPen(p);
     painter->setBrush(b);
 
     drawHandles(painter);
 }
 
 void KReportDesignerItemCheckBox::buildXML(QDomDocument *doc, QDomElement *parent)
 {
     //kreportpluginDebug();
     QDomElement entity = doc->createElement(QLatin1String("report:") + typeName());
 
     //properties
     addPropertyAsAttribute(&entity, nameProperty());
     addPropertyAsAttribute(&entity, m_controlSource);
     entity.setAttribute(QLatin1String("fo:foreground-color"), m_foregroundColor->value().toString());
     addPropertyAsAttribute(&entity, m_checkStyle);
     addPropertyAsAttribute(&entity, m_staticValue);
 
     // bounding rect
     buildXMLRect(doc, &entity, this);
 
     //Line Style
     buildXMLLineStyle(doc, &entity, lineStyle());
 
     parent->appendChild(entity);
 }
 
 void KReportDesignerItemCheckBox::slotPropertyChanged(KPropertySet &s, KProperty &p)
 {
     Q_UNUSED(s)
 
     if (p.name() == "name") {
         //For some reason p.oldValue returns an empty string
         if (!designer()->isEntityNameUnique(p.value().toString(), this)) {
             p.setValue(oldName());
         } else {
             setOldName(p.value().toString());
         }
     }
 
     KReportDesignerItemRectBase::propertyChanged(s, p);
     if (designer()) designer()->setModified(true);
 }
 
 void KReportDesignerItemCheckBox::mousePressEvent(QGraphicsSceneMouseEvent * event)
 {
     m_controlSource->setListData(designer()->fieldKeys(), designer()->fieldNames());
     KReportDesignerItemRectBase::mousePressEvent(event);
 }
diff --git a/src/items/check/KReportDesignerItemCheckBox.h b/src/items/check/KReportDesignerItemCheckBox.h
index 8873ba18..58a96636 100644
--- a/src/items/check/KReportDesignerItemCheckBox.h
+++ b/src/items/check/KReportDesignerItemCheckBox.h
@@ -1,55 +1,57 @@
 /* This file is part of the KDE project
  * Copyright (C) 2009-2010 by Adam Pigg (adam@piggz.co.uk)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 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
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library.  If not, see .
  */
 
 #ifndef KREPORTDESIGNERITEMCHECK_H
 #define KREPORTDESIGNERITEMCHECK_H
 
 #include "KReportDesignerItemRectBase.h"
 #include "KReportItemCheck.h"
 
 #include 
 #include 
 
 const int KREPORT_ITEM_CHECK_DEFAULT_WIDTH = 15;
 const int KREPORT_ITEM_CHECK_DEFAULT_HEIGHT = 15;
 
 class KReportDesignerItemCheckBox : public KReportItemCheckBox, public KReportDesignerItemRectBase
 {
     Q_OBJECT
 public:
-    KReportDesignerItemCheckBox(KReportDesigner *, QGraphicsScene * scene, const QPointF &pos);
-    KReportDesignerItemCheckBox(const QDomNode & element, KReportDesigner *, QGraphicsScene * scene);
+    KReportDesignerItemCheckBox(KReportDesigner *designer, QGraphicsScene *scene,
+                                const QPointF &pos);
+    KReportDesignerItemCheckBox(const QDomNode &element, KReportDesigner *designer,
+                                QGraphicsScene *scene);
 
-    virtual ~KReportDesignerItemCheckBox();
+    ~KReportDesignerItemCheckBox() override;
 
-    virtual void buildXML(QDomDocument *doc, QDomElement *parent);
+    void buildXML(QDomDocument *doc, QDomElement *parent) override;
 
-    virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0);
+    void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = nullptr) override;
 
-    virtual KReportDesignerItemCheckBox* clone();
+    KReportDesignerItemCheckBox* clone() override;
 
 private:
     void init(QGraphicsScene *scene);
 
 private Q_SLOTS:
     void slotPropertyChanged(KPropertySet &, KProperty &);
 
 protected:
-    virtual void mousePressEvent(QGraphicsSceneMouseEvent * event);
+    void mousePressEvent(QGraphicsSceneMouseEvent * event) override;
 };
 
 #endif // KREPORTDESIGNERITEMCHECK_H
diff --git a/src/items/check/KReportItemCheck.h b/src/items/check/KReportItemCheck.h
index 9a8eaea9..af7d7e67 100644
--- a/src/items/check/KReportItemCheck.h
+++ b/src/items/check/KReportItemCheck.h
@@ -1,63 +1,63 @@
 /* This file is part of the KDE project
  * Copyright (C) 2009-2010 by Adam Pigg (adam@piggz.co.uk)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 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
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library.  If not, see .
  */
 
 #ifndef KREPORTITEMCHECKBOX_H
 #define KREPORTITEMCHECKBOX_H
 
 #include "KReportItemBase.h"
 
 class QDomNode;
 
 namespace Scripting
 {
 class CheckBox;
 }
 
 class KReportItemCheckBox : public KReportItemBase
 {
 Q_OBJECT
 public:
     KReportItemCheckBox();
     explicit KReportItemCheckBox(const QDomNode &element);
-    virtual ~KReportItemCheckBox();
+    ~KReportItemCheckBox() override;
 
-    virtual QString typeName() const;
-    virtual int renderSimpleData(OROPage *page, OROSection *section, const QPointF &offset, const QVariant &data, KReportScriptHandler *script);
+    QString typeName() const override;
+    int renderSimpleData(OROPage *page, OROSection *section, const QPointF &offset, const QVariant &data, KReportScriptHandler *script) override;
 
-    virtual QString itemDataSource()const;
+    QString itemDataSource()const override;
 
 protected:
 
     KProperty * m_controlSource;
     KProperty* m_checkStyle;
     KProperty* m_foregroundColor;
     KProperty* m_lineColor;
     KProperty* m_lineWeight;
     KProperty* m_lineStyle;
     KProperty* m_staticValue;
 
     bool value() const;
     void setValue(bool v);
     KReportLineStyle lineStyle();
 
 private:
-    virtual void createProperties();
+    void createProperties() override;
 
     friend class Scripting::CheckBox;
 };
 
 #endif // KREPORTITEMCHECKBOX_H
diff --git a/src/items/check/KReportScriptCheck.h b/src/items/check/KReportScriptCheck.h
index 41eee751..3b43521a 100644
--- a/src/items/check/KReportScriptCheck.h
+++ b/src/items/check/KReportScriptCheck.h
@@ -1,87 +1,87 @@
 /* This file is part of the KDE project
  * Copyright (C) 2010 by Adam Pigg (adam@piggz.co.uk)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 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
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library.  If not, see .
  */
 
 #ifndef KREPORTSCRIPTCHECK_H
 #define KREPORTSCRIPTCHECK_H
 
 #include 
 
 #include "KReportItemCheck.h"
 
 namespace Scripting
 {
     /**
      @brief Checkbox item script interface
 
      The user facing interface for scripting report checkbox items
      */
     class CheckBox : public QObject
     {
         Q_OBJECT
         public:
             explicit CheckBox(KReportItemCheckBox *);
 
-            ~CheckBox();
+            ~CheckBox() override;
 
         public Q_SLOTS:
 
             //! Return the value of the checkbox
             bool value() const;
             //! Set the value of the checkbox, defaults to checked if no value is given
             void setValue(bool val = true);
 
             //! Returns the style of the checkbox as Cross, Tick or Dot
             QString checkStyle() const;
             //!Sets the style of the checkbox, valid values are Cross, Tick or Dot
             void setCheckStyle(const QString&);
 
             //!Returns the foreground color
             QColor foregroundColor() const;
             //!Sets the foreground color
             void setForegroundColor(const QColor&);
 
             //!Returs the line color
             QColor lineColor() const;
             //!Sets the line color
             void setLineColor(const QColor&);
 
             //!Returns the line weight (thickness)
             int lineWeight() const;
             //!Serts the line weight (thicknes)
             void setLineWeight(int);
 
             //! Returns the line style.  Valid values are those from Qt::PenStyle (0-5)
             int lineStyle() const;
             //! Srts the line style.  Valid values are those from Qt::PenStyle (0-5)
             void setLineStyle(int);
 
             //!Returns the position of the checkbox within the parent section
             QPointF position() const;
             //!Sets the position of the checkbox within the parent section
             void setPosition(const QPointF&);
 
             //!Returns the size of the checkbox
             QSizeF size() const;
             //!Serts the size of the checkbox
             void setSize(const QSizeF&);
 
         private:
             KReportItemCheckBox *m_check;
     };
 
 }
 #endif // KREPORTSCRIPTCHECK_H
diff --git a/src/items/field/KReportDesignerItemField.cpp b/src/items/field/KReportDesignerItemField.cpp
index 90814c05..49b6b542 100644
--- a/src/items/field/KReportDesignerItemField.cpp
+++ b/src/items/field/KReportDesignerItemField.cpp
@@ -1,186 +1,186 @@
 /* This file is part of the KDE project
  * Copyright (C) 2001-2007 by OpenMFG, LLC (info@openmfg.com)
  * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 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
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library.  If not, see .
  */
 
 #include "KReportDesignerItemField.h"
 #include "KReportItemField.h"
 #include "KReportDesigner.h"
 #include "kreportplugin_debug.h"
 #include "KReportLineStyle.h"
 
 #include 
 #include 
 #include 
 #include 
 
 //
 // class ReportEntityField
 //
 
 void KReportDesignerItemField::init(QGraphicsScene *scene)
 {
     if (scene)
         scene->addItem(this);
 
     setZValue(z());
 
     updateRenderText(m_controlSource->value().toString(), m_itemValue->value().toString(), QLatin1String("field"));
 }
 
 // methods (constructors)
 KReportDesignerItemField::KReportDesignerItemField(KReportDesigner *rw, QGraphicsScene *scene, const QPointF &pos)
         : KReportDesignerItemRectBase(rw, this)
 {
     Q_UNUSED(pos);
     init(scene);
     setSceneRect(properRect(*rw, getTextRect().width(), getTextRect().height()));
     nameProperty()->setValue(designer()->suggestEntityName(typeName()));
 }
 
 KReportDesignerItemField::KReportDesignerItemField(const QDomNode & element, KReportDesigner * d, QGraphicsScene * s)
         : KReportItemField(element), KReportDesignerItemRectBase(d, this)
 {
     init(s);
     setSceneRect(KReportItemBase::scenePosition(item()->position()), KReportItemBase::sceneSize(item()->size()));
 }
 
 KReportDesignerItemField* KReportDesignerItemField::clone()
 {
     QDomDocument d;
     QDomElement e = d.createElement(QLatin1String("clone"));
     QDomNode n;
     buildXML(&d, &e);
     n = e.firstChild();
-    return new KReportDesignerItemField(n, designer(), 0);
+    return new KReportDesignerItemField(n, designer(), nullptr);
 }
 
 // methods (deconstructor)
 KReportDesignerItemField::~KReportDesignerItemField()
 {}
 
 QRect KReportDesignerItemField::getTextRect() const
 {
     return QFontMetrics(font()).boundingRect(x(), y(), 0, 0, textFlags(), renderText());
 }
 
 
 
 void KReportDesignerItemField::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget *widget)
 {
     Q_UNUSED(option);
     Q_UNUSED(widget);
 
     // store any values we plan on changing so we can restore them
     QFont f = painter->font();
     QPen  p = painter->pen();
 
 
     painter->setFont(font());
     painter->setBackgroundMode(Qt::TransparentMode);
 
     QColor bg = m_backgroundColor->value().value();
     bg.setAlphaF(m_backgroundOpacity->value().toReal() *0.01);
 
     painter->setPen(m_foregroundColor->value().value());
 
     painter->fillRect(QGraphicsRectItem::rect(), bg);
     painter->drawText(rect(), textFlags(), renderText());
 
 
     if ((Qt::PenStyle)m_lineStyle->value().toInt() == Qt::NoPen || m_lineWeight->value().toInt() <= 0) {
         painter->setPen(QPen(Qt::lightGray));
     } else {
         painter->setPen(QPen(m_lineColor->value().value(), m_lineWeight->value().toInt(), (Qt::PenStyle)m_lineStyle->value().toInt()));
     }
 
     painter->drawRect(rect());
 
 
     drawHandles(painter);
 
     // restore an values before we started just in case
     painter->setFont(f);
     painter->setPen(p);
 }
 
 void KReportDesignerItemField::buildXML(QDomDocument *doc, QDomElement *parent)
 {
     QDomElement entity = doc->createElement(QLatin1String("report:") + typeName());
 
     // properties
     addPropertyAsAttribute(&entity, nameProperty());
     addPropertyAsAttribute(&entity, m_controlSource);
     addPropertyAsAttribute(&entity, m_verticalAlignment);
     addPropertyAsAttribute(&entity, m_horizontalAlignment);
     addPropertyAsAttribute(&entity, m_wordWrap);
     addPropertyAsAttribute(&entity, m_canGrow);
     addPropertyAsAttribute(&entity, m_itemValue);
 
     entity.setAttribute(QLatin1String("report:z-index"), zValue());
 
     // bounding rect
     buildXMLRect(doc, &entity, this);
 
     //text style info
     buildXMLTextStyle(doc, &entity, textStyle());
 
     //Line Style
     buildXMLLineStyle(doc, &entity, lineStyle());
 
 
 #if 0 //Field Totals
     if (m_trackTotal) {
         QDomElement tracktotal = doc->createElement("tracktotal");
         if (m_trackBuiltinFormat)
             tracktotal.setAttribute("builtin", "true");
         if (_useSubTotal)
             tracktotal.setAttribute("subtotal", "true");
         tracktotal.appendChild(doc.createTextNode(_trackTotalFormat->value().toString()));
         entity.appendChild(tracktotal);
     }
 #endif
 
     parent->appendChild(entity);
 }
 
 void KReportDesignerItemField::slotPropertyChanged(KPropertySet &s, KProperty &p)
 {
     Q_UNUSED(s);
 
     if (p.name() == "name") {
         //For some reason p.oldValue returns an empty string
         if (!designer()->isEntityNameUnique(p.value().toString(), this)) {
             p.setValue(oldName());
         } else {
             setOldName(p.value().toString());
         }
     }
 
     updateRenderText(m_controlSource->value().toString(), m_itemValue->value().toString(), QLatin1String("field"));
 
     KReportDesignerItemRectBase::propertyChanged(s, p);
     if (designer())designer()->setModified(true);
 }
 
 void KReportDesignerItemField::mousePressEvent(QGraphicsSceneMouseEvent * event)
 {
     //kreportpluginDebug() << m_reportDesigner->fieldKeys() <<  m_reportDesigner->fieldNames();
     m_controlSource->setListData(designer()->fieldKeys(), designer()->fieldNames());
     KReportDesignerItemRectBase::mousePressEvent(event);
 }
 
 
diff --git a/src/items/field/KReportDesignerItemField.h b/src/items/field/KReportDesignerItemField.h
index f51eb1c3..0910b88e 100644
--- a/src/items/field/KReportDesignerItemField.h
+++ b/src/items/field/KReportDesignerItemField.h
@@ -1,55 +1,56 @@
 /* This file is part of the KDE project
  * Copyright (C) 2001-2007 by OpenMFG, LLC (info@openmfg.com)
  * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 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
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library.  If not, see .
  */
 
 
 #ifndef KREPORTDESIGNERITEMFIELD_H
 #define KREPORTDESIGNERITEMFIELD_H
 
 #include 
 
 #include 
 
 #include "KReportItemField.h"
 #include "KReportDesignerItemRectBase.h"
 
 class KReportDesignerItemField : public KReportItemField, public KReportDesignerItemRectBase
 {
   Q_OBJECT
 public:
-    //Used when creating new basic field
-    KReportDesignerItemField(KReportDesigner *, QGraphicsScene * scene, const QPointF &pos);
-    //Used when loading from file
-    KReportDesignerItemField(const QDomNode & element, KReportDesigner *, QGraphicsScene * scene);
-    virtual ~KReportDesignerItemField();
-    virtual void buildXML(QDomDocument *doc, QDomElement *parent);
+    // Used when creating new basic field
+    KReportDesignerItemField(KReportDesigner *designer, QGraphicsScene *scene, const QPointF &pos);
+    // Used when loading from file
+    KReportDesignerItemField(const QDomNode &element, KReportDesigner *designer,
+                             QGraphicsScene *scene);
+    ~KReportDesignerItemField() override;
+    void buildXML(QDomDocument *doc, QDomElement *parent) override;
 
-    virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget *widget = 0);
-    virtual KReportDesignerItemField* clone();
+    void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget *widget = nullptr) override;
+    KReportDesignerItemField* clone() override;
 
 protected:
-    virtual void mousePressEvent(QGraphicsSceneMouseEvent * event);
+    void mousePressEvent(QGraphicsSceneMouseEvent * event) override;
 
 private:
     void init(QGraphicsScene *scene);
     QRect getTextRect() const;
 
 private Q_SLOTS:
     void slotPropertyChanged(KPropertySet &, KProperty &);
 };
 
 #endif
diff --git a/src/items/field/KReportFieldPlugin.cpp b/src/items/field/KReportFieldPlugin.cpp
index 67e28036..8d8a058d 100644
--- a/src/items/field/KReportFieldPlugin.cpp
+++ b/src/items/field/KReportFieldPlugin.cpp
@@ -1,66 +1,66 @@
 /* This file is part of the KDE project
    Copyright (C) 2010 by Adam Pigg (adam@piggz.co.uk)
 
    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.1 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 "KReportFieldPlugin.h"
 #include "KReportItemField.h"
 #include "KReportDesignerItemField.h"
 #include "KReportPluginMetaData.h"
 #ifdef KREPORT_SCRIPTING
 #include "KReportScriptField.h"
 #endif
 
 KREPORT_PLUGIN_FACTORY(KReportFieldPlugin, "field.json")
 
 KReportFieldPlugin::KReportFieldPlugin(QObject *parent, const QVariantList &args)
     : KReportPluginInterface(parent, args)
 {
 }
 
 KReportFieldPlugin::~KReportFieldPlugin()
 {
 
 }
 
 QObject* KReportFieldPlugin::createRendererInstance(const QDomNode& element)
 {
     return new KReportItemField(element);
 }
 
 QObject* KReportFieldPlugin::createDesignerInstance(const QDomNode& element, KReportDesigner* designer, QGraphicsScene* scene)
 {
     return new KReportDesignerItemField(element, designer, scene);
 }
 
 QObject* KReportFieldPlugin::createDesignerInstance(KReportDesigner* designer, QGraphicsScene* scene, const QPointF& pos)
 {
     return new KReportDesignerItemField(designer, scene, pos);
 }
 
 #ifdef KREPORT_SCRIPTING
 QObject* KReportFieldPlugin::createScriptInstance(KReportItemBase* item)
 {
     KReportItemField *field = dynamic_cast(item);
     if (field) {
         return new Scripting::Field(field);
     }
-    return 0;
+    return nullptr;
 }
 #endif
 
 #include "KReportFieldPlugin.moc"
diff --git a/src/items/field/KReportFieldPlugin.h b/src/items/field/KReportFieldPlugin.h
index 38f1aed7..2a29e4d6 100644
--- a/src/items/field/KReportFieldPlugin.h
+++ b/src/items/field/KReportFieldPlugin.h
@@ -1,41 +1,43 @@
 /* This file is part of the KDE project
    Copyright (C) 2010 by Adam Pigg (adam@piggz.co.uk)
 
    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.1 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.
 */
 
 #ifndef KREPORTFIELDPLUGIN_H
 #define KREPORTFIELDPLUGIN_H
 
 #include "KReportStaticPluginInterface.h"
 
 KREPORT_DECLARE_STATIC_PLUGIN(KReportFieldPlugin)
 
 class KReportFieldPlugin : public KReportPluginInterface
 {
-    public:
+public:
     explicit KReportFieldPlugin(QObject *parent, const QVariantList &args = QVariantList());
-    virtual ~KReportFieldPlugin();
+    ~KReportFieldPlugin() override;
 
-    virtual QObject* createRendererInstance(const QDomNode& element);
-    virtual QObject* createDesignerInstance(const QDomNode& element, KReportDesigner* , QGraphicsScene* scene);
-    virtual QObject* createDesignerInstance(KReportDesigner* , QGraphicsScene* scene, const QPointF& pos);
+    QObject *createRendererInstance(const QDomNode &element) override;
+    QObject *createDesignerInstance(const QDomNode &element, KReportDesigner *designer,
+                                    QGraphicsScene *scene) override;
+    QObject *createDesignerInstance(KReportDesigner *designer, QGraphicsScene *scene,
+                                    const QPointF &pos) override;
 #ifdef KREPORT_SCRIPTING
-    virtual QObject* createScriptInstance(KReportItemBase* item);
+    QObject *createScriptInstance(KReportItemBase *item) override;
 #endif
 };
 
 #endif // KREPORTFIELDPLUGIN_H
diff --git a/src/items/field/KReportItemField.h b/src/items/field/KReportItemField.h
index 491abbeb..39e57e5a 100644
--- a/src/items/field/KReportItemField.h
+++ b/src/items/field/KReportItemField.h
@@ -1,87 +1,87 @@
 /* This file is part of the KDE project
  * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 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
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library.  If not, see .
  */
 
 #ifndef KREPORTITEMFIELD_H
 #define KREPORTITEMFIELD_H
 
 #include "KReportItemBase.h"
 
 #include 
 
 class QDomNode;
 
 namespace Scripting
 {
 class Field;
 }
 
 class KReportItemField : public KReportItemBase
 {
 Q_OBJECT
 public:
     KReportItemField();
     explicit KReportItemField(const QDomNode & element);
-    virtual ~KReportItemField();
+    ~KReportItemField() override;
 
-    virtual QString typeName() const;
-    virtual int renderSimpleData(OROPage *page, OROSection *section, const QPointF &offset, const QVariant &data, KReportScriptHandler *script);
+    QString typeName() const override;
+    int renderSimpleData(OROPage *page, OROSection *section, const QPointF &offset, const QVariant &data, KReportScriptHandler *script) override;
 
-    virtual QString itemDataSource() const;
+    QString itemDataSource() const override;
 
 protected:
 
     KProperty * m_controlSource;
     KProperty * m_horizontalAlignment;
     KProperty * m_verticalAlignment;
     KProperty * m_font;
     //KProperty * m_trackTotal;
     //KProperty * m_trackBuiltinFormat;
     //KProperty * _useSubTotal;
     //KProperty * _trackTotalFormat;
     KProperty * m_foregroundColor;
     KProperty * m_backgroundColor;
     KProperty* m_backgroundOpacity;
     KProperty* m_lineColor;
     KProperty* m_lineWeight;
     KProperty* m_lineStyle;
     KProperty* m_wordWrap;
     KProperty* m_canGrow;
     KProperty* m_itemValue;
 
     //bool builtinFormat;
     //QString format;
 
     QStringList fieldNames(const QString &);
 
     KReportLineStyle lineStyle() const;
     KReportTextStyleData textStyle() const;
 
     int textFlags() const;
 
     QFont font() const {
         return m_font->value().value();
     }
 
     void setItemDataSource(const QString&);
 
 private:
-    virtual void createProperties();
+    void createProperties() override;
 
     friend class Scripting::Field;
 };
 
 #endif
diff --git a/src/items/field/KReportScriptField.h b/src/items/field/KReportScriptField.h
index ce7913fa..3105d6ff 100644
--- a/src/items/field/KReportScriptField.h
+++ b/src/items/field/KReportScriptField.h
@@ -1,101 +1,101 @@
 /* This file is part of the KDE project
  * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 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
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library.  If not, see .
  */
 
 #ifndef KRSCRIPTFIELD_H
 #define KRSCRIPTFIELD_H
 
 #include 
 
 #include "KReportItemField.h"
 
 /**
  @brief Field item script interface
 
  The user facing interface for scripting report field items
  */
 namespace Scripting
 {
 class Field : public QObject
 {
     Q_OBJECT
 public:
     explicit Field(KReportItemField*);
 
-    ~Field();
+    ~Field() override;
 
 public Q_SLOTS:
     //!Returns the source (column) that the field gets its data from*
     QString source() const;
     //!Sets the source (column) for the field
     void setSource(const QString&);
 
     //!Returns the horizontal alignment of the field, -1 = left, 0 = center, 1 = right
     int horizontalAlignment() const;
     //!Sets the horizontal alignment.  Valid values are -1, 0, 1
     void setHorizonalAlignment(int);
 
     //!Returns the vertical alignment of the field, -1 = left, 0 = center, 1 = right
     int verticalAlignment() const;
     //!Sets the vertical alignment.  Valid values are -1, 0, 1
     void setVerticalAlignment(int);
 
     //!Returns the background color of the field
     QColor backgroundColor() const;
     //!Sets the background color
     void setBackgroundColor(const QColor&);
 
     //!Returns the foreground (text) color of the field
     QColor foregroundColor() const;
     //!Srets the foreground (text) color
     void setForegroundColor(const QColor&);
 
     //!Returns the background opacity
     int backgroundOpacity() const;
     //!Sets the background opacity.  Values 0-100
     void setBackgroundOpacity(int);
 
     //!Returns the line color of the field
     QColor lineColor() const;
     //!Sets the line color of the field
     void setLineColor(const QColor&);
 
     //!Returns the line weight (width) of the field
     int lineWeight() const;
     //!Sets the line weight (width) of the field
     void setLineWeight(int);
 
     //! Returns the line style.  Valid values are those from Qt::PenStyle (0-5)
     int lineStyle() const;
     //! Srts the line style.  Valid values are those from Qt::PenStyle (0-5)
     void setLineStyle(int);
 
     //!Returns the position of the field within the parent section
     QPointF position() const;
     //!Sets the position of the field within the parent section
     void setPosition(const QPointF&);
 
     //!Returns the size of the field
     QSizeF size() const;
     //!Serts the size of the field
     void setSize(const QSizeF&);
 
 private:
     KReportItemField *m_field;
 
 };
 }
 #endif
diff --git a/src/items/image/KReportDesignerItemImage.cpp b/src/items/image/KReportDesignerItemImage.cpp
index 48f5c1c1..cfae0c3d 100644
--- a/src/items/image/KReportDesignerItemImage.cpp
+++ b/src/items/image/KReportDesignerItemImage.cpp
@@ -1,150 +1,150 @@
 /* This file is part of the KDE project
  * Copyright (C) 2001-2007 by OpenMFG, LLC (info@openmfg.com)
  * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 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
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library.  If not, see .
  */
 
 #include "KReportDesignerItemImage.h"
 #include "KReportDesignerItemBase.h"
 #include "KReportDesigner.h"
 
 #include 
 #include 
 #include 
 #include 
 #include 
 
 //
 // ReportEntitiesImage
 //
 // contructors/deconstructors
 
 void KReportDesignerItemImage::init(QGraphicsScene *scene)
 {
     //kreportpluginDebug();
     if (scene)
         scene->addItem(this);
 
     connect(propertySet(), SIGNAL(propertyChanged(KPropertySet&,KProperty&)),
             this, SLOT(slotPropertyChanged(KPropertySet&,KProperty&)));
 
     m_controlSource->setListData(designer()->fieldKeys(), designer()->fieldNames());
     setZValue(z());
 }
 
 KReportDesignerItemImage::KReportDesignerItemImage(KReportDesigner *rw, QGraphicsScene *scene, const QPointF &pos)
         : KReportDesignerItemRectBase(rw, this)
 {
     Q_UNUSED(pos);
     //kreportpluginDebug();
     init(scene);
     setSceneRect(properRect(*rw, KREPORT_ITEM_RECT_DEFAULT_WIDTH, KREPORT_ITEM_RECT_DEFAULT_WIDTH));
     nameProperty()->setValue(designer()->suggestEntityName(typeName()));
 }
 
 KReportDesignerItemImage::KReportDesignerItemImage(const QDomNode & element, KReportDesigner * rw, QGraphicsScene* scene)
         : KReportItemImage(element), KReportDesignerItemRectBase(rw, this)
 {
     init(scene);
     setSceneRect(KReportItemBase::scenePosition(item()->position()), KReportItemBase::sceneSize(item()->size()));
 }
 
 KReportDesignerItemImage* KReportDesignerItemImage::clone()
 {
     QDomDocument d;
     QDomElement e = d.createElement(QLatin1String("clone"));
     QDomNode n;
     buildXML(&d, &e);
     n = e.firstChild();
-    return new KReportDesignerItemImage(n, designer(), 0);
+    return new KReportDesignerItemImage(n, designer(), nullptr);
 }
 
 KReportDesignerItemImage::~KReportDesignerItemImage()
 {
     // do we need to clean anything up?
 }
 
 void KReportDesignerItemImage::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget)
 {
     Q_UNUSED(option);
     Q_UNUSED(widget);
 
     // store any values we plan on changing so we can restore them
     QPen  p = painter->pen();
 
     if (isInline()) {
         //QImage t_img = _image;
         QImage t_img = m_staticImage->value().value().toImage();
         if (mode() == QLatin1String("stretch")) {
             t_img = t_img.scaled(rect().width(), rect().height(), Qt::KeepAspectRatio);
         }
         painter->drawImage(rect().left(), rect().top(), t_img, 0, 0, rect().width(), rect().height());
     } else {
         painter->drawText(rect(), 0, dataSourceAndObjectTypeName(itemDataSource(), QLatin1String("image")));
     }
 
     //Draw a border so user knows the object edge
     painter->setPen(QPen(Qt::lightGray));
     painter->drawRect(rect());
 
 
     drawHandles(painter);
 
     // restore an values before we started just in case
     painter->setPen(p);
 }
 
 void KReportDesignerItemImage::buildXML(QDomDocument *doc, QDomElement *parent)
 {
     QDomElement entity = doc->createElement(QLatin1String("report:") + typeName());
 
     // properties
     addPropertyAsAttribute(&entity, nameProperty());
     addPropertyAsAttribute(&entity, m_resizeMode);
     entity.setAttribute(QLatin1String("report:z-index"), z());
     buildXMLRect(doc, &entity, this);
 
 
     if (isInline()) {
         QDomElement map = doc->createElement(QLatin1String("report:inline-image-data"));
         map.appendChild(doc->createTextNode(QLatin1String(inlineImageData())));
         entity.appendChild(map);
     } else {
         addPropertyAsAttribute(&entity, m_controlSource);
     }
 
     parent->appendChild(entity);
 }
 
 void KReportDesignerItemImage::slotPropertyChanged(KPropertySet &s, KProperty &p)
 {
     if (p.name() == "name") {
         //For some reason p.oldValue returns an empty string
         if (!designer()->isEntityNameUnique(p.value().toString(), this)) {
             p.setValue(oldName());
         } else {
             setOldName(p.value().toString());
         }
     }
 
     KReportDesignerItemRectBase::propertyChanged(s, p);
     if (designer()) designer()->setModified(true);
 }
 
 void KReportDesignerItemImage::mousePressEvent(QGraphicsSceneMouseEvent * event)
 {
     m_controlSource->setListData(designer()->fieldKeys(), designer()->fieldNames());
     KReportDesignerItemRectBase::mousePressEvent(event);
 }
diff --git a/src/items/image/KReportDesignerItemImage.h b/src/items/image/KReportDesignerItemImage.h
index 4d5094ab..e9bf3f87 100644
--- a/src/items/image/KReportDesignerItemImage.h
+++ b/src/items/image/KReportDesignerItemImage.h
@@ -1,50 +1,52 @@
 /* This file is part of the KDE project
  * Copyright (C) 2001-2007 by OpenMFG, LLC (info@openmfg.com)
  * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 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
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library.  If not, see .
  */
 
 #ifndef KREPORTDESIGNERITEMIMAGE_H
 #define KREPORTDESIGNERITEMIMAGE_H
 
 #include "KReportDesignerItemRectBase.h"
 #include "KReportItemImage.h"
 
 #include 
 
 class KReportDesignerItemImage : public KReportItemImage, public KReportDesignerItemRectBase
 {
   Q_OBJECT
 public:
-    KReportDesignerItemImage(KReportDesigner *, QGraphicsScene* scene, const QPointF &pos);
-    KReportDesignerItemImage(const QDomNode & element, KReportDesigner *, QGraphicsScene* scene);
+    KReportDesignerItemImage(KReportDesigner *designer, QGraphicsScene *scene, const QPointF &pos);
+    KReportDesignerItemImage(const QDomNode &element, KReportDesigner *designer,
+                             QGraphicsScene *scene);
+    ~KReportDesignerItemImage() override;
 
-    virtual ~KReportDesignerItemImage();
-    virtual void buildXML(QDomDocument *doc, QDomElement *parent);
-    virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0);
-    virtual KReportDesignerItemImage* clone();
+    void buildXML(QDomDocument *doc, QDomElement *parent) override;
+    void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
+               QWidget *widget = nullptr) override;
+    KReportDesignerItemImage *clone() override;
 
 protected:
-    virtual void mousePressEvent(QGraphicsSceneMouseEvent * event);
+    void mousePressEvent(QGraphicsSceneMouseEvent * event) override;
 
 private:
     void init(QGraphicsScene *scene);
 
 private Q_SLOTS:
     void slotPropertyChanged(KPropertySet &, KProperty &);
 
 };
 
 #endif
diff --git a/src/items/image/KReportImagePlugin.cpp b/src/items/image/KReportImagePlugin.cpp
index adf0b86f..318d86ff 100644
--- a/src/items/image/KReportImagePlugin.cpp
+++ b/src/items/image/KReportImagePlugin.cpp
@@ -1,67 +1,67 @@
 /* This file is part of the KDE project
    Copyright (C) 2010 by Adam Pigg (adam@piggz.co.uk)
 
    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.1 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 "KReportImagePlugin.h"
 #include "KReportItemImage.h"
 #include "KReportDesignerItemImage.h"
 #include "KReportPluginMetaData.h"
 #ifdef KREPORT_SCRIPTING
 #include "KReportScriptImage.h"
 #endif
 
 KREPORT_PLUGIN_FACTORY(KReportImagePlugin, "image.json")
 
 KReportImagePlugin::KReportImagePlugin(QObject *parent, const QVariantList &args)
     : KReportPluginInterface(parent, args)
 {
     Q_UNUSED(args)
 }
 
 KReportImagePlugin::~KReportImagePlugin()
 {
 
 }
 
 QObject* KReportImagePlugin::createRendererInstance(const QDomNode& element)
 {
     return new KReportItemImage(element);
 }
 
 QObject* KReportImagePlugin::createDesignerInstance(const QDomNode& element, KReportDesigner* designer, QGraphicsScene* scene)
 {
     return new KReportDesignerItemImage(element, designer, scene);
 }
 
 QObject* KReportImagePlugin::createDesignerInstance(KReportDesigner* designer, QGraphicsScene* scene, const QPointF& pos)
 {
     return new KReportDesignerItemImage(designer, scene, pos);
 }
 
 #ifdef KREPORT_SCRIPTING
 QObject* KReportImagePlugin::createScriptInstance(KReportItemBase* item)
 {
     KReportItemImage *image = dynamic_cast(item);
     if (image) {
         return new Scripting::Image(image);
     }
-    return 0;
+    return nullptr;
 }
 #endif
 
 #include "KReportImagePlugin.moc"
diff --git a/src/items/image/KReportImagePlugin.h b/src/items/image/KReportImagePlugin.h
index 2d32a321..c9930b41 100644
--- a/src/items/image/KReportImagePlugin.h
+++ b/src/items/image/KReportImagePlugin.h
@@ -1,41 +1,43 @@
 /* This file is part of the KDE project
    Copyright (C) 2010 by Adam Pigg (adam@piggz.co.uk)
 
    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.1 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.
 */
 
 #ifndef KREPORTIMAGEPLUGIN_H
 #define KREPORTIMAGEPLUGIN_H
 
 #include "KReportStaticPluginInterface.h"
 
 KREPORT_DECLARE_STATIC_PLUGIN(KReportImagePlugin)
 
 class KReportImagePlugin : public KReportPluginInterface
 {
-    public:
+public:
     explicit KReportImagePlugin(QObject *parent, const QVariantList &args = QVariantList());
-    virtual ~KReportImagePlugin();
+    ~KReportImagePlugin() override;
 
-    virtual QObject* createRendererInstance(const QDomNode& element);
-    virtual QObject* createDesignerInstance(const QDomNode& element, KReportDesigner* , QGraphicsScene* scene);
-    virtual QObject* createDesignerInstance(KReportDesigner* , QGraphicsScene* scene, const QPointF& pos);
+    QObject *createRendererInstance(const QDomNode &element) override;
+    QObject *createDesignerInstance(const QDomNode &element, KReportDesigner *designer,
+                                    QGraphicsScene *scene) override;
+    QObject *createDesignerInstance(KReportDesigner *designer, QGraphicsScene *scene,
+                                    const QPointF &pos) override;
 #ifdef KREPORT_SCRIPTING
-    virtual QObject* createScriptInstance(KReportItemBase* item);
+    QObject *createScriptInstance(KReportItemBase *item) override;
 #endif
 };
 
 #endif // KREPORTIMAGEPLUGIN_H
diff --git a/src/items/image/KReportItemImage.h b/src/items/image/KReportItemImage.h
index fb1cf692..7b326fcc 100644
--- a/src/items/image/KReportItemImage.h
+++ b/src/items/image/KReportItemImage.h
@@ -1,61 +1,61 @@
 /* This file is part of the KDE project
  * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 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
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library.  If not, see .
  */
 
 #ifndef KREPORTITEMIMAGE_H
 #define KREPORTITEMIMAGE_H
 
 #include "KReportItemBase.h"
 
 class QDomNode;
 
 namespace Scripting
 {
 class Image;
 }
 
 class KReportItemImage : public KReportItemBase
 {
     Q_OBJECT
 public:
     KReportItemImage();
     explicit KReportItemImage(const QDomNode & element);
-    virtual ~KReportItemImage();
+    ~KReportItemImage() override;
 
-    virtual QString typeName() const;
-    virtual int renderSimpleData(OROPage *page, OROSection *section, const QPointF &offset, const QVariant &data, KReportScriptHandler *script);
+    QString typeName() const override;
+    int renderSimpleData(OROPage *page, OROSection *section, const QPointF &offset, const QVariant &data, KReportScriptHandler *script) override;
 
-    virtual QString itemDataSource() const;
+    QString itemDataSource() const override;
 
 protected:
     KProperty * m_controlSource;
     KProperty* m_resizeMode;
     KProperty* m_staticImage;
 
     void setMode(const QString&);
     void setInlineImageData(const QByteArray &dat, const QString& = QString());
     void setColumn(const QString&);
     QString mode() const;
     bool isInline() const;
     QByteArray inlineImageData() const;
 
 private:
-    virtual void createProperties();
+    void createProperties() override;
 
     friend class Scripting::Image;
 };
 
 #endif
diff --git a/src/items/image/KReportScriptImage.h b/src/items/image/KReportScriptImage.h
index 72591fa4..7226ef7d 100644
--- a/src/items/image/KReportScriptImage.h
+++ b/src/items/image/KReportScriptImage.h
@@ -1,103 +1,103 @@
 /* This file is part of the KDE project
  * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 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
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library.  If not, see .
  */
 
 #ifndef SCRIPTINGKRSCRIPTIMAGE_H
 #define SCRIPTINGKRSCRIPTIMAGE_H
 
 #include 
 #include 
 #include 
 
 class KReportItemImage;
 
 namespace Scripting
 {
 
     /**
      @brief Image item script interface
 
      The user facing interface for scripting report image items
      */
 class Image : public QObject
 {
     Q_OBJECT
 public:
     explicit Image(KReportItemImage *);
 
-    ~Image();
+    ~Image() override;
 public Q_SLOTS:
 
 
     /**
     * Get the position of the barcode
     * @return position in points
      */
     QPointF position() const;
 
 
     /**
      * Sets the position of the barcode in points
      * @param Position
      */
     void setPosition(const QPointF&);
 
     /**
      * Get the size of the barcode
      * @return size in points
      */
     QSizeF size() const;
 
     /**
      * Set the size of the barcode in points
      * @param Size
      */
     void setSize(const QSizeF&);
 
     /**
      * Get the resize mode for the image
      * @return resizeMode Clip or Stretch
      */
     QString resizeMode() const;
 
     /**
      * Sets the resize mode for the image
      * @param ResizeMode "Stretch" or "Clip" default is to clip
      */
     void setResizeMode(const QString &);
 
     /**
      * Sets the data for the static image
      * the data should be base64 encoded
      * @param RawImageData
      */
     void setInlineImage(const QByteArray&);
 
     /**
      * Get the data from a file (expected to be an image)
      * the returned data will be base64 encoded
      * @param Path location of file
      * @return File data enoded in base64
      */
     void loadFromFile(const QVariant &);
 private:
     KReportItemImage *m_image;
 
 };
 
 }
 
 #endif
diff --git a/src/items/label/KReportBoundedTextItem.h b/src/items/label/KReportBoundedTextItem.h
index 3bf1f500..5f2c2266 100644
--- a/src/items/label/KReportBoundedTextItem.h
+++ b/src/items/label/KReportBoundedTextItem.h
@@ -1,69 +1,69 @@
 /* This file is part of the KDE project
   Copyright (C) 2014 Adam Pigg 
   Copyright (C) 2016 Jarosław Staniek 
 
   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.1 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.
 */
 
 #ifndef KREPORT_BOUNDEDTEXTITEM_H
 #define KREPORT_BOUNDEDTEXTITEM_H
 
 #include 
 #include 
 
 /**
  * @brief Subclass of QGraphicsTextItem which simply forces
  * its boundingRect to be the same as its parent.
  * By default a QGraphicsTextItem will size to its text and
  * we want it to size to the parent item.
  *
  */
 class BoundedTextItem : public QGraphicsTextItem
 {
     Q_OBJECT
 
 public:
     explicit BoundedTextItem(QGraphicsItem *parent);
-    virtual QRectF boundingRect() const;
-    virtual void paint( QPainter *painter, const QStyleOptionGraphicsItem *o, QWidget *w);
+    QRectF boundingRect() const override;
+    void paint( QPainter *painter, const QStyleOptionGraphicsItem *o, QWidget *w) override;
     void setBackgroudColor(const QColor &bc);
     void setForegroundColor(const QColor &fc);
 
     //! @return background opacity, 0..1.0
     qreal backgroudOpacity() const;
 
     //! Sets background opacity, 0..1.0
     void setBackgroudOpacity(qreal opacity);
 
     void setDisplayFont(const QFont &f);
 
 
 protected:
-    virtual void keyReleaseEvent ( QKeyEvent * event );
+    void keyReleaseEvent ( QKeyEvent * event ) override;
 
 private:
     QColor m_backgroundColor;
     QColor m_foregroundColor;
     QFont m_font;
 
     qreal m_backgroundOpacity;
 
 Q_SIGNALS:
     void exitEditMode();
 
 };
 
 #endif // KREPORT_BOUNDEDTEXTITEM_H
diff --git a/src/items/label/KReportDesignerItemLabel.cpp b/src/items/label/KReportDesignerItemLabel.cpp
index 7a0a4688..95fa2250 100644
--- a/src/items/label/KReportDesignerItemLabel.cpp
+++ b/src/items/label/KReportDesignerItemLabel.cpp
@@ -1,221 +1,221 @@
 /* This file is part of the KDE project
  * Copyright (C) 2001-2007 by OpenMFG, LLC (info@openmfg.com)
  * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 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
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library.  If not, see .
  */
 
 #include "KReportDesignerItemLabel.h"
 #include "KReportDesignerItemBase.h"
 #include "KReportDesigner.h"
 #include "KReportDesignerSectionScene.h"
 #include "KReportLineStyle.h"
 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 
 void KReportDesignerItemLabel::init(QGraphicsScene *scene)
 {
     if (scene)
         scene->addItem(this);
 
     connect(propertySet(), SIGNAL(propertyChanged(KPropertySet&,KProperty&)),
             this, SLOT(slotPropertyChanged(KPropertySet&,KProperty&)));
 
     setZValue(z());
     setFlag(ItemIsFocusable);
 
     m_inlineEdit = new BoundedTextItem(this);
     m_inlineEdit->setVisible(false);
     m_inlineEdit->setFlag(ItemIsFocusable);
     m_inlineEdit->setFlag(ItemIsSelectable, false);
     QTextDocument *doc = new QTextDocument;
     doc->setDocumentMargin(0);
     doc->setPlainText(text());
     m_inlineEdit->setDocument(doc);
 
     connect(m_inlineEdit, SIGNAL(exitEditMode()), this, SLOT(exitInlineEditingMode()));
 }
 
 // methods (constructors)
 KReportDesignerItemLabel::KReportDesignerItemLabel(KReportDesigner* d, QGraphicsScene * scene, const QPointF &pos)
         : KReportDesignerItemRectBase(d, this)
 {
     Q_UNUSED(pos);
     init(scene);
     setSceneRect(properRect(*d, getTextRect().width(), getTextRect().height()));
     nameProperty()->setValue(designer()->suggestEntityName(typeName()));
 
     enterInlineEditingMode();
 }
 
 KReportDesignerItemLabel::KReportDesignerItemLabel(const QDomNode & element, KReportDesigner * d, QGraphicsScene * s)
-        : KReportItemLabel(element), KReportDesignerItemRectBase(d, this), m_inlineEdit(0)
+        : KReportItemLabel(element), KReportDesignerItemRectBase(d, this), m_inlineEdit(nullptr)
 {
     init(s);
     setSceneRect(KReportItemBase::scenePosition(item()->position()), KReportItemBase::sceneSize(item()->size()));
 }
 
 KReportDesignerItemLabel* KReportDesignerItemLabel::clone()
 {
     QDomDocument d;
     QDomElement e = d.createElement(QLatin1String("clone"));
     QDomNode n;
     buildXML(&d, &e);
     n = e.firstChild();
-    return new KReportDesignerItemLabel(n, designer(), 0);
+    return new KReportDesignerItemLabel(n, designer(), nullptr);
 }
 
 // methods (deconstructor)
 KReportDesignerItemLabel::~KReportDesignerItemLabel()
 {}
 
 QRectF KReportDesignerItemLabel::getTextRect() const
 {
     return QFontMetrics(font()).boundingRect(x(), y(), 0, 0, textFlags(), m_text->value().toString());
 }
 
 void KReportDesignerItemLabel::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget)
 {
     Q_UNUSED(option);
     Q_UNUSED(widget);
 
     if (m_inlineEdit->isVisible()) {
         return;
     }
 
     // store any values we plan on changing so we can restore them
     QFont f = painter->font();
     QPen  p = painter->pen();
 
     painter->setFont(font());
     painter->setBackgroundMode(Qt::TransparentMode);
 
     QColor bg = m_backgroundColor->value().value();
     bg.setAlphaF(m_backgroundOpacity->value().toReal() * 0.01);
 
     painter->setPen(m_foregroundColor->value().value());
 
     painter->fillRect(QGraphicsRectItem::rect(), bg);
     painter->drawText(rect(), textFlags(), text());
 
     if ((Qt::PenStyle)m_lineStyle->value().toInt() == Qt::NoPen || m_lineWeight->value().toInt() <= 0) {
         painter->setPen(QPen(QColor(224, 224, 224)));
     } else {
         painter->setPen(QPen(m_lineColor->value().value(), m_lineWeight->value().toInt(), (Qt::PenStyle)m_lineStyle->value().toInt()));
     }
 
     painter->drawRect(QGraphicsRectItem::rect());
     painter->setPen(m_foregroundColor->value().value());
 
     drawHandles(painter);
 
     // restore an values before we started just in case
     painter->setFont(f);
     painter->setPen(p);
 }
 
 void KReportDesignerItemLabel::buildXML(QDomDocument *doc, QDomElement *parent)
 {
     //kreportpluginDebug();
     QDomElement entity = doc->createElement(QLatin1String("report:") + typeName());
 
     // properties
     addPropertyAsAttribute(&entity, nameProperty());
     addPropertyAsAttribute(&entity, m_text);
     addPropertyAsAttribute(&entity, m_verticalAlignment);
     addPropertyAsAttribute(&entity, m_horizontalAlignment);
     entity.setAttribute(QLatin1String("report:z-index"), z());
 
     // bounding rect
     buildXMLRect(doc, &entity, this);
 
     //text style info
     buildXMLTextStyle(doc, &entity, textStyle());
 
     //Line Style
     buildXMLLineStyle(doc, &entity, lineStyle());
 
     parent->appendChild(entity);
 }
 
 void KReportDesignerItemLabel::slotPropertyChanged(KPropertySet &s, KProperty &p)
 {
     Q_UNUSED(s);
 
     if (p.name() == "name") {
         //For some reason p.oldValue returns an empty string
         if (!designer()->isEntityNameUnique(p.value().toString(), this)) {
             p.setValue(oldName());
         } else {
             setOldName(p.value().toString());
         }
     } else if (p.name() == "caption") {
         m_inlineEdit->setPlainText(p.value().toString());
     }
 
     KReportDesignerItemRectBase::propertyChanged(s, p);
     if (designer()) designer()->setModified(true);
 
 }
 
 void KReportDesignerItemLabel::enterInlineEditingMode()
 {
     if (!m_inlineEdit->isVisible()) {
         m_inlineEdit->setVisible(true);
         m_inlineEdit->setPlainText(text());
         m_inlineEdit->setFocus();
 
         QTextCursor c = m_inlineEdit->textCursor();
         c.select(QTextCursor::Document);
         m_inlineEdit->setTextCursor(c);
 
         m_inlineEdit->setFont(m_font->value().value());
         m_inlineEdit->setDefaultTextColor(m_foregroundColor->value().value());
         m_inlineEdit->setBackgroudColor(m_backgroundColor->value().value());
         m_inlineEdit->setBackgroudOpacity(m_backgroundOpacity->value().toDouble() / 100.0);
         m_inlineEdit->setForegroundColor(m_foregroundColor->value().value());
         m_inlineEdit->setFont(m_font->value().value());
 
         update();
     }
 }
 
 void KReportDesignerItemLabel::exitInlineEditingMode()
 {
     if (m_inlineEdit->isVisible()) {
         m_inlineEdit->setVisible(false);
         setText(m_inlineEdit->toPlainText());
     }
 }
 
 void KReportDesignerItemLabel::mouseDoubleClickEvent(QGraphicsSceneMouseEvent* event)
 {
     Q_UNUSED(event);
     enterInlineEditingMode();
 }
 
 void KReportDesignerItemLabel::keyReleaseEvent(QKeyEvent* event)
 {
     if (event->key() == Qt::Key_F2) {
         enterInlineEditingMode();
     } else {
         QGraphicsRectItem::keyReleaseEvent(event);
     }
 }
diff --git a/src/items/label/KReportDesignerItemLabel.h b/src/items/label/KReportDesignerItemLabel.h
index 8df953ed..e8336c9d 100644
--- a/src/items/label/KReportDesignerItemLabel.h
+++ b/src/items/label/KReportDesignerItemLabel.h
@@ -1,61 +1,62 @@
 /* This file is part of the KDE project
  * Copyright (C) 2001-2007 by OpenMFG, LLC (info@openmfg.com)
  * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 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
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library.  If not, see .
  */
 
 #ifndef KREPORTDESIGNERITEMLABEL_H
 #define KREPORTDESIGNERITEMLABEL_H
 
 #include "KReportItemLabel.h"
 #include "KReportDesignerItemRectBase.h"
 #include "KReportBoundedTextItem.h"
 
 #include 
 #include 
 #include 
 #include 
 
 class KReportDesignerItemLabel : public KReportItemLabel, public KReportDesignerItemRectBase
 {
   Q_OBJECT
 public:
-    KReportDesignerItemLabel(KReportDesigner *, QGraphicsScene * scene, const QPointF &pos);
-    KReportDesignerItemLabel(const QDomNode & element, KReportDesigner *, QGraphicsScene * scene);
-    virtual ~KReportDesignerItemLabel();
+    KReportDesignerItemLabel(KReportDesigner *designer, QGraphicsScene *scene, const QPointF &pos);
+    KReportDesignerItemLabel(const QDomNode &element, KReportDesigner *designer,
+                             QGraphicsScene *scene);
+    ~KReportDesignerItemLabel() override;
 
-    virtual void buildXML(QDomDocument *doc, QDomElement *parent);
-    virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0);
-    virtual KReportDesignerItemLabel* clone();
+    void buildXML(QDomDocument *doc, QDomElement *parent) override;
+    void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = nullptr) override;
+    KReportDesignerItemLabel* clone() override;
 
 public Q_SLOTS:
-    virtual void enterInlineEditingMode();
-    virtual void exitInlineEditingMode();
+    void enterInlineEditingMode() override;
+    void exitInlineEditingMode() override;
 
 protected:
-    virtual void mouseDoubleClickEvent ( QGraphicsSceneMouseEvent * event );
-    virtual void keyReleaseEvent ( QKeyEvent * event );
+    void mouseDoubleClickEvent ( QGraphicsSceneMouseEvent * event ) override;
+    void keyReleaseEvent ( QKeyEvent * event ) override;
 
 private:
     void init(QGraphicsScene *scene);
     QRectF getTextRect() const;
     BoundedTextItem *m_inlineEdit;
 
 private Q_SLOTS:
     void slotPropertyChanged(KPropertySet &, KProperty &);
 
 };
 
 #endif
diff --git a/src/items/label/KReportItemLabel.h b/src/items/label/KReportItemLabel.h
index c47878c4..9ad248bb 100644
--- a/src/items/label/KReportItemLabel.h
+++ b/src/items/label/KReportItemLabel.h
@@ -1,72 +1,72 @@
 /* This file is part of the KDE project
  * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 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
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library.  If not, see .
  */
 
 #ifndef KReportItemLabel_H
 #define KReportItemLabel_H
 
 #include "KReportItemBase.h"
 
 #include 
 
 class QDomNode;
 
 namespace Scripting
 {
 class Label;
 }
 
 /**
 */
 class KReportItemLabel : public KReportItemBase
 {
 Q_OBJECT
 public:
     KReportItemLabel();
     explicit KReportItemLabel(const QDomNode & element);
-    virtual ~KReportItemLabel();
+    ~KReportItemLabel() override;
 
-    virtual QString typeName() const;
-    virtual int renderSimpleData(OROPage *page, OROSection *section, const QPointF &offset, const QVariant &data, KReportScriptHandler *script);
+    QString typeName() const override;
+    int renderSimpleData(OROPage *page, OROSection *section, const QPointF &offset, const QVariant &data, KReportScriptHandler *script) override;
 
 protected:
 
     KProperty *m_text;
     KProperty *m_horizontalAlignment;
     KProperty *m_verticalAlignment;
     KProperty *m_font;
     KProperty *m_foregroundColor;
     KProperty *m_backgroundColor;
     KProperty *m_backgroundOpacity;
     KProperty *m_lineColor;
     KProperty *m_lineWeight;
     KProperty *m_lineStyle;
 
     QString text() const;
     QFont font() const {
         return m_font->value().value();
     }
     Qt::Alignment textFlags() const;
     void setText(const QString&);
     KReportTextStyleData textStyle() const;
     KReportLineStyle lineStyle() const;
 
 private:
-    virtual void createProperties();
+    void createProperties() override;
 
     friend class Scripting::Label;
 };
 #endif
diff --git a/src/items/label/KReportLabelPlugin.cpp b/src/items/label/KReportLabelPlugin.cpp
index 9af63234..7bae6b45 100644
--- a/src/items/label/KReportLabelPlugin.cpp
+++ b/src/items/label/KReportLabelPlugin.cpp
@@ -1,107 +1,107 @@
 /* This file is part of the KDE project
    Copyright (C) 2010 by Adam Pigg (adam@piggz.co.uk)
 
    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.1 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 "KReportLabelPlugin.h"
 #include "KReportItemLabel.h"
 #include "KReportDesignerItemLabel.h"
 #include "KReportDesigner.h"
 #include "KReportPluginMetaData.h"
 #include "KReportLabelElement.h"
 #include "KReportLineStyle.h"
 #include "KReportUtils.h"
 
 #ifdef KREPORT_SCRIPTING
 #include "KReportScriptLabel.h"
 #endif
 
 #include 
 
 KREPORT_PLUGIN_FACTORY(KReportLabelPlugin, "label.json")
 
 KReportLabelPlugin::KReportLabelPlugin(QObject *parent, const QVariantList &args)
     : KReportPluginInterface(parent, args)
 {
 }
 
 KReportLabelPlugin::~KReportLabelPlugin()
 {
 
 }
 
 QObject* KReportLabelPlugin::createRendererInstance(const QDomNode &elem)
 {
     return new KReportItemLabel(elem);
 }
 
 QObject* KReportLabelPlugin::createDesignerInstance(KReportDesigner* designer, QGraphicsScene* scene, const QPointF &pos)
 {
     return new KReportDesignerItemLabel(designer, scene, pos);
 }
 
 QObject* KReportLabelPlugin::createDesignerInstance(const QDomNode & element, KReportDesigner *designer, QGraphicsScene * scene)
 {
     return new KReportDesignerItemLabel(element, designer, scene);
 }
 
 KReportElement KReportLabelPlugin::createElement()
 {
     return KReportLabelElement();
 }
 
 bool KReportLabelPlugin::loadElement(KReportElement *el, const QDomElement &dom, KReportDesignReadingStatus *status)
 {
     if (!KReportPluginInterface::loadElement(el, dom, status)) {
         return false;
     }
     KReportLabelElement label(*el);
     label.setText(KReportUtils::attr(dom, "report:caption", QString()));
     QString s = KReportUtils::attr(dom, "report:horizontal-align", QString());
     Qt::Alignment alignment = KReportUtils::horizontalAlignment(s, label.alignment() & Qt::AlignHorizontal_Mask);
     s = KReportUtils::attr(dom, "report:vertical-align", QString());
     alignment |= KReportUtils::verticalAlignment(s, label.alignment() & Qt::AlignVertical_Mask);
     label.setAlignment(alignment);
 
     const QDomElement textStyleDom = dom.firstChildElement(QLatin1String("report:text-style"));
     QFont font(label.font());
     KReportUtils::readFontAttributes(textStyleDom, &font);
     label.setFont(font);
 
     const QDomElement lineStyleDom = dom.firstChildElement(QLatin1String("report:line-style"));
     KReportLineStyle borderStyle(label.borderStyle());
     s = KReportUtils::attr(lineStyleDom, "report:line-style", QString());
     borderStyle.setPenStyle(KReportUtils::penStyle(s, borderStyle.penStyle()));
     borderStyle.setColor(KReportUtils::attr(lineStyleDom, "report:line-color", borderStyle.color()));
     // border-line-width could be better name but it's too late...
     borderStyle.setWeight(KReportUtils::attr(lineStyleDom, "report:line-weight", borderStyle.weight()));
     label.setBorderStyle(borderStyle);
     return true;
 }
 
 #ifdef KREPORT_SCRIPTING
 QObject* KReportLabelPlugin::createScriptInstance(KReportItemBase *item)
 {
     KReportItemLabel *label = dynamic_cast(item);
     if (label) {
         return new Scripting::Label(label);
     }
-    return 0;
+    return nullptr;
 }
 #endif
 
 #include "KReportLabelPlugin.moc"
diff --git a/src/items/label/KReportLabelPlugin.h b/src/items/label/KReportLabelPlugin.h
index 5e332903..227f5598 100644
--- a/src/items/label/KReportLabelPlugin.h
+++ b/src/items/label/KReportLabelPlugin.h
@@ -1,45 +1,49 @@
 /* This file is part of the KDE project
    Copyright (C) 2010 by Adam Pigg (adam@piggz.co.uk)
 
    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.1 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.
 */
 
 #ifndef KReportLabelPlugin_H
 #define KReportLabelPlugin_H
 
 #include "KReportStaticPluginInterface.h"
 
 KREPORT_DECLARE_STATIC_PLUGIN(KReportLabelPlugin)
 
 class KReportLabelPlugin : public KReportPluginInterface
 {
     Q_OBJECT
 public:
-    explicit KReportLabelPlugin(QObject *parent = 0, const QVariantList &args = QVariantList());
-
-    virtual ~KReportLabelPlugin();
-
-    virtual QObject* createRendererInstance(const QDomNode&);
-    virtual QObject* createDesignerInstance(KReportDesigner* , QGraphicsScene* scene, const QPointF&);
-    virtual QObject* createDesignerInstance(const QDomNode & element, KReportDesigner *, QGraphicsScene * scene);
-    virtual KReportElement createElement() Q_DECL_OVERRIDE;
-    virtual bool loadElement(KReportElement *el, const QDomElement &dom, KReportDesignReadingStatus *status) Q_DECL_OVERRIDE;
+    explicit KReportLabelPlugin(QObject *parent = nullptr,
+                                const QVariantList &args = QVariantList());
+
+    ~KReportLabelPlugin() override;
+
+    QObject *createRendererInstance(const QDomNode &) override;
+    QObject *createDesignerInstance(KReportDesigner *designer, QGraphicsScene *scene,
+                                    const QPointF &) override;
+    QObject *createDesignerInstance(const QDomNode &element, KReportDesigner *designer,
+                                    QGraphicsScene *scene) override;
+    KReportElement createElement() override;
+    bool loadElement(KReportElement *el, const QDomElement &dom,
+                     KReportDesignReadingStatus *status) override;
 #ifdef KREPORT_SCRIPTING
-    virtual QObject* createScriptInstance(KReportItemBase* item);
+    QObject *createScriptInstance(KReportItemBase *item) override;
 #endif
 };
 
 #endif // KReportLabelPlugin_H
diff --git a/src/items/label/KReportScriptLabel.h b/src/items/label/KReportScriptLabel.h
index 748c3a9d..9704af99 100644
--- a/src/items/label/KReportScriptLabel.h
+++ b/src/items/label/KReportScriptLabel.h
@@ -1,101 +1,101 @@
 /* This file is part of the KDE project
  * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 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
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library.  If not, see .
  */
 
 #ifndef KRSCRIPTLABEL_H
 #define KRSCRIPTLABEL_H
 
 #include 
 
 #include "KReportItemLabel.h"
 
 /**
  @brief Label item script interface
 
  The user facing interface for scripting report label items
  */
 namespace Scripting
 {
 class Label : public QObject
 {
     Q_OBJECT
 public:
     explicit Label(KReportItemLabel *);
 
-    ~Label();
+    ~Label() override;
 
 public Q_SLOTS:
     //!Return the label caption
     QString caption() const;
     //!Sets the label caption
     void setCaption(const QString&);
 
     //!Returns the horizontal alignment of the label, -1 = left, 0 = center, 1 = right
     int horizontalAlignment() const;
     //!Sets the horizontal alignment.  Valid values are -1, 0, 1
     void setHorizonalAlignment(int);
 
     //!Returns the vertical alignment of the label, -1 = left, 0 = center, 1 = right
     int verticalAlignment() const;
     //!Sets the vertical alignment.  Valid values are -1, 0, 1
     void setVerticalAlignment(int);
 
     //!Returns the background color of the label
     QColor backgroundColor() const;
     //!Sets the background color
     void setBackgroundColor(const QColor&);
 
     //!Returns the foreground (text) color of the label
     QColor foregroundColor() const;
     //!Srets the foreground (text) color
     void setForegroundColor(const QColor&);
 
     //!Returns the background opacity
     int backgroundOpacity() const;
     //!Sets the background opacity.  Values 0-100
     void setBackgroundOpacity(int);
 
     //!Returns the line color of the label
     QColor lineColor() const;
     //!Sets the line color of the label
     void setLineColor(const QColor&);
 
     //!Returns the line weight (width) of the label
     int lineWeight() const;
     //!Sets the line weight (width) of the label
     void setLineWeight(int);
 
     //! Returns the line style.  Valid values are those from Qt::PenStyle (0-5)
     int lineStyle() const;
     //! Srts the line style.  Valid values are those from Qt::PenStyle (0-5)
     void setLineStyle(int);
 
     //!Returns the position of the label within the parent section
     QPointF position() const;
     //!Sets the position of the label within the parent section
     void setPosition(const QPointF&);
 
     //!Returns the size of the label
     QSizeF size() const;
     //!Serts the size of the label
     void setSize(const QSizeF&);
 
 private:
     KReportItemLabel *m_label;
 };
 }
 
 #endif
diff --git a/src/items/text/KReportDesignerItemText.cpp b/src/items/text/KReportDesignerItemText.cpp
index 6c65249e..377d9933 100644
--- a/src/items/text/KReportDesignerItemText.cpp
+++ b/src/items/text/KReportDesignerItemText.cpp
@@ -1,177 +1,177 @@
 /* This file is part of the KDE project
  * Copyright (C) 2001-2007 by OpenMFG, LLC (info@openmfg.com)
  * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 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
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library.  If not, see .
  */
 
 #include "KReportDesignerItemText.h"
 #include "KReportDesignerItemBase.h"
 #include "KReportDesigner.h"
 #include "KReportLineStyle.h"
 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include "kreportplugin_debug.h"
 
 //
 // class ReportEntityText
 //
 // methods (constructors)
 
 void KReportDesignerItemText::init(QGraphicsScene *scene)
 {
     //setFlags(ItemIsSelectable | ItemIsMovable);
     if (scene)
         scene->addItem(this);
 
     connect(propertySet(), SIGNAL(propertyChanged(KPropertySet&,KProperty&)),
             this, SLOT(slotPropertyChanged(KPropertySet&,KProperty&)));
 
     m_controlSource->setListData(designer()->fieldKeys(), designer()->fieldNames());
     setZValue(z());
 
     updateRenderText(m_controlSource->value().toString(), m_itemValue->value().toString(),
                      QLatin1String("textarea"));
 }
 
 KReportDesignerItemText::KReportDesignerItemText(KReportDesigner * rw, QGraphicsScene * scene, const QPointF &pos)
         : KReportDesignerItemRectBase(rw, this)
 {
     Q_UNUSED(pos);
     init(scene);
     setSceneRect(properRect(*rw, getTextRect().width(), getTextRect().height()));
     nameProperty()->setValue(designer()->suggestEntityName(typeName()));
 }
 
 KReportDesignerItemText::KReportDesignerItemText(const QDomNode & element, KReportDesigner *d, QGraphicsScene *scene)
         : KReportItemText(element), KReportDesignerItemRectBase(d, this)
 {
     init(scene);
     setSceneRect(KReportItemBase::scenePosition(item()->position()), KReportItemBase::sceneSize(item()->size()));
 }
 
 KReportDesignerItemText* KReportDesignerItemText::clone()
 {
     QDomDocument d;
     QDomElement e = d.createElement(QLatin1String("clone"));
     QDomNode n;
     buildXML(&d, &e);
     n = e.firstChild();
-    return new KReportDesignerItemText(n, designer(), 0);
+    return new KReportDesignerItemText(n, designer(), nullptr);
 }
 
 KReportDesignerItemText::~KReportDesignerItemText
 
 ()
 {}
 
 QRect KReportDesignerItemText::getTextRect() const
 {
     return QFontMetrics(font()).boundingRect(int (x()), int (y()), 0, 0, textFlags(), renderText());
 }
 
 void KReportDesignerItemText::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget)
 {
     Q_UNUSED(option);
     Q_UNUSED(widget)
 
     // store any values we plan on changing so we can restore them
     QFont f = painter->font();
     QPen  p = painter->pen();
 
     painter->setFont(font());
     painter->setBackgroundMode(Qt::TransparentMode);
 
     QColor bg = m_backgroundColor->value().value();
     bg.setAlphaF(m_backgroundOpacity->value().toReal()*0.01);
 
     painter->setPen(m_foregroundColor->value().value());
 
     painter->fillRect(rect(),  bg);
     painter->drawText(rect(), textFlags(), renderText());
 
     if ((Qt::PenStyle)m_lineStyle->value().toInt() == Qt::NoPen || m_lineWeight->value().toInt() <= 0) {
         painter->setPen(QPen(Qt::lightGray));
     } else {
         painter->setPen(QPen(m_lineColor->value().value(), m_lineWeight->value().toInt(), (Qt::PenStyle)m_lineStyle->value().toInt()));
     }
     painter->drawRect(rect());
 
     painter->setPen(m_foregroundColor->value().value());
 
     drawHandles(painter);
 
     // restore an values before we started just in case
     painter->setFont(f);
     painter->setPen(p);
 }
 
 void KReportDesignerItemText::buildXML(QDomDocument *doc, QDomElement *parent)
 {
     //kreportpluginDebug();
     QDomElement entity = doc->createElement(QLatin1String("report:") + typeName());
 
     // properties
     addPropertyAsAttribute(&entity, nameProperty());
     addPropertyAsAttribute(&entity, m_controlSource);
     addPropertyAsAttribute(&entity, m_verticalAlignment);
     addPropertyAsAttribute(&entity, m_horizontalAlignment);
     entity.setAttribute(QLatin1String("report:bottom-padding"), m_bottomPadding);
     entity.setAttribute(QLatin1String("report:z-index"), z());
     addPropertyAsAttribute(&entity, m_itemValue);
 
     // bounding rect
     buildXMLRect(doc, &entity, this);
 
     //text style info
     buildXMLTextStyle(doc, &entity, textStyle());
 
     //Line Style
     buildXMLLineStyle(doc, &entity, lineStyle());
 
     parent->appendChild(entity);
 }
 
 void KReportDesignerItemText::mousePressEvent(QGraphicsSceneMouseEvent * event)
 {
     m_controlSource->setListData(designer()->fieldKeys(), designer()->fieldNames());
     KReportDesignerItemRectBase::mousePressEvent(event);
 }
 
 
 void KReportDesignerItemText::slotPropertyChanged(KPropertySet &s, KProperty &p)
 {
     Q_UNUSED(s);
 
     if (p.name() == "name") {
         //For some reason p.oldValue returns an empty string
         if (!designer()->isEntityNameUnique(p.value().toString(), this)) {
             p.setValue(oldName());
         } else {
             setOldName(p.value().toString());
         }
     }
 
     KReportDesignerItemRectBase::propertyChanged(s, p);
     if (designer()) {
         designer()->setModified(true);
     }
 
     updateRenderText(m_controlSource->value().toString(), m_itemValue->value().toString(),
                      QLatin1String("textarea"));
 }
diff --git a/src/items/text/KReportDesignerItemText.h b/src/items/text/KReportDesignerItemText.h
index 20b73292..ab2a48eb 100644
--- a/src/items/text/KReportDesignerItemText.h
+++ b/src/items/text/KReportDesignerItemText.h
@@ -1,54 +1,55 @@
 /* This file is part of the KDE project
  * Copyright (C) 2001-2007 by OpenMFG, LLC (info@openmfg.com)
  * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 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
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library.  If not, see .
  */
 
 
 #ifndef KREPORTDESIGNERITEMTEXT_H
 #define KREPORTDESIGNERITEMTEXT_H
 
 #include "KReportDesignerItemRectBase.h"
 #include "KReportItemText.h"
 
 #include 
 
 //
 // ReportEntityText
 //
 class KReportDesignerItemText : public KReportItemText, public KReportDesignerItemRectBase
 {
   Q_OBJECT
 public:
-    KReportDesignerItemText(KReportDesigner *, QGraphicsScene * scene, const QPointF &pos);
-    KReportDesignerItemText(const QDomNode & element, KReportDesigner *, QGraphicsScene * scene);
-    virtual ~KReportDesignerItemText();
+    KReportDesignerItemText(KReportDesigner *designer, QGraphicsScene *scene, const QPointF &pos);
+    KReportDesignerItemText(const QDomNode &element, KReportDesigner *designer,
+                            QGraphicsScene *scene);
+    ~KReportDesignerItemText() override;
 
-    virtual void buildXML(QDomDocument *doc, QDomElement *parent);
-    virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0);
-    virtual KReportDesignerItemText* clone();
+    void buildXML(QDomDocument *doc, QDomElement *parent) override;
+    void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = nullptr) override;
+    KReportDesignerItemText* clone() override;
 
 protected:
-    virtual void mousePressEvent(QGraphicsSceneMouseEvent * event);
+    void mousePressEvent(QGraphicsSceneMouseEvent * event) override;
 
 private:
     QRect getTextRect() const;
     void init(QGraphicsScene *scene);
 
 private Q_SLOTS:
     void slotPropertyChanged(KPropertySet &, KProperty &);
 };
 
 #endif
diff --git a/src/items/text/KReportItemText.h b/src/items/text/KReportItemText.h
index b469b9f3..c92e53cd 100644
--- a/src/items/text/KReportItemText.h
+++ b/src/items/text/KReportItemText.h
@@ -1,82 +1,82 @@
 /* This file is part of the KDE project
  * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 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
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library.  If not, see .
  */
 
 #ifndef KREPORTITEMTEXT_H
 #define KREPORTITEMTEXT_H
 
 #include "KReportItemBase.h"
 
 #include 
 
 class QDomNode;
 
 namespace Scripting
 {
 class Text;
 
 }
 /**
 */
 class KReportItemText : public KReportItemBase
 {
 Q_OBJECT
 public:
     KReportItemText();
     explicit KReportItemText(const QDomNode & element);
-    virtual ~KReportItemText();
+    ~KReportItemText() override;
 
-    virtual QString typeName() const;
-    virtual int renderSimpleData(OROPage *page, OROSection *section, const QPointF &offset, const QVariant &data, KReportScriptHandler *script);
+    QString typeName() const override;
+    int renderSimpleData(OROPage *page, OROSection *section, const QPointF &offset, const QVariant &data, KReportScriptHandler *script) override;
 
-    virtual QString itemDataSource() const;
+    QString itemDataSource() const override;
 
 protected:
 
     KProperty* m_controlSource;
     KProperty* m_horizontalAlignment;
     KProperty* m_verticalAlignment;
     KProperty* m_font;
     KProperty* m_foregroundColor;
     KProperty* m_backgroundColor;
     KProperty* m_backgroundOpacity;
     KProperty* m_lineColor;
     KProperty* m_lineWeight;
     KProperty* m_lineStyle;
     KProperty* m_itemValue;
 
 
     qreal m_bottomPadding;
 
     Qt::Alignment textFlags() const;
     QFont font() const {
         return m_font->value().value();
     }
 
     void setBottomPadding(qreal bp);
     qreal bottomPadding() const;
 
 
     KReportTextStyleData textStyle() const;
     KReportLineStyle lineStyle() const;
 
 private:
-    virtual void createProperties();
+    void createProperties() override;
 
     friend class Scripting::Text;
 };
 
 #endif
diff --git a/src/items/text/KReportScriptText.h b/src/items/text/KReportScriptText.h
index a97ec48e..2e1e388c 100644
--- a/src/items/text/KReportScriptText.h
+++ b/src/items/text/KReportScriptText.h
@@ -1,104 +1,104 @@
 /* This file is part of the KDE project
  * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 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
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library.  If not, see .
  */
 #ifndef SCRIPTINGKRSCRIPTTEXT_H
 #define SCRIPTINGKRSCRIPTTEXT_H
 
 #include 
 
 #include "KReportItemText.h"
 
 namespace Scripting
 {
 
 /**
 @brief Text item script interface
 
 The user facing interface for scripting report text items
 */
 class Text : public QObject
 {
     Q_OBJECT
 public:
     explicit Text(KReportItemText*);
 
-    ~Text();
+    ~Text() override;
 public Q_SLOTS:
 
     //!Returns the source (column) that the text item gets its data from
     QString source() const;
     //!Sets the source (column) for the field
     void setSource(const QString&);
 
     //!Returns the horizontal alignment of the label, -1 = left, 0 = center, 1 = right
     int horizontalAlignment() const;
     //!Sets the horizontal alignment.  Valid values are -1, 0, 1
     void setHorizonalAlignment(int);
 
     //!Returns the vertical alignment of the label, -1 = left, 0 = center, 1 = right
     int verticalAlignment() const;
     //!Sets the vertical alignment.  Valid values are -1, 0, 1
     void setVerticalAlignment(int);
 
     //!Returns the background color of the label
     QColor backgroundColor() const;
     //!Sets the background color
     void setBackgroundColor(const QColor&);
 
     //!Returns the foreground (text) color of the label
     QColor foregroundColor() const;
     //!Srets the foreground (text) color
     void setForegroundColor(const QColor&);
 
     //!Returns the background opacity
     int backgroundOpacity() const;
     //!Sets the background opacity.  Values 0-100
     void setBackgroundOpacity(int);
 
     //!Returns the line color of the label
     QColor lineColor() const;
     //!Sets the line color of the label
     void setLineColor(const QColor&);
 
     //!Returns the line weight (width) of the label
     int lineWeight() const;
     //!Sets the line weight (width) of the label
     void setLineWeight(int);
 
     //! Returns the line style.  Valid values are those from Qt::PenStyle (0-5)
     int lineStyle() const;
     //! Srts the line style.  Valid values are those from Qt::PenStyle (0-5)
     void setLineStyle(int);
 
     //!Returns the position of the label within the parent section
     QPointF position() const;
     //!Sets the position of the label within the parent section
     void setPosition(const QPointF&);
 
     //!Returns the size of the label
     QSizeF size() const;
     //!Serts the size of the label
     void setSize(const QSizeF&);
 
     //!Load the contets for the text item from the given file
     void loadFromFile(const QString& fileName);
 private:
     KReportItemText *m_text;
 };
 
 }
 
 #endif
diff --git a/src/items/text/KReportTextPlugin.cpp b/src/items/text/KReportTextPlugin.cpp
index de09867a..5dac6614 100644
--- a/src/items/text/KReportTextPlugin.cpp
+++ b/src/items/text/KReportTextPlugin.cpp
@@ -1,66 +1,66 @@
 /* This file is part of the KDE project
    Copyright (C) 2010 by Adam Pigg (adam@piggz.co.uk)
 
    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.1 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 "KReportTextPlugin.h"
 #include "KReportItemText.h"
 #include "KReportDesignerItemText.h"
 #include "KReportPluginMetaData.h"
 #ifdef KREPORT_SCRIPTING
 #include "KReportScriptText.h"
 #endif
 
 KREPORT_PLUGIN_FACTORY(KReportTextPlugin, "text.json")
 
 KReportTextPlugin::KReportTextPlugin(QObject *parent, const QVariantList &args)
     : KReportPluginInterface(parent, args)
 {
 }
 
 KReportTextPlugin::~KReportTextPlugin()
 {
 
 }
 
 QObject* KReportTextPlugin::createRendererInstance(const QDomNode& element)
 {
     return new KReportItemText(element);
 }
 
 QObject* KReportTextPlugin::createDesignerInstance(const QDomNode& element, KReportDesigner* designer, QGraphicsScene* scene)
 {
     return new KReportDesignerItemText(element, designer, scene);
 }
 
 QObject* KReportTextPlugin::createDesignerInstance(KReportDesigner* designer, QGraphicsScene* scene, const QPointF& pos)
 {
     return new KReportDesignerItemText(designer, scene, pos);
 }
 
 #ifdef KREPORT_SCRIPTING
 QObject* KReportTextPlugin::createScriptInstance(KReportItemBase* item)
 {
     KReportItemText *text = dynamic_cast(item);
     if (text) {
         return new Scripting::Text(text);
     }
-    return 0;
+    return nullptr;
 }
 #endif
 
 #include "KReportTextPlugin.moc"
diff --git a/src/items/text/KReportTextPlugin.h b/src/items/text/KReportTextPlugin.h
index dc843bd5..3e4492d3 100644
--- a/src/items/text/KReportTextPlugin.h
+++ b/src/items/text/KReportTextPlugin.h
@@ -1,41 +1,43 @@
 /* This file is part of the KDE project
    Copyright (C) 2010 by Adam Pigg (adam@piggz.co.uk)
 
    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.1 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.
 */
 
 #ifndef KReportTextPlugin_H
 #define KReportTextPlugin_H
 
 #include "KReportStaticPluginInterface.h"
 
 KREPORT_DECLARE_STATIC_PLUGIN(KReportTextPlugin)
 
 class KReportTextPlugin : public KReportPluginInterface
 {
-    public:
+public:
     explicit KReportTextPlugin(QObject *parent, const QVariantList &args = QVariantList());
-    virtual ~KReportTextPlugin();
+    ~KReportTextPlugin() override;
 
-    virtual QObject* createRendererInstance(const QDomNode& element);
-    virtual QObject* createDesignerInstance(const QDomNode& element, KReportDesigner* , QGraphicsScene* scene);
-    virtual QObject* createDesignerInstance(KReportDesigner* , QGraphicsScene* scene, const QPointF& pos);
+    QObject *createRendererInstance(const QDomNode &element) override;
+    QObject *createDesignerInstance(const QDomNode &element, KReportDesigner *designer,
+                                    QGraphicsScene *scene) override;
+    QObject *createDesignerInstance(KReportDesigner *designer, QGraphicsScene *scene,
+                                    const QPointF &pos) override;
 #ifdef KREPORT_SCRIPTING
-    virtual QObject* createScriptInstance(KReportItemBase* item);
+    QObject *createScriptInstance(KReportItemBase *item) override;
 #endif
 };
 
 #endif // KReportTextPlugin_H
diff --git a/src/plugins/barcode/KReportBarcodePlugin.cpp b/src/plugins/barcode/KReportBarcodePlugin.cpp
index 8b1de9ed..64d8da3f 100644
--- a/src/plugins/barcode/KReportBarcodePlugin.cpp
+++ b/src/plugins/barcode/KReportBarcodePlugin.cpp
@@ -1,66 +1,66 @@
 /* This file is part of the KDE project
    Copyright (C) 2010 by Adam Pigg (adam@piggz.co.uk)
 
    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.1 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 "KReportBarcodePlugin.h"
 #include "KReportItemBarcode.h"
 #include "KReportDesignerItemBarcode.h"
 #include "KReportPluginMetaData.h"
 #ifdef KREPORT_SCRIPTING
 #include "KReportScriptBarcode.h"
 #endif
 
 
 KREPORT_PLUGIN_FACTORY(KReportBarcodePlugin, "kreport_barcodeplugin.json")
 
 KReportBarcodePlugin::KReportBarcodePlugin(QObject *parent, const QVariantList &args)
     : KReportPluginInterface(parent, args)
 {
 }
 
 KReportBarcodePlugin::~KReportBarcodePlugin()
 {
 }
 
 QObject* KReportBarcodePlugin::createRendererInstance(const QDomNode& element)
 {
     return new KReportItemBarcode(element);
 }
 
 QObject* KReportBarcodePlugin::createDesignerInstance(const QDomNode& element, KReportDesigner* designer , QGraphicsScene* scene)
 {
     return new KReportDesignerItemBarcode(element, designer, scene);
 }
 
 QObject* KReportBarcodePlugin::createDesignerInstance(KReportDesigner* designer, QGraphicsScene* scene, const QPointF& pos)
 {
     return new KReportDesignerItemBarcode(designer, scene, pos);
 }
 
 #ifdef KREPORT_SCRIPTING
 QObject* KReportBarcodePlugin::createScriptInstance(KReportItemBase* item)
 {
     KReportItemBarcode *barcode = dynamic_cast(item);
     if (barcode) {
         return new Scripting::Barcode(barcode);
     }
-    return 0;
+    return nullptr;
 }
 #endif
 
 #include "KReportBarcodePlugin.moc"
diff --git a/src/plugins/barcode/KReportBarcodePlugin.h b/src/plugins/barcode/KReportBarcodePlugin.h
index 14d284fb..96f7721d 100644
--- a/src/plugins/barcode/KReportBarcodePlugin.h
+++ b/src/plugins/barcode/KReportBarcodePlugin.h
@@ -1,39 +1,41 @@
 /* This file is part of the KDE project
    Copyright (C) 2010 by Adam Pigg (adam@piggz.co.uk)
 
    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.1 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.
 */
 
 #ifndef KREPORTBARCODEPLUGIN_H
 #define KREPORTBARCODEPLUGIN_H
 
 #include 
 
 class KReportBarcodePlugin : public KReportPluginInterface
 {
-    public:
+public:
     explicit KReportBarcodePlugin(QObject *parent, const QVariantList &args = QVariantList());
-    virtual ~KReportBarcodePlugin();
+    ~KReportBarcodePlugin() override;
 
-    virtual QObject* createRendererInstance(const QDomNode& element);
-    virtual QObject* createDesignerInstance(const QDomNode& element, KReportDesigner* , QGraphicsScene* scene);
-    virtual QObject* createDesignerInstance(KReportDesigner* , QGraphicsScene* scene, const QPointF& pos);
+    QObject *createRendererInstance(const QDomNode &element) override;
+    QObject *createDesignerInstance(const QDomNode &element, KReportDesigner *designer,
+                                    QGraphicsScene *scene) override;
+    QObject *createDesignerInstance(KReportDesigner *designer, QGraphicsScene *scene,
+                                    const QPointF &pos) override;
 #ifdef KREPORT_SCRIPTING
-    virtual QObject* createScriptInstance(KReportItemBase* item);
+    QObject *createScriptInstance(KReportItemBase *item) override;
 #endif
 };
 
 #endif // KREPORTBARCODEPLUGIN_H
diff --git a/src/plugins/barcode/KReportDesignerItemBarcode.cpp b/src/plugins/barcode/KReportDesignerItemBarcode.cpp
index aa4c25f8..916c849c 100644
--- a/src/plugins/barcode/KReportDesignerItemBarcode.cpp
+++ b/src/plugins/barcode/KReportDesignerItemBarcode.cpp
@@ -1,173 +1,173 @@
 /* This file is part of the KDE project
  * Copyright (C) 2001-2007 by OpenMFG, LLC (info@openmfg.com)
  * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 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
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library.  If not, see .
  */
 
 #include "KReportDesignerItemBarcode.h"
 #include "KReportDesignerItemBase.h"
 #include "KReportDesigner.h"
 
 #include "barcodepaint.h"
 
 #include 
 #include 
 
 #include 
 #include 
 #include 
 #include 
 #include "kreportplugin_debug.h"
 
 void KReportDesignerItemBarcode::init(QGraphicsScene *scene)
 {
     if (scene)
         scene->addItem(this);
 
     connect(propertySet(), SIGNAL(propertyChanged(KPropertySet&,KProperty&)),
             this, SLOT(slotPropertyChanged(KPropertySet&,KProperty&)));
 
     setMaxLength(5);
     setZ(z());
 
     updateRenderText(m_itemValue->value().toString().isEmpty() ?  m_format->value().toString() : QString(), m_itemValue->value().toString(), QString());
 
 }
 // methods (constructors)
 KReportDesignerItemBarcode::KReportDesignerItemBarcode(KReportDesigner * rw, QGraphicsScene* scene, const QPointF &pos)
         : KReportDesignerItemRectBase(rw, this)
 {
     Q_UNUSED(pos);
     init(scene);
     setSceneRect(properRect(*rw, m_minWidthTotal*m_dpiX, m_minHeight*m_dpiY));
     nameProperty()->setValue(designer()->suggestEntityName(typeName()));
 }
 
 KReportDesignerItemBarcode::KReportDesignerItemBarcode(const QDomNode & element, KReportDesigner * rw, QGraphicsScene* scene)
         : KReportItemBarcode(element), KReportDesignerItemRectBase(rw, this)
 {
     init(scene);
     setSceneRect(KReportItemBase::scenePosition(item()->position()), KReportItemBase::sceneSize(item()->size()));
 }
 
 KReportDesignerItemBarcode* KReportDesignerItemBarcode::clone()
 {
     QDomDocument d;
     QDomElement e = d.createElement(QLatin1String("clone"));
     QDomNode n;
     buildXML(&d, &e);
     n = e.firstChild();
-    return new KReportDesignerItemBarcode(n, designer(), 0);
+    return new KReportDesignerItemBarcode(n, designer(), nullptr);
 }
 
 // methods (deconstructor)
 KReportDesignerItemBarcode::~KReportDesignerItemBarcode()
 {}
 
 QRect KReportDesignerItemBarcode::getTextRect()
 {
     QFont fnt = QFont();
     return QFontMetrics(fnt)
             .boundingRect(int (x()), int (y()), 0, 0, 0,
                           dataSourceAndObjectTypeName(itemDataSource(), QLatin1String("barcode")));
 }
 
 void KReportDesignerItemBarcode::paint(QPainter* painter,
                                         const QStyleOptionGraphicsItem* option,
                                         QWidget* widget)
 {
     Q_UNUSED(option);
     Q_UNUSED(widget);
 
     // store any values we plan on changing so we can restore them
     QPen  p = painter->pen();
 
     painter->setBackground(Qt::white);
 
     //Draw a border so user knows the object edge
     painter->setPen(QPen(QColor(224, 224, 224)));
     painter->drawRect(rect());
 
     drawHandles(painter);
 
     QByteArray fmt = m_format->value().toByteArray();
     if (fmt == "i2of5") {
         renderI2of5(rect().toRect(), renderText(), alignment(), painter);
     } else if (fmt == "3of9") {
         render3of9(rect().toRect(), renderText(), alignment(), painter);
     } else if (fmt == "3of9+") {
         renderExtended3of9(rect().toRect(), renderText(), alignment(), painter);
     } else if (fmt == "128") {
         renderCode128(rect().toRect(), renderText(), alignment(), painter);
     } else if (fmt == "upc-a") {
         renderCodeUPCA(rect().toRect(), renderText(), alignment(), painter);
     } else if (fmt == "upc-e") {
         renderCodeUPCE(rect().toRect(), renderText(), alignment(), painter);
     } else if (fmt == "ean13") {
         renderCodeEAN13(rect().toRect(), renderText(), alignment(), painter);
     } else if (fmt == "ean8") {
         renderCodeEAN8(rect().toRect(), renderText(), alignment(), painter);
     }
 
     painter->setPen(Qt::black);
     painter->drawText(rect(), 0, dataSourceAndObjectTypeName(itemDataSource(),
                                                              QLatin1String("barcode")));
 
     // restore an values before we started just in case
     painter->setPen(p);
 }
 
 void KReportDesignerItemBarcode::buildXML(QDomDocument *doc, QDomElement *parent)
 {
     //kreportpluginDebug();
     QDomElement entity = doc->createElement(QLatin1String("report:") + typeName());
 
     // properties
     addPropertyAsAttribute(&entity, nameProperty());
     addPropertyAsAttribute(&entity, m_controlSource);
     addPropertyAsAttribute(&entity, m_horizontalAlignment);
     addPropertyAsAttribute(&entity, m_format);
     addPropertyAsAttribute(&entity, m_maxLength);
     entity.setAttribute(QLatin1String("report:z-index"), zValue());
     addPropertyAsAttribute(&entity, m_itemValue);
 
     // bounding rect
     buildXMLRect(doc, &entity, this);
 
     parent->appendChild(entity);
 }
 
 void KReportDesignerItemBarcode::slotPropertyChanged(KPropertySet &s, KProperty &p)
 {
     if (p.name() == "name") {
         //For some reason p.oldValue returns an empty string
         if (!designer()->isEntityNameUnique(p.value().toString(), this)) {
             p.setValue(oldName());
         } else {
             setOldName(p.value().toString());
         }
     }
 
     updateRenderText(m_itemValue->value().toString().isEmpty() ?  m_format->value().toString() : QString(), m_itemValue->value().toString(), QString());
 
     KReportDesignerItemRectBase::propertyChanged(s, p);
     if (designer()) designer()->setModified(true);
 }
 
 void KReportDesignerItemBarcode::mousePressEvent(QGraphicsSceneMouseEvent * event)
 {
     m_controlSource->setListData(designer()->fieldKeys(), designer()->fieldNames());
     KReportDesignerItemRectBase::mousePressEvent(event);
 }
diff --git a/src/plugins/barcode/KReportDesignerItemBarcode.h b/src/plugins/barcode/KReportDesignerItemBarcode.h
index e89642b0..8cfb66e3 100644
--- a/src/plugins/barcode/KReportDesignerItemBarcode.h
+++ b/src/plugins/barcode/KReportDesignerItemBarcode.h
@@ -1,57 +1,59 @@
 /* This file is part of the KDE project
  * Copyright (C) 2001-2007 by OpenMFG, LLC (info@openmfg.com)
  * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 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
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library.  If not, see .
  */
 
 
 #ifndef KREPORTDESIGNERITEMBARCODE_H
 #define KREPORTDESIGNERITEMBARCODE_H
 
 #include "KReportDesignerItemRectBase.h"
 #include "KReportItemBarcode.h"
 
 #include 
 
 //
 // ReportEntityBarcode
 //
 class KReportDesignerItemBarcode : public KReportItemBarcode, public KReportDesignerItemRectBase
 {
     Q_OBJECT
 public:
-    KReportDesignerItemBarcode(KReportDesigner *, QGraphicsScene* scene, const QPointF &pos);
-    KReportDesignerItemBarcode(const QDomNode & element, KReportDesigner *, QGraphicsScene* scene);
+    KReportDesignerItemBarcode(KReportDesigner *designer, QGraphicsScene *scene,
+                               const QPointF &pos);
+    KReportDesignerItemBarcode(const QDomNode &element, KReportDesigner *designer,
+                               QGraphicsScene *scene);
+    ~KReportDesignerItemBarcode() override;
 
-    virtual ~KReportDesignerItemBarcode();
-    virtual void buildXML(QDomDocument *doc, QDomElement *parent);
-    virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0);
-
-    virtual KReportDesignerItemBarcode* clone();
+    void buildXML(QDomDocument *doc, QDomElement *parent) override;
+    void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
+               QWidget *widget = nullptr) override;
 
+    KReportDesignerItemBarcode *clone() override;
 
 protected:
-    virtual void mousePressEvent(QGraphicsSceneMouseEvent * event);
+    void mousePressEvent(QGraphicsSceneMouseEvent * event) override;
 
 private:
     void init(QGraphicsScene *scene);
 
     QRect getTextRect();
 
 private Q_SLOTS:
     void slotPropertyChanged(KPropertySet &, KProperty &);
 };
 
 #endif
diff --git a/src/plugins/barcode/KReportItemBarcode.h b/src/plugins/barcode/KReportItemBarcode.h
index a9543ae4..c55ee1c5 100644
--- a/src/plugins/barcode/KReportItemBarcode.h
+++ b/src/plugins/barcode/KReportItemBarcode.h
@@ -1,72 +1,72 @@
 /* This file is part of the KDE project
  * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 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
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library.  If not, see .
  */
 
 #ifndef KREPORTITEMBRCODE_H
 #define KREPORTITEMBRCODE_H
 
 #include "KReportItemBase.h"
 
 class QDomNode;
 
 namespace Scripting
 {
 class Barcode;
 }
 
 /**
 */
 class KReportItemBarcode : public KReportItemBase
 {
 Q_OBJECT
 public:
     KReportItemBarcode();
     explicit KReportItemBarcode(const QDomNode &element);
-    ~KReportItemBarcode();
+    ~KReportItemBarcode() override;
 
-    virtual QString typeName() const;
-    virtual int renderSimpleData(OROPage *page, OROSection *section, const QPointF &offset, const QVariant &data, KReportScriptHandler *script);
-    virtual QString itemDataSource() const;
+    QString typeName() const override;
+    int renderSimpleData(OROPage *page, OROSection *section, const QPointF &offset, const QVariant &data, KReportScriptHandler *script) override;
+    QString itemDataSource() const override;
 
 protected:
 
     KProperty * m_controlSource;
     KProperty * m_horizontalAlignment;
     KProperty * m_format;
     KProperty * m_maxLength;
     KProperty* m_itemValue;
 
 
     int alignment();
     void setAlignment(int);
     int maxLength();
     void setMaxLength(int i);
     QString format();
     void setFormat(const QString&);
 
     // all these values are in inches and
     // are for internal use only
     qreal m_minWidthData;
     qreal m_minWidthTotal;
     qreal m_minHeight;
 
 private:
-    virtual void createProperties();
+    void createProperties() override;
 
     friend class Scripting::Barcode;
 };
 
 #endif
diff --git a/src/plugins/barcode/KReportScriptBarcode.h b/src/plugins/barcode/KReportScriptBarcode.h
index bfec8efa..48289df0 100644
--- a/src/plugins/barcode/KReportScriptBarcode.h
+++ b/src/plugins/barcode/KReportScriptBarcode.h
@@ -1,115 +1,115 @@
 /* This file is part of the KDE project
  * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 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
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library.  If not, see .
  */
 
 #ifndef SCRIPTINGKRSCRIPTBARCODE_H
 #define SCRIPTINGKRSCRIPTBARCODE_H
 
 #include 
 
 #include "KReportItemBarcode.h"
 
 namespace Scripting
 {
 
 /**
 */
 class Barcode : public QObject
 {
     Q_OBJECT
 public:
     explicit Barcode(KReportItemBarcode *f);
 
-    ~Barcode();
+    ~Barcode() override;
 
 public Q_SLOTS:
 
 
     /**
      * Get the position of the barcode
      * @return position in points
      */
     QPointF position();
 
 
     /**
      * Sets the position of the barcode in points
      * @param Position
      */
     void setPosition(const QPointF&);
 
     /**
      * Get the size of the barcode
      * @return size in points
      */
     QSizeF size();
 
     /**
      * Set the size of the barcode in points
      * @param Size
      */
     void setSize(const QSizeF&);
 
     /**
      * Get the horizontal alignment
      * -1 Left
      * 0 Center
      * +1 Right
      * @return alignment
     */
     int horizontalAlignment();
 
     /**
      * Sets the horizontal alignment
      * @param  Alignemnt
      */
     void setHorizonalAlignment(int);
 
 
     /**
      * Get the control source (field name) of the barcode
      * @return control source
      */
     QString source();
 
 
     /**
      * Set the control source (field name) of the barcode
      * @param controlsource
      */
     void setSource(const QString&);
 
 
     /**
      * Get the barcode format
      * @return format as string
      */
     QString format();
 
     /**
      * Set the barcode format
      * @param format
      */
     void setFormat(const QString&);
 
 
 private:
     KReportItemBarcode *m_barcode;
 };
 
 }
 
 #endif
diff --git a/src/plugins/barcode/ext3of9.cpp b/src/plugins/barcode/ext3of9.cpp
index 7624cf71..586942be 100644
--- a/src/plugins/barcode/ext3of9.cpp
+++ b/src/plugins/barcode/ext3of9.cpp
@@ -1,194 +1,194 @@
 /* This file is part of the KDE project
  * Copyright (C) 2001-2007 by OpenMFG, LLC (info@openmfg.com)
  * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
  * Copyright (C) 2015 Jarosław Staniek 
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 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
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library.  If not, see .
  */
 
 /*
  *     This file contains the code that will render the extended 3of9 barcode.
  * This code will parse a string and build a compliant 3of9 string and then
  * call the 3of9 renderer to do the actual drawing.
  */
 
 #include 
 #include 
 
 #include "barcodes.h"
 
 class _ext3of9map
 {
 public:
     _ext3of9map(const char c, const char *s)
         : code(c), conversion(QLatin1String(s))
     {
     }
     const char code;
     const QString conversion;
 };
 const _ext3of9map ext3of9map[] = {
     _ext3of9map('\0' , "%U"),   // NUL
     _ext3of9map('\001' , "$A"),   // SOH
     _ext3of9map('\002' , "$B"),   // STX
     _ext3of9map('\003' , "$C"),   // ETX
     _ext3of9map('\004' , "$D"),   // EOT
     _ext3of9map('\005' , "$E"),   // ENQ
     _ext3of9map('\006' , "$F"),   // ACK
     _ext3of9map('\007' , "$G"),   // BEL
     _ext3of9map('\010' , "$H"),   // BS
     _ext3of9map('\011' , "$I"),   // HT
     _ext3of9map('\012' , "$J"),   // LF
     _ext3of9map('\013' , "$K"),   // VT
     _ext3of9map('\014' , "$L"),   // FF
     _ext3of9map('\015' , "$M"),   // CR
     _ext3of9map('\016' , "$N"),   // SO
     _ext3of9map('\017' , "$O"),   // SI
     _ext3of9map('\020' , "$P"),   // DLE
     _ext3of9map('\021' , "$Q"),   // DC1
     _ext3of9map('\022' , "$R"),   // DC2
     _ext3of9map('\023' , "$S"),   // DC3
     _ext3of9map('\024' , "$T"),   // DC4
     _ext3of9map('\025' , "$U"),   // NAK
     _ext3of9map('\026' , "$V"),   // SYN
     _ext3of9map('\027' , "$W"),   // ETB
     _ext3of9map('\030' , "$X"),   // CAN
     _ext3of9map('\031' , "$Y"),   // EM
     _ext3of9map('\032' , "$Z"),   // SUB
     _ext3of9map('\033' , "%A"),   // ESC
     _ext3of9map('\034' , "%B"),   // FS
     _ext3of9map('\035' , "%C"),   // GS
     _ext3of9map('\036' , "%D"),   // RS
     _ext3of9map('\037' , "%E"),   // US
     _ext3of9map(' ' , " "),   // SPACE
     _ext3of9map('!' , "/A"),
     _ext3of9map('"' , "/B"),
     _ext3of9map('#' , "/C"),
     _ext3of9map('$' , "/D"),
     _ext3of9map('%' , "/E"),
     _ext3of9map('&' , "/F"),
     _ext3of9map('\'' , "/G"),
     _ext3of9map('(' , "/H"),
     _ext3of9map(')' , "/I"),
     _ext3of9map('*' , "/J"),
     _ext3of9map('+' , "/K"),
     _ext3of9map(',' , "/L"),
     _ext3of9map('-' , "-"),   // /M
     _ext3of9map('.' , "."),   // /N
     _ext3of9map('/' , "/O"),
     _ext3of9map('0' , "0"),   // /P
     _ext3of9map('1' , "1"),   // /Q
     _ext3of9map('2' , "2"),   // /R
     _ext3of9map('3' , "3"),   // /S
     _ext3of9map('4' , "4"),   // /T
     _ext3of9map('5' , "5"),   // /U
     _ext3of9map('6' , "6"),   // /V
     _ext3of9map('7' , "7"),   // /W
     _ext3of9map('8' , "8"),   // /X
     _ext3of9map('9' , "9"),   // /Y
     _ext3of9map(':' , "/Z"),
     _ext3of9map(';' , "%F"),
     _ext3of9map('<' , "%G"),
     _ext3of9map('=' , "%H"),
     _ext3of9map('>' , "%I"),
     _ext3of9map('?' , "%J"),
     _ext3of9map('@' , "%V"),
     _ext3of9map('A' , "A"),
     _ext3of9map('B' , "B"),
     _ext3of9map('C' , "C"),
     _ext3of9map('D' , "D"),
     _ext3of9map('E' , "E"),
     _ext3of9map('F' , "F"),
     _ext3of9map('G' , "G"),
     _ext3of9map('H' , "H"),
     _ext3of9map('I' , "I"),
     _ext3of9map('J' , "J"),
     _ext3of9map('K' , "K"),
     _ext3of9map('L' , "L"),
     _ext3of9map('M' , "M"),
     _ext3of9map('N' , "N"),
     _ext3of9map('O' , "O"),
     _ext3of9map('P' , "P"),
     _ext3of9map('Q' , "Q"),
     _ext3of9map('R' , "R"),
     _ext3of9map('S' , "S"),
     _ext3of9map('T' , "T"),
     _ext3of9map('U' , "U"),
     _ext3of9map('V' , "V"),
     _ext3of9map('W' , "W"),
     _ext3of9map('X' , "X"),
     _ext3of9map('Y' , "Y"),
     _ext3of9map('Z' , "Z"),
     _ext3of9map('[' , "%K"),
     _ext3of9map('\\' , "%L"),
     _ext3of9map(']' , "%M"),
     _ext3of9map('^' , "%N"),
     _ext3of9map('_' , "%O"),
     _ext3of9map('`' , "%W"),
     _ext3of9map('a' , "+A"),
     _ext3of9map('b' , "+B"),
     _ext3of9map('c' , "+C"),
     _ext3of9map('d' , "+D"),
     _ext3of9map('e' , "+E"),
     _ext3of9map('f' , "+F"),
     _ext3of9map('g' , "+G"),
     _ext3of9map('h' , "+H"),
     _ext3of9map('i' , "+I"),
     _ext3of9map('j' , "+J"),
     _ext3of9map('k' , "+K"),
     _ext3of9map('l' , "+L"),
     _ext3of9map('m' , "+M"),
     _ext3of9map('n' , "+N"),
     _ext3of9map('o' , "+O"),
     _ext3of9map('p' , "+P"),
     _ext3of9map('q' , "+Q"),
     _ext3of9map('r' , "+R"),
     _ext3of9map('s' , "+S"),
     _ext3of9map('t' , "+T"),
     _ext3of9map('u' , "+U"),
     _ext3of9map('v' , "+V"),
     _ext3of9map('w' , "+W"),
     _ext3of9map('x' , "+X"),
     _ext3of9map('y' , "+Y"),
     _ext3of9map('z' , "+Z"),
     _ext3of9map('{' , "%P"),
     _ext3of9map('|' , "%Q"),
     _ext3of9map('}' , "%R"),
     _ext3of9map('~' , "%S"),
     _ext3of9map('\177' , "%T"),   // DEL
 
-    _ext3of9map(-1 , 0)
+    _ext3of9map(-1 , nullptr)
 };
 
 inline QString convertTo3of9(char code)
 {
     for (int i = 0; !ext3of9map[i].conversion.isEmpty(); i++)
         if (ext3of9map[i].code == code)
             return ext3of9map[i].conversion;
     return QString();
 }
 
 QString convertTo3of9(const QString &str)
 {
     QString result;
     for (int i = 0; i < str.length(); i++) {
         result += convertTo3of9(str.at(i).toLatin1());
     }
     return result;
 }
 
 void renderExtended3of9(OROPage * page, const QRectF & r, const QString & str, int align)
 {
     render3of9(page, r, convertTo3of9(str), align);
 }
diff --git a/src/plugins/chart/KReportChartPlugin.h b/src/plugins/chart/KReportChartPlugin.h
index 4e737a52..dc0d83a8 100644
--- a/src/plugins/chart/KReportChartPlugin.h
+++ b/src/plugins/chart/KReportChartPlugin.h
@@ -1,40 +1,42 @@
 /* This file is part of the KDE project
    Copyright (C) 2010 by Adam Pigg (adam@piggz.co.uk)
 
    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.1 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.
 */
 
 #ifndef KREPORTCHARTPLUGIN_H
 #define KREPORTCHARTPLUGIN_H
 
 #include 
 
 class KReportChartPlugin : public KReportPluginInterface
 {
     Q_OBJECT
-    public:
-        explicit KReportChartPlugin(QObject *parent, const QVariantList &args = QVariantList());
-        virtual ~KReportChartPlugin();
-
-        virtual QObject* createRendererInstance(const QDomNode& element);
-        virtual QObject* createDesignerInstance(const QDomNode& element, KoReportDesigner* , QGraphicsScene* scene);
-        virtual QObject* createDesignerInstance(KoReportDesigner* , QGraphicsScene* scene, const QPointF& pos);
+public:
+    explicit KReportChartPlugin(QObject *parent, const QVariantList &args = QVariantList());
+    virtual ~KReportChartPlugin();
+
+    virtual QObject *createRendererInstance(const QDomNode &element);
+    virtual QObject *createDesignerInstance(const QDomNode &element, KoReportDesigner *designer,
+                                            QGraphicsScene *scene);
+    virtual QObject *createDesignerInstance(KoReportDesigner *designer, QGraphicsScene *scene,
+                                            const QPointF &pos);
 #ifdef KREPORT_SCRIPTING
-        virtual QObject* createScriptInstance(KReportItemBase* item);
+    virtual QObject *createScriptInstance(KReportItemBase *item);
 #endif
 };
 
 #endif // KOREPORTCHARTPLUGIN_H
diff --git a/src/plugins/chart/KReportDesignerItemChart.h b/src/plugins/chart/KReportDesignerItemChart.h
index 2c35496e..b6670542 100644
--- a/src/plugins/chart/KReportDesignerItemChart.h
+++ b/src/plugins/chart/KReportDesignerItemChart.h
@@ -1,50 +1,51 @@
 /* This file is part of the KDE project
  * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 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
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library.  If not, see .
  */
 #ifndef REPORTENTITYCHART_H
 #define REPORTENTITYCHART_H
 
 
 #include "KReportItemChart.h"
 #include "KReportDesignerItemRectBase.h"
 
 /**
 */
 class KReportDesignerItemChart : public KReportItemChart, public KReportDesignerItemRectBase
 {
     Q_OBJECT
 public:
-    KReportDesignerItemChart(KoReportDesigner *, QGraphicsScene* scene, const QPointF &pos);
-    KReportDesignerItemChart(QDomNode *element, KoReportDesigner *, QGraphicsScene* scene);
+    KReportDesignerItemChart(KoReportDesigner *designer, QGraphicsScene *scene, const QPointF &pos);
+    KReportDesignerItemChart(QDomNode *element, KoReportDesigner *designer, QGraphicsScene *scene);
+    ~KReportDesignerItemChart() override;
 
-    virtual ~KReportDesignerItemChart();
-    virtual void buildXML(QDomDocument *doc, QDomElement *parent);
-    virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0);
-    virtual KReportDesignerItemChart* clone();
+    void buildXML(QDomDocument *doc, QDomElement *parent) override;
+    void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
+               QWidget *widget = nullptr) override;
+    KReportDesignerItemChart *clone() override;
 
 protected:
-    virtual void mousePressEvent(QGraphicsSceneMouseEvent * event);
+    void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
 
 private:
-    void init(QGraphicsScene*, KoReportDesigner *d);
+    void init(QGraphicsScene* scene, KoReportDesigner *d);
 
 private Q_SLOTS:
     void slotPropertyChanged(KPropertySet &, KProperty &);
     void slotReportDataChanged();
 
 };
 
 #endif
diff --git a/src/plugins/maps/KReportDesignerItemMaps.cpp b/src/plugins/maps/KReportDesignerItemMaps.cpp
index 959d12b7..cd738f04 100644
--- a/src/plugins/maps/KReportDesignerItemMaps.cpp
+++ b/src/plugins/maps/KReportDesignerItemMaps.cpp
@@ -1,133 +1,133 @@
 /*
  * Copyright (C) 2007-2016 by Adam Pigg (adam@piggz.co.uk)
  * Copyright (C) 2011-2015 by Radoslaw Wicik (radoslaw@wicik.pl)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 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
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library.  If not, see .
  */
 
 #include "KReportDesignerItemMaps.h"
 #include "KReportDesignerItemBase.h"
 #include "KReportDesigner.h"
 
 #include 
 #include 
 
 #include 
 #include 
 #include 
 #include 
 #include "kreportplugin_debug.h"
 
 void KReportDesignerItemMaps::init(QGraphicsScene *scene)
 {
     if (scene)
         scene->addItem(this);
 
     connect(propertySet(), SIGNAL(propertyChanged(KPropertySet&,KProperty&)),
             this, SLOT(slotPropertyChanged(KPropertySet&,KProperty&)));
 
     m_controlSource->setListData(designer()->fieldKeys(), designer()->fieldNames());
     setZValue(z());
 }
 
 KReportDesignerItemMaps::KReportDesignerItemMaps(KReportDesigner *rw, QGraphicsScene *scene, const QPointF &pos)
         : KReportDesignerItemRectBase(rw, this)
 {
     Q_UNUSED(pos);
     init(scene);
     setSceneRect(properRect(*rw, KREPORT_ITEM_RECT_DEFAULT_WIDTH, KREPORT_ITEM_RECT_DEFAULT_WIDTH));
     nameProperty()->setValue(designer()->suggestEntityName(typeName()));
 }
 
 KReportDesignerItemMaps::KReportDesignerItemMaps(const QDomNode &element, KReportDesigner *rw, QGraphicsScene* scene)
         : KReportItemMaps(element), KReportDesignerItemRectBase(rw, this)
 {
     init(scene);
     setSceneRect(KReportItemBase::scenePosition(item()->position()), KReportItemBase::sceneSize(item()->size()));
 }
 
 KReportDesignerItemMaps* KReportDesignerItemMaps::clone()
 {
     QDomDocument d;
     QDomElement e = d.createElement(QLatin1String("clone"));
     QDomNode n;
     buildXML(&d, &e);
     n = e.firstChild();
-    return new KReportDesignerItemMaps(n, designer(), 0);
+    return new KReportDesignerItemMaps(n, designer(), nullptr);
 }
 
 KReportDesignerItemMaps::~KReportDesignerItemMaps()
 {
     // do we need to clean anything up?
 }
 
 void KReportDesignerItemMaps::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget)
 {
     Q_UNUSED(option);
     Q_UNUSED(widget);
     // store any values we plan on changing so we can restore them
     QPen  p = painter->pen();
     painter->fillRect(rect(), QColor(0xc2, 0xfc, 0xc7));//C2FCC7
 
     //Draw a border so user knows the object edge
     painter->setPen(QPen(QColor(224, 224, 224)));
     painter->drawRect(rect());
     painter->setPen(Qt::black);
     painter->drawText(rect(), 0, dataSourceAndObjectTypeName(itemDataSource(), QLatin1String("map")));
 
     drawHandles(painter);
 
     // restore an values before we started just in case
     painter->setPen(p);
 }
 
 void KReportDesignerItemMaps::buildXML(QDomDocument *doc, QDomElement *parent)
 {
     QDomElement entity = doc->createElement(QLatin1String("report:") + typeName());
 
     // properties
     addPropertyAsAttribute(&entity, nameProperty());
     addPropertyAsAttribute(&entity, m_controlSource);
     addPropertyAsAttribute(&entity, m_latitudeProperty);
     addPropertyAsAttribute(&entity, m_longitudeProperty);
     addPropertyAsAttribute(&entity, m_zoomProperty);
     addPropertyAsAttribute(&entity, m_themeProperty);
     //addPropertyAsAttribute(&entity, m_resizeMode);
     entity.setAttribute(QLatin1String("report:z-index"), z());
     buildXMLRect(doc, &entity, this);
 
     parent->appendChild(entity);
 }
 
 void KReportDesignerItemMaps::slotPropertyChanged(KPropertySet &s, KProperty &p)
 {
     //kreportpluginDebug() << p.name() << ":" << p.value();
     if (p.name().toLower() == "name") {
         //For some reason p.oldValue returns an empty string
         if (!designer()->isEntityNameUnique(p.value().toString(), this)) {
             p.setValue(oldName());
         } else {
             setOldName(p.value().toString());
         }
     }
 
     KReportDesignerItemRectBase::propertyChanged(s, p);
     if (designer()) designer()->setModified(true);
 }
 
 void KReportDesignerItemMaps::mousePressEvent(QGraphicsSceneMouseEvent * event)
 {
     m_controlSource->setListData(designer()->fieldKeys(), designer()->fieldNames());
     KReportDesignerItemRectBase::mousePressEvent(event);
 }
diff --git a/src/plugins/maps/KReportDesignerItemMaps.h b/src/plugins/maps/KReportDesignerItemMaps.h
index 792db8ab..d6d2effd 100644
--- a/src/plugins/maps/KReportDesignerItemMaps.h
+++ b/src/plugins/maps/KReportDesignerItemMaps.h
@@ -1,52 +1,54 @@
 /*
  * Copyright (C) 2001-2007 by OpenMFG, LLC (info@openmfg.com)
  * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
  * Copyright (C) 2011 by Radoslaw Wicik (radoslaw@wicik.pl)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 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
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library.  If not, see .
  */
 
 #ifndef __REPORTENTITYIMAGE_H__
 #define __REPORTENTITYIMAGE_H__
 
 
 #include 
 
 #include 
 #include "KReportItemMaps.h"
 
 class KReportDesignerItemMaps : public KReportItemMaps, public KReportDesignerItemRectBase
 {
   Q_OBJECT
 public:
-    KReportDesignerItemMaps(KReportDesigner *, QGraphicsScene* scene, const QPointF &pos);
-    KReportDesignerItemMaps(const QDomNode &element, KReportDesigner *, QGraphicsScene* scene);
+    KReportDesignerItemMaps(KReportDesigner *designer, QGraphicsScene *scene, const QPointF &pos);
+    KReportDesignerItemMaps(const QDomNode &element, KReportDesigner *designer,
+                            QGraphicsScene *scene);
+    ~KReportDesignerItemMaps() override;
 
-    virtual ~KReportDesignerItemMaps();
-    virtual void buildXML(QDomDocument *doc, QDomElement *parent);
-    virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0);
-    virtual KReportDesignerItemMaps* clone();
+    void buildXML(QDomDocument *doc, QDomElement *parent) override;
+    void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
+               QWidget *widget = nullptr) override;
+    KReportDesignerItemMaps *clone() override;
 
 protected:
-    virtual void mousePressEvent(QGraphicsSceneMouseEvent * event);
+    void mousePressEvent(QGraphicsSceneMouseEvent * event) override;
 
 private:
     void init(QGraphicsScene *scene);
 
 private Q_SLOTS:
     void slotPropertyChanged(KPropertySet &, KProperty &);
 
 };
 
 #endif
diff --git a/src/plugins/maps/KReportItemMaps.cpp b/src/plugins/maps/KReportItemMaps.cpp
index e8749ff2..25085bdf 100644
--- a/src/plugins/maps/KReportItemMaps.cpp
+++ b/src/plugins/maps/KReportItemMaps.cpp
@@ -1,224 +1,224 @@
 /*
  * Copyright (C) 2007-2016 by Adam Pigg (adam@piggz.co.uk)
  * Copyright (C) 2011-2015 by Radoslaw Wicik (radoslaw@wicik.pl)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 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
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library.  If not, see .
  */
 #include "KReportItemMaps.h"
 
 #include 
 
 #include 
 
 #include 
 
 #include 
 
 #define myDebug() if (0) kDebug(44021)
 
 //! @todo replace with ReportItemMaps(const QDomNode &element = QDomNode())
 KReportItemMaps::KReportItemMaps()
     : m_longtitude(0)
     , m_latitude(0)
     , m_zoom(1200)
-    , m_pageId(0)
-    , m_sectionId(0)
-    , m_oroPicture(0)
+    , m_pageId(nullptr)
+    , m_sectionId(nullptr)
+    , m_oroPicture(nullptr)
     , m_longDataSetFromScript(false)
     , m_latDataSetFromScript(false)
     , m_zoomDataSetFromScript(false)
 {
     createProperties();
 }
 
 KReportItemMaps::KReportItemMaps(const QDomNode &element)
     : KReportItemMaps()
 {
     nameProperty()->setValue(element.toElement().attribute(QLatin1String("report:name")));
     m_controlSource->setValue(element.toElement().attribute(QLatin1String("report:item-data-source")));
     setZ(element.toElement().attribute(QLatin1String("report:z-index")).toDouble());
     m_latitudeProperty->setValue(element.toElement().attribute(QLatin1String("report:latitude")).toDouble());
     m_longitudeProperty->setValue(element.toElement().attribute(QLatin1String("report:longitude")).toDouble());
     m_zoomProperty->setValue(element.toElement().attribute(QLatin1String("report:zoom")).toInt());
     QString themeId(element.toElement().attribute(QLatin1String("report:theme")));
     themeId = themeId.isEmpty() ? m_themeManager.mapThemeIds()[0] : themeId;
     m_themeProperty->setValue(themeId);
 
     parseReportRect(element.toElement());
 }
 
 KReportItemMaps::~KReportItemMaps()
 {
 }
 
 void KReportItemMaps::createProperties()
 {
     m_controlSource = new KProperty("item-data-source", QStringList(), QStringList(), QString(), tr("Data Source"));
 
     m_latitudeProperty = new KProperty("latitude", 0.0, tr("Latitude"), QString(), KProperty::Double);
     m_latitudeProperty->setOption("min", -90);
     m_latitudeProperty->setOption("max", 90);
     m_latitudeProperty->setOption("unit", QString::fromUtf8("°"));
     m_latitudeProperty->setOption("precision", 7);
 
     m_longitudeProperty = new KProperty("longitude", 0.0, tr("Longitude"), QString(), KProperty::Double);
     m_longitudeProperty->setOption("min", -180);
     m_longitudeProperty->setOption("max", 180);
     m_longitudeProperty->setOption("unit", QString::fromUtf8("°"));
     m_longitudeProperty->setOption("precision", 7);
 
     m_zoomProperty     = new KProperty("zoom", 1000, tr("Zoom") );
     m_zoomProperty->setOption("min", 0);
     m_zoomProperty->setOption("max", 4000);
     m_zoomProperty->setOption("step", 100);
     m_zoomProperty->setOption("slider", true);
 
     QStringList mapThemIds(m_themeManager.mapThemeIds());
     m_themeProperty = new KProperty("theme",  mapThemIds, mapThemIds, mapThemIds[1], tr("Theme"));
 
     if (mapThemIds.contains(QLatin1String("earth/srtm/srtm.dgml"))) {
         m_themeProperty->setValue(QLatin1String("earth/srtm/srtm.dgml"), KProperty::DefaultValueOptions & ~KProperty::ValueOptions(KProperty::ValueOption::RememberOld));
     }
 
     propertySet()->addProperty(m_controlSource);
     propertySet()->addProperty(m_latitudeProperty);
     propertySet()->addProperty(m_longitudeProperty);
     propertySet()->addProperty(m_zoomProperty);
     propertySet()->addProperty(m_themeProperty);
 }
 
 
 void KReportItemMaps::setColumn(const QString &c)
 {
     m_controlSource->setValue(c);
 }
 
 QString KReportItemMaps::itemDataSource() const
 {
     return m_controlSource->value().toString();
 }
 
 QString KReportItemMaps::typeName() const
 {
     return QLatin1String("maps");
 }
 
 int KReportItemMaps::renderSimpleData(OROPage *page, OROSection *section, const QPointF &offset,
                                        const QVariant &data, KReportScriptHandler *script)
 {
     Q_UNUSED(script)
 
     deserializeData(data);
     m_pageId = page;
     m_sectionId = section;
     m_offset = offset;
 
 
     m_oroPicture = new OROPicture();
     m_oroPicture->setPosition(scenePosition(position()) + m_offset);
     m_oroPicture->setSize(sceneSize(size()));
 
     if (m_pageId) {
         m_pageId->insertPrimitive(m_oroPicture);
     }
 
     if (m_sectionId) {
         OROPicture *i2 = dynamic_cast(m_oroPicture->clone());
         if (i2) {
             i2->setPosition(scenePosition(position()));
         }
     }
 
     m_mapRenderer.renderJob(this);
 
     return 0; //Item doesn't stretch the section height
 }
 
 void KReportItemMaps::deserializeData(const QVariant& serialized)
 {
     //kreportpluginDebug() << "Map data for this record is" << serialized;
     QStringList dataList = serialized.toString().split(QLatin1Char(';'));
     if (dataList.size() == 3) {
         m_latitude = dataList[0].toDouble();
         m_longtitude = dataList[1].toDouble();
         m_zoom = dataList[2].toInt();
     } else {
         m_latitude = m_latitudeProperty->value().toReal();
         m_longtitude = m_longitudeProperty->value().toReal();
         m_zoom = m_zoomProperty->value().toInt();
     }
 }
 
 void KReportItemMaps::renderFinished()
 {
     emit finishedRendering();
 }
 
 OROPicture* KReportItemMaps::oroImage()
 {
     return m_oroPicture;
 }
 
 qreal KReportItemMaps::longtitude() const
 {
     return m_longtitude;
 }
 
 qreal KReportItemMaps::latitude() const
 {
     return m_latitude;
 }
 
 int KReportItemMaps::zoom() const
 {
     return m_zoom;
 }
 
 QString KReportItemMaps::themeId() const
 {
     return m_themeProperty->value().toString();
 }
 
 QVariant KReportItemMaps::realItemData(const QVariant& itemData) const
 {
     double lat, lon;
     int zoom;
 
     QStringList dataList = itemData.toString().split(QLatin1Char(';'));
 
     if (dataList.size() == 3) {
         lat = dataList[0].toDouble();
         lon = dataList[1].toDouble();
         zoom = dataList[2].toInt();
     } else if (dataList.size() == 2) {
         lat = dataList[0].toDouble();
         lon = dataList[1].toDouble();
         zoom = m_zoomProperty->value().toInt();
     } else {
         lat = m_latitudeProperty->value().toReal();
         lon = m_longitudeProperty->value().toReal();
         zoom = m_zoomProperty->value().toInt();
     }
 
     if (m_longDataSetFromScript) {
         lon = m_longtitude;
     }
     if (m_latDataSetFromScript) {
         lat = m_latitude;
     }
     if (m_zoomDataSetFromScript) {
         zoom = m_zoom;
     }
     return QString(QLatin1String("%1;%2;%3")).arg(lat).arg(lon).arg(zoom);
 }
diff --git a/src/plugins/maps/KReportItemMaps.h b/src/plugins/maps/KReportItemMaps.h
index dad7a8bb..71093a8b 100644
--- a/src/plugins/maps/KReportItemMaps.h
+++ b/src/plugins/maps/KReportItemMaps.h
@@ -1,96 +1,96 @@
 /*
  * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
  * Copyright (C) 2011-2015 by Radoslaw Wicik (radoslaw@wicik.pl)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 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
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library.  If not, see .
  */
 
 #ifndef KREPORTITEMMAPS_H
 #define KREPORTITEMMAPS_H
 
 #include "KReportAsyncItemBase.h"
 
 #include 
 #include 
 
 #include 
 
 #include "KReportMapRenderer.h"
 
 #include 
 
 class OROImage;
 class OROPicture;
 class OROPage;
 class OROSection;
 
 namespace Scripting
 {
 class Maps;
 }
 
 class KReportItemMaps : public KReportAsyncItemBase
 {
     Q_OBJECT
 public:
     KReportItemMaps();
     explicit KReportItemMaps(const QDomNode &element);
-    virtual ~KReportItemMaps();
+    ~KReportItemMaps() override;
 
-    virtual QString typeName() const;
-    virtual int renderSimpleData(OROPage *page, OROSection *section, const QPointF &offset, const QVariant &data, KReportScriptHandler *script);
+    QString typeName() const override;
+    int renderSimpleData(OROPage *page, OROSection *section, const QPointF &offset, const QVariant &data, KReportScriptHandler *script) override;
 
-    virtual QString itemDataSource() const;
+    QString itemDataSource() const override;
     virtual QVariant realItemData(const QVariant &itemData) const;
 
     void renderFinished();
 
     qreal longtitude() const;
     qreal latitude() const;
     int zoom() const;
     QString themeId() const;
 
     OROPicture* oroImage();
 
 protected:
     KProperty* m_controlSource;
     KProperty* m_latitudeProperty;
     KProperty* m_longitudeProperty;
     KProperty* m_zoomProperty;
     KProperty* m_themeProperty;
 
     void setColumn(const QString&);
 
     qreal m_longtitude;
     qreal m_latitude;
     int m_zoom;
     OROPage *m_pageId;
     OROSection *m_sectionId;
     QPointF m_offset;
     OROPicture * m_oroPicture;
     KReportMapRenderer m_mapRenderer;
     Marble::MapThemeManager m_themeManager;
 
 private:
-    virtual void createProperties();
+    void createProperties() override;
     void deserializeData(const QVariant& serialized);
 
     bool m_longDataSetFromScript;
     bool m_latDataSetFromScript;
     bool m_zoomDataSetFromScript;
 
     friend class Scripting::Maps;
 };
 
 #endif
diff --git a/src/plugins/maps/KReportMapRenderer.cpp b/src/plugins/maps/KReportMapRenderer.cpp
index 10b75a18..aed54565 100644
--- a/src/plugins/maps/KReportMapRenderer.cpp
+++ b/src/plugins/maps/KReportMapRenderer.cpp
@@ -1,125 +1,125 @@
 /*
  * Copyright (C) 2015  Radosław Wicik 
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 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
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include "KReportMapRenderer.h"
 #include "KReportItemMaps.h"
 #include 
 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 
 #include "kreportplugin_debug.h"
 
 KReportMapRenderer::KReportMapRenderer(QObject* parent)
     : QObject(parent)
-    , m_currentJob(0)
+    , m_currentJob(nullptr)
 {
     m_marble.setMapThemeId(QLatin1String("earth/openstreetmap/openstreetmap.dgml"));
     m_marble.setShowOverviewMap(false);
     m_marble.setMapQualityForViewContext(Marble::PrintQuality, Marble::Still);
     m_marble.setShowCrosshairs(true);
 
     foreach(Marble::AbstractFloatItem* floatItem, m_marble.floatItems()){
         if(floatItem->nameId() == QString(QLatin1String("navigation"))){
             floatItem->setVisible(false);
         }
     }
 
     connect(m_marble.model()->downloadManager(), &Marble::HttpDownloadManager::progressChanged, this, &KReportMapRenderer::downloadProgres);
     connect(&m_marble, &Marble::MarbleMap::renderStatusChanged, this, &KReportMapRenderer::onRenderStatusChange);
     connect(&m_retryTimer,  &QTimer::timeout, this, &KReportMapRenderer::retryRender);
 }
 
 KReportMapRenderer::~KReportMapRenderer()
 {
 
 }
 
 void KReportMapRenderer::renderJob(KReportItemMaps* reportItemMaps)
 {
     m_currentJob = reportItemMaps;
     int zoom = m_currentJob->zoom();
     //kreportpluginDebug() << "Map Renderer rendering" << m_currentJob->longtitude() << m_currentJob->latitude();
 
     m_marble.setMapThemeId(m_currentJob->themeId());
     //some themes enable overview map, and this must be disabled after theme switch.
     m_marble.setShowOverviewMap(false);
     m_marble.setSize(KReportItemBase::sceneSize(m_currentJob->size()).toSize());
     m_marble.centerOn(m_currentJob->longtitude(), m_currentJob->latitude());
     m_marble.setRadius(pow(M_E, (zoom / 200.0)));
     
     // Create a painter that will do the painting.
     Marble::GeoPainter geoPainter( m_currentJob->oroImage()->picture(), m_marble.viewport(), m_marble.mapQuality() );
     m_marble.paint( geoPainter, QRect() );
     
     if (m_marble.renderStatus() == Marble::Complete) {
         m_currentJob->renderFinished();
     } else {
         m_retryTimer.start(1000);
     }
             
 }
 
 void KReportMapRenderer::onRenderStatusChange(Marble::RenderStatus renderStatus)
 {
     //kreportpluginDebug() << m_marble.renderStatus() << "|" << renderStatus;
 
     if(m_currentJob){
         /*kreportpluginDebug()
             << this
             << m_currentJob
             << m_currentJob->longtitude()
             << m_currentJob->latitude()
             << m_currentJob->zoom()
             << " | status: " << renderStatus;*/
 
         if(renderStatus == Marble::Complete){
             m_currentJob->renderFinished();
         }
     }
 }
 
 void KReportMapRenderer::downloadProgres(int active, int queued)
 {
     Q_UNUSED(active)
     Q_UNUSED(queued)
     //if(m_currentJob){
     //    kreportpluginDebug() << "job:" << m_currentJob
     //    << "(" << m_currentJob->latitude() << "," << m_currentJob->longtitude() << ")"
     //    << "active/queued:" << active << "/" << queued;
     //}
 }
 
 void KReportMapRenderer::retryRender()
 {
     //kreportpluginDebug() << "Retrying map render";
 
     // Create a painter that will do the painting.
     Marble::GeoPainter geoPainter( m_currentJob->oroImage()->picture(), m_marble.viewport(), m_marble.mapQuality() );
     m_marble.paint( geoPainter, QRect() );
     
     if (m_marble.renderStatus() == Marble::Complete) {
         m_retryTimer.stop();
         m_currentJob->renderFinished();
     }
 }
 
diff --git a/src/plugins/maps/KReportMapRenderer.h b/src/plugins/maps/KReportMapRenderer.h
index 6f7c433b..6a5eeee7 100644
--- a/src/plugins/maps/KReportMapRenderer.h
+++ b/src/plugins/maps/KReportMapRenderer.h
@@ -1,54 +1,54 @@
 /*
  * Copyright (C) 2015  Radosław Wicik 
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 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
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #ifndef MAPRENDERER_H
 #define MAPRENDERER_H
 
 #include 
 #include 
 #include 
 
 #include 
 
 #include "kreportplugin_debug.h"
 
 class KReportItemMaps;
 
 class KReportMapRenderer : public QObject
 {
     Q_OBJECT
     Q_DISABLE_COPY(KReportMapRenderer)
 public:
-    KReportMapRenderer(QObject* parent = 0);
-    virtual ~KReportMapRenderer();
+    KReportMapRenderer(QObject* parent = nullptr);
+    ~KReportMapRenderer() override;
     void renderJob(KReportItemMaps* reportItemMaps);
 Q_SIGNALS:
     void jobFinished();
 private Q_SLOTS:
     void onRenderStatusChange(Marble::RenderStatus renderStatus);
     void downloadProgres(int active, int queued);
     void retryRender();
 
 private:
     Marble::MarbleMap m_marble;
     KReportItemMaps* m_currentJob;
     
     QTimer m_retryTimer;
 };
 
 #endif // MAPRENDERER_H
diff --git a/src/plugins/maps/KReportMapsPlugin.cpp b/src/plugins/maps/KReportMapsPlugin.cpp
index 43b7e320..9d6c3a07 100644
--- a/src/plugins/maps/KReportMapsPlugin.cpp
+++ b/src/plugins/maps/KReportMapsPlugin.cpp
@@ -1,69 +1,69 @@
 /*
    Copyright (C) 2010-2016 by Adam Pigg (adam@piggz.co.uk)
    Copyright (C) 2011 by Radoslaw Wicik (radoslaw@wicik.pl)
 
    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.1 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 "KReportMapsPlugin.h"
 #include "KReportItemMaps.h"
 #include "KReportDesignerItemMaps.h"
 #include 
 #ifdef KREPORT_SCRIPTING
 #include "KReportScriptMaps.h"
 #endif
 #include "kreport_debug.h"
 
 
 KREPORT_PLUGIN_FACTORY(KReportMapsPlugin, "kreport_mapsplugin.json")
 
 KReportMapsPlugin::KReportMapsPlugin(QObject *parent, const QVariantList &args) : KReportPluginInterface(parent)
 {
     Q_UNUSED(args)
 }
 
 KReportMapsPlugin::~KReportMapsPlugin()
 {
 }
 
 QObject* KReportMapsPlugin::createRendererInstance(const QDomNode& element)
 {
     return new KReportItemMaps(element);
 }
 
 QObject* KReportMapsPlugin::createDesignerInstance(const QDomNode& element, KReportDesigner* designer, QGraphicsScene* scene)
 {
     return new KReportDesignerItemMaps(element, designer, scene);
 }
 
 QObject* KReportMapsPlugin::createDesignerInstance(KReportDesigner* designer, QGraphicsScene* scene, const QPointF& pos)
 {
     //kreportpluginDebug() << "KReport maps init";
     return new KReportDesignerItemMaps(designer, scene, pos);
 }
 
 #ifdef KREPORT_SCRIPTING
 QObject* KReportMapsPlugin::createScriptInstance(KReportItemBase* /*item*/)
 {
     /*KoReportItemMaps *image = dynamic_cast(item);
     if (image) {
         return new Scripting::Maps(image);
     }*/
-    return 0;
+    return nullptr;
 }
 #endif
 
 #include "KReportMapsPlugin.moc"
diff --git a/src/plugins/maps/KReportMapsPlugin.h b/src/plugins/maps/KReportMapsPlugin.h
index 804b064e..b0082296 100644
--- a/src/plugins/maps/KReportMapsPlugin.h
+++ b/src/plugins/maps/KReportMapsPlugin.h
@@ -1,40 +1,42 @@
 /*
    Copyright (C) 2010 by Adam Pigg (adam@piggz.co.uk)
    Copyright (C) 2011 by Radoslaw Wicik (radoslaw@wicik.pl)
 
    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.1 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.
 */
 
 #ifndef KREPORTMAPSPLUGIN_H
 #define KREPORTMAPSPLUGIN_H
 
 #include "KReportPluginInterface.h"
 
 class KReportMapsPlugin : public KReportPluginInterface
 {
-    public:
+public:
     explicit KReportMapsPlugin(QObject *parent, const QVariantList &args = QVariantList());
-    virtual ~KReportMapsPlugin();
+    ~KReportMapsPlugin() override;
 
-    virtual QObject* createRendererInstance(const QDomNode& element);
-    virtual QObject* createDesignerInstance(const QDomNode& element, KReportDesigner* , QGraphicsScene* scene);
-    virtual QObject* createDesignerInstance(KReportDesigner* , QGraphicsScene* scene, const QPointF& pos);
+    QObject *createRendererInstance(const QDomNode &element) override;
+    QObject *createDesignerInstance(const QDomNode &element, KReportDesigner *designer,
+                                    QGraphicsScene *scene) override;
+    QObject *createDesignerInstance(KReportDesigner *designer, QGraphicsScene *scene,
+                                    const QPointF &pos) override;
 #ifdef KREPORT_SCRIPTING
-    virtual QObject* createScriptInstance(KReportItemBase* item);
+    QObject *createScriptInstance(KReportItemBase *item) override;
 #endif
 };
 
 #endif // KOREPORTMAPSPLUGIN_H
diff --git a/src/plugins/maps/KReportScriptMaps.h b/src/plugins/maps/KReportScriptMaps.h
index 8a780dc3..991f8a64 100644
--- a/src/plugins/maps/KReportScriptMaps.h
+++ b/src/plugins/maps/KReportScriptMaps.h
@@ -1,75 +1,75 @@
 /*
  * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
  * Copyright (C) 2011 by Radoslaw Wicik (rockford@wicik.pl)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 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
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library.  If not, see .
  */
 #ifndef SCRIPTINGKRSCRIPTMAPS_H
 #define SCRIPTINGKRSCRIPTMAPS_H
 
 #include 
 #include 
 #include 
 
 class KReportItemMaps;
 
 namespace Scripting
 {
 
 class Maps : public QObject
 {
     Q_OBJECT
 public:
     explicit Maps(KReportItemMaps *i);
 
-    ~Maps();
+    ~Maps() override;
 
 public Q_SLOTS:
     /**
     * Get the position of the map
     * @return position in points
      */
     QPointF position() const;
 
     /**
      * Sets the position of the map in points
      * @param Position
      */
     void setPosition(const QPointF &p);
 
     /**
      * Get the size of the map
      * @return size in points
      */
     QSizeF size() const;
 
     /**
      * Set the size of the map in points
      * @param Size
      */
     void setSize(const QSizeF &s);
 
     void setLatitude(qreal latitude);
 
     void setLongitude(qreal longitude);
 
     void setZoom(int zoom);
 
 private:
     KReportItemMaps *m_map;
 };
 
 }
 
 #endif //SCRIPTINGKRSCRIPTMAPS_H
diff --git a/src/plugins/web/KReportDesignerItemWeb.cpp b/src/plugins/web/KReportDesignerItemWeb.cpp
index 26868d1c..27d31d76 100644
--- a/src/plugins/web/KReportDesignerItemWeb.cpp
+++ b/src/plugins/web/KReportDesignerItemWeb.cpp
@@ -1,124 +1,124 @@
 /* This file is part of the KDE project
    Copyright Shreya Pandit 
    Copyright 2011 Adam Pigg 
 
    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 "KReportDesignerItemWeb.h"
 #include 
 #include 
 
 #include 
 #include 
 
 #include 
 #include 
 #include 
 #include 
 #include "kreportplugin_debug.h"
 
 void KReportDesignerItemWeb::init(QGraphicsScene *scene)
 {
     if (scene)
         scene->addItem(this);
 
     connect(propertySet(), SIGNAL(propertyChanged(KPropertySet&,KProperty&)), this, SLOT(slotPropertyChanged(KPropertySet&,KProperty&)));
 
     setZValue(z());
 }
 
 KReportDesignerItemWeb::KReportDesignerItemWeb(KReportDesigner *rw, QGraphicsScene *scene,
                                                  const QPointF &pos) : KReportDesignerItemRectBase(rw, this)
 {
     Q_UNUSED(pos);
     init(scene);
     setSceneRect(properRect(*rw, KREPORT_ITEM_RECT_DEFAULT_WIDTH, KREPORT_ITEM_RECT_DEFAULT_WIDTH));
     nameProperty()->setValue(designer()->suggestEntityName(typeName()));
 }
 
 KReportDesignerItemWeb::KReportDesignerItemWeb(const QDomNode &element, KReportDesigner *rw,
                                                  QGraphicsScene *scene)      
     : KReportItemWeb(element), KReportDesignerItemRectBase(rw, this)
 {
     init(scene);
     setSceneRect(KReportItemBase::scenePosition(item()->position()), KReportItemBase::sceneSize(item()->size()));
 }
 
 KReportDesignerItemWeb *KReportDesignerItemWeb::clone()
 {
     QDomDocument d;
     QDomElement e = d.createElement(QLatin1String("clone"));
     QDomNode n;
     buildXML(&d, &e);
     n = e.firstChild();
-    return new KReportDesignerItemWeb(n, designer(), 0);
+    return new KReportDesignerItemWeb(n, designer(), nullptr);
 }
 
 KReportDesignerItemWeb::~KReportDesignerItemWeb() //done,compared
 {
     // do we need to clean anything up?
 }
 
 void KReportDesignerItemWeb::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget)
 {
     Q_UNUSED(option);
     Q_UNUSED(widget);
 
     painter->drawRect(QGraphicsRectItem::rect());
     painter->drawText(rect(), 0, dataSourceAndObjectTypeName(itemDataSource(), QLatin1String("web-view")));
 
     painter->setBackgroundMode(Qt::TransparentMode);
 
     drawHandles(painter);
 }
 
 void KReportDesignerItemWeb::buildXML(QDomDocument *doc, QDomElement *parent)
 {
     Q_UNUSED(doc);
     Q_UNUSED(parent);
     QDomElement entity = doc->createElement(QLatin1String("report:") + typeName());
 
     // properties
     addPropertyAsAttribute(&entity, m_controlSource);
     addPropertyAsAttribute(&entity, nameProperty());
     entity.setAttribute(QLatin1String("report:z-index"), zValue());
     buildXMLRect(doc, &entity, this);
     parent->appendChild(entity);
 }
 
 void KReportDesignerItemWeb::slotPropertyChanged(KPropertySet &s, KProperty &p)
 {
     if (p.name() == "name") {
         if (!designer()->isEntityNameUnique(p.value().toString(), this)) {
             p.setValue(oldName());
         }
         else {
             setOldName(p.value().toString());
         }
     }
 
     KReportDesignerItemRectBase::propertyChanged(s, p);
     if (designer()) {
         designer()->setModified(true);
     }
 }
 
 void KReportDesignerItemWeb::mousePressEvent(QGraphicsSceneMouseEvent *event)
 {
     m_controlSource->setListData(designer()->fieldKeys(), designer()->fieldNames());
     KReportDesignerItemRectBase::mousePressEvent(event);
 }
diff --git a/src/plugins/web/KReportDesignerItemWeb.h b/src/plugins/web/KReportDesignerItemWeb.h
index 5bb0cba0..0ad57281 100644
--- a/src/plugins/web/KReportDesignerItemWeb.h
+++ b/src/plugins/web/KReportDesignerItemWeb.h
@@ -1,53 +1,53 @@
 /* This file is part of the KDE project
    Copyright Shreya Pandit 
    Copyright 2011 Adam Pigg 
 
    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.
 */
 
 #ifndef KREPORTDESIGNERITEMWEB_H
 #define KREPORTDESIGNERITEMWEB_H
 
 #include 
 #include "KReportItemWeb.h"
 
 class QGraphicsScene;
 
 /**
 */
 class KReportDesignerItemWeb : public KReportItemWeb, public KReportDesignerItemRectBase
 {
     Q_OBJECT
 public:
     KReportDesignerItemWeb(KReportDesigner *rw, QGraphicsScene *scene, const QPointF &pos);
     KReportDesignerItemWeb(const QDomNode &element, KReportDesigner *rw, QGraphicsScene *scene);
-    virtual ~KReportDesignerItemWeb();
+    ~KReportDesignerItemWeb() override;
 
-    virtual void buildXML(QDomDocument *doc, QDomElement *parent);
-    virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget);
-    virtual KReportDesignerItemWeb *clone();
+    void buildXML(QDomDocument *doc, QDomElement *parent) override;
+    void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget) override;
+    KReportDesignerItemWeb *clone() override;
 
 protected:
-    virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
+    void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
 
 private:
     void init(QGraphicsScene *scene);
 
 private Q_SLOTS:
     void slotPropertyChanged(KPropertySet &, KProperty &);
 };
 
 #endif
diff --git a/src/plugins/web/KReportItemWeb.h b/src/plugins/web/KReportItemWeb.h
index c8e00678..fff0e51a 100644
--- a/src/plugins/web/KReportItemWeb.h
+++ b/src/plugins/web/KReportItemWeb.h
@@ -1,71 +1,71 @@
 /* This file is part of the KDE project
    Copyright Shreya Pandit 
    Copyright 2011 Adam Pigg 
 
    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.
 */
 
 #ifndef KREPORTITEMWEB_H
 #define KREPORTITEMWEB_H
 
 #include 
 #include 
 
 #include 
 #include 
 #include 
 
 class QUrl;
 class QWebPage;
 
 namespace Scripting
 {
 class Web;
 }
 
 /**
 */
 class KReportItemWeb : public KReportAsyncItemBase
 {
     Q_OBJECT
 public:
     KReportItemWeb();
     explicit KReportItemWeb(const QDomNode &element);
-    virtual ~KReportItemWeb();
+    ~KReportItemWeb() override;
 
-    virtual QString typeName() const;
-    virtual int renderSimpleData(OROPage *page, OROSection *section, const QPointF &offset, const QVariant &data, KReportScriptHandler *script);
-    virtual QString itemDataSource() const;
+    QString typeName() const override;
+    int renderSimpleData(OROPage *page, OROSection *section, const QPointF &offset, const QVariant &data, KReportScriptHandler *script) override;
+    QString itemDataSource() const override;
 
 private Q_SLOTS:
     void loadFinished(bool);
 
 private:
     bool m_rendering;
     OROPage *m_targetPage;
     OROSection *m_targetSection;
     QPointF m_targetOffset;
 
 protected:
-    virtual void createProperties();
+    void createProperties() override;
 
     KProperty *m_controlSource;
     QWebPage *m_webPage;
 
     friend class Scripting::Web;
 };
 
 #endif
diff --git a/src/plugins/web/KReportWebPlugin.cpp b/src/plugins/web/KReportWebPlugin.cpp
index 07a4c33c..497c9a81 100644
--- a/src/plugins/web/KReportWebPlugin.cpp
+++ b/src/plugins/web/KReportWebPlugin.cpp
@@ -1,74 +1,74 @@
 /* This file is part of the KDE project
    Copyright Shreya Pandit 
 
    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 "KReportWebPlugin.h"
 #include "KReportDesignerItemWeb.h"
 #include "KReportPluginMetaData.h"
 #include 
 
 KREPORT_PLUGIN_FACTORY(KReportWebPlugin, "kreport_webplugin.json")
 
 KReportWebPlugin::KReportWebPlugin(QObject *parent, const QVariantList &args)
     : KReportPluginInterface(parent)
 {
     Q_UNUSED(args)
 #if 0
     KReportPluginMetaData *info = new KReportPluginInfo();
     info->setClassName("web");
     info->setName(tr("Web browser"));
     info->setIcon(koIcon("report_web_element"));
     info->setPriority(40);
     
     setInfo(info);
 #endif
 }
 
 KReportWebPlugin::~KReportWebPlugin()
 {
 }
 
 QObject *KReportWebPlugin::createRendererInstance(const QDomNode &element)
 {
     return new KReportItemWeb(element);
 }
 
 QObject *KReportWebPlugin::createDesignerInstance(const QDomNode &element, KReportDesigner *designer,
                                                    QGraphicsScene *scene)
 {
     return new KReportDesignerItemWeb(element, designer, scene);
 }
 
 QObject *KReportWebPlugin::createDesignerInstance(KReportDesigner *designer,
                                                    QGraphicsScene *scene,const QPointF &pos)
 {
     return new KReportDesignerItemWeb(designer, scene, pos);
 }
 
 #ifdef KREPORT_SCRIPTING
 QObject *KReportWebPlugin::createScriptInstance(KReportItemBase *item)
 {
     Q_UNUSED(item);
 //   KoReportItemweb *image = dynamic_cast(item);
     // if (image) {
     //   return new Scripting::Web(image);
-    return 0;
+    return nullptr;
 }
 #endif
 
 #include "KReportWebPlugin.moc"
diff --git a/src/plugins/web/KReportWebPlugin.h b/src/plugins/web/KReportWebPlugin.h
index a619156f..de750b97 100644
--- a/src/plugins/web/KReportWebPlugin.h
+++ b/src/plugins/web/KReportWebPlugin.h
@@ -1,42 +1,42 @@
 /* This file is part of the KDE project
    Copyright Shreya Pandit 
 
    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.
 */
 
 #ifndef KREPORTWEBPLUGIN_H
 #define KREPORTWEBPLUGIN_H
 
 #include "KReportPluginInterface.h"
 
 class KReportWebPlugin : public KReportPluginInterface
 {
     Q_OBJECT
 public:
     explicit KReportWebPlugin(QObject *parent, const QVariantList &args = QVariantList());
-    virtual ~KReportWebPlugin();
+    ~KReportWebPlugin() override;
 
-    virtual QObject *createRendererInstance(const QDomNode &element);
-    virtual QObject *createDesignerInstance(const QDomNode &element, KReportDesigner *designer,
-                                            QGraphicsScene *scene);
-    virtual QObject *createDesignerInstance(KReportDesigner *designer,
-                                            QGraphicsScene *scene,const QPointF &pos);
+    QObject *createRendererInstance(const QDomNode &element) override;
+    QObject *createDesignerInstance(const QDomNode &element, KReportDesigner *designer,
+                                            QGraphicsScene *scene) override;
+    QObject *createDesignerInstance(KReportDesigner *designer,
+                                            QGraphicsScene *scene,const QPointF &pos) override;
 #ifdef KREPORT_SCRIPTING
-    virtual QObject *createScriptInstance(KReportItemBase *item);
+    QObject *createScriptInstance(KReportItemBase *item) override;
 #endif
 };
 
 #endif // KOREPORTWEBPLUGIN_H
diff --git a/src/renderer/KReportAsyncItemManager_p.h b/src/renderer/KReportAsyncItemManager_p.h
index 094c268e..8b5d05d7 100644
--- a/src/renderer/KReportAsyncItemManager_p.h
+++ b/src/renderer/KReportAsyncItemManager_p.h
@@ -1,57 +1,57 @@
 /*  This file is part of the KDE project
     Copyright (C) 2011  Adam Pigg 
 
     This library is free software; you can redistribute it and/or
     modify it under the terms of the GNU Lesser General Public
     License as published by the Free Software Foundation; either
     version 2.1 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
     Lesser General Public License for more details.
 
     You should have received a copy of the GNU Lesser General Public
     License along with this library; if not, write to the Free Software
     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */
 
 
 #ifndef KREPORTASYNCITEMMANAGER_H
 #define KREPORTASYNCITEMMANAGER_H
 
 #include "config-kreport.h"
 #include "KReportAsyncItemBase.h"
 
 #include 
 #include 
 
 namespace KReportPrivate {
   
 class RenderData;
 
 class AsyncItemManager : public QObject
 {
     Q_OBJECT
 
 public:
     explicit AsyncItemManager(QObject *parent);
-    virtual ~AsyncItemManager();
+    ~AsyncItemManager() override;
 
     void addItem(KReportAsyncItemBase *item, OROPage *page, OROSection *section, QPointF offset, QVariant data, KReportScriptHandler *script);
 
     void startRendering();
 
 Q_SIGNALS:
     void finished();
 
 private Q_SLOTS:
     void itemFinished();
 
 private:
     QQueue m_renderList;
     QList m_itemList;
 };
 
 }
 #endif // KREPORTASYNCITEMMANAGER_H
diff --git a/src/renderer/KReportHTMLCSSRenderer_p.h b/src/renderer/KReportHTMLCSSRenderer_p.h
index ea1995c9..0c6c1142 100644
--- a/src/renderer/KReportHTMLCSSRenderer_p.h
+++ b/src/renderer/KReportHTMLCSSRenderer_p.h
@@ -1,48 +1,48 @@
 /* This file is part of the KDE project
  * Copyright (C) 2001-2007 by OpenMFG, LLC (info@openmfg.com)
  * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 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
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library.  If not, see .
  */
 #ifndef KREPORTHTMLCSSRENDERER_H
 #define KREPORTHTMLCSSRENDERER_H
 
 #include "KReportRendererBase.h"
 
 class ORODocument;
 
 namespace KReportPrivate {
   
 class HTMLCSSRenderer : public KReportRendererBase
 {
 public:
     HTMLCSSRenderer();
 
-    virtual ~HTMLCSSRenderer();
+    ~HTMLCSSRenderer() override;
 
-    virtual bool render(const KReportRendererContext&, ORODocument *document, int page = -1);
+    bool render(const KReportRendererContext&, ORODocument *document, int page = -1) override;
 
 private:
     QString renderCSS(ORODocument*);
 
     //! This is the directory name that will go inside the HTML files
     QString m_actualDirName;
 
     //! This is the directory where the image and other files will be temporarily stored
     QString m_tempDirName;
 };
 
 }
 
 #endif
diff --git a/src/renderer/KReportHTMLTableRenderer_p.h b/src/renderer/KReportHTMLTableRenderer_p.h
index f846482f..e70a9b44 100644
--- a/src/renderer/KReportHTMLTableRenderer_p.h
+++ b/src/renderer/KReportHTMLTableRenderer_p.h
@@ -1,47 +1,47 @@
 /* This file is part of the KDE project
  * Copyright (C) 2001-2007 by OpenMFG, LLC (info@openmfg.com)
  * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 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
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library.  If not, see .
  */
 #ifndef KREPORTHTMLTABLERENDERER_H
 #define KREPORTHTMLTABLERENDERER_H
 
 #include "KReportRendererBase.h"
 
 class ORODocument;
 
 namespace KReportPrivate {
   
 class HTMLTableRenderer : public KReportRendererBase
 {
 public:
     HTMLTableRenderer();
 
-    virtual ~HTMLTableRenderer();
+    ~HTMLTableRenderer() override;
 
-    virtual bool render(const KReportRendererContext&, ORODocument *document, int page = -1);
+    bool render(const KReportRendererContext&, ORODocument *document, int page = -1) override;
 
 private:
     QString renderTable(ORODocument*);
 
     //! This is the directory name that will go inside the HTML files
     QString m_actualDirName;
 
     //! This is the directory where the image and other files will be temporarily stored
     QString m_tempDirName;
 };
 
 }
 #endif
diff --git a/src/renderer/KReportKSpreadRenderer.h b/src/renderer/KReportKSpreadRenderer.h
index f26eae98..1c4c4449 100644
--- a/src/renderer/KReportKSpreadRenderer.h
+++ b/src/renderer/KReportKSpreadRenderer.h
@@ -1,37 +1,37 @@
 /* This file is part of the KDE project
  * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 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
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library.  If not, see .
  */
 
 #ifndef KREPORTKSPREADRENDERER_H
 #define KREPORTKSPREADRENDERER_H
 
 #include "KReportRendererBase.h"
 
 /**
 */
 class KReportKSpreadRenderer : public KReportRendererBase
 {
 public:
     KReportKSpreadRenderer();
-    ~KReportKSpreadRenderer();
+    ~KReportKSpreadRenderer() override;
 
-    virtual bool render(const KReportRendererContext&, ORODocument*, int page = -1);
+    bool render(const KReportRendererContext&, ORODocument*, int page = -1) override;
 
 private:
 
 };
 
 #endif
diff --git a/src/renderer/KReportOneRecordDataSource_p.h b/src/renderer/KReportOneRecordDataSource_p.h
index 6a219f35..c414c394 100644
--- a/src/renderer/KReportOneRecordDataSource_p.h
+++ b/src/renderer/KReportOneRecordDataSource_p.h
@@ -1,58 +1,58 @@
 /*
  *    This file is part of the KDE project
  *    Copyright (C) 2015 by Adam Pigg 
  *
  *    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.1 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.
  *
 */
 
 #ifndef KREPORTONERECORDDATA_H
 #define KREPORTONERECORDDATA_H
 
 #include 
 
 namespace KReportPrivate {
 /**
  * @brief A report data source which returns one record
  *
  * When no other data source is specified the pre-renderer
  * will create this as its data source.  This will return
  * one record of data, and no fields.  Useful for creating
  * a report with a static page of data, or a report page
  * generated from a script only.
  */
 class OneRecordDataSource :  public KReportDataSource
 {
 public:
     OneRecordDataSource();
-    ~OneRecordDataSource();
-    virtual QVariant value(const QString& field) const;
-    virtual QVariant value(int fieldNum) const;
-    virtual QStringList fieldNames() const;
-    virtual int fieldNumber(const QString& field) const;
-    virtual qint64 recordCount() const;
-    virtual qint64 at() const;
-    virtual bool moveLast();
-    virtual bool moveFirst();
-    virtual bool movePrevious();
-    virtual bool moveNext();
-    virtual bool close();
-    virtual bool open();
-    virtual QStringList dataSourceNames() const;
+    ~OneRecordDataSource() override;
+    QVariant value(const QString &field) const override;
+    QVariant value(int fieldNum) const override;
+    QStringList fieldNames() const override;
+    int fieldNumber(const QString &field) const override;
+    qint64 recordCount() const override;
+    qint64 at() const override;
+    bool moveLast() override;
+    bool moveFirst() override;
+    bool movePrevious() override;
+    bool moveNext() override;
+    bool close() override;
+    bool open() override;
+    QStringList dataSourceNames() const override;
 };
 }
 
 #endif // KREPORTONERECORDDATA_H
diff --git a/src/renderer/KReportPage.h b/src/renderer/KReportPage.h
index e8f850e5..9db3f208 100644
--- a/src/renderer/KReportPage.h
+++ b/src/renderer/KReportPage.h
@@ -1,58 +1,58 @@
 /* This file is part of the KDE project
  * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 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
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library.  If not, see .
  */
 
 #ifndef KREPORTPAGE_H
 #define KREPORTPAGE_H
 
 #include "kreport_export.h"
 
 #include 
 #include 
 
 class ORODocument;
 
 /**
  Provides a widget that renders a specific page of
  and ORODocument
  The widget is sized to the document size in pixels.
 */
 class KREPORT_EXPORT KReportPage : public QObject, public QGraphicsRectItem
 {
     Q_OBJECT
 public:
     KReportPage(QWidget *parent, ORODocument *document);
 
-    ~KReportPage();
+    ~KReportPage() override;
 
     //! Renders page @a page (counted from 1).
     void renderPage(int page);
 
 public Q_SLOTS:
-    virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0);
+    void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = nullptr) override;
 
     void pageUpdated(int pageNo);
 
 private Q_SLOTS:
     void renderCurrentPage();
 
 private:
     Q_DISABLE_COPY(KReportPage)
     class Private;
     Private * const d;
 };
 
 #endif
diff --git a/src/renderer/KReportPreRenderer.cpp b/src/renderer/KReportPreRenderer.cpp
index 4b66df1b..2923044e 100644
--- a/src/renderer/KReportPreRenderer.cpp
+++ b/src/renderer/KReportPreRenderer.cpp
@@ -1,697 +1,697 @@
 /* This file is part of the KDE project
  * Copyright (C) 2001-2007 by OpenMFG, LLC (info@openmfg.com)
  * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 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
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library.  If not, see .
  */
 
 #include "KReportPreRenderer.h"
 #include "KReportPreRenderer_p.h"
 #include "KReportAsyncItemManager_p.h"
 #include "KReportOneRecordDataSource_p.h"
 
 #include "KReportRenderObjects.h"
 #include "KReportDataSource.h"
 #include "KReportItemBase.h"
 #include "KReportDocument.h"
 #include "KReportDetailSectionData.h"
 #include "KReportLabelSizeInfo.h"
 #include "KReportPageSize.h"
 #include "KReportUtils_p.h"
 
 #ifdef KREPORT_SCRIPTING
 #include "scripting/KReportScriptHandler.h"
 #include "scripting/KReportGroupTracker.h"
 #endif
 
 #include 
 #include 
 #include "kreport_debug.h"
 
 KReportPreRendererPrivate::KReportPreRendererPrivate(KReportPreRenderer *preRenderer)
  : m_preRenderer(preRenderer)
 {
     m_valid = false;
-    m_document = 0;
-    m_reportDocument = 0;
-    m_page = 0;
+    m_document = nullptr;
+    m_reportDocument = nullptr;
+    m_page = nullptr;
     m_yOffset = 0.0;
     m_topMargin = m_bottomMargin = 0.0;
     m_leftMargin = m_rightMargin = 0.0;
     m_pageCounter = 0;
     m_maxHeight = m_maxWidth = 0.0;
     m_oneRecord = new KReportPrivate::OneRecordDataSource();
-    m_dataSource = 0;
+    m_dataSource = nullptr;
 #ifdef KREPORT_SCRIPTING
-    m_scriptHandler = 0;
+    m_scriptHandler = nullptr;
 #endif
     asyncManager = new KReportPrivate::AsyncItemManager(this);
 
     connect(asyncManager, SIGNAL(finished()), this, SLOT(asyncItemsFinished()));
 }
 
 KReportPreRendererPrivate::~KReportPreRendererPrivate()
 {
     delete m_reportDocument;
     delete m_document;
     delete m_oneRecord;
     m_postProcText.clear();
 }
 
 void KReportPreRendererPrivate::createNewPage()
 {
     //kreportDebug();
     if (m_pageCounter > 0)
         finishCurPage(false);
 
     m_pageCounter++;
 
 #ifdef KREPORT_SCRIPTING
     //Update the page count script value
     m_scriptHandler->setPageNumber(m_pageCounter);
     m_scriptHandler->newPage();
 #endif
 
-    m_page = new OROPage(0);
+    m_page = new OROPage(nullptr);
     m_document->addPage(m_page);
 
     //! @todo calculate past page
     bool lastPage = false;
 
     m_yOffset = m_topMargin;
 
     if (m_pageCounter == 1 && m_reportDocument->m_pageHeaderFirst)
         renderSection(*(m_reportDocument->m_pageHeaderFirst));
     else if (lastPage == true && m_reportDocument->m_pageHeaderLast)
         renderSection(*(m_reportDocument->m_pageHeaderLast));
     else if ((m_pageCounter % 2) == 1 && m_reportDocument->m_pageHeaderOdd)
         renderSection(*(m_reportDocument->m_pageHeaderOdd));
     else if ((m_pageCounter % 2) == 0 && m_reportDocument->m_pageHeaderAny)
         renderSection(*(m_reportDocument->m_pageHeaderAny));
     else if (m_reportDocument->m_pageHeaderAny)
         renderSection(*(m_reportDocument->m_pageHeaderAny));
 }
 
 qreal KReportPreRendererPrivate::finishCurPageSize(bool lastPage)
 {
     qreal retval = 0.0;
 
     if (lastPage && m_reportDocument->m_pageFooterLast)
         retval = renderSectionSize(* (m_reportDocument->m_pageFooterLast));
     else if (m_pageCounter == 1 && m_reportDocument->m_pageFooterFirst)
         retval = renderSectionSize(* (m_reportDocument->m_pageFooterFirst));
     else if ((m_pageCounter % 2) == 1 && m_reportDocument->m_pageFooterOdd)
         retval = renderSectionSize(* (m_reportDocument->m_pageFooterOdd));
     else if ((m_pageCounter % 2) == 0 && m_reportDocument->m_pageFooterEven)
         retval = renderSectionSize(* (m_reportDocument->m_pageFooterEven));
     else if (m_reportDocument->m_pageFooterAny)
         retval = renderSectionSize(* (m_reportDocument->m_pageFooterAny));
 
     //kreportDebug() << retval;
     return retval;
 }
 
 qreal KReportPreRendererPrivate::finishCurPage(bool lastPage)
 {
 
     qreal offset = m_maxHeight - m_bottomMargin;
     qreal retval = 0.0;
     //kreportDebug() << offset;
 
     if (lastPage && m_reportDocument->m_pageFooterLast) {
         //kreportDebug() << "Last Footer";
         m_yOffset = offset - renderSectionSize(* (m_reportDocument->m_pageFooterLast));
         retval = renderSection(* (m_reportDocument->m_pageFooterLast));
     } else if (m_pageCounter == 1 && m_reportDocument->m_pageFooterFirst) {
         //kreportDebug() << "First Footer";
         m_yOffset = offset - renderSectionSize(* (m_reportDocument->m_pageFooterFirst));
         retval = renderSection(* (m_reportDocument->m_pageFooterFirst));
     } else if ((m_pageCounter % 2) == 1 && m_reportDocument->m_pageFooterOdd) {
         //kreportDebug() << "Odd Footer";
         m_yOffset = offset - renderSectionSize(* (m_reportDocument->m_pageFooterOdd));
         retval = renderSection(* (m_reportDocument->m_pageFooterOdd));
     } else if ((m_pageCounter % 2) == 0 && m_reportDocument->m_pageFooterEven) {
         //kreportDebug() << "Even Footer";
         m_yOffset = offset - renderSectionSize(* (m_reportDocument->m_pageFooterEven));
         retval = renderSection(* (m_reportDocument->m_pageFooterEven));
     } else if (m_reportDocument->m_pageFooterAny) {
         //kreportDebug() << "Any Footer";
         m_yOffset = offset - renderSectionSize(* (m_reportDocument->m_pageFooterAny));
         retval = renderSection(* (m_reportDocument->m_pageFooterAny));
     }
 
     return retval;
 }
 
 void KReportPreRendererPrivate::renderDetailSection(KReportDetailSectionData *detailData)
 {
     if (detailData->m_detailSection) {
         if (m_dataSource/* && !curs->eof()*/) {
             QStringList keys;
             QStringList keyValues;
             QList shownGroups;
-            KReportDetailGroupSectionData * grp = 0;
+            KReportDetailGroupSectionData * grp = nullptr;
 
             bool status = m_dataSource->moveFirst();
             int recordCount = m_dataSource->recordCount();
 
             //kreportDebug() << "Record Count:" << recordCount;
 
             for (int i = 0; i < (int) detailData->m_groupList.count(); ++i) {
                 grp = detailData->m_groupList[i];
                 //If the group has a header or footer, then emit a change of group value
                 if(grp->m_groupFooter || grp->m_groupHeader) {
                     // we get here only if group is *shown*
                     shownGroups << i;
                     keys.append(grp->m_column);
                     if (!keys.last().isEmpty())
                         keyValues.append(m_dataSource->value(m_dataSource->fieldNumber(keys.last())).toString());
                     else
                         keyValues.append(QString());
 
                     //Tell interested parties we're about to render a header
                     emit(enteredGroup(keys.last(), keyValues.last()));
                 }
                 if (grp->m_groupHeader)
                     renderSection(*(grp->m_groupHeader));
             }
 
             while (status) {
                 const qint64 pos = m_dataSource->at();
                 //kreportDebug() << "At:" << l << "Y:" << m_yOffset << "Max Height:" << m_maxHeight;
                 if ((renderSectionSize(*detailData->m_detailSection)
                         + finishCurPageSize((pos + 1 == recordCount))
                         + m_bottomMargin + m_yOffset) >= m_maxHeight)
                 {
                     //kreportDebug() << "Next section is too big for this page";
                     if (pos > 0) {
                         m_dataSource->movePrevious();
                         createNewPage();
                         m_dataSource->moveNext();
                     }
                 }
 
                 renderSection(*(detailData->m_detailSection));
                 if (m_dataSource)
                     status = m_dataSource->moveNext();
 
                 if (status == true && keys.count() > 0) {
                     // check to see where it is we need to start
                     int pos = -1; // if it's still -1 by the time we are done then no keyValues changed
                     for (int i = 0; i < keys.count(); ++i) {
                         if (keyValues[i] != m_dataSource->value(m_dataSource->fieldNumber(keys[i])).toString()) {
                             pos = i;
                             break;
                         }
                     }
                     // don't bother if nothing has changed
                     if (pos != -1) {
                         // roll back the query and go ahead if all is good
                         status = m_dataSource->movePrevious();
                         if (status == true) {
                             // print the footers as needed
                             // any changes made in this for loop need to be duplicated
                             // below where the footers are finished.
                             bool do_break = false;
                             for (int i = shownGroups.count() - 1; i >= 0; i--) {
                                 if (do_break)
                                     createNewPage();
                                 do_break = false;
                                 grp = detailData->m_groupList[shownGroups.at(i)];
 
                                 if (grp->m_groupFooter) {
                                     if (renderSectionSize(*(grp->m_groupFooter)) + finishCurPageSize(false) + m_bottomMargin + m_yOffset >= m_maxHeight)
                                         createNewPage();
                                     renderSection(*(grp->m_groupFooter));
                                 }
 
                                 if (KReportDetailGroupSectionData::BreakAfterGroupFooter == grp->m_pagebreak)
                                     do_break = true;
                             }
                             // step ahead to where we should be and print the needed headers
                             // if all is good
                             status = m_dataSource->moveNext();
                             if (do_break)
                                 createNewPage();
                             if (status == true) {
                                 for (int i = 0; i < shownGroups.count(); ++i) {
                                     grp = detailData->m_groupList[shownGroups.at(i)];
 
                                     if (grp->m_groupHeader) {
                                         if (renderSectionSize(*(grp->m_groupHeader)) + finishCurPageSize(false) + m_bottomMargin + m_yOffset >= m_maxHeight) {
                                             m_dataSource->movePrevious();
                                             createNewPage();
                                             m_dataSource->moveNext();
                                         }
 
                                         if (!keys[i].isEmpty())
                                             keyValues[i] = m_dataSource->value(m_dataSource->fieldNumber(keys[i])).toString();
 
                                         //Tell interested parties thak key values changed
                                         renderSection(*(grp->m_groupHeader));
                                     }
 
 
                                 }
                             }
                         }
                     }
                 }
             }
 
             if (keys.size() > 0 && m_dataSource->movePrevious()) {
                 // finish footers
                 // duplicated changes from above here
                 for (int i = shownGroups.count() - 1; i >= 0; i--) {
                     grp = detailData->m_groupList[shownGroups.at(i)];
 
                     if (grp->m_groupFooter) {
                         if (renderSectionSize(*(grp->m_groupFooter)) + finishCurPageSize(false) + m_bottomMargin + m_yOffset >= m_maxHeight)
                             createNewPage();
                         renderSection(*(grp->m_groupFooter));
                         emit(exitedGroup(keys[i], keyValues[i]));
                     }
                 }
             }
         }
         if (KReportDetailSectionData::BreakAtEnd == detailData->m_pageBreak)
             createNewPage();
     }
 }
 
 qreal KReportPreRendererPrivate::renderSectionSize(const KReportSectionData & sectionData)
 {
     qreal intHeight = POINT_TO_INCH(sectionData.height()) * KReportPrivate::dpiX();
 
     int itemHeight = 0;
 
     if (sectionData.objects().count() == 0)
         return intHeight;
 
     QList objects = sectionData.objects();
     foreach(KReportItemBase *ob, objects) {
         QPointF offset(m_leftMargin, m_yOffset);
         QVariant itemData = m_dataSource->value(ob->itemDataSource());
 
         //ASync objects cannot alter the section height
         KReportAsyncItemBase *async_ob = qobject_cast(ob);
 
         if (!async_ob) {
-            itemHeight = ob->renderSimpleData(0, 0, offset, itemData, m_scriptHandler);
+            itemHeight = ob->renderSimpleData(nullptr, nullptr, offset, itemData, m_scriptHandler);
 
             if (itemHeight > intHeight) {
                 intHeight = itemHeight;
             }
         }
     }
 
     return intHeight;
 }
 
 qreal KReportPreRendererPrivate::renderSection(const KReportSectionData & sectionData)
 {
     qreal sectionHeight = POINT_TO_INCH(sectionData.height()) * KReportPrivate::dpiX();
 
     int itemHeight = 0;
     //kreportDebug() << "Name: " << sectionData.name() << " Height: " << sectionHeight
     //         << "Objects: " << sectionData.objects().count();
     emit(renderingSection(const_cast(§ionData), m_page, QPointF(m_leftMargin, m_yOffset)));
 
     //Create a pre-rendered section for this section and add it to the document
     OROSection *sec = new OROSection(m_document);
     sec->setHeight(sectionData.height());
     sec->setBackgroundColor(sectionData.backgroundColor());
     sec->setType(sectionData.type());
     m_document->addSection(sec);
 
     //Render section background
     ORORect* bg = new ORORect();
     bg->setPen(QPen(Qt::NoPen));
     bg->setBrush(sectionData.backgroundColor());
     qreal w = m_page->document()->pageLayout().fullRectPixels(KReportPrivate::dpiX()).width() - m_page->document()->pageLayout().marginsPixels(KReportPrivate::dpiX()).right() - m_leftMargin;
 
     bg->setRect(QRectF(m_leftMargin, m_yOffset, w, sectionHeight));
     m_page->insertPrimitive(bg, true);
 
     QList objects = sectionData.objects();
     foreach(KReportItemBase *ob, objects) {
         QPointF offset(m_leftMargin, m_yOffset);
         QVariant itemData = m_dataSource->value(ob->itemDataSource());
 
         if (ob->supportsSubQuery()) {
            itemHeight = ob->renderReportData(m_page, sec, offset, m_dataSource, m_scriptHandler);
         } else {
             KReportAsyncItemBase *async_ob = qobject_cast(ob);
             if (async_ob){
                 //kreportDebug() << "async object";
                 asyncManager->addItem(async_ob, m_page, sec, offset, itemData, m_scriptHandler);
             } else {
                 //kreportDebug() << "sync object";
                 itemHeight = ob->renderSimpleData(m_page, sec, offset, itemData, m_scriptHandler);
             }
         }
 
         if (itemHeight > sectionHeight) {
             sectionHeight = itemHeight;
         }
     }
     for (int i = 0; i < m_page->primitiveCount(); ++i) {
         OROPrimitive *prim = m_page->primitive(i);
         if (OROTextBox *text = dynamic_cast(prim)) {
             if (text->requiresPostProcessing()) {
                 m_postProcText.append(text);
             }
         }
     }
     m_yOffset += sectionHeight;
 
     return sectionHeight;
 }
 
 #ifdef KREPORT_SCRIPTING
 void KReportPreRendererPrivate::initEngine()
 {
     delete m_scriptHandler;
     m_scriptHandler = new KReportScriptHandler(m_dataSource, m_reportDocument);
 
     connect(this, SIGNAL(enteredGroup(QString,QVariant)), m_scriptHandler, SLOT(slotEnteredGroup(QString,QVariant)));
 
     connect(this, SIGNAL(exitedGroup(QString,QVariant)), m_scriptHandler, SLOT(slotExitedGroup(QString,QVariant)));
 
     connect(this, SIGNAL(renderingSection(KReportSectionData*,OROPage*,QPointF)), m_scriptHandler, SLOT(slotEnteredSection(KReportSectionData*,OROPage*,QPointF)));
 }
 #endif
 
 void KReportPreRendererPrivate::asyncItemsFinished()
 {
     //kreportDebug() << "Finished rendering async items";
     asyncManager->deleteLater();
     emit finishedAllASyncItems();
 }
 
 bool KReportPreRendererPrivate::generateDocument()
 {
     if (!m_dataSource) {
         m_dataSource = m_oneRecord;
     }
 
     if (!m_valid || !m_reportDocument) {
         return false;
     }
 
     // Do this check now so we don't have to undo a lot of work later if it fails
     KReportLabelSizeInfo label;
     if (m_reportDocument->pageSize() == QLatin1String("Labels")) {
         label = KReportLabelSizeInfo::find(m_reportDocument->labelType());
         if (label.isNull()) {
             return false;
         }
     }
     //kreportDebug() << "Creating Document";
     m_document = new ORODocument(m_reportDocument->title());
 
     m_pageCounter  = 0;
     m_yOffset      = 0.0;
 
     //kreportDebug() << "Calculating Margins";
     if (!label.isNull()) {
         if (m_reportDocument->pageLayout().orientation() == QPageLayout::Portrait) {
             m_topMargin = (label.startY() / 100.0);
             m_bottomMargin = 0;
             m_rightMargin = 0;
             m_leftMargin = (label.startX() / 100.0);
         } else {
             m_topMargin = (label.startX() / 100.0);
             m_bottomMargin = 0;
             m_rightMargin = 0;
             m_leftMargin = (label.startY() / 100.0);
         }
     } else {
 
         m_topMargin    = m_reportDocument->pageLayout().marginsPoints().top();
         m_bottomMargin = m_reportDocument->pageLayout().marginsPoints().bottom();
         m_rightMargin  = m_reportDocument->pageLayout().marginsPoints().right();
         m_leftMargin   = m_reportDocument->pageLayout().marginsPoints().left();
         //kreportDebug() << "Margins:" << m_topMargin << m_bottomMargin << m_rightMargin << m_leftMargin;
      }
 
     //kreportDebug() << "Calculating Page Size";
     QPageLayout layout =  m_reportDocument->pageLayout();
     // This should reflect the information of the report page size
     if (m_reportDocument->pageSize() == QLatin1String("Custom")) {
         m_maxWidth = m_reportDocument->pageLayout().fullRectPoints().width();
         m_maxHeight = m_reportDocument->pageLayout().fullRectPoints().height();
     } else {
         if (!label.isNull()) {
             m_maxWidth = label.width();
             m_maxHeight = label.height();
             m_reportDocument->pageLayout().setPageSize(QPageSize(KReportPageSize::pageSize(label.paper())));
         } else {
             // lookup the correct size information for the specified size paper
             QSizeF pageSizePx = m_reportDocument->pageLayout().fullRectPixels(KReportPrivate::dpiX()).size();
 
             m_maxWidth = pageSizePx.width();
             m_maxHeight = pageSizePx.height();
         }
     }
 
     if (m_reportDocument->pageLayout().orientation() == QPageLayout::Landscape) {
         qreal tmp = m_maxWidth;
         m_maxWidth = m_maxHeight;
         m_maxHeight = tmp;
     }
 
     //kreportDebug() << "Page Size:" << m_maxWidth << m_maxHeight;
 
     m_document->setPageLayout(m_reportDocument->pageLayout());
     m_dataSource->setSorting(m_reportDocument->m_detailSection->m_sortedFields);
     if (!m_dataSource->open()) {
         return false;
     }
 
     #ifdef KREPORT_SCRIPTING
     initEngine();
     connect(m_scriptHandler, SIGNAL(groupChanged(QMap)),
             m_preRenderer, SIGNAL(groupChanged(QMap)));
 
     //Loop through all abjects that have been registered, and register them with the script handler
     if (m_scriptHandler) {
         QMapIterator i(m_scriptObjects);
         while (i.hasNext()) {
             i.next();
             m_scriptHandler->registerScriptObject(i.value(), i.key());
         }
         //execute the script, if it fails, abort and return the empty document
         if (!m_scriptHandler->trigger()) {
             m_scriptHandler->displayErrors();
             return m_document;
         }
     }
     #endif
 
     createNewPage();
     if (!label.isNull()) {
         // Label Print Run
         // remember the initial margin setting as we will be modifying
         // the value and restoring it as we move around
         qreal margin = m_leftMargin;
 
         m_yOffset = m_topMargin;
 
         qreal w = (label.width() / 100.0);
         qreal wg = (label.xGap() / 100.0);
         qreal h = (label.height() / 100.0);
         qreal hg = (label.yGap() / 100.0);
         int numCols = label.columns();
         int numRows = label.rows();
         qreal tmp;
 
         // flip the value around if we are printing landscape
         if (!m_reportDocument->pageLayout().orientation() == QPageLayout::Portrait) {
             w = (label.height() / 100.0);
             wg = (label.yGap() / 100.0);
             h = (label.width() / 100.0);
             hg = (label.xGap() / 100.0);
             numCols = label.rows();
             numRows = label.columns();
         }
 
         KReportDetailSectionData * detailData = m_reportDocument->m_detailSection;
         if (detailData->m_detailSection) {
             KReportDataSource *mydata = m_dataSource;
 
             if (mydata && mydata->recordCount() > 0) { /* && !((query = orqThis->getQuery())->eof()))*/
                 if (!mydata->moveFirst()) {
                     return false;
                 }
                 int row = 0;
                 int col = 0;
                 do {
                     tmp = m_yOffset; // store the value as renderSection changes it
                     renderSection(*(detailData->m_detailSection));
                     m_yOffset = tmp; // restore the value that renderSection modified
 
                     col++;
                     m_leftMargin += w + wg;
                     if (col >= numCols) {
                         m_leftMargin = margin; // reset back to original value
                         col = 0;
                         row++;
                         m_yOffset += h + hg;
                         if (row >= numRows) {
                             m_yOffset = m_topMargin;
                             row = 0;
                             createNewPage();
                         }
                     }
                 } while (mydata->moveNext());
             }
         }
 
     } else {
         // Normal Print Run
         if (m_reportDocument->m_reportHeader) {
             renderSection(*(m_reportDocument->m_reportHeader));
         }
 
         if (m_reportDocument->m_detailSection) {
             renderDetailSection(m_reportDocument->m_detailSection);
         }
 
         if (m_reportDocument->m_reportFooter) {
             if (renderSectionSize(*(m_reportDocument->m_reportFooter)) + finishCurPageSize(true) + m_bottomMargin + m_yOffset >= m_maxHeight) {
                 createNewPage();
             }
             renderSection(*(m_reportDocument->m_reportFooter));
         }
     }
     finishCurPage(true);
 
     #ifdef KREPORT_SCRIPTING
     // _postProcText contains those text boxes that need to be updated
     // with information that wasn't available at the time it was added to the document
     m_scriptHandler->setPageTotal(m_document->pageCount());
 
     for (int i = 0; i < m_postProcText.size(); i++) {
         OROTextBox * tb = m_postProcText.at(i);
 
         m_scriptHandler->setPageNumber(tb->page()->pageNumber() + 1);
 
         tb->setText(m_scriptHandler->evaluate(tb->text()).toString());
     }
     #endif
 
     asyncManager->startRendering();
 
     #ifdef KREPORT_SCRIPTING
     m_scriptHandler->displayErrors();
     #endif
 
     if (!m_dataSource->close()) {
         return false;
     }
     #ifdef KREPORT_SCRIPTING
     delete m_scriptHandler;
-    m_scriptHandler = 0;
+    m_scriptHandler = nullptr;
     #endif
 
     if (m_dataSource != m_oneRecord) {
         delete m_dataSource;
-        m_dataSource = 0;
+        m_dataSource = nullptr;
     }
     m_postProcText.clear();
 
     return true;
 }
 
 //===========================KReportPreRenderer===============================
 
 KReportPreRenderer::KReportPreRenderer(const QDomElement &document) : d(new KReportPreRendererPrivate(this))
 {
     setDocument(document);
     connect(d, &KReportPreRendererPrivate::finishedAllASyncItems, this, &KReportPreRenderer::finishedAllASyncItems);
 }
 
 KReportPreRenderer::~KReportPreRenderer()
 {
     delete d;
 }
 
 void KReportPreRenderer::setName(const QString &n)
 {
     d->m_reportDocument->setName(n);
 }
 
 bool KReportPreRenderer::isValid() const
 {
     if (d && d->m_valid)
         return true;
     return false;
 }
 
 ORODocument* KReportPreRenderer::document()
 {
     return d->m_document;
 }
 
 bool KReportPreRenderer::generateDocument()
 {
 //    delete d->m_document;
     if (!d->generateDocument()) {
         delete d->m_document;
-        d->m_document = 0;
+        d->m_document = nullptr;
     }
     return d->m_document;
 }
 
 void KReportPreRenderer::setSourceData(KReportDataSource *dataSource)
 {
     if (d && dataSource != d->m_dataSource) {
         delete d->m_dataSource;
         d->m_dataSource = dataSource;
     }
 }
 
 bool KReportPreRenderer::setDocument(const QDomElement &document)
 {
     delete d->m_document;
     d->m_valid = false;
 
     if (document.tagName() != QLatin1String("report:content")) {
         kreportWarning() << "report schema is invalid";
         return false;
     }
 
     d->m_reportDocument = new KReportDocument(document);
     d->m_valid = d->m_reportDocument->isValid();
     return isValid();
 }
 
 #ifdef KREPORT_SCRIPTING
 void KReportPreRenderer::registerScriptObject(QObject* obj, const QString& name)
 {
     //kreportDebug() << name;
     d->m_scriptObjects[name] = obj;
 }
 
 KReportScriptHandler *KReportPreRenderer::scriptHandler()
 {
     return d->m_scriptHandler;
 }
 #endif
 
 const KReportDocument* KReportPreRenderer::reportData() const
 {
     return d->m_reportDocument;
 }
diff --git a/src/renderer/KReportPreRenderer.h b/src/renderer/KReportPreRenderer.h
index ffab0afa..3ec256b3 100644
--- a/src/renderer/KReportPreRenderer.h
+++ b/src/renderer/KReportPreRenderer.h
@@ -1,83 +1,83 @@
 /* This file is part of the KDE project
  * Copyright (C) 2001-2007 by OpenMFG, LLC (info@openmfg.com)
  * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 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
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library.  If not, see .
  */
 
 #ifndef KREPORTPRERENDERER_H
 #define KREPORTPRERENDERER_H
 
 #include "config-kreport.h"
 #include "kreport_export.h"
 
 #include 
 
 #ifdef KREPORT_SCRIPTING
 class KReportScriptHandler;
 #else
 #define KReportScriptHandler void
 #endif
 class KReportPreRendererPrivate;
 class ORODocument;
 class KReportDataSource;
 class KReportDocument;
 class QDomElement;
 
 //
 // ORPreRender
 // This class takes a report definition and prerenders the result to
 // an ORODocument that can be used to pass to any number of renderers.
 //
 class KREPORT_EXPORT KReportPreRenderer : public QObject
 {
     Q_OBJECT
 public:
     explicit KReportPreRenderer(const QDomElement& document);
 
-    virtual ~KReportPreRenderer();
+    ~KReportPreRenderer() override;
 
     //! Sets source data to @a data, takes ownership
     void setSourceData(KReportDataSource* dataSource);
 
 #ifdef KREPORT_SCRIPTING
     KReportScriptHandler *scriptHandler();
-    void registerScriptObject(QObject*, const QString&);
+    void registerScriptObject(QObject *obj, const QString &name);
 #endif
 
     bool generateDocument();
 
     ORODocument *document();
 
     /**
     @brief Set the name of the report so that it can be used internally by the script engine
     */
     void setName(const QString &);
 
     bool isValid() const;
 
     const KReportDocument *reportData() const;
 
 Q_SIGNALS:
     void groupChanged(const QMap &groupData);
     void finishedAllASyncItems();
     
 private:
     bool setDocument(const QDomElement &document);
 
 private:
     KReportPreRendererPrivate *const d;
 };
 
 #endif // KREPORTPRERENDERER_H
diff --git a/src/renderer/KReportPreRenderer_p.h b/src/renderer/KReportPreRenderer_p.h
index dd658a31..b39168ef 100644
--- a/src/renderer/KReportPreRenderer_p.h
+++ b/src/renderer/KReportPreRenderer_p.h
@@ -1,101 +1,101 @@
 /* This file is part of the KDE project
  * Copyright (C) 2001-2007 by OpenMFG, LLC (info@openmfg.com)
  * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 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
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library.  If not, see .
  */
 
 #ifndef KREPORTPRERENDERER_P_H
 #define KREPORTPRERENDERER_P_H
 
 #include "config-kreport.h"
 
 #include "KReportRenderObjects.h"
 #include "KReportAsyncItemManager_p.h"
 #include "KReportDetailSectionData.h"
 
 #include 
 
 namespace KReportPrivate{
   class OneRecordDataSource;
 }
 class KReportPreRenderer;
 
 /*! This class is the private class that houses all the internal
   variables so we can provide a cleaner interface to the user
   without presenting to them things that they don't need to see
   and may change over time. */
 class KReportPreRendererPrivate : public QObject
 {
     Q_OBJECT
 public:
     KReportPreRendererPrivate(KReportPreRenderer *preRenderer);
-    virtual ~KReportPreRendererPrivate();
+    ~KReportPreRendererPrivate() override;
 
     KReportPreRenderer * const m_preRenderer;
     bool m_valid;
 
     ORODocument* m_document;
     OROPage*     m_page;
     KReportDocument* m_reportDocument;
 
     qreal m_yOffset;      // how far down the current page are we
     qreal m_topMargin;    // value stored in the correct units
     qreal m_bottomMargin; // -- same as above --
     qreal m_leftMargin;   // -- same as above --
     qreal m_rightMargin;  // -- same as above --
     qreal m_maxHeight;    // -- same as above --
     qreal m_maxWidth;     // -- same as above --
     int m_pageCounter;    // what page are we currently on?
 
     KReportDataSource* m_dataSource;
     KReportPrivate::OneRecordDataSource *m_oneRecord;
 
     QList m_postProcText;
 
 #ifdef KREPORT_SCRIPTING
     QMap m_scriptObjects;
 #endif
 
     void createNewPage();
     qreal finishCurPage(bool lastPage);
     qreal finishCurPageSize(bool lastPage);
 
     void renderDetailSection(KReportDetailSectionData *detailData);
     qreal renderSection(const KReportSectionData &);
     qreal renderSectionSize(const KReportSectionData &);
 
     ///Scripting Stuff
     KReportScriptHandler *m_scriptHandler;
 #ifdef KREPORT_SCRIPTING
     void initEngine();
 #endif
 
     //! Generates m_document. Returns true on success.
     //! @note m_document is not removed on failure, caller should remove it.
     bool generateDocument();
 
     KReportPrivate::AsyncItemManager* asyncManager;
 
 private Q_SLOTS:
     void asyncItemsFinished();
 
 Q_SIGNALS:
     void enteredGroup(const QString&, const QVariant&);
     void exitedGroup(const QString&, const QVariant&);
     void renderingSection(KReportSectionData*, OROPage*, QPointF);
     void finishedAllASyncItems();
 };
 
 #endif // __KOREPORTPRERENDERER_P_H__
diff --git a/src/renderer/KReportPrintRenderer_p.cpp b/src/renderer/KReportPrintRenderer_p.cpp
index 7f4325e0..0250d8bb 100644
--- a/src/renderer/KReportPrintRenderer_p.cpp
+++ b/src/renderer/KReportPrintRenderer_p.cpp
@@ -1,247 +1,247 @@
 /* This file is part of the KDE project
  * Copyright (C) 2001-2007 by OpenMFG, LLC (info@openmfg.com)
  * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 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
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library.  If not, see .
  */
 
 #include "KReportPrintRenderer_p.h"
 #include "kreport_debug.h"
 #include "KReportRenderObjects.h"
 #include "KReportPageSize.h"
 #include "KReportUtils_p.h"
 
 #include 
 #include 
 #include 
 
 namespace KReportPrivate {
 
 PrintRenderer::PrintRenderer()
 {
 }
 
 PrintRenderer::~PrintRenderer()
 {
 }
 
 bool PrintRenderer::setupPrinter( ORODocument * document, QPrinter * pPrinter)
 {
-    if (document == 0 || pPrinter == 0)
+    if (document == nullptr || pPrinter == nullptr)
         return false;
 
     pPrinter->setCreator(QLatin1String("KReport Print Renderer"));
     pPrinter->setDocName(document->title());
     pPrinter->setFullPage(true);
     pPrinter->setOrientation((document->pageLayout().orientation() == QPageLayout::Portrait ? QPrinter::Portrait : QPrinter::Landscape));
     pPrinter->setPageOrder(QPrinter::FirstPageFirst);
 
     if (!document->pageLayout().pageSize().isValid()) {
         pPrinter->setPageSize(QPrinter::Custom);
     } else {
         pPrinter->setPageSize(QPageSize(document->pageLayout().pageSize()));
     }
 
     return true;
 }
 
 bool PrintRenderer::render(const KReportRendererContext &context, ORODocument *document, int page)
 {
     Q_UNUSED(page);
-    if (document == 0 || context.printer() == 0 || context.painter() == 0)
+    if (document == nullptr || context.printer() == nullptr || context.painter() == nullptr)
         return false;
 
     setupPrinter(document, context.printer());
 
     bool endWhenComplete = false;
 
 
     if (!context.painter()->isActive()) {
         endWhenComplete = true;
         if (!context.painter()->begin(context.printer()))
             return false;
     }
 
     int fromPage = context.printer()->fromPage();
     if (fromPage > 0)
         fromPage -= 1;
     int toPage = context.printer()->toPage();
     if (toPage == 0 || toPage > document->pageCount())
         toPage = document->pageCount();
 
     qreal scaleX = context.printer()->resolution() / qreal(KReportPrivate::dpiX());
     qreal scaleY = context.printer()->resolution() / qreal(KReportPrivate::dpiY());
 
 
     for (int copy = 0; copy < context.printer()->numCopies(); copy++) {
         for (int page = fromPage; page < toPage; page++) {
             if (page > fromPage)
                 context.printer()->newPage();
 
             OROPage * p = document->page(page);
             if (context.printer()->pageOrder() == QPrinter::LastPageFirst)
                 p = document->page(toPage - 1 - page);
 
             // Render Page Objects
             for (int i = 0; i < p->primitiveCount(); i++) {
                 OROPrimitive * prim = p->primitive(i);
 
 
                 prim->setPosition(QPointF(prim->position().x() * scaleX, prim->position().y() * scaleY));
                 prim->setSize(QSizeF(prim->size().width() * scaleX, prim->size().height() * scaleY));
                 //kreportDebug() << "Rendering object" << i << "type" << prim->type();
                 if (OROTextBox *tb = dynamic_cast(prim)) {
                     QPointF ps = tb->position();
                     QSizeF sz = tb->size();
                     QRectF rc = QRectF(ps.x(), ps.y(), sz.width(), sz.height());
 
                     context.painter()->save();
                     //Background
 
                     QColor bg = tb->textStyle().backgroundColor;
                     bg.setAlphaF(0.01 * tb->textStyle().backgroundOpacity);
 
                     //_painter()->setBackgroundMode(Qt::OpaqueMode);
                     context.painter()->fillRect(rc, bg);
 
                     //Text
                     context.painter()->setBackgroundMode(Qt::TransparentMode);
                     context.painter()->setFont(tb->textStyle().font);
                     context.painter()->setPen(tb->textStyle().foregroundColor);
                     context.painter()->drawText(rc, tb->flags(), tb->text());
 
                     //outer line
                     context.painter()->setPen(QPen(tb->lineStyle().color(), tb->lineStyle().weight() * scaleX, tb->lineStyle().penStyle()));
                     context.painter()->drawRect(rc);
 
                     //Reset back to defaults for next element
                     context.painter()->restore();
 
                 } else if (OROLine *ln = dynamic_cast(prim)) {
                     QPointF s = ln->startPoint();
                     QPointF e(ln->endPoint().x() * scaleX, ln->endPoint().y() * scaleY);
                     //QPen pen ( _painter()->pen() );
                     QPen pen(ln->lineStyle().color(), ln->lineStyle().weight() * scaleX, ln->lineStyle().penStyle());
 
                     context.painter()->save();
                     context.painter()->setRenderHint(QPainter::Antialiasing, true);
                     context.painter()->setPen(pen);
                     context.painter()->drawLine(QLineF(s.x(), s.y(), e.x(), e.y()));
                     context.painter()->setRenderHint(QPainter::Antialiasing, false);
                     context.painter()->restore();
                 } else if (OROImage *im = dynamic_cast(prim)) {
                     QPointF ps = im->position();
                     QSizeF sz = im->size();
                     QRectF rc = QRectF(ps.x(), ps.y(), sz.width(), sz.height());
 
                     QImage img = im->image();
                     if (im->isScaled())
                         img = img.scaled(rc.size().toSize(), (Qt::AspectRatioMode) im->aspectRatioMode(), (Qt::TransformationMode) im->transformationMode());
 
                     QRectF sr = QRectF(QPointF(0.0, 0.0), rc.size().boundedTo(img.size()));
                     context.painter()->drawImage(rc.topLeft(), img, sr);
                 } else if (ORORect *re = dynamic_cast(prim)) {
                     QPointF ps = re->position();
                     QSizeF sz = re->size();
                     QRectF rc = QRectF(ps.x(), ps.y(), sz.width(), sz.height());
 
                     context.painter()->save();
                     context.painter()->setPen(re->pen());
                     context.painter()->setBrush(re->brush());
                     context.painter()->drawRect(rc);
                     context.painter()->restore();
                 } else if (OROEllipse *re = dynamic_cast(prim)) {
                     QPointF ps = re->position();
                     QSizeF sz = re->size();
                     QRectF rc = QRectF(ps.x(), ps.y(), sz.width(), sz.height());
 
                     context.painter()->save();
                     context.painter()->setPen(re->pen());
                     context.painter()->setBrush(re->brush());
                     context.painter()->drawEllipse(rc);
                     context.painter()->restore();
                 } else if (OROPicture *im = dynamic_cast(prim)) {
                     QPointF ps = im->position();
                     QSizeF sz = im->size();
                     QRectF rc = QRectF(ps.x(), ps.y(), sz.width(), sz.height());
                     context.painter()->drawPicture(rc.topLeft(), *(im->picture()));
                 } else if (OROCheckBox *chk = dynamic_cast(prim)) {
                     QPointF ps = chk->position();
                     QSizeF sz = chk->size();
                     QRectF rc = QRectF(ps.x(), ps.y(), sz.width(), sz.height());
 
                     context.painter()->save();
 
                     context.painter()->setBackgroundMode(Qt::OpaqueMode);
                     context.painter()->setRenderHint(QPainter::Antialiasing);
 
                     context.painter()->setPen(chk->foregroundColor());
 
                     if (chk->lineStyle().penStyle() == Qt::NoPen || chk->lineStyle().weight() <= 0) {
                         context.painter()->setPen(QPen(Qt::lightGray));
                     } else {
                         context.painter()->setPen(QPen(chk->lineStyle().color(), chk->lineStyle().weight() * scaleX, chk->lineStyle().penStyle()));
                     }
 
                     qreal ox = sz.width() / 5;
                     qreal oy = sz.height() / 5;
 
                     //Checkbox Style
                     if (chk->checkType() == OROCheckBox::Cross) {
                         context.painter()->drawRoundedRect(rc, sz.width() / 10 , sz.height() / 10);
 
                         if (chk->value()) {
                             QPen lp;
                             lp.setColor(chk->foregroundColor());
                             lp.setWidth(ox > oy ? oy : ox);
                             context.painter()->setPen(lp);
                             context.painter()->drawLine(QPointF(ox, oy) + ps, QPointF(sz.width() - ox, sz.height() - oy) + ps);
                             context.painter()->drawLine(QPointF(ox, sz.height() - oy) + ps, QPoint(sz.width() - ox, oy) + ps);
                         }
                     } else if (chk->checkType() == OROCheckBox::Dot) {
                         //Radio Style
                         context.painter()->drawEllipse(rc);
 
                         if (chk->value()) {
                             QBrush lb(chk->foregroundColor());
                             context.painter()->setBrush(lb);
                             context.painter()->setPen(Qt::NoPen);
                             context.painter()->drawEllipse(rc.center(), sz.width() / 2 - ox, sz.height() / 2 - oy);
                         }
                     } else {
                         //Tickbox Style
                         context.painter()->drawRoundedRect(rc, sz.width() / 10 , sz.height() / 10);
 
                         if (chk->value()) {
                             QPen lp;
                             lp.setColor(chk->foregroundColor());
                             lp.setWidth(ox > oy ? oy : ox);
                             context.painter()->setPen(lp);
                             context.painter()->drawLine(QPointF(ox, sz.height() / 2) + ps, QPointF(sz.width() / 2, sz.height() - oy) + ps);
                             context.painter()->drawLine(QPointF(sz.width() / 2, sz.height() - oy) + ps, QPointF(sz.width() - ox, oy) + ps);
                         }
                     }
                     context.painter()->restore();
                 }
             }
         }
     }
 
     if (endWhenComplete)
         context.painter()->end();
 
     return true;
 }
 
 }
diff --git a/src/renderer/KReportPrintRenderer_p.h b/src/renderer/KReportPrintRenderer_p.h
index f7cd7b12..0ac2e412 100644
--- a/src/renderer/KReportPrintRenderer_p.h
+++ b/src/renderer/KReportPrintRenderer_p.h
@@ -1,43 +1,44 @@
 /* This file is part of the KDE project
  * Copyright (C) 2001-2007 by OpenMFG, LLC (info@openmfg.com)
  * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 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
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library.  If not, see .
  */
 
 #ifndef KREPORTPRINTRENDERER_H
 #define KREPORTPRINTRENDERER_H
 
 #include "KReportRendererBase.h"
 
 class ORODocument;
 
 namespace KReportPrivate {
   
 class PrintRenderer : public KReportRendererBase
 {
     public:
         PrintRenderer();
-        virtual ~PrintRenderer();
-        virtual bool render(const KReportRendererContext&, ORODocument*, int page = -1);
+        ~PrintRenderer() override;
+        bool render(const KReportRendererContext &context, ORODocument *document,
+                    int page = -1) override;
 
     private:
         bool setupPrinter(ORODocument *, QPrinter *);
 };
 
 }
 #endif // KREPORTPRINTRENDERER_H
 
 
 
diff --git a/src/renderer/KReportRendererBase.cpp b/src/renderer/KReportRendererBase.cpp
index 72eef79f..7d8c59af 100644
--- a/src/renderer/KReportRendererBase.cpp
+++ b/src/renderer/KReportRendererBase.cpp
@@ -1,154 +1,154 @@
 /* This file is part of the KDE project
    Copyright (C) 2010 by Adam Pigg (adam@piggz.co.uk)
 
    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.1 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 "KReportRendererBase.h"
 #include "KReportScreenRenderer_p.h"
 #include "KReportPrintRenderer_p.h"
 #include "KReportKSpreadRenderer.h"
 #include "KReportHTMLTableRenderer_p.h"
 #include "KReportHTMLCSSRenderer_p.h"
 //! @todo port #include "KReportODTRenderer.h"
 //! @todo port #include "KOdtFrameReportRenderer.h"
 
 class Q_DECL_HIDDEN KReportRendererContext::Private 
 {
 public:
     Private();
     ~Private();
     QUrl destinationUrl;
     QPainter *painter = nullptr;
     QPrinter *printer = nullptr;    
 };
 
 KReportRendererContext::Private::Private()
 {
 }
 
 KReportRendererContext::Private::~Private()
 {
 }
 
 
 KReportRendererContext::KReportRendererContext()
  : d(new Private())
 {
 }
 
 KReportRendererContext::~KReportRendererContext()
 {
     delete d;
 }
 
 QPainter * KReportRendererContext::painter() const
 {
     return d->painter;
 }
 
 QPrinter * KReportRendererContext::printer() const
 {
     return d->printer;
 }
 
 
 QPainter * KReportRendererContext::painter()
 {
     return d->painter;
 }
 
 QPrinter * KReportRendererContext::printer()
 {
     return d->printer;
 }
 
 void KReportRendererContext::setUrl(const QUrl& url)
 {
     d->destinationUrl = url;
 }
 
 void KReportRendererContext::setPainter(QPainter* painter)
 {
     d->painter = painter;
 }
 
 void KReportRendererContext::setPrinter(QPrinter* printer)
 {
     d->printer = printer;
 }
 
 QUrl KReportRendererContext::url() const
 {
     return d->destinationUrl;
 }
 
 
 KReportRendererBase::KReportRendererBase()
 {
 }
 
 KReportRendererBase::~KReportRendererBase()
 {
 }
 
 class KReportRendererFactory::Private 
 {
 public:
     bool dummy = true;
 };
 
 KReportRendererFactory::KReportRendererFactory() : d(new Private())
 {
 }
 
 KReportRendererFactory::~KReportRendererFactory()
 {
     delete d;
 }
 
 KReportRendererBase* KReportRendererFactory::createInstance(const QString& key)
 {
     const QString lowerKey = key.toLower();
     if (lowerKey == QLatin1String("screen")) {
         return new KReportPrivate::ScreenRenderer();
     }
     if (lowerKey == QLatin1String("print")) {
         return new KReportPrivate::PrintRenderer();
     }
 //! @todo port
 #if 0
     if (lowerKey == QLatin1String("ods")) {
         return new KReportKSpreadRenderer();
     }
 #endif
     if (lowerKey == QLatin1String("htmltable")) {
         return new KReportPrivate::HTMLTableRenderer();
     }
     if (lowerKey == QLatin1String("htmlcss")) {
         return new KReportPrivate::HTMLCSSRenderer();
     }
 //! @todo port
 #if 0
     if (lowerKey == QLatin1String("odttable") || lowerKey == QLatin1String("odt")) {
         return new KReportODTRenderer();
     }
     if (lowerKey == QLatin1String("odtframes")) {
         return new KReportOdtFrameReportRenderer();
     }
 #endif
-    return 0;
+    return nullptr;
 }
diff --git a/src/renderer/KReportScreenRenderer_p.h b/src/renderer/KReportScreenRenderer_p.h
index 468906df..44f8ad05 100644
--- a/src/renderer/KReportScreenRenderer_p.h
+++ b/src/renderer/KReportScreenRenderer_p.h
@@ -1,49 +1,49 @@
 /* This file is part of the KDE project
  * Copyright (C) 2001-2007 by OpenMFG, LLC (info@openmfg.com)
  * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 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
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library.  If not, see .
  */
 
 #ifndef KREPORTSCREENRENDERER_H
 #define KREPORTSCREENRENDERER_H
 
 #include 
 
 #include "KReportRendererBase.h"
 
 class ORODocument;
 
 namespace KReportPrivate {
   
 class ScreenRenderer : public KReportRendererBase
 {
 public:
     ScreenRenderer();
-    virtual ~ScreenRenderer();
+    ~ScreenRenderer() override;
 
     //void setPainter(QPainter *);
     //QPainter * painter() {
     //    return m_painter;
     //}
 
-    virtual bool render(const KReportRendererContext& context, ORODocument *document, int page);
+    bool render(const KReportRendererContext &context, ORODocument *document, int page) override;
 
 protected:
     //QPainter* m_painter;
 };
 
 }
 
 #endif // KREPORTSCREENRENDERER_H
diff --git a/src/renderer/KReportView.cpp b/src/renderer/KReportView.cpp
index db7f89d2..8542773c 100644
--- a/src/renderer/KReportView.cpp
+++ b/src/renderer/KReportView.cpp
@@ -1,169 +1,169 @@
 /* This file is part of the KDE project
    Copyright (C) 2015 by Adam Pigg (adam@piggz.co.uk)
    Copyright (C) 2017 Jarosław Staniek 
 
    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.1 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 "KReportView.h"
 #include "KReportPage.h"
 #include "KReportRenderObjects.h"
 #include "KReportPreRenderer.h"
 #include "KReportRendererBase.h"
 #include "kreport_debug.h"
 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 
 //! @internal
 class Q_DECL_HIDDEN KReportView::Private
 {
 public:
     explicit Private()
-        : reportPage(0)
+        : reportPage(nullptr)
         , currentPage(1)
         , pageCount(0)
     {}
 
     ~Private()
     {}
 
     //! Move to page @a page (counted from 1)
     void moveToPage(int page)
     {
         if (page != currentPage && page >= 1 && page <= pageCount) {
             currentPage = page;
             reportPage->renderPage(currentPage);
         }
     }
 
     QPointer reportDocument;
     QGraphicsView *reportView;
     QGraphicsScene *reportScene;
     KReportPage *reportPage;
 
     int currentPage;
     int pageCount;
 
     KReportRendererFactory factory;
 };
 
 
 KReportView::KReportView(QWidget *parent)
         : QWidget(parent), d(new Private())
 {
     setObjectName(QLatin1String("KReportView"));
 
     d->reportView = new QGraphicsView(this);
     // page selector should be always visible:
     d->reportView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
 
     QVBoxLayout *l = new QVBoxLayout;
     l->setMargin(0);
     setLayout(l);
 
     layout()->addWidget(d->reportView);
 
     d->reportScene = new QGraphicsScene(this);
     d->reportScene->setSceneRect(0,0,1000,2000);
     d->reportView->setScene(d->reportScene);
 
     d->reportScene->setBackgroundBrush(palette().brush(QPalette::Dark));
 }
 
 KReportView::~KReportView()
 {
     //kreportDebug();
     delete d;
 }
 
 void KReportView::moveToFirstPage()
 {
     d->moveToPage(1);
 }
 
 void KReportView::moveToLastPage()
 {
     d->moveToPage(d->pageCount);
 }
 
 void KReportView::moveToNextPage()
 {
     d->moveToPage(d->currentPage + 1);
 }
 
 void KReportView::moveToPreviousPage()
 {
     d->moveToPage(d->currentPage - 1);
 }
 
 void KReportView::moveToPage(int page)
 {
     d->moveToPage(page);
 }
 
 int KReportView::currentPage() const
 {
     return d->currentPage;
 }
 
 int KReportView::pageCount() const
 {
     return d->pageCount;
 }
 
 void KReportView::setDocument(ORODocument* doc)
 {
     d->reportDocument = doc;
 
     if (d->reportPage) {
         delete d->reportPage;
     }
 
     d->pageCount = doc->pageCount();
 
     d->reportPage = new KReportPage(this, d->reportDocument);
     d->reportPage->setObjectName(QLatin1String("KReportPage"));
 
     d->reportScene->setSceneRect(0,0,d->reportPage->rect().width() + 40, d->reportPage->rect().height() + 40);
     d->reportScene->addItem(d->reportPage);
     d->reportPage->setPos(20,20);
     d->reportView->centerOn(0,0);
 
 }
 
 QAbstractScrollArea* KReportView::scrollArea()
 {
     return d->reportView;
 }
 
 void KReportView::refreshCurrentPage()
 {
     //qDebug() << "Refreshing current page" << d->currentPage;
     if (d->reportPage) {
         d->reportPage->renderPage(d->currentPage);
     }
 }
 
diff --git a/src/renderer/KReportView.h b/src/renderer/KReportView.h
index 20dc0692..9f850d23 100644
--- a/src/renderer/KReportView.h
+++ b/src/renderer/KReportView.h
@@ -1,67 +1,67 @@
 /* This file is part of the KDE project
    Copyright (C) 2015 by Adam Pigg (adam@piggz.co.uk)
    Copyright (C) 2017 Jarosław Staniek 
 
    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.1 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.
 */
 
 #ifndef KREPORTVIEW_H
 #define KREPORTVIEW_H
 
 #include 
 
 #include "kreport_export.h"
 
 class ORODocument;
 class QAbstractScrollArea;
 
 /**
  * @brief Provides a simple widget for viewing a rendered report on screen
  *
  */
 class KREPORT_EXPORT KReportView : public QWidget
 {
     Q_OBJECT
 public:
     explicit KReportView(QWidget *parent);
 
-    ~KReportView();
+    ~KReportView() override;
 
     void moveToFirstPage();
     void moveToLastPage();
     void moveToNextPage();
     void moveToPreviousPage();
 
     //! Moves to page @a page (counted from 1)
     //! @since 3.1
     void moveToPage(int page);
 
     //! @return number of current page (counted from 1)
     int currentPage() const;
 
     int pageCount() const;
     void refreshCurrentPage();
     void setDocument(ORODocument* doc);
 
     QAbstractScrollArea* scrollArea();
 
 private:
     Q_DISABLE_COPY(KReportView)
     class Private;
     Private * const d;
 };
 
 #endif
diff --git a/src/renderer/scripting/KReportGroupTracker.h b/src/renderer/scripting/KReportGroupTracker.h
index cc219baf..739e19b5 100644
--- a/src/renderer/scripting/KReportGroupTracker.h
+++ b/src/renderer/scripting/KReportGroupTracker.h
@@ -1,19 +1,19 @@
 #ifndef KREPORTGROUPTRACKER_H
 #define KREPORTGROUPTRACKER_H
 
 #include 
 #include "kreport_export.h"
 
 class KREPORT_EXPORT KReportGroupTracker : public QObject {
     Q_OBJECT
 
 protected:
     KReportGroupTracker() {}
-    virtual ~KReportGroupTracker(){}
+    ~KReportGroupTracker() override{}
 
 public:
     Q_SLOT virtual void setGroupData(const QMap &groupData) = 0;
 };
 
 #endif // KREPORTGROUPTRACKER_H
 
diff --git a/src/renderer/scripting/KReportScriptConstants.h b/src/renderer/scripting/KReportScriptConstants.h
index 943f113e..3303393c 100644
--- a/src/renderer/scripting/KReportScriptConstants.h
+++ b/src/renderer/scripting/KReportScriptConstants.h
@@ -1,71 +1,71 @@
 /* This file is part of the KDE project
  * Copyright (C) 2001-2007 by OpenMFG, LLC (info@openmfg.com)
  * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 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
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library.  If not, see .
  */
 
 #ifndef KRSCRIPTCONSTANTS_H
 #define KRSCRIPTCONSTANTS_H
 
 #include 
 
 /**
  @brief Helper giving access to various scripting constants
 
  Contains methods for retreiving the current page number, page total
  and access to the PenStyle enums from user scripts
  */
 class KReportScriptConstants : public QObject
 {
     Q_OBJECT
 public:
-    explicit KReportScriptConstants(QObject *parent = 0);
+    explicit KReportScriptConstants(QObject *parent = nullptr);
 
-    ~KReportScriptConstants();
+    ~KReportScriptConstants() override;
     Q_ENUMS(PenStyle)
 
     //!Enum values for pen styles that can be accessed from user scripts using
     //! \code
     //! constants.QtSolidLine
     //! \endcode
     //! for example
     enum PenStyle {QtNoPen = 0, QtSolidLine, QtDashLine, QtDotLine, QtDashDotLine, QtDashDotDotLine};
 
     void setPageNumber(int p) {
         m_currentPage = p;
     }
     void setPageTotal(int t) {
         m_totalPages = t;
     };
 public Q_SLOTS:
 
     //! @return the current page number
     int PageNumber() {
         return m_currentPage;
     };
 
     //! @return the total number of pages
     int PageTotal() {
         return m_totalPages;
     };
 
 private:
     int m_currentPage;
     int m_totalPages;
 
 
 };
 
 #endif
diff --git a/src/renderer/scripting/KReportScriptDebug.cpp b/src/renderer/scripting/KReportScriptDebug.cpp
index 5789deb5..c4436ef1 100644
--- a/src/renderer/scripting/KReportScriptDebug.cpp
+++ b/src/renderer/scripting/KReportScriptDebug.cpp
@@ -1,41 +1,41 @@
 /* This file is part of the KDE project
  * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 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
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library.  If not, see .
  */
 
 #include "KReportScriptDebug.h"
 #include "kreport_debug.h"
 
 #include 
 
 KReportScriptDebug::KReportScriptDebug(QObject *parent)
         : QObject(parent)
 {
 }
 
 
 KReportScriptDebug::~KReportScriptDebug()
 {
 }
 
 void KReportScriptDebug::print(const QString& s)
 {
     kreportDebug() << s;
 }
 
 void KReportScriptDebug::message(const QString &t, const QString &m)
 {
-    KMessageBox::information(0, m, t);
+    KMessageBox::information(nullptr, m, t);
 }
diff --git a/src/renderer/scripting/KReportScriptDebug.h b/src/renderer/scripting/KReportScriptDebug.h
index 57a39c5e..d8e2f4f9 100644
--- a/src/renderer/scripting/KReportScriptDebug.h
+++ b/src/renderer/scripting/KReportScriptDebug.h
@@ -1,45 +1,45 @@
 /* This file is part of the KDE project
  * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 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
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library.  If not, see .
  */
 
 #ifndef KRSCRIPTDEBUG_H
 #define KRSCRIPTDEBUG_H
 
 #include 
 
 /**
  @brief Helper for the scripting API to display user messages
 
  Contains methods for display messages to the screen or console \n
  */
 class KReportScriptDebug : public QObject
 {
     Q_OBJECT
 public:
-    explicit KReportScriptDebug(QObject *parent = 0);
+    explicit KReportScriptDebug(QObject *parent = nullptr);
 
-    ~KReportScriptDebug();
+    ~KReportScriptDebug() override;
 
 public Q_SLOTS:
     //! Prints the given message to the console
     void print(const QString&);
 
     //! Displays the given message and title in an information box
     void message(const QString &, const QString&);
 
 };
 
 #endif
diff --git a/src/renderer/scripting/KReportScriptDraw.cpp b/src/renderer/scripting/KReportScriptDraw.cpp
index f65fe9d8..3c48196b 100644
--- a/src/renderer/scripting/KReportScriptDraw.cpp
+++ b/src/renderer/scripting/KReportScriptDraw.cpp
@@ -1,132 +1,132 @@
 /* This file is part of the KDE project
  * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 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
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library.  If not, see .
  */
 
 #include "KReportScriptDraw.h"
 #include "KReportRenderObjects.h"
 
 #include 
 #include 
 
 KReportScriptDraw::KReportScriptDraw(QObject *parent)
         : QObject(parent)
 {
-    m_curPage = 0;
+    m_curPage = nullptr;
 }
 
 
 KReportScriptDraw::~KReportScriptDraw()
 {
 }
 
 void KReportScriptDraw::setPage(OROPage *p)
 {
     m_curPage = p;
 }
 
 void KReportScriptDraw::setOffset(QPointF off)
 {
     m_curOffset = off;
 }
 
 void KReportScriptDraw::rectangle(qreal x, qreal y, qreal w, qreal h, const QString& lc, const QString& fc, qreal lw, int a)
 {
     if (m_curPage) {
         ORORect *r = new ORORect();
 
         r->setRect(QRectF(KReportItemBase::scenePosition(QPointF(x, y)) + m_curOffset, KReportItemBase::sceneSize(QSizeF(w, h))));
 
         QPen pen(QColor(lc), lw);
         QColor c(fc);
         c.setAlpha(a);
         QBrush bru(c);
 
         r->setBrush(bru);
         r->setPen(pen);
         m_curPage->insertPrimitive(r);
     }
 }
 
 void KReportScriptDraw::ellipse(qreal x, qreal y, qreal w, qreal h, const QString& lc, const QString& fc, qreal lw, int a)
 {
     if (m_curPage) {
         OROEllipse *e = new OROEllipse();
 
         e->setRect(QRectF(KReportItemBase::scenePosition(QPointF(x, y)) + m_curOffset, KReportItemBase::sceneSize(QSizeF(w, h))));
 
         QPen pen(QColor(lc), lw);
         QColor c(fc);
         c.setAlpha(a);
         QBrush bru(c);
 
         e->setBrush(bru);
         e->setPen(pen);
         m_curPage->insertPrimitive(e);
     }
 }
 
 void KReportScriptDraw::line(qreal x1, qreal y1, qreal x2, qreal y2, const QString& lc)
 {
     if (m_curPage) {
         OROLine *ln = new OROLine();
 
         ln->setStartPoint(KReportItemBase::scenePosition(QPointF(x1, y1) + m_curOffset));
         ln->setEndPoint(KReportItemBase::scenePosition(QPointF(x2, y2) + m_curOffset));
 
         KReportLineStyle ls;
         ls.setColor(QColor(lc));
         ls.setWeight(1);
         ls.setPenStyle(Qt::SolidLine);
 
         ln->setLineStyle(ls);
         m_curPage->insertPrimitive(ln);
     }
 }
 
 void KReportScriptDraw::text(qreal x, qreal y, const QString &txt, const QString &fnt, int pt, const QString &fc, const QString&bc, const QString &lc, qreal lw, int o)
 {
     if (m_curPage) {
         QFont f(fnt, pt);
         QRectF r = QFontMetrics(f).boundingRect(txt);
 
         KReportTextStyleData ts;
         ts.font = f;
         ts.backgroundColor = QColor(bc);
         ts.foregroundColor = QColor(fc);
         ts.backgroundOpacity = o;
 
         KReportLineStyle ls;
         ls.setColor(QColor(lc));
         ls.setWeight(lw);
         if (lw <= 0)
             ls.setPenStyle(Qt::NoPen);
         else
             ls.setPenStyle(Qt::SolidLine);
 
 
         OROTextBox *tb = new OROTextBox();
         tb->setPosition(QPointF(x, y) + m_curOffset);
         tb->setSize(r.size());
         tb->setTextStyle(ts);
         tb->setLineStyle(ls);
 
         tb->setText(txt);
 
         m_curPage->insertPrimitive(tb);
 
     }
 }
 
diff --git a/src/renderer/scripting/KReportScriptDraw.h b/src/renderer/scripting/KReportScriptDraw.h
index e1828c8e..12bed5e0 100644
--- a/src/renderer/scripting/KReportScriptDraw.h
+++ b/src/renderer/scripting/KReportScriptDraw.h
@@ -1,96 +1,96 @@
 /* This file is part of the KDE project
  * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 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
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library.  If not, see .
  */
 
 #ifndef KRSCRIPTDRAW_H
 #define KRSCRIPTDRAW_H
 
 #include 
 #include 
 
 class OROPage;
 
 /**
 */
 class KReportScriptDraw : public QObject
 {
     Q_OBJECT
 public:
-    explicit KReportScriptDraw(QObject *parent = 0);
+    explicit KReportScriptDraw(QObject *parent = nullptr);
 
-    ~KReportScriptDraw();
+    ~KReportScriptDraw() override;
     void setPage(OROPage*);
     void setOffset(QPointF);
 public Q_SLOTS:
     /**
     Draw a rectangle
     \param x X posistion
     \param y Y position
     \param w Width
     \param h Height
     \param lc Line Color
     \param fc Fill Color
     \param lw Line Width
     \param o Opacity (0=transparent, 100=opaque)
     */
     void rectangle(qreal, qreal, qreal, qreal, const QString&, const QString&, qreal, int);
 
     /**
     Draw an ellipse
     \param x X posistion
     \param y Y position
     \param w Width
     \param h Height
     \param lc Line Color
     \param fc Fill Color
     \param lw Line Width
     \param o Opacity (0=transparent, 100=opaque)
      */
     void ellipse(qreal, qreal, qreal, qreal, const QString&, const QString&, qreal, int);
 
     /**
     Draw a line
     \param x1 Start X position
     \param y1 Start Y Position
     \param x2 End X position
     \param y2 End Y position
     \param lc Line Color
     */
     void line(qreal, qreal, qreal, qreal, const QString&);
 
     /**
     Draw some text
     \param x X Position
     \param y Y Position
     \param txt The text
     \param fnt The font
     \param pt Point size
     \param fc Foreground color
     \param bc Background color
     \param lc Line color
     \param lw Line width
     \param o Opacity (0=transparent, 100=opaque)
     */
     void text(qreal, qreal, const QString &, const QString &fnt = QLatin1String("Helvetica"),
               int pt = 12, const QString &fc = QLatin1String("#000000"), const QString &bc = QLatin1String("#ffffff"),
               const QString &lc = QLatin1String("#ffffff"), qreal lw = 0, int o = 0);
 private:
     OROPage *m_curPage;
     QPointF m_curOffset;
 
 };
 
 #endif
diff --git a/src/renderer/scripting/KReportScriptHandler.cpp b/src/renderer/scripting/KReportScriptHandler.cpp
index 969328da..b7493fd7 100644
--- a/src/renderer/scripting/KReportScriptHandler.cpp
+++ b/src/renderer/scripting/KReportScriptHandler.cpp
@@ -1,202 +1,202 @@
 /* This file is part of the KDE project
  * Copyright (C) 2007-2008 by Adam Pigg 
  * Copyright (C) 2012 Jarosław Staniek 
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 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
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library.  If not, see .
  */
 
 #include "KReportScriptHandler.h"
 
 #include "KReportScriptSection.h"
 #include "KReportScriptDebug.h"
 #include "KReportScriptReport.h"
 #include "KReportScriptDraw.h"
 #include "KReportScriptConstants.h"
 #include "KReportSectionData.h"
 #include "KReportItemBase.h"
 #include "KReportDocument.h"
 #include "KReportDetailSectionData.h"
 #include "KReportRenderObjects.h"
 #include "kreport_debug.h"
 
 #include 
 #include 
 #include 
 
 class Q_DECL_HIDDEN KReportScriptHandler::Private
 {
 public:
     Private();
     ~Private();
     KReportScriptConstants *constants;
     KReportScriptDebug *debug;
     KReportScriptDraw *draw;
     Scripting::Report *report;
     const KReportDataSource *reportDataSource;
     QString source;
     KReportDocument  *reportDocument;
     QJSEngine engine;
     QJSValue scriptValue;
     QMap groups;
     QMap sectionMap;
 };
 
 KReportScriptHandler::Private::Private() : constants(new KReportScriptConstants), debug(new KReportScriptDebug), draw(new KReportScriptDraw)
 {
 }
 
 KReportScriptHandler::Private::~Private()
 {
 }
 
 KReportScriptHandler::KReportScriptHandler(const KReportDataSource* reportDataSource, KReportDocument* reportDocument) : d(new Private())
 {
     d->reportDocument = reportDocument;
     d->reportDataSource = reportDataSource;
 
     //Add a general report object
     d->report = new Scripting::Report(d->reportDocument);
     
     registerScriptObject(d->constants, QLatin1String("constants"));
     registerScriptObject(d->debug, QLatin1String("debug"));
     registerScriptObject(d->draw, QLatin1String("draw"));
 
     QJSValue r = registerScriptObject(d->report, d->reportDocument->name());
 
     //Add the sections
     QList secs = d->reportDocument->sections();
     foreach(KReportSectionData *sec, secs) {
         d->sectionMap[sec] = new Scripting::Section(sec);
         d->sectionMap[sec]->setParent(d->report);
         d->sectionMap[sec]->setObjectName(sec->name().replace(QLatin1Char('-'), QLatin1Char('_'))
                                          .remove(QLatin1String("report:")));
         QJSValue s = d->engine.newQObject(d->sectionMap[sec]);
         r.setProperty(d->sectionMap[sec]->objectName(), s);
         //kreportDebug() << "Added" << d->sectionMap[sec]->objectName() << "to report" << d->reportData->name();
     }
 
     //kreportDebug() << "Report name is" << d->reportData->name();
 }
 
 bool KReportScriptHandler::trigger()
 {
     QString code = d->reportDataSource->scriptCode(d->reportDocument->script());
     //kreportDebug() << code;
 
     if (code.isEmpty()) {
         return true;
     }
 
     d->scriptValue = d->engine.evaluate(code, d->reportDocument->script());
 
     if (d->scriptValue.isError()) {
         return false;
     }/*TODO else {
         kreportDebug() << "Function Names:" << d->engine->functionNames();
     }*/
     d->report->eventOnOpen();
     return true;
 }
 
 KReportScriptHandler::~KReportScriptHandler()
 {
     delete d;
 }
 
 void KReportScriptHandler::newPage()
 {
     if (d->report) {
         d->report->eventOnNewPage();
     }
 }
 
 void KReportScriptHandler::slotEnteredGroup(const QString &key, const QVariant &value)
 {
     //kreportDebug() << key << value;
     d->groups[key] = value;
     emit(groupChanged(d->groups));
 }
 void KReportScriptHandler::slotExitedGroup(const QString &key, const QVariant &value)
 {
     Q_UNUSED(value);
     //kreportDebug() << key << value;
     d->groups.remove(key);
     emit(groupChanged(d->groups));
 }
 
 void KReportScriptHandler::slotEnteredSection(KReportSectionData *section, OROPage* cp, QPointF off)
 {
     if (cp)
         d->draw->setPage(cp);
     d->draw->setOffset(off);
 
     Scripting::Section *ss = d->sectionMap[section];
     if (ss) {
         ss->eventOnRender();
     }
 }
 
 QVariant KReportScriptHandler::evaluate(const QString &code)
 {
     if (!d->scriptValue.isError()) {
         QJSValue result = d->engine.evaluate(code);
         if (!result.isError()) {
             return result.toVariant();
         } else {
-            QMessageBox::warning(0, tr("Script Error"), d->scriptValue.toString());
+            QMessageBox::warning(nullptr, tr("Script Error"), d->scriptValue.toString());
         }
     }
     return QVariant();
 }
 
 void KReportScriptHandler::displayErrors()
 {
     if (d->scriptValue.isError()) {
-        QMessageBox::warning(0, tr("Script Error"), d->scriptValue.toString());
+        QMessageBox::warning(nullptr, tr("Script Error"), d->scriptValue.toString());
     }
 }
 
 //! @todo KEXI3 move to kexi
 #if 0
 QString KReportScriptHandler::where()
 {
     QString w;
     QMap::const_iterator i = d->groups.constBegin();
     while (i != d->groups.constEnd()) {
         w += QLatin1Char('(') + i.key() + QLatin1String(" = '") + i.value().toString() + QLatin1String("') AND ");
         ++i;
     }
     w.chop(4);
     //kreportDebug() << w;
     return w;
 }
 #endif
 
 QJSValue KReportScriptHandler::registerScriptObject(QObject* obj, const QString& name)
 {
     QJSValue val;
     val = d->engine.newQObject(obj);
     d->engine.globalObject().setProperty(name, val);
     return val;
 }
 
 void KReportScriptHandler::setPageNumber(int p)
 {
     d->constants->setPageNumber(p);
 }
 
 void KReportScriptHandler::setPageTotal(int t)
 {
     d->constants->setPageTotal(t);
 }
diff --git a/src/renderer/scripting/KReportScriptHandler.h b/src/renderer/scripting/KReportScriptHandler.h
index 7e42dcb4..b33efe0f 100644
--- a/src/renderer/scripting/KReportScriptHandler.h
+++ b/src/renderer/scripting/KReportScriptHandler.h
@@ -1,77 +1,77 @@
 /* This file is part of the KDE project
  * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 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
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library.  If not, see .
  */
 
 #ifndef KRSCRIPTHANDLER_H
 #define KRSCRIPTHANDLER_H
 
 #include "kreport_export.h"
 #include "config-kreport.h"
 
 #ifdef KREPORT_SCRIPTING
 #include "KReportScriptConstants.h"
 #include "KReportDataSource.h"
 #include 
 
 class KReportScriptDebug;
 class KReportScriptDraw;
 class KReportSectionData;
 class QJSEngine;
 class KReportDocument;
 class OROPage;
 
 namespace Scripting
 {
 class Report;
 class Section;
 }
 
 class KREPORT_EXPORT KReportScriptHandler : public QObject
 {
     Q_OBJECT
 public:
     KReportScriptHandler(const KReportDataSource *reportDataSource, KReportDocument* reportDocument);
-    ~KReportScriptHandler();
+    ~KReportScriptHandler() override;
 
     QVariant evaluate(const QString&);
     void displayErrors();
     QJSValue registerScriptObject(QObject*, const QString&);
     bool trigger();
 
 public Q_SLOTS:
 
     void slotEnteredSection(KReportSectionData*, OROPage*, QPointF);
     void slotEnteredGroup(const QString&, const QVariant&);
     void slotExitedGroup(const QString&, const QVariant&);
     void setPageNumber(int p);
     void setPageTotal(int t);
     void newPage();
 
 Q_SIGNALS:
     void groupChanged(const QMap &groupData);
 
 private:
     //! @todo KEXI3 QString where();
     Q_DISABLE_COPY(KReportScriptHandler)
     class Private;
     Private * const d;
 };
 
 #else // !KREPORT_SCRIPTING
 #define KReportScriptHandler void
 #endif
 
 #endif
diff --git a/src/renderer/scripting/KReportScriptLine.h b/src/renderer/scripting/KReportScriptLine.h
index c34dc223..4cd2c62e 100644
--- a/src/renderer/scripting/KReportScriptLine.h
+++ b/src/renderer/scripting/KReportScriptLine.h
@@ -1,112 +1,112 @@
 /* This file is part of the KDE project
  * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 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
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library.  If not, see .
  */
 
 #ifndef SCRIPTINGKRSCRIPTLINE_H
 #define SCRIPTINGKRSCRIPTLINE_H
 
 #include 
 #include 
 #include 
 
 class KReportItemLine;
 
 namespace Scripting
 {
 
 /**
 @brief Line item script interface
 
 The user facing interface for scripting report line items
 */
 class Line : public QObject
 {
     Q_OBJECT
 public:
     explicit Line(KReportItemLine *);
 
-    ~Line();
+    ~Line() override;
 
 public Q_SLOTS:
     /**
      * Return the start position of the line
      * @return start position
      */
     QPointF startPosition();
 
     /**
      * Set the start position of the line
      * @param StartPosition
      */
     void setStartPosition(const QPointF&);
 
     /**
      * Return the end position of the line
      * @return end position
      */
     QPointF endPosition();
 
     /**
      * Set the end position of the line
      * @param EndPosition
      */
     void setEndPosition(const QPointF&);
 
     /**
      * Return the color of the line
      * @return line color
      */
     QColor lineColor();
 
     /**
      * Sets the line color
      * @param LineColor
      */
     void setLineColor(const QColor&);
 
     /**
      * Return the weight (width) of the line
      * @return Weight
      */
     int lineWeight();
 
     /**
      * Set the weight (width) of the line
      * @param Weight
      */
     void setLineWeight(int);
 
     /**
      * Return the line style.  Valid values are those from Qt::PenStyle (0-5)
      * @return Style
      */
     int lineStyle();
 
 
     /**
      * Set the style of the line
      * @param Style From Qt::PenStyle (0-5)
      */
     void setLineStyle(int);
 
 private:
     KReportItemLine *m_line;
 
 };
 
 }
 
 #endif
diff --git a/src/renderer/scripting/KReportScriptReport.cpp b/src/renderer/scripting/KReportScriptReport.cpp
index c1b4dc2e..6f92dfa1 100644
--- a/src/renderer/scripting/KReportScriptReport.cpp
+++ b/src/renderer/scripting/KReportScriptReport.cpp
@@ -1,118 +1,118 @@
 /* This file is part of the KDE project
  * Copyright (C) 2001-2007 by OpenMFG, LLC (info@openmfg.com)
  * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 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
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library.  If not, see .
  */
 #include "KReportScriptReport.h"
 #include "KReportDocument.h"
 #include "KReportItemBase.h"
 #include "KReportPluginManager.h"
 #include "KReportPluginInterface.h"
 #include "KReportScriptLine.h"
 #include "KReportScriptSection.h"
 #include "KReportItemLine.h"
 #include "kreport_debug.h"
 
 namespace Scripting
 {
 
 Report::Report(KReportDocument *r)
 {
     m_reportData = r;
     m_scriptObject = 0;
 }
 
 
 Report::~Report()
 {
 
 }
 
 QString Report::title() const
 {
     return m_reportData->title();
 }
 
 QString Report::name() const
 {
     return m_reportData->name();
 }
 
 QString Report::recordSource() const
 {
     return m_reportData->query();
 }
 
 QObject* Report::objectByName(const QString &n)
 {
     QListobs = m_reportData->objects();
     foreach(KReportItemBase *o, obs) {
         if (o->entityName() == n) {
 
             if (o->typeName() == QLatin1String("line")) {
                         return new Scripting::Line(dynamic_cast(o));
             }
             else {
                 KReportPluginManager* manager = KReportPluginManager::self();
                 KReportPluginInterface *plugin = manager->plugin(o->typeName());
                 if (plugin) {
                     QObject *obj = plugin->createScriptInstance(o);
                     if (obj) {
                         return obj;
                     }
                 }
                 else {
                     kreportWarning() << "Encountered unknown node while parsing section: " << o->typeName();
                 }
             }
         }
     }
-    return 0;
+    return nullptr;
 }
 
 QObject* Report::sectionByName(const QString &n)
 {
     KReportSectionData *sec = m_reportData->section(n);
     if (sec) {
         return new Scripting::Section(sec);
     } else {
         return new QObject();
     }
 }
 
 void Report::initialize(const QJSValue &val)
 {
     m_scriptObject = val;
 }
 
 void Report::eventOnOpen()
 {
     if (m_scriptObject.isObject() && m_scriptObject.hasProperty(QLatin1String("OnOpen")))
         m_scriptObject.property(QLatin1String("OnOpen")).call();
 }
 
 void Report::eventOnComplete()
 {
     if (m_scriptObject.isObject() && m_scriptObject.hasProperty(QLatin1String("OnComlete")))
         m_scriptObject.property(QLatin1String("OnComplete")).call();
 }
 
 void Report::eventOnNewPage()
 {
     if (m_scriptObject.isObject() && m_scriptObject.hasProperty(QLatin1String("OnNewPage")))
         m_scriptObject.property(QLatin1String("OnNewPage")).call();
 }
 
 }
diff --git a/src/renderer/scripting/KReportScriptReport.h b/src/renderer/scripting/KReportScriptReport.h
index c1a97846..ed3a5986 100644
--- a/src/renderer/scripting/KReportScriptReport.h
+++ b/src/renderer/scripting/KReportScriptReport.h
@@ -1,90 +1,90 @@
 /* This file is part of the KDE project
  * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 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
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library.  If not, see .
  */
 #ifndef SCRIPTINGKRSCRIPTREPORT_H
 #define SCRIPTINGKRSCRIPTREPORT_H
 
 #include 
 #include 
 
 class KReportDocument;
 
 namespace Scripting
 {
 
 
 /**
     @ *brief Report object user scripting API.
 
     Contains methods for a report object which can be called by user scripts. \n
 
     Example: \n
     \code
     function report()
     {
         this.OnOpen = function()
         {
             debug.print("Report opened!");
         }
     }
     reportname.initialize(new report())
     \endcode
 */
 class Report : public QObject
 {
     Q_OBJECT
 public:
     explicit Report(KReportDocument*);
 
-    ~Report();
+    ~Report() override;
 
 public Q_SLOTS:
     //! @return the title of the report as a string
     QString title() const;
 
     //! @return the name of the report as a string
     QString name() const;
 
     //! @return the record source (data source, table, query etc) as a string
     QString recordSource() const;
 
     //! @return an object in the report given its name, or NULL
     QObject* objectByName(const QString &);
 
     //! @return a section in the report given its name, or NULL
     QObject* sectionByName(const QString &);
 
 
     //! Assigns a user object to this report
     void initialize(const QJSValue &val);
 
     //! Executed when the report is opened.  If a handler exists for this in the user object it is called.
     void eventOnOpen();
 
     //! Executed when the report is complete.  If a handler exists for this in the user object it is called.
     void eventOnComplete();
 
     //! Executed when a new page is created.  If a handler exists for this in the user object it is called.
     void eventOnNewPage();
 
 private:
     KReportDocument *m_reportData;
     QJSValue m_scriptObject;
 };
 
 }
 
 #endif
diff --git a/src/renderer/scripting/KReportScriptSection.cpp b/src/renderer/scripting/KReportScriptSection.cpp
index 4ff302a1..05eac881 100644
--- a/src/renderer/scripting/KReportScriptSection.cpp
+++ b/src/renderer/scripting/KReportScriptSection.cpp
@@ -1,108 +1,108 @@
 /* This file is part of the KDE project
  * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 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
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library.  If not, see .
  */
 #include "KReportScriptSection.h"
 
 #include "KReportScriptLine.h"
 #include "KReportItemBase.h"
 #include "KReportPluginManager.h"
 #include "KReportPluginInterface.h"
 #include "KReportItemLine.h"
 #include "KReportSectionData.h"
 #include "kreport_debug.h"
 
 namespace Scripting
 {
 Section::Section(KReportSectionData* sec)
 {
     m_section = sec;
     m_scriptObject = 0;
 }
 
 
 Section::~Section()
 {
 }
 
 QColor Section::backgroundColor() const
 {
     return m_section->m_backgroundColor->value().value();
 }
 
 void   Section::setBackgroundColor(const QColor &c)
 {
     //kreportDebug() << c.name();
     m_section->m_backgroundColor->setValue(c);
 }
 
 qreal Section::height() const
 {
     return m_section->m_height->value().toDouble();
 }
 
 void Section::setHeight(qreal h)
 {
     m_section->m_height->setValue(h);
 }
 
 QString Section::name() const
 {
     return m_section->objectName();
 }
 
 QObject* Section::objectByNumber(int i)
 {
     if (m_section->m_objects[i]->typeName() == QLatin1String("line")) {
                 return new Scripting::Line(dynamic_cast(m_section->m_objects[i]));
     }
     else {
         KReportPluginManager* manager = KReportPluginManager::self();
         KReportPluginInterface *plugin = manager->plugin(m_section->m_objects[i]->typeName());
         if (plugin) {
             QObject *obj = plugin->createScriptInstance(m_section->m_objects[i]);
             if (obj) {
                 return obj;
             }
         }
         else {
             kreportWarning() << "Encountered unknown node while parsing section: " << m_section->m_objects[i]->typeName();
         }
     }
 
     return new QObject();
 }
 
 QObject* Section::objectByName(const QString& n)
 {
     for (int i = 0; i < m_section->objects().count(); ++i) {
         if (m_section->m_objects[i]->entityName() == n) {
             return objectByNumber(i);
         }
     }
-    return 0;
+    return nullptr;
 }
 
 void Section::initialize(const QJSValue &s)
 {
     m_scriptObject = s;
 }
 
 void Section::eventOnRender()
 {
     if (m_scriptObject.isObject() && m_scriptObject.hasProperty(QLatin1String("OnRender")))
         m_scriptObject.property(QLatin1String("OnRender")).call();
 }
 }
diff --git a/src/renderer/scripting/KReportScriptSection.h b/src/renderer/scripting/KReportScriptSection.h
index 4ad0d98e..2c2e4766 100644
--- a/src/renderer/scripting/KReportScriptSection.h
+++ b/src/renderer/scripting/KReportScriptSection.h
@@ -1,85 +1,85 @@
 /* This file is part of the KDE project
  * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 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
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library.  If not, see .
  */
 #ifndef KRSCRIPTSECTION_H
 #define KRSCRIPTSECTION_H
 
 #include 
 #include 
 
 class KReportSectionData;
 
 /**
  @ *brief Report section object user scripting API.
 
  Contains methods for a report section object which can be called by user scripts. \n
 
  Example: \n
  \code
  function detail()
  {
  this.OnRender = function()
  {
  debug.print("Rendering detail section!");
  }
  }
  reportname.section_detail.initialize(new detail())
  \endcode
 */
 namespace Scripting
 {
 class Section : public QObject
 {
     Q_OBJECT
 public:
     explicit Section(KReportSectionData*);
 
-    ~Section();
+    ~Section() override;
 
 public Q_SLOTS:
     //! @return the background color of the section
     QColor backgroundColor() const;
 
     //! Sets the background color of the section to the given color
     void setBackgroundColor(const QColor&);
 
     //! @return the section height as a real number, in points
     qreal height() const;
 
     //! Sets the section height to the given value in points
     void setHeight(qreal);
 
     //! @return the name of the section
     QString name() const;
 
     //! @return an object in the section, by number
     QObject* objectByNumber(int);
 
     //! @return an object in the section, by name
     QObject* objectByName(const QString&);
 
     //! Assigns a user object to this section
     void initialize(const QJSValue &s);
 
     //! Executed when the report is opened.  If a handler exists for this in the user object it is called.
     void eventOnRender();
 
 private:
     KReportSectionData *m_section;
     QJSValue m_scriptObject;
 };
 }
 #endif
diff --git a/src/wrtembed/KReportDesigner.cpp b/src/wrtembed/KReportDesigner.cpp
index f0cd08db..98a7016c 100644
--- a/src/wrtembed/KReportDesigner.cpp
+++ b/src/wrtembed/KReportDesigner.cpp
@@ -1,1523 +1,1523 @@
 /* This file is part of the KDE project
  * Copyright (C) 2001-2007 by OpenMFG, LLC 
  * Copyright (C) 2007-2010 by Adam Pigg 
  * Copyright (C) 2011-2017 Jarosław Staniek 
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 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
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library.  If not, see .
  */
 
 #include "KReportDesigner.h"
 #include "KReportDesignerSection.h"
 #include "KReportDesignerSectionScene.h"
 #include "KReportDesignerSectionView.h"
 #include "KReportDesignerSectionDetailGroup.h"
 #include "KReportPropertiesButton.h"
 #include "KReportSectionEditor.h"
 #include "KReportDesignerSectionDetail.h"
 #include "KReportDesignerItemLine.h"
 #include "KReportRuler_p.h"
 #include "KReportZoomHandler_p.h"
 #include "KReportPageSize.h"
 #include "KReportUtils_p.h"
 #include "KReportUtils.h"
 #include "KReportPluginInterface.h"
 #include "KReportPluginManager.h"
 #include "KReportSection.h"
 #include "KReportPluginMetaData.h"
 #include "kreport_debug.h"
 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 
 //! Also add public method for runtime?
 const char ns[] = "http://kexi-project.org/report/2.0";
 
 static QDomElement propertyToElement(QDomDocument* d, KProperty* p)
 {
     QDomElement e = d->createElement(QLatin1String("report:" + p->name().toLower()));
     e.appendChild(d->createTextNode(p->value().toString()));
     return e;
 }
 
 //
 // define and implement the ReportWriterSectionData class
 // a simple class to hold/hide data in the ReportHandler class
 //
 class ReportWriterSectionData
 {
 public:
     ReportWriterSectionData() {
         selected_x_offset = 0;
         selected_y_offset = 0;
         mouseAction = ReportWriterSectionData::MA_None;
     }
     virtual ~ReportWriterSectionData() {
     }
 
     enum MouseAction {
         MA_None = 0,
         MA_Insert = 1,
         MA_Grab = 2,
         MA_MoveStartPoint,
         MA_MoveEndPoint,
         MA_ResizeNW = 8,
         MA_ResizeN,
         MA_ResizeNE,
         MA_ResizeE,
         MA_ResizeSE,
         MA_ResizeS,
         MA_ResizeSW,
         MA_ResizeW
     };
 
     int selected_x_offset;
     int selected_y_offset;
 
     MouseAction mouseAction;
     QString itemToInsert;
 
     QList copy_list;
     QList cut_list;
 };
 
 //! @internal
 class Q_DECL_HIDDEN KReportDesigner::Private
 {
 public:
     Private(){}
 
     ~Private()
     {
         delete dataSource;
     }
 
     QGridLayout *grid;
     KReportRuler *hruler;
     KReportZoomHandler zoomHandler;
     QVBoxLayout *vboxlayout;
     KReportPropertiesButton *pageButton;
 
     QGraphicsScene *activeScene = nullptr;
 
     ReportWriterSectionData sectionData;
 
     KReportDesignerSection *reportHeader = nullptr;
     KReportDesignerSection *pageHeaderFirst = nullptr;
     KReportDesignerSection *pageHeaderOdd = nullptr;
     KReportDesignerSection *pageHeaderEven = nullptr;
     KReportDesignerSection *pageHeaderLast = nullptr;
     KReportDesignerSection *pageHeaderAny = nullptr;
 
     KReportDesignerSection *pageFooterFirst = nullptr;
     KReportDesignerSection *pageFooterOdd = nullptr;
     KReportDesignerSection *pageFooterEven = nullptr;
     KReportDesignerSection *pageFooterLast = nullptr;
     KReportDesignerSection *pageFooterAny = nullptr;
     KReportDesignerSection *reportFooter = nullptr;
     KReportDesignerSectionDetail *detail = nullptr;
 
     //Properties
     KPropertySet set;
     KPropertySet *itemSet;
     KProperty *title;
     KProperty *pageSize;
     KProperty *orientation;
     KProperty *unit;
     KProperty *customHeight;
     KProperty *customWidth;
     KProperty *leftMargin;
     KProperty *rightMargin;
     KProperty *topMargin;
     KProperty *bottomMargin;
     KProperty *showGrid;
     KProperty *gridDivisions;
     KProperty *gridSnap;
     KProperty *labelType;
 #ifdef KREPORT_SCRIPTING
     KProperty *script;
 #endif
 
     //Actions
     QAction *editCutAction;
     QAction *editCopyAction;
     QAction *editPasteAction;
     QAction *editDeleteAction;
     QAction *sectionEdit;
     QAction *parameterEdit;
     QAction *itemRaiseAction;
     QAction *itemLowerAction;
 
     qreal pressX = -1;
     qreal pressY = -1;
     qreal releaseX = -1;
     qreal releaseY = -1;
 
     bool modified = false; // true if this document has been modified, false otherwise
 
     QString originalInterpreter; //Value of the script interpreter at load time
     QString originalScript; //Value of the script at load time
 
     KReportDataSource *dataSource = nullptr;
 };
 
 KReportDesigner::KReportDesigner(QWidget * parent)
         : QWidget(parent), d(new Private())
 {
     KReportPluginManager::self(); // this loads icons early enough
 
     createProperties();
     createActions();
 
     d->grid = new QGridLayout(this);
     d->grid->setSpacing(0);
     d->grid->setMargin(0);
     d->grid->setColumnStretch(1, 1);
     d->grid->setRowStretch(1, 1);
     d->grid->setSizeConstraint(QLayout::SetFixedSize);
 
     d->vboxlayout = new QVBoxLayout();
     d->vboxlayout->setSpacing(0);
     d->vboxlayout->setMargin(0);
     d->vboxlayout->setSizeConstraint(QLayout::SetFixedSize);
 
     //Create nice rulers
     d->hruler = new KReportRuler(this, Qt::Horizontal, d->zoomHandler);
 
     d->pageButton = new KReportPropertiesButton(this);
 
     d->hruler->setUnit(KReportUnit(KReportUnit::Centimeter));
 
     d->grid->addWidget(d->pageButton, 0, 0);
     d->grid->addWidget(d->hruler, 0, 1);
     d->grid->addLayout(d->vboxlayout, 1, 0, 1, 2);
 
     d->pageButton->setMaximumSize(QSize(19, 22));
     d->pageButton->setMinimumSize(QSize(19, 22));
 
     d->detail = new KReportDesignerSectionDetail(this);
     d->vboxlayout->insertWidget(0, d->detail);
 
     setLayout(d->grid);
 
     connect(d->pageButton, SIGNAL(released()), this, SLOT(slotPageButton_Pressed()));
     emit pagePropertyChanged(d->set);
 
     connect(&d->set, SIGNAL(propertyChanged(KPropertySet&,KProperty&)),
             this, SLOT(slotPropertyChanged(KPropertySet&,KProperty&)));
 
     changeSet(&d->set);
 }
 
 KReportDesigner::~KReportDesigner()
 {
     delete d;
 }
 
 KReportDesigner::KReportDesigner(QWidget *parent, const QDomElement &data)
     : KReportDesigner(parent)
 {
     if (data.tagName() != QLatin1String("report:content")) {
         // arg we got an xml file but not one i know of
         kreportWarning() << "root element was not ";
     }
     //kreportDebug() << data.text();
     deleteDetail();
 
     QDomNodeList nlist = data.childNodes();
     QDomNode it;
 
     for (int i = 0; i < nlist.count(); ++i) {
         it = nlist.item(i);
         // at this level all the children we get should be Elements
         if (it.isElement()) {
             QString n = it.nodeName().toLower();
             //kreportDebug() << n;
             if (n == QLatin1String("report:title")) {
                 setReportTitle(it.firstChild().nodeValue());
 #ifdef KREPORT_SCRIPTING
             } else if (n == QLatin1String("report:script")) {
                 d->originalInterpreter = it.toElement().attribute(QLatin1String("report:script-interpreter"));
                 d->originalScript = it.firstChild().nodeValue();
                 d->script->setValue(d->originalScript);
 
                 if (d->originalInterpreter != QLatin1String("javascript") && d->originalInterpreter != QLatin1String("qtscript")) {
                     QString msg = tr("This report contains scripts of type \"%1\". "
                                      "Only scripts written in JavaScript language are "
                                      "supported. To prevent losing the scripts, their type "
                                      "and content will not be changed unless you change these scripts."
                                      ).arg(d->originalInterpreter);
                     QMessageBox::warning(this, tr("Unsupported Script Type"), msg);
                 }
 #endif
             } else if (n == QLatin1String("report:grid")) {
                 d->showGrid->setValue(it.toElement().attribute(QLatin1String("report:grid-visible"), QString::number(1)).toInt() != 0);
                 d->gridSnap->setValue(it.toElement().attribute(QLatin1String("report:grid-snap"), QString::number(1)).toInt() != 0);
                 d->gridDivisions->setValue(it.toElement().attribute(QLatin1String("report:grid-divisions"), QString::number(4)).toInt());
                 d->unit->setValue(it.toElement().attribute(QLatin1String("report:page-unit"), QLatin1String("cm")));
             }
 
             //! @todo Load page options
             else if (n == QLatin1String("report:page-style")) {
                 QString pagetype = it.firstChild().nodeValue();
 
                 if (pagetype == QLatin1String("predefined")) {
                     d->pageSize->setValue(it.toElement().attribute(QLatin1String("report:page-size"), QLatin1String("A4")));
                 } else if (pagetype == QLatin1String("custom")) {
                     d->pageSize->setValue(QLatin1String("custom"));
                     d->customHeight->setValue(KReportUnit::parseValue(it.toElement().attribute(QLatin1String("report:custom-page-height"), QLatin1String(""))));
                     d->customWidth->setValue(KReportUnit::parseValue(it.toElement().attribute(QLatin1String("report:custom-page-widtht"), QLatin1String(""))));
                 } else if (pagetype == QLatin1String("label")) {
                     //! @todo
                 }
 
                 d->rightMargin->setValue(KReportUnit::parseValue(it.toElement().attribute(QLatin1String("fo:margin-right"), QLatin1String("1.0cm"))));
                 d->leftMargin->setValue(KReportUnit::parseValue(it.toElement().attribute(QLatin1String("fo:margin-left"), QLatin1String("1.0cm"))));
                 d->topMargin->setValue(KReportUnit::parseValue(it.toElement().attribute(QLatin1String("fo:margin-top"), QLatin1String("1.0cm"))));
                 d->bottomMargin->setValue(KReportUnit::parseValue(it.toElement().attribute(QLatin1String("fo:margin-bottom"), QLatin1String("1.0cm"))));
 
                 d->orientation->setValue(it.toElement().attribute(QLatin1String("report:print-orientation"), QLatin1String("portrait")));
 
             } else if (n == QLatin1String("report:body")) {
                 QDomNodeList sectionlist = it.childNodes();
                 QDomNode sec;
 
                 for (int s = 0; s < sectionlist.count(); ++s) {
                     sec = sectionlist.item(s);
                     if (sec.isElement()) {
                         QString sn = sec.nodeName().toLower();
                         //kreportDebug() << sn;
                         if (sn == QLatin1String("report:section")) {
                             QString sectiontype = sec.toElement().attribute(QLatin1String("report:section-type"));
-                            if (section(KReportSectionData::sectionTypeFromString(sectiontype)) == 0) {
+                            if (section(KReportSectionData::sectionTypeFromString(sectiontype)) == nullptr) {
                                 insertSection(KReportSectionData::sectionTypeFromString(sectiontype));
                                 section(KReportSectionData::sectionTypeFromString(sectiontype))->initFromXML(sec);
                             }
                         } else if (sn == QLatin1String("report:detail")) {
                             KReportDesignerSectionDetail * rsd = new KReportDesignerSectionDetail(this);
                             rsd->initFromXML(&sec);
                             setDetail(rsd);
                         }
                     } else {
                         kreportWarning() << "Encountered an unknown Element: "  << n;
                     }
                 }
             }
         } else {
             kreportWarning() << "Encountered a child node of root that is not an Element";
         }
     }
     this->slotPageButton_Pressed();
     emit reportDataChanged();
     slotPropertyChanged(d->set, *d->unit); // set unit for all items
     setModified(false);
 }
 
 ///The saving code
 QDomElement KReportDesigner::document() const
 {
     QDomDocument doc;
     QString saveInterpreter;
 
     QDomElement content = doc.createElement(QLatin1String("report:content"));
     content.setAttribute(QLatin1String("xmlns:report"), QLatin1String(ns));
     content.setAttribute(QLatin1String("xmlns:fo"), QLatin1String("urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"));
     content.setAttribute(QLatin1String("xmlns:svg"), QLatin1String("urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"));
 
     doc.appendChild(content);
 
     //title
     content.appendChild(propertyToElement(&doc, d->title));
 
 #ifdef KREPORT_SCRIPTING
     if (!d->script->value().toString().isEmpty()) {
         if (d->script->value().toString() != d->originalScript || d->originalInterpreter == QLatin1String("qtscript")) {
             //The script has changed so force interpreter to 'javascript'.  Also set if was using qtscript
             saveInterpreter = QLatin1String("javascript");
         } else {
             saveInterpreter = d->originalInterpreter;
         }
 
         QDomElement scr = propertyToElement(&doc, d->script);
         scr.setAttribute(QLatin1String("report:script-interpreter"), saveInterpreter);
         content.appendChild(scr);
     }
 #endif
 
     QDomElement grd = doc.createElement(QLatin1String("report:grid"));
     KReportUtils::addPropertyAsAttribute(&grd, d->showGrid);
     KReportUtils::addPropertyAsAttribute(&grd, d->gridDivisions);
     KReportUtils::addPropertyAsAttribute(&grd, d->gridSnap);
     KReportUtils::addPropertyAsAttribute(&grd, d->unit);
     content.appendChild(grd);
 
     // pageOptions
     // -- size
     QDomElement pagestyle = doc.createElement(QLatin1String("report:page-style"));
 
     if (d->pageSize->value().toString() == QLatin1String("Custom")) {
         pagestyle.appendChild(doc.createTextNode(QLatin1String("custom")));
         KReportUtils::setAttribute(&pagestyle, QLatin1String("report:custom-page-width"), d->customWidth->value().toDouble());
         KReportUtils::setAttribute(&pagestyle, QLatin1String("report:custom-page-height"), d->customHeight->value().toDouble());
 
     } else if (d->pageSize->value().toString() == QLatin1String("Label")) {
         pagestyle.appendChild(doc.createTextNode(QLatin1String("label")));
         pagestyle.setAttribute(QLatin1String("report:page-label-type"), d->labelType->value().toString());
     } else {
         pagestyle.appendChild(doc.createTextNode(QLatin1String("predefined")));
         KReportUtils::addPropertyAsAttribute(&pagestyle, d->pageSize);
         //pagestyle.setAttribute("report:page-size", d->pageSize->value().toString());
     }
 
     // -- orientation
     KReportUtils::addPropertyAsAttribute(&pagestyle, d->orientation);
 
     // -- margins: save as points, and not localized
     KReportUtils::setAttribute(&pagestyle, QLatin1String("fo:margin-top"), d->topMargin->value().toDouble());
     KReportUtils::setAttribute(&pagestyle, QLatin1String("fo:margin-bottom"), d->bottomMargin->value().toDouble());
     KReportUtils::setAttribute(&pagestyle, QLatin1String("fo:margin-right"), d->rightMargin->value().toDouble());
     KReportUtils::setAttribute(&pagestyle, QLatin1String("fo:margin-left"), d->leftMargin->value().toDouble());
 
     content.appendChild(pagestyle);
 
     QDomElement body = doc.createElement(QLatin1String("report:body"));
     QDomElement domsection;
 
     for (int i = KReportSectionData::PageHeaderFirst; i <= KReportSectionData::PageFooterAny; ++i) {
         KReportDesignerSection *sec = section((KReportSectionData::Section)i);
         if (sec) {
             domsection = doc.createElement(QLatin1String("report:section"));
             domsection.setAttribute(QLatin1String("report:section-type"), KReportSectionData::sectionTypeString(KReportSectionData::Section(i)));
             sec->buildXML(&doc, &domsection);
             body.appendChild(domsection);
         }
     }
 
     QDomElement detail = doc.createElement(QLatin1String("report:detail"));
     d->detail->buildXML(&doc, &detail);
     body.appendChild(detail);
 
     content.appendChild(body);
     return content;
 }
 
 void KReportDesigner::slotSectionEditor()
 {
     KReportSectionEditor se(this);
     (void)se.exec();
 }
 
 void KReportDesigner::setDataSource(KReportDataSource* source)
 {
     if (d->dataSource == source) {
         return;
     }
     delete d->dataSource;
 
     d->dataSource = source;
     slotPageButton_Pressed();
     setModified(true);
     emit reportDataChanged();
 }
 
 KReportDesignerSection * KReportDesigner::section(KReportSectionData::Section s) const
 {
     KReportDesignerSection *sec;
     switch (s) {
     case KReportSectionData::PageHeaderAny:
         sec = d->pageHeaderAny;
         break;
     case KReportSectionData::PageHeaderEven:
         sec = d->pageHeaderEven;
         break;
     case KReportSectionData::PageHeaderOdd:
         sec = d->pageHeaderOdd;
         break;
     case KReportSectionData::PageHeaderFirst:
         sec = d->pageHeaderFirst;
         break;
     case KReportSectionData::PageHeaderLast:
         sec = d->pageHeaderLast;
         break;
     case KReportSectionData::PageFooterAny:
         sec = d->pageFooterAny;
         break;
     case KReportSectionData::PageFooterEven:
         sec = d->pageFooterEven;
         break;
     case KReportSectionData::PageFooterOdd:
         sec = d->pageFooterOdd;
         break;
     case KReportSectionData::PageFooterFirst:
         sec = d->pageFooterFirst;
         break;
     case KReportSectionData::PageFooterLast:
         sec = d->pageFooterLast;
         break;
     case KReportSectionData::ReportHeader:
         sec = d->reportHeader;
         break;
     case KReportSectionData::ReportFooter:
         sec = d->reportFooter;
         break;
     default:
-        sec = 0;
+        sec = nullptr;
     }
     return sec;
 }
 
 KReportDesignerSection* KReportDesigner::createSection()
 {
     return new KReportDesignerSection(this, d->zoomHandler);
 }
 
 void KReportDesigner::removeSection(KReportSectionData::Section s)
 {
     KReportDesignerSection* sec = section(s);
     if (sec) {
         delete sec;
 
         switch (s) {
         case KReportSectionData::PageHeaderAny:
-            d->pageHeaderAny = 0;
+            d->pageHeaderAny = nullptr;
             break;
         case KReportSectionData::PageHeaderEven:
-            sec = d->pageHeaderEven = 0;
+            sec = d->pageHeaderEven = nullptr;
             break;
         case KReportSectionData::PageHeaderOdd:
-            d->pageHeaderOdd = 0;
+            d->pageHeaderOdd = nullptr;
             break;
         case KReportSectionData::PageHeaderFirst:
-            d->pageHeaderFirst = 0;
+            d->pageHeaderFirst = nullptr;
             break;
         case KReportSectionData::PageHeaderLast:
-            d->pageHeaderLast = 0;
+            d->pageHeaderLast = nullptr;
             break;
         case KReportSectionData::PageFooterAny:
-            d->pageFooterAny = 0;
+            d->pageFooterAny = nullptr;
             break;
         case KReportSectionData::PageFooterEven:
-            d->pageFooterEven = 0;
+            d->pageFooterEven = nullptr;
             break;
         case KReportSectionData::PageFooterOdd:
-            d->pageFooterOdd = 0;
+            d->pageFooterOdd = nullptr;
             break;
         case KReportSectionData::PageFooterFirst:
-            d->pageFooterFirst = 0;
+            d->pageFooterFirst = nullptr;
             break;
         case KReportSectionData::PageFooterLast:
-            d->pageFooterLast = 0;
+            d->pageFooterLast = nullptr;
             break;
         case KReportSectionData::ReportHeader:
-            d->reportHeader = 0;
+            d->reportHeader = nullptr;
             break;
         case KReportSectionData::ReportFooter:
-            d->reportFooter = 0;
+            d->reportFooter = nullptr;
             break;
         default:
-            sec = 0;
+            sec = nullptr;
         }
 
         setModified(true);
         adjustSize();
     }
 }
 
 void KReportDesigner::insertSection(KReportSectionData::Section s)
 {
     KReportDesignerSection* sec = section(s);
     if (!sec) {
         int idx = 0;
         for (int i = 1; i <= s; ++i) {
             if (section((KReportSectionData::Section)i))
                 idx++;
         }
         if (s > KReportSectionData::ReportHeader)
             idx++;
         //kreportDebug() << idx;
         KReportDesignerSection *rs = createSection();
         d->vboxlayout->insertWidget(idx, rs);
 
         switch (s) {
         case KReportSectionData::PageHeaderAny:
             rs->setTitle(tr("Page Header (Any)"));
             d->pageHeaderAny = rs;
             break;
         case KReportSectionData::PageHeaderEven:
             rs->setTitle(tr("Page Header (Even)"));
             d->pageHeaderEven = rs;
             break;
         case KReportSectionData::PageHeaderOdd:
             rs->setTitle(tr("Page Header (Odd)"));
             d->pageHeaderOdd = rs;
             break;
         case KReportSectionData::PageHeaderFirst:
             rs->setTitle(tr("Page Header (First)"));
             d->pageHeaderFirst = rs;
             break;
         case KReportSectionData::PageHeaderLast:
             rs->setTitle(tr("Page Header (Last)"));
             d->pageHeaderLast = rs;
             break;
         case KReportSectionData::PageFooterAny:
             rs->setTitle(tr("Page Footer (Any)"));
             d->pageFooterAny = rs;
             break;
         case KReportSectionData::PageFooterEven:
             rs->setTitle(tr("Page Footer (Even)"));
             d->pageFooterEven = rs;
             break;
         case KReportSectionData::PageFooterOdd:
             rs->setTitle(tr("Page Footer (Odd)"));
             d->pageFooterOdd = rs;
             break;
         case KReportSectionData::PageFooterFirst:
             rs->setTitle(tr("Page Footer (First)"));
             d->pageFooterFirst = rs;
             break;
         case KReportSectionData::PageFooterLast:
             rs->setTitle(tr("Page Footer (Last)"));
             d->pageFooterLast = rs;
             break;
         case KReportSectionData::ReportHeader:
             rs->setTitle(tr("Report Header"));
             d->reportHeader = rs;
             break;
         case KReportSectionData::ReportFooter:
             rs->setTitle(tr("Report Footer"));
             d->reportFooter = rs;
             break;
             //These sections cannot be inserted this way
         case KReportSectionData::None:
         case KReportSectionData::GroupHeader:
         case KReportSectionData::GroupFooter:
         case KReportSectionData::Detail:
             break;
         }
 
         rs->show();
         setModified(true);
         adjustSize();
         emit pagePropertyChanged(d->set);
     }
 }
 
 void KReportDesigner::setReportTitle(const QString & str)
 {
     if (reportTitle() != str) {
         d->title->setValue(str);
         setModified(true);
     }
 }
 
 KPropertySet* KReportDesigner::propertySet() const
 {
     return &d->set;
 }
 
 KPropertySet* KReportDesigner::selectedItemPropertySet() const
 {
     return d->itemSet;
 }
 
 KReportDataSource *KReportDesigner::reportDataSource() const
 {
     return d->dataSource;
 }
 
 KReportDesignerSectionDetail * KReportDesigner::detailSection() const
 {
     return d->detail;
 }
 
 QString KReportDesigner::reportTitle() const
 {
     return d->title->value().toString();
 }
 
 bool KReportDesigner::isModified() const
 {
     return d->modified;
 }
 
 void KReportDesigner::setModified(bool modified)
 {
     d->modified = modified;
 
     if (d->modified) {
         emit dirty();
     }
 }
 
 QStringList KReportDesigner::fieldNames() const
 {
     QStringList qs;
     qs << QString();
     if (d->dataSource)
         qs << d->dataSource->fieldNames();
 
     return qs;
 }
 
 QStringList KReportDesigner::fieldKeys() const
 {
     QStringList qs;
     qs << QString();
     if (d->dataSource)
         qs << d->dataSource->fieldKeys();
 
     return qs;
 }
 
 void KReportDesigner::createProperties()
 {
     QStringList keys, strings;
     KReportDesigner::addMetaProperties(&d->set,
         tr("Report", "Main report element"), QLatin1String("kreport-report-element"));
 
     connect(&d->set, SIGNAL(propertyChanged(KPropertySet&,KProperty&)),
             this, SLOT(slotPropertyChanged(KPropertySet&,KProperty&)));
 
     d->title = new KProperty("title", QLatin1String("Report"), tr("Title"), tr("Report Title"));
 
     keys.clear();
     keys =  KReportPageSize::pageFormatKeys();
     strings = KReportPageSize::pageFormatNames();
     QString defaultKey = KReportPageSize::pageSizeKey(KReportPageSize::defaultSize());
     d->pageSize = new KProperty("page-size", keys, strings, defaultKey, tr("Page Size"));
 
     keys.clear(); strings.clear();
     keys << QLatin1String("portrait") << QLatin1String("landscape");
     strings << tr("Portrait") << tr("Landscape");
     d->orientation = new KProperty("print-orientation", keys, strings, QLatin1String("portrait"), tr("Page Orientation"));
 
     keys.clear(); strings.clear();
 
     strings = KReportUnit::listOfUnitNameForUi(KReportUnit::HidePixel);
     QString unit;
     foreach(const QString &un, strings) {
         unit = un.mid(un.indexOf(QLatin1String("(")) + 1, 2);
         keys << unit;
     }
 
     d->unit = new KProperty("page-unit", keys, strings, QLatin1String("cm"), tr("Page Unit"));
 
     d->showGrid = new KProperty("grid-visible", true, tr("Show Grid"));
     d->gridSnap = new KProperty("grid-snap", true, tr("Snap to Grid"));
     d->gridDivisions = new KProperty("grid-divisions", 4, tr("Grid Divisions"));
 
     d->leftMargin = new KProperty("margin-left", KReportUnit(KReportUnit::Centimeter).fromUserValue(1.0),
         tr("Left Margin"), tr("Left Margin"), KProperty::Double);
     d->rightMargin = new KProperty("margin-right", KReportUnit(KReportUnit::Centimeter).fromUserValue(1.0),
         tr("Right Margin"), tr("Right Margin"), KProperty::Double);
     d->topMargin = new KProperty("margin-top", KReportUnit(KReportUnit::Centimeter).fromUserValue(1.0),
         tr("Top Margin"), tr("Top Margin"), KProperty::Double);
     d->bottomMargin = new KProperty("margin-bottom", KReportUnit(KReportUnit::Centimeter).fromUserValue(1.0),
         tr("Bottom Margin"), tr("Bottom Margin"), KProperty::Double);
     d->leftMargin->setOption("unit", QLatin1String("cm"));
     d->rightMargin->setOption("unit", QLatin1String("cm"));
     d->topMargin->setOption("unit", QLatin1String("cm"));
     d->bottomMargin->setOption("unit", QLatin1String("cm"));
 
     d->set.addProperty(d->title);
     d->set.addProperty(d->pageSize);
     d->set.addProperty(d->orientation);
     d->set.addProperty(d->unit);
     d->set.addProperty(d->gridSnap);
     d->set.addProperty(d->showGrid);
     d->set.addProperty(d->gridDivisions);
     d->set.addProperty(d->leftMargin);
     d->set.addProperty(d->rightMargin);
     d->set.addProperty(d->topMargin);
     d->set.addProperty(d->bottomMargin);
 
 #ifdef KREPORT_SCRIPTING
     d->script = new KProperty("script", QStringList(), QStringList(), QString(), tr("Object Script"));
     d->set.addProperty(d->script);
 #endif
 
 //    KProperty* _customHeight;
 //    KProperty* _customWidth;
 
 }
 
 /**
 @brief Handle property changes
 */
 void KReportDesigner::slotPropertyChanged(KPropertySet &s, KProperty &p)
 {
     setModified(true);
     emit pagePropertyChanged(s);
 
     if (p.name() == "page-unit") {
         d->hruler->setUnit(pageUnit());
         QString newstr = d->set.property("page-unit").value().toString();
 
         d->set.property("margin-left").setOption("unit", newstr);
         d->set.property("margin-right").setOption("unit", newstr);
         d->set.property("margin-top").setOption("unit", newstr);
         d->set.property("margin-bottom").setOption("unit", newstr);
     }
 }
 
 void KReportDesigner::slotPageButton_Pressed()
 {
 #ifdef KREPORT_SCRIPTING
     if (d->dataSource) {
         QStringList sl = d->dataSource->scriptList();
         sl.prepend(QLatin1String(""));
         d->script->setListData(sl, sl);
     }
     changeSet(&d->set);
 #endif
 }
 
 QSize KReportDesigner::sizeHint() const
 {
     int w = 0;
     int h = 0;
 
     if (d->pageFooterAny)
         h += d->pageFooterAny->sizeHint().height();
     if (d->pageFooterEven)
         h += d->pageFooterEven->sizeHint().height();
     if (d->pageFooterFirst)
         h += d->pageFooterFirst->sizeHint().height();
     if (d->pageFooterLast)
         h += d->pageFooterLast->sizeHint().height();
     if (d->pageFooterOdd)
         h += d->pageFooterOdd->sizeHint().height();
     if (d->pageHeaderAny)
         h += d->pageHeaderAny->sizeHint().height();
     if (d->pageHeaderEven)
         h += d->pageHeaderEven->sizeHint().height();
     if (d->pageHeaderFirst)
         h += d->pageHeaderFirst->sizeHint().height();
     if (d->pageHeaderLast)
         h += d->pageHeaderLast->sizeHint().height();
     if (d->pageHeaderOdd)
         h += d->pageHeaderOdd->sizeHint().height();
     if (d->reportHeader)
         h += d->reportHeader->sizeHint().height();
     if (d->reportFooter) {
         h += d->reportFooter->sizeHint().height();
 
     }
     if (d->detail) {
         h += d->detail->sizeHint().height();
         w += d->detail->sizeHint().width();
     }
 
     h += d->hruler->height();
 
     return QSize(w, h);
 }
 
 int KReportDesigner::pageWidthPx() const
 {
     QPageLayout layout = QPageLayout(
         QPageSize(KReportPageSize::pageSize(d->set.property("page-size").value().toString())),
         d->set.property("print-orientation").value().toString()
                 == QLatin1String("portrait") ? QPageLayout::Portrait : QPageLayout::Landscape, QMarginsF(0,0,0,0));
 
     QSize pageSizePx = layout.fullRectPixels(KReportPrivate::dpiX()).size();
 
     int width = pageSizePx.width();
     width = width - POINT_TO_INCH(d->set.property("margin-left").value().toDouble()) * KReportPrivate::dpiX();
     width = width - POINT_TO_INCH(d->set.property("margin-right").value().toDouble()) * KReportPrivate::dpiX();
 
     return width;
 }
 
 void KReportDesigner::resizeEvent(QResizeEvent * event)
 {
     Q_UNUSED(event);
     d->hruler->setRulerLength(pageWidthPx());
 }
 
 void KReportDesigner::setDetail(KReportDesignerSectionDetail *rsd)
 {
     if (!d->detail) {
         int idx = 0;
         if (d->pageHeaderFirst) idx++;
         if (d->pageHeaderOdd) idx++;
         if (d->pageHeaderEven) idx++;
         if (d->pageHeaderLast) idx++;
         if (d->pageHeaderAny) idx++;
         if (d->reportHeader) idx++;
         d->detail = rsd;
         d->vboxlayout->insertWidget(idx, d->detail);
     }
 }
 void KReportDesigner::deleteDetail()
 {
     delete d->detail;
-    d->detail = 0;
+    d->detail = nullptr;
 }
 
 KReportUnit KReportDesigner::pageUnit() const
 {
     QString u;
     bool found;
 
     u = d->unit->value().toString();
 
     KReportUnit unit = KReportUnit::fromSymbol(u, &found);
     if (!found) {
         unit = KReportUnit(KReportUnit::Centimeter);
     }
 
     return unit;
 }
 
 void KReportDesigner::setGridOptions(bool vis, int div)
 {
     d->showGrid->setValue(QVariant(vis));
     d->gridDivisions->setValue(div);
 }
 
 //
 // methods for the sectionMouse*Event()
 //
 void KReportDesigner::sectionContextMenuEvent(KReportDesignerSectionScene * s, QGraphicsSceneContextMenuEvent * e)
 {
     Q_UNUSED(s);
 
     QMenu pop;
 
     bool itemsSelected = selectionCount() > 0;
     if (itemsSelected) {
         //! @todo KF5 use KStandardAction
         QAction *a = new QAction(QIcon::fromTheme(QLatin1String("edit-cut")), tr("Cut"), this);
         connect(a, SIGNAL(triggered()), this, SLOT(slotEditCut()));
         pop.addAction(a);
         //! @todo KF5 use KStandardAction
         a = new QAction(QIcon::fromTheme(QLatin1String("edit-copy")), tr("Copy"), this);
         connect(a, SIGNAL(triggered()), this, SLOT(slotEditCopy()));
         pop.addAction(a);
     }
     if (!d->sectionData.copy_list.isEmpty()) {
         QAction *a = new QAction(QIcon::fromTheme(QLatin1String("edit-paste")), tr("Paste"), this);
         connect(a, SIGNAL(triggered()), this, SLOT(slotEditPaste()));
         pop.addAction(a);
     }
 
     if (itemsSelected) {
         pop.addSeparator();
         //! @todo KF5 use KStandard*
         //const KGuiItem del = KStandardGuiItem::del();
         //a->setToolTip(del.toolTip());
         //a->setShortcut(QKeySequence(QKeySequence::Delete));
         QAction *a = new QAction(QIcon::fromTheme(QLatin1String("edit-delete")), tr("Delete"), this);
         connect(a, SIGNAL(triggered()), SLOT(slotEditDelete()));
         pop.addAction(a);
     }
     if (!pop.actions().isEmpty()) {
         pop.exec(e->screenPos());
     }
 }
 
 void KReportDesigner::sectionMousePressEvent(KReportDesignerSectionView * v, QMouseEvent * e)
 {
     Q_UNUSED(v);
     d->pressX = e->pos().x();
     d->pressY = e->pos().y();
 }
 
 void KReportDesigner::sectionMouseReleaseEvent(KReportDesignerSectionView * v, QMouseEvent * e)
 {
     e->accept();
 
     d->releaseX = e->pos().x();
     d->releaseY = e->pos().y();
 
     if (e->button() == Qt::LeftButton) {
         QPointF pos(d->pressX, d->pressY);
         QPointF end(d->releaseX, d->releaseY);
         if (d->releaseY >= v->scene()->height()) {
             d->releaseY = v->scene()->height();
             end.setY(v->scene()->height());
         }
 
         if (d->releaseX >= v->scene()->width()) {
             d->releaseX = v->scene()->width();
             end.setX(v->scene()->width());
         }
 
         if (d->sectionData.mouseAction == ReportWriterSectionData::MA_Insert) {
-            QGraphicsItem * item = 0;
+            QGraphicsItem * item = nullptr;
             QString classString;
             QString iconName;
             if (d->sectionData.itemToInsert == QLatin1String("org.kde.kreport.line")) {
                 item = new KReportDesignerItemLine(v->designer(), v->scene(), pos, end);
                 classString = tr("Line", "Report line element");
                 iconName = QLatin1String("kreport-line-element");
             }
             else {
                 KReportPluginManager* pluginManager = KReportPluginManager::self();
                 KReportPluginInterface *plug = pluginManager->plugin(d->sectionData.itemToInsert);
                 if (plug) {
                     QObject *obj = plug->createDesignerInstance(v->designer(), v->scene(), pos);
                     if (obj) {
                         item = dynamic_cast(obj);
                         classString = plug->metaData()->name();
                         iconName = plug->metaData()->iconName();
                     }
                 }
                 else {
                     kreportWarning() << "attempted to insert an unknown item";
                 }
             }
             if (item) {
                 item->setVisible(true);
                 item->setSelected(true);
                 KReportItemBase* baseReportItem = dynamic_cast(item);
                 if (baseReportItem) {
                     baseReportItem->setUnit(pageUnit());
                     KPropertySet *set = baseReportItem->propertySet();
                     KReportDesigner::addMetaProperties(set, classString, iconName);
                     changeSet(set);
                     if (v && v->designer()) {
                         v->designer()->setModified(true);
                     }
                     emit itemInserted(d->sectionData.itemToInsert);
                 }
             }
 
             d->sectionData.mouseAction = ReportWriterSectionData::MA_None;
             d->sectionData.itemToInsert.clear();
             unsetSectionCursor();
         }
     }
 }
 
 unsigned int KReportDesigner::selectionCount() const
 {
     if (activeScene())
         return activeScene()->selectedItems().count();
     else
         return 0;
 }
 
 void KReportDesigner::changeSet(KPropertySet *s)
 {
     //Set the checked state of the report properties button
     if (s == &d->set)
         d->pageButton->setCheckState(Qt::Checked);
     else
         d->pageButton->setCheckState(Qt::Unchecked);
 
     d->itemSet = s;
     emit propertySetChanged();
 }
 
 //
 // Actions
 //
 
 void KReportDesigner::slotItem(const QString &entity)
 {
     //kreportDebug() << entity;
     d->sectionData.mouseAction = ReportWriterSectionData::MA_Insert;
     d->sectionData.itemToInsert = entity;
     setSectionCursor(QCursor(Qt::CrossCursor));
 }
 
 void KReportDesigner::slotEditDelete()
 {
-    QGraphicsItem * item = 0;
+    QGraphicsItem * item = nullptr;
     bool modified = false;
     while (selectionCount() > 0) {
         item = activeScene()->selectedItems().value(0);
         if (item) {
             QGraphicsScene * scene = item->scene();
             delete item;
             scene->update();
             d->sectionData.mouseAction = ReportWriterSectionData::MA_None;
             modified = true;
         }
     }
     activeScene()->selectedItems().clear();
 
     /*! @todo temporary: clears cut and copy lists to make sure we do not crash
      if weve deleted something in the list
      should really check if an item is in the list first
      and remove it. */
     d->sectionData.cut_list.clear();
     d->sectionData.copy_list.clear();
     if (modified) {
         setModified(true);
     }
 }
 
 void KReportDesigner::slotEditCut()
 {
     if (selectionCount() > 0) {
         //First delete any items that are curerntly in the list
         //so as not to leak memory
         qDeleteAll(d->sectionData.cut_list);
         d->sectionData.cut_list.clear();
 
         QGraphicsItem * item = activeScene()->selectedItems().first();
         bool modified = false;
         if (item) {
             d->sectionData.copy_list.clear();
             foreach(QGraphicsItem *item, activeScene()->selectedItems()) {
                 d->sectionData.cut_list.append(dynamic_cast(item));
                 d->sectionData.copy_list.append(dynamic_cast(item));
             }
             foreach(QGraphicsItem *item, activeScene()->selectedItems()) {
                 activeScene()->removeItem(item);
                 activeScene()->update();
                 modified = true;
             }
             d->sectionData.selected_x_offset = 10;
             d->sectionData.selected_y_offset = 10;
         }
         if (modified) {
             setModified(true);
         }
     }
 }
 
 void KReportDesigner::slotEditCopy()
 {
     if (selectionCount() < 1)
         return;
 
     QGraphicsItem * item = activeScene()->selectedItems().first();
     if (item) {
         d->sectionData.copy_list.clear();
         foreach(QGraphicsItem *item, activeScene()->selectedItems()) {
             d->sectionData.copy_list.append(dynamic_cast(item));
         }
         d->sectionData.selected_x_offset = 10;
         d->sectionData.selected_y_offset = 10;
     }
 }
 
 void KReportDesigner::slotEditPaste()
 {
     // call the editPaste function passing it a reportsection
     slotEditPaste(activeScene());
 }
 
 void KReportDesigner::slotEditPaste(QGraphicsScene * canvas)
 {
 
     // paste a new item of the copy we have in the specified location
     if (!d->sectionData.copy_list.isEmpty()) {
         QList activeItems = canvas->selectedItems();
-        QGraphicsItem *activeItem = 0;
+        QGraphicsItem *activeItem = nullptr;
         if (activeItems.count() == 1) {
             activeItem = activeItems.first();
         }
         canvas->clearSelection();
         d->sectionData.mouseAction = ReportWriterSectionData::MA_None;
 
         //! @todo this code sucks :)
         //! The setPos calls only work AFTER the name has been set ?!?!?
 
         foreach(KReportDesignerItemBase *item, d->sectionData.copy_list) {
             KReportItemBase *obj = dynamic_cast(item);
             const QString type = obj ? obj->typeName() : QLatin1String("object");
             //kreportDebug() << type;
             KReportDesignerItemBase *ent = item->clone();
             KReportItemBase *new_obj = dynamic_cast(ent);
             if (new_obj) {
                 new_obj->setEntityName(suggestEntityName(type));
                 if (activeItem) {
                     new_obj->setPosition(KReportItemBase::positionFromScene(QPointF(activeItem->x() + 10, activeItem->y() + 10)));
                 } else {
                     new_obj->setPosition(KReportItemBase::positionFromScene(QPointF(0, 0)));
                 }
                 changeSet(new_obj->propertySet());
             }
             QGraphicsItem *pasted_ent = dynamic_cast(ent);
             if (pasted_ent) {
                 pasted_ent->setSelected(true);
                 canvas->addItem(pasted_ent);
                 pasted_ent->show();
                 d->sectionData.mouseAction = ReportWriterSectionData::MA_Grab;
                 setModified(true);
             }
         }
     }
 }
 void KReportDesigner::slotRaiseSelected()
 {
     dynamic_cast(activeScene())->raiseSelected();
 }
 
 void KReportDesigner::slotLowerSelected()
 {
     dynamic_cast(activeScene())->lowerSelected();
 }
 
 QGraphicsScene* KReportDesigner::activeScene() const
 {
     return d->activeScene;
 }
 
 void KReportDesigner::setActiveScene(QGraphicsScene* a)
 {
     if (d->activeScene && d->activeScene != a)
         d->activeScene->clearSelection();
     d->activeScene = a;
 
     //Trigger an update so that the last scene redraws its title;
     update();
 }
 
 QString KReportDesigner::suggestEntityName(const QString &n) const
 {
     KReportDesignerSection *sec;
     int itemCount = 0;
     //Count items in the main sections
     for (int i = 1; i <= KReportSectionData::PageFooterAny; i++) {
         sec = section((KReportSectionData::Section) i);
         if (sec) {
             const QGraphicsItemList l = sec->items();
             itemCount += l.count();
         }
     }
 
     if (d->detail) {
         //Count items in the group headers/footers
         for (int i = 0; i < d->detail->groupSectionCount(); i++) {
             sec = d->detail->groupSection(i)->groupHeader();
             if (sec) {
                 const QGraphicsItemList l = sec->items();
                 itemCount += l.count();
             }
             sec = d->detail->groupSection(i)->groupFooter();
             if (sec) {
                 const QGraphicsItemList l = sec->items();
                 itemCount += l.count();
             }
         }
 
         sec = d->detail->detailSection();
         if (sec) {
             const QGraphicsItemList l = sec->items();
             itemCount += l.count();
         }
     }
 
     while (!isEntityNameUnique(n + QString::number(itemCount))) {
         itemCount++;
     }
     return n + QString::number(itemCount);
 }
 
 bool KReportDesigner::isEntityNameUnique(const QString &n, KReportItemBase* ignore) const
 {
     KReportDesignerSection *sec;
     bool unique = true;
 
     //Check items in the main sections
     for (int i = 1; i <= KReportSectionData::PageFooterAny; i++) {
         sec = section((KReportSectionData::Section)i);
         if (sec) {
             const QGraphicsItemList l = sec->items();
             for (QGraphicsItemList::const_iterator it = l.constBegin(); it != l.constEnd(); ++it) {
                 KReportItemBase* itm = dynamic_cast(*it);
                 if (itm && itm->entityName() == n  && itm != ignore) {
                     unique = false;
                     break;
                 }
             }
             if (!unique) break;
         }
     }
 
     //Count items in the group headers/footers
     if (unique && d->detail) {
         for (int i = 0; i < d->detail->groupSectionCount(); ++i) {
             sec = d->detail->groupSection(i)->groupHeader();
             if (sec) {
                 const QGraphicsItemList l = sec->items();
                 for (QGraphicsItemList::const_iterator it = l.constBegin(); it != l.constEnd(); ++it) {
                     KReportItemBase* itm = dynamic_cast(*it);
                     if (itm && itm->entityName() == n  && itm != ignore) {
                         unique = false;
                         break;
                     }
                 }
 
             }
             sec = d->detail->groupSection(i)->groupFooter();
             if (unique && sec) {
                 const QGraphicsItemList l = sec->items();
                 for (QGraphicsItemList::const_iterator it = l.constBegin(); it != l.constEnd(); ++it) {
                     KReportItemBase* itm = dynamic_cast(*it);
                     if (itm && itm->entityName() == n  && itm != ignore) {
                         unique = false;
                         break;
                     }
                 }
             }
         }
     }
     if (unique && d->detail) {
         sec = d->detail->detailSection();
         if (sec) {
             const QGraphicsItemList l = sec->items();
             for (QGraphicsItemList::const_iterator it = l.constBegin(); it != l.constEnd(); ++it) {
                 KReportItemBase* itm = dynamic_cast(*it);
                 if (itm && itm->entityName() == n  && itm != ignore) {
                     unique = false;
                     break;
                 }
             }
         }
     }
 
     return unique;
 }
 
 static bool actionPriortyLessThan(QAction* act1, QAction* act2)
 {
     if (act1->data().toInt() > 0 && act2->data().toInt() > 0) {
         return act1->data().toInt() < act2->data().toInt();
     }
     return false;
 }
 
 QList KReportDesigner::itemActions(QActionGroup* group)
 {
     KReportPluginManager* manager = KReportPluginManager::self();
     QList actList = manager->createActions(group);
 
     //! @todo make line a real plugin so this isn't needed:
     QAction *act = new QAction(QIcon::fromTheme(QLatin1String("kreport-line-element")), tr("Line"), group);
     act->setObjectName(QLatin1String("org.kde.kreport.line"));
     act->setData(9);
     act->setCheckable(true);
     actList << act;
 
     qSort(actList.begin(), actList.end(), actionPriortyLessThan);
     int i = 0;
 
     /*! @todo maybe this is a bit hackish
      It finds the first plugin based on the priority in userdata
      The lowest oriority a plugin can have is 10
      And inserts a separator before it. */
     bool sepInserted = false;
     foreach(QAction *a, actList) {
         ++i;
         if (!sepInserted && a->data().toInt() >= 10) {
             QAction *sep = new QAction(QLatin1String("separator"), group);
             sep->setSeparator(true);
             actList.insert(i-1, sep);
             sepInserted = true;
         }
         if (group) {
             group->addAction(a);
         }
     }
 
     return actList;
 }
 
 QList< QAction* > KReportDesigner::designerActions()
 {
     QList al;
     QAction *sep = new QAction(QString(), this);
     sep->setSeparator(true);
 
     al << d->editCutAction << d->editCopyAction << d->editPasteAction << d->editDeleteAction << sep << d->sectionEdit << sep << d->itemLowerAction << d->itemRaiseAction;
 
     return al;
 }
 
 void KReportDesigner::createActions()
 {
     d->editCutAction = new QAction(QIcon::fromTheme(QLatin1String("edit-cut")), tr("Cu&t"), this);
     d->editCutAction->setObjectName(QLatin1String("edit_cut"));
     d->editCutAction->setToolTip(tr("Cut selection to clipboard"));
     d->editCutAction->setShortcuts(KStandardShortcut::cut());
     d->editCutAction->setProperty("iconOnly", true);
 
     d->editCopyAction = new QAction(QIcon::fromTheme(QLatin1String("edit-copy")), tr("&Copy"), this);
     d->editCopyAction->setObjectName(QLatin1String("edit_copy"));
     d->editCopyAction->setToolTip(tr("Copy selection to clipboard"));
     d->editCopyAction->setShortcuts(KStandardShortcut::copy());
     d->editCopyAction->setProperty("iconOnly", true);
 
     d->editPasteAction = new QAction(QIcon::fromTheme(QLatin1String("edit-paste")), tr("&Paste"), this);
     d->editPasteAction->setObjectName(QLatin1String("edit_paste"));
     d->editPasteAction->setToolTip(tr("Paste clipboard content"));
     d->editPasteAction->setShortcuts(KStandardShortcut::paste());
     d->editPasteAction->setProperty("iconOnly", true);
 
     const KGuiItem del = KStandardGuiItem::del();
     d->editDeleteAction = new QAction(del.icon(), del.text(), this);
     d->editDeleteAction->setObjectName(QLatin1String("edit_delete"));
     d->editDeleteAction->setToolTip(del.toolTip());
     d->editDeleteAction->setWhatsThis(del.whatsThis());
     d->editDeleteAction->setProperty("iconOnly", true);
 
     d->sectionEdit = new QAction(tr("Edit Sections"), this);
     d->sectionEdit->setObjectName(QLatin1String("section_edit"));
 
     d->itemRaiseAction = new QAction(QIcon::fromTheme(QLatin1String("arrow-up")), tr("Raise"), this);
     d->itemRaiseAction->setObjectName(QLatin1String("item_raise"));
     d->itemLowerAction = new QAction(QIcon::fromTheme(QLatin1String("arrow-down")), tr("Lower"), this);
     d->itemLowerAction->setObjectName(QLatin1String("item_lower"));
 
     //Edit Actions
     connect(d->editCutAction, SIGNAL(triggered(bool)), this, SLOT(slotEditCut()));
     connect(d->editCopyAction, SIGNAL(triggered(bool)), this, SLOT(slotEditCopy()));
     connect(d->editPasteAction, SIGNAL(triggered(bool)), this, SLOT(slotEditPaste()));
     connect(d->editDeleteAction, SIGNAL(triggered(bool)), this, SLOT(slotEditDelete()));
 
     connect(d->sectionEdit, SIGNAL(triggered(bool)), this, SLOT(slotSectionEditor()));
 
     //Raise/Lower
     connect(d->itemRaiseAction, SIGNAL(triggered(bool)), this, SLOT(slotRaiseSelected()));
     connect(d->itemLowerAction, SIGNAL(triggered(bool)), this, SLOT(slotLowerSelected()));
 }
 
 void KReportDesigner::setSectionCursor(const QCursor& c)
 {
     if (d->pageFooterAny)
         d->pageFooterAny->setSectionCursor(c);
     if (d->pageFooterEven)
         d->pageFooterEven->setSectionCursor(c);
     if (d->pageFooterFirst)
         d->pageFooterFirst->setSectionCursor(c);
     if (d->pageFooterLast)
         d->pageFooterLast->setSectionCursor(c);
     if (d->pageFooterOdd)
         d->pageFooterOdd->setSectionCursor(c);
 
     if (d->pageHeaderAny)
         d->pageHeaderAny->setSectionCursor(c);
     if (d->pageHeaderEven)
         d->pageHeaderEven->setSectionCursor(c);
     if (d->pageHeaderFirst)
         d->pageHeaderFirst->setSectionCursor(c);
     if (d->pageHeaderLast)
         d->pageHeaderLast->setSectionCursor(c);
     if (d->pageHeaderOdd)
         d->pageHeaderOdd->setSectionCursor(c);
 
     if (d->detail)
         d->detail->setSectionCursor(c);
 }
 
 void KReportDesigner::unsetSectionCursor()
 {
     if (d->pageFooterAny)
         d->pageFooterAny->unsetSectionCursor();
     if (d->pageFooterEven)
         d->pageFooterEven->unsetSectionCursor();
     if (d->pageFooterFirst)
         d->pageFooterFirst->unsetSectionCursor();
     if (d->pageFooterLast)
         d->pageFooterLast->unsetSectionCursor();
     if (d->pageFooterOdd)
         d->pageFooterOdd->unsetSectionCursor();
 
     if (d->pageHeaderAny)
         d->pageHeaderAny->unsetSectionCursor();
     if (d->pageHeaderEven)
         d->pageHeaderEven->unsetSectionCursor();
     if (d->pageHeaderFirst)
         d->pageHeaderFirst->unsetSectionCursor();
     if (d->pageHeaderLast)
         d->pageHeaderLast->unsetSectionCursor();
     if (d->pageHeaderOdd)
         d->pageHeaderOdd->unsetSectionCursor();
 
     if (d->detail)
         d->detail->unsetSectionCursor();
 }
 
 qreal KReportDesigner::countSelectionHeight() const
 {
     if (d->releaseY == -1 || d->pressY == -1) {
         return -1;
     }
     return qAbs(d->releaseY - d->pressY);
 }
 
 qreal KReportDesigner::countSelectionWidth() const
 {
     if (d->releaseX == -1 || d->pressX == -1) {
         return -1;
     }
     return qAbs(d->releaseX - d->pressX);
 }
 
 qreal KReportDesigner::getSelectionPressX() const
 {
     return d->pressX;
 }
 
 qreal KReportDesigner::getSelectionPressY() const
 {
     return d->pressY;
 }
 
 QPointF KReportDesigner::getPressPoint() const
 {
     return QPointF(d->pressX, d->pressY);
 }
 
 QPointF KReportDesigner::getReleasePoint() const
 {
     return QPointF(d->releaseX, d->releaseY);
 }
 
 void KReportDesigner::plugItemActions(const QList &actList)
 {
     foreach(QAction *a, actList) {
         connect(a, SIGNAL(triggered(bool)), this, SLOT(slotItemTriggered(bool)));
     }
 }
 
 void KReportDesigner::slotItemTriggered(bool checked)
 {
     if (!checked) {
         return;
     }
     QObject *theSender = sender();
     if (!theSender) {
         return;
     }
     slotItem(theSender->objectName());
 }
 
 void KReportDesigner::addMetaProperties(KPropertySet* set, const QString &classString,
                                         const QString &iconName)
 {
     Q_ASSERT(set);
     KProperty *prop;
     set->addProperty(prop = new KProperty("this:classString", classString));
     prop->setVisible(false);
     set->addProperty(prop = new KProperty("this:iconName", iconName));
     prop->setVisible(false);
 }
diff --git a/src/wrtembed/KReportDesigner.h b/src/wrtembed/KReportDesigner.h
index dc28afa9..7dc79825 100644
--- a/src/wrtembed/KReportDesigner.h
+++ b/src/wrtembed/KReportDesigner.h
@@ -1,349 +1,349 @@
 /* This file is part of the KDE project
  * Copyright (C) 2001-2007 by OpenMFG, LLC 
  * Copyright (C) 2007-2008 by Adam Pigg 
  * Copyright (C) 2011-2017 Jarosław Staniek 
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 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
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library.  If not, see .
  */
 #ifndef KREPORTDESIGNER_H
 #define KREPORTDESIGNER_H
 
 #include 
 
 #include "KReportDocument.h"
 #include "KReportDataSource.h"
 
 class KProperty;
 class KPropertySet;
 
 class KReportItemBase;
 
 class QGraphicsScene;
 class QActionGroup;
 class QGraphicsSceneContextMenuEvent;
 class QString;
 
 class KReportDesignerSectionDetail;
 class KReportDesignerSection;
 class KReportUnit;
 class KReportDesignerSectionScene;
 class KReportDesignerSectionView;
 class QAction;
 
 //
 // Class ReportDesigner
 //     The ReportDesigner is the main widget for designing a report
 //
 class KREPORT_EXPORT KReportDesigner : public QWidget
 {
     Q_OBJECT
 public:
     /**
     @brief Constructor that create a blank designer
     @param widget QWidget parent
     */
-    explicit KReportDesigner(QWidget *parent = 0);
+    explicit KReportDesigner(QWidget *parent = nullptr);
 
     /**
     @brief Constructor that create a designer, and loads the report described in the QDomElement
     @param widget QWidget parent
     @param element Report structure XML element
     */
-    KReportDesigner(QWidget *, const QDomElement &data);
+    KReportDesigner(QWidget *parent, const QDomElement &data);
 
     /**
     @brief Desctructor
     */
-    ~KReportDesigner();
+    ~KReportDesigner() override;
 
     /**
     @brief Sets the report data
     The report data interface contains functions to retrieve data
     and information about the fields.
     @param kodata Pointer to KReportDataSource instance, ownership is transferred
     */
     void setDataSource(KReportDataSource* source);
 
     /**
     @brief Return a pointer to the reports data
     @return Pointer to report data
     */
     KReportDataSource *reportDataSource() const;
 
     /**
     @brief Return a pointer to the section specified
     @param section KReportSectionData::Section enum value of the section to return
     @return Pointer to report section object, or 0 if no section exists
     */
     KReportDesignerSection* section(KReportSectionData::Section) const;
 
     /**
     @brief Creates new section
     @return Pointer to a new report section section object, ownership is transferred to
             the caller
     */
     KReportDesignerSection* createSection() Q_REQUIRED_RESULT;
 
     /**
     @brief Deletes the section specified
     @param section KReportSectionData::Section enum value of the section to return
     */
     void removeSection(KReportSectionData::Section);
 
     /**
     @brief Create a new section and insert it into the report
     @param section KReportSectionData::Section enum value of the section to return
     */
     void insertSection(KReportSectionData::Section);
 
     /**
     @brief Return a pointer to the detail section.
     The detail section contains the actual detail section and related group sections
     @return Pointer to detail section
     */
     KReportDesignerSectionDetail* detailSection() const;
 
     /**
     @brief Sets the title of the reportData
     @param title Report Title
     */
     void setReportTitle(const QString &);
 
     /**
     @brief Sets the parameters for the display of the background gridpoints
     @param visible Grid visibility
     @param divisions Number of minor divisions between major points
     */
     void setGridOptions(bool visible, int divisions);
 
     /**
     @brief Return the title of the report
     */
     QString reportTitle() const;
 
     /**
     @brief Return an XML description of the report
     @return QDomElement describing the report definition
     */
     QDomElement document() const;
 
     /**
     @brief Return true if the design has been modified
     @return modified status
     */
     bool isModified() const;
 
     /**
     @return a list of field names in the selected KReportData
     */
     QStringList fieldNames() const;
 
     /**
     @return a list of field keys in the selected KReportData
     The keys can be used to reference the names
     */
     QStringList fieldKeys() const;
 
     /**
     @brief Calculate the width of the page in pixels given the paper size, orientation, dpi and margin
     @return integer value of width in pixels
     */
     int pageWidthPx() const;
 
     /**
     @return the scene (section) that is currently active
     */
     QGraphicsScene* activeScene() const;
 
     /**
     @brief Sets the active Scene
     @param scene The scene to make active
     */
     void setActiveScene(QGraphicsScene* scene);
 
     /**
     @return the property set for the general report properties
     */
     KPropertySet* propertySet() const;
 
     /**
     @brief Give a hint on the size of the widget
     */
-    virtual QSize sizeHint() const;
+    QSize sizeHint() const override;
 
     /**
     @brief Return the current unit assigned to the report
     */
     KReportUnit pageUnit() const;
 
     /**
     @brief Handle the context menu event for a report section
     @param scene The associated scene (section)
     */
-    void sectionContextMenuEvent(KReportDesignerSectionScene *, QGraphicsSceneContextMenuEvent * e);
+    void sectionContextMenuEvent(KReportDesignerSectionScene *s, QGraphicsSceneContextMenuEvent * e);
 
     /**
     @brief Handle the mouse release event for a report section
     */
-    void sectionMouseReleaseEvent(KReportDesignerSectionView *, QMouseEvent * e);
+    void sectionMouseReleaseEvent(KReportDesignerSectionView *v, QMouseEvent * e);
 
-    void sectionMousePressEvent(KReportDesignerSectionView *, QMouseEvent * e);
+    void sectionMousePressEvent(KReportDesignerSectionView *v, QMouseEvent * e);
 
     /**
     @brief Sets the property set for the currently selected item
     @param set Property set of item
     */
     void changeSet(KPropertySet *);
 
     /**
     @brief Return the property set for the curently selected item
     */
     KPropertySet* selectedItemPropertySet() const;
 
     /**
     @brief Sets the modified status, defaulting to true for modified
     @param modified Modified status
     */
     void setModified(bool modified);
 
     /**
     @brief Return a unique name that can be used by the entity
     @param entity Name of entity
     */
     QString suggestEntityName(const QString &) const;
 
     /**
     @brief Checks if the supplied name is unique among all entities
     */
-    bool isEntityNameUnique(const QString &, KReportItemBase* = 0) const;
+    bool isEntityNameUnique(const QString &, KReportItemBase* = nullptr) const;
 
     /**
     @brief Returns a list of actions that represent the entities that can be inserted into the report.
     Actions are created as children of @a group and belong to the group.
     @return list of actions */
-    static QList itemActions(QActionGroup* group = 0);
+    static QList itemActions(QActionGroup* group = nullptr);
 
     /**
     @brief Populates the toolbar with actions that can be applied to the report
     Actions are created as children of @a group and belong to the group.
     @return list of actions */
     QList designerActions();
 
     /**
     @return X position of mouse when mouse press occurs
     */
     qreal getSelectionPressX() const;
 
     /**
     @return Y position of mouse when mouse press occurs
     */
     qreal getSelectionPressY() const;
 
     /**
     @return difference between X position of mouse release and press
     */
     qreal countSelectionWidth() const;
 
     /**
     @return difference between Y position of mouse release and press
     */
     qreal countSelectionHeight() const;
 
     /**
     @return point that contains X,Y coordinates of mouse press
     */
     QPointF getPressPoint() const;
 
     /**
     @return point that contains X,Y coordinates of mouse press
     */
     QPointF getReleasePoint() const;
 
     void plugItemActions(const QList &actList);
 
     /**
      * @brief Adds meta-properties to the property set @a set for consumption by property editor
      * - "this:classString" - user-visible translated name of element type, e.g. tr("Label")
      * - "this:iconName" - name of user-visible icon, e.g. "kreport-label-element"
      *
      * All the properties are set to invisible.
      * @see propertySet()
      */
     static void addMetaProperties(KPropertySet* set, const QString &classString,
                                   const QString &iconName);
 
 public Q_SLOTS:
 
     void slotEditDelete();
     void slotEditCut();
     void slotEditCopy();
     void slotEditPaste();
     void slotEditPaste(QGraphicsScene *);
 
     void slotItem(const QString&);
 
     void slotSectionEditor();
 
     void slotRaiseSelected();
     void slotLowerSelected();
 
 private:
     void init();
 
     /**
     @brief Sets the detail section to the given section
     */
     void setDetail(KReportDesignerSectionDetail *rsd);
 
     /**
     @brief Deletes the detail section
     */
     void deleteDetail();
 
-    virtual void resizeEvent(QResizeEvent * event);
+    void resizeEvent(QResizeEvent * event) override;
 
     //Properties
     void createProperties();
 
     unsigned int selectionCount() const;
 
     void setSectionCursor(const QCursor&);
     void unsetSectionCursor();
 
     void createActions();
 
 private Q_SLOTS:
     void slotPropertyChanged(KPropertySet &s, KProperty &p);
 
     /**
     @brief When the 'page' button in the top left is pressed, change the property set to the reports properties.
     */
     void slotPageButton_Pressed();
 
     void slotItemTriggered(bool checked);
 
 Q_SIGNALS:
     void pagePropertyChanged(KPropertySet &s);
     void propertySetChanged();
     void dirty();
     void reportDataChanged();
     void itemInserted(const QString& entity);
 
 private:
     Q_DISABLE_COPY(KReportDesigner)
     class Private;
     Private * const d;
 };
 
 #endif
diff --git a/src/wrtembed/KReportDesignerItemBase.cpp b/src/wrtembed/KReportDesignerItemBase.cpp
index 0c78d2e7..38b506ef 100644
--- a/src/wrtembed/KReportDesignerItemBase.cpp
+++ b/src/wrtembed/KReportDesignerItemBase.cpp
@@ -1,118 +1,118 @@
 /* This file is part of the KDE project
  * Copyright (C) 2001-2007 by OpenMFG, LLC (info@openmfg.com)
  * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 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
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library.  If not, see .
  */
 
 #include "KReportDesignerItemBase.h"
 #include "KReportItemBase.h"
 #include "KReportUtils.h"
 
 #include 
 #include 
 #include 
 
 class Q_DECL_HIDDEN KReportDesignerItemBase::Private
 {
 public:
     Private();
     ~Private();
     
     KReportDesigner *reportDesigner;
     KReportItemBase *item;
     QString renderText;   
 };
 
 KReportDesignerItemBase::Private::Private()
 {
 }
 
 KReportDesignerItemBase::Private::~Private()
 {
 }
 
 KReportDesignerItemBase::~KReportDesignerItemBase()
 {
     delete d;
 }
 
 KReportDesignerItemBase::KReportDesignerItemBase(KReportDesigner *r, KReportItemBase *b) : d(new Private())
 {
     d->reportDesigner = r;
     d->item = b;
 }
 
 void KReportDesignerItemBase::buildXML(QGraphicsItem * item, QDomDocument *doc, QDomElement *parent)
 {
-    KReportDesignerItemBase *re = 0;
+    KReportDesignerItemBase *re = nullptr;
     re = dynamic_cast(item);
 
     if (re) {
         re->buildXML(doc, parent);
     }
 
 }
 
 void KReportDesignerItemBase::buildXMLRect(QDomDocument *doc, QDomElement *entity, KReportItemBase *i)
 {
     Q_UNUSED(doc);
     KReportUtils::buildXMLRect(entity, i->position(), i->size());
 }
 
 void KReportDesignerItemBase::buildXMLTextStyle(QDomDocument *doc, QDomElement *entity, const KReportTextStyleData &ts)
 {
     KReportUtils::buildXMLTextStyle(doc, entity, ts);
 }
 
 void KReportDesignerItemBase::buildXMLLineStyle(QDomDocument *doc, QDomElement *entity, const KReportLineStyle &ls)
 {
     KReportUtils::buildXMLLineStyle(doc, entity, ls);
 }
 
 QString KReportDesignerItemBase::dataSourceAndObjectTypeName(const QString& dataSource, const QString& objectTypeName) const
 {
     return QString::fromLatin1("%1: %2").arg(dataSource).arg(objectTypeName);
 }
 
 // static
 void KReportDesignerItemBase::addPropertyAsAttribute(QDomElement* e, KProperty* p)
 {
     KReportUtils::addPropertyAsAttribute(e, p);
 }
 
 KReportDesigner * KReportDesignerItemBase::designer() const
 {
     return d->reportDesigner;
 }
 
 void KReportDesignerItemBase::setDesigner(KReportDesigner* rd)
 {
     d->reportDesigner = rd;
 }
 
 KReportItemBase *KReportDesignerItemBase::item() const
 {
     return d->item;
 }
 
 QString KReportDesignerItemBase::renderText() const
 {
     return d->renderText;
 }
 
 void KReportDesignerItemBase::setRenderText(const QString& text)
 {
     d->renderText = text;
 }
diff --git a/src/wrtembed/KReportDesignerItemBase.h b/src/wrtembed/KReportDesignerItemBase.h
index 0c42dd76..109d2300 100644
--- a/src/wrtembed/KReportDesignerItemBase.h
+++ b/src/wrtembed/KReportDesignerItemBase.h
@@ -1,88 +1,89 @@
 /* This file is part of the KDE project
  * Copyright (C) 2001-2007 by OpenMFG, LLC (info@openmfg.com)
  * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 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
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library.  If not, see .
  */
 
 /*
  *     This file contains all the Report Entity classes. Each one is a
  * derivative of ReportEntity, which in turn is derived from QCanvasItem.
  */
 
 #ifndef KREPORTDESIGNERITEMBASE_H
 #define KREPORTDESIGNERITEMBASE_H
 
 #include 
 
 #include "KReportItemBase.h"
 
 class QDomDocument;
 class QDomElement;
 
 class KReportDesigner;
 class KReportPosition;
 class KReportSize;
 
 //
 // ReportEntity
 //
 class KREPORT_EXPORT KReportDesignerItemBase
 {
 public:
     virtual ~KReportDesignerItemBase();
 
     static void buildXML(QGraphicsItem * item, QDomDocument *doc, QDomElement *parent);
     virtual void buildXML(QDomDocument *doc, QDomElement *parent) = 0;
 
     static void buildXMLRect(QDomDocument *doc, QDomElement *entity, KReportItemBase *i);
     static void buildXMLTextStyle(QDomDocument *doc, QDomElement *entity, const KReportTextStyleData &ts);
     static void buildXMLLineStyle(QDomDocument *doc, QDomElement *entity, const KReportLineStyle &ls);
 
     virtual KReportDesignerItemBase* clone() = 0;
     virtual void move(const QPointF&) = 0;
 
     KReportDesigner* designer() const;
     void setDesigner(KReportDesigner* rd);
 
     static void addPropertyAsAttribute(QDomElement* e, KProperty* p);
 
 protected:
-    explicit KReportDesignerItemBase(KReportDesigner*, KReportItemBase*);
-    QString dataSourceAndObjectTypeName(const QString& dataSource, const QString& objectTypeName) const;
+    explicit KReportDesignerItemBase(KReportDesigner *r, KReportItemBase *);
+    QString dataSourceAndObjectTypeName(const QString &dataSource,
+                                        const QString &objectTypeName) const;
 
     /**
      * @brief Updates the text that is shown for the item in the report designer
      * If itemDataSource is set then it is preferred over itemStaticValue
      * itemType is appended to the end of the text
      *
      * @param itemDataSource source field property
      * @param itemStaticValue value property
      * @param itemType type of item
      * @return void
      */
     void updateRenderText(const QString &itemDataSource, const QString &itemStaticValue, const QString &itemType);    
     KReportItemBase *item() const;
     
     void setRenderText(const QString &text);
     QString renderText() const;
 
 private:
     Q_DISABLE_COPY(KReportDesignerItemBase)
     class Private;
     Private * const d;
 };
 
 #endif
 
diff --git a/src/wrtembed/KReportDesignerItemLine.cpp b/src/wrtembed/KReportDesignerItemLine.cpp
index aaa6a271..05b75a89 100644
--- a/src/wrtembed/KReportDesignerItemLine.cpp
+++ b/src/wrtembed/KReportDesignerItemLine.cpp
@@ -1,256 +1,260 @@
 /* This file is part of the KDE project
  * Copyright (C) 2001-2007 by OpenMFG, LLC (info@openmfg.com)
  * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 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
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library.  If not, see .
  */
 
 #include "KReportDesignerItemLine.h"
 #include "KReportDesignerItemBase.h"
 #include "KReportDesigner.h"
 #include "KReportDesignerSectionScene.h"
 #include "KReportUtils.h"
 #include "KReportLineStyle.h"
 
 #include 
 #include 
 #include 
 #include 
 
 //
 // class ReportEntityLine
 //
 void KReportDesignerItemLine::init(QGraphicsScene* s, KReportDesigner *r)
 {
     setPos(0, 0);
     setUnit(r->pageUnit());
 
     nameProperty()->setValue(r->suggestEntityName(typeName()));
     
     setFlags(ItemIsSelectable | ItemIsMovable | ItemSendsGeometryChanges);
 
     setPen(QPen(Qt::black, 5));
     setAcceptHoverEvents(true);
 
     if (s)
         s->addItem(this);
 
     setZValue(z());
 }
 
 KReportDesignerItemLine::KReportDesignerItemLine(KReportDesigner * d, QGraphicsScene * scene, const QPointF &pos)
         : KReportDesignerItemBase(d, this)
 {
     init(scene, d);
     setLineScene(QLineF(pos, QPointF(20,20)+pos));
     
 }
 
 KReportDesignerItemLine::KReportDesignerItemLine(KReportDesigner * d, QGraphicsScene * scene, const QPointF &startPos, const QPointF &endPos)
         : KReportDesignerItemBase(d, this)
 {
     init(scene, d);
     setLineScene(QLineF(startPos, endPos));
 }
 
 KReportDesignerItemLine::KReportDesignerItemLine(const QDomNode & entity, KReportDesigner * d, QGraphicsScene * scene)
         : KReportItemLine(entity), KReportDesignerItemBase(d, this)
 {
     init(scene, d);
     QPointF s = scenePosition(m_start->value().toPointF());
     QPointF e = scenePosition(m_end->value().toPointF());
     
     setLine ( s.x(), s.y(), e.x(), e.y() );
 }
 
+KReportDesignerItemLine::~KReportDesignerItemLine()
+{
+}
+
 KReportDesignerItemLine* KReportDesignerItemLine::clone()
 {
     QDomDocument d;
     QDomElement e = d.createElement(QLatin1String("clone"));
     QDomNode n;
     buildXML(&d, &e);
     n = e.firstChild();
-    return new KReportDesignerItemLine(n, designer(), 0);
+    return new KReportDesignerItemLine(n, designer(), nullptr);
 }
 
 void KReportDesignerItemLine::paint(QPainter* painter, const QStyleOptionGraphicsItem* option,
                              QWidget *widget)
 {
     Q_UNUSED(option);
     Q_UNUSED(widget);
 
     painter->setRenderHint(QPainter::Antialiasing, true);
     QPen p = painter->pen();
     painter->setPen(QPen(m_lineColor->value().value(), m_lineWeight->value().toInt(), (Qt::PenStyle)m_lineStyle->value().toInt()));
     painter->drawLine(line());
     if (isSelected()) {
 
         // draw a selected border for visual purposes
         painter->setPen(QPen(QColor(128, 128, 255), 0, Qt::DotLine));
         QPointF pt = line().p1();
         painter->fillRect(pt.x(), pt.y() - 2, 5, 5, QColor(128, 128, 255));
         pt = line().p2();
         painter->fillRect(pt.x() - 4, pt.y() - 2, 5, 5, QColor(128, 128, 255));
 
         painter->setPen(p);
     }
 }
 
 void KReportDesignerItemLine::buildXML(QDomDocument *doc, QDomElement *parent)
 {
     QDomElement entity = doc->createElement(QLatin1String("report:") + typeName());
 
     // properties
     addPropertyAsAttribute(&entity, nameProperty());
     entity.setAttribute(QLatin1String("report:z-index"), zValue());
     KReportUtils::setAttribute(&entity, QLatin1String("svg:x1"), m_start->value().toPointF().x());
     KReportUtils::setAttribute(&entity, QLatin1String("svg:y1"), m_start->value().toPointF().y());
     KReportUtils::setAttribute(&entity, QLatin1String("svg:x2"), m_end->value().toPointF().x());
     KReportUtils::setAttribute(&entity, QLatin1String("svg:y2"), m_end->value().toPointF().y());
 
     buildXMLLineStyle(doc, &entity, lineStyle());
 
     parent->appendChild(entity);
 }
 
 void KReportDesignerItemLine::propertyChanged(KPropertySet &s, KProperty &p)
 {
     Q_UNUSED(s);
 
     if (p.name() == "startposition" || p.name() == "endposition") {
         QPointF s = scenePosition(m_start->value().toPointF());
         QPointF e = scenePosition(m_end->value().toPointF());
         
         setLine ( s.x(), s.y(), e.x(), e.y() );
     }
     else if (p.name() == "name") {
         //For some reason p.oldValue returns an empty string
         if (!designer()->isEntityNameUnique(p.value().toString(), this)) {
             p.setValue(oldName());
         } else {
             setOldName(p.value().toString());
         }
     }
     if (designer())
         designer()->setModified(true);
 
     update();
 }
 
 void KReportDesignerItemLine::mousePressEvent(QGraphicsSceneMouseEvent * event)
 {
     designer()->changeSet(propertySet());
     setSelected(true);
     QGraphicsLineItem::mousePressEvent(event);
 }
 
 QVariant KReportDesignerItemLine::itemChange(GraphicsItemChange change, const QVariant &value)
 {
     return QGraphicsItem::itemChange(change, value);
 }
 
 void KReportDesignerItemLine::mouseReleaseEvent(QGraphicsSceneMouseEvent * event)
 {
     QGraphicsLineItem::mouseReleaseEvent(event);
 }
 
 void KReportDesignerItemLine::mouseMoveEvent(QGraphicsSceneMouseEvent * event)
 {
     int x;
     int y;
 
     KReportDesignerSectionScene *section = qobject_cast(scene());
     if (!section) {
         return;
     }
         
     QPointF p = section->gridPoint(event->scenePos());
     //kreportDebug() << p;
     x = p.x();
     y = p.y();
 
     if (x < 0) x = 0;
     if (y < 0) y = 0;
     if (x > scene()->width()) x = scene()->width();
     if (y > scene()->height()) y = scene()->height();
 
     switch (m_grabAction) {
     case 1:
         m_start->setValue(positionFromScene(QPointF(x,y)));
         break;
     case 2:
         m_end->setValue(positionFromScene(QPointF(x,y)));
         break;
     default:
         QPointF d = mapToItem(this, section->gridPoint(event->scenePos())) - mapToItem(this, section->gridPoint(event->lastScenePos()));
 
         if (((line().p1() + d).x() >= 0) &&
                 ((line().p2() + d).x() >= 0) &&
                 ((line().p1() + d).y() >= 0) &&
                 ((line().p2() + d).y() >= 0)  &&
                 ((line().p1() + d).x() <= scene()->width()) &&
                 ((line().p2() + d).x() <= scene()->width()) &&
                 ((line().p1() + d).y() <= scene()->height()) &&
                 ((line().p2() + d).y() <= scene()->height()))
             setLineScene(QLineF(line().p1() + d, line().p2() + d));
         break;
     }
 }
 
-int KReportDesignerItemLine::grabHandle(QPointF pos)
+int KReportDesignerItemLine::grabHandle(const QPointF &pos)
 {
     if (QRectF(line().p1().x(), line().p1().y() - 2, 5, 5).contains(pos)) {
         // we are over point 1
         return 1;
     } else if (QRectF(line().p2().x() - 4, line().p2().y() - 2, 5, 5).contains(pos)) {
         // we are over point 2
         return 2;
     } else {
         return 0;
     }
 
 }
 
 void KReportDesignerItemLine::hoverMoveEvent(QGraphicsSceneHoverEvent * event)
 {
     if (isSelected()) {
         m_grabAction = grabHandle(event->pos());
         switch (m_grabAction) {
         case 1: //Point 1
             setCursor(Qt::SizeAllCursor);
             break;
         case 2: //Point 2
             setCursor(Qt::SizeAllCursor);
             break;
         default:
             unsetCursor();
         }
     }
 }
 
-void KReportDesignerItemLine::setLineScene(QLineF l)
+void KReportDesignerItemLine::setLineScene(const QLineF &line)
 {
-    m_start->setValue(positionFromScene(l.p1()));
-    m_end->setValue(positionFromScene(l.p2()));
-    
-    setLine(l);
+    m_start->setValue(positionFromScene(line.p1()));
+    m_end->setValue(positionFromScene(line.p2()));
+
+    setLine(line);
 }
 
 void KReportDesignerItemLine::move(const QPointF& m)
 {
     QPointF original = scenePosition(position());
     original += m;
     
     setPosition(positionFromScene(original));
 }
diff --git a/src/wrtembed/KReportDesignerItemLine.h b/src/wrtembed/KReportDesignerItemLine.h
index 03910881..f58b1c5d 100644
--- a/src/wrtembed/KReportDesignerItemLine.h
+++ b/src/wrtembed/KReportDesignerItemLine.h
@@ -1,62 +1,65 @@
 /* This file is part of the KDE project
  * Copyright (C) 2001-2007 by OpenMFG, LLC (info@openmfg.com)
  * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 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
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library.  If not, see .
  */
 
 #ifndef KREPORTDESIGNERITEMLINE_H
 #define KREPORTDESIGNERITEMLINE_H
 
 #include "KReportDesignerItemBase.h"
 #include "KReportItemLine.h"
 
 #include 
 
 class KReportDesigner;
 class KPropertySet;
 
 class KReportDesignerItemLine : public KReportItemLine, public QGraphicsLineItem, public KReportDesignerItemBase
 {
     Q_OBJECT
 public:
-    KReportDesignerItemLine(KReportDesigner *, QGraphicsScene * scene, const QPointF &pos);
-    KReportDesignerItemLine(KReportDesigner * d, QGraphicsScene * scene, const QPointF &startPos, const QPointF &endPos);
-    KReportDesignerItemLine(const QDomNode & element, KReportDesigner *, QGraphicsScene * scene);
+    KReportDesignerItemLine(KReportDesigner *d, QGraphicsScene *scene, const QPointF &pos);
+    KReportDesignerItemLine(KReportDesigner *d, QGraphicsScene *scene, const QPointF &startPos,
+                            const QPointF &endPos);
+    KReportDesignerItemLine(const QDomNode &element, KReportDesigner *d, QGraphicsScene *scene);
+    ~KReportDesignerItemLine() override;
 
-    virtual void buildXML(QDomDocument *doc, QDomElement *parent);
-    virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget *widget = 0);
-    virtual KReportDesignerItemLine* clone();
+    void buildXML(QDomDocument *doc, QDomElement *parent) override;
+    void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
+               QWidget *widget = nullptr) override;
+    KReportDesignerItemLine *clone() override;
 
-    void setLineScene(QLineF);
+    void setLineScene(const QLineF &line);
 
-    virtual void move(const QPointF&);
+    void move(const QPointF &m) override;
 
 private:
     KReportDesigner* m_rd;
-    void init(QGraphicsScene*, KReportDesigner *);
-    int grabHandle(QPointF pos);
+    void init(QGraphicsScene *s, KReportDesigner *r);
+    int grabHandle(const QPointF &pos);
 
     int m_grabAction;
 
 protected:
-    virtual void hoverMoveEvent(QGraphicsSceneHoverEvent * event);
-    virtual void mouseMoveEvent(QGraphicsSceneMouseEvent * event);
-    virtual void mousePressEvent(QGraphicsSceneMouseEvent * event);
-    virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent * event);
-    virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value);
-    virtual void propertyChanged(KPropertySet &s, KProperty &p);
+    void hoverMoveEvent(QGraphicsSceneHoverEvent * event) override;
+    void mouseMoveEvent(QGraphicsSceneMouseEvent * event) override;
+    void mousePressEvent(QGraphicsSceneMouseEvent * event) override;
+    void mouseReleaseEvent(QGraphicsSceneMouseEvent * event) override;
+    QVariant itemChange(GraphicsItemChange change, const QVariant &value) override;
+    void propertyChanged(KPropertySet &s, KProperty &p) override;
 };
 
 #endif
diff --git a/src/wrtembed/KReportDesignerItemRectBase.cpp b/src/wrtembed/KReportDesignerItemRectBase.cpp
index 12032a87..b3ea31a2 100644
--- a/src/wrtembed/KReportDesignerItemRectBase.cpp
+++ b/src/wrtembed/KReportDesignerItemRectBase.cpp
@@ -1,396 +1,396 @@
 /* This file is part of the KDE project
  * Copyright (C) 2001-2007 by OpenMFG, LLC (info@openmfg.com)
  * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 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
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library.  If not, see .
  */
 
 #include "KReportDesignerItemRectBase.h"
 #include "KReportDesignerSectionView.h"
 #include "KReportDesigner.h"
 #include "KReportDesignerSectionScene.h"
 #include "KReportUtils_p.h"
 
 #include 
 #include 
 #include 
 
 class Q_DECL_HIDDEN KReportDesignerItemRectBase::Private
 {
 public:
     Private();
     ~Private();
     
     int grabAction = 0;
 };
 
 KReportDesignerItemRectBase::Private::Private()
 {
 }
 
 KReportDesignerItemRectBase::Private::~Private()
 {
 }
 
 KReportDesignerItemRectBase::KReportDesignerItemRectBase(KReportDesigner *r, KReportItemBase *b)
         : QGraphicsRectItem(), KReportDesignerItemBase(r, b), d(new KReportDesignerItemRectBase::Private)
 {
     m_dpiX = KReportPrivate::dpiX();
     m_dpiY = KReportPrivate::dpiY();
 
     d->grabAction = 0;
     setAcceptHoverEvents(true);
 
     setFlags(ItemIsSelectable | ItemIsMovable | ItemSendsGeometryChanges);
 }
 
 KReportDesignerItemRectBase::~KReportDesignerItemRectBase()
 {
     delete d;
 }
 
 QRectF KReportDesignerItemRectBase::sceneRect()
 {
     return QRectF(KReportItemBase::scenePosition(item()->position()), KReportItemBase::sceneSize(item()->size()));
 }
 
 QRectF KReportDesignerItemRectBase::pointRect() const
 {
     return QRectF(item()->position(), item()->size());
 }
 
 void KReportDesignerItemRectBase::setSceneRect(const QPointF& topLeft, const QSizeF& size, UpdatePropertyFlag update)
 {
     setSceneRect(QRectF(topLeft, size), update);
 }
 
 void KReportDesignerItemRectBase::setSceneRect(const QRectF& rect, UpdatePropertyFlag update)
 {
     QGraphicsRectItem::setPos(rect.x(), rect.y());
     setRect(0, 0, rect.width(), rect.height());
     if (update == UpdateProperty) {
         item()->setPosition(KReportItemBase::positionFromScene(QPointF(rect.x(), rect.y())));
         item()->setSize(KReportItemBase::sizeFromScene(QSizeF(rect.width(), rect.height())));
     }
     this->update();
 }
 
 void KReportDesignerItemRectBase::mousePressEvent(QGraphicsSceneMouseEvent * event)
 {
     //Update and show properties
     item()->setPosition(KReportItemBase::positionFromScene(QPointF(sceneRect().x(), sceneRect().y())));
     designer()->changeSet(item()->propertySet());
     setSelected(true);
     scene()->update();
 
     QGraphicsItem::mousePressEvent(event);
 }
 
 void KReportDesignerItemRectBase::mouseReleaseEvent(QGraphicsSceneMouseEvent * event)
 {
     //Keep the size and position in sync
     item()->setPosition(KReportItemBase::positionFromScene(pos()));
     item()->setSize(KReportItemBase::sizeFromScene(QSizeF(rect().width(), rect().height())));
 
     QGraphicsItem::mouseReleaseEvent(event);
 }
 
 void KReportDesignerItemRectBase::mouseMoveEvent(QGraphicsSceneMouseEvent * event)
 {
     //kreportDebug() << m_grabAction;
 
     qreal w, h;
 
     KReportDesignerSectionScene *section = qobject_cast(scene());
     if (!section) {
         return;
     }
     
     QPointF p  = section->gridPoint(event->scenePos());
     w = p.x() - scenePos().x();
     h = p.y() - scenePos().y();
 
     //! @todo use an enum for the directions
 
     switch (d->grabAction) {
     case 1:
         if (sceneRect().y() - p.y() + rect().height() > 0 && sceneRect().x() - p.x() + rect().width() >= 0)
             setSceneRect(QPointF(p.x(), p.y()), QSizeF(sceneRect().x() - p.x() + rect().width(), sceneRect().y() - p.y() + rect().height()));
         break;
     case 2:
         if (sceneRect().y() - p.y() + rect().height() >= 0)
             setSceneRect(QPointF(sceneRect().x(), p.y()), QSizeF(rect().width(), sceneRect().y() - p.y() + rect().height()));
         break;
     case 3:
         if (sceneRect().y() - p.y() + rect().height() >= 0 && w >= 0)
             setSceneRect(QPointF(sceneRect().x(), p.y()), QSizeF(w, sceneRect().y() - p.y() + rect().height()));
         break;
     case 4:
         if (w >= 0)
             setSceneRect(QPointF(sceneRect().x(), sceneRect().y()), QSizeF(w, (rect().height())));
         break;
     case 5:
         if (h >= 0 && w >= 0)
             setSceneRect(QPointF(sceneRect().x(), sceneRect().y()), QSizeF(w, h));
         break;
     case 6:
         if (h >= 0)
             setSceneRect(QPointF(sceneRect().x(), sceneRect().y()), QSizeF((rect().width()), h));
         break;
     case 7:
         if (sceneRect().x() - p.x() + rect().width() >= 0 && h >= 0)
             setSceneRect(QPointF(p.x(), sceneRect().y()), QSizeF(sceneRect().x() - p.x() + rect().width(), h));
         break;
     case 8:
         if (sceneRect().x() - p.x() + rect().width() >= 0)
             setSceneRect(QPointF(p.x(), sceneRect().y()), QSizeF(sceneRect().x() - p.x() + rect().width(), rect().height()));
         break;
     default:
         QGraphicsItem::mouseMoveEvent(event);
     }
 }
 
 void KReportDesignerItemRectBase::hoverMoveEvent(QGraphicsSceneHoverEvent * event)
 {
     //m_grabAction = 0;
 
     if (isSelected()) {
         d->grabAction = grabHandle(event->pos());
         switch (d->grabAction) {
         case 1:
             setCursor(Qt::SizeFDiagCursor);
             break;
         case 2:
             setCursor(Qt::SizeVerCursor);
             break;
         case 3:
             setCursor(Qt::SizeBDiagCursor);
             break;
         case 4:
             setCursor(Qt::SizeHorCursor);
             break;
         case 5:
             setCursor(Qt::SizeFDiagCursor);
             break;
         case 6:
             setCursor(Qt::SizeVerCursor);
             break;
         case 7:
             setCursor(Qt::SizeBDiagCursor);
             break;
         case 8:
             setCursor(Qt::SizeHorCursor);
             break;
         default:
             unsetCursor();
         }
     }
     //kreportDebug() << m_grabAction;
 }
 
 void KReportDesignerItemRectBase::drawHandles(QPainter *painter)
 {
     if (isSelected()) {
         // draw a selected border for visual purposes
         painter->setPen(QPen(QColor(128, 128, 255), 0, Qt::DotLine));
 
         painter->drawRect(rect());
 
         const QRectF r = rect();
         double halfW = (r.width() / 2);
         double halfH = (r.height() / 2);
         QPointF center = r.center();
 
         center += QPointF(0.75,0.75);
 
         painter->fillRect(center.x() - halfW, center.y() - halfH , 5, 5, QColor(128, 128, 255));
         painter->fillRect(center.x() - 2, center.y() - halfH , 5, 5, QColor(128, 128, 255));
         painter->fillRect(center.x() + halfW - 4, center.y() - halfH, 5, 5, QColor(128, 128, 255));
 
         painter->fillRect(center.x() + (halfW - 4), center.y() - 2, 5, 5, QColor(128, 128, 255));
 
         painter->fillRect(center.x() +  halfW - 4 , center.y() + halfH - 4 , 5, 5, QColor(128, 128, 255));
         painter->fillRect(center.x() - 2, center.y() + halfH - 4, 5, 5, QColor(128, 128, 255));
         painter->fillRect(center.x() - halfW, center.y() + halfH - 4 , 5, 5, QColor(128, 128, 255));
 
         painter->fillRect(center.x() - halfW, center.y() - 2, 5, 5, QColor(128, 128, 255));
 
     }
 }
 
 /**
  @return 1 2 3
   8 0 4
   7 6 5
 */
-int KReportDesignerItemRectBase::grabHandle(QPointF pos)
+int KReportDesignerItemRectBase::grabHandle(const QPointF &pos)
 {
     QRectF r = boundingRect();
     int halfW = (int)(r.width() / 2);
     int halfH = (int)(r.height() / 2);
     QPointF center = r.center();
 
     if (QRectF(center.x() - (halfW), center.y() - (halfH), 5, 5).contains(pos)) {
         // we are over the top-left handle
         return 1;
     } else if (QRectF(center.x() - 2, center.y() - (halfH), 5, 5).contains(pos)) {
         // top-middle handle
         return 2;
     } else if (QRectF(center.x() + (halfW - 4), center.y() - (halfH), 5, 5).contains(pos)) {
         // top-right
         return 3;
     } else if (QRectF(center.x() + (halfW - 4), center.y() - 2, 5, 5).contains(pos)) {
         // middle-right
         return 4;
     } else if (QRectF(center.x() + (halfW - 4), center.y() + (halfH - 4), 5, 5).contains(pos)) {
         // bottom-left
         return 5;
     } else if (QRectF(center.x() - 2, center.y() + (halfH - 4), 5, 5).contains(pos)) {
         // bottom-middle
         return 6;
     } else if (QRectF(center.x() - (halfW), center.y() + (halfH - 4), 5, 5).contains(pos)) {
         // bottom-right
         return 7;
     } else if (QRectF(center.x() - (halfW), center.y() - 2, 5, 5).contains(pos)) {
         // middle-right
         return 8;
     }
     return 0;
 }
 
 QVariant KReportDesignerItemRectBase::itemChange(GraphicsItemChange change, const QVariant &value)
 {
     KReportDesignerSectionScene *section = qobject_cast(scene());
     if (section) {
             
         if (change == ItemPositionChange) {
             QPointF newPos = value.toPointF();
             
             newPos = section->gridPoint(newPos);
             if (newPos.x() < 0)
                 newPos.setX(0);
             else if (newPos.x() > (scene()->width() - rect().width()))
                 newPos.setX(scene()->width() - rect().width());
 
             if (newPos.y() < 0)
                 newPos.setY(0);
             else if (newPos.y() > (scene()->height() - rect().height()))
                 newPos.setY(scene()->height() - rect().height());
 
             return newPos;
         } else if (change == ItemPositionHasChanged) {
             item()->setPosition(KReportItemBase::positionFromScene(value.toPointF()));
             //TODO dont update property
             //m_ppos->setScenePos(value.toPointF(), KReportPosition::DontUpdateProperty);
         } else if (change == ItemSceneHasChanged && item()) {
             QPointF newPos = pos();
 
             newPos = section->gridPoint(newPos);
             if (newPos.x() < 0)
                 newPos.setX(0);
             else if (newPos.x() > (scene()->width() - rect().width()))
                 newPos.setX(scene()->width() - rect().width());
 
             if (newPos.y() < 0)
                 newPos.setY(0);
             else if (newPos.y() > (scene()->height() - rect().height()))
                 newPos.setY(scene()->height() - rect().height());
 
             setSceneRect(newPos, KReportItemBase::sceneSize(item()->size()), KReportDesignerItemRectBase::DontUpdateProperty);
         }
     }
     return QGraphicsItem::itemChange(change, value);
 }
 
 void KReportDesignerItemRectBase::propertyChanged(const KPropertySet &s, const KProperty &p)
 {
     Q_UNUSED(s)
     Q_UNUSED(p)
 #if 0
     if (p.name() == "position") {
         item()->setPosition(item()->unit().convertToPoint(p.value().toPointF())); //TODO dont update property
     } else if (p.name() == "size") {
         item()->setSize(item()->unit().convertToPoint(p.value().toSizeF())); //TODO dont update property
     }
 #endif
     setSceneRect(KReportItemBase::scenePosition(item()->position()), KReportItemBase::sceneSize(item()->size()), DontUpdateProperty);
 }
 
 void KReportDesignerItemRectBase::move(const QPointF& /*m*/)
 {
 //! @todo
 }
 
 QPointF KReportDesignerItemRectBase::properPressPoint(const KReportDesigner &d) const
 {
     const QPointF pressPoint = d.getPressPoint();
     const QPointF releasePoint = d.getReleasePoint();
     if (releasePoint.x() < pressPoint.x() && releasePoint.y() < pressPoint.y()) {
         return releasePoint;
     }
     if (releasePoint.x() < pressPoint.x() && releasePoint.y() > pressPoint.y()) {
         return QPointF(releasePoint.x(), pressPoint.y());
     }
     if (releasePoint.x() > pressPoint.x() && releasePoint.y() < pressPoint.y()) {
         return QPointF(pressPoint.x(), releasePoint.y());
     }
     return QPointF(pressPoint);
 }
 
 QRectF KReportDesignerItemRectBase::properRect(const KReportDesigner &d, qreal minWidth, qreal minHeight) const
 {
     QPointF tempPressPoint = properPressPoint(d);
     qreal currentPressX = tempPressPoint.x();
     qreal currentPressY = tempPressPoint.y();
     const qreal width = qMax(d.countSelectionWidth(), minWidth);
     const qreal height = qMax(d.countSelectionHeight(), minHeight);
 
     qreal tempReleasePointX = tempPressPoint.x() + width;
     qreal tempReleasePointY = tempPressPoint.y() + height;
 
     if (tempReleasePointX > scene()->width()) {
         int offsetWidth = tempReleasePointX - scene()->width();
         currentPressX = tempPressPoint.x() - offsetWidth;
     }
     if (tempReleasePointY > scene()->height()) {
         int offsetHeight = tempReleasePointY - scene()->height();
         currentPressY = tempPressPoint.y() - offsetHeight;
     }
     return (QRectF(QPointF(currentPressX, currentPressY), QSizeF(width, height)));
 }
 
 void KReportDesignerItemRectBase::enterInlineEditingMode()
 {
 }
 
 void KReportDesignerItemRectBase::exitInlineEditingMode()
 {
 }
 
 void KReportDesignerItemBase::updateRenderText(const QString &itemDataSource, const QString &itemStaticValue, const QString &itemType)
 {
     if (itemDataSource.isEmpty()) {
         if (itemType.isEmpty()) {
             setRenderText(itemStaticValue);
         } else {
             setRenderText(dataSourceAndObjectTypeName(itemStaticValue, itemType));
         }
     } else {
         if (itemType.isEmpty()) {
             setRenderText(itemDataSource);
         } else {
             setRenderText(dataSourceAndObjectTypeName(itemDataSource, itemType));
         }
     }
 }
diff --git a/src/wrtembed/KReportDesignerItemRectBase.h b/src/wrtembed/KReportDesignerItemRectBase.h
index 4c8d1907..182e12a8 100644
--- a/src/wrtembed/KReportDesignerItemRectBase.h
+++ b/src/wrtembed/KReportDesignerItemRectBase.h
@@ -1,83 +1,83 @@
 /* This file is part of the KDE project
 
  * Copyright (C) 2001-2007 by OpenMFG, LLC (info@openmfg.com)
  * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 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
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library.  If not, see .
  */
 
 #ifndef KREPORTDESIGNERITEMRECTBASE_H
 #define KREPORTDESIGNERITEMRECTBASE_H
 
 #include 
 
 #include "KReportDesignerItemBase.h"
 #include "kreport_export.h"
 
 class KReportDesigner;
 class KReportPosition;
 class KReportSize;
 
 class KPropertySet;
 
 const int KREPORT_ITEM_RECT_DEFAULT_WIDTH = 100;
 const int KREPORT_ITEM_RECT_DEFAULT_HEIGHT = 100;
 
 /**
 */
 class KREPORT_EXPORT KReportDesignerItemRectBase : public QGraphicsRectItem, public KReportDesignerItemBase
 {
 public:
     explicit KReportDesignerItemRectBase(KReportDesigner *r, KReportItemBase *b);
 
-    virtual ~KReportDesignerItemRectBase();
+    ~KReportDesignerItemRectBase() override;
 
     QRectF pointRect() const;
 
     virtual void enterInlineEditingMode();
     virtual void exitInlineEditingMode();
 
 protected:
     int m_dpiX;
     int m_dpiY;
 
     enum UpdatePropertyFlag {
         UpdateProperty,
         DontUpdateProperty
     };
 
     void setSceneRect(const QPointF& topLeft, const QSizeF& size, UpdatePropertyFlag update = UpdateProperty);
     void setSceneRect(const QRectF& rect, UpdatePropertyFlag update = UpdateProperty);
 
     void drawHandles(QPainter*);
     QRectF sceneRect();
-    virtual void mousePressEvent(QGraphicsSceneMouseEvent * event);
-    virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent * event);
-    virtual void mouseMoveEvent(QGraphicsSceneMouseEvent * event);
-    virtual void hoverMoveEvent(QGraphicsSceneHoverEvent * event);
-    virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value);
+    void mousePressEvent(QGraphicsSceneMouseEvent * event) override;
+    void mouseReleaseEvent(QGraphicsSceneMouseEvent * event) override;
+    void mouseMoveEvent(QGraphicsSceneMouseEvent * event) override;
+    void hoverMoveEvent(QGraphicsSceneHoverEvent * event) override;
+    QVariant itemChange(GraphicsItemChange change, const QVariant &value) override;
 
     void propertyChanged(const KPropertySet &s, const KProperty &p);
 
-    virtual void move(const QPointF&);
+    void move(const QPointF&) override;
     QRectF properRect(const KReportDesigner &d, qreal minWidth, qreal minHeight) const;
 private:
-    int grabHandle(QPointF);
+    int grabHandle(const QPointF &pos);
     QPointF properPressPoint(const KReportDesigner &d) const;
 
     class Private;
     Private * const d;
 };
 
 #endif
diff --git a/src/wrtembed/KReportDesignerSection.cpp b/src/wrtembed/KReportDesignerSection.cpp
index d8a6d9e0..62360b1e 100644
--- a/src/wrtembed/KReportDesignerSection.cpp
+++ b/src/wrtembed/KReportDesignerSection.cpp
@@ -1,429 +1,429 @@
 /* This file is part of the KDE project
  * Copyright (C) 2001-2007 by OpenMFG, LLC (info@openmfg.com)
  * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
  * Copyright (C) 2014 Jarosław Staniek 
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 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
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library.  If not, see .
  */
 
 #include "KReportDesignerSection.h"
 
 #include "KReportDesignerSectionScene.h"
 #include "KReportDesignerSectionView.h"
 #include "KReportDesigner.h"
 #include "KReportDesignerItemBase.h"
 #include "KReportUtils.h"
 #include "KReportPluginInterface.h"
 #include "KReportPluginManager.h"
 #include "KReportDesignerItemRectBase.h"
 #include "KReportDesignerItemLine.h"
 #include "KReportRuler_p.h"
 #include "KReportZoomHandler_p.h"
 #include "KReportUtils_p.h"
 #include "KReportPluginMetaData.h"
 #include "kreport_debug.h"
 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 
 
 //! @internal
 class ReportResizeBar : public QFrame
 {
     Q_OBJECT
 public:
-    explicit ReportResizeBar(QWidget * parent = 0, Qt::WindowFlags f = 0);
+    explicit ReportResizeBar(QWidget * parent = nullptr, Qt::WindowFlags f = nullptr);
 
 Q_SIGNALS:
     void barDragged(int delta);
 
 protected:
-    void mouseMoveEvent(QMouseEvent * e);
+    void mouseMoveEvent(QMouseEvent * e) override;
 };
 
 //! @internal
 class KReportDesignerSectionTitle : public QLabel
 {
     Q_OBJECT
 public:
-    explicit KReportDesignerSectionTitle(QWidget *parent = 0);
-    ~KReportDesignerSectionTitle();
+    explicit KReportDesignerSectionTitle(QWidget *parent = nullptr);
+    ~KReportDesignerSectionTitle() override;
 
 Q_SIGNALS:
     void clicked();
 
 protected:
-    virtual void paintEvent(QPaintEvent* event);
-    virtual void mousePressEvent(QMouseEvent *event);
+    void paintEvent(QPaintEvent* event) override;
+    void mousePressEvent(QMouseEvent *event) override;
 };
 
 //! @internal
 class Q_DECL_HIDDEN KReportDesignerSection::Private
 {
 public:
     explicit Private()
     {}
 
     ~Private()
     {}
 
     KReportDesignerSectionTitle *title;
     KReportDesignerSectionScene *scene;
     ReportResizeBar *resizeBar;
     KReportDesignerSectionView *sceneView;
     KReportDesigner*reportDesigner;
     KReportRuler *sectionRuler;
 
     KReportSectionData *sectionData;
     int dpiY;
 };
 
 
 KReportDesignerSection::KReportDesignerSection(KReportDesigner * rptdes,
                                                const KReportZoomHandler &zoomHandler)
         : QWidget(rptdes)
         , d(new Private())
 {
     Q_ASSERT(rptdes);
     d->sectionData = new KReportSectionData(this);
     connect(d->sectionData->propertySet(), SIGNAL(propertyChanged(KPropertySet&,KProperty&)),
             this, SLOT(slotPropertyChanged(KPropertySet&,KProperty&)));
 
     d->dpiY = KReportPrivate::dpiY();
 
     d->reportDesigner = rptdes;
     setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
 
     QGridLayout * glayout = new QGridLayout(this);
     glayout->setSpacing(0);
     glayout->setMargin(0);
     glayout->setColumnStretch(1, 1);
     glayout->setRowStretch(1, 1);
     glayout->setSizeConstraint(QLayout::SetFixedSize);
 
     // ok create the base interface
     d->title = new KReportDesignerSectionTitle(this);
     d->title->setObjectName(QLatin1String("detail"));
     d->title->setText(tr("Detail"));
 
     d->sectionRuler = new KReportRuler(this, Qt::Vertical, zoomHandler);
     d->sectionRuler->setUnit(d->reportDesigner->pageUnit());
     d->scene = new KReportDesignerSectionScene(d->reportDesigner->pageWidthPx(), d->dpiY, rptdes);
     d->scene->setBackgroundBrush(d->sectionData->backgroundColor());
     
     d->sceneView = new KReportDesignerSectionView(rptdes, d->scene, this);
     d->sceneView->setObjectName(QLatin1String("scene view"));
     d->sceneView->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
 
     d->resizeBar = new ReportResizeBar(this);
 
     connect(d->resizeBar, SIGNAL(barDragged(int)), this, SLOT(slotResizeBarDragged(int)));
     connect(d->reportDesigner, SIGNAL(pagePropertyChanged(KPropertySet&)),
         this, SLOT(slotPageOptionsChanged(KPropertySet&)));
     connect(d->scene, SIGNAL(clicked()), this, (SLOT(slotSceneClicked())));
     connect(d->scene, SIGNAL(lostFocus()), d->title, SLOT(update()));
     connect(d->title, SIGNAL(clicked()), this, (SLOT(slotSceneClicked())));
 
     glayout->addWidget(d->title, 0, 0, 1, 2);
     glayout->addWidget(d->sectionRuler, 1, 0);
     glayout->addWidget(d->sceneView , 1, 1);
     glayout->addWidget(d->resizeBar, 2, 0, 1, 2);
     d->sectionRuler->setFixedWidth(d->sectionRuler->sizeHint().width());
 
     setLayout(glayout);
     slotResizeBarDragged(0);
 }
 
 KReportDesignerSection::~KReportDesignerSection()
 {
     delete d;
 }
 
 void KReportDesignerSection::setTitle(const QString & s)
 {
     d->title->setText(s);
 }
 
 void KReportDesignerSection::slotResizeBarDragged(int delta)
 {
     if (d->sceneView->designer() && d->sceneView->designer()->propertySet()->property("page-size").value().toString() == QLatin1String("Labels")) {
         return; // we don't want to allow this on reports that are for labels
     }
     slotSceneClicked(); // switches property set to this section
 
     qreal h = d->scene->height() + delta;
 
     if (h < 1) h = 1;
 
     h = d->scene->gridPoint(QPointF(0, h)).y();
     d->sectionData->m_height->setValue(INCH_TO_POINT(h/d->dpiY));
     d->sectionRuler->setRulerLength(h);
 
     d->scene->setSceneRect(0, 0, d->scene->width(), h);
     d->sceneView->resizeContents(QSize(d->scene->width(), h));
 
     d->reportDesigner->setModified(true);
 }
 
 void KReportDesignerSection::buildXML(QDomDocument *doc, QDomElement *section)
 {
     KReportUtils::setAttribute(section, QLatin1String("svg:height"), d->sectionData->m_height->value().toDouble());
     section->setAttribute(QLatin1String("fo:background-color"), d->sectionData->backgroundColor().name());
 
     // now get a list of all the QGraphicsItems on this scene and output them.
     QGraphicsItemList list = d->scene->items();
     for (QGraphicsItemList::iterator it = list.begin();
             it != list.end(); ++it) {
         KReportDesignerItemBase::buildXML((*it), doc, section);
     }
 }
 
 void KReportDesignerSection::initFromXML(const QDomNode & section)
 {
     QDomNodeList nl = section.childNodes();
     QDomNode node;
     QString n;
 
     qreal h = KReportUnit::parseValue(section.toElement().attribute(QLatin1String("svg:height"), QLatin1String("2.0cm")));
     d->sectionData->m_height->setValue(h);
 
     h  = POINT_TO_INCH(h) * d->dpiY;
     //kreportDebug() << "Section Height: " << h;
     d->scene->setSceneRect(0, 0, d->scene->width(), h);
     slotResizeBarDragged(0);
 
     d->sectionData->m_backgroundColor->setValue(QColor(section.toElement().attribute(QLatin1String("fo:background-color"), QLatin1String("#ffffff"))));
 
     for (int i = 0; i < nl.count(); ++i) {
         node = nl.item(i);
         n = node.nodeName();
         if (n.startsWith(QLatin1String("report:"))) {
             //Load objects
             //report:line is a special case as it is not a plugin
             QString reportItemName = n.mid(qstrlen("report:"));
             if (reportItemName == QLatin1String("line")) {
                 (new KReportDesignerItemLine(node, d->sceneView->designer(), d->scene))->setVisible(true);
                 continue;
             }
             KReportPluginManager* manager = KReportPluginManager::self();
             KReportPluginInterface *plugin = manager->plugin(reportItemName);
             if (plugin) {
                 QObject *obj = plugin->createDesignerInstance(node, d->reportDesigner, d->scene);
                 if (obj) {
                     KReportDesignerItemRectBase *entity = dynamic_cast(obj);
                     if (entity) {
                         entity->setVisible(true);
                     }
                     KReportItemBase *item = dynamic_cast(obj);
                     if (item) {
                         item->setUnit(d->reportDesigner->pageUnit());
                         KReportDesigner::addMetaProperties(item->propertySet(),
                                                            plugin->metaData()->name(),
                                                            plugin->metaData()->iconName());
                     }
                     continue;
                 }
             }
         }
         kreportWarning() << "Encountered unknown node while parsing section: " << n;
     }
 }
 
 QSize KReportDesignerSection::sizeHint() const
 {
     return QSize(d->scene->width()  + d->sectionRuler->frameSize().width(), d->title->frameSize().height() + d->sceneView->sizeHint().height() + d->resizeBar->frameSize().height());
 }
 
 void KReportDesignerSection::slotPageOptionsChanged(KPropertySet &set)
 {
     Q_UNUSED(set)
 
     KReportUnit unit = d->reportDesigner->pageUnit();
 
     d->sectionData->m_height->setOption("unit", unit.symbol());
 
     //update items position with unit
     QList itms = d->scene->items();
     for (int i = 0; i < itms.size(); ++i) {
         KReportItemBase *obj = dynamic_cast(itms[i]);
         if (obj) {
             obj->setUnit(unit);
         }
     }
 
     d->scene->setSceneRect(0, 0, d->reportDesigner->pageWidthPx(), d->scene->height());
     d->title->setMinimumWidth(d->reportDesigner->pageWidthPx() + d->sectionRuler->frameSize().width());
     d->sectionRuler->setUnit(d->reportDesigner->pageUnit());
 
     //Trigger a redraw of the background
     d->sceneView->resetCachedContent();
 
     d->reportDesigner->adjustSize();
     d->reportDesigner->repaint();
 
     slotResizeBarDragged(0);
 }
 
 void KReportDesignerSection::slotSceneClicked()
 {
     d->reportDesigner->setActiveScene(d->scene);
     d->reportDesigner->changeSet(d->sectionData->propertySet());
 }
 
 void KReportDesignerSection::slotPropertyChanged(KPropertySet &s, KProperty &p)
 {
     Q_UNUSED(s)
     //kreportDebug() << p.name();
 
     //Handle Background Color
     if (p.name() == "background-color") {
         d->scene->setBackgroundBrush(p.value().value());
     }
 
     if (p.name() == "height") {
     d->scene->setSceneRect(0, 0, d->scene->width(), POINT_TO_INCH(p.value().toDouble()) * d->dpiY);
     slotResizeBarDragged(0);
     }
 
     if (d->reportDesigner)
         d->reportDesigner->setModified(true);
 
     d->sceneView->resetCachedContent();
     d->scene->update();
 }
 
 void KReportDesignerSection::setSectionCursor(const QCursor& c)
 {
     if (d->sceneView)
         d->sceneView->setCursor(c);
 }
 
 void KReportDesignerSection::unsetSectionCursor()
 {
     if (d->sceneView)
         d->sceneView->unsetCursor();
 }
 
 QGraphicsItemList KReportDesignerSection::items() const
 {
     QGraphicsItemList items;
 
     if (d->scene) {
         foreach (QGraphicsItem *itm, d->scene->items()) {
-            if (itm->parentItem() == 0) {
+            if (itm->parentItem() == nullptr) {
                 items << itm;
             }
         }
     }
 
     return items;
 }
 
 
 //
 // class ReportResizeBar
 //
 ReportResizeBar::ReportResizeBar(QWidget * parent, Qt::WindowFlags f)
         : QFrame(parent, f)
 {
     setCursor(QCursor(Qt::SizeVerCursor));
     setFrameStyle(QFrame::HLine);
     setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
 }
 
 void ReportResizeBar::mouseMoveEvent(QMouseEvent * e)
 {
     e->accept();
     emit barDragged(e->y());
 }
 
 //=============================================================================
 
 KReportDesignerSectionTitle::KReportDesignerSectionTitle(QWidget*parent) : QLabel(parent)
 {
     setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
     setAlignment(Qt::AlignLeft | Qt::AlignTop);
     setMinimumHeight(qMax(fontMetrics().lineSpacing(),16 + 2)); //16 = Small icon size
 }
 
 KReportDesignerSectionTitle::~KReportDesignerSectionTitle()
 {
 }
 
 //! \return true if \a o has parent \a par.
 static bool hasParent(QObject* par, QObject* o)
 {
     if (!o || !par)
         return false;
     while (o && o != par)
         o = o->parent();
     return o == par;
 }
 
 static void replaceColors(QPixmap* original, const QColor& color)
 {
     QImage dest(original->toImage());
     QPainter p(&dest);
     p.setCompositionMode(QPainter::CompositionMode_SourceIn);
     p.fillRect(dest.rect(), color);
     *original = QPixmap::fromImage(dest);
 }
 
 void KReportDesignerSectionTitle::paintEvent(QPaintEvent * event)
 {
     QPainter painter(this);
     KReportDesignerSection* section = dynamic_cast(parent());
     if (section) {
         const bool current = section->d->scene == section->d->reportDesigner->activeScene();
         QPalette::ColorGroup cg = QPalette::Inactive;
         QWidget *activeWindow = QApplication::activeWindow();
         if (activeWindow) {
             QWidget *par = activeWindow->focusWidget();
             if (qobject_cast(par)) {
                 par = par->parentWidget(); // we're close, pick common parent
             }
             if (hasParent(par, this)) {
                 cg = QPalette::Active;
             }
         }
         if (current) {
             painter.fillRect(rect(), palette().brush(cg, QPalette::Highlight));
         }
         painter.setPen(palette().color(cg, current ? QPalette::HighlightedText : QPalette::WindowText));
         QPixmap pixmap(QIcon::fromTheme(QLatin1String("arrow-down")).pixmap(16,16));
         replaceColors(&pixmap, painter.pen().color());
         const int left = 25;
         painter.drawPixmap(QPoint(left, (height() - pixmap.height()) / 2), pixmap);
 
         painter.drawText(rect().adjusted(left + pixmap.width() + 4, 0, 0, 0), Qt::AlignLeft | Qt::AlignVCenter, text());
     }
     QFrame::paintEvent(event);
 }
 
 void KReportDesignerSectionTitle::mousePressEvent(QMouseEvent *event)
 {
     QLabel::mousePressEvent(event);
     if (event->button() == Qt::LeftButton) {
         emit clicked();
     }
 }
 
 #include "KReportDesignerSection.moc"
diff --git a/src/wrtembed/KReportDesignerSection.h b/src/wrtembed/KReportDesignerSection.h
index 028f1efc..45ab8130 100644
--- a/src/wrtembed/KReportDesignerSection.h
+++ b/src/wrtembed/KReportDesignerSection.h
@@ -1,91 +1,91 @@
 /* This file is part of the KDE project
  * Copyright (C) 2001-2007 by OpenMFG, LLC (info@openmfg.com)
  * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
  * Copyright (C) 2014 Jarosław Staniek 
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 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
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library.  If not, see .
  */
 
 #ifndef __REPORTSECTION_H__
 #define __REPORTSECTION_H__
 
 #include 
 
 #include "kreport_export.h"
 
 // forward declarations
 class QDomNode;
 class QDomDocument;
 class QDomElement;
 class QGraphicsItem;
 typedef QList QGraphicsItemList;
 
 class KPropertySet;
 class KProperty;
 
 class KReportDesigner;
 class KReportZoomHandler;
 
 //
 // Class ReportSection
 //
 //     This class is the base to all Report Section's visual representation.
 // It contains the basic data and interface that all the sections need to work.
 //
 class KREPORT_EXPORT KReportDesignerSection : public QWidget
 {
     Q_OBJECT
 public:
-    virtual ~KReportDesignerSection();
+    ~KReportDesignerSection() override;
 
     void setTitle(const QString & s);
     void buildXML(QDomDocument *doc, QDomElement *section);
     void initFromXML(const QDomNode & section);
-    virtual QSize sizeHint() const;
+    QSize sizeHint() const override;
 
     /**
      * @brief Return the items in the section
      * Only return top-level items ... ie, items with no parent item
      * because child items are not full report-items, they are implementation
      * details of a report item and do not need to be counted individually
      *
      * @return QGraphicsItemList
      */
     QGraphicsItemList items() const;
 
     void setSectionCursor(const QCursor&);
     void unsetSectionCursor();
 
 protected Q_SLOTS:
     void slotResizeBarDragged(int delta);
 
 protected:
     explicit KReportDesignerSection(KReportDesigner * rptdes,
                                     const KReportZoomHandler &zoomHandler);
 
 private Q_SLOTS:
     void slotPageOptionsChanged(KPropertySet &);
     void slotSceneClicked();
     void slotPropertyChanged(KPropertySet &, KProperty &);
 
 private:
     Q_DISABLE_COPY(KReportDesignerSection)
     class Private;
     Private * const d;
     friend class KReportDesigner;
     friend class KReportDesignerSectionTitle;
 };
 
 #endif
 
diff --git a/src/wrtembed/KReportDesignerSectionDetail.h b/src/wrtembed/KReportDesignerSectionDetail.h
index be67ef17..af0b2c13 100644
--- a/src/wrtembed/KReportDesignerSectionDetail.h
+++ b/src/wrtembed/KReportDesignerSectionDetail.h
@@ -1,74 +1,74 @@
 /* This file is part of the KDE project
  * Copyright (C) 2001-2007 by OpenMFG, LLC (info@openmfg.com)
  * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 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
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library.  If not, see .
  */
 
 #ifndef KREPORTDESIGNERSECTIONDETAIL_H
 #define KREPORTDESIGNERSECTIONDETAIL_H
 
 #include 
 
 #include "kreport_export.h"
 
 class QDomNode;
 class QDomElement;
 class QDomDocument;
 
 class KReportDesignerSection;
 class KReportDesigner;
 class KReportDesignerSectionDetailGroup;
 
 /**
 */
 class KREPORT_EXPORT KReportDesignerSectionDetail : public QWidget
 {
     Q_OBJECT
 public:
     explicit KReportDesignerSectionDetail(KReportDesigner * rptdes);
-    virtual ~KReportDesignerSectionDetail();
+    ~KReportDesignerSectionDetail() override;
 
     enum PageBreak {
         BreakNone = 0,
         BreakAtEnd = 1
     };
 
     void setPageBreak(int);
     int pageBreak() const;
 
     KReportDesignerSection * detailSection() const;
 
     void buildXML(QDomDocument *doc, QDomElement *section);
     void initFromXML(QDomNode *node);
 
     KReportDesigner * reportDesigner() const;
 
     int groupSectionCount() const;
     KReportDesignerSectionDetailGroup * groupSection(int i) const;
     void insertGroupSection(int idx, KReportDesignerSectionDetailGroup * rsd);
     int indexOfGroupSection(const QString & column) const;
     void removeGroupSection(int idx, bool del = false);
-    virtual QSize sizeHint() const;
+    QSize sizeHint() const override;
 
     void setSectionCursor(const QCursor&);
     void unsetSectionCursor();
 
 private:
     Q_DISABLE_COPY(KReportDesignerSectionDetail)
     class Private;
     Private * const d;
 };
 
 #endif
diff --git a/src/wrtembed/KReportDesignerSectionDetailGroup.h b/src/wrtembed/KReportDesignerSectionDetailGroup.h
index 3085ca6e..73a3bfaa 100644
--- a/src/wrtembed/KReportDesignerSectionDetailGroup.h
+++ b/src/wrtembed/KReportDesignerSectionDetailGroup.h
@@ -1,77 +1,78 @@
 /* This file is part of the KDE project
  * Copyright (C) 2001-2007 by OpenMFG, LLC (info@openmfg.com)
  * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 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
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library.  If not, see .
  */
 
 #ifndef KREPORTDESIGNERSECTIONDETAILGROUP_H
 #define KREPORTDESIGNERSECTIONDETAILGROUP_H
 
 #include 
 
 #include "kreport_export.h"
 
 class QDomElement;
 class QDomDocument;
 class QString;
 class QWidget;
 
 class KReportDesignerSection;
 class KReportDesignerSectionDetail;
 
 /**
 */
 class KREPORT_EXPORT KReportDesignerSectionDetailGroup : public QObject
 {
     Q_OBJECT
 public:
-    KReportDesignerSectionDetailGroup(const QString &column, KReportDesignerSectionDetail *, QWidget * parent = 0);
-    ~KReportDesignerSectionDetailGroup();
+    KReportDesignerSectionDetailGroup(const QString &column, KReportDesignerSectionDetail *rsd,
+                                      QWidget *parent = nullptr);
+    ~KReportDesignerSectionDetailGroup() override;
 
     enum PageBreak {
         BreakNone = 0,
         BreakAfterGroupFooter = 1,
         BreakBeforeGroupHeader = 2
     };
 
     void setColumn(const QString &);
     QString column() const;
 
     void setGroupHeaderVisible(bool yes = true);
     bool groupHeaderVisible() const;
 
     void setGroupFooterVisible(bool yes = true);
     bool groupFooterVisible() const;
 
     void setPageBreak(PageBreak);
     PageBreak  pageBreak() const;
 
     void setSort(Qt::SortOrder);
     Qt::SortOrder sort();
 
     KReportDesignerSection * groupHeader() const;
     KReportDesignerSection * groupFooter() const;
 
     void buildXML(QDomDocument *doc, QDomElement *section) const;
     void initFromXML( const QDomElement &element );
 
 private:
     Q_DISABLE_COPY(KReportDesignerSectionDetailGroup)
     class Private;
     Private * const d;
 };
 
 
 #endif
diff --git a/src/wrtembed/KReportDesignerSectionScene.cpp b/src/wrtembed/KReportDesignerSectionScene.cpp
index 9c2d584e..d51d5a03 100644
--- a/src/wrtembed/KReportDesignerSectionScene.cpp
+++ b/src/wrtembed/KReportDesignerSectionScene.cpp
@@ -1,258 +1,258 @@
 /* This file is part of the KDE project
  * Copyright (C) 2001-2007 by OpenMFG, LLC (info@openmfg.com)
  * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 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
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library.  If not, see .
  */
 
 #include "KReportDesignerSectionScene.h"
 #include "KReportDesignerItemRectBase.h"
 #include "KReportDesigner.h"
 #include "KReportLabelSizeInfo.h"
 #include "KReportUtils_p.h"
 #include "kreport_debug.h"
 
 #include 
 #include 
 #include 
 #include 
 
 KReportDesignerSectionScene::KReportDesignerSectionScene(qreal w, qreal h, KReportDesigner *rd)
         : QGraphicsScene(0, 0, w, h, rd), m_rd(rd)
 {
     m_dpiX = KReportPrivate::dpiX();
     m_dpiY = KReportPrivate::dpiY();
 
     if (m_unit.type() != m_rd->pageUnit().type()) {
         m_unit = m_rd->pageUnit();
         if (m_unit.type() == KReportUnit::Cicero ||
             m_unit.type() == KReportUnit::Pica ||
             m_unit.type() == KReportUnit::Millimeter) {
             m_majorX = POINT_TO_INCH(m_unit.fromUserValue(10)) * m_dpiX;
             m_majorY = POINT_TO_INCH(m_unit.fromUserValue(10)) * m_dpiY;
         } else if (m_unit.type() == KReportUnit::Point) {
             m_majorX = POINT_TO_INCH(m_unit.fromUserValue(100)) * m_dpiX;
             m_majorY = POINT_TO_INCH(m_unit.fromUserValue(100)) * m_dpiY;
         } else {
             m_majorX = POINT_TO_INCH(m_unit.fromUserValue(1)) * m_dpiX;
             m_majorY = POINT_TO_INCH(m_unit.fromUserValue(1)) * m_dpiY;
         }
     }
 }
 KReportDesignerSectionScene::~KReportDesignerSectionScene()
 {
     // Qt should be handling everything for us
 }
 
 void KReportDesignerSectionScene::drawBackground(QPainter* painter, const QRectF & clip)
 {
     //Draw the default background colour
     QGraphicsScene::drawBackground(painter, clip);
     painter->setRenderHint(QPainter::Antialiasing, false);
 
     if (m_rd->propertySet()->property("grid-visible").value().toBool()) {
         if (m_unit.type() != m_rd->pageUnit().type()) {
             m_unit = m_rd->pageUnit();
             if (m_unit.type() == KReportUnit::Cicero ||
                 m_unit.type() == KReportUnit::Pica ||
                 m_unit.type() == KReportUnit::Millimeter) {
                 m_majorX = POINT_TO_INCH(m_unit.fromUserValue(10)) * m_dpiX;
                 m_majorY = POINT_TO_INCH(m_unit.fromUserValue(10)) * m_dpiY;
             } else if (m_unit.type() == KReportUnit::Point) {
                 m_majorX = POINT_TO_INCH(m_unit.fromUserValue(100)) * m_dpiX;
                 m_majorY = POINT_TO_INCH(m_unit.fromUserValue(100)) * m_dpiY;
             } else {
                 m_majorX = POINT_TO_INCH(m_unit.fromUserValue(1)) * m_dpiX;
                 m_majorY = POINT_TO_INCH(m_unit.fromUserValue(1)) * m_dpiY;
             }
 
         }
         int minorSteps = m_rd->propertySet()->property("grid-divisions").value().toInt();
         m_pixelIncrementX = (m_majorX / minorSteps);
         m_pixelIncrementY = (m_majorY / minorSteps);
 
         QPen pen = painter->pen();
         painter->setPen(Qt::lightGray);
 
         //kreportDebug() << "dpix" << KReportPrivate::dpiX() << "dpiy" << KReportPrivate::dpiY() << "mayorx:" << majorx << "majory" << majory << "pix:" << pixel_incrementx << "piy:" << pixel_incrementy;
 
         QVector lines;
         QVector points;
 
         if (m_pixelIncrementX > 2) { // do not bother painting points if increments are so small
             int wpoints = qRound(sceneRect().width() / m_pixelIncrementX);
             int hpoints = qRound(sceneRect().height() / m_pixelIncrementY);
             for (int i = 0; i < wpoints; ++i) {
                 for (int j = 0; j < hpoints; ++j) {
                     //if (clip.contains(i * pixel_incrementx, j * pixel_incrementy)){
                     if (i % minorSteps == 0 && j % minorSteps == 0) {
                         lines << QLine(QPoint(i * m_pixelIncrementX, j * m_pixelIncrementY), QPoint(i * m_pixelIncrementX, j * m_pixelIncrementY  + m_majorX));
                         //painter->drawLine();
                         lines << QLine(QPoint(i * m_pixelIncrementX, j * m_pixelIncrementY), QPoint(i * m_pixelIncrementX + m_majorY, j * m_pixelIncrementY));
                         //painter->drawLine();
                     } else {
                         points << QPoint(i * m_pixelIncrementX, j * m_pixelIncrementY);
                         //painter->drawPoint();
                     }
                     //}
                 }
             }
             painter->drawPoints(points);
             painter->drawLines(lines);
 
         }
 
         pen.setWidth(1);
         //update ( clip );
     }
 }
 
 void KReportDesignerSectionScene::mousePressEvent(QGraphicsSceneMouseEvent * e)
 {
     // clear the selection if Shift Key has not been pressed and it's a left mouse button   and
     // if the right mouse button has been pressed over an item which is not part of selected items
     if (((e->modifiers() & Qt::ShiftModifier) == 0 && e->button() == Qt::LeftButton)   ||
             (!(selectedItems().contains(itemAt(e->scenePos(), QTransform()))) && e->button() == Qt::RightButton))
         clearSelection();
 
     //This will be caught by the section to display its properties, if an item is under the cursor then they will display their properties
     QGraphicsItem* itemUnderCursor = itemAt(e->scenePos(), QTransform());
     emit clicked();
     
     KReportDesignerItemRectBase *rectUnderCursor = qgraphicsitem_cast< KReportDesignerItemRectBase* >(itemUnderCursor);
     if (itemUnderCursor && !rectUnderCursor) {
         rectUnderCursor = qgraphicsitem_cast< KReportDesignerItemRectBase* >(itemUnderCursor->parentItem());
     }
     exitInlineEditingModeInItems(rectUnderCursor);
 
     QGraphicsScene::mousePressEvent(e);
 }
 
 void KReportDesignerSectionScene::contextMenuEvent(QGraphicsSceneContextMenuEvent * e)
 {
     m_rd->sectionContextMenuEvent(this, e);
 }
 
 QPointF KReportDesignerSectionScene::gridPoint(const QPointF& p)
 {
     if (!m_rd->propertySet()->property("grid-snap").value().toBool()) {
         return p;
     }
 
     if (m_unit.type() != m_rd->pageUnit().type()) {
         m_unit = m_rd->pageUnit();
         //! @todo Again? Copy&Paste error?
         if (m_unit.type() != m_rd->pageUnit().type()) {
             m_unit = m_rd->pageUnit();
             if (m_unit.type() == KReportUnit::Cicero ||
                 m_unit.type() == KReportUnit::Pica ||
                 m_unit.type() == KReportUnit::Millimeter) {
                 m_majorX = POINT_TO_INCH(m_unit.fromUserValue(10)) * m_dpiX;
                 m_majorY = POINT_TO_INCH(m_unit.fromUserValue(10)) * m_dpiY;
             } else if (m_unit.type() == KReportUnit::Point) {
                 m_majorX = POINT_TO_INCH(m_unit.fromUserValue(100)) * m_dpiX;
                 m_majorY = POINT_TO_INCH(m_unit.fromUserValue(100)) * m_dpiY;
             } else {
                 m_majorX = POINT_TO_INCH(m_unit.fromUserValue(1)) * m_dpiX;
                 m_majorY = POINT_TO_INCH(m_unit.fromUserValue(1)) * m_dpiY;
             }
 
         }
     }
     int minorSteps = m_rd->propertySet()->property("grid-divisions").value().toInt();
     m_pixelIncrementX = (m_majorX / minorSteps);
     m_pixelIncrementY = (m_majorY / minorSteps);
 
     return QPointF(qRound((p.x() / m_pixelIncrementX)) * m_pixelIncrementX, qRound((p.y() / m_pixelIncrementY)) * m_pixelIncrementY);
 }
 
 void KReportDesignerSectionScene::focusOutEvent(QFocusEvent * focusEvent)
 {
-    exitInlineEditingModeInItems(0);
+    exitInlineEditingModeInItems(nullptr);
 
     emit lostFocus();
     QGraphicsScene::focusOutEvent(focusEvent);
 }
 
 qreal KReportDesignerSectionScene::lowestZValue()
 {
     qreal z;
     qreal zz;
     z = 0;
     QGraphicsItemList list = items();
     for (QGraphicsItemList::iterator it = list.begin(); it != list.end(); ++it) {
         zz = (*it)->zValue();
         if (zz < z) {
             z = zz;
         }
 
     }
     return z;
 }
 
 qreal KReportDesignerSectionScene::highestZValue()
 {
     qreal z;
     qreal zz;
     z = 0;
     QGraphicsItemList list = items();
     for (QGraphicsItemList::iterator it = list.begin(); it != list.end(); ++it) {
         zz = (*it)->zValue();
         if (zz > z) {
             z = zz;
         }
     }
     return z;
 }
 
 void KReportDesignerSectionScene::lowerSelected()
 {
     QGraphicsItemList list = selectedItems();
     for (QGraphicsItemList::iterator it = list.begin();
             it != list.end(); ++it) {
         (*it)->setZValue(lowestZValue() - 1);
     }
 }
 
 void KReportDesignerSectionScene::raiseSelected()
 {
     QGraphicsItemList list = selectedItems();
     for (QGraphicsItemList::iterator it = list.begin();
             it != list.end(); ++it) {
         (*it)->setZValue(highestZValue() + 1);
     }
 }
 
 QGraphicsItemList KReportDesignerSectionScene::itemsOrdered() const
 {
     QGraphicsItemList r;
     QGraphicsItemList list = items();
     for (QGraphicsItemList::iterator it = list.begin(); it != list.end(); ++it) {
         for (QGraphicsItemList::iterator rit = r.begin(); rit != r.end(); ++rit) {
 
         }
     }
 
     return r;
 }
 
 void KReportDesignerSectionScene::exitInlineEditingModeInItems(KReportDesignerItemRectBase *rectUnderCursor)
 {
     foreach(QGraphicsItem *it, items()) {
         KReportDesignerItemRectBase *itm = qgraphicsitem_cast< KReportDesignerItemRectBase* >(it);
         if (itm && itm != rectUnderCursor) {
             itm->exitInlineEditingMode();
         }
     }
 }
diff --git a/src/wrtembed/KReportDesignerSectionScene.h b/src/wrtembed/KReportDesignerSectionScene.h
index 38fcd5a5..3219c43c 100644
--- a/src/wrtembed/KReportDesignerSectionScene.h
+++ b/src/wrtembed/KReportDesignerSectionScene.h
@@ -1,81 +1,81 @@
 /* This file is part of the KDE project
  * Copyright (C) 2001-2007 by OpenMFG, LLC (info@openmfg.com)
  * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 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
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library.  If not, see .
  */
 
 //
 // Class ReportCanvas
 //
 //     Overrides the drawForeground() method to do the grid.
 //
 
 #ifndef KREPORTDESIGNERSECTIONSCENE_H
 #define KREPORTDESIGNERSECTIONSCENE_H
 
 #include 
 
 #include "KReportUnit.h"
 
 typedef QList QGraphicsItemList;
 class KReportDesigner;
 class QGraphicsSceneContextMenuEvent;
 class QGraphicsSceneMouseEvent;
 class KReportDesignerItemRectBase;
 
 class KReportDesignerSectionScene : public QGraphicsScene
 {
     Q_OBJECT
 public:
     KReportDesignerSectionScene(qreal w, qreal h, KReportDesigner* rd);
-    virtual ~KReportDesignerSectionScene();
+    ~KReportDesignerSectionScene() override;
     KReportDesigner* document() const {
         return m_rd;
     }
     QPointF gridPoint(const QPointF&);
     void raiseSelected();
     void lowerSelected();
     QGraphicsItemList itemsOrdered() const;
     qreal gridSize() const {
         return m_pixelIncrementX;
     }
 
 protected:
-    virtual void drawBackground(QPainter* painter, const QRectF & clip);
-    virtual void mousePressEvent(QGraphicsSceneMouseEvent * e);
-    virtual void focusOutEvent(QFocusEvent * focusEvent);
-    virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent * contextMenuEvent);
+    void drawBackground(QPainter *painter, const QRectF &clip) override;
+    void mousePressEvent(QGraphicsSceneMouseEvent *e) override;
+    void focusOutEvent(QFocusEvent *focusEvent) override;
+    void contextMenuEvent(QGraphicsSceneContextMenuEvent *contextMenuEvent) override;
 
 Q_SIGNALS:
     void clicked();
     void lostFocus();
 
 private:
     qreal lowestZValue();
     qreal highestZValue();
     void exitInlineEditingModeInItems(KReportDesignerItemRectBase *rectUnderCursor);
 
     KReportDesigner * m_rd;
 
     KReportUnit m_unit;
     qreal m_majorX = 0.0;
     qreal m_majorY = 0.0;
     qreal m_pixelIncrementX = 0.0;
     qreal m_pixelIncrementY = 0.0;
     int m_dpiX;
     int m_dpiY;
 };
 
 #endif
diff --git a/src/wrtembed/KReportDesignerSectionView.h b/src/wrtembed/KReportDesignerSectionView.h
index 74e6a28c..b09ca4df 100644
--- a/src/wrtembed/KReportDesignerSectionView.h
+++ b/src/wrtembed/KReportDesignerSectionView.h
@@ -1,46 +1,47 @@
 /* This file is part of the KDE project
  * Copyright (C) 2001-2007 by OpenMFG, LLC (info@openmfg.com)
  * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 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
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library.  If not, see .
  */
 
 #ifndef KREPORTDESIGNERSECTIONVIEW_H
 #define KREPORTDESIGNERSECTIONVIEW_H
 
 #include 
 
 class KReportDesigner;
 
 class KReportDesignerSectionView : public QGraphicsView
 {
     Q_OBJECT
 public:
-    KReportDesignerSectionView(KReportDesigner *, QGraphicsScene * scene, QWidget * parent = 0);
-    virtual ~KReportDesignerSectionView();
+    KReportDesignerSectionView(KReportDesigner *designer, QGraphicsScene *scene,
+                               QWidget *parent = nullptr);
+    ~KReportDesignerSectionView() override;
 
     KReportDesigner * designer() const;
-    virtual QSize sizeHint() const;
+    QSize sizeHint() const override;
 public Q_SLOTS:
     void resizeContents(const QSize&);
 
 protected:
-    void mousePressEvent(QMouseEvent * e);
-    void mouseReleaseEvent(QMouseEvent * e);
+    void mousePressEvent(QMouseEvent * e) override;
+    void mouseReleaseEvent(QMouseEvent * e) override;
 
 private:
     KReportDesigner* m_reportDesigner;
 };
 
 #endif
diff --git a/src/wrtembed/KReportDetailGroupSectionDialog.h b/src/wrtembed/KReportDetailGroupSectionDialog.h
index b07cee83..ceb7e1df 100644
--- a/src/wrtembed/KReportDetailGroupSectionDialog.h
+++ b/src/wrtembed/KReportDetailGroupSectionDialog.h
@@ -1,35 +1,35 @@
 /* This file is part of the KDE project
  * Copyright (C) 2001-2007 by OpenMFG, LLC (info@openmfg.com)
  * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 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
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library.  If not, see .
  */
 
 #ifndef DETAILGROUPSECTIONDIALOG_H
 #define DETAILGROUPSECTIONDIALOG_H
 
 #include 
 
 #include 
 
 class KReportDetailGroupSectionDialog : public QDialog, public Ui::DetailGroupSectionDialog
 {
     Q_OBJECT
 
 public:
-    explicit KReportDetailGroupSectionDialog(QWidget* parent = 0);
-    ~KReportDetailGroupSectionDialog();
+    explicit KReportDetailGroupSectionDialog(QWidget* parent = nullptr);
+    ~KReportDetailGroupSectionDialog() override;
 };
 
 #endif // DETAILGROUPSECTIONDIALOG_H
diff --git a/src/wrtembed/KReportPropertiesButton.h b/src/wrtembed/KReportPropertiesButton.h
index ce3717cd..9d16eca9 100644
--- a/src/wrtembed/KReportPropertiesButton.h
+++ b/src/wrtembed/KReportPropertiesButton.h
@@ -1,34 +1,34 @@
 /* This file is part of the KDE project
    Copyright (C) 2010 by Adam Pigg (adam@piggz.co.uk)
 
    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.1 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.
 */
 
 #ifndef REPORTPROPERTIESBUTTON_H
 #define REPORTPROPERTIESBUTTON_H
 
 #include 
 
 class KReportPropertiesButton : public QCheckBox
 {
     Q_OBJECT
 public:
     explicit KReportPropertiesButton(QWidget*);
 protected:
-    virtual void paintEvent(QPaintEvent*);
+    void paintEvent(QPaintEvent*) override;
 };
 
 #endif // REPORTPROPERTIESBUTTON_H
diff --git a/src/wrtembed/KReportRuler_p.cpp b/src/wrtembed/KReportRuler_p.cpp
index bbd9d74a..60cc9ea2 100644
--- a/src/wrtembed/KReportRuler_p.cpp
+++ b/src/wrtembed/KReportRuler_p.cpp
@@ -1,1518 +1,1518 @@
 /* This file is part of the KDE project
    Copyright (C) 1998, 1999 Reginald Stadlbauer 
    Copyright (C) 2006 Peter Simonsson 
    Copyright (C) 2007 C. Boemann 
    Copyright (C) 2007-2008 Jan Hambrecht 
    Copyright (C) 2007 Thomas Zander 
 
    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 "KReportRuler_p.h"
 #include "KReportZoomHandler_p.h"
 
 #include 
 #include 
 #include 
 #include 
 
 // the distance in pixels of a mouse position considered outside the rule
 static const int OutsideRulerThreshold = 20;
 //
 static const int fullStepMarkerLength = 6;
 static const int halfStepMarkerLength = 6;
 static const int quarterStepMarkerLength = 3;
 static const int measurementTextAboveBelowMargin = 1;
 
 class RulerTabChooser : public QWidget
 {
 public:
     RulerTabChooser(QWidget *parent) : QWidget(parent), m_type(QTextOption::LeftTab), m_showTabs(false) {}
-    virtual ~RulerTabChooser() {}
+    ~RulerTabChooser() override {}
 
     inline QTextOption::TabType type() {return m_type;}
     void setShowTabs(bool showTabs) { if (m_showTabs == showTabs) return; m_showTabs = showTabs; update(); }
-    void mousePressEvent(QMouseEvent *);
+    void mousePressEvent(QMouseEvent *) override;
 
-    void paintEvent(QPaintEvent *);
+    void paintEvent(QPaintEvent *) override;
 
 private:
     QTextOption::TabType m_type;
     bool m_showTabs :1;
 };
 
 // ----
 
 class PaintingStrategy
 {
 public:
     /// constructor
     PaintingStrategy() {}
     /// destructor
     virtual ~PaintingStrategy() {}
 
     /**
      * Draw the background of the ruler.
      * @param ruler the ruler to draw on.
      * @param painter the painter we can paint with.
      */
     virtual QRectF drawBackground(const KReportRuler::Private *ruler, QPainter *painter) = 0;
 
     /**
      * Draw the indicators for text-tabs.
      * @param ruler the ruler to draw on.
      * @param painter the painter we can paint with.
      */
     virtual void drawTabs(const KReportRuler::Private *ruler, QPainter *painter) = 0;
 
     /**
      * Draw the indicators for the measurements which typically are drawn every [unit].
      * @param ruler the ruler to draw on.
      * @param painter the painter we can paint with.
      * @param rectangle
      */
     virtual void drawMeasurements(const KReportRuler::Private *ruler, QPainter *painter, const QRectF &rectangle) = 0;
 
     /**
      * Draw the indicators for the indents of a text paragraph
      * @param ruler the ruler to draw on.
      * @param painter the painter we can paint with.
      */
     virtual void drawIndents(const KReportRuler::Private *ruler, QPainter *painter) = 0;
 
     /**
      *returns the size suggestion for a ruler with this strategy.
      */
     virtual QSize sizeHint() = 0;
 };
 
 // ----
 
 class HorizontalPaintingStrategy : public PaintingStrategy
 {
 public:
     HorizontalPaintingStrategy() : lengthInPixel(1) {}
 
-    virtual QRectF drawBackground(const KReportRuler::Private *ruler, QPainter *painter);
-    virtual void drawTabs(const KReportRuler::Private *ruler, QPainter *painter);
-    virtual void drawMeasurements(const KReportRuler::Private *ruler, QPainter *painter, const QRectF &rectangle);
-    virtual void drawIndents(const KReportRuler::Private *ruler, QPainter *painter);
-    virtual QSize sizeHint();
+    QRectF drawBackground(const KReportRuler::Private *ruler, QPainter *painter) override;
+    void drawTabs(const KReportRuler::Private *ruler, QPainter *painter) override;
+    void drawMeasurements(const KReportRuler::Private *ruler, QPainter *painter, const QRectF &rectangle) override;
+    void drawIndents(const KReportRuler::Private *ruler, QPainter *painter) override;
+    QSize sizeHint() override;
 
 private:
     qreal lengthInPixel;
 };
 
 // ----
 
 class VerticalPaintingStrategy : public PaintingStrategy
 {
 public:
     VerticalPaintingStrategy() : lengthInPixel(1) {}
 
-    virtual QRectF drawBackground(const KReportRuler::Private *ruler, QPainter *painter);
-    virtual void drawTabs(const KReportRuler::Private *, QPainter *) {}
-    virtual void drawMeasurements(const KReportRuler::Private *ruler, QPainter *painter, const QRectF &rectangle);
-    virtual void drawIndents(const KReportRuler::Private *, QPainter *) { }
-    virtual QSize sizeHint();
+    QRectF drawBackground(const KReportRuler::Private *ruler, QPainter *painter) override;
+    void drawTabs(const KReportRuler::Private *, QPainter *) override {}
+    void drawMeasurements(const KReportRuler::Private *ruler, QPainter *painter, const QRectF &rectangle) override;
+    void drawIndents(const KReportRuler::Private *, QPainter *) override {}
+    QSize sizeHint() override;
 
 private:
     qreal lengthInPixel;
 };
 
 class HorizontalDistancesPaintingStrategy : public HorizontalPaintingStrategy
 {
 public:
     HorizontalDistancesPaintingStrategy() {}
 
-    virtual void drawMeasurements(const KReportRuler::Private *ruler, QPainter *painter, const QRectF &rectangle);
+    void drawMeasurements(const KReportRuler::Private *ruler, QPainter *painter, const QRectF &rectangle) override;
 
 private:
     void drawDistanceLine(const KReportRuler::Private *d, QPainter *painter, qreal start, qreal end);
 };
 
 // ----
 
 class KReportRuler::Private
 {
 public:
     Private(KReportRuler *parent, const KReportZoomHandler &zoomHandler, Qt::Orientation orientation);
     ~Private();
 
     void emitTabChanged();
 
     KReportUnit unit;
     const Qt::Orientation orientation;
     const KReportZoomHandler * const viewConverter;
 
     int offset;
     qreal rulerLength;
     qreal activeRangeStart;
     qreal activeRangeEnd;
     qreal activeOverrideRangeStart;
     qreal activeOverrideRangeEnd;
 
     int mouseCoordinate;
     int showMousePosition;
 
     bool showSelectionBorders;
     qreal firstSelectionBorder;
     qreal secondSelectionBorder;
 
     bool showIndents;
     qreal firstLineIndent;
     qreal paragraphIndent;
     qreal endIndent;
 
     bool showTabs;
     bool relativeTabs;
     bool tabMoved; // set to true on first move of a selected tab
     QList tabs;
     int originalIndex; //index of selected tab before we started dragging it.
     int currentIndex; //index of selected tab or selected HotSpot - only valid when selected indicates tab or hotspot
     KReportRuler::Tab deletedTab;
     qreal tabDistance;
 
     struct HotSpotData {
         qreal position;
         int id;
     };
     QList hotspots;
 
     bool rightToLeft;
     enum Selection {
         None,
         Tab,
         FirstLineIndent,
         ParagraphIndent,
         EndIndent,
         HotSpot
     };
     Selection selected;
     int selectOffset;
 
     QList popupActions;
 
     RulerTabChooser *tabChooser;
 
     // Cached painting strategies
     PaintingStrategy * normalPaintingStrategy;
     PaintingStrategy * distancesPaintingStrategy;
 
     // Current painting strategy
     PaintingStrategy * paintingStrategy;
 
     KReportRuler *ruler;
 
     qreal numberStepForUnit() const;
     /// @return The rounding of value to the nearest multiple of stepValue
     qreal doSnapping(qreal value) const;
-    Selection selectionAtPosition(const QPoint & pos, int *selectOffset = 0);
-    int hotSpotIndex(const QPoint & pos);
+    Selection selectionAtPosition(const QPoint &pos, int *selectOffset = nullptr);
+    int hotSpotIndex(const QPoint &pos);
     qreal effectiveActiveRangeStart() const;
     qreal effectiveActiveRangeEnd() const;
 
     friend class VerticalPaintingStrategy;
     friend class HorizontalPaintingStrategy;
 };
 
 // ----
 
 void RulerTabChooser::mousePressEvent(QMouseEvent *)
 {
     if (! m_showTabs) {
         return;
     }
 
     switch(m_type) {
     case QTextOption::LeftTab:
         m_type = QTextOption::RightTab;
         break;
     case QTextOption::RightTab:
         m_type = QTextOption::CenterTab;
         break;
     case QTextOption::CenterTab:
         m_type = QTextOption::DelimiterTab;
         break;
     case QTextOption::DelimiterTab:
         m_type = QTextOption::LeftTab;
         break;
     }
     update();
 }
 
 void RulerTabChooser::paintEvent(QPaintEvent *)
 {
     if (! m_showTabs) {
         return;
     }
 
     QPainter painter(this);
     QPolygonF polygon;
 
     painter.setPen(palette().color(QPalette::Text));
     painter.setBrush(palette().color(QPalette::Text));
     painter.setRenderHint( QPainter::Antialiasing );
 
     qreal x = qreal(width())/2.0;
     painter.translate(0,-height()/2+5);
 
     switch (m_type) {
     case QTextOption::LeftTab:
         polygon << QPointF(x+0.5, height() - 8.5)
             << QPointF(x+6.5, height() - 2.5)
             << QPointF(x+0.5, height() - 2.5);
         painter.drawPolygon(polygon);
         break;
     case QTextOption::RightTab:
         polygon << QPointF(x+0.5, height() - 8.5)
             << QPointF(x-5.5, height() - 2.5)
             << QPointF(x+0.5, height() - 2.5);
         painter.drawPolygon(polygon);
         break;
     case QTextOption::CenterTab:
         polygon << QPointF(x+0.5, height() - 8.5)
             << QPointF(x-5.5, height() - 2.5)
             << QPointF(x+6.5, height() - 2.5);
         painter.drawPolygon(polygon);
         break;
     case QTextOption::DelimiterTab:
         polygon << QPointF(x-5.5, height() - 2.5)
             << QPointF(x+6.5, height() - 2.5);
         painter.drawPolyline(polygon);
         polygon << QPointF(x+0.5, height() - 2.5)
             << QPointF(x+0.5, height() - 8.5);
         painter.drawPolyline(polygon);
         break;
     default:
         break;
     }
 }
 
 static int compareTabs(const KReportRuler::Tab &tab1, const KReportRuler::Tab &tab2)
 {
     return tab1.position < tab2.position;
 }
 
 QRectF HorizontalPaintingStrategy::drawBackground(const KReportRuler::Private *d, QPainter *painter)
 {
     lengthInPixel = d->viewConverter->documentToViewX(d->rulerLength);
     QRectF rectangle;
     rectangle.setX(qMax(0, d->offset));
     rectangle.setY(0);
     rectangle.setWidth(qMin(qreal(d->ruler->width() - 1.0 - rectangle.x()),
                             (d->offset >= 0) ? lengthInPixel : lengthInPixel + d->offset));
     rectangle.setHeight(d->ruler->height() - 1);
     QRectF activeRangeRectangle;
     activeRangeRectangle.setX(qMax(rectangle.x() + 1,
           d->viewConverter->documentToViewX(d->effectiveActiveRangeStart()) + d->offset));
     activeRangeRectangle.setY(rectangle.y() + 1);
     activeRangeRectangle.setRight(qMin(rectangle.right() - 1,
           d->viewConverter->documentToViewX(d->effectiveActiveRangeEnd()) + d->offset));
     activeRangeRectangle.setHeight(rectangle.height() - 2);
 
     painter->setPen(d->ruler->palette().color(QPalette::Mid));
     painter->drawRect(rectangle);
 
     if(d->effectiveActiveRangeStart() != d->effectiveActiveRangeEnd())
         painter->fillRect(activeRangeRectangle, d->ruler->palette().brush(QPalette::Base));
 
     if(d->showSelectionBorders) {
         // Draw first selection border
         if(d->firstSelectionBorder > 0) {
             qreal border = d->viewConverter->documentToViewX(d->firstSelectionBorder) + d->offset;
             painter->drawLine(QPointF(border, rectangle.y() + 1), QPointF(border, rectangle.bottom() - 1));
         }
         // Draw second selection border
         if(d->secondSelectionBorder > 0) {
             qreal border = d->viewConverter->documentToViewX(d->secondSelectionBorder) + d->offset;
             painter->drawLine(QPointF(border, rectangle.y() + 1), QPointF(border, rectangle.bottom() - 1));
         }
     }
 
     return rectangle;
 }
 
 void HorizontalPaintingStrategy::drawTabs(const KReportRuler::Private *d, QPainter *painter)
 {
     if (! d->showTabs)
         return;
     QPolygonF polygon;
 
     const QColor tabColor = d->ruler->palette().color(QPalette::Text);
     painter->setPen(tabColor);
     painter->setBrush(tabColor);
     painter->setRenderHint( QPainter::Antialiasing );
 
     qreal position = -10000;
 
     foreach (const KReportRuler::Tab & t, d->tabs) {
         qreal x;
         if (d->rightToLeft) {
             x = d->viewConverter->documentToViewX(d->effectiveActiveRangeEnd()
                     - (d->relativeTabs ? d->paragraphIndent : 0) - t.position) + d->offset;
         } else {
             x = d->viewConverter->documentToViewX(d->effectiveActiveRangeStart()
                     + (d->relativeTabs ? d->paragraphIndent : 0) + t.position) + d->offset;
         }
         position = qMax(position, t.position);
 
         polygon.clear();
         switch (t.type) {
         case QTextOption::LeftTab:
             polygon << QPointF(x+0.5, d->ruler->height() - 6.5)
                 << QPointF(x+6.5, d->ruler->height() - 0.5)
                 << QPointF(x+0.5, d->ruler->height() - 0.5);
             painter->drawPolygon(polygon);
             break;
         case QTextOption::RightTab:
             polygon << QPointF(x+0.5, d->ruler->height() - 6.5)
                 << QPointF(x-5.5, d->ruler->height() - 0.5)
                 << QPointF(x+0.5, d->ruler->height() - 0.5);
             painter->drawPolygon(polygon);
             break;
         case QTextOption::CenterTab:
             polygon << QPointF(x+0.5, d->ruler->height() - 6.5)
                 << QPointF(x-5.5, d->ruler->height() - 0.5)
                 << QPointF(x+6.5, d->ruler->height() - 0.5);
             painter->drawPolygon(polygon);
             break;
         case QTextOption::DelimiterTab:
             polygon << QPointF(x-5.5, d->ruler->height() - 0.5)
                 << QPointF(x+6.5, d->ruler->height() - 0.5);
             painter->drawPolyline(polygon);
             polygon << QPointF(x+0.5, d->ruler->height() - 0.5)
                 << QPointF(x+0.5, d->ruler->height() - 6.5);
             painter->drawPolyline(polygon);
             break;
         default:
             break;
         }
     }
 
     // and also draw the regular interval tab that are non editable
     if (d->tabDistance > 0.0) {
         // first possible position
         position = qMax(position, d->relativeTabs ? 0 : d->paragraphIndent);
         if (position < 0) {
             position = int(position / d->tabDistance) * d->tabDistance;
         } else {
             position = (int(position / d->tabDistance) + 1) * d->tabDistance;
         }
         while (position < d->effectiveActiveRangeEnd() - d->effectiveActiveRangeStart()
                 - d->endIndent) {
             qreal x;
             if (d->rightToLeft) {
                 x = d->viewConverter->documentToViewX(d->effectiveActiveRangeEnd()
                         - (d->relativeTabs ? d->paragraphIndent : 0) - position) + d->offset;
             } else {
                 x = d->viewConverter->documentToViewX(d->effectiveActiveRangeStart()
                         + (d->relativeTabs ? d->paragraphIndent : 0) + position) + d->offset;
             }
 
             polygon.clear();
             polygon << QPointF(x+0.5, d->ruler->height() - 3.5)
                 << QPointF(x+4.5, d->ruler->height() - 0.5)
                 << QPointF(x+0.5, d->ruler->height() - 0.5);
             painter->drawPolygon(polygon);
 
             position += d->tabDistance;
         }
     }
 }
 
 void HorizontalPaintingStrategy::drawMeasurements(const KReportRuler::Private *d, QPainter *painter, const QRectF &rectangle)
 {
     qreal numberStep = d->numberStepForUnit(); // number step in unit
 //    QRectF activeRangeRectangle;
     int numberStepPixel = qRound(d->viewConverter->documentToViewX(d->unit.fromUserValue(numberStep)));
 //    const bool adjustMillimeters = (d->unit.type() == KReportUnit::Millimeter);
 
     const QFont font = QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont);
     const QFontMetrics fontMetrics(font);
     painter->setFont(font);
 
     if (numberStepPixel == 0 || numberStep == 0)
         return;
 
     // Calc the longest text length
     int textLength = 0;
     for(int i = 0; i < lengthInPixel; i += numberStepPixel) {
         int number = qRound((i / numberStepPixel) * numberStep);
 
         textLength = qMax(textLength, fontMetrics.width(QString::number(number)));
     }
     textLength += 4;  // Add some padding
 
     // Change number step so all digits fits
     while(textLength > numberStepPixel) {
         numberStepPixel += numberStepPixel;
         numberStep += numberStep;
     }
 
     int start=0;
     // Calc the first number step
     if(d->offset < 0)
         start = qAbs(d->offset);
 
     // make a little hack so rulers shows correctly inversed number aligned
     const qreal lengthInUnit = d->unit.toUserValue(d->rulerLength);
     const qreal hackyLength = lengthInUnit - fmod(lengthInUnit, numberStep);
     if(d->rightToLeft) {
         start -= int(d->viewConverter->documentToViewX(fmod(d->rulerLength,
                     d->unit.fromUserValue(numberStep))));
     }
 
     int stepCount = (start / numberStepPixel) + 1;
     int halfStepCount = (start / qRound(numberStepPixel * 0.5)) + 1;
     int quarterStepCount = (start / qRound(numberStepPixel * 0.25)) + 1;
 
     int pos = 0;
     const QPen numberPen(d->ruler->palette().color(QPalette::Text));
     const QPen markerPen(d->ruler->palette().color(QPalette::Inactive, QPalette::Text));
     painter->setPen(markerPen);
 
     if(d->offset > 0)
         painter->translate(d->offset, 0);
 
     const int len = qRound(rectangle.width()) + start;
     int nextStep = qRound(d->viewConverter->documentToViewX(
         d->unit.fromUserValue(numberStep * stepCount)));
     int nextHalfStep = qRound(d->viewConverter->documentToViewX(d->unit.fromUserValue(
         numberStep * 0.5 * halfStepCount)));
     int nextQuarterStep = qRound(d->viewConverter->documentToViewX(d->unit.fromUserValue(
         numberStep * 0.25 * quarterStepCount)));
 
     for(int i = start; i < len; ++i) {
         pos = i - start;
 
         if(i == nextStep) {
             if(pos != 0)
                 painter->drawLine(QPointF(pos, rectangle.bottom()-1),
                                  QPointF(pos, rectangle.bottom() - fullStepMarkerLength));
 
             int number = qRound(stepCount * numberStep);
 
             QString numberText = QString::number(number);
             int x = pos;
             if (d->rightToLeft) { // this is done in a hacky way with the fine tuning done above
                 numberText = QString::number(hackyLength - stepCount * numberStep);
             }
             painter->setPen(numberPen);
             painter->drawText(QPointF(x-fontMetrics.width(numberText)/2.0,
                                      rectangle.bottom() -fullStepMarkerLength -measurementTextAboveBelowMargin),
                              numberText);
             painter->setPen(markerPen);
 
             ++stepCount;
             nextStep = qRound(d->viewConverter->documentToViewX(
                 d->unit.fromUserValue(numberStep * stepCount)));
             ++halfStepCount;
             nextHalfStep = qRound(d->viewConverter->documentToViewX(d->unit.fromUserValue(
                 numberStep * 0.5 * halfStepCount)));
             ++quarterStepCount;
             nextQuarterStep = qRound(d->viewConverter->documentToViewX(d->unit.fromUserValue(
                 numberStep * 0.25 * quarterStepCount)));
         }
         else if(i == nextHalfStep) {
             if(pos != 0)
                 painter->drawLine(QPointF(pos, rectangle.bottom()-1),
                                  QPointF(pos, rectangle.bottom() - halfStepMarkerLength));
 
             ++halfStepCount;
             nextHalfStep = qRound(d->viewConverter->documentToViewX(d->unit.fromUserValue(
                 numberStep * 0.5 * halfStepCount)));
             ++quarterStepCount;
             nextQuarterStep = qRound(d->viewConverter->documentToViewX(d->unit.fromUserValue(
                 numberStep * 0.25 * quarterStepCount)));
         }
         else if(i == nextQuarterStep) {
             if(pos != 0)
                 painter->drawLine(QPointF(pos, rectangle.bottom()-1),
                                  QPointF(pos, rectangle.bottom() - quarterStepMarkerLength));
 
             ++quarterStepCount;
             nextQuarterStep = qRound(d->viewConverter->documentToViewX(d->unit.fromUserValue(
                 numberStep * 0.25 * quarterStepCount)));
         }
     }
 
     // Draw the mouse indicator
     const int mouseCoord = d->mouseCoordinate - start;
     if (d->selected == KReportRuler::Private::None || d->selected == KReportRuler::Private::HotSpot) {
         const qreal top = rectangle.y() + 1;
         const qreal bottom = rectangle.bottom() -1;
         if (d->selected == KReportRuler::Private::None && d->showMousePosition && mouseCoord > 0 && mouseCoord < rectangle.width() )
             painter->drawLine(QPointF(mouseCoord, top), QPointF(mouseCoord, bottom));
         foreach (const KReportRuler::Private::HotSpotData & hp, d->hotspots) {
             const qreal x = d->viewConverter->documentToViewX(hp.position) + d->offset;
             painter->drawLine(QPointF(x, top), QPointF(x, bottom));
         }
     }
 }
 
 void HorizontalPaintingStrategy::drawIndents(const KReportRuler::Private *d, QPainter *painter)
 {
     QPolygonF polygon;
 
     painter->setBrush(d->ruler->palette().brush(QPalette::Base));
     painter->setRenderHint( QPainter::Antialiasing );
 
     qreal x;
     // Draw first line start indent
     if (d->rightToLeft)
         x = d->effectiveActiveRangeEnd() - d->firstLineIndent - d->paragraphIndent;
     else
         x = d->effectiveActiveRangeStart() + d->firstLineIndent + d->paragraphIndent;
     // convert and use the +0.5 to go to nearest integer so that the 0.5 added below ensures sharp lines
     x = int(d->viewConverter->documentToViewX(x) + d->offset + 0.5);
     polygon << QPointF(x+6.5, 0.5)
         << QPointF(x+0.5, 8.5)
         << QPointF(x-5.5, 0.5)
         << QPointF(x+5.5, 0.5);
     painter->drawPolygon(polygon);
 
     // draw the hanging indent.
     if (d->rightToLeft)
         x = d->effectiveActiveRangeStart() + d->endIndent;
     else
         x = d->effectiveActiveRangeStart() + d->paragraphIndent;
     // convert and use the +0.5 to go to nearest integer so that the 0.5 added below ensures sharp lines
     x = int(d->viewConverter->documentToViewX(x) + d->offset + 0.5);
     const int bottom = d->ruler->height();
     polygon.clear();
     polygon << QPointF(x+6.5, bottom - 0.5)
         << QPointF(x+0.5, bottom - 8.5)
         << QPointF(x-5.5, bottom - 0.5)
         << QPointF(x+5.5, bottom - 0.5);
     painter->drawPolygon(polygon);
 
     // Draw end-indent or paragraph indent if mode is rightToLeft
     qreal diff;
     if (d->rightToLeft)
         diff = d->viewConverter->documentToViewX(d->effectiveActiveRangeEnd()
                      - d->paragraphIndent) + d->offset - x;
     else
         diff = d->viewConverter->documentToViewX(d->effectiveActiveRangeEnd() - d->endIndent)
                 + d->offset - x;
     polygon.translate(diff, 0);
     painter->drawPolygon(polygon);
 }
 
 QSize HorizontalPaintingStrategy::sizeHint()
 {
     // assumes that digits for the number only use glyphs which do not go below the baseline
     const QFontMetrics fm(QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont));
     const int digitsHeight = fm.ascent() + 1; // +1 for baseline
     const int minimum = digitsHeight + fullStepMarkerLength + 2*measurementTextAboveBelowMargin;
 
     return QSize(0, minimum);
 }
 
 QRectF VerticalPaintingStrategy::drawBackground(const KReportRuler::Private *d, QPainter *painter)
 {
     lengthInPixel = d->viewConverter->documentToViewY(d->rulerLength);
     QRectF rectangle;
     rectangle.setX(0);
     rectangle.setY(qMax(0, d->offset));
     rectangle.setWidth(d->ruler->width() - 1.0);
     rectangle.setHeight(qMin(qreal(d->ruler->height() - 1.0 - rectangle.y()),
                              (d->offset >= 0) ? lengthInPixel : lengthInPixel + d->offset));
 
     QRectF activeRangeRectangle;
     activeRangeRectangle.setX(rectangle.x() + 1);
     activeRangeRectangle.setY(qMax(rectangle.y() + 1,
         d->viewConverter->documentToViewY(d->effectiveActiveRangeStart()) + d->offset));
     activeRangeRectangle.setWidth(rectangle.width() - 2);
     activeRangeRectangle.setBottom(qMin(rectangle.bottom() - 1,
         d->viewConverter->documentToViewY(d->effectiveActiveRangeEnd()) + d->offset));
 
     painter->setPen(d->ruler->palette().color(QPalette::Mid));
     painter->drawRect(rectangle);
 
     if(d->effectiveActiveRangeStart() != d->effectiveActiveRangeEnd())
         painter->fillRect(activeRangeRectangle, d->ruler->palette().brush(QPalette::Base));
 
     if(d->showSelectionBorders) {
         // Draw first selection border
         if(d->firstSelectionBorder > 0) {
             qreal border = d->viewConverter->documentToViewY(d->firstSelectionBorder) + d->offset;
             painter->drawLine(QPointF(rectangle.x() + 1, border), QPointF(rectangle.right() - 1, border));
         }
         // Draw second selection border
         if(d->secondSelectionBorder > 0) {
             qreal border = d->viewConverter->documentToViewY(d->secondSelectionBorder) + d->offset;
             painter->drawLine(QPointF(rectangle.x() + 1, border), QPointF(rectangle.right() - 1, border));
         }
     }
 
     return rectangle;
 }
 
 void VerticalPaintingStrategy::drawMeasurements(const KReportRuler::Private *d, QPainter *painter, const QRectF &rectangle)
 {
     qreal numberStep = d->numberStepForUnit(); // number step in unit
     int numberStepPixel = qRound(d->viewConverter->documentToViewY( d->unit.fromUserValue(numberStep)));
     if (numberStepPixel <= 0)
         return;
 
     const QFont font = QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont);
     const QFontMetrics fontMetrics(font);
     painter->setFont(font);
 
     // Calc the longest text length
     int textLength = 0;
 
     for(int i = 0; i < lengthInPixel; i += numberStepPixel) {
         int number = qRound((i / numberStepPixel) * numberStep);
         textLength = qMax(textLength, fontMetrics.width(QString::number(number)));
     }
     textLength += 4;  // Add some padding
 
     if (numberStepPixel == 0 || numberStep == 0)
         return;
     // Change number step so all digits will fit
     while(textLength > numberStepPixel) {
         numberStepPixel += numberStepPixel;
         numberStep += numberStep;
     }
 
     // Calc the first number step
     const int start = d->offset < 0 ? qAbs(d->offset) : 0;
 
     // make a little hack so rulers shows correctly inversed number aligned
     int stepCount = (start / numberStepPixel) + 1;
     int halfStepCount = (start / qRound(numberStepPixel * 0.5)) + 1;
     int quarterStepCount = (start / qRound(numberStepPixel * 0.25)) + 1;
 
     const QPen numberPen(d->ruler->palette().color(QPalette::Text));
     const QPen markerPen(d->ruler->palette().color(QPalette::Inactive, QPalette::Text));
     painter->setPen(markerPen);
 
     if(d->offset > 0)
         painter->translate(0, d->offset);
 
     const int len = qRound(rectangle.height()) + start;
     int nextStep = qRound(d->viewConverter->documentToViewY(
         d->unit.fromUserValue(numberStep * stepCount)));
     int nextHalfStep = qRound(d->viewConverter->documentToViewY(d->unit.fromUserValue(
         numberStep * 0.5 * halfStepCount)));
     int nextQuarterStep = qRound(d->viewConverter->documentToViewY(d->unit.fromUserValue(
         numberStep * 0.25 * quarterStepCount)));
 
     int pos = 0;
     for(int i = start; i < len; ++i) {
         pos = i - start;
 
         if(i == nextStep) {
             painter->save();
             painter->translate(rectangle.right()-fullStepMarkerLength, pos);
             if(pos != 0)
                 painter->drawLine(QPointF(0, 0), QPointF(fullStepMarkerLength-1, 0));
 
             painter->rotate(-90);
             int number = qRound(stepCount * numberStep);
             QString numberText = QString::number(number);
             painter->setPen(numberPen);
             painter->drawText(QPointF(-fontMetrics.width(numberText) / 2.0, -measurementTextAboveBelowMargin), numberText);
             painter->restore();
 
             ++stepCount;
             nextStep = qRound(d->viewConverter->documentToViewY(
                 d->unit.fromUserValue(numberStep * stepCount)));
             ++halfStepCount;
             nextHalfStep = qRound(d->viewConverter->documentToViewY(d->unit.fromUserValue(
                 numberStep * 0.5 * halfStepCount)));
             ++quarterStepCount;
             nextQuarterStep = qRound(d->viewConverter->documentToViewY(d->unit.fromUserValue(
                 numberStep * 0.25 * quarterStepCount)));
         } else if(i == nextHalfStep) {
             if(pos != 0)
                 painter->drawLine(QPointF(rectangle.right() - halfStepMarkerLength, pos),
                                  QPointF(rectangle.right() - 1, pos));
 
             ++halfStepCount;
             nextHalfStep = qRound(d->viewConverter->documentToViewY(d->unit.fromUserValue(
                 numberStep * 0.5 * halfStepCount)));
             ++quarterStepCount;
             nextQuarterStep = qRound(d->viewConverter->documentToViewY(d->unit.fromUserValue(
                 numberStep * 0.25 * quarterStepCount)));
         } else if(i == nextQuarterStep) {
             if(pos != 0)
                 painter->drawLine(QPointF(rectangle.right() - quarterStepMarkerLength, pos),
                                  QPointF(rectangle.right() - 1, pos));
 
             ++quarterStepCount;
             nextQuarterStep = qRound(d->viewConverter->documentToViewY(d->unit.fromUserValue(
                 numberStep * 0.25 * quarterStepCount)));
         }
     }
 
     // Draw the mouse indicator
     const int mouseCoord = d->mouseCoordinate - start;
     if (d->selected == KReportRuler::Private::None || d->selected == KReportRuler::Private::HotSpot) {
         const qreal left = rectangle.left() + 1;
         const qreal right = rectangle.right() -1;
         if (d->selected == KReportRuler::Private::None && d->showMousePosition && mouseCoord > 0 && mouseCoord < rectangle.height() )
             painter->drawLine(QPointF(left, mouseCoord), QPointF(right, mouseCoord));
         foreach (const KReportRuler::Private::HotSpotData & hp, d->hotspots) {
             const qreal y = d->viewConverter->documentToViewY(hp.position) + d->offset;
             painter->drawLine(QPointF(left, y), QPointF(right, y));
         }
     }
 }
 
 QSize VerticalPaintingStrategy::sizeHint()
 {
     // assumes that digits for the number only use glyphs which do not go below the baseline
     const QFontMetrics fm(QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont));
     const int digitsHeight = fm.ascent() + 1; // +1 for baseline
     const int minimum = digitsHeight + fullStepMarkerLength + 2*measurementTextAboveBelowMargin;
 
     return QSize(minimum, 0);
 }
 
 
 void HorizontalDistancesPaintingStrategy::drawDistanceLine(const KReportRuler::Private *d,
                                                            QPainter *painter, qreal start,
                                                            qreal end)
 {
 
     // Don't draw too short lines
     if (qMax(start, end) - qMin(start, end) < 1)
         return;
 
     painter->save();
     painter->translate(d->offset, d->ruler->height() / 2);
     painter->setPen(d->ruler->palette().color(QPalette::Text));
     painter->setBrush(d->ruler->palette().color(QPalette::Text));
 
     QLineF line(QPointF(d->viewConverter->documentToViewX(start), 0),
             QPointF(d->viewConverter->documentToViewX(end), 0));
     QPointF midPoint = line.pointAt(0.5);
 
     // Draw the label text
     const QFont font = QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont);
     const QFontMetrics fontMetrics(font);
     QString label = d->unit.toUserStringValue(
             d->viewConverter->viewToDocumentX(line.length())) + QLatin1String("") + d->unit.symbol();
     QPointF labelPosition = QPointF(midPoint.x() - fontMetrics.width(label)/2,
             midPoint.y() + fontMetrics.ascent()/2);
     painter->setFont(font);
     painter->drawText(labelPosition, label);
 
     // Draw the arrow lines
     qreal arrowLength = (line.length() - fontMetrics.width(label)) / 2 - 2;
     arrowLength = qMax(qreal(0.0), arrowLength);
     QLineF startArrow(line.p1(), line.pointAt(arrowLength / line.length()));
     QLineF endArrow(line.p2(), line.pointAt(1.0 - arrowLength / line.length()));
     painter->drawLine(startArrow);
     painter->drawLine(endArrow);
 
     // Draw the arrow heads
     QPolygonF arrowHead;
     arrowHead << line.p1() << QPointF(line.x1()+3, line.y1()-3)
         << QPointF(line.x1()+3, line.y1()+3);
     painter->drawPolygon(arrowHead);
     arrowHead.clear();
     arrowHead << line.p2() << QPointF(line.x2()-3, line.y2()-3)
         << QPointF(line.x2()-3, line.y2()+3);
     painter->drawPolygon(arrowHead);
 
     painter->restore();
 }
 
 void HorizontalDistancesPaintingStrategy::drawMeasurements(const KReportRuler::Private *d,
                                                            QPainter *painter, const QRectF&)
 {
     QList points;
     points << 0.0;
     points << d->effectiveActiveRangeStart() + d->paragraphIndent + d->firstLineIndent;
     points << d->effectiveActiveRangeStart() + d->paragraphIndent;
     points << d->effectiveActiveRangeEnd() - d->endIndent;
     points << d->effectiveActiveRangeStart();
     points << d->effectiveActiveRangeEnd();
     points << d->rulerLength;
     qSort(points.begin(), points.end());
     QListIterator i(points);
     i.next();
     while (i.hasNext() && i.hasPrevious()) {
         drawDistanceLine(d, painter, i.peekPrevious(), i.peekNext());
         i.next();
     }
 }
 
 KReportRuler::Private::Private(KReportRuler *parent,
                                          const KReportZoomHandler &zoomHandler, Qt::Orientation o)
     : unit(KReportUnit(KReportUnit::Point)),
     orientation(o),
     viewConverter(&zoomHandler),
     offset(0),
     rulerLength(0),
     activeRangeStart(0),
     activeRangeEnd(0),
     activeOverrideRangeStart(0),
     activeOverrideRangeEnd(0),
     mouseCoordinate(-1),
     showMousePosition(0),
     showSelectionBorders(false),
     firstSelectionBorder(0),
     secondSelectionBorder(0),
     showIndents(false),
     firstLineIndent(0),
     paragraphIndent(0),
     endIndent(0),
     showTabs(false),
     relativeTabs(false),
     tabMoved(false),
     originalIndex(-1),
     currentIndex(0),
     tabDistance(0.0),
     rightToLeft(false),
     selected(None),
     selectOffset(0),
-    tabChooser(0),
+    tabChooser(nullptr),
     normalPaintingStrategy(o == Qt::Horizontal ?
             (PaintingStrategy*)new HorizontalPaintingStrategy() : (PaintingStrategy*)new VerticalPaintingStrategy()),
     distancesPaintingStrategy((PaintingStrategy*)new HorizontalDistancesPaintingStrategy()),
     paintingStrategy(normalPaintingStrategy),
     ruler(parent)
 {
 }
 
 KReportRuler::Private::~Private()
 {
     delete normalPaintingStrategy;
     delete distancesPaintingStrategy;
 }
 
 qreal KReportRuler::Private::numberStepForUnit() const
 {
     switch(unit.type()) {
         case KReportUnit::Inch:
         case KReportUnit::Centimeter:
         case KReportUnit::Decimeter:
         case KReportUnit::Millimeter:
             return 1.0;
         case KReportUnit::Pica:
         case KReportUnit::Cicero:
             return 10.0;
         case KReportUnit::Point:
         default:
             return 100.0;
     }
 }
 
 qreal KReportRuler::Private::doSnapping(qreal value) const
 {
     qreal numberStep = unit.fromUserValue(numberStepForUnit()/4.0);
     return numberStep * qRound(value / numberStep);
 }
 
 KReportRuler::Private::Selection KReportRuler::Private::selectionAtPosition(const QPoint & pos, int *selectOffset )
 {
     const int height = ruler->height();
     if (rightToLeft) {
         int x = int(viewConverter->documentToViewX(effectiveActiveRangeEnd() - firstLineIndent - paragraphIndent) + offset);
         if (pos.x() >= x - 8 && pos.x() <= x +8 && pos.y() < height / 2) {
             if (selectOffset)
                 *selectOffset = x - pos.x();
             return KReportRuler::Private::FirstLineIndent;
         }
 
         x = int(viewConverter->documentToViewX(effectiveActiveRangeEnd() - paragraphIndent) + offset);
         if (pos.x() >= x - 8 && pos.x() <= x +8 && pos.y() > height / 2) {
             if (selectOffset)
                 *selectOffset = x - pos.x();
             return KReportRuler::Private::ParagraphIndent;
         }
 
         x = int(viewConverter->documentToViewX(effectiveActiveRangeStart() + endIndent) + offset);
         if (pos.x() >= x - 8 && pos.x() <= x + 8) {
             if (selectOffset)
                 *selectOffset = x - pos.x();
             return KReportRuler::Private::EndIndent;
         }
     }
     else {
         int x = int(viewConverter->documentToViewX(effectiveActiveRangeStart() + firstLineIndent + paragraphIndent) + offset);
         if (pos.x() >= x -8 && pos.x() <= x + 8 && pos.y() < height / 2) {
             if (selectOffset)
                 *selectOffset = x - pos.x();
             return KReportRuler::Private::FirstLineIndent;
         }
 
         x = int(viewConverter->documentToViewX(effectiveActiveRangeStart() + paragraphIndent) + offset);
         if (pos.x() >= x - 8 && pos.x() <= x + 8 && pos.y() > height/2) {
             if (selectOffset)
                 *selectOffset = x - pos.x();
             return KReportRuler::Private::ParagraphIndent;
         }
 
         x = int(viewConverter->documentToViewX(effectiveActiveRangeEnd() - endIndent) + offset);
         if (pos.x() >= x - 8 && pos.x() <= x + 8) {
             if (selectOffset)
                 *selectOffset = x - pos.x();
             return KReportRuler::Private::EndIndent;
         }
     }
 
     return KReportRuler::Private::None;
 }
 
 int KReportRuler::Private::hotSpotIndex(const QPoint & pos)
 {
     for(int counter = 0; counter < hotspots.count(); counter++) {
         bool hit;
         if (orientation == Qt::Horizontal)
             hit = qAbs(viewConverter->documentToViewX(hotspots[counter].position) - pos.x() + offset) < 3;
         else
             hit = qAbs(viewConverter->documentToViewY(hotspots[counter].position) - pos.y() + offset) < 3;
 
         if (hit)
             return counter;
     }
     return -1;
 }
 
 qreal KReportRuler::Private::effectiveActiveRangeStart() const
 {
     if (activeOverrideRangeStart != activeOverrideRangeEnd) {
         return activeOverrideRangeStart;
     } else {
         return activeRangeStart;
     }
 }
 
 qreal KReportRuler::Private::effectiveActiveRangeEnd() const
 {
     if (activeOverrideRangeStart != activeOverrideRangeEnd) {
         return activeOverrideRangeEnd;
     } else {
         return activeRangeEnd;
     }
 }
 
 void KReportRuler::Private::emitTabChanged()
 {
     KReportRuler::Tab tab;
     if (currentIndex >= 0)
         tab = tabs[currentIndex];
-    emit ruler->tabChanged(originalIndex, currentIndex >= 0 ? &tab : 0);
+    emit ruler->tabChanged(originalIndex, currentIndex >= 0 ? &tab : nullptr);
 }
 
 
 KReportRuler::KReportRuler(QWidget* parent, Qt::Orientation orientation,
                            const KReportZoomHandler &zoomHandler)
   : QWidget(parent)
   , d(new KReportRuler::Private(this, zoomHandler, orientation))
 {
     setMouseTracking( true );
 }
 
 KReportRuler::~KReportRuler()
 {
     delete d;
 }
 
 KReportUnit KReportRuler::unit() const
 {
     return d->unit;
 }
 
 void KReportRuler::setUnit(const KReportUnit &unit)
 {
     d->unit = unit;
     update();
 }
 
 qreal KReportRuler::rulerLength() const
 {
     return d->rulerLength;
 }
 
 Qt::Orientation KReportRuler::orientation() const
 {
     return d->orientation;
 }
 
 void KReportRuler::setOffset(int offset)
 {
     d->offset = offset;
     update();
 }
 
 void KReportRuler::setRulerLength(qreal length)
 {
     d->rulerLength = length;
     update();
 }
 
 void KReportRuler::paintEvent(QPaintEvent* event)
 {
     QPainter painter(this);
     painter.setClipRegion(event->region());
     painter.save();
     QRectF rectangle = d->paintingStrategy->drawBackground(d, &painter);
     painter.restore();
     painter.save();
     d->paintingStrategy->drawMeasurements(d, &painter, rectangle);
     painter.restore();
     if (d->showIndents) {
         painter.save();
         d->paintingStrategy->drawIndents(d, &painter);
         painter.restore();
     }
     d->paintingStrategy->drawTabs(d, &painter);
 }
 
 QSize KReportRuler::minimumSizeHint() const
 {
     return d->paintingStrategy->sizeHint();
 }
 
 QSize KReportRuler::sizeHint() const
 {
     return d->paintingStrategy->sizeHint();
 }
 
 void KReportRuler::setActiveRange(qreal start, qreal end)
 {
     d->activeRangeStart = start;
     d->activeRangeEnd = end;
     update();
 }
 
 void KReportRuler::setOverrideActiveRange(qreal start, qreal end)
 {
     d->activeOverrideRangeStart = start;
     d->activeOverrideRangeEnd = end;
     update();
 }
 
 void KReportRuler::updateMouseCoordinate(int coordinate)
 {
     if(d->mouseCoordinate == coordinate)
         return;
     d->mouseCoordinate = coordinate;
     update();
 }
 
 void KReportRuler::setShowMousePosition(bool show)
 {
     d->showMousePosition = show;
     update();
 }
 
 void KReportRuler::setRightToLeft(bool isRightToLeft)
 {
     d->rightToLeft = isRightToLeft;
     update();
 }
 
 void KReportRuler::setShowIndents(bool show)
 {
     d->showIndents = show;
     update();
 }
 
 void KReportRuler::setFirstLineIndent(qreal indent)
 {
     d->firstLineIndent = indent;
     if (d->showIndents) {
         update();
     }
 }
 
 void KReportRuler::setParagraphIndent(qreal indent)
 {
     d->paragraphIndent = indent;
     if (d->showIndents) {
         update();
     }
 }
 
 void KReportRuler::setEndIndent(qreal indent)
 {
     d->endIndent = indent;
     if (d->showIndents) {
         update();
     }
 }
 
 qreal KReportRuler::firstLineIndent() const
 {
     return d->firstLineIndent;
 }
 
 qreal KReportRuler::paragraphIndent() const
 {
     return d->paragraphIndent;
 }
 
 qreal KReportRuler::endIndent() const
 {
     return d->endIndent;
 }
 
 QWidget *KReportRuler::tabChooser()
 {
-    if ((d->tabChooser == 0) && (d->orientation == Qt::Horizontal)) {
+    if ((d->tabChooser == nullptr) && (d->orientation == Qt::Horizontal)) {
         d->tabChooser = new RulerTabChooser(parentWidget());
         d->tabChooser->setShowTabs(d->showTabs);
     }
 
     return d->tabChooser;
 }
 
 void KReportRuler::setShowSelectionBorders(bool show)
 {
     d->showSelectionBorders = show;
     update();
 }
 
 void KReportRuler::updateSelectionBorders(qreal first, qreal second)
 {
     d->firstSelectionBorder = first;
     d->secondSelectionBorder = second;
 
     if(d->showSelectionBorders)
         update();
 }
 
 void KReportRuler::setShowTabs(bool show)
 {
     if (d->showTabs == show) {
         return;
     }
 
     d->showTabs = show;
     if (d->tabChooser) {
         d->tabChooser->setShowTabs(show);
     }
     update();
 }
 
 void KReportRuler::setRelativeTabs(bool relative)
 {
     d->relativeTabs = relative;
     if (d->showTabs) {
         update();
     }
 }
 
 void KReportRuler::updateTabs(const QList &tabs, qreal tabDistance)
 {
     d->tabs = tabs;
     d->tabDistance = tabDistance;
     if (d->showTabs) {
         update();
     }
 }
 
 QList KReportRuler::tabs() const
 {
     QList answer = d->tabs;
     qSort(answer.begin(), answer.end(), compareTabs);
 
     return answer;
 }
 
 void KReportRuler::setPopupActionList(const QList &popupActionList)
 {
     d->popupActions = popupActionList;
 }
 
 QList KReportRuler::popupActionList() const
 {
     return d->popupActions;
 }
 
 void KReportRuler::mousePressEvent ( QMouseEvent* ev )
 {
     d->tabMoved = false;
     d->selected = KReportRuler::Private::None;
     if (ev->button() == Qt::RightButton && !d->popupActions.isEmpty())
         QMenu::exec(d->popupActions, ev->globalPos());
     if (ev->button() != Qt::LeftButton) {
         ev->ignore();
         return;
     }
 
     QPoint pos = ev->pos();
 
     if (d->showTabs) {
         int i = 0;
         int x;
         foreach (const Tab & t, d->tabs) {
             if (d->rightToLeft) {
                 x = d->viewConverter->documentToViewX(d->effectiveActiveRangeEnd()
                         - (d->relativeTabs ? d->paragraphIndent : 0) - t.position) + d->offset;
             } else {
                 x = d->viewConverter->documentToViewX(d->effectiveActiveRangeStart()
                         + (d->relativeTabs ? d->paragraphIndent : 0) + t.position) + d->offset;
             }
             if (pos.x() >= x-6 && pos.x() <= x+6) {
                 d->selected = KReportRuler::Private::Tab;
                 d->selectOffset = x - pos.x();
                 d->currentIndex = i;
                 break;
             }
             i++;
         }
         d->originalIndex = d->currentIndex;
     }
 
     if (d->selected == KReportRuler::Private::None)
         d->selected = d->selectionAtPosition(ev->pos(), &d->selectOffset);
     if (d->selected == KReportRuler::Private::None) {
         int hotSpotIndex = d->hotSpotIndex(ev->pos());
         if (hotSpotIndex >= 0) {
             d->selected = KReportRuler::Private::HotSpot;
             update();
         }
     }
 
     if (d->showTabs && d->selected == KReportRuler::Private::None) {
         // still haven't found something so let assume the user wants to add a tab
         qreal tabpos;
         if (d->rightToLeft) {
             tabpos = d->viewConverter->viewToDocumentX(pos.x() - d->offset)
                     + d->effectiveActiveRangeEnd() + (d->relativeTabs ? d->paragraphIndent : 0);
         } else {
             tabpos = d->viewConverter->viewToDocumentX(pos.x() - d->offset)
                     - d->effectiveActiveRangeStart() - (d->relativeTabs ? d->paragraphIndent : 0);
         }
         Tab t(tabpos, d->tabChooser ?  d->tabChooser->type() :
                          d->rightToLeft ? QTextOption::RightTab :
                                           QTextOption::LeftTab);
         d->tabs.append(t);
         d->selectOffset = 0;
         d->selected = KReportRuler::Private::Tab;
         d->currentIndex = d->tabs.count() - 1;
         d->originalIndex = -1; // new!
         update();
     }
     if (d->orientation == Qt::Horizontal && (ev->modifiers() & Qt::ShiftModifier) &&
             (d->selected == KReportRuler::Private::FirstLineIndent ||
              d->selected == KReportRuler::Private::ParagraphIndent ||
              d->selected == KReportRuler::Private::Tab ||
              d->selected == KReportRuler::Private::EndIndent))
         d->paintingStrategy = d->distancesPaintingStrategy;
 
     if (d->selected != KReportRuler::Private::None)
         emit aboutToChange();
 }
 
 void KReportRuler::mouseReleaseEvent ( QMouseEvent* ev )
 {
     ev->accept();
     if (d->selected == KReportRuler::Private::Tab) {
         if (d->originalIndex >= 0 && !d->tabMoved) {
             int type = d->tabs[d->currentIndex].type;
             type++;
             if (type > 3)
                 type = 0;
             d->tabs[d->currentIndex].type = static_cast (type);
             update();
         }
         d->emitTabChanged();
     }
     else if( d->selected != KReportRuler::Private::None)
         emit indentsChanged(true);
     else
         ev->ignore();
 
     d->paintingStrategy = d->normalPaintingStrategy;
     d->selected = KReportRuler::Private::None;
 }
 
 void KReportRuler::mouseMoveEvent ( QMouseEvent* ev )
 {
     QPoint pos = ev->pos();
 
     qreal activeLength = d->effectiveActiveRangeEnd() - d->effectiveActiveRangeStart();
 
     switch (d->selected) {
     case KReportRuler::Private::FirstLineIndent:
         if (d->rightToLeft)
             d->firstLineIndent = d->effectiveActiveRangeEnd() - d->paragraphIndent -
                 d->viewConverter->viewToDocumentX(pos.x() + d->selectOffset - d->offset);
         else
             d->firstLineIndent = d->viewConverter->viewToDocumentX(pos.x() + d->selectOffset
                 - d->offset) - d->effectiveActiveRangeStart() - d->paragraphIndent;
         if( ! (ev->modifiers() & Qt::ShiftModifier)) {
             d->firstLineIndent = d->doSnapping(d->firstLineIndent);
             d->paintingStrategy = d->normalPaintingStrategy;
         } else {
             if (d->orientation == Qt::Horizontal)
                 d->paintingStrategy = d->distancesPaintingStrategy;
         }
 
         emit indentsChanged(false);
         break;
     case KReportRuler::Private::ParagraphIndent:
         if (d->rightToLeft)
             d->paragraphIndent = d->effectiveActiveRangeEnd() -
                 d->viewConverter->viewToDocumentX(pos.x() + d->selectOffset - d->offset);
         else
             d->paragraphIndent = d->viewConverter->viewToDocumentX(pos.x() + d->selectOffset
                 - d->offset) - d->effectiveActiveRangeStart();
         if( ! (ev->modifiers() & Qt::ShiftModifier)) {
             d->paragraphIndent = d->doSnapping(d->paragraphIndent);
             d->paintingStrategy = d->normalPaintingStrategy;
         } else {
             if (d->orientation == Qt::Horizontal)
                 d->paintingStrategy = d->distancesPaintingStrategy;
         }
 
         if (d->paragraphIndent + d->endIndent > activeLength)
             d->paragraphIndent = activeLength - d->endIndent;
         emit indentsChanged(false);
         break;
     case KReportRuler::Private::EndIndent:
         if (d->rightToLeft)
             d->endIndent = d->viewConverter->viewToDocumentX(pos.x()
                  + d->selectOffset - d->offset) - d->effectiveActiveRangeStart();
         else
             d->endIndent = d->effectiveActiveRangeEnd() - d->viewConverter->viewToDocumentX(pos.x()
                  + d->selectOffset - d->offset);
         if (!(ev->modifiers() & Qt::ShiftModifier)) {
             d->endIndent = d->doSnapping(d->endIndent);
             d->paintingStrategy = d->normalPaintingStrategy;
         } else {
             if (d->orientation == Qt::Horizontal)
                 d->paintingStrategy = d->distancesPaintingStrategy;
         }
 
         if (d->paragraphIndent + d->endIndent > activeLength)
             d->endIndent = activeLength - d->paragraphIndent;
         emit indentsChanged(false);
         break;
     case KReportRuler::Private::Tab:
         d->tabMoved = true;
         if (d->currentIndex < 0) { // tab is deleted.
             if (ev->pos().y() < height()) { // reinstante it.
                 d->currentIndex = d->tabs.count();
                 d->tabs.append(d->deletedTab);
             } else {
                 break;
             }
         }
         if (d->rightToLeft)
             d->tabs[d->currentIndex].position = d->effectiveActiveRangeEnd() -
                 d->viewConverter->viewToDocumentX(pos.x() + d->selectOffset - d->offset);
         else
             d->tabs[d->currentIndex].position = d->viewConverter->viewToDocumentX(pos.x() + d->selectOffset
                 - d->offset) - d->effectiveActiveRangeStart();
         if (!(ev->modifiers() & Qt::ShiftModifier))
             d->tabs[d->currentIndex].position = d->doSnapping(d->tabs[d->currentIndex].position);
         if (d->tabs[d->currentIndex].position < 0)
             d->tabs[d->currentIndex].position = 0;
         if (d->tabs[d->currentIndex].position > activeLength)
             d->tabs[d->currentIndex].position = activeLength;
 
         if (ev->pos().y() > height() + OutsideRulerThreshold ) { // moved out of the ruler, delete it.
             d->deletedTab = d->tabs.takeAt(d->currentIndex);
             d->currentIndex = -1;
             // was that a temporary added tab?
             if ( d->originalIndex == -1 )
                 emit guideLineCreated(d->orientation,
                         d->orientation == Qt::Horizontal
                         ? d->viewConverter->viewToDocumentY(ev->pos().y())
                         : d->viewConverter->viewToDocumentX(ev->pos().x()));
         }
 
         d->emitTabChanged();
         break;
     case KReportRuler::Private::HotSpot:
         qreal newPos;
         if (d->orientation == Qt::Horizontal)
             newPos= d->viewConverter->viewToDocumentX(pos.x() - d->offset);
         else
             newPos= d->viewConverter->viewToDocumentY(pos.y() - d->offset);
         d->hotspots[d->currentIndex].position = newPos;
         emit hotSpotChanged(d->hotspots[d->currentIndex].id, newPos);
         break;
     case KReportRuler::Private::None:
         d->mouseCoordinate = (d->orientation == Qt::Horizontal ?  pos.x() : pos.y()) - d->offset;
         int hotSpotIndex = d->hotSpotIndex(pos);
         if (hotSpotIndex >= 0) {
             setCursor(QCursor( d->orientation == Qt::Horizontal ? Qt::SplitHCursor : Qt::SplitVCursor ));
             break;
         }
         unsetCursor();
 
         KReportRuler::Private::Selection selection = d->selectionAtPosition(pos);
         QString text;
         switch(selection) {
         case KReportRuler::Private::FirstLineIndent: text = tr("First line indent"); break;
         case KReportRuler::Private::ParagraphIndent: text = tr("Left indent"); break;
         case KReportRuler::Private::EndIndent: text = tr("Right indent"); break;
         case KReportRuler::Private::None:
             if (ev->buttons() & Qt::LeftButton) {
                 if (d->orientation == Qt::Horizontal && ev->pos().y() > height() + OutsideRulerThreshold)
                     emit guideLineCreated(d->orientation, d->viewConverter->viewToDocumentY(ev->pos().y()));
                 else if (d->orientation == Qt::Vertical && ev->pos().x() > width() + OutsideRulerThreshold)
                     emit guideLineCreated(d->orientation, d->viewConverter->viewToDocumentX(ev->pos().x()));
             }
             break;
         default:
             break;
         }
         setToolTip(text);
     }
     update();
 }
 
 void KReportRuler::clearHotSpots()
 {
     if (d->hotspots.isEmpty())
         return;
     d->hotspots.clear();
     update();
 }
 
 void KReportRuler::setHotSpot(qreal position, int id)
 {
     int hotspotCount = d->hotspots.count();
     for (int i = 0; i < hotspotCount; ++i) {
         KReportRuler::Private::HotSpotData & hs = d->hotspots[i];
         if (hs.id == id) {
             hs.position = position;
             update();
             return;
         }
     }
     // not there yet, then insert it.
     KReportRuler::Private::HotSpotData hs;
     hs.position = position;
     hs.id = id;
     d->hotspots.append(hs);
 }
 
 bool KReportRuler::removeHotSpot(int id)
 {
     QList::Iterator iter = d->hotspots.begin();
     while(iter != d->hotspots.end()) {
         if (iter->id == id) {
             d->hotspots.erase(iter);
             update();
             return true;
         }
     }
     return false;
 }
diff --git a/src/wrtembed/KReportRuler_p.h b/src/wrtembed/KReportRuler_p.h
index 5f68f9a1..e333f8c8 100644
--- a/src/wrtembed/KReportRuler_p.h
+++ b/src/wrtembed/KReportRuler_p.h
@@ -1,265 +1,265 @@
 /* This file is part of the KDE project
  * Copyright (C) 1998, 1999 Reginald Stadlbauer 
  * Copyright (C) 2006 Peter Simonsson 
  * Copyright (C) 2007 C. Boemann 
  * Copyright (C) 2007 Thomas Zander 
  *
  * 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.
 */
 
 #ifndef KREPORTRULER_P_H
 #define KREPORTRULER_P_H
 
 #include "KReportUnit.h"
 #include 
 #include 
 
 class KReportZoomHandler;
 
 /**
  * Decorator widget to draw a single ruler around a canvas.
  */
 class KReportRuler : public QWidget
 {
 Q_OBJECT
 public:
     /**
      * Creates a ruler with the orientation @p orientation
      * @param parent parent widget
      * @param orientation the orientation of the ruler
      * @param viewConverter the view converter used to convert from point to pixel
      */
     KReportRuler(QWidget* parent, Qt::Orientation orientation,
                  const KReportZoomHandler &zoomHandler);
-    ~KReportRuler();
+    ~KReportRuler() override;
 
     /// For paragraphs each tab definition is represented by this struct.
     struct Tab {
         inline Tab(qreal aPosition, QTextOption::TabType aType) : position(aPosition), type(aType) {}
         inline Tab() : position(0.0), type(QTextOption::LeftTab) {}
         qreal position;            ///< distance in point from the start of the text-shape
         QTextOption::TabType type; ///< Determine which type is used.
     };
 
     /// The ruler's unit
     KReportUnit unit() const;
 
     /// The length of the ruler in points (pt)
     qreal rulerLength() const;
 
     /// The orientation of the ruler
     Qt::Orientation orientation() const;
 
     /// The start indent of the first line
     qreal firstLineIndent() const;
 
     /// The start indent of the rest of the lines
     qreal paragraphIndent() const;
 
     /// The end indent of all lines
     qreal endIndent() const;
 
     /// The tab chooser widget, which you must put into a layout along with the ruler.
     /// Returns 0 for vertical rulers,
     QWidget *tabChooser();
 
     /**
      * set a list of actions that will be shown in a popup should the user right click on this ruler.
      * @param popupActionList the list of actions
      * @see popupActionList()
      */
     void setPopupActionList(const QList &popupActionList);
     /**
      * Return the actions list.
      * @see setPopupActionList()
      */
     QList popupActionList() const;
 
     /// reimplemented
-    virtual QSize minimumSizeHint() const;
+    QSize minimumSizeHint() const override;
 
     /// reimplemented
-    virtual QSize sizeHint() const;
+    QSize sizeHint() const override;
 
     class Private;
 
 public Q_SLOTS:
     /// Set the unit of the ruler
     void setUnit(const KReportUnit &unit);
 
     /** Set the offset. Use this function to sync the ruler with
       * the canvas' position on screen
       * @param offset The offset in pixels
       */
     void setOffset(int offset);
 
     /// Sets the length of the ruler to @p length in points (pt)
     void setRulerLength(qreal length);
 
     /** Set the active range, ie the part of the ruler that is most likely used.
       * set to 0, 0 when there is no longer any active range
       * @param start the start of the range in pt
       * @param end the end of the range in pt
       */
     void setActiveRange(qreal start, qreal end);
 
     /** Set the override active range, ie the part of the ruler that is most likely used.
       * set to 0, 0 when there is no longer any active range
       * The override, means that if set it takes precedence over the normal active range.
       * @param start the start of the range in pt
       * @param end the end of the range in pt
       */
     void setOverrideActiveRange(qreal start, qreal end);
 
     /** Set the state of the ruler so that it shows everything in right to left mode.
       * @param isRightToLeft state of right to left mode. Default is false.
       */
     void setRightToLeft(bool isRightToLeft);
 
     /** Set if the ruler should show indents as used in textditors.
       * Set the indents with setFirstLineIndent(), setParagraphIndent(), setEndIndent() .
       * @param show show indents if true. Default is false.
       */
     void setShowIndents(bool show);
 
     /** Set the position of the first line start indent relative to the active range.
       * If Right To left is set the indent is relative to the right side of the active range .
       * @param indent the value relative to the active range.
       */
     void setFirstLineIndent(qreal indent);
 
     /** Set the position of the rest of the lines start indent relative to the active range.
       * If Right To left is set the indent is relative to the right side of the active range .
       * @param indent the value relative to the active range.
       */
     void setParagraphIndent(qreal indent);
 
     /** Set the position of the end indent relative to the active range.
       * If Right To left is set the indent is relative to the left side of the active range .
       * @param indent the value relative to the active range.
       */
     void setEndIndent(qreal indent);
 
     /** Set whether the ruler should show the current mouse position.
       * Update the position with updateMouseCoordinate().
       * @param show show mouse position if true. Default is false.
       */
     void setShowMousePosition(bool show);
 
     /** Update the current position of the mouse pointer, repainting if changed.
       * The ruler offset will be applied before painting.
       * @param coordinate Either the x or y coordinate of the mouse depending
       *                   of the orientation of the ruler.
       */
     void updateMouseCoordinate(int coordinate);
 
     /**
      * Set whether the ruler should show the selection borders
      * @param show show selection borders if true, default is false.
      */
     void setShowSelectionBorders(bool show);
 
     /**
      * Update the selection borders
      * @param first the first selection border in points
      * @param second the other selection border in points
      */
     void updateSelectionBorders(qreal first, qreal second);
 
     /**
      * Set whether the ruler should show tabs
      * @param show show selection borders if true, default is false.
      */
     void setShowTabs(bool show);
 
     /**
      * Set whether the tabs is relative to the paragraph indent
      * @param relative tabs are relative to pragraph indent if true, default is false.
      */
     void setRelativeTabs(bool relative);
 
     /**
      * Update the tabs
      * @param tabs a list of tabs that is shown on the ruler
      * @param tabDistance the distance between regular interval tabs
      */
     void updateTabs(const QList &tabs, qreal tabDistance);
 
     /***
      * Return the list of tabs set on this ruler.
      */
     QList tabs() const;
 
     /**
      * Clear all previously set hotspots.
      * A hotspot is a position on the ruler that the user can manipulate by dragging.
      */
     void clearHotSpots();
 
     /**
      * Add or set a hotspot.
      * A hotspot is a position on the ruler that the user can manipulate by dragging.
      * @param position the new position of the hotspot.
      * @param id the unique id for the hotspot. If the id has not been set before, it will be added.
      */
     void setHotSpot(qreal position, int id = -1);
 
     /**
      * Remove a previously set hotspot, returning true if one is actually returned.
      * @param id the unique id for the hotspot.
      * A hotspot is a position on the ruler that the user can manipulate by dragging.
      */
     bool removeHotSpot(int id);
 
 Q_SIGNALS:
     /**
      * emitted when any of the indents is moved by the user.
      * @param final false until the user releases the mouse. So you can implement live update.
      */
     void indentsChanged(bool final);
 
     /**
      * Emitted when any of the tabs are moved, deleted or inserted by the user.
      * @param originalTabIndex the index in the list of tabs before the user interaction
      *          started, or -1 if this is a new tab
      * @param tab the new tab, or zero when the tab has been removed.
      */
     void tabChanged(int originalTabIndex, KReportRuler::Tab *tab);
 
     /// emitted when there the user is about to change a tab or hotspot
     void aboutToChange();
 
     void hotSpotChanged(int id, qreal newPosition);
 
     /// emitted when the mouse is drag+released outside the ruler
     void guideLineCreated(Qt::Orientation orientation, qreal viewPosition);
 
 protected:
     /// reimplemented
-    virtual void paintEvent(QPaintEvent* event);
+    void paintEvent(QPaintEvent* event) override;
     /// reimplemented
-    virtual void mousePressEvent(QMouseEvent *ev);
+    void mousePressEvent(QMouseEvent *ev) override;
     /// reimplemented
-    virtual void mouseReleaseEvent(QMouseEvent *ev);
+    void mouseReleaseEvent(QMouseEvent *ev) override;
     /// reimplemented
-    virtual void mouseMoveEvent(QMouseEvent *ev);
+    void mouseMoveEvent(QMouseEvent *ev) override;
 
 private:
     Private * const d;
     friend class KReportRuler::Private;
 };
 
 #endif
diff --git a/src/wrtembed/KReportSectionEditor.h b/src/wrtembed/KReportSectionEditor.h
index 9311ac3e..7fedc05e 100644
--- a/src/wrtembed/KReportSectionEditor.h
+++ b/src/wrtembed/KReportSectionEditor.h
@@ -1,82 +1,82 @@
 /* This file is part of the KDE project
  * Copyright (C) 2001-2007 by OpenMFG, LLC (info@openmfg.com)
  * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
  * Copyright (C) 2012 by Friedrich W. H. Kossebau (kossebau@kde.org)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 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
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library.  If not, see .
  */
 
 #ifndef SECTIONEDITOR_H
 #define SECTIONEDITOR_H
 
 #include 
 #include 
 
 #include 
 
 class KReportDesigner;
 class KReportDesignerSectionDetail;
 class KReportDesignerSectionDetailGroup;
 
 class KReportSectionEditor : public QDialog
 {
     Q_OBJECT
 
 public:
-    explicit KReportSectionEditor(KReportDesigner* parent = 0);
-    ~KReportSectionEditor();
+    explicit KReportSectionEditor(KReportDesigner* parent = nullptr);
+    ~KReportSectionEditor() override;
 
 private Q_SLOTS:
     void cbReportHeader_toggled(bool yes);
     void cbReportFooter_toggled(bool yes);
     void cbHeadFirst_toggled(bool yes);
     void cbHeadLast_toggled(bool yes);
     void cbHeadEven_toggled(bool yes);
     void cbHeadOdd_toggled(bool yes);
     void cbFootFirst_toggled(bool yes);
     void cbFootLast_toggled(bool yes);
     void cbFootEven_toggled(bool yes);
     void cbFootOdd_toggled(bool yes);
     void cbHeadAny_toggled(bool yes);
     void cbFootAny_toggled(bool yes);
 
     void btnAdd_clicked();
     void btnEdit_clicked();
     void btnRemove_clicked();
     void btnMoveUp_clicked();
     void brnMoveDown_clicked();
 
     void updateButtonsForItem(QListWidgetItem *currentItem);
     void updateButtonsForRow(int row);
 
 private:
     bool editDetailGroup(KReportDesignerSectionDetailGroup *rsdg);
     void updateAddButton();
 
     QString columnName(const QString &column) const;
     QSet groupingColumns() const;
 
 private:
     Ui::SectionEditor m_ui;
     QPushButton *m_btnAdd;
     QPushButton *m_btnEdit;
     QPushButton *m_btnRemove;
     QPushButton *m_btnMoveUp;
     QPushButton *m_btnMoveDown;
 
     KReportDesigner *m_reportDesigner;
     KReportDesignerSectionDetail *m_reportSectionDetail;
 };
 
 #endif // SECTIONEDITOR_H
diff --git a/src/wrtembed/KReportZoomMode_p.cpp b/src/wrtembed/KReportZoomMode_p.cpp
index 957e79b8..007eb8d1 100644
--- a/src/wrtembed/KReportZoomMode_p.cpp
+++ b/src/wrtembed/KReportZoomMode_p.cpp
@@ -1,93 +1,93 @@
 /* This file is part of the KDE project
    Copyright (C) 2005 Johannes Schaub 
    Copyright (C) 2011 Arjen Hiemstra 
 
    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 "KReportZoomMode_p.h"
 
 #include 
 
 const char* const KReportZoomMode::modes[] =
 {
     QT_TRANSLATE_NOOP("KReportZoomMode", "%1%"),
     QT_TRANSLATE_NOOP("KReportZoomMode", "Fit Page Width"),
     QT_TRANSLATE_NOOP("KReportZoomMode", "Fit Page"),
-    0,
+    nullptr,
     QT_TRANSLATE_NOOP("KReportZoomMode", "Actual Pixels"),
-    0,
-    0,
-    0,
+    nullptr,
+    nullptr,
+    nullptr,
     QT_TRANSLATE_NOOP("KReportZoomMode", "Fit Text Width")
 };
 
 qreal KReportZoomMode::minimumZoomValue = 0.2;
 qreal KReportZoomMode::maximumZoomValue = 5.0;
 
 QString KReportZoomMode::toString(Mode mode)
 {
     return QCoreApplication::translate("KReportZoomMode", modes[mode]);
 }
 
 KReportZoomMode::Mode KReportZoomMode::toMode(const QString& mode)
 {
     if(mode == QCoreApplication::translate("KReportZoomMode", modes[ZOOM_WIDTH]))
         return ZOOM_WIDTH;
     else
     if(mode == QCoreApplication::translate("KReportZoomMode", modes[ZOOM_PAGE]))
         return ZOOM_PAGE;
     else
      if(mode == QCoreApplication::translate("KReportZoomMode", modes[ZOOM_PIXELS]))
         return ZOOM_PIXELS;
     else
      if(mode == QCoreApplication::translate("KReportZoomMode", modes[ZOOM_TEXT]))
         return ZOOM_TEXT;
     else
        return ZOOM_CONSTANT;
     // we return ZOOM_CONSTANT else because then we can pass '10%' or '15%'
     // or whatever, it's automatically converted. ZOOM_CONSTANT is
     // changeable, whereas all other zoom modes (non-constants) are normal
     // text like "Fit to xxx". they let the view grow/shrink according
     // to windowsize, hence the term 'non-constant'
 }
 
 qreal KReportZoomMode::minimumZoom()
 {
     return minimumZoomValue;
 }
 
 qreal KReportZoomMode::maximumZoom()
 {
     return maximumZoomValue;
 }
 
 qreal KReportZoomMode::clampZoom(qreal zoom)
 {
     return qMin(maximumZoomValue, qMax(minimumZoomValue, zoom));
 }
 
 void KReportZoomMode::setMinimumZoom(qreal zoom)
 {
     Q_ASSERT(zoom > 0.0f);
     minimumZoomValue = zoom;
 }
 
 void KReportZoomMode::setMaximumZoom(qreal zoom)
 {
     Q_ASSERT(zoom > 0.0f);
     maximumZoomValue = zoom;
 }
diff --git a/tools/sdc.py b/tools/sdc.py
index 780e1935..46c82e4d 100755
--- a/tools/sdc.py
+++ b/tools/sdc.py
@@ -1,1008 +1,1008 @@
 #!/usr/bin/env python
 # -*- coding: utf-8 -*-
 from __future__ import print_function
 #
 #   This file is part of the KDE project
 #   Copyright (C) 2010-2015 Jarosław Staniek 
 #
 #   Shared Data Compiler (SDC)
 
 version = '0.2'
 
 #   A tool that takes a header file with C++ class declaration with specification
 #   of class' data members and injects getters, setters and facilities for
 #   Qt 5-compatible implicitly/explicitly sharing. Tedious, manual work is considerably
 #   reduced. The generated code is enriched with Doxygen-style documentation.
 #
 #   Syntax:
 #    Add an //SDC: comment to the class declaration line
 #        class MYLIB_EXPORT MyClass [: public SuperClass] //SDC: [CLASS_OPTIONS]
 #
 #    supported CLASS_OPTIONS: namespace=NAMESPACE, with_from_to_map,
 #                             operator==, explicit, virtual_dtor, custom_clone
 #
 #    TODO: explain details in README-SDC.md
 #
 #    Specification of each class' data members should be in form:
 #
 #        TYPE NAME; //SDC: [DATA_MEMBER_OPTIONS]
 #
 #    Supported DATA_MEMBER_OPTIONS: default=DEFAULT_VALUE, no_getter, no_setter,
 #                                   getter=CUSTOM_GETTER_NAME,
 #                                   setter=CUSTOM_SETTER_NAME,
 #                                   custom, custom_getter, custom_setter,
 #                                   default_setter=DEFAULT_SETTER_PARAM,
 #                                   mutable, simple_type, invokable,
 #                                   internal, custom_clone
 #    If NAME contains '(' then 'TYPE NAME;' is added to the shared data class
 #    as a method declaration.
 #
 #   This program is free software; you can redistribute it and/or
 #   modify it under the terms of the GNU General Public
 #   License as published by the Free Software Foundation; either
 #   version 2 of the License, or (at your option) any later version.
 #
 #   This program 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 program; see the file COPYING.  If not, write to
 #   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 #   Boston, MA 02110-1301, USA.
 #
 #   As a special exception, you may create a larger work that contains
 #   code generated by the Shared Data Compiler and distribute that work
 #   under terms of the GNU Lesser General Public License (LGPL) as published
 #   by the Free Software Foundation; either version 2.1 of the License,
 #   or (at your option) any later version or under terms that are fully
 #   compatible with these licenses.
 #
 #   Alternatively, if you modify or redistribute the Shared Data Compiler tool
 #   itself, you may (at your option) remove this special exception, which will
 #   cause the resulting generted source code files to be licensed under
 #   the GNU General Public License (either version 2 of the License, or
 #   at your option under any later version) without this special exception.
 #
 #   This special exception was added by Jarosław Staniek.
 #   Contact him for more licensing options, e.g. using in non-Open Source projects.
 #
 
 import os, sys, shlex
 
 line = ''
 
 APPNAME = "Shared Data Compiler"
 
 def usage():
     print('''Usage: %s [INPUT] [OUTPUT]
 %s version %s
 ''' % (sys.argv[0], APPNAME, version))
 
 def syntax_error(msg):
     print(APPNAME, "Syntax error in %s: %s" % (in_fname, msg), file=sys.stderr)
     sys.exit(1)
 
 def warning(*objs):
     print(APPNAME, "WARNING:", *objs, file=sys.stderr)
 
 if len(sys.argv) < 3:
     usage()
     sys.exit(0)
 
 # --- open ---
 in_fname = sys.argv[1]
 out_fname = sys.argv[2]
 
 try:
     infile = open(in_fname, "rb") # binary mode needed for Windows
     outfile = open(out_fname, "w")
 except Exception, inst:
     print(inst)
     sys.exit(1)
 
 outfile_sdc = None
 
 # --- utils ---
 def param(lst, name):
     for item in lst:
         s = item.split('=')
         if len(s) > 1 and s[0] == name:
             return s[1]
     return ''
 
 def param_exists(lst, name):
     try:
         if lst.index(name) >= 0:
             return True
     except ValueError:
             pass
     return False
 
 def find_index(list, elem):
     try:
         i = list.index(elem)
     except ValueError:
         i = -1
     return i
 
 def find_last_index(list, elem):
     i = find_index(list[::-1], elem) #reverted
     return -1 if i == -1 else len(list) - i - 1
 
 # --- process ---
 shared_class_name = ''
 shared_class_options = {}
 generated_code_inserted = False
 shared_class_inserted = False
 data_class_ctor = ''
 data_class_copy_ctor = ''
 data_class_members = ''
 members_list = []
 data_accesors = ''
 protected_data_accesors = ''
 main_ctor = ''
 member = {}
 toMap_impl = ''
 fromMap_impl = ''
 
 def get_file(fname):
     if fname.rfind(os.sep) == -1:
         return fname
     return fname[fname.rfind(os.sep)+1:]
 
 def open_sdc():
     global outfile_sdc, shared_class_options
     if not outfile_sdc:
         sdc_fname = out_fname.replace('.h', '_sdc.cpp')
         try:
             outfile_sdc = open(sdc_fname, "w")
         except Exception, inst:
             print(inst)
             sys.exit(1)
     outfile_sdc.write(warningHeader())
     outfile_sdc.write("""#include "%s"
 #include 
 
 """ % get_file(out_fname))
 
     if shared_class_options['namespace']:
         outfile_sdc.write("""using namespace %s;
 
 """ % shared_class_options['namespace'])
 
 """
     Inserts generated fromMap(), toMap() code into the output.
     Declarations are inserted into the header, definitions into extra *_sdc.cpp file
 """
 def insert_fromMap_toMap_methods():
     global outfile, shared_class_name, toMap_impl, fromMap_impl
     outfile.write("""    /*! @return map with saved attributes of the %s object.
 
      @see %s(const QMap&, bool *).
     */
     QMap toMap() const {
         return d->toMap();
     }
 
 """ % (shared_class_name, shared_class_name))
     open_sdc()
     outfile_sdc.write("""%s::Data::Data(const QMap &map, bool *ok)
 {
 %s
     if (ok)
         *ok = true;
 }
 
 QMap %s::Data::toMap() const
 {
     QMap map;
 %s
     return map;
 }
 """ % (shared_class_name, fromMap_impl, shared_class_name, toMap_impl))
     outfile_sdc.close()
 
 """
     Inserts generated operator==() code for shared class into the output.
 """
 def insert_operator_eq():
     global outfile, shared_class_name, shared_class_options, superclass
     data = 'data()' if superclass else 'd'
     otherData = 'other.' + data
     if not shared_class_options['explicit']: # deep comparison only for implicitly shared data
         data = '*' + data
         otherData = '*' + otherData
     outfile.write("""    //! @return true if this object is equal to @a other; otherwise returns false.
     bool operator==(const %s &other) const {
         return %s == %s;
     }
 
 """ % (shared_class_name, data, otherData))
 
 """
     Inserts generated operator!=() code for shared class into the output.
 """
 def insert_operator_neq():
     global outfile, shared_class_name, shared_class_options, superclass
     outfile.write("""    //! @return true if this object is not equal to @a other; otherwise returns false.
     bool operator!=(const %s &other) const {
         return !operator==(other);
     }
 
 """ % (shared_class_name))
 
 """
     Inserts generated clone() method (makes sense for explicitly shared class).
 """
 def insert_clone():
     global outfile, shared_class_name, shared_class_options, superclass
     line = """    //! Clones the object with all attributes; the copy isn't shared with the original.
-    virtual %s clone() const%s""" % (shared_class_name, 'Q_DECL_OVERRIDE ' if superclass else '')
+    virtual %s clone() const%s""" % (shared_class_name, 'override ' if superclass else '')
     custom_clone = False; # not needed I guess: shared_class_options['custom_clone']
     if custom_clone:
         line += """;
 """
     else:
         line += """ {
         return %s(d->clone());
     }
 """ % (shared_class_name)
     outfile.write(line)
 
 """
     Inserts generated Data::operator==() code into the output.
 """
 def insert_data_operator_eq():
     global outfile, members_list, superclass
     outfile.write("""        bool operator==(const Data &other) const {
 """)
     outfile.write("            return ")
     first = True;
     space = """
                    && """
     if superclass:
         outfile.write('%s::Data::operator==(other)' % superclass)
         first = False;
     for member in members_list:
         if member['internal']:
             continue
         outfile.write("""%s%s == other.%s""" % ('' if first else space, member['name'], member['name']))
         if first:
             first = False
     outfile.write(""";
         }
 
 """)
 
 """
     Inserts generated code into the output.
 """
 def insert_generated_code(context):
     global infile, outfile, generated_code_inserted, data_class_ctor, data_class_copy_ctor, superclass
     global data_class_members, data_accesors, protected_data_accesors, main_ctor, shared_class_name, shared_class_options
     global prev_line
     if generated_code_inserted:
         return;
     #print "--------insert_generated_code--------"
     #outfile.write('//CONTEXT:' + str(context) + '\n')
     #outfile.write('//data_class_ctor>\n')
     outfile.write(data_class_ctor)
     #outfile.write('// &map, bool *ok);
 
         QMap toMap() const;
 
 """)
     if shared_class_options['operator=='] and not shared_class_options['explicit']:
         insert_data_operator_eq()
 
     outfile.write(data_class_members)
     outfile.write(main_ctor)
     outfile.write(data_accesors)
     outfile.write("\n")
     if shared_class_options['with_from_to_map']:
         insert_fromMap_toMap_methods()
     if shared_class_options['operator==']:
         insert_operator_eq()
         insert_operator_neq()
     if shared_class_options['explicit'] and (not superclass or shared_class_options['custom_clone']):
         insert_clone()
     if protected_data_accesors:
         outfile.write("protected:")
         outfile.write(protected_data_accesors)
         outfile.write("\npublic:")
     outfile.write("\n")
     generated_code_inserted = True
 
 
 """
     Reads documentation for single section (setter or getter) and returns it.
     Leaves the file pointer before */ or another @getter/@setter mark.
 """
 def read_getter_or_setter_doc():
     global prev_line, line
     result = ''
     while True:
         prev_pos = infile.tell()
         prev_line = line
         line = infile.readline()
         if not line:
             break
         elif line.find('*/') != -1 or line.find('@getter') != -1 or line.find('@setter') != -1:
             #print "seek prev from " + line
             infile.seek(prev_pos)
             break
         else:
             result += line
     return result
 
 def process_docs(comment):
     global prev_line, line
     result = {}
     while True:
         prev_line = line
         line = infile.readline()
         #print "process_docs: " + line
         if not line:
             break
         elif line.find('*/') != -1:
             if result == {}:
                 insert_generated_code(1)
                 outfile.write(line)
             break
         elif line.find('@getter') != -1:
             result['getter'] = read_getter_or_setter_doc()
         elif line.find('@setter') != -1:
             result['setter'] = read_getter_or_setter_doc()
         else:
             insert_generated_code(2)
             outfile.write(comment)
             outfile.write(line)
     if result == {}:
         result = None
     #print "process_docs result: " + str(result)
     return result
 
 def try_read_member_docs(comment):
     global prev_line, line
     prev_pos = infile.tell()
     result = comment
     while True:
         prev_line = line
         line = infile.readline()
         if not line or line.find('@getter') != -1 or line.find('@setter') != -1:
             infile.seek(prev_pos)
             return None
         elif line.find('*/') != -1:
             return result
         else:
             result += line
     return None
 
 """ makes setter out of name or returns forceSetter if specified """
 def makeSetter(name, forceSetter):
     if forceSetter:
         return forceSetter
     return 'set' + name[0].upper() + name[1:]
 
 def update_data_accesors():
     global data_accesors, protected_data_accesors, member
     if not member['no_getter']:
         if member.has_key('getter_docs'):
             val = '\n    /*!\n' + member['getter_docs'] + '    */'
             if member['access'] == 'public':
                 data_accesors += val
             else: # protected
                 protected_data_accesors += val
         getter = member['getter']
         if not getter:
             getter = member['name']
         invokable = 'Q_INVOKABLE ' if member['invokable'] else ''
         if member['custom_getter']:
             val = """
     %s%s %s() const;
 """ % (invokable, member['type'], getter)
         else:
             val = """
     %s%s %s() const {
         return %s->%s;
     }
 """ % (invokable, member['type'], getter, 'data()' if superclass else 'd', member['name'])
         if member['access'] == 'public':
             data_accesors += val
         else: # protected
             protected_data_accesors += val
     if not member['no_setter']:
         if member.has_key('setter_docs'):
             val = '\n    /*!\n' + member['setter_docs'] + '    */'
             if member['access'] == 'public':
                 data_accesors += val
             else: # protected
                 protected_data_accesors += val
         # heuristics to check if the const & should be used:
         arg_type = member['type']
         if arg_type.lower() != arg_type and not member['simple_type']:
             arg_type = 'const %s &' % arg_type
         setter = makeSetter(member['name'], member['setter'])
         default_setter = (' = ' + member['default_setter']) if member['default_setter'] else ''
         invokable = 'Q_INVOKABLE ' if member['invokable'] else ''
         if member['custom_setter']:
             val = """
     %svoid %s(%s %s%s);
 """ % (invokable, setter, arg_type, member['name'], default_setter)
         else:
             val = """
     %svoid %s(%s %s%s) {
         %s->%s = %s;
     }
 """ % (invokable, setter, arg_type, member['name'], default_setter, 'data()' if superclass else 'd', member['name'], member['name'])
         if member['access'] == 'public':
             data_accesors += val
         else: # protected
             protected_data_accesors += val
 
 def data_member_found(lst):
     return len(lst) > 2 and lst[0] != 'class' and find_index(lst, '//SDC:') >= 2
 
 # sets shared_class_options[option_name] to proper value; returns lst with removed element option_name if exists
 def get_shared_class_option(lst, option_name):
     global shared_class_options
     shared_class_options[option_name] = param_exists(lst, option_name)
     if shared_class_options[option_name]:
         lst.remove(option_name)
     return lst
 
 """ like get_shared_class_option() but also gets value (not just checks for existence) """
 def get_shared_class_option_with_value(lst, option_name):
     global shared_class_options
     for item in lst:
         s = item.split('=')
         if len(s) > 1 and s[0] == option_name:
             lst.remove(item)
             shared_class_options[option_name] = s[1]
             return lst
     shared_class_options[option_name] = False
     return lst
 
 def enabled_shared_class_options():
     global shared_class_options
     result = []
     for opt in shared_class_options:
         if shared_class_options[opt]:
             result.append(opt)
     # add some defaults
     if find_index(result, 'explicit') == -1:
         result.append('implicit')
     return result
 
 def warningHeader():
     return """/****************************************************************************
 ** Shared Class code from reading file '%s'
 **
 ** Created
 **      by: The Shared Data Compiler version %s
 **
 ** WARNING! All changes made in this file will be lost!
 *****************************************************************************/
 
 """ % (get_file(in_fname), version)
 
 """ generates conversion code to string from many types, used by Data::toMap()
     @todo more types """
 def generate_toString_conversion(name, _type):
     if _type == 'QString' or _type == 'QByteArray':
         return name
     elif _type == 'bool':
         return 'QString::number((int)%s)' % name # 0 or 1
     return 'QVariant(%s).toString()' % name
 
 """ generates conversion code from string to many types, used by Data(QMap<..>)
     @todo more types """
 def generate_fromString_conversion(name, _type):
     s = 'map[QLatin1String(\"%s\")]' % name
     if _type == 'bool': # 0 or 1
         return """%s = %s.toInt(ok) == 1;
     if (ok && !(*ok))
         return;
 """ % (name, s)
     elif _type == 'int':
         return """%s = %s.toInt(ok);
     if (ok && !(*ok))
         return;
 """ % (name, s)
     else: # QString...
         return "%s = %s;" % (name, s)
 
 # returns position (line number) for #include  or -1 if #include  isn't needed
 def get_pos_for_QSharedData_h():
     global infile, prev_line, line
     prev_pos = infile.tell()
     line_number = -1
     infile.seek(0)
     # find last #include
     last_include = -1
     while True:
         prev_line = line
         line = infile.readline().lower()
         if not line:
             break
         line_number += 1
         if line.find('#include ') != -1:
             if line.find('qshareddata') != -1:
                 last_include = -1
                 break
             else:
                 last_include = line_number + 1
     infile.seek(prev_pos)
     return last_include
 
 # replaces "Foo>" with "Foo< ABC< DEF > >" to avoid build errors
 def fix_templates(s):
     if s.count('<') < 2:
         return s
     result=''
     for c in s:
         if c == '>':
             result += ' '
         result += c
         if c == '<':
             result += ' '
     return result
 
 def other_comment(line):
     ln = line.strip(' ')
     return ln.startswith('/**') \
       or ln.startswith('/*!') \
       or ln .startswith('//!') \
       or ln.startswith('///')
 
 """ @return (shared_class_name, export_macro, superclass) """
 def get_shared_class_name_export_and_superclass(lst):
     # if 'lst' contains ':' and then 'public', we have inheritance
     i = find_last_index(lst, 'public') # last index because there can be multiple 'public/protected' and most likely we want the last
     #print i
     if i >= 3:
         inheritance_type = 'public'
     else:
         i = find_last_index(lst, 'protected')
         inheritance_type = 'protected' if i >= 3 else ''
     # - if there's inheritance and export_macro exists, lst has at least 6 elements:
     # ['class', export_macro, shared_class_name, ':', 'public/protected', superclass, ...]:
     # - if export_macro exists, lst has at least 3 elements:
     # ['class', export_macro, shared_class_name, ...]:
     expected_len = 6 if inheritance_type else 3
     if len(lst) >= expected_len:
         _shared_class_name = lst[2]
         _export_macro = lst[1]
     else: # no export_macro
         _shared_class_name = lst[1]
         _export_macro = ''
     _superclass = lst[i + 1] if inheritance_type else ''
     return (_shared_class_name, _export_macro, _superclass)
 
 """ Strips the C++ comment //: @return lst with removed first found element that starts
     with '//' and all following """
 def remove_cpp_comment(lst):
     result = []
     for el in lst:
         if el.startswith('//'):
             break
         result.append(el)
     return result
 
 """ Simplifies a multi-line doc like this:
 /*!
 Foo
 */
 to:
 /*! Foo */ """
 def simplify_multiline_doc(doc):
     lines = doc.split('\n')
     result = []
     if lines[0].strip() == '':
         result += '\n'
         lines.pop(0)
     if len(lines) < 2:
         return doc
     indentation = '';
     i = 0;
     for c in lines[0]:
         if c == ' ' or c == '\t':
             indentation += c
         else:
             break
     line0 = lines[0].strip()
     line1 = lines[1].strip()
     if line0 == '/*!' and not line1.startswith('/*') and not line1.startswith('/*'):
         result += indentation + '/*! ' + line1 + '\n'
         lines = lines[2:] # because line 0 and 1 already processed
     for line in lines:
         if line.strip() == '*/': # add to prev line
             last = result.pop()
             result += last[:-1] + ' */\n'
         else:
             result += line + '\n'
     result[-1] = result[-1][:-1] # remove last \n
     return ''.join(result)
 
 def process():
     global infile, outfile, generated_code_inserted, data_class_ctor, data_class_copy_ctor
     global shared_class_name, superclass, shared_class_options, shared_class_inserted, data_class_members
     global members_list, data_accesors, member, main_ctor, toMap_impl, fromMap_impl
     global prev_line, line
     outfile.write(warningHeader())
 
     member = {}
     after_member = False
 
     data_class_ctor = ''
     data_class_copy_ctor = ''
     data_class_ctor_changed = False
     data_class_copy_ctor_changed = False
     position_for_include_QSharedData_h = get_pos_for_QSharedData_h()
 
     line_number = -1 # used for writing #include 
     while True:
         prev_line = line
         line = infile.readline()
         line_number += 1
         if not line:
             break
 #        print line,
         lst = line.split()
         #print lst, find_index(lst, '//SDC:')
         if line_number == position_for_include_QSharedData_h:
             outfile.write("""#include 
 """)
             position_for_include_QSharedData_h = -1
         line_starts_with_class = len(lst) > 0 and lst[0] == 'class'
         if line_starts_with_class and find_index(lst, '//SDC:') < 0:
             shared_class_inserted = False # required because otherwise QSharedDataPointer d will be added to all classes
             outfile.write(line)
         elif line_starts_with_class and find_index(lst, '//SDC:') > 0:
             # re-init variables, needed if there are more than one shared class per file
             shared_class_inserted = False
             generated_code_inserted = False
             shared_class_options = {}
             data_class_ctor = ''
             data_class_copy_ctor = ''
             data_class_members = ''
             members_list = []
             data_accesors = ''
             protected_data_accesors = ''
             toMap_impl = ''
             fromMap_impl = ''
             data_class_ctor_changed = False
             data_class_copy_ctor_changed = False
             lst = shlex.split(line) # better than default split()
             # Syntax: shared class [EXPORT_MACRO] [CLASS_OPTIONS] MyClass [: public SuperClass]
             # Any unrecognized bits are left out, this lets to use EXPORT_MACRO=MYLIB_EXPORT for example.
             # output: class [EXPORT_MACRO] MyClass [: public SuperClass]
             lst = get_shared_class_option(lst, 'explicit')
             lst = get_shared_class_option(lst, 'operator==')
             lst = get_shared_class_option(lst, 'with_from_to_map')
             lst = get_shared_class_option(lst, 'virtual_dtor')
             lst = get_shared_class_option(lst, 'custom_clone') # only insert declaration of clone()
             lst = get_shared_class_option_with_value(lst, 'namespace')
             (shared_class_name, export_macro, superclass) = get_shared_class_name_export_and_superclass(lst)
             if superclass:
                 shared_class_options['virtual_dtor'] = True # inheritance implies this
             if shared_class_options['custom_clone'] and not shared_class_options['explicit']:
                 warning('\'custom_clone\' class option only supported with \'explicit\' class option')
                 shared_class_options['custom_clone'] = False
             main_ctor = """    };
 
     %s()
      : %s(new Data)
     {
     }
 
     %s(const %s &other)
      : %s
     {
     }
 """ % (shared_class_name, superclass if superclass else 'd', shared_class_name, shared_class_name, (superclass + '(other)') if superclass else 'd(other.d)')
             if superclass:
                 main_ctor += """
     %s(const %s &other)
      : %s(other)
     {
         if (!data()) { // '@a 'other' does not store suitable data, create a new one and copy what we have
             d = new Data(*d.data());
         }
     }
 """ % (shared_class_name, superclass, superclass)
 
             if shared_class_options['with_from_to_map']:
                 main_ctor += """
     /*! Constructor for %s object, takes attributes saved to map @a map.
          If @a ok is not 0, sets *ok to true on success and to false on failure. @see toMap(). */
     %s(const QMap &map, bool *ok)
      : d(new Data(map, ok))
     {
     }
 """ % (shared_class_name, shared_class_name)
             main_ctor += """
     %s~%s();
 """ % (('virtual ' if shared_class_options['virtual_dtor'] else ''), shared_class_name)
             if shared_class_options['explicit']:
                 outfile.write("""/*! @note objects of this class are explicitly shared, what means they behave like regular
           C++ pointers, except that by doing reference counting and not deleting the shared
           data object until the reference count is 0, they avoid the dangling pointer problem.
           See Qt documentation.
  */
 """)
             else:
                 outfile.write("""/*! @note objects of this class are implicitly shared, what means they have value semantics
           by offering copy-on-write behaviour to maximize resource usage and minimize copying.
           Only a pointer to the data is passed around. See Qt documentation.
  */
 """)
 
             # Finally output the class name: use all remaining elements of 'lst' except
             # the 0th (which is the 'shared' keyword):
             outfile.write('//! @note This class has been generated using the following SDC class options: '
                           + ', '.join(enabled_shared_class_options()) + '\n')
             outfile.write(' '.join(remove_cpp_comment(lst)) + '\n')
             while True:
                 prev_line = line
                 line = infile.readline() # output everything until 'public:'
                 outfile.write(line)
                 if line.strip().startswith('public:'):
                     break
             shared_class_inserted = True
         elif len(lst) >= 2 and lst[0] == '#if' and lst[1] == '0':
             insert_generated_code(3)
             outfile.write(line)
             while True:
                 prev_line = line
                 line = infile.readline()
                 lst = line.split()
                 if not line:
                     break
                 elif len(lst) >= 1 and lst[0] == '#endif':
                     outfile.write(line)
                     break
                 outfile.write(line)
         elif len(lst) == 1 and (lst[0] == '/**' or lst[0] == '/*!'):
             comment = line
 
             member_docs = try_read_member_docs(comment)
             #print "member_docs:" + str(member_docs)
 
             docs = None
             if member_docs:
                 member = {}
                 member['docs'] = '\n    ' + member_docs.replace('\n', '\n    ') + '    */';
             else:
                 docs = process_docs(comment)
             if docs:
                 #print "DOCS:" + str(docs)
                 member = {}
                 if docs.has_key('getter'):
                     member['getter_docs'] = docs['getter']
                 if docs.has_key('setter'):
                     member['setter_docs'] = docs['setter']
             elif not member_docs:
                 insert_generated_code(4)
                 outfile.write(comment)
         elif len(lst) >= 2 and lst[0] == 'enum':
             # skip enums: until '};' found
             outfile.write(line)
             while True:
                 prev_line = line
                 line = infile.readline()
                 lst = line.split()
                 if len(lst) > 0 and lst[0] == '};':
                     outfile.write(line)
                     break
                 outfile.write(line)
         elif data_member_found(lst):
             """ for syntax see top of the file """
             if lst[1].endswith(';'):
                 lst[1] = lst[1][:-1] # strip ';' from member name
             sdc_index = find_index(lst, '//SDC:')
             options_list = lst[sdc_index+1:]
             #print lst
             member['name'] = lst[1]
             member['type'] = fix_templates(lst[0])
             member['access'] = 'protected' if (find_index(options_list, 'protected') >= 0) else 'public'
             member['default'] = param(options_list, 'default')
             member['default_setter'] = param(options_list, 'default_setter')
             member['internal'] = param_exists(options_list, 'internal'); # skip Data::operators and setter/getter
             member['no_getter'] = param_exists(options_list, 'no_getter') or member['internal']
             member['getter'] = param(options_list, 'getter')
             member['no_setter'] = param_exists(options_list, 'no_setter') or member['internal']
             member['setter'] = param(options_list, 'setter')
             member['custom'] = param_exists(options_list, 'custom')
             member['custom_getter'] = param_exists(options_list, 'custom_getter') or member['custom']
             member['custom_setter'] = param_exists(options_list, 'custom_setter') or member['custom']
             member['mutable'] = param_exists(options_list, 'mutable')
             member['simple_type'] = param_exists(options_list, 'simple_type')
             member['invokable'] = param_exists(options_list, 'invokable')
             # '(' found in name so it's a method declaration -> just add it to the data class
             isMethodDeclaration = find_index(member['name'], '(') >= 0
             isInternalMember = member['no_getter'] and member['no_setter']
             #print member
             if not data_class_ctor_changed:
                 data_class_ctor = """    //! @internal data class used to implement %s shared class %s.
     //! Provides thread-safe reference counting.
     class Data : public %s
     {
     public:
         Data()
 """ % ('explicitly' if shared_class_options['explicit'] else 'implicitly', shared_class_name, (superclass + '::Data') if superclass else 'QSharedData')
             if not data_class_copy_ctor_changed:
                 data_class_copy_ctor = ''
                 if superclass:
                     data_class_copy_ctor += """
         Data(const %s::Data &other)
          : %s::Data(other)
         {
         }
 """ % (superclass, superclass)
                 data_class_copy_ctor += """
         Data(const Data &other)
          : %s(other)
 """ % ((superclass + '::Data') if superclass else 'QSharedData')
                 data_class_copy_ctor_changed = True
             if not isMethodDeclaration:
                 members_list.append(member);
                 if member['default']:
                     data_class_ctor += '        '
                     if data_class_ctor_changed:
                         data_class_ctor += ', '
                     else:
                         data_class_ctor += ': '
                         data_class_ctor_changed = True
                     data_class_ctor += member['name'] + '(' + member['default'] + ')\n'
     #            print data_class_ctor
                 if not member['internal']:
                     data_class_copy_ctor += '         , %s(other.%s)\n' % (member['name'], member['name'])
             if member.has_key('docs'):
                 data_class_members += simplify_multiline_doc(member['docs']) + '\n';
 
             mutable = 'mutable ' if member['mutable'] else ''
             data_class_members += "        %s%s;" % (mutable, ' '.join(lst[:sdc_index]))
             # add doc for shared data member
             if not isMethodDeclaration:
                 if isInternalMember:
                     data_class_members += ' //!< @internal'
                 else:
                     data_class_members += ' //!< @see '
                 if not member['no_getter']:
                     getter = member['getter']
                     if not getter:
                         getter = member['name']
                     data_class_members += "%s::%s()" % (shared_class_name, getter)
                 if not member['no_setter']:
                     if not member['no_getter']:
                         data_class_members += ", "
                     setter = makeSetter(member['name'], member['setter'])
                     data_class_members += "%s::%s()" % (shared_class_name, setter)
 
             data_class_members += '\n'
 
             if not isMethodDeclaration:
                 if shared_class_options['with_from_to_map']:
                     toMap_impl += '    map[QLatin1String(\"%s\")] = %s;\n' % (member['name'], generate_toString_conversion(member['name'], member['type']))
                     fromMap_impl += '    %s\n' % generate_fromString_conversion(member['name'], member['type'])
                 update_data_accesors()
 
             member = {}
             if len(prev_line.split()) == 0: # remove current line because it's not going to the output now; this helps to remove duplicated empty lines
                 line = ''
             after_member = True
         elif len(lst) > 0 and lst[0] == '};' and line[:2] == '};' and shared_class_inserted:
             insert_generated_code(5)
 #            outfile.write('\nprivate:\n');
             outfile.write('\nprotected:\n');
             if shared_class_options['explicit']:
                 if superclass:
                     outfile.write("""    virtual const Data* data() const { return dynamic_cast(%s::d.constData()); }
     virtual Data* data() { return dynamic_cast(%s::d.data()); }
 """ % (superclass, superclass))
                 else:
                     outfile.write("""    %s(Data *data)
      : d(data)
     {
     }
 
     %s(QExplicitlySharedDataPointer<%s::Data> &data)
      : d(data)
     {
     }
 
     QExplicitlySharedDataPointer d;
 """ % (shared_class_name, shared_class_name, shared_class_name))
             else:
                 outfile.write('    QSharedDataPointer d;\n');
             outfile.write(line)
 
             if shared_class_options['explicit']:
                 outfile.write("""
 template<>
 %s %s::Data *QSharedDataPointer<%s::Data>::clone();
 """ % (export_macro, shared_class_name, shared_class_name))
                 open_sdc()
                 outfile_sdc.write("""template<>
 %s %s::Data *QSharedDataPointer<%s::Data>::clone()
 {
     return d->clone();
 }
 """ % (export_macro, shared_class_name, shared_class_name))
 
         else:
             #outfile.write('____ELSE____\n');
             if False and other_comment(line):
                 prev_pos = infile.tell()
                 prev_line_number = line_number
                 ln = line[:-1].strip(' ')
                 result = ''
                 print("'" + ln + "'")
                 if ln.startswith('/**') or ln.startswith('/*!'):
                     while True:
                         result += line
                         if not line or ln.endswith('*/'):
                             result = result[:-1]
                             break
                         prev_line = line
                         line = infile.readline()
                         line_number += 1
                         ln = line[:-1].strip(' ')
                     print(result)
                 if result:
                     member['docs'] = result
                 infile.seek(prev_pos)
                 prev_line = line
                 line = infile.readline()
                 lst = line.split()
                 line_number = prev_line_number
 
             if not lst:
                 if len(prev_line.split()) > 0:
                     #outfile.write('['+prev_line + ']prev_line[' + line +']')
                     outfile.write(line)
             elif not after_member or len(lst) > 0:
                 if shared_class_inserted:
                     insert_generated_code(6)
                 outfile.write(line)
             elif generated_code_inserted and len(lst) == 0:
                 #outfile.write('ELSE>>>' + line)
                 outfile.write(line)
 #            else:
 #                outfile.write(line)
 
 process()
 
 # --- close ---
 infile.close()
 outfile.close()