diff --git a/kirigami-plasmadesktop-integration/kirigamiplasmafactory.h b/kirigami-plasmadesktop-integration/kirigamiplasmafactory.h --- a/kirigami-plasmadesktop-integration/kirigamiplasmafactory.h +++ b/kirigami-plasmadesktop-integration/kirigamiplasmafactory.h @@ -33,7 +33,7 @@ public: explicit KirigamiPlasmaFactory(QObject *parent = nullptr); - ~KirigamiPlasmaFactory(); + ~KirigamiPlasmaFactory() override; Kirigami::PlatformTheme *createPlatformTheme(QObject *parent) Q_DECL_OVERRIDE; }; diff --git a/kirigami-plasmadesktop-integration/kirigamiplasmafactory.cpp b/kirigami-plasmadesktop-integration/kirigamiplasmafactory.cpp --- a/kirigami-plasmadesktop-integration/kirigamiplasmafactory.cpp +++ b/kirigami-plasmadesktop-integration/kirigamiplasmafactory.cpp @@ -25,9 +25,7 @@ { } -KirigamiPlasmaFactory::~KirigamiPlasmaFactory() -{ -} +KirigamiPlasmaFactory::~KirigamiPlasmaFactory() = default; Kirigami::PlatformTheme *KirigamiPlasmaFactory::createPlatformTheme(QObject *parent) { diff --git a/kirigami-plasmadesktop-integration/plasmadesktoptheme.h b/kirigami-plasmadesktop-integration/plasmadesktoptheme.h --- a/kirigami-plasmadesktop-integration/plasmadesktoptheme.h +++ b/kirigami-plasmadesktop-integration/plasmadesktoptheme.h @@ -46,8 +46,8 @@ Q_PROPERTY(QColor viewFocusColor READ viewFocusColor NOTIFY colorsChanged) public: - explicit PlasmaDesktopTheme(QObject *parent = 0); - ~PlasmaDesktopTheme(); + explicit PlasmaDesktopTheme(QObject *parent = nullptr); + ~PlasmaDesktopTheme() override; Q_INVOKABLE QIcon iconFromTheme(const QString &name, const QColor &customColor = Qt::transparent) Q_DECL_OVERRIDE; diff --git a/kirigami-plasmadesktop-integration/plasmadesktoptheme.cpp b/kirigami-plasmadesktop-integration/plasmadesktoptheme.cpp --- a/kirigami-plasmadesktop-integration/plasmadesktoptheme.cpp +++ b/kirigami-plasmadesktop-integration/plasmadesktoptheme.cpp @@ -32,8 +32,7 @@ class IconLoaderSingleton { public: - IconLoaderSingleton() - {} + IconLoaderSingleton() = default; KIconLoader self; }; @@ -104,9 +103,7 @@ Colors ret = {{}, KColorScheme(group, KColorScheme::ColorSet::Selection), KColorScheme(group, set)}; QPalette pal; - static const QPalette::ColorGroup states[3] = { QPalette::Active, QPalette::Inactive, QPalette::Disabled }; - for (int i = 0; i < 3; i++) { - QPalette::ColorGroup state = states[i]; + for (auto state : { QPalette::Active, QPalette::Inactive, QPalette::Disabled }) { pal.setBrush(state, QPalette::WindowText, ret.scheme.foreground()); pal.setBrush(state, QPalette::Window, ret.scheme.background()); pal.setBrush(state, QPalette::Base, ret.scheme.background()); @@ -184,17 +181,13 @@ syncColors(); } -PlasmaDesktopTheme::~PlasmaDesktopTheme() -{ -} +PlasmaDesktopTheme::~PlasmaDesktopTheme() = default; QIcon PlasmaDesktopTheme::iconFromTheme(const QString &name, const QColor &customColor) { QPalette pal = palette(); if (customColor != Qt::transparent) { - static const QPalette::ColorGroup states[3] = { QPalette::Active, QPalette::Inactive, QPalette::Disabled }; - for (int i = 0; i < 3; i++) { - QPalette::ColorGroup state = states[i]; + for (auto state : { QPalette::Active, QPalette::Inactive, QPalette::Disabled }) { pal.setBrush(state, QPalette::WindowText, customColor); } } @@ -232,7 +225,7 @@ setNegativeTextColor(colors.scheme.foreground(KColorScheme::NegativeText).color()); setNeutralTextColor(colors.scheme.foreground(KColorScheme::NeutralText).color()); setPositiveTextColor(colors.scheme.foreground(KColorScheme::PositiveText).color()); - + //background setBackgroundColor(colors.scheme.background(KColorScheme::NormalBackground).color()); @@ -258,25 +251,25 @@ QColor PlasmaDesktopTheme::buttonTextColor() const { - qWarning()<<"WARNING: buttonTextColor is deprecated, use textColor with colorSet: Theme.Button instead"; + qWarning() << "WARNING: buttonTextColor is deprecated, use textColor with colorSet: Theme.Button instead"; return m_buttonTextColor; } QColor PlasmaDesktopTheme::buttonBackgroundColor() const { - qWarning()<<"WARNING: buttonBackgroundColor is deprecated, use backgroundColor with colorSet: Theme.Button instead"; + qWarning() << "WARNING: buttonBackgroundColor is deprecated, use backgroundColor with colorSet: Theme.Button instead"; return m_buttonBackgroundColor; } QColor PlasmaDesktopTheme::buttonHoverColor() const { - qWarning()<<"WARNING: buttonHoverColor is deprecated, use backgroundColor with colorSet: Theme.Button instead"; + qWarning() << "WARNING: buttonHoverColor is deprecated, use backgroundColor with colorSet: Theme.Button instead"; return m_buttonHoverColor; } QColor PlasmaDesktopTheme::buttonFocusColor() const { - qWarning()<<"WARNING: buttonFocusColor is deprecated, use backgroundColor with colorSet: Theme.Button instead"; + qWarning() << "WARNING: buttonFocusColor is deprecated, use backgroundColor with colorSet: Theme.Button instead"; return m_buttonFocusColor; } @@ -289,19 +282,19 @@ QColor PlasmaDesktopTheme::viewBackgroundColor() const { - qWarning()<<"WARNING: viewBackgroundColor is deprecated, use backgroundColor with colorSet: Theme.View instead"; + qWarning() << "WARNING: viewBackgroundColor is deprecated, use backgroundColor with colorSet: Theme.View instead"; return m_viewBackgroundColor; } QColor PlasmaDesktopTheme::viewHoverColor() const { - qWarning()<<"WARNING: viewHoverColor is deprecated, use backgroundColor with colorSet: Theme.View instead"; + qWarning() << "WARNING: viewHoverColor is deprecated, use backgroundColor with colorSet: Theme.View instead"; return m_viewHoverColor; } QColor PlasmaDesktopTheme::viewFocusColor() const { - qWarning()<<"WARNING: viewFocusColor is deprecated, use backgroundColor with colorSet: Theme.View instead"; + qWarning() << "WARNING: viewFocusColor is deprecated, use backgroundColor with colorSet: Theme.View instead"; return m_viewFocusColor; } diff --git a/plugin/CMakeLists.txt b/plugin/CMakeLists.txt --- a/plugin/CMakeLists.txt +++ b/plugin/CMakeLists.txt @@ -15,7 +15,7 @@ endif() add_library(qqc2desktopstyleplugin SHARED ${qqc2desktopstyle_SRCS}) -target_link_libraries(qqc2desktopstyleplugin Qt5::Core Qt5::Qml Qt5::Quick Qt5::Gui Qt5::Widgets KF5::Kirigami2) +target_link_libraries(qqc2desktopstyleplugin Qt5::Core Qt5::Qml Qt5::Quick Qt5::Gui Qt5::Widgets KF5::Kirigami2) if(KF5ConfigWidgets_FOUND) target_link_libraries(qqc2desktopstyleplugin diff --git a/plugin/kquickpadding_p.h b/plugin/kquickpadding_p.h --- a/plugin/kquickpadding_p.h +++ b/plugin/kquickpadding_p.h @@ -59,7 +59,7 @@ int m_bottom; public: - KQuickPadding(QObject *parent = 0) : + KQuickPadding(QObject *parent = nullptr) : QObject(parent), m_left(0), m_top(0), diff --git a/plugin/kquickstyleitem.cpp b/plugin/kquickstyleitem.cpp --- a/plugin/kquickstyleitem.cpp +++ b/plugin/kquickstyleitem.cpp @@ -58,7 +58,7 @@ KQuickStyleItem::KQuickStyleItem(QQuickItem *parent) : QQuickItem(parent), - m_styleoption(0), + m_styleoption(nullptr), m_itemType(Undefined), m_sunken(false), m_raised(false), @@ -156,7 +156,7 @@ else delete m_styleoption; - m_styleoption = 0; + m_styleoption = nullptr; } void KQuickStyleItem::initStyleOption() @@ -188,7 +188,7 @@ QStyleOptionButton *opt = qstyleoption_cast(m_styleoption); opt->text = text(); opt->icon = m_properties[QStringLiteral("icon")].value(); - int e = qApp->style()->pixelMetric(QStyle::PM_ButtonIconSize, m_styleoption, 0); + int e = qApp->style()->pixelMetric(QStyle::PM_ButtonIconSize, m_styleoption, nullptr); opt->iconSize = QSize(e, e); opt->features = activeControl() == QLatin1String("default") ? QStyleOptionButton::DefaultButton : @@ -299,7 +299,7 @@ if (opt->icon.isNull() && !opt->text.isEmpty()) opt->toolButtonStyle = Qt::ToolButtonTextOnly; - int e = qApp->style()->pixelMetric(QStyle::PM_ToolBarIconSize, m_styleoption, 0); + int e = qApp->style()->pixelMetric(QStyle::PM_ToolBarIconSize, m_styleoption, nullptr); opt->iconSize = QSize(e, e); const QFont font = qApp->font("QToolButton"); @@ -738,7 +738,7 @@ case SpinBox :{ subcontrol = qApp->style()->hitTestComplexControl(QStyle::CC_SpinBox, qstyleoption_cast(m_styleoption), - QPoint(px,py), 0); + QPoint(px,py), nullptr); if (subcontrol == QStyle::SC_SpinBoxUp) return QStringLiteral("up"); else if (subcontrol == QStyle::SC_SpinBoxDown) @@ -749,16 +749,16 @@ case Slider: { subcontrol = qApp->style()->hitTestComplexControl(QStyle::CC_Slider, qstyleoption_cast(m_styleoption), - QPoint(px,py), 0); + QPoint(px,py), nullptr); if (subcontrol == QStyle::SC_SliderHandle) return QStringLiteral("handle"); } break; case ScrollBar: { subcontrol = qApp->style()->hitTestComplexControl(QStyle::CC_ScrollBar, qstyleoption_cast(m_styleoption), - QPoint(px,py), 0); + QPoint(px,py), nullptr); switch (subcontrol) { case QStyle::SC_ScrollBarSlider: return QStringLiteral("handle"); @@ -865,7 +865,7 @@ // We have to create a new style option since we might be calling with a QStyleOptionSpinBox QStyleOptionFrame frame; frame.state = m_styleoption->state; - frame.lineWidth = qApp->style()->pixelMetric(QStyle::PM_DefaultFrameWidth, m_styleoption, 0); + frame.lineWidth = qApp->style()->pixelMetric(QStyle::PM_DefaultFrameWidth, m_styleoption, nullptr); frame.rect = m_styleoption->rect; frame.styleObject = this; size = qApp->style()->sizeFromContents(QStyle::CT_LineEdit, &frame, QSize(width, height)); @@ -907,7 +907,7 @@ case ComboBoxItem: if (static_cast(m_styleoption)->menuItemType == QStyleOptionMenuItem::Scroller) { size.setHeight(qMax(QApplication::globalStrut().height(), - qApp->style()->pixelMetric(QStyle::PM_MenuScrollerHeight, 0, 0))); + qApp->style()->pixelMetric(QStyle::PM_MenuScrollerHeight, nullptr, nullptr))); } else { size = qApp->style()->sizeFromContents(QStyle::CT_MenuItem, m_styleoption, QSize(width,height)); } @@ -1002,47 +1002,47 @@ { if (metric == QLatin1String("scrollbarExtent")) - return qApp->style()->pixelMetric(QStyle::PM_ScrollBarExtent, 0 ); + return qApp->style()->pixelMetric(QStyle::PM_ScrollBarExtent, nullptr); else if (metric == QLatin1String("defaultframewidth")) return qApp->style()->pixelMetric(QStyle::PM_DefaultFrameWidth, m_styleoption); else if (metric == QLatin1String("taboverlap")) - return qApp->style()->pixelMetric(QStyle::PM_TabBarTabOverlap, 0 ); + return qApp->style()->pixelMetric(QStyle::PM_TabBarTabOverlap, nullptr); else if (metric == QLatin1String("tabbaseoverlap")) - return qApp->style()->pixelMetric(QStyle::PM_TabBarBaseOverlap, m_styleoption ); + return qApp->style()->pixelMetric(QStyle::PM_TabBarBaseOverlap, m_styleoption); else if (metric == QLatin1String("tabhspace")) - return qApp->style()->pixelMetric(QStyle::PM_TabBarTabHSpace, 0 ); + return qApp->style()->pixelMetric(QStyle::PM_TabBarTabHSpace, nullptr); else if (metric == QLatin1String("indicatorwidth")) - return qApp->style()->pixelMetric(QStyle::PM_ExclusiveIndicatorWidth, 0 ); + return qApp->style()->pixelMetric(QStyle::PM_ExclusiveIndicatorWidth, nullptr); else if (metric == QLatin1String("tabvspace")) - return qApp->style()->pixelMetric(QStyle::PM_TabBarTabVSpace, 0 ); + return qApp->style()->pixelMetric(QStyle::PM_TabBarTabVSpace, nullptr); else if (metric == QLatin1String("tabbaseheight")) - return qApp->style()->pixelMetric(QStyle::PM_TabBarBaseHeight, 0 ); + return qApp->style()->pixelMetric(QStyle::PM_TabBarBaseHeight, nullptr); else if (metric == QLatin1String("tabvshift")) - return qApp->style()->pixelMetric(QStyle::PM_TabBarTabShiftVertical, 0 ); + return qApp->style()->pixelMetric(QStyle::PM_TabBarTabShiftVertical, nullptr); else if (metric == QLatin1String("menubarhmargin")) - return qApp->style()->pixelMetric(QStyle::PM_MenuBarHMargin, 0 ); + return qApp->style()->pixelMetric(QStyle::PM_MenuBarHMargin, nullptr); else if (metric == QLatin1String("menubarvmargin")) - return qApp->style()->pixelMetric(QStyle::PM_MenuBarVMargin, 0 ); + return qApp->style()->pixelMetric(QStyle::PM_MenuBarVMargin, nullptr); else if (metric == QLatin1String("menubarpanelwidth")) - return qApp->style()->pixelMetric(QStyle::PM_MenuBarPanelWidth, 0 ); + return qApp->style()->pixelMetric(QStyle::PM_MenuBarPanelWidth, nullptr); else if (metric == QLatin1String("menubaritemspacing")) - return qApp->style()->pixelMetric(QStyle::PM_MenuBarItemSpacing, 0 ); + return qApp->style()->pixelMetric(QStyle::PM_MenuBarItemSpacing, nullptr); else if (metric == QLatin1String("spacebelowmenubar")) return qApp->style()->styleHint(QStyle::SH_MainWindow_SpaceBelowMenuBar, m_styleoption); else if (metric == QLatin1String("menuhmargin")) - return qApp->style()->pixelMetric(QStyle::PM_MenuHMargin, 0 ); + return qApp->style()->pixelMetric(QStyle::PM_MenuHMargin, nullptr); else if (metric == QLatin1String("menuvmargin")) - return qApp->style()->pixelMetric(QStyle::PM_MenuVMargin, 0 ); + return qApp->style()->pixelMetric(QStyle::PM_MenuVMargin, nullptr); else if (metric == QLatin1String("menupanelwidth")) - return qApp->style()->pixelMetric(QStyle::PM_MenuPanelWidth, 0 ); + return qApp->style()->pixelMetric(QStyle::PM_MenuPanelWidth, nullptr); else if (metric == QLatin1String("submenuoverlap")) - return qApp->style()->pixelMetric(QStyle::PM_SubMenuOverlap, 0 ); + return qApp->style()->pixelMetric(QStyle::PM_SubMenuOverlap, nullptr); else if (metric == QLatin1String("splitterwidth")) - return qApp->style()->pixelMetric(QStyle::PM_SplitterWidth, 0 ); + return qApp->style()->pixelMetric(QStyle::PM_SplitterWidth, nullptr); else if (metric == QLatin1String("scrollbarspacing")) - return abs(qApp->style()->pixelMetric(QStyle::PM_ScrollView_ScrollBarSpacing, 0 )); + return abs(qApp->style()->pixelMetric(QStyle::PM_ScrollView_ScrollBarSpacing, nullptr)); else if (metric == QLatin1String("treeviewindentation")) - return qApp->style()->pixelMetric(QStyle::PM_TreeViewIndentation, 0 ); + return qApp->style()->pixelMetric(QStyle::PM_TreeViewIndentation, nullptr); return 0; } @@ -1113,7 +1113,7 @@ emit elementTypeChanged(); if (m_styleoption) { delete m_styleoption; - m_styleoption = 0; + m_styleoption = nullptr; } // Only enable visible if the widget can animate @@ -1245,7 +1245,7 @@ case ItemBranchIndicator: { QStyleOption opt; opt.rect = QRect(0, 0, implicitWidth(), implicitHeight()); - return qApp->style()->subElementRect(QStyle::SE_TreeViewDisclosureItem, &opt, 0); + return qApp->style()->subElementRect(QStyle::SE_TreeViewDisclosureItem, &opt, nullptr); } default: break; @@ -1453,7 +1453,7 @@ break; case Menu: { QStyleHintReturnMask val; - qApp->style()->styleHint(QStyle::SH_Menu_Mask, m_styleoption, 0, &val); + qApp->style()->styleHint(QStyle::SH_Menu_Mask, m_styleoption, nullptr, &val); painter->save(); painter->setClipRegion(val.region); painter->fillRect(m_styleoption->rect, m_styleoption->palette.window()); @@ -1558,7 +1558,7 @@ { if (m_image.isNull()) { delete node; - return 0; + return nullptr; } QSGNinePatchNode *styleNode = static_cast(node); diff --git a/plugin/kquickstyleitem_p.h b/plugin/kquickstyleitem_p.h --- a/plugin/kquickstyleitem_p.h +++ b/plugin/kquickstyleitem_p.h @@ -60,7 +60,7 @@ public: QQuickTableRowImageProvider1() : QQuickImageProvider(QQuickImageProvider::Pixmap) {} - QPixmap requestPixmap(const QString &id, QSize *size, const QSize &requestedSize); + QPixmap requestPixmap(const QString &id, QSize *size, const QSize &requestedSize) override; }; class KQuickStyleItem: public QQuickItem @@ -105,8 +105,8 @@ KQuickPadding* border() { return &m_border; } public: - KQuickStyleItem(QQuickItem *parent = 0); - ~KQuickStyleItem(); + KQuickStyleItem(QQuickItem *parent = nullptr); + ~KQuickStyleItem() override; enum MenuItemType { SeparatorType = 0, @@ -263,9 +263,9 @@ void textureHeightChanged(int h); protected: - virtual bool event(QEvent *); - virtual QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *); - virtual void updatePolish(); + bool event(QEvent *) override; + QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *) override; + void updatePolish() override; bool eventFilter(QObject *watched, QEvent *event) override; private: diff --git a/plugin/qqc2desktopstyleplugin.h b/plugin/qqc2desktopstyleplugin.h --- a/plugin/qqc2desktopstyleplugin.h +++ b/plugin/qqc2desktopstyleplugin.h @@ -30,7 +30,7 @@ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") public: - void registerTypes(const char *uri); + void registerTypes(const char *uri) override; }; #endif diff --git a/plugin/qsgdefaultninepatchnode_p.h b/plugin/qsgdefaultninepatchnode_p.h --- a/plugin/qsgdefaultninepatchnode_p.h +++ b/plugin/qsgdefaultninepatchnode_p.h @@ -62,7 +62,7 @@ { public: QSGDefaultNinePatchNode(); - ~QSGDefaultNinePatchNode(); + ~QSGDefaultNinePatchNode() override; void setTexture(QSGTexture *texture) override; void setBounds(const QRectF &bounds) override;