OpenShot Library | libopenshot  0.3.3
QtUtilities.h
Go to the documentation of this file.
1 
7 // Copyright (c) 2008-2020 OpenShot Studios, LLC
8 //
9 // SPDX-License-Identifier: LGPL-3.0-or-later
10 
11 #ifndef OPENSHOT_QT_UTILITIES_H
12 #define OPENSHOT_QT_UTILITIES_H
13 
14 #include <iostream>
15 #include <Qt>
16 #include <QTextStream>
17 
18 // Fix Qt::endl for older Qt versions
19 // From: https://bugreports.qt.io/browse/QTBUG-82680
20 #if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
21 namespace Qt {
22  using TextStreamFunction = QTextStream& (*)(QTextStream&);
23  constexpr TextStreamFunction endl = ::endl;
24 }
25 #endif
26 
27 
28 namespace openshot {
29  // Clean up buffer after QImage is deleted
30  static inline void cleanUpBuffer(void *info)
31  {
32  if (!info)
33  return;
34  // Remove buffer since QImage tells us to
35  uint8_t *qbuffer = reinterpret_cast<uint8_t *>(info);
36  delete[] qbuffer;
37  }
38 } // namespace
39 
40 #endif // OPENSHOT_QT_UTILITIES_H
openshot
This namespace is the default namespace for all code in the openshot library.
Definition: Compressor.h:28