[KColorScheme] Add items to ColorSet and Role enums for the total number of items
ClosedPublic

Authored by ndavis on Mon, Dec 2, 5:15 AM.

Details

Summary

I noticed that QPalette had these (see link below), but KColorScheme didn't. Since there is no function to get the number of items in an enum for C++, it seems like it would be useful to have a built-in way to get the total number of color sets or roles. For instance, a person might want to create an array of all foreground colors, but they would have to hardcode the array sizes without this patch.

I also removed some enum item value assignments that don't seem to have any use and might cause issues if new enum items are added.

https://code.qt.io/cgit/qt/qtbase.git/tree/src/gui/kernel/qpalette.h#n90

I plan to make a follow up patch to reduce the amount of hardcoded values in KColorScheme.

Test Plan

Open colorscheme editor in the Colors KCM to see if any colors or effects look broken.

Diff Detail

Repository
R265 KConfigWidgets
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
ndavis created this revision.Mon, Dec 2, 5:15 AM
Restricted Application added a project: Frameworks. · View Herald TranscriptMon, Dec 2, 5:15 AM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
ndavis requested review of this revision.Mon, Dec 2, 5:15 AM
ndavis edited the summary of this revision. (Show Details)
ndavis edited the summary of this revision. (Show Details)Mon, Dec 2, 5:19 AM
ndavis edited the summary of this revision. (Show Details)
ndavis updated this revision to Diff 70717.Mon, Dec 2, 5:35 AM
  • Also do Effects enum
ndavis edited the summary of this revision. (Show Details)Mon, Dec 2, 5:38 AM
ndavis retitled this revision from Add items to ColorSet and Role enums for the total number of items to [KColorScheme] Add items to ColorSet and Role enums for the total number of items.Mon, Dec 2, 6:35 AM
ndavis updated this revision to Diff 70718.Mon, Dec 2, 6:44 AM
  • Split up Effects enum
ndavis edited the test plan for this revision. (Show Details)Mon, Dec 2, 6:59 AM
ndavis edited the summary of this revision. (Show Details)Mon, Dec 2, 7:15 AM
dfaure accepted this revision.Mon, Dec 2, 10:09 PM
This revision is now accepted and ready to land.Mon, Dec 2, 10:09 PM
This revision was automatically updated to reflect the committed changes.