mirror of
https://github.com/Chatterino/chatterino2.git
synced 2026-08-24 10:04:53 -05:00
chore: remove old qt version checks (#6863)
Remove all Qt version checks for Qt versions below 6.5. Reviewed-by: pajlada <rasmus.karlsson@pajlada.com>
This commit is contained in:
@@ -22,11 +22,7 @@
|
||||
|
||||
#ifndef NO_QTKEYCHAIN
|
||||
# ifdef CMAKE_BUILD
|
||||
# if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
# include "qt6keychain/keychain.h"
|
||||
# else
|
||||
# include "qt5keychain/keychain.h"
|
||||
# endif
|
||||
# include "qt6keychain/keychain.h"
|
||||
# else
|
||||
# include <qtkeychain/keychain.h>
|
||||
# endif
|
||||
|
||||
@@ -33,12 +33,6 @@ TldSet &tlds()
|
||||
}
|
||||
QTextStream stream(&file);
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
// Default encoding of QTextStream is already UTF-8, at least in Qt6
|
||||
#else
|
||||
stream.setCodec("UTF-8");
|
||||
#endif
|
||||
|
||||
TldSet set;
|
||||
|
||||
while (!stream.atEnd())
|
||||
|
||||
@@ -44,7 +44,6 @@ void NetworkTask::run()
|
||||
const auto &timeout = this->data_->timeout;
|
||||
if (timeout.has_value())
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 3, 0)
|
||||
QObject::connect(this->reply_, &QNetworkReply::requestSent, this,
|
||||
[this]() {
|
||||
const auto &timeout = this->data_->timeout;
|
||||
@@ -54,13 +53,6 @@ void NetworkTask::run()
|
||||
QObject::connect(this->timer_, &QTimer::timeout,
|
||||
this, &NetworkTask::timeout);
|
||||
});
|
||||
#else
|
||||
this->timer_ = new QTimer(this);
|
||||
this->timer_->setSingleShot(true);
|
||||
this->timer_->start(timeout.value());
|
||||
QObject::connect(this->timer_, &QTimer::timeout, this,
|
||||
&NetworkTask::timeout);
|
||||
#endif
|
||||
}
|
||||
|
||||
QObject::connect(this->reply_, &QNetworkReply::finished, this,
|
||||
|
||||
@@ -77,30 +77,18 @@ bool isList(const PossibleType &possibleType);
|
||||
|
||||
inline bool variantIs(const QVariant &a, int type)
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
return a.typeId() == type;
|
||||
#else
|
||||
return a.type() == type;
|
||||
#endif
|
||||
}
|
||||
|
||||
inline bool variantIsNot(const QVariant &a, int type)
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
return a.typeId() != type;
|
||||
#else
|
||||
return a.type() != type;
|
||||
#endif
|
||||
}
|
||||
|
||||
inline bool convertVariantTypes(QVariant &a, QVariant &b, int type)
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
QMetaType ty(type);
|
||||
return a.convert(ty) && b.convert(ty);
|
||||
#else
|
||||
return a.convert(type) && b.convert(type);
|
||||
#endif
|
||||
}
|
||||
|
||||
inline bool variantTypesMatch(QVariant &a, QVariant &b, int type)
|
||||
|
||||
@@ -12,7 +12,6 @@ namespace {
|
||||
/// This attempts to convert both variants to a common type if they're not equal.
|
||||
bool looselyCompareVariants(QVariant &lhs, QVariant &rhs)
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
// Qt 6 and later don't convert types as much as Qt 5 did when comparing.
|
||||
//
|
||||
// Based on QVariant::cmp from Qt 5.15
|
||||
@@ -36,7 +35,6 @@ bool looselyCompareVariants(QVariant &lhs, QVariant &rhs)
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return lhs == rhs;
|
||||
}
|
||||
@@ -217,11 +215,7 @@ QVariant BinaryOperation::execute(const ContextMap &context) const
|
||||
|
||||
auto matching = left.toString();
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
switch (static_cast<QMetaType::Type>(right.typeId()))
|
||||
#else
|
||||
switch (static_cast<QMetaType::Type>(right.type()))
|
||||
#endif
|
||||
{
|
||||
case QMetaType::QRegularExpression: {
|
||||
return right.toRegularExpression()
|
||||
|
||||
@@ -243,11 +243,7 @@ void processIgnorePhrases(const std::vector<IgnorePhrase> &phrases,
|
||||
return;
|
||||
}
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
auto words = midrepl.tokenize(u' ');
|
||||
#else
|
||||
auto words = midrepl.split(' ');
|
||||
#endif
|
||||
SizeType pos = 0;
|
||||
for (const auto &word : words)
|
||||
{
|
||||
@@ -313,11 +309,7 @@ void processIgnorePhrases(const std::vector<IgnorePhrase> &phrases,
|
||||
QRegularExpression emoteregex(
|
||||
"\\b" + emote.name.string + "\\b",
|
||||
QRegularExpression::UseUnicodePropertiesOption);
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
|
||||
auto match = emoteregex.matchView(midExtendedRef);
|
||||
#else
|
||||
auto match = emoteregex.match(midExtendedRef);
|
||||
#endif
|
||||
if (match.hasMatch())
|
||||
{
|
||||
emote.start = static_cast<int>(from + match.capturedStart());
|
||||
|
||||
+2
-4
@@ -119,18 +119,16 @@ int main(int argc, char **argv)
|
||||
qCInfo(chatterinoApp).noquote()
|
||||
<< "Chatterino Qt SSL library version:"
|
||||
<< QSslSocket::sslLibraryVersionString();
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 1, 0)
|
||||
qCInfo(chatterinoApp).noquote()
|
||||
<< "Chatterino Qt SSL active backend:"
|
||||
<< QSslSocket::activeBackend() << "of"
|
||||
<< QSslSocket::availableBackends().join(", ");
|
||||
# if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0)
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0)
|
||||
qCInfo(chatterinoApp) << "Chatterino Qt SSL active backend features:"
|
||||
<< QSslSocket::supportedFeatures();
|
||||
# endif
|
||||
#endif
|
||||
qCInfo(chatterinoApp) << "Chatterino Qt SSL active backend protocols:"
|
||||
<< QSslSocket::supportedProtocols();
|
||||
#endif
|
||||
|
||||
Settings settings(args, paths->settingsDirectory);
|
||||
|
||||
|
||||
@@ -829,11 +829,7 @@ FontStyle TextElement::fontStyle() const noexcept
|
||||
|
||||
void TextElement::appendText(QStringView text)
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
for (auto word : text.split(' ')) // creates a QList
|
||||
#else
|
||||
for (auto word : text.tokenize(u' '))
|
||||
#endif
|
||||
{
|
||||
this->words_.append(word.toString());
|
||||
}
|
||||
@@ -841,9 +837,6 @@ void TextElement::appendText(QStringView text)
|
||||
|
||||
void TextElement::appendText(const QString &text)
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
this->appendText(QStringView{text});
|
||||
#else
|
||||
qsizetype firstSpace = text.indexOf(u' ');
|
||||
if (firstSpace == -1)
|
||||
{
|
||||
@@ -857,7 +850,6 @@ void TextElement::appendText(const QString &text)
|
||||
{
|
||||
this->words_.emplace_back(word.toString());
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
QJsonObject TextElement::toJson() const
|
||||
|
||||
@@ -57,16 +57,12 @@ public:
|
||||
|
||||
void debug(std::string_view msg) override
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
|
||||
qCDebug(this->loggingCategory).noquote() << msg;
|
||||
#endif
|
||||
}
|
||||
|
||||
void warn(std::string_view msg) override
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
|
||||
qCWarning(this->loggingCategory).noquote() << msg;
|
||||
#endif
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
@@ -18,7 +18,6 @@ using namespace chatterino;
|
||||
|
||||
int getUsernameBoldness()
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
// From qfont.cpp
|
||||
// https://github.com/qt/qtbase/blob/589c6d066f84833a7c3dda1638037f4b2e91b7aa/src/gui/text/qfont.cpp#L143-L169
|
||||
static constexpr std::array<std::array<int, 2>, 9> legacyToOpenTypeMap{{
|
||||
@@ -55,9 +54,6 @@ int getUsernameBoldness()
|
||||
}
|
||||
|
||||
return result;
|
||||
#else
|
||||
return getSettings()->boldScale.getValue();
|
||||
#endif
|
||||
}
|
||||
|
||||
float fontSize(FontStyle style)
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "singletons/Resources.hpp"
|
||||
#include "singletons/WindowManager.hpp"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QColor>
|
||||
#include <QDir>
|
||||
#include <QElapsedTimer>
|
||||
@@ -18,10 +19,7 @@
|
||||
#include <QJsonArray>
|
||||
#include <QJsonDocument>
|
||||
#include <QSet>
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
|
||||
# include <QStyleHints>
|
||||
#endif
|
||||
#include <QApplication>
|
||||
#include <QStyleHints>
|
||||
|
||||
#include <cmath>
|
||||
#include <numbers>
|
||||
@@ -334,7 +332,6 @@ Theme::Theme(const Paths &paths)
|
||||
|
||||
this->loadAvailableThemes(paths);
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
|
||||
QObject::connect(QApplication::styleHints(),
|
||||
&QStyleHints::colorSchemeChanged, &this->lifetime_,
|
||||
[this] {
|
||||
@@ -344,7 +341,6 @@ Theme::Theme(const Paths &paths)
|
||||
getApp()->getWindows()->forceLayoutChannelViews();
|
||||
}
|
||||
});
|
||||
#endif
|
||||
|
||||
this->update();
|
||||
}
|
||||
@@ -352,7 +348,6 @@ Theme::Theme(const Paths &paths)
|
||||
void Theme::update()
|
||||
{
|
||||
auto currentTheme = [&]() -> QString {
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
|
||||
if (this->isSystemTheme())
|
||||
{
|
||||
switch (QApplication::styleHints()->colorScheme())
|
||||
@@ -364,7 +359,6 @@ void Theme::update()
|
||||
return this->darkSystemThemeName;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return this->themeName;
|
||||
};
|
||||
|
||||
|
||||
@@ -381,20 +381,12 @@ QStringView codepointSlice(QStringView str, qsizetype begin, qsizetype end)
|
||||
|
||||
void removeFirstQS(QString &str)
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
|
||||
str.removeFirst();
|
||||
#else
|
||||
str.remove(0, 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
void removeLastQS(QString &str)
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
|
||||
str.removeLast();
|
||||
#else
|
||||
str.chop(1);
|
||||
#endif
|
||||
}
|
||||
|
||||
void writeProviderEmotesCache(const QString &id, const QString &provider,
|
||||
|
||||
@@ -8,10 +8,7 @@
|
||||
#include <QString>
|
||||
#include <QStringView>
|
||||
#include <QtGlobal>
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
|
||||
# include <QUtf8StringView>
|
||||
#endif
|
||||
#include <QUtf8StringView>
|
||||
|
||||
namespace chatterino {
|
||||
|
||||
@@ -33,7 +30,6 @@ struct QCompareTransparentBase {
|
||||
bool operator()(QStringView a, QLatin1String b) const noexcept;
|
||||
bool operator()(QLatin1String a, QStringView b) const noexcept;
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
|
||||
bool operator()(QUtf8StringView a, QUtf8StringView b) const noexcept;
|
||||
|
||||
bool operator()(const QString & a, QUtf8StringView b) const noexcept;
|
||||
@@ -43,7 +39,6 @@ struct QCompareTransparentBase {
|
||||
bool operator()(QUtf8StringView a, const QString & b) const noexcept;
|
||||
bool operator()(QUtf8StringView a, QStringView b) const noexcept;
|
||||
bool operator()(QUtf8StringView a, QLatin1String b) const noexcept;
|
||||
#endif
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
@@ -116,7 +111,6 @@ inline bool QCompareTransparentBase<CS>::operator()(
|
||||
return a.compare(b, CS) < 0;
|
||||
}
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
|
||||
template <Qt::CaseSensitivity CS>
|
||||
inline bool QCompareTransparentBase<CS>::operator()(
|
||||
QUtf8StringView a, QUtf8StringView b) const noexcept
|
||||
@@ -165,6 +159,5 @@ inline bool QCompareTransparentBase<CS>::operator()(
|
||||
{
|
||||
return a.compare(b, CS) < 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
@@ -134,20 +134,13 @@ public:
|
||||
/// the entire duration of the program).
|
||||
///
|
||||
/// @param view The view to turn into a static string
|
||||
/// @returns Qt6: A static string (never gets freed), Qt5: regular string
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
/// @returns A static string (never gets freed)
|
||||
[[nodiscard]] inline QString staticString(QStringView view) noexcept
|
||||
{
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-const-cast)
|
||||
return QString(QStringPrivate(nullptr, const_cast<char16_t *>(view.utf16()),
|
||||
view.size()));
|
||||
}
|
||||
#else
|
||||
[[nodiscard]] inline QString staticString(QStringView view)
|
||||
{
|
||||
return view.toString();
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace chatterino::qmagicenum::detail
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@ namespace chatterino::windows::detail {
|
||||
|
||||
void renameThread(HANDLE hThread, const QString &threadName)
|
||||
{
|
||||
# if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
// SetThreadDescription requires Windows 10, version 1607
|
||||
// Qt 6 requires Windows 10 1809
|
||||
|
||||
@@ -25,7 +24,6 @@ void renameThread(HANDLE hThread, const QString &threadName)
|
||||
<< "Failed to set thread description, hresult=0x"
|
||||
<< QString::number(hr, 16);
|
||||
}
|
||||
# endif
|
||||
}
|
||||
|
||||
} // namespace chatterino::windows::detail
|
||||
|
||||
@@ -131,17 +131,13 @@ RECT windowBordersFor(HWND hwnd, bool isMaximized)
|
||||
{
|
||||
// GetDpiForWindow and GetSystemMetricsForDpi are only supported on
|
||||
// Windows 10 and later. Qt 6 requires Windows 10.
|
||||
# if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
auto dpi = GetDpiForWindow(hwnd);
|
||||
# endif
|
||||
|
||||
auto systemMetric = [&](auto index) {
|
||||
# if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
if (dpi != 0)
|
||||
{
|
||||
return GetSystemMetricsForDpi(index, dpi);
|
||||
}
|
||||
# endif
|
||||
return GetSystemMetrics(index);
|
||||
};
|
||||
|
||||
@@ -804,13 +800,8 @@ void BaseWindow::showEvent(QShowEvent *)
|
||||
#endif
|
||||
}
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
bool BaseWindow::nativeEvent(const QByteArray &eventType, void *message,
|
||||
qintptr *result)
|
||||
#else
|
||||
bool BaseWindow::nativeEvent(const QByteArray &eventType, void *message,
|
||||
long *result)
|
||||
#endif
|
||||
{
|
||||
#ifdef USEWINSDK
|
||||
MSG *msg = reinterpret_cast<MSG *>(message);
|
||||
@@ -1134,11 +1125,7 @@ bool BaseWindow::handleSHOWWINDOW(MSG *msg)
|
||||
#endif
|
||||
}
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
bool BaseWindow::handleNCCALCSIZE(MSG *msg, qintptr *result)
|
||||
#else
|
||||
bool BaseWindow::handleNCCALCSIZE(MSG *msg, long *result)
|
||||
#endif
|
||||
{
|
||||
#ifdef USEWINSDK
|
||||
if (!this->hasCustomWindowFrame())
|
||||
@@ -1250,11 +1237,7 @@ bool BaseWindow::handleMOVE(MSG *msg)
|
||||
return false;
|
||||
}
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
bool BaseWindow::handleNCHITTEST(MSG *msg, qintptr *result)
|
||||
#else
|
||||
bool BaseWindow::handleNCHITTEST(MSG *msg, long *result)
|
||||
#endif
|
||||
{
|
||||
#ifdef USEWINSDK
|
||||
const LONG borderWidth = 8; // in device independent pixels
|
||||
|
||||
@@ -128,13 +128,8 @@ protected:
|
||||
|
||||
virtual void windowDeactivationEvent();
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
bool nativeEvent(const QByteArray &eventType, void *message,
|
||||
qintptr *result) override;
|
||||
#else
|
||||
bool nativeEvent(const QByteArray &eventType, void *message,
|
||||
long *result) override;
|
||||
#endif
|
||||
void scaleChangedEvent(float) override;
|
||||
|
||||
void paintEvent(QPaintEvent *) override;
|
||||
@@ -177,13 +172,8 @@ private:
|
||||
bool handleSHOWWINDOW(MSG *msg);
|
||||
bool handleSIZE(MSG *msg);
|
||||
bool handleMOVE(MSG *msg);
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
bool handleNCCALCSIZE(MSG *msg, qintptr *result);
|
||||
bool handleNCHITTEST(MSG *msg, qintptr *result);
|
||||
#else
|
||||
bool handleNCCALCSIZE(MSG *msg, long *result);
|
||||
bool handleNCHITTEST(MSG *msg, long *result);
|
||||
#endif
|
||||
|
||||
void appendTitlebarButton(Button *button);
|
||||
|
||||
|
||||
@@ -32,13 +32,8 @@ FramelessEmbedWindow::FramelessEmbedWindow()
|
||||
}
|
||||
|
||||
#ifdef USEWINSDK
|
||||
# if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
bool FramelessEmbedWindow::nativeEvent(const QByteArray &eventType,
|
||||
void *message, qintptr *result)
|
||||
# else
|
||||
bool FramelessEmbedWindow::nativeEvent(const QByteArray &eventType,
|
||||
void *message, long *result)
|
||||
# endif
|
||||
{
|
||||
MSG *msg = reinterpret_cast<MSG *>(message);
|
||||
|
||||
|
||||
@@ -18,13 +18,8 @@ public:
|
||||
protected:
|
||||
#ifdef USEWINSDK
|
||||
|
||||
# if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
bool nativeEvent(const QByteArray &eventType, void *message,
|
||||
qintptr *result) override;
|
||||
# else
|
||||
bool nativeEvent(const QByteArray &eventType, void *message,
|
||||
long *result) override;
|
||||
# endif
|
||||
|
||||
void showEvent(QShowEvent *event) override;
|
||||
#endif
|
||||
|
||||
@@ -299,7 +299,7 @@ void OverlayWindow::toggleInertia()
|
||||
this->setInert(!this->inert_);
|
||||
}
|
||||
|
||||
void OverlayWindow::enterEvent(EnterEvent * /*event*/)
|
||||
void OverlayWindow::enterEvent(QEnterEvent * /*event*/)
|
||||
{
|
||||
#ifndef OVERLAY_NATIVE_MOVE
|
||||
this->startInteraction();
|
||||
@@ -315,7 +315,7 @@ void OverlayWindow::leaveEvent(QEvent * /*event*/)
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
bool OverlayWindow::nativeEvent(const QByteArray &eventType, void *message,
|
||||
NativeResult *result)
|
||||
qintptr *result)
|
||||
{
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
|
||||
MSG *msg = reinterpret_cast<MSG *>(message);
|
||||
@@ -368,7 +368,7 @@ bool OverlayWindow::nativeEvent(const QByteArray &eventType, void *message,
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
void OverlayWindow::handleNCHITTEST(MSG *msg, NativeResult *result)
|
||||
void OverlayWindow::handleNCHITTEST(MSG *msg, qintptr *result)
|
||||
{
|
||||
// This implementation is similar to the one of BaseWindow, but has the
|
||||
// following differences:
|
||||
|
||||
@@ -41,21 +41,13 @@ public:
|
||||
void drawOutline(QPainter &painter) override;
|
||||
|
||||
protected:
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
using NativeResult = qintptr;
|
||||
using EnterEvent = QEnterEvent;
|
||||
#else
|
||||
using NativeResult = long;
|
||||
using EnterEvent = QEvent;
|
||||
#endif
|
||||
|
||||
bool eventFilter(QObject *object, QEvent *event) override;
|
||||
void enterEvent(EnterEvent *event) override;
|
||||
void enterEvent(QEnterEvent *event) override;
|
||||
void leaveEvent(QEvent *event) override;
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
bool nativeEvent(const QByteArray &eventType, void *message,
|
||||
NativeResult *result) override;
|
||||
qintptr *result) override;
|
||||
#endif
|
||||
|
||||
void addShortcuts() override;
|
||||
@@ -72,7 +64,7 @@ private:
|
||||
void applyTheme();
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
void handleNCHITTEST(MSG *msg, NativeResult *result);
|
||||
void handleNCHITTEST(MSG *msg, qintptr *result);
|
||||
|
||||
HCURSOR sizeAllCursor_;
|
||||
#endif
|
||||
|
||||
@@ -334,12 +334,7 @@ void stringify(sol::stack_proxy it, QString &s, size_t maxItems = 10,
|
||||
{
|
||||
s.append(u", ["_s);
|
||||
}
|
||||
# if QT_VERSION < QT_VERSION_CHECK(6, 5, 0)
|
||||
s.append(QString::fromUtf8(
|
||||
key.data(), static_cast<qsizetype>(key.size())));
|
||||
# else
|
||||
s.append(QUtf8StringView(key));
|
||||
# endif
|
||||
s.append("] = <dyn>");
|
||||
n++;
|
||||
}
|
||||
|
||||
@@ -169,11 +169,7 @@ void Button::setOpaqueContent(bool opaqueContent)
|
||||
this->opaqueContent_ = opaqueContent;
|
||||
}
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
void Button::enterEvent(QEnterEvent * /*event*/)
|
||||
#else
|
||||
void Button::enterEvent(QEvent * /*event*/)
|
||||
#endif
|
||||
{
|
||||
if (!this->mouseOver_)
|
||||
{
|
||||
|
||||
@@ -182,11 +182,7 @@ protected:
|
||||
/// Setter for #opaqueContent()
|
||||
void setOpaqueContent(bool opaqueContent);
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
void enterEvent(QEnterEvent * /*event*/) override;
|
||||
#else
|
||||
void enterEvent(QEvent * /*event*/) override;
|
||||
#endif
|
||||
void leaveEvent(QEvent *event) override;
|
||||
void mousePressEvent(QMouseEvent *event) override;
|
||||
void mouseReleaseEvent(QMouseEvent *event) override;
|
||||
|
||||
@@ -1869,11 +1869,7 @@ void ChannelView::wheelEvent(QWheelEvent *event)
|
||||
}
|
||||
}
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
void ChannelView::enterEvent(QEnterEvent * /*event*/)
|
||||
#else
|
||||
void ChannelView::enterEvent(QEvent * /*event*/)
|
||||
#endif
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -244,11 +244,7 @@ protected:
|
||||
void paintEvent(QPaintEvent * /*event*/) override;
|
||||
void wheelEvent(QWheelEvent *event) override;
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
void enterEvent(QEnterEvent * /*event*/) override;
|
||||
#else
|
||||
void enterEvent(QEvent * /*event*/) override;
|
||||
#endif
|
||||
void leaveEvent(QEvent * /*event*/) override;
|
||||
|
||||
bool event(QEvent *event) override;
|
||||
|
||||
@@ -1167,11 +1167,7 @@ void NotebookTab::mouseDoubleClickEvent(QMouseEvent *event)
|
||||
}
|
||||
}
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
void NotebookTab::enterEvent(QEnterEvent *event)
|
||||
#else
|
||||
void NotebookTab::enterEvent(QEvent *event)
|
||||
#endif
|
||||
{
|
||||
this->mouseOver_ = true;
|
||||
|
||||
|
||||
@@ -102,11 +102,7 @@ protected:
|
||||
void mousePressEvent(QMouseEvent *event) override;
|
||||
void mouseReleaseEvent(QMouseEvent *event) override;
|
||||
void mouseDoubleClickEvent(QMouseEvent *event) override;
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
void enterEvent(QEnterEvent *event) override;
|
||||
#else
|
||||
void enterEvent(QEvent *event) override;
|
||||
#endif
|
||||
void leaveEvent(QEvent *) override;
|
||||
|
||||
void dragEnterEvent(QDragEnterEvent *event) override;
|
||||
|
||||
@@ -19,11 +19,7 @@ TableRowDragStyle::TableRowDragStyle(const QString &name)
|
||||
|
||||
void TableRowDragStyle::applyTo(QTableView *view)
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 1, 0)
|
||||
auto styleName = view->style()->name();
|
||||
#else
|
||||
QString styleName = "fusion";
|
||||
#endif
|
||||
auto *proxyStyle = new TableRowDragStyle(styleName);
|
||||
proxyStyle->setParent(view);
|
||||
view->setStyle(proxyStyle);
|
||||
|
||||
@@ -19,11 +19,7 @@ void ColorItemDelegate::paint(QPainter *painter,
|
||||
{
|
||||
auto data = index.data(Qt::DecorationRole);
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
if (data.typeId() != QMetaType::QColor)
|
||||
#else
|
||||
if (data.type() != QVariant::Color)
|
||||
#endif
|
||||
{
|
||||
return QStyledItemDelegate::paint(painter, option, index);
|
||||
}
|
||||
|
||||
@@ -191,11 +191,6 @@ AboutPage::AboutPage()
|
||||
}
|
||||
|
||||
QTextStream stream(&contributorsFile);
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
// Default encoding of QTextStream is already UTF-8
|
||||
#else
|
||||
stream.setCodec("UTF-8");
|
||||
#endif
|
||||
|
||||
QString line;
|
||||
|
||||
|
||||
@@ -134,14 +134,11 @@ void GeneralPage::initLayout(GeneralPageView &layout)
|
||||
{
|
||||
auto *themes = getApp()->getThemes();
|
||||
auto available = themes->availableThemes();
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
|
||||
available.emplace_back("System", "System");
|
||||
#endif
|
||||
|
||||
SettingWidget::dropdown("Theme", themes->themeName, available)
|
||||
->addTo(layout);
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
|
||||
SettingWidget::dropdown("Dark system theme",
|
||||
themes->darkSystemThemeName,
|
||||
themes->availableThemes())
|
||||
@@ -157,7 +154,6 @@ void GeneralPage::initLayout(GeneralPageView &layout)
|
||||
"theme and you enabled the adaptive 'System' theme.")
|
||||
->conditionallyEnabledBy(themes->themeName, "System")
|
||||
->addTo(layout);
|
||||
#endif
|
||||
}
|
||||
|
||||
layout.addDropdown<float>(
|
||||
|
||||
@@ -90,9 +90,7 @@ KeyboardSettingsPage::KeyboardSettingsPage()
|
||||
|
||||
auto *keySequenceInput = new QKeySequenceEdit(this);
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0)
|
||||
keySequenceInput->setClearButtonEnabled(true);
|
||||
#endif
|
||||
auto *searchText = new QLabel("Search keybind:", this);
|
||||
|
||||
QObject::connect(keySequenceInput, &QKeySequenceEdit::keySequenceChanged,
|
||||
|
||||
@@ -1066,11 +1066,7 @@ void SplitHeader::mouseDoubleClickEvent(QMouseEvent *event)
|
||||
this->doubleClicked_ = true;
|
||||
}
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
void SplitHeader::enterEvent(QEnterEvent *event)
|
||||
#else
|
||||
void SplitHeader::enterEvent(QEvent *event)
|
||||
#endif
|
||||
{
|
||||
if (!this->tooltipText_.isEmpty())
|
||||
{
|
||||
|
||||
@@ -49,11 +49,7 @@ protected:
|
||||
void mousePressEvent(QMouseEvent *event) override;
|
||||
void mouseReleaseEvent(QMouseEvent *event) override;
|
||||
void mouseMoveEvent(QMouseEvent *event) override;
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
void enterEvent(QEnterEvent *event) override;
|
||||
#else
|
||||
void enterEvent(QEvent *event) override;
|
||||
#endif
|
||||
void leaveEvent(QEvent *event) override;
|
||||
void mouseDoubleClickEvent(QMouseEvent *event) override;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user