Qt5 support standard dialogs such as QFileDialog, QFontDialog, and QColorDialog, however, it does not provide a color picker to allow a user to pick a color. Recently, I need a color picker for one of my projects and I implemented a simple color picker widget.
SColorPicker
is available from Github as a part of QtUtils repository. To use SColorPicker
, add the header and cpp files directly in your project. Then, simply add an instance of SColorPicker
in a layout. SColorPicker
will appear as 16×16 pixels colored square in the layout. If you need a different size, change it in the SColorPicker's
constructor. When a user double-clicks on the colored square, the system’s color dialog will appear allowing the user to choose a color. The selected color can be obtained from color()
function or by connecting to colorPicked()
signal.
Below are the screenshots of the SColorPicker_Demo
and system color dialog present to the user on Windows 10 computer.

