From a11c935c3245e2daa22f74fa62bb78af63a232a5 Mon Sep 17 00:00:00 2001 From: Sergei Ilinykh Date: Sat, 16 Mar 2024 16:38:44 +0300 Subject: [PATCH] Make Qt6 buildable --- 3rdparty/qite | 2 +- iris | 2 +- src/psirosterwidget.cpp | 4 ++++ src/shortcutmanager.cpp | 3 ++- src/svgiconengine.cpp | 2 ++ src/tools/optionstree/optionstreemodel.cpp | 8 ++++++++ src/vcardfactory.cpp | 4 ++++ src/whiteboarding/wbitem.cpp | 4 +--- 8 files changed, 23 insertions(+), 6 deletions(-) diff --git a/3rdparty/qite b/3rdparty/qite index 94669c1ed..48f038a71 160000 --- a/3rdparty/qite +++ b/3rdparty/qite @@ -1 +1 @@ -Subproject commit 94669c1edc3770cadd9931f878e09e83a350235f +Subproject commit 48f038a710e72a32bfdde339175fb449cb17ad97 diff --git a/iris b/iris index 99d930be0..8fdf68808 160000 --- a/iris +++ b/iris @@ -1 +1 @@ -Subproject commit 99d930be0c63b9c9e079f902d04268b030689ed0 +Subproject commit 8fdf6880838fb9a847326b8ffcefe4248a985a22 diff --git a/src/psirosterwidget.cpp b/src/psirosterwidget.cpp index 736379e32..43989746a 100644 --- a/src/psirosterwidget.cpp +++ b/src/psirosterwidget.cpp @@ -242,7 +242,11 @@ void PsiRosterWidget::setShowStatusMsg(bool enabled) void PsiRosterWidget::filterEditTextChanged(const QString &text) { if (filterModel_) +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) filterModel_->setFilterRegExp(QRegularExpression::escape(text)); +#else + filterModel_->setFilterRegularExpression(QRegularExpression::escape(text)); +#endif } void PsiRosterWidget::quitFilteringMode() { setFilterModeEnabled(false); } diff --git a/src/shortcutmanager.cpp b/src/shortcutmanager.cpp index 032608e11..d9e03dfce 100644 --- a/src/shortcutmanager.cpp +++ b/src/shortcutmanager.cpp @@ -5,6 +5,7 @@ #include #include +#include /** * \brief The Construtor of the Shortcutmanager @@ -127,7 +128,7 @@ void ShortcutManager::connect(const QString &path, QObject *parent, const char * act->setShortcuts(shortcuts); act->setShortcutContext(appWide ? Qt::ApplicationShortcut : Qt::WindowShortcut); if (parent->isWidgetType()) - static_cast(parent)->addAction(act); + qobject_cast(parent)->addAction(act); parent->connect(act, SIGNAL(triggered()), slot); } } else { diff --git a/src/svgiconengine.cpp b/src/svgiconengine.cpp index 49fa070dc..a776a8c8f 100644 --- a/src/svgiconengine.cpp +++ b/src/svgiconengine.cpp @@ -44,12 +44,14 @@ void SvgIconEngine::paint(QPainter *painter, const QRect &rect, QIcon::Mode mode void SvgIconEngine::virtual_hook(int id, void *data) { switch (id) { +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) case QIconEngine::AvailableSizesHook: reinterpret_cast(data)->sizes.clear(); break; case QIconEngine::IconNameHook: *reinterpret_cast(data) = name; break; +#endif #if QT_VERSION >= QT_VERSION_CHECK(5, 7, 0) case QIconEngine::IsNullHook: *reinterpret_cast(data) = !(renderer && renderer->isValid()); diff --git a/src/tools/optionstree/optionstreemodel.cpp b/src/tools/optionstree/optionstreemodel.cpp index fd4bf15cf..27ab86ae7 100644 --- a/src/tools/optionstree/optionstreemodel.cpp +++ b/src/tools/optionstree/optionstreemodel.cpp @@ -238,11 +238,19 @@ bool OptionsTreeModel::setData(const QModelIndex &index, const QVariant &value, } QVariant current = tree_->getOption(option); QVariant newval = value; +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) if (!newval.canConvert(int(current.type()))) { +#else + if (!newval.canConvert(current.metaType())) { +#endif qWarning("Sorry don't know how to do that!"); return false; } +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) newval.convert(int(current.type())); +#else + newval.convert(current.metaType()); +#endif tree_->setOption(option, newval); return true; } diff --git a/src/vcardfactory.cpp b/src/vcardfactory.cpp index 60e78712a..863d3432f 100644 --- a/src/vcardfactory.cpp +++ b/src/vcardfactory.cpp @@ -127,7 +127,11 @@ void VCardFactory::saveVCard(const Jid &j, const VCard &vcard, bool notifyPhoto) QFile file(ApplicationInfo::vCardDir() + '/' + JIDUtil::encode(j.bare()).toLower() + ".xml"); file.open(QIODevice::WriteOnly); QTextStream out(&file); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + out.setEncoding(QStringConverter::Utf8); +#else out.setCodec("UTF-8"); +#endif QDomDocument doc; doc.appendChild(vcard.toXml(&doc)); out << doc.toString(4); diff --git a/src/whiteboarding/wbitem.cpp b/src/whiteboarding/wbitem.cpp index 0b768afd1..92a1e3ef9 100644 --- a/src/whiteboarding/wbitem.cpp +++ b/src/whiteboarding/wbitem.cpp @@ -420,8 +420,6 @@ QPointF WbItem::center() ** ****************************************************************************/ -double qstrtod(const char *s00, char const **se, bool *ok); - static qreal toDouble(const QChar *&str) { const int maxLen = 255; // technically doubles can go til 308+ but whatever @@ -499,7 +497,7 @@ static qreal toDouble(const QChar *&str) #endif { bool ok = false; - val = qstrtod(temp, nullptr, &ok); + val = QByteArray::fromRawData(temp, pos).toDouble(&ok); } } return val;