Index: src/kitemviews/kfileitemmodel.cpp =================================================================== --- src/kitemviews/kfileitemmodel.cpp +++ src/kitemviews/kfileitemmodel.cpp @@ -2296,7 +2296,7 @@ const KFileItemModel::RoleInfoMap* KFileItemModel::rolesInfoMap(int& count) { - static const RoleInfoMap rolesInfoMap[] = { + static constexpr std::array rolesInfoMap{{ // | role | roleType | role translation | group translation | requires Baloo | requires indexer { nullptr, NoRole, nullptr, nullptr, nullptr, nullptr, false, false }, { "text", NameRole, I18N_NOOP2_NOSTRIP("@label", "Name"), nullptr, nullptr, false, false }, @@ -2331,10 +2331,10 @@ { "permissions", PermissionsRole, I18N_NOOP2_NOSTRIP("@label", "Permissions"), I18N_NOOP2_NOSTRIP("@label", "Other"), false, false }, { "owner", OwnerRole, I18N_NOOP2_NOSTRIP("@label", "Owner"), I18N_NOOP2_NOSTRIP("@label", "Other"), false, false }, { "group", GroupRole, I18N_NOOP2_NOSTRIP("@label", "User Group"), I18N_NOOP2_NOSTRIP("@label", "Other"), false, false }, - }; + }}; - count = sizeof(rolesInfoMap) / sizeof(RoleInfoMap); - return rolesInfoMap; + count = rolesInfoMap.size(); + return rolesInfoMap.data(); } void KFileItemModel::determineMimeTypes(const KFileItemList& items, int timeout) Index: src/kitemviews/private/kbaloorolesprovider.cpp =================================================================== --- src/kitemviews/private/kbaloorolesprovider.cpp +++ src/kitemviews/private/kbaloorolesprovider.cpp @@ -104,7 +104,7 @@ // Mapping from the URIs to the KFileItemModel roles. Note that this must not be // a 1:1 mapping: One role may contain several URI-values - static const PropertyInfo propertyInfoList[] = { + static constexpr std::array propertyInfoList{{ { "rating", "rating" }, { "tag", "tags" }, { "comment", "comment" }, @@ -125,7 +125,7 @@ { "releaseYear", "releaseYear" }, { "trackNumber", "track" }, { "originUrl", "originUrl" } - }; + }}; for (unsigned int i = 0; i < sizeof(propertyInfoList) / sizeof(PropertyInfo); ++i) { m_roleForProperty.insert(propertyInfoList[i].property, propertyInfoList[i].role); Index: src/kitemviews/private/kpixmapmodifier.cpp =================================================================== --- src/kitemviews/private/kpixmapmodifier.cpp +++ src/kitemviews/private/kpixmapmodifier.cpp @@ -38,8 +38,7 @@ #include #include -static const quint32 stackBlur8Mul[255] = -{ +static constexpr std::array stackBlur8Mul{{ 512,512,456,512,328,456,335,512,405,328,271,456,388,335,292,512, 454,405,364,328,298,271,496,456,420,388,360,335,312,292,273,512, 482,454,428,405,383,364,345,328,312,298,284,271,259,496,475,456, @@ -56,10 +55,9 @@ 385,381,377,374,370,367,363,360,357,354,350,347,344,341,338,335, 332,329,326,323,320,318,315,312,310,307,304,302,299,297,294,292, 289,287,285,282,280,278,275,273,271,269,267,265,263,261,259 -}; +}}; -static const quint32 stackBlur8Shr[255] = -{ +static constexpr std::array stackBlur8Shr{{ 9, 11, 12, 13, 13, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 20, 20, 20, @@ -76,7 +74,7 @@ 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24 -}; +}}; static void blurHorizontal(QImage& image, unsigned int* stack, int div, int radius) { @@ -311,7 +309,7 @@ p->fillRect(contentRect, Qt::transparent); } - QPixmap m_tiles[NumTiles]; + std::array m_tiles; }; } Index: src/panels/places/placespanel.cpp =================================================================== --- src/panels/places/placespanel.cpp +++ src/panels/places/placespanel.cpp @@ -308,12 +308,12 @@ }; const int iconSizeCount = 4; - static const IconSizeInfo iconSizes[iconSizeCount] = { + static constexpr std::array iconSizes{{ {KIconLoader::SizeSmall, I18N_NOOP2_NOSTRIP("Small icon size", "Small (%1x%2)")}, {KIconLoader::SizeSmallMedium, I18N_NOOP2_NOSTRIP("Medium icon size", "Medium (%1x%2)")}, {KIconLoader::SizeMedium, I18N_NOOP2_NOSTRIP("Large icon size", "Large (%1x%2)")}, {KIconLoader::SizeLarge, I18N_NOOP2_NOSTRIP("Huge icon size", "Huge (%1x%2)")} - }; + }}; QHash iconSizeActionMap; QActionGroup* iconSizeGroup = new QActionGroup(iconSizeSubMenu);