Skip to content

Commit

Permalink
Qt5 compatibility fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
Vitozz committed Mar 15, 2024
1 parent bc0af92 commit c40fe52
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/contactlistmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,11 @@ void ContactListModel::Private::clear()

operationQueue.clear();

#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QHashIterator<PsiContact *, QPersistentModelIndex> it(monitoredContacts);
#else
QMultiHashIterator<PsiContact *, QPersistentModelIndex> it(monitoredContacts);
#endif
while (it.hasNext()) {
it.next();
disconnect(it.key(), nullptr, this, nullptr);
Expand Down
4 changes: 4 additions & 0 deletions src/pluginhost.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,11 @@ bool PluginHost::incomingXml(int account, const QDomElement &e)
}

// regex filters
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QMapIterator<QRegularExpression, IqNamespaceFilter *> i(iqNsxFilters_);
#else
QMultiMapIterator<QRegularExpression, IqNamespaceFilter *> i(iqNsxFilters_);
#endif
while (!handled && i.hasNext()) {
if (i.key().match(ns).hasMatch() && (i.value()->*handler)(account, e)) {
handled = true;
Expand Down
4 changes: 4 additions & 0 deletions src/pluginmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1055,7 +1055,11 @@ QString PluginManager::installChatLogJSDataFilter(const QString &js, PsiPlugin::

void PluginManager::uninstallChatLogJSDataFilter(const QString &id)
{
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QMutableMapIterator<PsiPlugin::Priority, std::pair<QString, QString>> it(_messageViewJSFilters);
#else
QMutableMultiMapIterator<PsiPlugin::Priority, std::pair<QString, QString>> it(_messageViewJSFilters);
#endif

while (it.hasNext()) {
if (it.next().value().first == id) {
Expand Down
1 change: 1 addition & 0 deletions src/psicontactlistview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include <QHelpEvent>
#include <QLayout>
#include <QMimeData>
#include <QScreen>
#include <QTimer>

static const int recalculateTimerTimeout = 500;
Expand Down
5 changes: 5 additions & 0 deletions src/tabs/tabdlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#include <QSignalMapper>
#include <QTimer>
#include <QVBoxLayout>
#include <QVariant>
#ifdef Q_OS_WIN
#include <windows.h>
#endif
Expand Down Expand Up @@ -254,7 +255,11 @@ void TabDlg::tab_aboutToShowMenu(QMenu *menu)
int tabDlgMetaType = qRegisterMetaType<TabDlg *>("TabDlg*");
for (TabDlg *tabSet : tabManager_->tabSets()) {
QAction *act = sendTo->addAction(tabSet->desiredCaption());
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
act->setData(QVariant(tabDlgMetaType, &tabSet));
#else
act->setData(QVariant(QMetaType(tabDlgMetaType), &tabSet));
#endif
act->setEnabled(tabSet != this);
}
connect(sendTo, SIGNAL(triggered(QAction *)), SLOT(menu_sendTabTo(QAction *)));
Expand Down
3 changes: 3 additions & 0 deletions src/widgets/emojidb.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
// This is a generated file. See emoji.py for details
// clang-format off
#include "qglobal.h"
#include "emojiregistry.h"
#include <vector>
static std::vector<EmojiRegistry::Group> db = {
{
QT_TR_NOOP("Smileys & Emotion"),
Expand Down
4 changes: 2 additions & 2 deletions src/x11windowsystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace {
bool isPlatformX11()
{
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
return QX11Info::isPlatformX11());
return QX11Info::isPlatformX11();
#else
auto x11app = qApp->nativeInterface<QNativeInterface::QX11Application>();
return !!x11app;
Expand Down Expand Up @@ -73,7 +73,7 @@ static bool getCardinal32Prop(Display *display, Window win, char *propName, long
auto getDisplay()
{
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
return QX11Info::display());
return QX11Info::display();
#else
auto x11app = qApp->nativeInterface<QNativeInterface::QX11Application>();
return x11app->display();
Expand Down

0 comments on commit c40fe52

Please sign in to comment.