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 QString canonicalPath = fi.canonicalFilePath();
141 QDir dataDir(dataDirPath);
143 if (dataDir.exists())
145 dataDir.setPath(dataDir.canonicalPath());
151 fi.setFile(fi.absoluteFilePath());
152 QDir ancestor(fi.absoluteFilePath());
153 while (ancestor != dataDir) {
154 if (ancestor.isRoot())
165 ancestor = newAncestor;
173 fi.setFile(canonicalPath);
174 QDir ancestor = fi.dir();
175 while (ancestor != dataDir)
QString applicationDirPath()
QString absoluteFilePath(const QString &fileName) const const
QString absolutePath() const const
QString canonicalPath() const const
bool exists() const const
bool isRoot() const const
void setPath(const QString &path)
int byteCount() const const
qsizetype 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
QTextStream & left(QTextStream &stream)
QTextStream & right(QTextStream &stream)