31 #define TTK_QT_VERSION_CHECK(major, minor, patch) (QT_VERSION >= QT_VERSION_CHECK(major, minor, patch))
35 # define qPrintable(s) QString(s).toLocal8Bit().constData()
38 #ifndef qUtf8Printable
39 # define qUtf8Printable(s) QString(s).toUtf8().constData()
49 Q_DECL_CONSTEXPR
typename std::add_const<T>::type &
as_const(
T &t) noexcept {
return t; }
56 #if !TTK_QT_VERSION_CHECK(5,7,0) || TTK_QT_VERSION_CHECK(6,6,0)
57 # define qAsConst std::as_const
65 T v = qobject_cast<
T>(object);
72 T v = qobject_cast<
T>(object);
76 # define object_cast qobject_cast
80 # define TTKObjectCast(x, y) (object_cast<x>(y))
82 # define TTKObjectCast(x, y) ((x)(y))
85 #if defined TTK_CAST && TTK_QT_VERSION_CHECK(5,15,0)
86 # define TTKVoidCast(x) (x)(void*)
88 # define TTKVoidCast(x) (x)
92 #if !TTK_QT_VERSION_CHECK(5,0,0) && defined(Q_CC_GNU)
93 # if defined(__GXX_EXPERIMENTAL_CXX0X__) || TTK_HAS_CXX11
94 # define Q_COMPILER_DEFAULT_MEMBERS
95 # define Q_COMPILER_DELETE_MEMBERS
96 # define Q_COMPILER_NULLPTR
97 # define Q_COMPILER_EXPLICIT_OVERRIDES
98 # define Q_COMPILER_CONSTEXPR
104 #ifdef Q_COMPILER_NULLPTR
105 # define TTK_NULLPTR nullptr
107 # define TTK_NULLPTR NULL
110 #ifdef Q_COMPILER_DEFAULT_MEMBERS
111 # define TTK_DEFAULT = default
116 #ifdef Q_COMPILER_DELETE_MEMBERS
117 # define TTK_DELETE = delete
122 #ifdef Q_COMPILER_EXPLICIT_OVERRIDES
123 # define TTK_OVERRIDE override
124 # define TTK_FINAL final
126 # ifndef TTK_OVERRIDE
127 # define TTK_OVERRIDE
134 #if defined Q_CC_MSVC && _MSC_VER <= 1800
135 # define constexpr const
138 #if defined Q_COMPILER_CONSTEXPR
139 # if defined(__cpp_constexpr) && __cpp_constexpr >= 201304L
140 # define TTK_CONSTEXPR constexpr
141 # define TTK_RCONSTEXPR constexpr
143 # define TTK_CONSTEXPR constexpr
144 # define TTK_RCONSTEXPR const
147 # define TTK_CONSTEXPR const
148 # define TTK_RCONSTEXPR const
153 #define TTK_DISABLE_COPY(Class) \
155 Class(const Class &) TTK_DELETE; \
156 Class &operator=(const Class &) TTK_DELETE;
159 #define TTK_DISABLE_INIT_COPY(Class) \
160 TTK_DISABLE_COPY(Class) \
164 #define TTK_DECLARE_MODULE(Class) \
166 inline static QString className() \
173 #define TTK_DECLARE_LIST(Class) using Class##List = QList<Class>
174 #define TTK_DECLARE_FLAG(Flags, Enum) using Flags = QFlags<Enum>
176 #define TTK_SIGNAL SIGNAL
177 #define TTK_SLOT SLOT
179 #if TTK_QT_VERSION_CHECK(6,0,0)
180 # define qint qintptr
185 #define TTK_FILE_SUFFIX(fin) fin.suffix().toLower()
189 # define TTK_SIGNLE_SHOT(...) TTK_PP_OVERLOAD(__TTK_SIGNLE_SHOT__, __VA_ARGS__)(__VA_ARGS__)
191 # define TTK_SIGNLE_SHOT(...) TTK_PP_CAT(TTK_PP_OVERLOAD(__TTK_SIGNLE_SHOT__, __VA_ARGS__)(__VA_ARGS__), TTK_PP_EMPTY())
193 #define __TTK_SIGNLE_SHOT__2(a, s) QTimer::singleShot(TTK_DN_ONCE, this, s(a()));
194 #define __TTK_SIGNLE_SHOT__3(a, b, s) QTimer::singleShot(TTK_DN_ONCE, a, s(b()));
195 #define __TTK_SIGNLE_SHOT__4(a, b, c, s) QTimer::singleShot(a, b, s(c()));
206 #if !TTK_QT_VERSION_CHECK(5,10,0)
207 using qsizetype = QIntegerForSizeof<std::size_t>::Signed;
210 #endif // TTKQTGLOBAL_H
Q_DECL_CONSTEXPR std::add_const< T >::type & as_const(T &t) noexcept
#define TTKStaticCast(x, y)
QMap< qint64, QString > TTKIntStringMap
QMap< QString, QVariant > TTKVariantMap
QList< QVariant > TTKVariantList
QMap< QString, QString > TTKStringMap