diff options
| author | 2023-10-04 22:50:00 +0200 | |
|---|---|---|
| committer | 2023-10-18 10:26:35 +0200 | |
| commit | b62b83e7772e9fba12fd6eadb6c1e70924ccf173 (patch) | |
| tree | 768534de16817dadabf5f9a9f8005558f9201a9d /src | |
| parent | Make shortcuts compatible with qt6; remove unused KviShortcut constructor sin... (diff) | |
| download | KVIrc-b62b83e7772e9fba12fd6eadb6c1e70924ccf173.tar.gz KVIrc-b62b83e7772e9fba12fd6eadb6c1e70924ccf173.tar.bz2 KVIrc-b62b83e7772e9fba12fd6eadb6c1e70924ccf173.zip | |
Misc Qt6 port for slightly changed class names and method signatures
Diffstat (limited to 'src')
| -rw-r--r-- | src/kvirc/kernel/KviIpcSentinel.cpp | 4 | ||||
| -rw-r--r-- | src/kvirc/kernel/KviIpcSentinel.h | 5 | ||||
| -rw-r--r-- | src/kvirc/ui/KviIrcView.cpp | 2 | ||||
| -rw-r--r-- | src/kvirc/ui/KviIrcView_events.cpp | 5 | ||||
| -rw-r--r-- | src/kvirc/ui/KviToolBar.cpp | 1 | ||||
| -rw-r--r-- | src/modules/notifier/NotifierWindow.cpp | 4 | ||||
| -rw-r--r-- | src/modules/notifier/NotifierWindow.h | 4 | ||||
| -rw-r--r-- | src/modules/objects/KvsObject_listWidget.cpp | 2 | ||||
| -rw-r--r-- | src/modules/objects/KvsObject_multiLineEdit.cpp | 8 | ||||
| -rw-r--r-- | src/modules/objects/KvsObject_tableWidget.cpp | 2 | ||||
| -rw-r--r-- | src/modules/objects/KvsObject_treeWidgeteItem.cpp | 2 | ||||
| -rw-r--r-- | src/modules/objects/KvsObject_webView.cpp | 12 | ||||
| -rw-r--r-- | src/modules/objects/KvsObject_webView.h | 15 | ||||
| -rw-r--r-- | src/modules/objects/qthttp/qhttp.h | 4 | ||||
| -rw-r--r-- | src/modules/options/OptionsWidget_windowList.cpp | 2 | ||||
| -rw-r--r-- | src/modules/snd/libkvisnd.cpp | 10 | ||||
| -rw-r--r-- | src/modules/upnp/XmlFunctions.cpp | 4 |
17 files changed, 68 insertions, 18 deletions
diff --git a/src/kvirc/kernel/KviIpcSentinel.cpp b/src/kvirc/kernel/KviIpcSentinel.cpp index d6d793b55..4f082184c 100644 --- a/src/kvirc/kernel/KviIpcSentinel.cpp +++ b/src/kvirc/kernel/KviIpcSentinel.cpp @@ -318,7 +318,11 @@ struct fake_xcb_property_notify_event_t } #endif +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) bool KviIpcSentinel::nativeEvent(const QByteArray & id, void * msg, long * res) +#else +bool KviIpcSentinel::nativeEvent(const QByteArray & id, void * msg, qintptr * res) +#endif { #if defined(COMPILE_ON_WINDOWS) || defined(COMPILE_ON_MINGW) return winEvent((MSG *)msg, res); diff --git a/src/kvirc/kernel/KviIpcSentinel.h b/src/kvirc/kernel/KviIpcSentinel.h index 273ffa6b9..7ba7aaa33 100644 --- a/src/kvirc/kernel/KviIpcSentinel.h +++ b/src/kvirc/kernel/KviIpcSentinel.h @@ -54,8 +54,11 @@ protected: // protected members virtual bool x11Event(XEvent * e); bool x11GetRemoteMessage(); #endif //!COMPILE_X11_SUPPORT - +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) bool nativeEvent(const QByteArray & id, void * msg, long * res) override; +#else + bool nativeEvent(const QByteArray & id, void * msg, qintptr * res) override; +#endif }; #endif //!COMPILE_NO_IPC diff --git a/src/kvirc/ui/KviIrcView.cpp b/src/kvirc/ui/KviIrcView.cpp index d1a81b05b..79f04fef1 100644 --- a/src/kvirc/ui/KviIrcView.cpp +++ b/src/kvirc/ui/KviIrcView.cpp @@ -313,7 +313,7 @@ KviIrcView::KviIrcView(QWidget * parent, KviWindow * pWnd) setSizePolicy(oSizePolicy); } -static inline void delete_text_line(KviIrcViewLine * line, QHash<KviIrcViewLine *, KviAnimatedPixmap *> * animatedSmiles) +static inline void delete_text_line(KviIrcViewLine * line, QMultiHash<KviIrcViewLine *, KviAnimatedPixmap *> * animatedSmiles) { QMultiHash<KviIrcViewLine *, KviAnimatedPixmap *>::iterator it = animatedSmiles->find(line); while(it != animatedSmiles->end() && it.key() == line) diff --git a/src/kvirc/ui/KviIrcView_events.cpp b/src/kvirc/ui/KviIrcView_events.cpp index db9de0c02..d9730ac0f 100644 --- a/src/kvirc/ui/KviIrcView_events.cpp +++ b/src/kvirc/ui/KviIrcView_events.cpp @@ -299,7 +299,12 @@ void KviIrcView::mousePressEvent(QMouseEvent * e) // We actually trigger the click event after the double click interval // is elapsed without a second click. m_iMouseTimer = startTimer(QApplication::doubleClickInterval()); + +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) m_pLastEvent = new QMouseEvent(*e); +#else + m_pLastEvent = new QMouseEvent(e->type(), e->position(), e->globalPosition(), e->button(), e->buttons(), e->modifiers(), e->pointingDevice()); +#endif } } diff --git a/src/kvirc/ui/KviToolBar.cpp b/src/kvirc/ui/KviToolBar.cpp index e7f2a12dd..c201f90ed 100644 --- a/src/kvirc/ui/KviToolBar.cpp +++ b/src/kvirc/ui/KviToolBar.cpp @@ -29,6 +29,7 @@ #include "KviOptions.h" #include <array> +#include <QActionGroup> #include <QCursor> #include <QEvent> #include <QMenu> diff --git a/src/modules/notifier/NotifierWindow.cpp b/src/modules/notifier/NotifierWindow.cpp index b40d5d4a5..18a978fee 100644 --- a/src/modules/notifier/NotifierWindow.cpp +++ b/src/modules/notifier/NotifierWindow.cpp @@ -880,7 +880,11 @@ void NotifierWindow::setCursor(int iCur) } } +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) void NotifierWindow::enterEvent(QEvent *) +#else +void NotifierWindow::enterEvent(QEnterEvent *) +#endif { if(!m_pShowHideTimer) { diff --git a/src/modules/notifier/NotifierWindow.h b/src/modules/notifier/NotifierWindow.h index 20665b871..028144409 100644 --- a/src/modules/notifier/NotifierWindow.h +++ b/src/modules/notifier/NotifierWindow.h @@ -127,7 +127,11 @@ protected: void mouseReleaseEvent(QMouseEvent * e) override; void mouseMoveEvent(QMouseEvent * e) override; void leaveEvent(QEvent * e) override; +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) void enterEvent(QEvent * e) override; +#else + void enterEvent(QEnterEvent * e) override; +#endif bool eventFilter(QObject * pEdit, QEvent * e) override; void keyPressEvent(QKeyEvent * e) override; public slots: diff --git a/src/modules/objects/KvsObject_listWidget.cpp b/src/modules/objects/KvsObject_listWidget.cpp index e7a634f57..5ba1b8df6 100644 --- a/src/modules/objects/KvsObject_listWidget.cpp +++ b/src/modules/objects/KvsObject_listWidget.cpp @@ -39,7 +39,7 @@ const int item_flags[] = { Qt::ItemIsDropEnabled, Qt::ItemIsUserCheckable, Qt::ItemIsEnabled, - Qt::ItemIsTristate + Qt::ItemIsUserTristate }; const char * const itemflags_tbl[] = { diff --git a/src/modules/objects/KvsObject_multiLineEdit.cpp b/src/modules/objects/KvsObject_multiLineEdit.cpp index 19ddb0f84..9d65435f5 100644 --- a/src/modules/objects/KvsObject_multiLineEdit.cpp +++ b/src/modules/objects/KvsObject_multiLineEdit.cpp @@ -403,7 +403,11 @@ bool KvsObject_textedit::functionText(KviKvsObjectFunctionCall * c) bool KvsObject_textedit::functionHtml(KviKvsObjectFunctionCall * c) { if(widget()) +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) c->returnValue()->setString(((QTextEdit *)widget())->document()->toHtml(QByteArray("utf-8"))); +#else + c->returnValue()->setString(((QTextEdit *)widget())->document()->toHtml()); +#endif return true; } @@ -823,7 +827,11 @@ bool KvsObject_textedit::functionsaveFile(KviKvsObjectFunctionCall * c) KVSO_PARAMETERS_END(c) if (KviQString::equalCI(szFormat, "html")) +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) szData = ((QTextEdit *)widget())->document()->toHtml(QByteArray("utf-8")); +#else + szData = ((QTextEdit *)widget())->document()->toHtml(); +#endif else { if (!szFormat.isEmpty() && !KviQString::equalCI(szFormat, "text")) c->warning(__tr2qs_ctx("Unknown text document format '%Q'. Writing the document as plain text.", "objects"), &szFormat); diff --git a/src/modules/objects/KvsObject_tableWidget.cpp b/src/modules/objects/KvsObject_tableWidget.cpp index d2d7bee17..f1e15edc5 100644 --- a/src/modules/objects/KvsObject_tableWidget.cpp +++ b/src/modules/objects/KvsObject_tableWidget.cpp @@ -51,7 +51,7 @@ const int item_flags[] = { Qt::ItemIsDropEnabled, Qt::ItemIsUserCheckable, Qt::ItemIsEnabled, - Qt::ItemIsTristate + Qt::ItemIsUserTristate }; const char * const itemflags_tbl[] = { diff --git a/src/modules/objects/KvsObject_treeWidgeteItem.cpp b/src/modules/objects/KvsObject_treeWidgeteItem.cpp index ca5419f1e..a554ef67b 100644 --- a/src/modules/objects/KvsObject_treeWidgeteItem.cpp +++ b/src/modules/objects/KvsObject_treeWidgeteItem.cpp @@ -40,7 +40,7 @@ const int item_flags[] = { Qt::ItemIsDropEnabled, Qt::ItemIsUserCheckable, Qt::ItemIsEnabled, - Qt::ItemIsTristate + Qt::ItemIsUserTristate }; const char * const itemflags_tbl[] = { diff --git a/src/modules/objects/KvsObject_webView.cpp b/src/modules/objects/KvsObject_webView.cpp index d5fc79414..1dcf3781c 100644 --- a/src/modules/objects/KvsObject_webView.cpp +++ b/src/modules/objects/KvsObject_webView.cpp @@ -37,7 +37,11 @@ #include <QWebEngineProfile> #include <QWebEngineView> #include <QWebEngineSettings> +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) #include <QWebEngineDownloadItem> +#else +#include <QWebEngineDownloadRequest> +#endif #include <QNetworkRequest> #include <QNetworkReply> #include <QPixmap> @@ -48,7 +52,7 @@ #include <QToolTip> static int g_iDownloadId = 1; -KviKvsDownloadHandler::KviKvsDownloadHandler(KvsObject_webView * pParent, QString &szFilePath, QWebEngineDownloadItem * pDownload, int iId) +KviKvsDownloadHandler::KviKvsDownloadHandler(KvsObject_webView * pParent, QString &szFilePath, DOWNLOAD_CLASS_NAME * pDownload, int iId) : QObject(pParent) { m_Id = iId; @@ -401,8 +405,8 @@ bool KvsObject_webView::init(KviKvsRunTimeContext * c, KviKvsVariantList *) connect(pView, SIGNAL(loadFinished(bool)), this, SLOT(slotLoadFinished(bool))); connect(pView, SIGNAL(loadProgress(int)), this, SLOT(slotLoadProgress(int))); connect(pPage, SIGNAL(linkClicked(const QUrl &)), this, SLOT(slotLinkClicked(const QUrl &))); - connect(QWebEngineProfile::defaultProfile(), SIGNAL(downloadRequested(QWebEngineDownloadItem*)), - this, SLOT(slotDownloadRequest(QWebEngineDownloadItem*))); + connect(QWebEngineProfile::defaultProfile(), SIGNAL(downloadRequested(DOWNLOAD_CLASS_NAME*)), + this, SLOT(slotDownloadRequest(DOWNLOAD_CLASS_NAME*))); return true; } @@ -717,7 +721,7 @@ void KvsObject_webView::slotLinkClicked(const QUrl & url) callFunction(this, "linkClickedEvent", ¶ms); } -void KvsObject_webView::slotDownloadRequest(QWebEngineDownloadItem *pDownload) +void KvsObject_webView::slotDownloadRequest(DOWNLOAD_CLASS_NAME *pDownload) { QString szFilePath = ""; KviKvsVariant * filepathret = new KviKvsVariant(szFilePath); diff --git a/src/modules/objects/KvsObject_webView.h b/src/modules/objects/KvsObject_webView.h index 8bb9f9b9e..c7f733798 100644 --- a/src/modules/objects/KvsObject_webView.h +++ b/src/modules/objects/KvsObject_webView.h @@ -35,7 +35,14 @@ #include <QMouseEvent> #include <QContextMenuEvent> -class QWebEngineDownloadItem; +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) +#define DOWNLOAD_CLASS_NAME QWebEngineDownloadItem +#else +#define DOWNLOAD_CLASS_NAME QWebEngineDownloadRequest +#endif + +class DOWNLOAD_CLASS_NAME; + class KvsObject_webView; class KviKvsWebView : public QWebEngineView @@ -143,7 +150,7 @@ protected slots: void slotLoadFinished(bool); void slotLoadProgress(int); void slotLoadStarted(); - void slotDownloadRequest(QWebEngineDownloadItem *); + void slotDownloadRequest(DOWNLOAD_CLASS_NAME *); void slotLinkClicked(const QUrl &); void slotOnChange(QString); @@ -157,13 +164,13 @@ class KviKvsDownloadHandler : public QObject { Q_OBJECT public: - KviKvsDownloadHandler(KvsObject_webView * pParent, QString &szFilePath, QWebEngineDownloadItem * pDownload, int iId); + KviKvsDownloadHandler(KvsObject_webView * pParent, QString &szFilePath, DOWNLOAD_CLASS_NAME * pDownload, int iId); ~KviKvsDownloadHandler(); protected: KvsObject_webView * m_pParentScript; - QWebEngineDownloadItem * m_pDownload; + DOWNLOAD_CLASS_NAME * m_pDownload; int m_Id; protected slots: void slotDownloadProgress(qint64 bytesReceived, qint64 bytesTotal); diff --git a/src/modules/objects/qthttp/qhttp.h b/src/modules/objects/qthttp/qhttp.h index 3e622e943..3a79871a2 100644 --- a/src/modules/objects/qthttp/qhttp.h +++ b/src/modules/objects/qthttp/qhttp.h @@ -49,8 +49,6 @@ #include <qscopedpointer.h> #include <qtcpsocket.h> -QT_BEGIN_HEADER - class QTcpSocket; class QTimerEvent; class QIODevice; @@ -300,6 +298,4 @@ private: friend class QHttpPGHRequest; }; -QT_END_HEADER - #endif // QHTTP_H diff --git a/src/modules/options/OptionsWidget_windowList.cpp b/src/modules/options/OptionsWidget_windowList.cpp index 1c61be88f..a61944627 100644 --- a/src/modules/options/OptionsWidget_windowList.cpp +++ b/src/modules/options/OptionsWidget_windowList.cpp @@ -123,7 +123,7 @@ void addAlertLevels(KviOptionsWidget * widget, KviTalGroupBox * g) QString help_text = available_options_text + "<br>"; for (const auto& alert_type : alert_list) { - if (alert_type != &alert_list.back()) + if (alert_type != alert_list.back()) help_text += alert_type + ", "; else help_text += alert_type; diff --git a/src/modules/snd/libkvisnd.cpp b/src/modules/snd/libkvisnd.cpp index 4c56ab380..3ad4d5bd9 100644 --- a/src/modules/snd/libkvisnd.cpp +++ b/src/modules/snd/libkvisnd.cpp @@ -34,7 +34,11 @@ #include "KviLocale.h" #include "KviQString.h" +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) #include <QSound> +#else +#include <QSoundEffect> +#endif #ifdef COMPILE_PHONON_SUPPORT #include <phonon/mediaobject.h> @@ -347,7 +351,13 @@ bool KviSoundPlayer::playQt(const QString & szFileName) { if(isMuted()) return true; +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) QSound::play(szFileName); +#else + QSoundEffect effect; + effect.setSource(QUrl::fromLocalFile(szFileName)); + effect.play(); +#endif return true; } diff --git a/src/modules/upnp/XmlFunctions.cpp b/src/modules/upnp/XmlFunctions.cpp index 35cebb38f..12777a488 100644 --- a/src/modules/upnp/XmlFunctions.cpp +++ b/src/modules/upnp/XmlFunctions.cpp @@ -112,7 +112,11 @@ QString XmlFunctions::getNodeValue(const QDomNode & rootNode, const QString & pa QString XmlFunctions::getSource(const QDomNode & node, int indent) { QString source; +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) QTextStream textStream(&source, QIODevice::WriteOnly); +#else + QTextStream textStream(&source, QIODeviceBase::WriteOnly); +#endif node.save(textStream, indent); return source; } |
