File indexing completed on 2024-04-14 15:52:15
0001 /* 0002 SPDX-FileCopyrightText: 2019-2022 Krusader Krew <https://krusader.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef _COMPAT_H_ 0008 #define _COMPAT_H_ 0009 0010 #include <kio_version.h> 0011 0012 #if __has_include(<KCompletion/kcompletion_version.h>) 0013 #include <KCompletion/kcompletion_version.h> 0014 #else // Pre KF-5.91 header layout 0015 #include <kcompletion_version.h> 0016 #endif 0017 0018 #if __has_include(<KArchive/karchive_version.h>) 0019 #include <KArchive/karchive_version.h> 0020 #else // Pre KF-5.91 header layout 0021 #include <karchive_version.h> 0022 #endif 0023 0024 /** 0025 * KActionMenu::setDelayed(bool) was made deprecated since 5.77 in 0026 * favor of KActionMenu::setPopupMode(QToolButton::ToolButtonPopupMode) 0027 * 0028 * This can be removed when the frameworks minimum version required will be >= 5.77 0029 */ 0030 #if KIO_VERSION >= QT_VERSION_CHECK(5, 77, 0) 0031 #define KACTIONMENU_SETDELAYED setPopupMode(QToolButton::InstantPopup) 0032 #else 0033 #define KACTIONMENU_SETDELAYED setDelayed(false) 0034 #endif 0035 0036 /** 0037 * KLineEdit::returnPressed has been deprecated since 5.81 0038 * in favor of KLineEdit::returnKeyPressed. 0039 * 0040 * This can be removed when the frameworks minimum version required will be >= 5.81 0041 */ 0042 #if KCOMPLETION_VERSION >= QT_VERSION_CHECK(5, 81, 0) 0043 #define KLINEEDIT_RETURNKEYPRESSED returnKeyPressed 0044 #else 0045 #define KLINEEDIT_RETURNKEYPRESSED returnPressed 0046 #endif 0047 0048 /** 0049 * KFilterDev::compressionTypeForMimeType has been deprecated since 5.85 0050 * in favor of KLineEdit::returnKeyPressed. 0051 * 0052 * This can be removed when the frameworks minimum version required will be >= 5.85 0053 */ 0054 #if KARCHIVE_VERSION >= QT_VERSION_CHECK(5, 85, 0) 0055 #define COMPRESSIONTYPEFORMIMETYPE KCompressionDevice::compressionTypeForMimeType 0056 #else 0057 #define COMPRESSIONTYPEFORMIMETYPE KFilterDev::compressionTypeForMimeType 0058 #endif 0059 0060 /** 0061 * QButtonGroup::buttonClicked(int id) was made obsoleted in QT 5.15 in 0062 * favor of QButtonGroup::idClicked(int id) 0063 * 0064 * https://doc.qt.io/qt-5.15/qbuttongroup-obsolete.html#buttonClicked-1 0065 * 0066 * This can be removed when the qt minimum version required will be >= 5.15 0067 */ 0068 #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) 0069 #define QBUTTONGROUP_BUTTONCLICKED idClicked 0070 #else 0071 #define QBUTTONGROUP_BUTTONCLICKED buttonClicked 0072 #endif 0073 0074 /** 0075 * QResource::isCompressed() was made obsoleted in QT 5.15 in 0076 * favor of QResource::Compression QResource::compressionAlgorithm() 0077 * 0078 * https://doc.qt.io/qt-5.15/qresource-obsolete.html#isCompressed 0079 * 0080 * This can be removed when the qt minimum version required will be >= 5.15 0081 */ 0082 #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) 0083 #define QRESOURCE_ISCOMPRESSED(A) ((A).compressionAlgorithm() != QResource::NoCompression) 0084 #else 0085 #define QRESOURCE_ISCOMPRESSED(A) (A).isCompressed() 0086 #endif 0087 0088 /** 0089 * QString::split(QChar sep, QString::SplitBehavior behavior, Qt::CaseSensitivity cs = Qt::CaseSensitive) 0090 * was made obsoleted in QT 5.15 in favor of the namespaced Qt::endl 0091 * 0092 * https://doc.qt.io/qt-5.15/qstring-obsolete.html#split-2 0093 * 0094 * This can be removed when the qt minimum version required will be >= 5.15 0095 */ 0096 #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) 0097 #define SKIP_EMPTY_PARTS Qt::SkipEmptyParts 0098 #else 0099 #define SKIP_EMPTY_PARTS QString::SkipEmptyParts 0100 #endif 0101 0102 /** 0103 * QTextSteam::endl() was made obsoleted in QT 5.15 in 0104 * favor of the namespaced Qt::endl 0105 * 0106 * https://doc.qt.io/qt-5.15/qtextstream-obsolete.html#endl 0107 * 0108 * This can be removed when the qt minimum version required will be >= 5.15 0109 */ 0110 #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) 0111 #define QT_ENDL Qt::endl 0112 #else 0113 #define QT_ENDL endl 0114 #endif 0115 0116 /** 0117 * QComboBox::activated(const QString &text) was made obsoleted in QT 5.15 in 0118 * favor of QComboBox::textActivated(const QString &text) 0119 * 0120 * https://doc.qt.io/qt-5.15/qcombobox-obsolete.html#activated-1 0121 * 0122 * This can be removed when the qt minimum version required will be >= 5.15 0123 */ 0124 #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) 0125 #define QCOMBOBOX_ACTIVATED textActivated 0126 #else 0127 #define QCOMBOBOX_ACTIVATED activated 0128 #endif 0129 0130 /** 0131 * QComboBox::highlighted(const QString &text) was made obsoleted in QT 5.15 in 0132 * favor of QComboBox::textHighlighted(const QString &text) 0133 * 0134 * https://doc.qt.io/qt-5.15/qcombobox-obsolete.html#highlighted-1 0135 * 0136 * This can be removed when the qt minimum version required will be >= 5.15 0137 */ 0138 #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) 0139 #define QCOMBOBOX_HIGHLIGHTED textHighlighted 0140 #else 0141 #define QCOMBOBOX_HIGHLIGHTED highlighted 0142 #endif 0143 0144 #endif