Don't rely on TWidget using QObjectPrivate for Qt version check

This commit is contained in:
Ilya Fedin 2024-05-03 00:40:41 +04:00 committed by John Preston
parent 4cc4d2ff56
commit ce3459e249
2 changed files with 6 additions and 3 deletions

View file

@ -15,9 +15,6 @@
#include <QtGui/QColorSpace>
#include <private/qwidget_p.h>
// Patching out this code without patching out all other private API usage
// and the Qt::{Core,Gui,Widgets}Private cmake dependency is asking
// for memory corruption
class TWidgetPrivate : public QWidgetPrivate {
public:
#if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0)

View file

@ -156,6 +156,12 @@ bool Distinct(FixedRange a, FixedRange b) {
Renderer::Renderer(const Ui::Text::String &t)
: _t(&t)
, _spoiler(_t->_extended ? _t->_extended->spoiler.get() : nullptr) {
[[maybe_unused]] static const auto Once = [] {
// Running with a Qt version other than the one built upon is
// dangerous due to excessive private API usage in this class
Assert(QLatin1String(qVersion()) == QLatin1String(QT_VERSION_STR));
return true;
}();
}
Renderer::~Renderer() {