Perceptual Color
How to get started
How to get started? PerceptualColor::ColorDialog provides a perceptual replacement for QColorDialog:
// Show a modal color dialog and get the color that the user has chosen
QColor myColor = PerceptualColor::ColorDialog::getColor();
This is a minimal, but complete example project showing how to use this library:
CMakeLists.txt:
cmake_minimum_required(VERSION 3.16)
project(example)
find_package(
"perceptualcolor-0"
REQUIRED)
add_executable(example)
target_sources(example PRIVATE example.cpp)
target_link_libraries(
example
PRIVATE PerceptualColor::perceptualcolor-0)
example.cpp:
#include <colordialog.h>
#include <qapplication.h>
#include <qcolordialog.h>
#include <rgbcolorspacefactory.h>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
auto myColorSpace = PerceptualColor::RgbColorSpaceFactory::createSrgb();
PerceptualColor::ColorDialog m_colorDialog(myColorSpace);
m_colorDialog.setOption(QColorDialog::ColorDialogOption::ShowAlphaChannel);
m_colorDialog.show();
return app.exec();
}
static QSharedPointer< PerceptualColor::RgbColorSpace > createSrgb()
Create an sRGB color space object.
Definition rgbcolorspacefactory.cpp:36
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:57:18 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:57:18 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.