Skip to content

Commit

Permalink
Fix behavior of DitheringMode with QVariant in Qt5
Browse files Browse the repository at this point in the history
Fixes #3304
  • Loading branch information
10110111 committed Jul 5, 2023
1 parent 26ab36d commit d4a5b01
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/core/Dithering.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ namespace ForTextureMgr
GLuint makeDitherPatternTexture(QOpenGLFunctions& gl);
}

// This namespace is only needed to add the Q_NAMESPACE and Q_ENUM_NS for Qt5
// to be able to store DitheringMode in QVariant and convert its values to
// string. Normally (e.g. in Qt6) I'd just put the enum into the global
// namespace.
namespace Dithering
{
Q_NAMESPACE

enum class DitheringMode
{
Disabled, //!< Dithering disabled, will leave the infamous color bands
Expand All @@ -37,6 +45,9 @@ enum class DitheringMode
Color888, //!< 24-bit color (AKA True color)
Color101010, //!< 30-bit color (AKA Deep color)
};
Q_ENUM_NS(DitheringMode)
}
using Dithering::DitheringMode;

Vec3f calcRGBMaxValue(DitheringMode mode);

Expand Down

0 comments on commit d4a5b01

Please sign in to comment.