diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -104,6 +104,13 @@ endif() message(STATUS "Release build: ${RELEASE_BUILD}") +# use CPP-11 +if (CMAKE_VERSION VERSION_LESS "3.1") + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") +else () + set (CMAKE_CXX_STANDARD 11) +endif () + ############ ############# ## Options ## diff --git a/libs/widgets/KoAspectButton.h b/libs/widgets/KoAspectButton.h --- a/libs/widgets/KoAspectButton.h +++ b/libs/widgets/KoAspectButton.h @@ -32,7 +32,7 @@ public: /// constructor explicit KoAspectButton(QWidget *parent); - virtual ~KoAspectButton(); + ~KoAspectButton() Q_DECL_OVERRIDE; /// Returns of keeping aspect ratio is on or off bool keepAspectRatio() const; @@ -54,10 +54,10 @@ protected: /// reimplemented - virtual void mouseReleaseEvent(QMouseEvent *); - virtual void paintEvent (QPaintEvent *); - virtual QSize sizeHint () const; - void keyReleaseEvent (QKeyEvent *e); + void mouseReleaseEvent(QMouseEvent *) Q_DECL_OVERRIDE; + void paintEvent (QPaintEvent *) Q_DECL_OVERRIDE; + QSize sizeHint () const Q_DECL_OVERRIDE; + void keyReleaseEvent (QKeyEvent *e) Q_DECL_OVERRIDE; private: class Private; diff --git a/libs/widgets/KoColorPatch.h b/libs/widgets/KoColorPatch.h --- a/libs/widgets/KoColorPatch.h +++ b/libs/widgets/KoColorPatch.h @@ -32,7 +32,7 @@ Q_OBJECT public: explicit KoColorPatch( QWidget *parent ); - virtual ~KoColorPatch(); + ~KoColorPatch() override; /** * Set the color of this color patch @@ -46,9 +46,9 @@ KoColor color() const; protected: - virtual void mousePressEvent(QMouseEvent *e ); ///< reimplemented from QFrame - virtual void paintEvent(QPaintEvent *e); ///< reimplemented from QFrame - virtual QSize sizeHint() const; ///< reimplemented from QFrame + void mousePressEvent(QMouseEvent *e) Q_DECL_OVERRIDE; ///< reimplemented from QFrame + void paintEvent(QPaintEvent *e) Q_DECL_OVERRIDE; ///< reimplemented from QFrame + QSize sizeHint() const Q_DECL_OVERRIDE; ///< reimplemented from QFrame Q_SIGNALS: diff --git a/libs/widgets/KoColorPopupAction.h b/libs/widgets/KoColorPopupAction.h --- a/libs/widgets/KoColorPopupAction.h +++ b/libs/widgets/KoColorPopupAction.h @@ -42,12 +42,12 @@ * * @param parent The parent for this action. */ - explicit KoColorPopupAction(QObject *parent = 0); + explicit KoColorPopupAction(QObject *parent = nullptr); /** * Destructor */ - virtual ~KoColorPopupAction(); + ~KoColorPopupAction() Q_DECL_OVERRIDE; public Q_SLOTS: /// Sets a new color to be displayed diff --git a/libs/widgets/KoColorPopupButton.h b/libs/widgets/KoColorPopupButton.h --- a/libs/widgets/KoColorPopupButton.h +++ b/libs/widgets/KoColorPopupButton.h @@ -38,21 +38,21 @@ * * @param parent parent QWidget */ - explicit KoColorPopupButton(QWidget *parent=0); + explicit KoColorPopupButton(QWidget *parent = nullptr); /** * Destructor */ - virtual ~KoColorPopupButton(); + ~KoColorPopupButton() Q_DECL_OVERRIDE = default; - QSize sizeHint() const; + QSize sizeHint() const Q_DECL_OVERRIDE; Q_SIGNALS: /// Emitted when a resource was selected void iconSizeChanged(); protected: - virtual void resizeEvent(QResizeEvent *); ///< reimplemented from QToolButton + void resizeEvent(QResizeEvent *) Q_DECL_OVERRIDE; ///< reimplemented from QToolButton }; #endif diff --git a/libs/widgets/KoColorPopupButton.cpp b/libs/widgets/KoColorPopupButton.cpp --- a/libs/widgets/KoColorPopupButton.cpp +++ b/libs/widgets/KoColorPopupButton.cpp @@ -31,10 +31,6 @@ setToolButtonStyle(Qt::ToolButtonIconOnly); } -KoColorPopupButton::~KoColorPopupButton() -{ -} - QSize KoColorPopupButton::sizeHint() const { QStyleOptionToolButton opt; diff --git a/libs/widgets/KoColorSetWidget.h b/libs/widgets/KoColorSetWidget.h --- a/libs/widgets/KoColorSetWidget.h +++ b/libs/widgets/KoColorSetWidget.h @@ -47,12 +47,12 @@ * * @param parent parent QWidget */ - explicit KoColorSetWidget(QWidget *parent=0); + explicit KoColorSetWidget(QWidget *parent = nullptr); /** * Destructor */ - virtual ~KoColorSetWidget(); + ~KoColorSetWidget() Q_DECL_OVERRIDE; /** * Sets the color set that this widget shows. @@ -67,7 +67,7 @@ KoColorSet* colorSet(); protected: - virtual void resizeEvent(QResizeEvent *event); ///< reimplemented from QFrame + void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE; ///< reimplemented from QFrame Q_SIGNALS: diff --git a/libs/widgets/KoColorSlider.h b/libs/widgets/KoColorSlider.h --- a/libs/widgets/KoColorSlider.h +++ b/libs/widgets/KoColorSlider.h @@ -41,8 +41,8 @@ */ KoColor currentColor() const; protected: - virtual void drawContents( QPainter* ); - virtual void drawArrow(QPainter *painter, const QPoint &pos); + void drawContents( QPainter* ) Q_DECL_OVERRIDE; + void drawArrow(QPainter *painter, const QPoint &pos) Q_DECL_OVERRIDE; protected: struct Private; diff --git a/libs/widgets/KoColorSlider.cpp b/libs/widgets/KoColorSlider.cpp --- a/libs/widgets/KoColorSlider.cpp +++ b/libs/widgets/KoColorSlider.cpp @@ -32,7 +32,7 @@ struct Q_DECL_HIDDEN KoColorSlider::Private { - Private() : upToDate(false), displayRenderer(0) {} + Private() : upToDate(false), displayRenderer(nullptr) {} KoColor minColor; KoColor maxColor; QPixmap pixmap; diff --git a/libs/widgets/KoConfigAuthorPage.h b/libs/widgets/KoConfigAuthorPage.h --- a/libs/widgets/KoConfigAuthorPage.h +++ b/libs/widgets/KoConfigAuthorPage.h @@ -32,7 +32,7 @@ public: KoConfigAuthorPage(); - ~KoConfigAuthorPage(); + ~KoConfigAuthorPage() Q_DECL_OVERRIDE; void apply(); diff --git a/libs/widgets/KoContextBarButton.h b/libs/widgets/KoContextBarButton.h --- a/libs/widgets/KoContextBarButton.h +++ b/libs/widgets/KoContextBarButton.h @@ -32,19 +32,18 @@ class KoContextBarButton : public QToolButton { Q_OBJECT public: - explicit KoContextBarButton(const QString &iconName, QWidget *parent = 0); - ~KoContextBarButton(); + explicit KoContextBarButton(const QString &iconName, QWidget *parent = nullptr); + ~KoContextBarButton() override = default; public Q_SLOTS: void setFadingValue(int value); protected: - void paintEvent(QPaintEvent*); - virtual void enterEvent(QEvent *event); - virtual void leaveEvent(QEvent *event); - virtual void showEvent(QShowEvent *event); - virtual void hideEvent(QHideEvent *event); - + void paintEvent(QPaintEvent*) Q_DECL_OVERRIDE; + void enterEvent(QEvent *event) Q_DECL_OVERRIDE; + void leaveEvent(QEvent *event) Q_DECL_OVERRIDE; + void showEvent(QShowEvent *event) Q_DECL_OVERRIDE; + void hideEvent(QHideEvent *event) Q_DECL_OVERRIDE; private: /** Starts button fading animation */ diff --git a/libs/widgets/KoContextBarButton.cpp b/libs/widgets/KoContextBarButton.cpp --- a/libs/widgets/KoContextBarButton.cpp +++ b/libs/widgets/KoContextBarButton.cpp @@ -44,20 +44,14 @@ : QToolButton(parent) , m_isHovered(false) , m_fadingValue(0) -, m_fadingTimeLine(0) +, m_fadingTimeLine(nullptr) { const int size = QApplication::style()->pixelMetric(QStyle::PM_ButtonIconSize); setIconSize(QSize(size, size)); setAutoRaise(true); setIcon(QIcon::fromTheme(iconName)); } - -KoContextBarButton::~KoContextBarButton() -{ -} - - void KoContextBarButton::paintEvent(QPaintEvent*) { QStylePainter painter(this); @@ -135,7 +129,7 @@ if (m_fadingTimeLine) { m_fadingTimeLine->stop(); delete m_fadingTimeLine; - m_fadingTimeLine = 0; + m_fadingTimeLine = nullptr; } m_fadingValue = 0; } diff --git a/libs/widgets/KoCsvImportDialog.h b/libs/widgets/KoCsvImportDialog.h --- a/libs/widgets/KoCsvImportDialog.h +++ b/libs/widgets/KoCsvImportDialog.h @@ -53,7 +53,7 @@ /** * Destructor. */ - virtual ~KoCsvImportDialog(); + ~KoCsvImportDialog() Q_DECL_OVERRIDE; /** * Set the data to import. diff --git a/libs/widgets/KoDialog.h b/libs/widgets/KoDialog.h --- a/libs/widgets/KoDialog.h +++ b/libs/widgets/KoDialog.h @@ -172,7 +172,7 @@ /** * Destroys the dialog. */ - ~KoDialog(); + ~KoDialog() Q_DECL_OVERRIDE; /** * Creates (or recreates) the button box and all the buttons in it. @@ -821,7 +821,7 @@ void updateGeometry(); private: - KoDialog(KoDialogPrivate &dd, QWidget *parent, Qt::WindowFlags flags = 0); + KoDialog(KoDialogPrivate &dd, QWidget *parent, Qt::WindowFlags flags = nullptr); KoDialogPrivate *const d_ptr; private: diff --git a/libs/widgets/KoDialog_p.h b/libs/widgets/KoDialog_p.h --- a/libs/widgets/KoDialog_p.h +++ b/libs/widgets/KoDialog_p.h @@ -46,7 +46,7 @@ { } - virtual ~KoDialogPrivate() {} + virtual ~KoDialogPrivate() = default; KoDialog *q_ptr; diff --git a/libs/widgets/KoDockWidgetTitleBar.h b/libs/widgets/KoDockWidgetTitleBar.h --- a/libs/widgets/KoDockWidgetTitleBar.h +++ b/libs/widgets/KoDockWidgetTitleBar.h @@ -34,10 +34,10 @@ Q_OBJECT public: explicit KoDockWidgetTitleBar(QDockWidget *dockWidget); - virtual ~KoDockWidgetTitleBar(); + ~KoDockWidgetTitleBar() Q_DECL_OVERRIDE; - virtual QSize minimumSizeHint() const; ///< reimplemented from QWidget - virtual QSize sizeHint() const; ///< reimplemented from QWidget + QSize minimumSizeHint() const Q_DECL_OVERRIDE; ///< reimplemented from QWidget + QSize sizeHint() const Q_DECL_OVERRIDE; ///< reimplemented from QWidget enum TextVisibilityMode {TextCanBeInvisible, FullTextAlwaysVisible}; /// Define whether the minimal width should ensure that the full text is visible. @@ -52,8 +52,8 @@ void setCollapsable(bool collapsable); protected: - virtual void paintEvent(QPaintEvent* event); ///< reimplemented from QWidget - virtual void resizeEvent(QResizeEvent* event); ///< reimplemented from QWidget + void paintEvent(QPaintEvent* event) Q_DECL_OVERRIDE; ///< reimplemented from QWidget + void resizeEvent(QResizeEvent* event) Q_DECL_OVERRIDE; ///< reimplemented from QWidget private: Q_PRIVATE_SLOT(d, void toggleFloating()) Q_PRIVATE_SLOT(d, void toggleCollapsed()) diff --git a/libs/widgets/KoDockWidgetTitleBar.cpp b/libs/widgets/KoDockWidgetTitleBar.cpp --- a/libs/widgets/KoDockWidgetTitleBar.cpp +++ b/libs/widgets/KoDockWidgetTitleBar.cpp @@ -59,14 +59,14 @@ QDockWidget *q = dockWidget; d->floatButton = new KoDockWidgetTitleBarButton(this); - d->floatButton->setIcon(q->style()->standardIcon(QStyle::SP_TitleBarNormalButton, 0, q)); + d->floatButton->setIcon(q->style()->standardIcon(QStyle::SP_TitleBarNormalButton, nullptr, q)); connect(d->floatButton, SIGNAL(clicked()), SLOT(toggleFloating())); d->floatButton->setVisible(true); d->floatButton->setToolTip(i18nc("@info:tooltip", "Float Docker")); d->floatButton->setStyleSheet("border: 0"); d->closeButton = new KoDockWidgetTitleBarButton(this); - d->closeButton->setIcon(q->style()->standardIcon(QStyle::SP_TitleBarCloseButton, 0, q)); + d->closeButton->setIcon(q->style()->standardIcon(QStyle::SP_TitleBarCloseButton, nullptr, q)); connect(d->closeButton, SIGNAL(clicked()), q, SLOT(close())); d->closeButton->setVisible(true); d->closeButton->setToolTip(i18nc("@info:tooltip", "Close Docker")); @@ -180,8 +180,8 @@ QDockWidget *q = qobject_cast(parentWidget()); - int fw = q->isFloating() ? q->style()->pixelMetric(QStyle::PM_DockWidgetFrameWidth, 0, q) : 0; - int mw = q->style()->pixelMetric(QStyle::PM_DockWidgetTitleMargin, 0, q); + int fw = q->isFloating() ? q->style()->pixelMetric(QStyle::PM_DockWidgetFrameWidth, nullptr, q) : 0; + int mw = q->style()->pixelMetric(QStyle::PM_DockWidgetTitleMargin, nullptr, q); QStyleOptionDockWidget titleOpt; titleOpt.initFrom(q); @@ -208,7 +208,7 @@ { QDockWidget *q = qobject_cast(parentWidget()); - int fw = q->isFloating() ? q->style()->pixelMetric(QStyle::PM_DockWidgetFrameWidth, 0, q) : 0; + int fw = q->isFloating() ? q->style()->pixelMetric(QStyle::PM_DockWidgetFrameWidth, nullptr, q) : 0; QStyleOptionDockWidget opt; opt.initFrom(q); @@ -302,7 +302,7 @@ d->updateIcons(); q->setProperty("Locked", locked); - resizeEvent(0); + resizeEvent(nullptr); } @@ -338,7 +338,7 @@ void KoDockWidgetTitleBar::Private::toggleCollapsed() { QDockWidget *q = qobject_cast(thePublic->parentWidget()); - if (q == 0) // there does not *have* to be anything on the dockwidget. + if (q == nullptr) // there does not *have* to be anything on the dockwidget. return; preCollapsedWidth = q->widget()->isHidden() ? -1 : thePublic->width(); @@ -356,7 +356,7 @@ closeButton->setVisible(hasFeature(q, QDockWidget::DockWidgetClosable)); floatButton->setVisible(hasFeature(q, QDockWidget::DockWidgetFloatable)); - thePublic->resizeEvent(0); + thePublic->resizeEvent(nullptr); } // QT5TODO: this is not yet triggered by theme changes it seems @@ -373,7 +373,7 @@ if (q->widget()) { collapseButton->setIcon(q->widget()->isHidden() ? closeIcon(q) : openIcon(q)); } - thePublic->resizeEvent(0); + thePublic->resizeEvent(nullptr); } diff --git a/libs/widgets/KoDockWidgetTitleBarButton.h b/libs/widgets/KoDockWidgetTitleBarButton.h --- a/libs/widgets/KoDockWidgetTitleBarButton.h +++ b/libs/widgets/KoDockWidgetTitleBarButton.h @@ -37,15 +37,15 @@ public: explicit KoDockWidgetTitleBarButton(QWidget *parent = 0); - ~KoDockWidgetTitleBarButton(); + ~KoDockWidgetTitleBarButton() Q_DECL_OVERRIDE; - QSize sizeHint() const; ///< reimplemented from QWidget - QSize minimumSizeHint() const; ///< reimplemented from QWidget + QSize sizeHint() const Q_DECL_OVERRIDE; ///< reimplemented from QWidget + QSize minimumSizeHint() const Q_DECL_OVERRIDE; ///< reimplemented from QWidget protected: - virtual void enterEvent(QEvent *event); - virtual void leaveEvent(QEvent *event); - virtual void paintEvent(QPaintEvent *event); + void enterEvent(QEvent *event) Q_DECL_OVERRIDE; + void leaveEvent(QEvent *event) Q_DECL_OVERRIDE; + void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE; private: class Private; diff --git a/libs/widgets/KoDocumentInfoDlg.h b/libs/widgets/KoDocumentInfoDlg.h --- a/libs/widgets/KoDocumentInfoDlg.h +++ b/libs/widgets/KoDocumentInfoDlg.h @@ -76,7 +76,7 @@ void accept(); protected: // QWidget API - void hideEvent(QHideEvent * event); + void hideEvent(QHideEvent * event) Q_DECL_OVERRIDE; private Q_SLOTS: /** Connected with clicked() from pbReset - Reset parts of the metadata */ diff --git a/libs/widgets/KoDocumentInfoDlg.cpp b/libs/widgets/KoDocumentInfoDlg.cpp --- a/libs/widgets/KoDocumentInfoDlg.cpp +++ b/libs/widgets/KoDocumentInfoDlg.cpp @@ -60,7 +60,7 @@ setHeader(item->name()); setIcon(QIcon::fromTheme(item->iconName())); } - ~KoPageWidgetItemAdapter() { delete m_item; } + ~KoPageWidgetItemAdapter() Q_DECL_OVERRIDE { delete m_item; } bool shouldDialogCloseBeVetoed() { return m_item->shouldDialogCloseBeVetoed(); } void apply() { m_item->apply(); } @@ -77,7 +77,7 @@ toggleEncryption(false), applyToggleEncryption(false), documentSaved(false) {} - ~KoDocumentInfoDlgPrivate() {} + ~KoDocumentInfoDlgPrivate() = default; KoDocumentInfo* info; QList pages; diff --git a/libs/widgets/KoDocumentInfoPropsPage.h b/libs/widgets/KoDocumentInfoPropsPage.h --- a/libs/widgets/KoDocumentInfoPropsPage.h +++ b/libs/widgets/KoDocumentInfoPropsPage.h @@ -30,9 +30,9 @@ public: explicit KoDocumentInfoPropsPage(KPropertiesDialog *props, const QVariantList & = QVariantList()); - virtual ~KoDocumentInfoPropsPage(); + ~KoDocumentInfoPropsPage() Q_DECL_OVERRIDE; - virtual void applyChanges(); + void applyChanges() Q_DECL_OVERRIDE; private: class KoDocumentInfoPropsPagePrivate; diff --git a/libs/widgets/KoDocumentInfoPropsPage.cpp b/libs/widgets/KoDocumentInfoPropsPage.cpp --- a/libs/widgets/KoDocumentInfoPropsPage.cpp +++ b/libs/widgets/KoDocumentInfoPropsPage.cpp @@ -46,12 +46,12 @@ { d->m_info = new KoDocumentInfo(this); d->m_url = props->item().url(); - d->m_dlg = 0; + d->m_dlg = nullptr; if (!d->m_url.isLocalFile()) return; - d->m_dst = 0; + d->m_dst = nullptr; d->m_src = KoStore::createStore(d->m_url.toLocalFile(), KoStore::Read); diff --git a/libs/widgets/KoDpi.h b/libs/widgets/KoDpi.h --- a/libs/widgets/KoDpi.h +++ b/libs/widgets/KoDpi.h @@ -51,7 +51,7 @@ /// @internal, for KoApplication static void setDPI(int x, int y); - ~KoDpi(); + ~KoDpi() = default; private: static KoDpi* self(); diff --git a/libs/widgets/KoDpi.cpp b/libs/widgets/KoDpi.cpp --- a/libs/widgets/KoDpi.cpp +++ b/libs/widgets/KoDpi.cpp @@ -59,10 +59,6 @@ #endif } -KoDpi::~KoDpi() -{ -} - void KoDpi::setDPI(int x, int y) { //debugWidgets << x <<"," << y; diff --git a/libs/widgets/KoDualColorButton.h b/libs/widgets/KoDualColorButton.h --- a/libs/widgets/KoDualColorButton.h +++ b/libs/widgets/KoDualColorButton.h @@ -70,16 +70,16 @@ * @param dialogParent The parent widget of the color selection dialog. */ KoDualColorButton(const KoColor &foregroundColor, const KoColor &backgroundColor, - QWidget *parent = 0, QWidget* dialogParent = 0 ); + QWidget *parent = nullptr, QWidget* dialogParent = nullptr ); KoDualColorButton(const KoColor &foregroundColor, const KoColor &backgroundColor, const KoColorDisplayRendererInterface *displayRenderer, - QWidget *parent = 0, QWidget* dialogParent = 0 ); + QWidget *parent = nullptr, QWidget* dialogParent = nullptr); /** * Destroys the KoDualColorButton. */ - ~KoDualColorButton(); + ~KoDualColorButton() Q_DECL_OVERRIDE; /** * Returns the current foreground color. @@ -102,7 +102,7 @@ * Returns the minimum size needed to display the widget and all its * controls. */ - virtual QSize sizeHint() const; + virtual QSize sizeHint() const Q_DECL_OVERRIDE; public Q_SLOTS: /** @@ -150,13 +150,13 @@ */ virtual void metrics( QRect &foregroundRect, QRect &backgroundRect ); - virtual void paintEvent( QPaintEvent *event ); - virtual void mousePressEvent( QMouseEvent *event ); - virtual void mouseMoveEvent( QMouseEvent *event ); - virtual void mouseReleaseEvent( QMouseEvent *event ); - virtual void dragEnterEvent( QDragEnterEvent *event ); - virtual void dropEvent( QDropEvent *event ); - virtual void changeEvent(QEvent *event); + virtual void paintEvent( QPaintEvent *event ) Q_DECL_OVERRIDE; + virtual void mousePressEvent( QMouseEvent *event ) Q_DECL_OVERRIDE; + virtual void mouseMoveEvent( QMouseEvent *event ) Q_DECL_OVERRIDE; + virtual void mouseReleaseEvent( QMouseEvent *event ) Q_DECL_OVERRIDE; + virtual void dragEnterEvent( QDragEnterEvent *event ) Q_DECL_OVERRIDE; + virtual void dropEvent( QDropEvent *event ) Q_DECL_OVERRIDE; + virtual void changeEvent(QEvent *event) Q_DECL_OVERRIDE; private: class Private; diff --git a/libs/widgets/KoEditColorSetDialog.h b/libs/widgets/KoEditColorSetDialog.h --- a/libs/widgets/KoEditColorSetDialog.h +++ b/libs/widgets/KoEditColorSetDialog.h @@ -36,7 +36,7 @@ Q_OBJECT public: KoEditColorSetWidget(const QList &palettes, const QString &activePalette, QWidget *parent = 0); - virtual ~KoEditColorSetWidget(); + ~KoEditColorSetWidget() Q_DECL_OVERRIDE; /** * Return the active color set. The caller takes ownership of that color set. @@ -83,7 +83,7 @@ * @param activePalette name of the palette which will be activated after this dialog is shown. * @param parent the parent widget */ - KoEditColorSetDialog(const QList &palettes, const QString &activePalette, QWidget *parent = 0); + KoEditColorSetDialog(const QList &palettes, const QString &activePalette, QWidget *parent = nullptr); /** * Returns the last active color set. @@ -95,7 +95,7 @@ /** * Destructor */ - virtual ~KoEditColorSetDialog(); + ~KoEditColorSetDialog() Q_DECL_OVERRIDE; private: KoEditColorSetWidget *ui; diff --git a/libs/widgets/KoEditColorSetDialog.cpp b/libs/widgets/KoEditColorSetDialog.cpp --- a/libs/widgets/KoEditColorSetDialog.cpp +++ b/libs/widgets/KoEditColorSetDialog.cpp @@ -41,9 +41,9 @@ KoEditColorSetWidget::KoEditColorSetWidget(const QList &palettes, const QString &activePalette, QWidget *parent) : QWidget(parent), m_colorSets(palettes), - m_gridLayout(0), - m_activeColorSet(0), - m_activePatch(0), + m_gridLayout(nullptr), + m_activeColorSet(nullptr), + m_activePatch(nullptr), m_initialColorSetCount(palettes.count()), m_activeColorSetRequested(false) { @@ -111,7 +111,7 @@ { if (m_gridLayout) { delete m_gridLayout; - m_activePatch = 0; + m_activePatch = nullptr; } QWidget *wdg = new QWidget(m_scrollArea); @@ -197,7 +197,7 @@ { Q_ASSERT(m_activeColorSet); if (!m_activeColorSet->save()) - KMessageBox::error(0, i18n("Cannot write to palette file %1. Maybe it is read-only. ", m_activeColorSet->filename()), i18n("Palette")); + KMessageBox::error(nullptr, i18n("Cannot write to palette file %1. Maybe it is read-only. ", m_activeColorSet->filename()), i18n("Palette")); } KoColorSet *KoEditColorSetWidget::activeColorSet() diff --git a/libs/widgets/KoFillConfigWidget.h b/libs/widgets/KoFillConfigWidget.h --- a/libs/widgets/KoFillConfigWidget.h +++ b/libs/widgets/KoFillConfigWidget.h @@ -42,7 +42,7 @@ }; public: explicit KoFillConfigWidget(QWidget *parent); - ~KoFillConfigWidget(); + ~KoFillConfigWidget() Q_DECL_OVERRIDE; void setCanvas(KoCanvasBase *canvas); diff --git a/libs/widgets/KoFillConfigWidget.cpp b/libs/widgets/KoFillConfigWidget.cpp --- a/libs/widgets/KoFillConfigWidget.cpp +++ b/libs/widgets/KoFillConfigWidget.cpp @@ -164,7 +164,7 @@ { public: Private() - : canvas(0) + : canvas(nullptr) { } /// Apply the gradient stops using the shape background @@ -174,7 +174,7 @@ return QSharedPointer(); } - KoGradientBackground *newGradient = 0; + KoGradientBackground *newGradient = nullptr; QSharedPointer oldGradient = qSharedPointerDynamicCast(shape->background()); if (oldGradient) { // just copy the gradient and set the new stops @@ -256,7 +256,7 @@ d->colorButton->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); layout->addWidget(d->colorButton); - d->noFillAction = new QAction(0); + d->noFillAction = new QAction(nullptr); d->colorAction = new KoColorPopupAction(d->colorButton); d->colorAction->setToolTip(i18n("Change the filling color")); @@ -376,7 +376,7 @@ } QSharedPointer fill(new KoColorBackground(d->colorAction->currentColor())); - KUndo2Command *firstCommand = 0; + KUndo2Command *firstCommand = nullptr; foreach (KoShape *shape, selectedShapes) { if (! firstCommand) { firstCommand = new KoShapeBackgroundCommand(shape, fill); @@ -404,7 +404,7 @@ QGradientStops newStops = gradientBackground->gradient()->stops(); gradientBackground.clear(); - KUndo2Command *firstCommand = 0; + KUndo2Command *firstCommand = nullptr; foreach (KoShape *shape, selectedShapes) { QSharedPointer fill = d->applyFillGradientStops(shape, newStops); if (! fill) { diff --git a/libs/widgets/KoGenericRegistryModel.h b/libs/widgets/KoGenericRegistryModel.h --- a/libs/widgets/KoGenericRegistryModel.h +++ b/libs/widgets/KoGenericRegistryModel.h @@ -37,20 +37,20 @@ KoGenericRegistryModel(KoGenericRegistry* registry); - virtual ~KoGenericRegistryModel(); + ~KoGenericRegistryModel() Q_DECL_OVERRIDE = default; public: /** * @return the number of elements in the registry */ - virtual int rowCount(const QModelIndex &parent = QModelIndex()) const; + int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE; /** * When role == Qt::DisplayRole, this function will return the name of the * element. */ - virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE; /** * @return the element at the given index @@ -68,11 +68,6 @@ { } -template -KoGenericRegistryModel::~KoGenericRegistryModel() -{ -} - template int KoGenericRegistryModel::rowCount(const QModelIndex &/*parent*/) const { diff --git a/libs/widgets/KoGradientEditWidget.h b/libs/widgets/KoGradientEditWidget.h --- a/libs/widgets/KoGradientEditWidget.h +++ b/libs/widgets/KoGradientEditWidget.h @@ -53,10 +53,10 @@ * Creates a new gradient tab widget with the given parent. * @param parent the widgets parent */ - explicit KoGradientEditWidget(QWidget* parent = 0L); + explicit KoGradientEditWidget(QWidget* parent = nullptr); /// Destroys the widget - virtual ~KoGradientEditWidget(); + ~KoGradientEditWidget() Q_DECL_OVERRIDE = default; /** * Sets a new gradient to edit. diff --git a/libs/widgets/KoGradientEditWidget.cpp b/libs/widgets/KoGradientEditWidget.cpp --- a/libs/widgets/KoGradientEditWidget.cpp +++ b/libs/widgets/KoGradientEditWidget.cpp @@ -150,10 +150,6 @@ updateUI(); } -KoGradientEditWidget::~KoGradientEditWidget() -{ -} - void KoGradientEditWidget::setupUI() { QGridLayout* editLayout = new QGridLayout(this); diff --git a/libs/widgets/KoIconToolTip.h b/libs/widgets/KoIconToolTip.h --- a/libs/widgets/KoIconToolTip.h +++ b/libs/widgets/KoIconToolTip.h @@ -27,11 +27,11 @@ { Q_OBJECT public: - KoIconToolTip() {} - virtual ~KoIconToolTip() {} + KoIconToolTip() = default; + ~KoIconToolTip() Q_DECL_OVERRIDE = default; protected: - virtual QTextDocument *createDocument( const QModelIndex &index ); + virtual QTextDocument *createDocument( const QModelIndex &index ) Q_DECL_OVERRIDE; private: typedef KoItemToolTip super; diff --git a/libs/widgets/KoItemToolTip.h b/libs/widgets/KoItemToolTip.h --- a/libs/widgets/KoItemToolTip.h +++ b/libs/widgets/KoItemToolTip.h @@ -40,7 +40,7 @@ Q_OBJECT public: KoItemToolTip(); - virtual ~KoItemToolTip(); + ~KoItemToolTip() Q_DECL_OVERRIDE; void showTip(QWidget *widget, const QPoint &pos, const QStyleOptionViewItem &option, const QModelIndex &index); protected: @@ -75,12 +75,12 @@ void updatePosition(QWidget *widget, const QPoint &pos, const QStyleOptionViewItem &option); public: - virtual QSize sizeHint() const; + virtual QSize sizeHint() const Q_DECL_OVERRIDE; protected: - virtual void paintEvent(QPaintEvent *e); - virtual void timerEvent(QTimerEvent *e); - virtual bool eventFilter(QObject *object, QEvent *event); + virtual void paintEvent(QPaintEvent *e) Q_DECL_OVERRIDE; + virtual void timerEvent(QTimerEvent *e) Q_DECL_OVERRIDE; + virtual bool eventFilter(QObject *object, QEvent *event) Q_DECL_OVERRIDE; }; #endif diff --git a/libs/widgets/KoLineStyleItemDelegate_p.h b/libs/widgets/KoLineStyleItemDelegate_p.h --- a/libs/widgets/KoLineStyleItemDelegate_p.h +++ b/libs/widgets/KoLineStyleItemDelegate_p.h @@ -26,10 +26,10 @@ { Q_OBJECT public: - explicit KoLineStyleItemDelegate(QObject *parent = 0); - ~KoLineStyleItemDelegate() {} - void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const; - QSize sizeHint (const QStyleOptionViewItem &option, const QModelIndex &index) const; + explicit KoLineStyleItemDelegate(QObject *parent = nullptr); + ~KoLineStyleItemDelegate() Q_DECL_OVERRIDE = default; + void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const Q_DECL_OVERRIDE; + QSize sizeHint (const QStyleOptionViewItem &option, const QModelIndex &index) const Q_DECL_OVERRIDE; }; #endif diff --git a/libs/widgets/KoLineStyleModel_p.h b/libs/widgets/KoLineStyleModel_p.h --- a/libs/widgets/KoLineStyleModel_p.h +++ b/libs/widgets/KoLineStyleModel_p.h @@ -28,10 +28,10 @@ { Q_OBJECT public: - explicit KoLineStyleModel(QObject *parent = 0); - virtual ~KoLineStyleModel() {} - int rowCount(const QModelIndex &parent = QModelIndex()) const; - QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; + explicit KoLineStyleModel(QObject *parent = nullptr); + ~KoLineStyleModel() Q_DECL_OVERRIDE = default; + int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE; + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE; /// adds the given style to the model bool addCustomStyle(const QVector &style); diff --git a/libs/widgets/KoLineStyleSelector.h b/libs/widgets/KoLineStyleSelector.h --- a/libs/widgets/KoLineStyleSelector.h +++ b/libs/widgets/KoLineStyleSelector.h @@ -30,8 +30,8 @@ { Q_OBJECT public: - explicit KoLineStyleSelector(QWidget *parent = 0); - virtual ~KoLineStyleSelector(); + explicit KoLineStyleSelector(QWidget *parent = nullptr); + ~KoLineStyleSelector() Q_DECL_OVERRIDE; /** * Adds a new line style to the combobox. @@ -60,7 +60,7 @@ QVector lineDashes() const; protected: - void paintEvent(QPaintEvent *pe); + void paintEvent(QPaintEvent *pe) Q_DECL_OVERRIDE; private: class Private; diff --git a/libs/widgets/KoMarkerItemDelegate.h b/libs/widgets/KoMarkerItemDelegate.h --- a/libs/widgets/KoMarkerItemDelegate.h +++ b/libs/widgets/KoMarkerItemDelegate.h @@ -29,11 +29,11 @@ { Q_OBJECT public: - explicit KoMarkerItemDelegate(KoMarkerData::MarkerPosition position, QObject *parent = 0); - virtual ~KoMarkerItemDelegate(); + explicit KoMarkerItemDelegate(KoMarkerData::MarkerPosition position, QObject *parent = nullptr); + ~KoMarkerItemDelegate() Q_DECL_OVERRIDE = default; - virtual void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const; - virtual QSize sizeHint(const QStyleOptionViewItem & option, const QModelIndex &index) const; + void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const Q_DECL_OVERRIDE; + QSize sizeHint(const QStyleOptionViewItem & option, const QModelIndex &index) const Q_DECL_OVERRIDE; private: KoMarkerData::MarkerPosition m_position; }; diff --git a/libs/widgets/KoMarkerItemDelegate.cpp b/libs/widgets/KoMarkerItemDelegate.cpp --- a/libs/widgets/KoMarkerItemDelegate.cpp +++ b/libs/widgets/KoMarkerItemDelegate.cpp @@ -32,10 +32,6 @@ { } -KoMarkerItemDelegate::~KoMarkerItemDelegate() -{ -} - void KoMarkerItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const { painter->save(); @@ -52,7 +48,7 @@ pathShape.moveTo(QPointF(option.rect.left(), option.rect.center().y())); pathShape.lineTo(QPointF(option.rect.right(), option.rect.center().y())); KoMarker *marker = index.data(Qt::DecorationRole).value(); - if (marker != 0) { + if (marker != nullptr) { pathShape.setMarker(marker, m_position); } diff --git a/libs/widgets/KoMarkerModel.h b/libs/widgets/KoMarkerModel.h --- a/libs/widgets/KoMarkerModel.h +++ b/libs/widgets/KoMarkerModel.h @@ -29,11 +29,11 @@ { Q_OBJECT public: - KoMarkerModel(const QList markers, KoMarkerData::MarkerPosition position, QObject *parent = 0); - virtual ~KoMarkerModel(); + KoMarkerModel(const QList markers, KoMarkerData::MarkerPosition position, QObject *parent = nullptr); + ~KoMarkerModel() Q_DECL_OVERRIDE = default; - int rowCount(const QModelIndex &parent = QModelIndex()) const; - QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; + int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE; + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE; int markerIndex(KoMarker *marker) const; QVariant marker(int index, int role = Qt::UserRole) const; diff --git a/libs/widgets/KoMarkerModel.cpp b/libs/widgets/KoMarkerModel.cpp --- a/libs/widgets/KoMarkerModel.cpp +++ b/libs/widgets/KoMarkerModel.cpp @@ -32,10 +32,6 @@ { } -KoMarkerModel::~KoMarkerModel() -{ -} - int KoMarkerModel::rowCount(const QModelIndex &parent) const { Q_UNUSED(parent) diff --git a/libs/widgets/KoMarkerSelector.h b/libs/widgets/KoMarkerSelector.h --- a/libs/widgets/KoMarkerSelector.h +++ b/libs/widgets/KoMarkerSelector.h @@ -30,8 +30,8 @@ { Q_OBJECT public: - explicit KoMarkerSelector(KoMarkerData::MarkerPosition position, QWidget *parent = 0); - virtual ~KoMarkerSelector(); + explicit KoMarkerSelector(KoMarkerData::MarkerPosition position, QWidget *parent = nullptr); + virtual ~KoMarkerSelector() Q_DECL_OVERRIDE; // set the current marker style void setMarker(KoMarker *marker); @@ -47,7 +47,7 @@ void updateMarkers(const QList markers); protected: - void paintEvent(QPaintEvent *pe); + void paintEvent(QPaintEvent *pe) Q_DECL_OVERRIDE; private: class Private; diff --git a/libs/widgets/KoMarkerSelector.cpp b/libs/widgets/KoMarkerSelector.cpp --- a/libs/widgets/KoMarkerSelector.cpp +++ b/libs/widgets/KoMarkerSelector.cpp @@ -73,7 +73,7 @@ pathShape.lineTo(QPointF(rect.right(), rect.center().y())); KoMarker *marker = itemData(currentIndex(), Qt::DecorationRole).value(); - if (marker != 0) { + if (marker != nullptr) { pathShape.setMarker(marker, d->model->position()); } diff --git a/libs/widgets/KoModeBoxDocker.cpp b/libs/widgets/KoModeBoxDocker.cpp --- a/libs/widgets/KoModeBoxDocker.cpp +++ b/libs/widgets/KoModeBoxDocker.cpp @@ -39,7 +39,7 @@ void KoModeBoxDocker::setCanvas(KoCanvasBase *canvas) { - setEnabled(canvas != 0); + setEnabled(canvas != nullptr); m_modeBox->setCanvas(canvas); } diff --git a/libs/widgets/KoModeBoxDocker_p.h b/libs/widgets/KoModeBoxDocker_p.h --- a/libs/widgets/KoModeBoxDocker_p.h +++ b/libs/widgets/KoModeBoxDocker_p.h @@ -36,9 +36,9 @@ explicit KoModeBoxDocker(KoModeBox *modeBox); /// reimplemented from KoCanvasObserverBase - virtual QString observerName() const { return QStringLiteral("KoModeBoxDocker"); } - virtual void setCanvas(KoCanvasBase *canvas); - virtual void unsetCanvas(); + QString observerName() const Q_DECL_OVERRIDE { return QStringLiteral("KoModeBoxDocker"); } + void setCanvas(KoCanvasBase *canvas) Q_DECL_OVERRIDE; + void unsetCanvas() Q_DECL_OVERRIDE; private Q_SLOTS: /// Called when the docker changes area diff --git a/libs/widgets/KoModeBoxFactory.h b/libs/widgets/KoModeBoxFactory.h --- a/libs/widgets/KoModeBoxFactory.h +++ b/libs/widgets/KoModeBoxFactory.h @@ -38,12 +38,12 @@ { public: explicit KoModeBoxFactory(KoCanvasControllerWidget *canvas, const QString &applicationName, const QString& appName); - ~KoModeBoxFactory(); + ~KoModeBoxFactory() Q_DECL_OVERRIDE; - virtual QString id() const; - KoDockFactoryBase::DockPosition defaultDockPosition() const; - QDockWidget* createDockWidget(); - virtual bool isCollapsable() const { return false; } + QString id() const Q_DECL_OVERRIDE; + KoDockFactoryBase::DockPosition defaultDockPosition() const Q_DECL_OVERRIDE; + QDockWidget* createDockWidget() Q_DECL_OVERRIDE; + bool isCollapsable() const Q_DECL_OVERRIDE { return false; } private: class Private; diff --git a/libs/widgets/KoModeBox_p.h b/libs/widgets/KoModeBox_p.h --- a/libs/widgets/KoModeBox_p.h +++ b/libs/widgets/KoModeBox_p.h @@ -43,7 +43,7 @@ { Q_OBJECT protected: - void showEvent(QShowEvent *); + void showEvent(QShowEvent *) Q_DECL_OVERRIDE; }; /** @@ -60,7 +60,7 @@ public: /// constructor explicit KoModeBox(KoCanvasControllerWidget *canvas, const QString &applicationName); - ~KoModeBox(); + ~KoModeBox() Q_DECL_OVERRIDE; /** * Should been called when the docker position has changed. diff --git a/libs/widgets/KoPageLayoutWidget.h b/libs/widgets/KoPageLayoutWidget.h --- a/libs/widgets/KoPageLayoutWidget.h +++ b/libs/widgets/KoPageLayoutWidget.h @@ -35,7 +35,7 @@ public: KoPageLayoutWidget(QWidget *parent, const KoPageLayout &layout); - ~KoPageLayoutWidget(); + ~KoPageLayoutWidget() Q_DECL_OVERRIDE; KoPageLayout pageLayout() const; diff --git a/libs/widgets/KoPagePreviewWidget.h b/libs/widgets/KoPagePreviewWidget.h --- a/libs/widgets/KoPagePreviewWidget.h +++ b/libs/widgets/KoPagePreviewWidget.h @@ -33,11 +33,11 @@ class KOWIDGETS_EXPORT KoPagePreviewWidget : public QWidget { Q_OBJECT public: - explicit KoPagePreviewWidget(QWidget *parent = 0); + explicit KoPagePreviewWidget(QWidget *parent = nullptr); ~KoPagePreviewWidget(); protected: - void paintEvent(QPaintEvent *event); + void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE; public Q_SLOTS: void setPageLayout(const KoPageLayout &layout); diff --git a/libs/widgets/KoPageWidgetItem.h b/libs/widgets/KoPageWidgetItem.h --- a/libs/widgets/KoPageWidgetItem.h +++ b/libs/widgets/KoPageWidgetItem.h @@ -31,7 +31,7 @@ class KOWIDGETS_EXPORT KoPageWidgetItem { public: - virtual ~KoPageWidgetItem() {} + virtual ~KoPageWidgetItem() = default; virtual QWidget *widget() = 0; virtual QString name() const = 0; diff --git a/libs/widgets/KoPositionSelector.h b/libs/widgets/KoPositionSelector.h --- a/libs/widgets/KoPositionSelector.h +++ b/libs/widgets/KoPositionSelector.h @@ -32,7 +32,7 @@ Q_OBJECT public: explicit KoPositionSelector(QWidget *parent); - ~KoPositionSelector(); + ~KoPositionSelector() Q_DECL_OVERRIDE; KoFlake::Position position() const; void setPosition(KoFlake::Position position); @@ -42,7 +42,7 @@ protected: /// reimplemented - virtual void paintEvent (QPaintEvent *event); + virtual void paintEvent (QPaintEvent *event) Q_DECL_OVERRIDE; private Q_SLOTS: void positionChanged(int position); diff --git a/libs/widgets/KoPositionSelector.cpp b/libs/widgets/KoPositionSelector.cpp --- a/libs/widgets/KoPositionSelector.cpp +++ b/libs/widgets/KoPositionSelector.cpp @@ -62,14 +62,14 @@ { } - ~RadioLayout() + ~RadioLayout() Q_DECL_OVERRIDE { foreach( const Item & item, items ) delete item.child; items.clear(); } - void setGeometry (const QRect &geom) { + void setGeometry (const QRect &geom) Q_DECL_OVERRIDE { QSize prefSize = calcSizes(); qreal columnWidth, rowHeight; @@ -116,34 +116,34 @@ return prefSize; } - QLayoutItem *itemAt (int index) const { + QLayoutItem *itemAt (int index) const Q_DECL_OVERRIDE { if( index < count() ) return items.at(index).child; else return 0; } - QLayoutItem *takeAt (int index) { + QLayoutItem *takeAt (int index) Q_DECL_OVERRIDE { Q_ASSERT(index < count()); Item item = items.takeAt(index); return item.child; } - int count () const { + int count () const Q_DECL_OVERRIDE { return items.count(); } - void addItem(QLayoutItem *) { + void addItem(QLayoutItem *) Q_DECL_OVERRIDE { Q_ASSERT(0); } - QSize sizeHint() const { + QSize sizeHint() const Q_DECL_OVERRIDE { if(preferred.isEmpty()) const_cast (this)->calcSizes(); return preferred; } - QSize minimumSize() const { + QSize minimumSize() const Q_DECL_OVERRIDE { if(minimum.isEmpty()) const_cast (this)->calcSizes(); return minimum; diff --git a/libs/widgets/KoResourceItemChooser.h b/libs/widgets/KoResourceItemChooser.h --- a/libs/widgets/KoResourceItemChooser.h +++ b/libs/widgets/KoResourceItemChooser.h @@ -51,7 +51,7 @@ /// \p usePreview shows the aside preview with the resource's image explicit KoResourceItemChooser(QSharedPointer resourceAdapter, QWidget *parent = 0, bool usePreview = false); - ~KoResourceItemChooser(); + ~KoResourceItemChooser() Q_DECL_OVERRIDE; /// Sets number of columns in the view and causes the number of rows to be calculated accordingly void setColumnCount(int columnCount); @@ -111,7 +111,7 @@ void setSynced(bool sync); - virtual bool eventFilter(QObject *object, QEvent *event); + bool eventFilter(QObject *object, QEvent *event) Q_DECL_OVERRIDE; Q_SIGNALS: /// Emitted when a resource was selected @@ -131,15 +131,15 @@ void updateView(); protected: - virtual void showEvent(QShowEvent *event); + void showEvent(QShowEvent *event) Q_DECL_OVERRIDE; private: void updateButtonState(); void updatePreview(KoResource *resource); - virtual void resizeEvent(QResizeEvent *event); + virtual void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE; /// Resource for a given model index /// @returns the resource pointer, 0 is index not valid diff --git a/libs/widgets/KoResourceItemChooserContextMenu.h b/libs/widgets/KoResourceItemChooserContextMenu.h --- a/libs/widgets/KoResourceItemChooserContextMenu.h +++ b/libs/widgets/KoResourceItemChooserContextMenu.h @@ -34,7 +34,7 @@ Q_OBJECT public: explicit ContextMenuExistingTagAction( KoResource * resource, const QString &tag, QObject* parent = 0); - ~ContextMenuExistingTagAction(); + ~ContextMenuExistingTagAction() Q_DECL_OVERRIDE = default; Q_SIGNALS: void triggered(KoResource * resource, const QString &tag); @@ -56,7 +56,7 @@ Q_OBJECT public: explicit KoLineEditAction(QObject* parent); - virtual ~KoLineEditAction(); + ~KoLineEditAction() Q_DECL_OVERRIDE = default; void setIcon(const QIcon &icon); void closeParentOnTrigger(bool closeParent); bool closeParentOnTrigger(); @@ -81,7 +81,7 @@ Q_OBJECT public: explicit NewTagAction (KoResource* resource, QMenu* parent); - ~NewTagAction(); + ~NewTagAction() Q_DECL_OVERRIDE = default; Q_SIGNALS: void triggered(KoResource * resource, const QString &tag); @@ -104,7 +104,7 @@ const QString& currentlySelectedTag, const QStringList& allTags ); - virtual ~KoResourceItemChooserContextMenu(); + ~KoResourceItemChooserContextMenu() Q_DECL_OVERRIDE = default; Q_SIGNALS: /// Emitted when a resource should be added to an existing tag. diff --git a/libs/widgets/KoResourceItemChooserContextMenu.cpp b/libs/widgets/KoResourceItemChooserContextMenu.cpp --- a/libs/widgets/KoResourceItemChooserContextMenu.cpp +++ b/libs/widgets/KoResourceItemChooserContextMenu.cpp @@ -34,10 +34,10 @@ : QWidgetAction(parent) , m_closeParentOnTrigger(false) { - QWidget* pWidget = new QWidget (NULL); + QWidget* pWidget = new QWidget (nullptr); QHBoxLayout* pLayout = new QHBoxLayout(); - m_label = new QLabel(NULL); - m_editBox = new KLineEdit(NULL); + m_label = new QLabel(nullptr); + m_editBox = new KLineEdit(nullptr); pLayout->addWidget(m_label); pLayout->addWidget(m_editBox); pWidget->setLayout(pLayout); @@ -47,11 +47,6 @@ this, SLOT(onTriggered(QString))); } -KoLineEditAction::~KoLineEditAction() -{ - -} - void KoLineEditAction::setIcon(const QIcon &icon) { QPixmap pixmap = QPixmap(icon.pixmap(16,16)); @@ -113,18 +108,10 @@ this, SLOT(onTriggered())); } -ContextMenuExistingTagAction::~ContextMenuExistingTagAction() -{ -} - void ContextMenuExistingTagAction::onTriggered() { emit triggered(m_resource, m_tag); } -NewTagAction::~NewTagAction() -{ -} - NewTagAction::NewTagAction(KoResource* resource, QMenu* parent) :KoLineEditAction (parent) { @@ -206,8 +193,3 @@ this, SIGNAL(resourceAssignmentToNewTagRequested(KoResource*,QString))); assignableTagsMenu->addAction(addTagAction); } - -KoResourceItemChooserContextMenu::~KoResourceItemChooserContextMenu() -{ - -} diff --git a/libs/widgets/KoResourceItemChooserSync.h b/libs/widgets/KoResourceItemChooserSync.h --- a/libs/widgets/KoResourceItemChooserSync.h +++ b/libs/widgets/KoResourceItemChooserSync.h @@ -36,7 +36,7 @@ Q_OBJECT public: KoResourceItemChooserSync(); - virtual ~KoResourceItemChooserSync(); + ~KoResourceItemChooserSync() Q_DECL_OVERRIDE; static KoResourceItemChooserSync* instance(); /// Gets the base length diff --git a/libs/widgets/KoResourceItemChooserSync.cpp b/libs/widgets/KoResourceItemChooserSync.cpp --- a/libs/widgets/KoResourceItemChooserSync.cpp +++ b/libs/widgets/KoResourceItemChooserSync.cpp @@ -36,9 +36,7 @@ d->baseLength = 50; } -KoResourceItemChooserSync::~KoResourceItemChooserSync() -{ -} +KoResourceItemChooserSync::~KoResourceItemChooserSync() = default; KoResourceItemChooserSync* KoResourceItemChooserSync::instance() { diff --git a/libs/widgets/KoResourceItemDelegate.h b/libs/widgets/KoResourceItemDelegate.h --- a/libs/widgets/KoResourceItemDelegate.h +++ b/libs/widgets/KoResourceItemDelegate.h @@ -28,12 +28,12 @@ { Q_OBJECT public: - explicit KoResourceItemDelegate(QObject *parent = 0); - virtual ~KoResourceItemDelegate() {} + explicit KoResourceItemDelegate(QObject *parent = nullptr); + ~KoResourceItemDelegate() Q_DECL_OVERRIDE = default; /// reimplemented - virtual void paint( QPainter *, const QStyleOptionViewItem &, const QModelIndex & ) const; + void paint( QPainter *, const QStyleOptionViewItem &, const QModelIndex & ) const Q_DECL_OVERRIDE; /// reimplemented - QSize sizeHint ( const QStyleOptionViewItem &, const QModelIndex & ) const; + QSize sizeHint ( const QStyleOptionViewItem &, const QModelIndex & ) const Q_DECL_OVERRIDE; private: KoCheckerBoardPainter m_checkerPainter; }; diff --git a/libs/widgets/KoResourceItemView.h b/libs/widgets/KoResourceItemView.h --- a/libs/widgets/KoResourceItemView.h +++ b/libs/widgets/KoResourceItemView.h @@ -34,20 +34,20 @@ public: - explicit KoResourceItemView(QWidget *parent = 0); - virtual ~KoResourceItemView() { disconnect(); } + explicit KoResourceItemView(QWidget *parent = nullptr); + ~KoResourceItemView() Q_DECL_OVERRIDE { disconnect(); } /// reimplemented - virtual bool viewportEvent(QEvent *event); + bool viewportEvent(QEvent *event) Q_DECL_OVERRIDE; Q_SIGNALS: void currentResourceChanged(const QModelIndex &); void contextMenuRequested(const QPoint &); protected: - virtual void contextMenuEvent(QContextMenuEvent *event); - void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected); + void contextMenuEvent(QContextMenuEvent *event) Q_DECL_OVERRIDE; + void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected) Q_DECL_OVERRIDE; private: KoIconToolTip m_tip; diff --git a/libs/widgets/KoResourceModel.h b/libs/widgets/KoResourceModel.h --- a/libs/widgets/KoResourceModel.h +++ b/libs/widgets/KoResourceModel.h @@ -35,16 +35,16 @@ Q_OBJECT public: explicit KoResourceModel(QSharedPointer resourceAdapter, QObject * parent = 0); - virtual ~KoResourceModel(); + ~KoResourceModel() Q_DECL_OVERRIDE; /// reimplemented - virtual int rowCount(const QModelIndex &parent = QModelIndex()) const; + int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE; /// reimplemented - virtual int columnCount ( const QModelIndex & parent = QModelIndex() ) const; + int columnCount ( const QModelIndex & parent = QModelIndex() ) const Q_DECL_OVERRIDE; /// reimplemented - virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE; /// reimplemented - virtual QModelIndex index ( int row, int column = 0, const QModelIndex & parent = QModelIndex() ) const; + QModelIndex index ( int row, int column = 0, const QModelIndex & parent = QModelIndex() ) const Q_DECL_OVERRIDE; /// Sets the number of columns to display void setColumnCount( int columnCount ); @@ -55,29 +55,29 @@ LargeThumbnailRole = 33 }; - QModelIndex indexFromResource(KoResource* resource) const; + QModelIndex indexFromResource(KoResource* resource) const Q_DECL_OVERRIDE; /// facade for KoAbstractResourceServerAdapter QString extensions() const; void importResourceFile(const QString &filename); void importResourceFile(const QString &filename, bool fileCreation); - bool removeResource(KoResource* resource); + bool removeResource(KoResource* resource) Q_DECL_OVERRIDE; void removeResourceFile(const QString & filename); - QStringList assignedTagsList(KoResource *resource) const; - void addTag(KoResource* resource, const QString& tag); - void deleteTag( KoResource* resource, const QString& tag); - QStringList tagNamesList() const; + QStringList assignedTagsList(KoResource *resource) const Q_DECL_OVERRIDE; + void addTag(KoResource* resource, const QString& tag) Q_DECL_OVERRIDE; + void deleteTag( KoResource* resource, const QString& tag) Q_DECL_OVERRIDE; + QStringList tagNamesList() const Q_DECL_OVERRIDE; QStringList searchTag(const QString& lineEditText); - void enableResourceFiltering(bool enable); - void setCurrentTag(const QString& currentTag); - void searchTextChanged(const QString& searchString); - void updateServer(); - int resourcesCount() const; - QList currentlyVisibleResources() const; - QList serverResources() const; - void tagCategoryMembersChanged(); - void tagCategoryAdded(const QString& tag); - void tagCategoryRemoved(const QString& tag); + void enableResourceFiltering(bool enable) Q_DECL_OVERRIDE; + void setCurrentTag(const QString& currentTag) Q_DECL_OVERRIDE; + void searchTextChanged(const QString& searchString) Q_DECL_OVERRIDE; + void updateServer() Q_DECL_OVERRIDE; + int resourcesCount() const Q_DECL_OVERRIDE; + QList currentlyVisibleResources() const Q_DECL_OVERRIDE; + QList serverResources() const Q_DECL_OVERRIDE; + void tagCategoryMembersChanged() Q_DECL_OVERRIDE; + void tagCategoryAdded(const QString& tag) Q_DECL_OVERRIDE; + void tagCategoryRemoved(const QString& tag) Q_DECL_OVERRIDE; QString serverType() const; diff --git a/libs/widgets/KoResourceModelBase.h b/libs/widgets/KoResourceModelBase.h --- a/libs/widgets/KoResourceModelBase.h +++ b/libs/widgets/KoResourceModelBase.h @@ -30,17 +30,17 @@ { Q_OBJECT public: - explicit KoResourceModelBase(QObject * parent = 0 ); - virtual ~KoResourceModelBase(); + explicit KoResourceModelBase(QObject * parent = nullptr ); + ~KoResourceModelBase() Q_DECL_OVERRIDE; /// reimplemented - virtual int rowCount(const QModelIndex &parent = QModelIndex()) const =0; + int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE = 0; /// reimplemented - virtual int columnCount ( const QModelIndex & parent = QModelIndex() ) const =0; + int columnCount ( const QModelIndex & parent = QModelIndex() ) const Q_DECL_OVERRIDE = 0; /// reimplemented - virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const =0; + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE = 0; /// reimplemented - virtual QModelIndex index ( int row, int column = 0, const QModelIndex & parent = QModelIndex() ) const =0; + QModelIndex index ( int row, int column = 0, const QModelIndex & parent = QModelIndex() ) const Q_DECL_OVERRIDE = 0; virtual QModelIndex indexFromResource(KoResource* resource) const =0; virtual QStringList assignedTagsList(KoResource *resource) const =0; diff --git a/libs/widgets/KoResourcePaths.cpp b/libs/widgets/KoResourcePaths.cpp --- a/libs/widgets/KoResourcePaths.cpp +++ b/libs/widgets/KoResourcePaths.cpp @@ -50,8 +50,8 @@ /* default */ QStandardPaths::GenericDataLocation; } - KoResourcePathsImpl(); - ~KoResourcePathsImpl(); + KoResourcePathsImpl() = default; + ~KoResourcePathsImpl() = default; void addResourceTypeInternal(const QString &type, const QString &basetype, const QString &relativeName, bool priority); @@ -77,15 +77,6 @@ QHash m_relatives; // Same with relative paths }; -KoResourcePathsImpl::KoResourcePathsImpl() -{ -} - -KoResourcePathsImpl::~KoResourcePathsImpl() -{ -} - - void KoResourcePathsImpl::addResourceTypeInternal(const QString &type, const QString &basetype, const QString &relativename, bool priority) diff --git a/libs/widgets/KoResourcePopupAction.h b/libs/widgets/KoResourcePopupAction.h --- a/libs/widgets/KoResourcePopupAction.h +++ b/libs/widgets/KoResourcePopupAction.h @@ -47,7 +47,7 @@ /** * Destructor */ - virtual ~KoResourcePopupAction(); + ~KoResourcePopupAction() Q_DECL_OVERRIDE; QSharedPointer currentBackground() const; void setCurrentBackground(QSharedPointer background); diff --git a/libs/widgets/KoResourcePopupAction.cpp b/libs/widgets/KoResourcePopupAction.cpp --- a/libs/widgets/KoResourcePopupAction.cpp +++ b/libs/widgets/KoResourcePopupAction.cpp @@ -42,6 +42,8 @@ #include #include +#include + class KoResourcePopupAction::Private { public: @@ -110,7 +112,7 @@ * This happens only if the actions are QWidgetAction, and we know they are since * the only ones added are in KoResourcePopupAction constructor. */ int i = 0; - while(d->menu->actions().size() > 0) { + while(!d->menu->actions().empty()) { d->menu->removeAction(d->menu->actions().at(i)); ++i; } @@ -127,7 +129,7 @@ void KoResourcePopupAction::setCurrentBackground(QSharedPointer background) { - d->background = background; + d->background = std::move(background); updateIcon(); } diff --git a/libs/widgets/KoResourceSelector.h b/libs/widgets/KoResourceSelector.h --- a/libs/widgets/KoResourceSelector.h +++ b/libs/widgets/KoResourceSelector.h @@ -43,7 +43,7 @@ * Constructs a new resource selector. * @param parent the parent widget */ - explicit KoResourceSelector(QWidget *parent = 0); + explicit KoResourceSelector(QWidget *parent = nullptr); /** * Constructs a new resource selector showing the resources of the given resource adapter. @@ -53,7 +53,7 @@ explicit KoResourceSelector( QSharedPointer resourceAdapter, QWidget * parent = 0 ); /// Destroys the resource selector - virtual ~KoResourceSelector(); + ~KoResourceSelector() Q_DECL_OVERRIDE; /// Sets the resource adaptor to get resources from void setResourceAdapter(QSharedPointerresourceAdapter); @@ -76,11 +76,11 @@ protected: /// reimplemented - virtual void paintEvent( QPaintEvent * ); + void paintEvent( QPaintEvent * ) Q_DECL_OVERRIDE; /// reimplemented - virtual void mousePressEvent( QMouseEvent * ); + void mousePressEvent( QMouseEvent * ) Q_DECL_OVERRIDE; /// reimplemented - virtual void mouseMoveEvent( QMouseEvent * event ); + void mouseMoveEvent( QMouseEvent * event ) Q_DECL_OVERRIDE; private Q_SLOTS: void indexChanged( int index ); diff --git a/libs/widgets/KoResourceServer.h b/libs/widgets/KoResourceServer.h --- a/libs/widgets/KoResourceServer.h +++ b/libs/widgets/KoResourceServer.h @@ -140,7 +140,7 @@ m_tagStore->loadTags(); } - virtual ~KoResourceServer() + virtual ~KoResourceServer() Q_DECL_OVERRIDE { if (m_tagStore) { delete m_tagStore; @@ -158,7 +158,7 @@ } - int resourceCount() const { + int resourceCount() const Q_DECL_OVERRIDE { return m_resources.size(); } @@ -168,7 +168,7 @@ * be loaded or and invalid aren't added to the server. * @param filenames list of filenames to be loaded */ - void loadResources(QStringList filenames) { + void loadResources(QStringList filenames) Q_DECL_OVERRIDE { QStringList uniqueFiles; @@ -290,11 +290,10 @@ if (m_blackListFileNames.contains(resource->filename())) { m_blackListFileNames.removeAll(resource->filename()); writeBlackListFile(); - } - else{ - warnWidgets<<"Doesn't contain filename"; - return false; - } + } else{ + warnWidgets<<"Doesn't contain filename"; + return false; + } //then return true// @@ -479,7 +478,7 @@ notifyResourceChanged(resource); } - QStringList blackListedFiles() const + QStringList blackListedFiles() const Q_DECL_OVERRIDE { return m_blackListFileNames; } @@ -543,7 +542,7 @@ } } - QStringList queryResources(const QString &query) const + QStringList queryResources(const QString &query) const Q_DECL_OVERRIDE { return m_tagStore->searchTag(query); } @@ -671,12 +670,12 @@ protected: - KoResource* byMd5(const QByteArray &md5) const + KoResource* byMd5(const QByteArray &md5) const Q_DECL_OVERRIDE { return Policy::toResourcePointer(resourceByMD5(md5)); } - KoResource* byFileName(const QString &fileName) const + KoResource* byFileName(const QString &fileName) const Q_DECL_OVERRIDE { return Policy::toResourcePointer(resourceByFilename(fileName)); } diff --git a/libs/widgets/KoResourceServerAdapter.h b/libs/widgets/KoResourceServerAdapter.h --- a/libs/widgets/KoResourceServerAdapter.h +++ b/libs/widgets/KoResourceServerAdapter.h @@ -34,8 +34,8 @@ { Q_OBJECT public: - KoAbstractResourceServerAdapter(QObject *parent = 0); - virtual ~KoAbstractResourceServerAdapter(); + KoAbstractResourceServerAdapter(QObject *parent = nullptr); + ~KoAbstractResourceServerAdapter() Q_DECL_OVERRIDE = default; virtual void connectToResourceServer() = 0; virtual QList resources() = 0; @@ -107,13 +107,13 @@ } - virtual ~KoResourceServerAdapter() + virtual ~KoResourceServerAdapter() Q_DECL_OVERRIDE { if (m_resourceServer) m_resourceServer->removeObserver(this); } - QString serverType() const + QString serverType() const Q_DECL_OVERRIDE { if (m_resourceServer) { return m_resourceServer->type(); @@ -126,13 +126,13 @@ m_resourceServer = 0; } - void connectToResourceServer() + void connectToResourceServer() Q_DECL_OVERRIDE { if (m_resourceServer) m_resourceServer->addObserver(this); } - virtual QList resources() + QList resources() Q_DECL_OVERRIDE { if (! m_resourceServer) return QList(); @@ -155,7 +155,7 @@ return m_serverResources; } - bool addResource(KoResource* resource) + bool addResource(KoResource* resource) Q_DECL_OVERRIDE { if (! m_resourceServer) return false; @@ -168,7 +168,7 @@ return false; } - bool removeResource(KoResource* resource) + bool removeResource(KoResource* resource) Q_DECL_OVERRIDE { if (! m_resourceServer) return false; @@ -183,14 +183,14 @@ return false; } - void importResourceFile(const QString & filename , bool fileCreation = true) + void importResourceFile(const QString & filename , bool fileCreation = true) Q_DECL_OVERRIDE { if (! m_resourceServer) return; m_resourceServer->importResourceFile(filename, fileCreation); } - void removeResourceFile(const QString & filename) + void removeResourceFile(const QString & filename) Q_DECL_OVERRIDE { if (!m_resourceServer) { return; @@ -228,86 +228,86 @@ emitTagCategoryWasRemoved(tag); } - QString extensions() const { + QString extensions() const Q_DECL_OVERRIDE { if (! m_resourceServer) return QString(); return m_resourceServer->extensions(); } - void setCurrentTag(const QString& resourceFileNames) { + void setCurrentTag(const QString& resourceFileNames) Q_DECL_OVERRIDE { serverResourceCacheInvalid(true); m_resourceFilter.setCurrentTag(resourceFileNames); } - void enableResourceFiltering(bool enable) { + void enableResourceFiltering(bool enable) Q_DECL_OVERRIDE { m_enableFiltering = enable; } - void updateServer() { + void updateServer() Q_DECL_OVERRIDE{ emitRemovingResource(0); } - QStringList assignedTagsList(KoResource* resource) { + QStringList assignedTagsList(KoResource* resource) Q_DECL_OVERRIDE { return m_resourceServer->assignedTagsList(resource); } - QStringList tagNamesList() { + QStringList tagNamesList() Q_DECL_OVERRIDE{ return m_resourceServer->tagNamesList(); } - void addTag(const QString& tag) { + void addTag(const QString& tag) Q_DECL_OVERRIDE { m_resourceServer->addTag(0, tag); } - void addTag(KoResource* resource, const QString& tag) { + void addTag(KoResource* resource, const QString& tag) Q_DECL_OVERRIDE { m_resourceServer->addTag(resource, tag); } - void deleteTag(KoResource* resource, const QString& tag) { + void deleteTag(KoResource* resource, const QString& tag) Q_DECL_OVERRIDE { m_resourceServer->delTag(resource, tag); } - void setFilterIncludes(const QStringList& filteredNames) { + void setFilterIncludes(const QStringList& filteredNames) Q_DECL_OVERRIDE { m_resourceFilter.setInclusions(filteredNames); } - void searchTextChanged(const QString& searchString) { + void searchTextChanged(const QString& searchString) Q_DECL_OVERRIDE { m_resourceFilter.setFilters(searchString); serverResourceCacheInvalid(true); } - QStringList searchTag(const QString& lineEditText) { + QStringList searchTag(const QString& lineEditText) Q_DECL_OVERRIDE { return m_resourceServer->searchTag(lineEditText); } // called by model to notify server of change - void tagCategoryMembersChanged() { + void tagCategoryMembersChanged() Q_DECL_OVERRIDE { m_resourceServer->tagCategoryMembersChanged(); } - void tagCategoryAdded(const QString& tag) { + void tagCategoryAdded(const QString& tag) Q_DECL_OVERRIDE { m_resourceServer->tagCategoryAdded(tag); } - void tagCategoryRemoved(const QString& tag) { + void tagCategoryRemoved(const QString& tag) Q_DECL_OVERRIDE { m_resourceServer->tagCategoryRemoved(tag); } - virtual QList serverResources() { + virtual QList serverResources() Q_DECL_OVERRIDE { return m_serverResources; } - void configureFilters(int filterType, bool enable){ + void configureFilters(int filterType, bool enable) Q_DECL_OVERRIDE { m_resourceFilter.configure(filterType,enable); } - void setSortingEnabled(bool value) { + void setSortingEnabled(bool value) Q_DECL_OVERRIDE { m_sortingEnabled = value; serverResourceCacheInvalid(true); } - bool sortingEnabled() const { + bool sortingEnabled() const Q_DECL_OVERRIDE { return m_sortingEnabled; } diff --git a/libs/widgets/KoResourceServerAdapter.cpp b/libs/widgets/KoResourceServerAdapter.cpp --- a/libs/widgets/KoResourceServerAdapter.cpp +++ b/libs/widgets/KoResourceServerAdapter.cpp @@ -24,10 +24,6 @@ { } -KoAbstractResourceServerAdapter::~KoAbstractResourceServerAdapter() -{ -} - void KoAbstractResourceServerAdapter::emitResourceAdded(KoResource* resource) { emit resourceAdded(resource); diff --git a/libs/widgets/KoResourceServerProvider.h b/libs/widgets/KoResourceServerProvider.h --- a/libs/widgets/KoResourceServerProvider.h +++ b/libs/widgets/KoResourceServerProvider.h @@ -46,7 +46,7 @@ * @param server the server the resources will be loaded for */ explicit KoResourceLoaderThread(KoResourceServerBase *server); - ~KoResourceLoaderThread(); + ~KoResourceLoaderThread() Q_DECL_OVERRIDE = default; public Q_SLOTS: /** * Checks whether the thread has finished loading and waits @@ -58,7 +58,7 @@ /** * Overridden from QThread */ - void run(); + void run() Q_DECL_OVERRIDE; private: @@ -76,7 +76,7 @@ public: KoResourceServerProvider(); - virtual ~KoResourceServerProvider(); + ~KoResourceServerProvider() Q_DECL_OVERRIDE; static KoResourceServerProvider* instance(); diff --git a/libs/widgets/KoResourceServerProvider.cpp b/libs/widgets/KoResourceServerProvider.cpp --- a/libs/widgets/KoResourceServerProvider.cpp +++ b/libs/widgets/KoResourceServerProvider.cpp @@ -78,7 +78,7 @@ friend class KoResourceBundle; - virtual KoAbstractGradient* createResource( const QString & filename ) { + KoAbstractGradient* createResource( const QString & filename ) Q_DECL_OVERRIDE { QString fileExtension; int index = filename.lastIndexOf('.'); @@ -96,7 +96,7 @@ return grad; } - virtual QList< KoAbstractGradient* > sortedResources() { + QList< KoAbstractGradient* > sortedResources() Q_DECL_OVERRIDE { QList< KoAbstractGradient* > resources = KoResourceServer::sortedResources(); QList< KoAbstractGradient* > sorted; if (m_foregroundToTransparent && resources.contains(m_foregroundToTransparent)) { @@ -129,10 +129,6 @@ connect(qApp, SIGNAL(aboutToQuit()), SLOT(barrier())); } -KoResourceLoaderThread::~KoResourceLoaderThread() -{ -} - void KoResourceLoaderThread::run() { m_server->loadResources(m_fileNames); diff --git a/libs/widgets/KoResourceTaggingManager.h b/libs/widgets/KoResourceTaggingManager.h --- a/libs/widgets/KoResourceTaggingManager.h +++ b/libs/widgets/KoResourceTaggingManager.h @@ -44,7 +44,7 @@ public: explicit KoResourceTaggingManager(KoResourceModel* model, QWidget* parent); - ~KoResourceTaggingManager(); + ~KoResourceTaggingManager() Q_DECL_OVERRIDE; void showTaggingBar(bool show); QStringList availableTags() const; QString currentTag(); diff --git a/libs/widgets/KoRuler.h b/libs/widgets/KoRuler.h --- a/libs/widgets/KoRuler.h +++ b/libs/widgets/KoRuler.h @@ -50,7 +50,7 @@ * @param viewConverter the view converter used to convert from point to pixel */ KoRuler(QWidget* parent, Qt::Orientation orientation, const KoViewConverter* viewConverter); - ~KoRuler(); + ~KoRuler() Q_DECL_OVERRIDE; /// For paragraphs each tab definition is represented by this struct. struct Tab { @@ -93,10 +93,10 @@ QList popupActionList() const; /// reimplemented - virtual QSize minimumSizeHint() const; + QSize minimumSizeHint() const Q_DECL_OVERRIDE; /// reimplemented - virtual QSize sizeHint() const; + QSize sizeHint() const Q_DECL_OVERRIDE; public Q_SLOTS: /// Set the unit of the ruler @@ -259,13 +259,13 @@ protected: /// reimplemented - virtual void paintEvent(QPaintEvent* event); + void paintEvent(QPaintEvent* event) Q_DECL_OVERRIDE; /// reimplemented - virtual void mousePressEvent(QMouseEvent *ev); + void mousePressEvent(QMouseEvent *ev) Q_DECL_OVERRIDE; /// reimplemented - virtual void mouseReleaseEvent(QMouseEvent *ev); + void mouseReleaseEvent(QMouseEvent *ev) Q_DECL_OVERRIDE; /// reimplemented - virtual void mouseMoveEvent(QMouseEvent *ev); + void mouseMoveEvent(QMouseEvent *ev) Q_DECL_OVERRIDE; private: KoRulerPrivate * const d; diff --git a/libs/widgets/KoRulerController_p.h b/libs/widgets/KoRulerController_p.h --- a/libs/widgets/KoRulerController_p.h +++ b/libs/widgets/KoRulerController_p.h @@ -119,7 +119,7 @@ if (docVar.isNull()) return; QTextDocument *doc = static_cast(docVar.value()); - if (doc == 0) + if (doc == nullptr) return; const int position = resourceManager->intResource(KoText::CurrentTextPosition); const int anchor = resourceManager->intResource(KoText::CurrentTextAnchor); @@ -180,7 +180,7 @@ if (docVar.isNull()) return QTextBlock(); QTextDocument *doc = static_cast(docVar.value()); - if (doc == 0) + if (doc == nullptr) return QTextBlock(); return doc->findBlock(resourceManager->intResource(KoText::CurrentTextPosition)); } @@ -190,7 +190,7 @@ if (docVar.isNull()) return false; QTextDocument *doc = static_cast(docVar.value()); - if (doc == 0) + if (doc == nullptr) return false; return KoTextDocument(doc).relativeTabs(); } diff --git a/libs/widgets/KoRuler_p.h b/libs/widgets/KoRuler_p.h --- a/libs/widgets/KoRuler_p.h +++ b/libs/widgets/KoRuler_p.h @@ -87,11 +87,11 @@ public: HorizontalPaintingStrategy() : lengthInPixel(1) {} - virtual QRectF drawBackground(const KoRulerPrivate *ruler, QPainter &painter); - virtual void drawTabs(const KoRulerPrivate *ruler, QPainter &painter); - virtual void drawMeasurements(const KoRulerPrivate *ruler, QPainter &painter, const QRectF &rectangle); - virtual void drawIndents(const KoRulerPrivate *ruler, QPainter &painter); - virtual QSize sizeHint(); + QRectF drawBackground(const KoRulerPrivate *ruler, QPainter &painter) Q_DECL_OVERRIDE; + void drawTabs(const KoRulerPrivate *ruler, QPainter &painter) Q_DECL_OVERRIDE; + void drawMeasurements(const KoRulerPrivate *ruler, QPainter &painter, const QRectF &rectangle) Q_DECL_OVERRIDE; + void drawIndents(const KoRulerPrivate *ruler, QPainter &painter) Q_DECL_OVERRIDE; + QSize sizeHint() Q_DECL_OVERRIDE; private: qreal lengthInPixel; diff --git a/libs/widgets/KoShadowConfigWidget.cpp b/libs/widgets/KoShadowConfigWidget.cpp --- a/libs/widgets/KoShadowConfigWidget.cpp +++ b/libs/widgets/KoShadowConfigWidget.cpp @@ -182,7 +182,7 @@ KoSelection *selection = d->canvas->shapeManager()->selection(); KoShape * shape = selection->firstSelectedShape(KoFlake::TopLevelSelection); - setEnabled(shape != 0); + setEnabled(shape != nullptr); if (! shape) { setShadowVisible(false); diff --git a/libs/widgets/KoSliderCombo.h b/libs/widgets/KoSliderCombo.h --- a/libs/widgets/KoSliderCombo.h +++ b/libs/widgets/KoSliderCombo.h @@ -50,12 +50,12 @@ * * @param parent parent QWidget */ - explicit KoSliderCombo(QWidget *parent=0); + explicit KoSliderCombo(QWidget *parent = nullptr); /** * Destructor */ - virtual ~KoSliderCombo(); + ~KoSliderCombo() Q_DECL_OVERRIDE; /** * The precision of values given as the number of digits after the period. @@ -99,8 +99,8 @@ */ qreal value() const; - virtual QSize minimumSizeHint() const; ///< reimplemented from QComboBox - virtual QSize sizeHint() const; ///< reimplemented from QComboBox + QSize minimumSizeHint() const Q_DECL_OVERRIDE; ///< reimplemented from QComboBox + QSize sizeHint() const Q_DECL_OVERRIDE; ///< reimplemented from QComboBox public Q_SLOTS: @@ -122,12 +122,12 @@ void valueChanged(qreal value, bool final); protected: - virtual void paintEvent(QPaintEvent *); ///< reimplemented from QComboBox - virtual void hideEvent(QHideEvent *); ///< reimplemented from QComboBox - virtual void changeEvent(QEvent *e); ///< reimplemented from QComboBox - virtual void mousePressEvent(QMouseEvent *e); ///< reimplemented from QComboBox - virtual void keyPressEvent(QKeyEvent *e); ///< reimplemented from QComboBox - virtual void wheelEvent(QWheelEvent *e); ///< reimplemented from QComboBox + void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE; ///< reimplemented from QComboBox + void hideEvent(QHideEvent *) Q_DECL_OVERRIDE; ///< reimplemented from QComboBox + void changeEvent(QEvent *e) Q_DECL_OVERRIDE; ///< reimplemented from QComboBox + void mousePressEvent(QMouseEvent *e) Q_DECL_OVERRIDE; ///< reimplemented from QComboBox + void keyPressEvent(QKeyEvent *e) Q_DECL_OVERRIDE; ///< reimplemented from QComboBox + void wheelEvent(QWheelEvent *e) Q_DECL_OVERRIDE; ///< reimplemented from QComboBox private: Q_PRIVATE_SLOT(d, void sliderValueChanged(int value)) diff --git a/libs/widgets/KoSliderCombo.cpp b/libs/widgets/KoSliderCombo.cpp --- a/libs/widgets/KoSliderCombo.cpp +++ b/libs/widgets/KoSliderCombo.cpp @@ -287,8 +287,6 @@ emit valueChanged(value, true); } -KoSliderComboContainer::~KoSliderComboContainer() {} - void KoSliderComboContainer::mousePressEvent(QMouseEvent *e) { QStyleOptionComboBox opt; diff --git a/libs/widgets/KoSliderCombo_p.h b/libs/widgets/KoSliderCombo_p.h --- a/libs/widgets/KoSliderCombo_p.h +++ b/libs/widgets/KoSliderCombo_p.h @@ -45,9 +45,9 @@ Q_OBJECT public: KoSliderComboContainer(KoSliderCombo *parent) : QMenu(parent ), m_parent(parent) {} - ~KoSliderComboContainer(); + ~KoSliderComboContainer() Q_DECL_OVERRIDE = default; protected: - virtual void mousePressEvent(QMouseEvent *e); + void mousePressEvent(QMouseEvent *e) Q_DECL_OVERRIDE; private: KoSliderCombo *m_parent; }; diff --git a/libs/widgets/KoStrokeConfigWidget.h b/libs/widgets/KoStrokeConfigWidget.h --- a/libs/widgets/KoStrokeConfigWidget.h +++ b/libs/widgets/KoStrokeConfigWidget.h @@ -47,7 +47,7 @@ Q_OBJECT public: explicit KoStrokeConfigWidget(QWidget *parent); - ~KoStrokeConfigWidget(); + ~KoStrokeConfigWidget() Q_DECL_OVERRIDE; // Getters Qt::PenStyle lineStyle() const; diff --git a/libs/widgets/KoStrokeConfigWidget.cpp b/libs/widgets/KoStrokeConfigWidget.cpp --- a/libs/widgets/KoStrokeConfigWidget.cpp +++ b/libs/widgets/KoStrokeConfigWidget.cpp @@ -70,8 +70,8 @@ { Q_OBJECT public: - CapNJoinMenu(QWidget *parent = 0); - virtual QSize sizeHint() const; + CapNJoinMenu(QWidget *parent = nullptr); + QSize sizeHint() const Q_DECL_OVERRIDE; KoUnitDoubleSpinBox *miterLimit; QButtonGroup *capGroup; @@ -88,7 +88,7 @@ capGroup = new QButtonGroup(this); capGroup->setExclusive(true); - QToolButton *button = 0; + QToolButton *button = nullptr; button = new QToolButton(this); button->setIcon(koIcon("stroke-cap-butt")); @@ -159,7 +159,7 @@ { public: Private() - : canvas(0), + : canvas(nullptr), active(true) { } @@ -453,7 +453,7 @@ void KoStrokeConfigWidget::applyMarkerChanges(KoMarkerData::MarkerPosition position) { - KoMarker *marker = 0; + KoMarker *marker = nullptr; if (position == KoMarkerData::MarkerStart) { marker = startMarker(); } @@ -470,14 +470,14 @@ const QList shapeList = selection->selectedShapes(); QList pathShapeList; - for (QList::ConstIterator itShape = shapeList.begin(); itShape != shapeList.end(); ++itShape) { - KoPathShape* pathShape = dynamic_cast(*itShape); + for (auto itShape : shapeList) { + KoPathShape* pathShape = dynamic_cast(itShape); if (pathShape) { pathShapeList << pathShape; } } - if (pathShapeList.size()) { + if (!pathShapeList.empty()) { KoPathShapeMarkerCommand* cmdMarker = new KoPathShapeMarkerCommand(pathShapeList, marker, position); canvasController->canvas()->addCommand(cmdMarker); } diff --git a/libs/widgets/KoTableView.h b/libs/widgets/KoTableView.h --- a/libs/widgets/KoTableView.h +++ b/libs/widgets/KoTableView.h @@ -39,14 +39,14 @@ FIXED_ROWS /// The number of rows is fixed }; - explicit KoTableView(QWidget *parent = 0); - virtual ~KoTableView() {} + explicit KoTableView(QWidget *parent = nullptr); + ~KoTableView() Q_DECL_OVERRIDE = default; /** reimplemented * This will draw a number of rows based on the number of columns if m_viewMode is FIXED_COLUMS * And it will draw a number of columns based on the number of rows if m_viewMode is FIXED_ROWS */ - virtual void resizeEvent(QResizeEvent *event); + void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE; void setViewMode(ViewMode mode); diff --git a/libs/widgets/KoTagChooserWidget.h b/libs/widgets/KoTagChooserWidget.h --- a/libs/widgets/KoTagChooserWidget.h +++ b/libs/widgets/KoTagChooserWidget.h @@ -35,7 +35,7 @@ public: explicit KoTagChooserWidget(QWidget* parent); - virtual ~KoTagChooserWidget(); + ~KoTagChooserWidget() Q_DECL_OVERRIDE; void setCurrentIndex(int index); int findIndexOf(const QString &tagName); void insertItem(const QString &tagName); diff --git a/libs/widgets/KoTagFilterWidget.h b/libs/widgets/KoTagFilterWidget.h --- a/libs/widgets/KoTagFilterWidget.h +++ b/libs/widgets/KoTagFilterWidget.h @@ -34,7 +34,7 @@ public: explicit KoTagFilterWidget(QWidget* parent); - virtual ~KoTagFilterWidget(); + ~KoTagFilterWidget() Q_DECL_OVERRIDE; void allowSave(bool allow); void clear(); Q_SIGNALS: diff --git a/libs/widgets/KoToolBox.cpp b/libs/widgets/KoToolBox.cpp --- a/libs/widgets/KoToolBox.cpp +++ b/libs/widgets/KoToolBox.cpp @@ -205,7 +205,7 @@ void KoToolBox::setCurrentLayer(const KoCanvasController *canvas, const KoShapeLayer *layer) { Q_UNUSED(canvas); - const bool enabled = layer == 0 || (layer->isEditable() && layer->isVisible()); + const bool enabled = layer == nullptr || (layer->isEditable() && layer->isVisible()); foreach (QToolButton *button, d->visibilityCodes.keys()) { if (d->visibilityCodes[button].endsWith( QLatin1String( "/always") ) ) { continue; diff --git a/libs/widgets/KoToolBoxButton.cpp b/libs/widgets/KoToolBoxButton.cpp --- a/libs/widgets/KoToolBoxButton.cpp +++ b/libs/widgets/KoToolBoxButton.cpp @@ -50,7 +50,7 @@ QPalette p = qApp->palette(); if (isChecked()) { QPalette palette_highlight(p); - QColor c = p.color(QPalette::Highlight); + const QColor &c = p.color(QPalette::Highlight); palette_highlight.setColor(QPalette::Button, c); setPalette(palette_highlight); } diff --git a/libs/widgets/KoToolBoxDocker_p.h b/libs/widgets/KoToolBoxDocker_p.h --- a/libs/widgets/KoToolBoxDocker_p.h +++ b/libs/widgets/KoToolBoxDocker_p.h @@ -37,9 +37,9 @@ explicit KoToolBoxDocker(KoToolBox *toolBox); /// reimplemented from KoCanvasObserverBase - virtual void setCanvas(KoCanvasBase *canvas); - virtual void unsetCanvas(); - virtual QString observerName() const { return QStringLiteral("KoToolBoxDocker"); } + void setCanvas(KoCanvasBase *canvas) Q_DECL_OVERRIDE; + void unsetCanvas() Q_DECL_OVERRIDE; + QString observerName() const Q_DECL_OVERRIDE { return QStringLiteral("KoToolBoxDocker"); } protected: void resizeEvent(QResizeEvent *event) override; diff --git a/libs/widgets/KoToolBoxFactory.h b/libs/widgets/KoToolBoxFactory.h --- a/libs/widgets/KoToolBoxFactory.h +++ b/libs/widgets/KoToolBoxFactory.h @@ -35,13 +35,13 @@ class KOWIDGETS_EXPORT KoToolBoxFactory : public KoDockFactoryBase { public: - explicit KoToolBoxFactory(); - ~KoToolBoxFactory(); + explicit KoToolBoxFactory() = default; + ~KoToolBoxFactory() Q_DECL_OVERRIDE = default; - virtual QString id() const; - KoDockFactoryBase::DockPosition defaultDockPosition() const; - QDockWidget* createDockWidget(); - virtual bool isCollapsable() const { return false; } + QString id() const Q_DECL_OVERRIDE; + KoDockFactoryBase::DockPosition defaultDockPosition() const Q_DECL_OVERRIDE; + QDockWidget* createDockWidget() Q_DECL_OVERRIDE; + virtual bool isCollapsable() const Q_DECL_OVERRIDE { return false; } }; #endif diff --git a/libs/widgets/KoToolBoxFactory.cpp b/libs/widgets/KoToolBoxFactory.cpp --- a/libs/widgets/KoToolBoxFactory.cpp +++ b/libs/widgets/KoToolBoxFactory.cpp @@ -21,14 +21,6 @@ #include "KoToolBox_p.h" #include "KoToolBoxDocker_p.h" - -KoToolBoxFactory::KoToolBoxFactory() -{ -} - -KoToolBoxFactory::~KoToolBoxFactory() { -} - QString KoToolBoxFactory::id() const { return QLatin1String("ToolBox"); diff --git a/libs/widgets/KoToolBoxLayout_p.h b/libs/widgets/KoToolBoxLayout_p.h --- a/libs/widgets/KoToolBoxLayout_p.h +++ b/libs/widgets/KoToolBoxLayout_p.h @@ -39,7 +39,7 @@ { } - ~SectionLayout() + ~SectionLayout() Q_DECL_OVERRIDE { qDeleteAll( m_items ); m_items.clear(); @@ -59,26 +59,26 @@ m_items.insert(index-1, new QWidgetItem(button)); } - QSize sizeHint() const + QSize sizeHint() const Q_DECL_OVERRIDE { Q_ASSERT(0); return QSize(); } - void addItem(QLayoutItem*) { Q_ASSERT(0); } + void addItem(QLayoutItem*) Q_DECL_OVERRIDE { Q_ASSERT(0); } - QLayoutItem* itemAt(int i) const + QLayoutItem* itemAt(int i) const Q_DECL_OVERRIDE { if (m_items.count() <= i) - return 0; + return nullptr; return m_items.at(i); } - QLayoutItem* takeAt(int i) { return m_items.takeAt(i); } + QLayoutItem* takeAt(int i) Q_DECL_OVERRIDE { return m_items.takeAt(i); } - int count() const { return m_items.count(); } + int count() const Q_DECL_OVERRIDE { return m_items.count(); } - void setGeometry (const QRect &rect) + void setGeometry (const QRect &rect) Q_DECL_OVERRIDE { int x = 0; int y = 0; @@ -214,9 +214,9 @@ setSpacing(6); } - ~KoToolBoxLayout(); + ~KoToolBoxLayout() Q_DECL_OVERRIDE; - QSize sizeHint() const + QSize sizeHint() const Q_DECL_OVERRIDE { // Prefer showing one row/column by default const QSize minSize = minimumSize(); @@ -230,7 +230,7 @@ } } - QSize minimumSize() const + QSize minimumSize() const Q_DECL_OVERRIDE { if (m_sections.isEmpty()) return QSize(); @@ -252,19 +252,19 @@ m_sections.insert(iterator, new QWidgetItem(section)); } - void addItem(QLayoutItem*) + void addItem(QLayoutItem*) Q_DECL_OVERRIDE { Q_ASSERT(0); // don't let anything else be added. (code depends on this!) } - QLayoutItem* itemAt(int i) const + QLayoutItem* itemAt(int i) const Q_DECL_OVERRIDE { return m_sections.value(i); } - QLayoutItem* takeAt(int i) { return m_sections.takeAt(i); } - int count() const { return m_sections.count(); } + QLayoutItem* takeAt(int i) Q_DECL_OVERRIDE { return m_sections.takeAt(i); } + int count() const Q_DECL_OVERRIDE { return m_sections.count(); } - void setGeometry (const QRect &rect) + void setGeometry (const QRect &rect) Q_DECL_OVERRIDE { QLayout::setGeometry(rect); doLayout(rect.size(), true); diff --git a/libs/widgets/KoToolBox_p.h b/libs/widgets/KoToolBox_p.h --- a/libs/widgets/KoToolBox_p.h +++ b/libs/widgets/KoToolBox_p.h @@ -101,8 +101,8 @@ void slotContextIconSize(); protected: - void paintEvent(QPaintEvent *event); - void contextMenuEvent(QContextMenuEvent *event); + void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE; + void contextMenuEvent(QContextMenuEvent *event) Q_DECL_OVERRIDE; private: class Private; diff --git a/libs/widgets/KoToolDocker.h b/libs/widgets/KoToolDocker.h --- a/libs/widgets/KoToolDocker.h +++ b/libs/widgets/KoToolDocker.h @@ -36,18 +36,18 @@ { Q_OBJECT public: - explicit KoToolDocker(QWidget *parent = 0); - ~KoToolDocker(); + explicit KoToolDocker(QWidget *parent = nullptr); + ~KoToolDocker() Q_DECL_OVERRIDE; void resetWidgets(); /// reimplemented - virtual void setCanvas(KoCanvasBase *canvas); - virtual void unsetCanvas(); + void setCanvas(KoCanvasBase *canvas) Q_DECL_OVERRIDE; + void unsetCanvas() Q_DECL_OVERRIDE; protected: - virtual void resizeEvent(QResizeEvent* event); ///< reimplemented from QWidget + void resizeEvent(QResizeEvent* event) Q_DECL_OVERRIDE; ///< reimplemented from QWidget public Q_SLOTS: /** * Update the option widgets to the argument one, removing the currently set widget. diff --git a/libs/widgets/KoToolDocker.cpp b/libs/widgets/KoToolDocker.cpp --- a/libs/widgets/KoToolDocker.cpp +++ b/libs/widgets/KoToolDocker.cpp @@ -258,7 +258,7 @@ void KoToolDocker::resizeEvent(QResizeEvent*) { - int fw = isFloating() ? style()->pixelMetric(QStyle::PM_DockWidgetFrameWidth, 0, this) : 0; + int fw = isFloating() ? style()->pixelMetric(QStyle::PM_DockWidgetFrameWidth, nullptr, this) : 0; d->tabButton->move(width() - d->tabButton->width() - d->scrollArea->verticalScrollBar()->sizeHint().width(), fw); } diff --git a/libs/widgets/KoTriangleColorSelector.h b/libs/widgets/KoTriangleColorSelector.h --- a/libs/widgets/KoTriangleColorSelector.h +++ b/libs/widgets/KoTriangleColorSelector.h @@ -32,13 +32,13 @@ public: explicit KoTriangleColorSelector(QWidget *parent); explicit KoTriangleColorSelector(const KoColorDisplayRendererInterface *displayRenderer, QWidget *parent); - ~KoTriangleColorSelector(); + ~KoTriangleColorSelector() Q_DECL_OVERRIDE; protected: // events - void paintEvent( QPaintEvent * event ); - void resizeEvent( QResizeEvent * event ); - void mouseReleaseEvent( QMouseEvent * event ); - void mousePressEvent( QMouseEvent * event ); - void mouseMoveEvent( QMouseEvent * event ); + void paintEvent( QPaintEvent * event ) Q_DECL_OVERRIDE; + void resizeEvent( QResizeEvent * event ) Q_DECL_OVERRIDE; + void mouseReleaseEvent( QMouseEvent * event ) Q_DECL_OVERRIDE; + void mousePressEvent( QMouseEvent * event ) Q_DECL_OVERRIDE; + void mouseMoveEvent( QMouseEvent * event ) Q_DECL_OVERRIDE; public: int hue() const; int value() const; diff --git a/libs/widgets/KoUnitDoubleSpinBox.h b/libs/widgets/KoUnitDoubleSpinBox.h --- a/libs/widgets/KoUnitDoubleSpinBox.h +++ b/libs/widgets/KoUnitDoubleSpinBox.h @@ -84,20 +84,20 @@ void setMinMaxStep( double min, double max, double step ); /// reimplemented from superclass, will forward to KoUnitDoubleValidator - virtual QValidator::State validate(QString &input, int &pos) const; + QValidator::State validate(QString &input, int &pos) const Q_DECL_OVERRIDE; /** * Transform the double in a nice text, using locale symbols * @param value the number as double * @return the resulting string */ - virtual QString textFromValue( double value ) const; + QString textFromValue( double value ) const Q_DECL_OVERRIDE; /** * Transform a string into a double, while taking care of locale specific symbols. * @param str the string to transform into a number * @return the value as double */ - virtual double valueFromText( const QString& str ) const; + double valueFromText( const QString& str ) const Q_DECL_OVERRIDE; Q_SIGNALS: diff --git a/libs/widgets/KoViewItemContextBar.h b/libs/widgets/KoViewItemContextBar.h --- a/libs/widgets/KoViewItemContextBar.h +++ b/libs/widgets/KoViewItemContextBar.h @@ -44,7 +44,7 @@ public: explicit KoViewItemContextBar(QAbstractItemView *parent); - virtual ~KoViewItemContextBar(); + ~KoViewItemContextBar() Q_DECL_OVERRIDE = default; virtual bool eventFilter(QObject *watched, QEvent *event); /** diff --git a/libs/widgets/KoViewItemContextBar.cpp b/libs/widgets/KoViewItemContextBar.cpp --- a/libs/widgets/KoViewItemContextBar.cpp +++ b/libs/widgets/KoViewItemContextBar.cpp @@ -72,10 +72,6 @@ m_view->setMouseTracking(true); } -KoViewItemContextBar::~KoViewItemContextBar() -{ -} - bool KoViewItemContextBar::eventFilter(QObject *watched, QEvent *event) { if (watched == m_view->viewport()) { diff --git a/libs/widgets/KoZoomAction.h b/libs/widgets/KoZoomAction.h --- a/libs/widgets/KoZoomAction.h +++ b/libs/widgets/KoZoomAction.h @@ -47,12 +47,12 @@ * @param parent The action's parent object. */ KoZoomAction( KoZoomMode::Modes zoomModes, const QString& text, QObject *parent); - ~KoZoomAction(); + ~KoZoomAction() Q_DECL_OVERRIDE; /** * Reimplemented from QWidgetAction. */ - virtual QWidget* createWidget(QWidget* parent); + QWidget* createWidget(QWidget* parent) Q_DECL_OVERRIDE; enum SpecialButton { AspectMode = 1, ///< changing aspect mode diff --git a/libs/widgets/KoZoomAction.cpp b/libs/widgets/KoZoomAction.cpp --- a/libs/widgets/KoZoomAction.cpp +++ b/libs/widgets/KoZoomAction.cpp @@ -119,7 +119,7 @@ , d(new Private(this)) { d->zoomModes = zoomModes; - d->specialButtons = 0; + d->specialButtons = nullptr; setIcon(koIcon("zoom-original")); setEditable( true ); setMaxComboViewCount( 15 ); diff --git a/libs/widgets/KoZoomController.h b/libs/widgets/KoZoomController.h --- a/libs/widgets/KoZoomController.h +++ b/libs/widgets/KoZoomController.h @@ -72,8 +72,8 @@ KoZoomController(KoCanvasController *controller, KoZoomHandler *zoomHandler, KActionCollection *actionCollection, - KoZoomAction::SpecialButtons specialButtons = 0, - QObject *parent = 0); + KoZoomAction::SpecialButtons specialButtons = nullptr, + QObject *parent = nullptr); /** * A special override for for creation of a zoom controller @@ -95,11 +95,11 @@ KoZoomHandler *zoomHandler, KActionCollection *actionCollection, bool createZoomShortcuts, - KoZoomAction::SpecialButtons specialButtons = 0, - QObject *parent = 0); + KoZoomAction::SpecialButtons specialButtons = nullptr, + QObject *parent = nullptr); /// destructor - ~KoZoomController(); + ~KoZoomController() Q_DECL_OVERRIDE; /// returns the zoomAction that is maintained by this controller KoZoomAction *zoomAction() const; diff --git a/libs/widgets/KoZoomController_p.h b/libs/widgets/KoZoomController_p.h --- a/libs/widgets/KoZoomController_p.h +++ b/libs/widgets/KoZoomController_p.h @@ -41,9 +41,7 @@ action = new KoZoomAction(KoZoomMode::ZOOM_WIDTH | KoZoomMode::ZOOM_PAGE, i18n("Zoom"), p); action->setSpecialButtons(specialButtons); } - ~Private() - { - } + ~Private() = default; /// so we know when the canvasController changes size void setAvailableSize() diff --git a/libs/widgets/KoZoomHandler.h b/libs/widgets/KoZoomHandler.h --- a/libs/widgets/KoZoomHandler.h +++ b/libs/widgets/KoZoomHandler.h @@ -39,7 +39,7 @@ public: KoZoomHandler(); - virtual ~KoZoomHandler(); + ~KoZoomHandler() Q_DECL_OVERRIDE = default; /** * @return the conversion factor between document and view, that @@ -98,7 +98,7 @@ * Change the zoom level, keeping the resolution unchanged. * @param zoom the zoom factor (e.g. 1.0 for 100%) */ - void setZoom(qreal zoom); + void setZoom(qreal zoom) Q_DECL_OVERRIDE; /** * Change the zoom mode @@ -145,74 +145,74 @@ * Convert a coordinate in pt to pixels. * @param documentPoint the point in the document coordinate system of a KoShape. */ - virtual QPointF documentToView(const QPointF &documentPoint) const; + QPointF documentToView(const QPointF &documentPoint) const Q_DECL_OVERRIDE; /** * Convert a coordinate in pixels to pt. * @param viewPoint the point in the coordinate system of the widget, or window. */ - virtual QPointF viewToDocument(const QPointF &viewPoint) const; + QPointF viewToDocument(const QPointF &viewPoint) const Q_DECL_OVERRIDE; /** * Convert a rectangle in pt to pixels. * @param documentRect the rect in the document coordinate system of a KoShape. */ - virtual QRectF documentToView(const QRectF &documentRect) const; + QRectF documentToView(const QRectF &documentRect) const Q_DECL_OVERRIDE; /** * Convert a rectangle in pixels to pt. * @param viewRect the rect in the coordinate system of the widget, or window. */ - virtual QRectF viewToDocument(const QRectF &viewRect) const; + QRectF viewToDocument(const QRectF &viewRect) const Q_DECL_OVERRIDE; /** * Convert a size in pt to pixels. * @param documentSize the size in pt. * @return the size in pixels. */ - virtual QSizeF documentToView(const QSizeF &documentSize) const; + QSizeF documentToView(const QSizeF &documentSize) const Q_DECL_OVERRIDE; /** * Convert a size in pixels to pt. * @param viewSize the size in pixels. * @return the size in pt. */ - virtual QSizeF viewToDocument(const QSizeF &viewSize) const; + QSizeF viewToDocument(const QSizeF &viewSize) const Q_DECL_OVERRIDE; /** * Convert a single x coordinate in pt to pixels. * @param documentX the x coordinate in pt. * @return the x coordinate in pixels. */ - virtual qreal documentToViewX(qreal documentX) const; + qreal documentToViewX(qreal documentX) const Q_DECL_OVERRIDE; /** * Convert a single y coordinate in pt to pixels. * @param documentY the y coordinate in pt. * @return the y coordinate in pixels. */ - virtual qreal documentToViewY(qreal documentY) const; + qreal documentToViewY(qreal documentY) const Q_DECL_OVERRIDE; /** * Convert a single x coordinate in pixels to pt. * @param viewX the x coordinate in pixels. * @return the x coordinate in pt. */ - virtual qreal viewToDocumentX(qreal viewX) const; + qreal viewToDocumentX(qreal viewX) const Q_DECL_OVERRIDE; /** * Convert a single y coordinate in pixels to pt. * @param viewY the y coordinate in pixels. * @return the y coordinate in pt. */ - virtual qreal viewToDocumentY(qreal viewY) const; + qreal viewToDocumentY(qreal viewY) const Q_DECL_OVERRIDE; /** * Get the zoom levels of the individual x and y axis. Copy them to the pointer parameters. * @param zoomX a pointer to a qreal which will be modified to set the horizontal zoom. * @param zoomY a pointer to a qreal which will be modified to set the vertical zoom. */ - virtual void zoom(qreal *zoomX, qreal *zoomY) const; + void zoom(qreal *zoomX, qreal *zoomY) const Q_DECL_OVERRIDE; using KoViewConverter::zoom; diff --git a/libs/widgets/KoZoomHandler.cpp b/libs/widgets/KoZoomHandler.cpp --- a/libs/widgets/KoZoomHandler.cpp +++ b/libs/widgets/KoZoomHandler.cpp @@ -39,10 +39,6 @@ setDpi(KoDpi::dpiX(), KoDpi::dpiY()); } -KoZoomHandler::~KoZoomHandler() -{ -} - void KoZoomHandler::setResolutionToStandard() { setDpi(KoDpi::dpiX(), KoDpi::dpiY()); diff --git a/libs/widgets/KoZoomInput.h b/libs/widgets/KoZoomInput.h --- a/libs/widgets/KoZoomInput.h +++ b/libs/widgets/KoZoomInput.h @@ -25,21 +25,21 @@ { Q_OBJECT public: - explicit KoZoomInput(QWidget* parent = 0); - ~KoZoomInput(); + explicit KoZoomInput(QWidget* parent = nullptr); + ~KoZoomInput() Q_DECL_OVERRIDE; void setZoomLevels(const QStringList& levels); void setCurrentZoomLevel(const QString& level); - virtual bool eventFilter(QObject* watched, QEvent* event); + bool eventFilter(QObject* watched, QEvent* event) Q_DECL_OVERRIDE; Q_SIGNALS: void zoomLevelChanged(const QString& level); protected: - void enterEvent(QEvent* event); - void leaveEvent(QEvent* event); - void keyPressEvent(QKeyEvent* event); + void enterEvent(QEvent* event) Q_DECL_OVERRIDE; + void leaveEvent(QEvent* event) Q_DECL_OVERRIDE; + void keyPressEvent(QKeyEvent* event) Q_DECL_OVERRIDE; private: class Private; diff --git a/libs/widgets/KoZoomMode.cpp b/libs/widgets/KoZoomMode.cpp --- a/libs/widgets/KoZoomMode.cpp +++ b/libs/widgets/KoZoomMode.cpp @@ -26,11 +26,11 @@ I18N_NOOP("%1%"), I18N_NOOP("Fit Page Width"), I18N_NOOP("Fit Page"), - 0, + nullptr, I18N_NOOP("Actual Pixels"), - 0, - 0, - 0, + nullptr, + nullptr, + nullptr, I18N_NOOP("Fit Text Width") }; @@ -46,14 +46,11 @@ { if(mode == i18n(modes[ZOOM_WIDTH])) return ZOOM_WIDTH; - else - if(mode == i18n(modes[ZOOM_PAGE])) + else if(mode == i18n(modes[ZOOM_PAGE])) return ZOOM_PAGE; - else - if(mode == i18n(modes[ZOOM_PIXELS])) + else if(mode == i18n(modes[ZOOM_PIXELS])) return ZOOM_PIXELS; - else - if(mode == i18n(modes[ZOOM_TEXT])) + else if(mode == i18n(modes[ZOOM_TEXT])) return ZOOM_TEXT; else return ZOOM_CONSTANT; diff --git a/libs/widgets/KoZoomWidget.h b/libs/widgets/KoZoomWidget.h --- a/libs/widgets/KoZoomWidget.h +++ b/libs/widgets/KoZoomWidget.h @@ -32,7 +32,7 @@ public: KoZoomWidget(QWidget* parent, KoZoomAction::SpecialButtons specialButtons, int maxZoom); - ~KoZoomWidget(); + ~KoZoomWidget() Q_DECL_OVERRIDE; Q_SIGNALS: /** diff --git a/libs/widgets/KoZoomWidget.cpp b/libs/widgets/KoZoomWidget.cpp --- a/libs/widgets/KoZoomWidget.cpp +++ b/libs/widgets/KoZoomWidget.cpp @@ -35,9 +35,9 @@ public: Private() - : slider(0) - , input(0) - , aspectButton(0) + : slider(nullptr) + , input(nullptr) + , aspectButton(nullptr) {} QSlider* slider;