File indexing completed on 2024-05-12 15:54:49

0001 /*
0002  * SPDX-FileCopyrightText: 2021 Arjen Hiemstra <ahiemstra@heimr.nl>
0003  *
0004  * SPDX-License-Identifier: LGPL-2.1-or-later
0005  */
0006 
0007 #ifndef DISPLAYCOLORSPACE_H
0008 #define DISPLAYCOLORSPACE_H
0009 
0010 #include <QColorSpace>
0011 #include <QObject>
0012 
0013 /**
0014  * Provides access to the display color space from QML.
0015  */
0016 class DisplayColorSpace : public QObject
0017 {
0018     Q_OBJECT
0019 
0020 public:
0021     DisplayColorSpace(QObject *parent = nullptr);
0022 
0023     /**
0024      * The color space of the display.
0025      *
0026      * This provides a QColorSpace instance that matches the color space of the
0027      * display. If the color space cannot be retrieved for whatever reason, a
0028      * default sRGB color space is returned.
0029      *
0030      * TODO: Handle screen changes.
0031      */
0032     Q_PROPERTY(QColorSpace colorSpace READ colorSpace CONSTANT)
0033     QColorSpace colorSpace() const;
0034 
0035 private:
0036     void update();
0037 
0038     QColorSpace m_colorSpace;
0039 };
0040 
0041 #endif // DISPLAYCOLORSPACE_H