18#include <QAbstractSpinBox>
19#include <QApplication>
22#include <QStandardPaths>
24static inline bool clipLineToEdge(qreal& t0, qreal& t1, qreal p, qreal q)
40 qreal x1 = line.
x1(), x2 = line.
x2(), dx = line.
dx(), y1 = line.
y1(), y2 = line.
y2(), dy = line.
dy();
42 if ((t0 == 0 && t1 == 1 && ((x1 < left && x2 < left) ||
43 (x1 > right && x2 > right) ||
44 (y1 < top && y2 < top) ||
45 (y1 > bottom && y2 > bottom))) ||
46 !clipLineToEdge(t0, t1, -dx, x1 - left) ||
47 !clipLineToEdge(t0, t1, dx, right - x1) ||
48 !clipLineToEdge(t0, t1, -dy, y1 - top) ||
49 !clipLineToEdge(t0, t1, dy, bottom - y1)) {
54 return {line.
x1() + line.
dx() * t0,
55 line.
y1() + line.
dy() * t0,
56 line.
x1() + line.
dx() * t1,
57 line.
y1() + line.
dy() * t1};
107quint64 imageSize(
const QImage& img)
109#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
118 static const char alphanum[] =
"0123456789abcdefghijklmnopqrstuvwxyz";
119 const int alphanumLen =
sizeof(alphanum);
121 if (len > 128) len = 128;
124 for (
int i = 0; i < len; ++i)
126 s[i] = alphanum[rand() % (alphanumLen - 1)];
139 while (!existingSubpath.isRoot() && !existingSubpath.exists() && !existingSubpath.isSymbolicLink())
142 existingSubpath.setFile(existingSubpath.dir().absolutePath());
146 QString canonicalPath = existingSubpath.canonicalFilePath();
165 QString canonicalDataDirPath = closestCanonicalPath(dataDirPath);
166 QString canonicalFilePath = closestCanonicalPath(
QDir(dataDirPath).filePath(filePath));
168 if (canonicalFilePath.
startsWith(canonicalDataDirPath))
170 return canonicalFilePath;
QString applicationDirPath()
QString absolutePath() const const
QString filePath(const QString &fileName) const const
QString relativeFilePath(const QString &fileName) const const
int byteCount() const const
int sizeInBytes() const const
QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
QString findExecutable(const QString &executableName, const QStringList &paths)
QString fromUtf8(const char *str, int size)
bool isEmpty() const const
bool startsWith(const QString &s, Qt::CaseSensitivity cs) const const
QTextStream & left(QTextStream &stream)
QTextStream & right(QTextStream &stream)