30 #if TTK_QT_VERSION_CHECK(5,11,0)
31 # define QtFontWidth(p, t) p.horizontalAdvance(t)
33 # define QtFontWidth(p, t) p.width(t)
37 #if TTK_QT_VERSION_CHECK(5,10,0)
38 # define QtImageBytes(p) p.sizeInBytes()
40 # define QtImageBytes(p) p.byteCount()
44 #if TTK_QT_VERSION_CHECK(6,4,0)
45 # define QtItemSetTextAlignment(p, a) p->setTextAlignment(Qt::Alignment(a));
47 # define QtItemSetTextAlignment(p, a) p->setTextAlignment(a);
51 #if TTK_QT_VERSION_CHECK(5,13,0)
52 # define QtContainerSwap(p, i, j) p->swapItemsAt(i, j)
54 # define QtContainerSwap(p, i, j) p->swap(i, j)
58 #if TTK_QT_VERSION_CHECK(5,15,0)
59 # define QtNetworkErrorConnect(p, q, f, s) QObject::connect(p, SIGNAL(errorOccurred(QNetworkReply::NetworkError)), q, s(f(QNetworkReply::NetworkError)))
61 # define QtNetworkErrorConnect(p, q, f, s) QObject::connect(p, SIGNAL(error(QNetworkReply::NetworkError)), q, s(f(QNetworkReply::NetworkError)))
65 #if TTK_QT_VERSION_CHECK(5,15,0)
66 # define QtNetworkErrorVoidConnect(p, q, f, s) QObject::connect(p, SIGNAL(errorOccurred(QNetworkReply::NetworkError)), q, s(f()))
68 # define QtNetworkErrorVoidConnect(p, q, f, s) QObject::connect(p, SIGNAL(error(QNetworkReply::NetworkError)), q, s(f()))
72 #if TTK_QT_VERSION_CHECK(5,15,0)
73 # define QtSocketErrorConnect(p, q, f, s) QObject::connect(p, SIGNAL(errorOccurred(QAbstractSocket::SocketError)), q, s(f(QAbstractSocket::SocketError)))
75 # define QtSocketErrorConnect(p, q, f, s) QObject::connect(p, SIGNAL(error(QAbstractSocket::SocketError)), q, s(f(QAbstractSocket::SocketError)))
79 #if TTK_QT_VERSION_CHECK(5,15,0)
80 # define QtSocketErrorVoidConnect(p, q, f, s) QObject::connect(p, SIGNAL(errorOccurred(QAbstractSocket::SocketError)), q, s(f()))
82 # define QtSocketErrorVoidConnect(p, q, f, s) QObject::connect(p, SIGNAL(error(QAbstractSocket::SocketError)), q, s(f()))
86 #if TTK_QT_VERSION_CHECK(5,15,0)
87 # define QtProcessConnect(p, q, f, s) QObject::connect(p, SIGNAL(errorOccurred(QProcess::ProcessError)), q, s(f(QProcess::ProcessError)))
89 # define QtProcessConnect(p, q, f, s) QObject::connect(p, SIGNAL(error(QProcess::ProcessError)), q, s(f(QProcess::ProcessError)))
93 #if TTK_QT_VERSION_CHECK(5,15,0)
94 # define QtProcessVoidConnect(p, q, f, s) QObject::connect(p, SIGNAL(errorOccurred(QProcess::ProcessError)), q, s(f()))
96 # define QtProcessVoidConnect(p, q, f, s) QObject::connect(p, SIGNAL(error(QProcess::ProcessError)), q, s(f()))
100 #if TTK_QT_VERSION_CHECK(5,15,0)
101 # define QtButtonGroupConnect(p, q, f, s) QObject::connect(p, SIGNAL(idClicked(int)), q, s(f(int)))
103 # define QtButtonGroupConnect(p, q, f, s) QObject::connect(p, SIGNAL(buttonClicked(int)), q, s(f(int)))
107 #if TTK_QT_VERSION_CHECK(5,15,0)
108 # define QtButtonGroupVoidConnect(p, q, f, s) QObject::connect(p, SIGNAL(idClicked(int)), q, s(f()))
110 # define QtButtonGroupVoidConnect(p, q, f, s) QObject::connect(p, SIGNAL(buttonClicked(int)), q, s(f()))
114 #if TTK_QT_VERSION_CHECK(5,15,0)
115 # define QtNamespace(p) Qt::p
117 # define QtNamespace(p) p
121 #if TTK_QT_VERSION_CHECK(5,15,0)
122 # define QtLablePixmap(p) p->pixmap(Qt::ReturnByValue)
124 # define QtLablePixmap(p) p->pixmap() ? *p->pixmap() : QPixmap();
128 #if TTK_QT_VERSION_CHECK(5,15,0)
129 # define QtSkipEmptyParts Qt::SkipEmptyParts
131 # define QtSkipEmptyParts QString::SkipEmptyParts
135 #if TTK_QT_VERSION_CHECK(5,15,0)
136 # define QtWheelDelta(p) p->angleDelta().y()
138 # define QtWheelDelta(p) p->delta()
142 #if TTK_QT_VERSION_CHECK(6,0,0)
143 # define QtMouseX(p) p->position().x()
144 # define QtMouseY(p) p->position().y()
145 # define QtMousePos(p) p->position()
146 # define QtMouseGlobalX(p) p->globalPosition().x()
147 # define QtMouseGlobalY(p) p->globalPosition().y()
148 # define QtMouseGlobalPos(p) p->globalPosition().toPoint()
150 # define QtMouseX(p) p->x()
151 # define QtMouseY(p) p->y()
152 # define QtMousePos(p) p->pos()
153 # define QtMouseGlobalX(p) p->globalX()
154 # define QtMouseGlobalY(p) p->globalY()
155 # define QtMouseGlobalPos(p) p->globalPos()
159 #if TTK_QT_VERSION_CHECK(6,0,0)
160 # define QtEnterEvent QEnterEvent
162 # define QtEnterEvent QEvent
166 #if TTK_QT_VERSION_CHECK(6,0,0)
167 # define QtVariantType(p) p.typeId()
169 # define QtVariantType(p) p.type()
173 #if TTK_QT_VERSION_CHECK(6,0,0)
174 # define QtKeySequence(k, m) QKeySequence(QKeyCombination(m, k))
176 # define QtKeySequence(k, m) QKeySequence(k + m)
180 #if TTK_QT_VERSION_CHECK(6,0,0)
181 # define QtKeyCombine(p) p.toCombined()
183 # define QtKeyCombine(p) p
189 #if !TTK_QT_VERSION_CHECK(5,7,0)
190 template <
typename... Args>
191 struct QNonConstOverload
193 template <
typename R,
typename T>
194 Q_DECL_CONSTEXPR
auto operator()(R (
T::*ptr)(Args...))
const noexcept -> decltype(ptr)
197 template <
typename R,
typename T>
198 static Q_DECL_CONSTEXPR
auto of(R (
T::*ptr)(Args...)) noexcept -> decltype(ptr)
202 template <
typename... Args>
203 struct QConstOverload
205 template <
typename R,
typename T>
206 Q_DECL_CONSTEXPR
auto operator()(R (
T::*ptr)(Args...)
const)
const noexcept -> decltype(ptr)
209 template <
typename R,
typename T>
210 static Q_DECL_CONSTEXPR
auto of(R (
T::*ptr)(Args...)
const) noexcept -> decltype(ptr)
214 template <
typename... Args>
215 struct QOverload : QConstOverload<Args...>, QNonConstOverload<Args...>
217 using QConstOverload<Args...>::of;
218 using QConstOverload<Args...>::operator();
219 using QNonConstOverload<Args...>::of;
220 using QNonConstOverload<Args...>::operator();
222 template <
typename R>
223 Q_DECL_CONSTEXPR
auto operator()(R (*ptr)(Args...))
const noexcept -> decltype(ptr)
226 template <
typename R>
227 static Q_DECL_CONSTEXPR
auto of(R (*ptr)(Args...)) noexcept -> decltype(ptr)
239 #endif // TTKQTCOMPAT_H
The namespace of the qt compat function wrapper.