Skip to content

Commit

Permalink
Merge 5.12 into 5.12.4
Browse files Browse the repository at this point in the history
Change-Id: I0b00afdda019c5ede5ea6b552cfc9ebbcd854037
  • Loading branch information
gladhorn committed May 27, 2019
2 parents b4f8359 + cc4c0b4 commit a275f1e
Show file tree
Hide file tree
Showing 13 changed files with 218 additions and 178 deletions.
22 changes: 8 additions & 14 deletions qmake/generators/makefile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2002,14 +2002,11 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t)
QString dep_cmd = replaceExtraCompilerVariables(tmp_dep_cmd, inpf, tmp_out, LocalShell);
dep_cmd = dep_cd_cmd + fixEnvVariables(dep_cmd);
if (FILE *proc = QT_POPEN(dep_cmd.toLatin1().constData(), QT_POPEN_READ)) {
QString indeps;
while(!feof(proc)) {
int read_in = (int)fread(buff, 1, 255, proc);
if(!read_in)
break;
indeps += QByteArray(buff, read_in);
}
QByteArray depData;
while (int read_in = feof(proc) ? 0 : (int)fread(buff, 1, 255, proc))
depData.append(buff, read_in);
QT_PCLOSE(proc);
const QString indeps = QString::fromLocal8Bit(depData);
if(!indeps.isEmpty()) {
QDir outDir(Option::output_dir);
QStringList dep_cmd_deps = splitDeps(indeps, dep_lines);
Expand Down Expand Up @@ -2090,14 +2087,11 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t)
QString dep_cmd = replaceExtraCompilerVariables(tmp_dep_cmd, inpf, out, LocalShell);
dep_cmd = dep_cd_cmd + fixEnvVariables(dep_cmd);
if (FILE *proc = QT_POPEN(dep_cmd.toLatin1().constData(), QT_POPEN_READ)) {
QString indeps;
while(!feof(proc)) {
int read_in = (int)fread(buff, 1, 255, proc);
if(!read_in)
break;
indeps += QByteArray(buff, read_in);
}
QByteArray depData;
while (int read_in = feof(proc) ? 0 : (int)fread(buff, 1, 255, proc))
depData.append(buff, read_in);
QT_PCLOSE(proc);
const QString indeps = QString::fromLocal8Bit(depData);
if(!indeps.isEmpty()) {
QDir outDir(Option::output_dir);
QStringList dep_cmd_deps = splitDeps(indeps, dep_lines);
Expand Down
151 changes: 35 additions & 116 deletions src/gui/kernel/qhighdpiscaling_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -204,86 +204,42 @@ inline QPointF toNativeLocalPosition(const QPointF &pos, const QWindow *window)
return pos * scaleFactor;
}

inline QRect fromNativePixels(const QRect &pixelRect, const QPlatformScreen *platformScreen)
template <typename C>
inline QRect fromNativePixels(const QRect &pixelRect, const C *context)
{
const qreal scaleFactor = QHighDpiScaling::factor(platformScreen);
const QPoint origin = QHighDpiScaling::origin(platformScreen);
const qreal scaleFactor = QHighDpiScaling::factor(context);
const QPoint origin = QHighDpiScaling::origin(context);
return QRect(fromNative(pixelRect.topLeft(), scaleFactor, origin),
fromNative(pixelRect.size(), scaleFactor));
}

inline QRect toNativePixels(const QRect &pointRect, const QPlatformScreen *platformScreen)
template <typename C>
inline QRect toNativePixels(const QRect &pointRect, const C *context)
{
const qreal scaleFactor = QHighDpiScaling::factor(platformScreen);
const QPoint origin = QHighDpiScaling::origin(platformScreen);
const qreal scaleFactor = QHighDpiScaling::factor(context);
const QPoint origin = QHighDpiScaling::origin(context);
return QRect(toNative(pointRect.topLeft(), scaleFactor, origin),
toNative(pointRect.size(), scaleFactor));
}

inline QRect fromNativePixels(const QRect &pixelRect, const QScreen *screen)
template <typename C>
inline QRectF toNativePixels(const QRectF &pointRect, const C *context)
{
const qreal scaleFactor = QHighDpiScaling::factor(screen);
const QPoint origin = QHighDpiScaling::origin(screen);
return QRect(fromNative(pixelRect.topLeft(), scaleFactor, origin),
fromNative(pixelRect.size(), scaleFactor));
}

inline QRect toNativePixels(const QRect &pointRect, const QScreen *screen)
{
const qreal scaleFactor = QHighDpiScaling::factor(screen);
const QPoint origin = QHighDpiScaling::origin(screen);
return QRect(toNative(pointRect.topLeft(), scaleFactor, origin),
toNative(pointRect.size(), scaleFactor));
}

inline QRect fromNativePixels(const QRect &pixelRect, const QWindow *window)
{
const qreal scaleFactor = QHighDpiScaling::factor(window);
const QPoint origin = QHighDpiScaling::origin(window);
return QRect(fromNative(pixelRect.topLeft(), scaleFactor, origin),
fromNative(pixelRect.size(), scaleFactor));
}

inline QRectF toNativePixels(const QRectF &pointRect, const QScreen *screen)
{
const qreal scaleFactor = QHighDpiScaling::factor(screen);
const QPoint origin = QHighDpiScaling::origin(screen);
const qreal scaleFactor = QHighDpiScaling::factor(context);
const QPoint origin = QHighDpiScaling::origin(context);
return QRectF(toNative(pointRect.topLeft(), scaleFactor, origin),
toNative(pointRect.size(), scaleFactor));
}

inline QRect toNativePixels(const QRect &pointRect, const QWindow *window)
{
const qreal scaleFactor = QHighDpiScaling::factor(window);
const QPoint origin = QHighDpiScaling::origin(window);
return QRect(toNative(pointRect.topLeft(), scaleFactor, origin),
toNative(pointRect.size(), scaleFactor));
toNative(pointRect.size(), scaleFactor));
}

inline QRectF fromNativePixels(const QRectF &pixelRect, const QScreen *screen)
template <typename C>
inline QRectF fromNativePixels(const QRectF &pixelRect, const C *context)
{
const qreal scaleFactor = QHighDpiScaling::factor(screen);
const QPoint origin = QHighDpiScaling::origin(screen);
const qreal scaleFactor = QHighDpiScaling::factor(context);
const QPoint origin = QHighDpiScaling::origin(context);
return QRectF(fromNative(pixelRect.topLeft(), scaleFactor, origin),
fromNative(pixelRect.size(), scaleFactor));
}

inline QRectF fromNativePixels(const QRectF &pixelRect, const QWindow *window)
{
const qreal scaleFactor = QHighDpiScaling::factor(window);
const QPoint origin = QHighDpiScaling::origin(window);
return QRectF(fromNative(pixelRect.topLeft(), scaleFactor, origin),
fromNative(pixelRect.size(), scaleFactor));
}

inline QRectF toNativePixels(const QRectF &pointRect, const QWindow *window)
{
const qreal scaleFactor = QHighDpiScaling::factor(window);
const QPoint origin = QHighDpiScaling::origin(window);
return QRectF(toNative(pointRect.topLeft(), scaleFactor, origin),
toNative(pointRect.size(), scaleFactor));
}

inline QSize fromNativePixels(const QSize &pixelSize, const QWindow *window)
{
return pixelSize / QHighDpiScaling::factor(window);
Expand All @@ -304,44 +260,28 @@ inline QSizeF toNativePixels(const QSizeF &pointSize, const QWindow *window)
return pointSize * QHighDpiScaling::factor(window);
}

inline QPoint fromNativePixels(const QPoint &pixelPoint, const QScreen *screen)
{
return fromNative(pixelPoint, QHighDpiScaling::factor(screen), QHighDpiScaling::origin(screen));
}

inline QPoint fromNativePixels(const QPoint &pixelPoint, const QWindow *window)
{
return fromNative(pixelPoint, QHighDpiScaling::factor(window), QHighDpiScaling::origin(window));
}

inline QPoint toNativePixels(const QPoint &pointPoint, const QScreen *screen)
template <typename C>
inline QPoint fromNativePixels(const QPoint &pixelPoint, const C *context)
{
return toNative(pointPoint, QHighDpiScaling::factor(screen), QHighDpiScaling::origin(screen));
return fromNative(pixelPoint, QHighDpiScaling::factor(context), QHighDpiScaling::origin(context));
}

inline QPoint toNativePixels(const QPoint &pointPoint, const QWindow *window)
template <typename C>
inline QPoint toNativePixels(const QPoint &pointPoint, const C *context)
{
return toNative(pointPoint, QHighDpiScaling::factor(window), QHighDpiScaling::origin(window));
return toNative(pointPoint, QHighDpiScaling::factor(context), QHighDpiScaling::origin(context));
}

inline QPointF fromNativePixels(const QPointF &pixelPoint, const QScreen *screen)
template <typename C>
inline QPointF fromNativePixels(const QPointF &pixelPoint, const C *context)
{
return fromNative(pixelPoint, QHighDpiScaling::factor(screen), QHighDpiScaling::origin(screen));
return fromNative(pixelPoint, QHighDpiScaling::factor(context), QHighDpiScaling::origin(context));
}

inline QPointF fromNativePixels(const QPointF &pixelPoint, const QWindow *window)
template <typename C>
inline QPointF toNativePixels(const QPointF &pointPoint, const C *context)
{
return fromNative(pixelPoint, QHighDpiScaling::factor(window), QHighDpiScaling::origin(window));
}

inline QPointF toNativePixels(const QPointF &pointPoint, const QScreen *screen)
{
return toNative(pointPoint, QHighDpiScaling::factor(screen), QHighDpiScaling::origin(screen));
}

inline QPointF toNativePixels(const QPointF &pointPoint, const QWindow *window)
{
return toNative(pointPoint, QHighDpiScaling::factor(window), QHighDpiScaling::origin(window));
return toNative(pointPoint, QHighDpiScaling::factor(context), QHighDpiScaling::origin(context));
}

inline QMargins fromNativePixels(const QMargins &pixelMargins, const QWindow *window)
Expand Down Expand Up @@ -406,47 +346,26 @@ inline QRegion toNativeLocalRegion(const QRegion &pointRegion, const QWindow *wi
}

// Any T that has operator/()
template <typename T>
T fromNativePixels(const T &pixelValue, const QWindow *window)
{
if (!QHighDpiScaling::isActive())
return pixelValue;

return pixelValue / QHighDpiScaling::factor(window);

}

//##### ?????
template <typename T>
T fromNativePixels(const T &pixelValue, const QScreen *screen)
template <typename T, typename C>
T fromNativePixels(const T &pixelValue, const C *context)
{
if (!QHighDpiScaling::isActive())
return pixelValue;

return pixelValue / QHighDpiScaling::factor(screen);
return pixelValue / QHighDpiScaling::factor(context);

}

// Any T that has operator*()
template <typename T>
T toNativePixels(const T &pointValue, const QWindow *window)
template <typename T, typename C>
T toNativePixels(const T &pointValue, const C *context)
{
if (!QHighDpiScaling::isActive())
return pointValue;

return pointValue * QHighDpiScaling::factor(window);
return pointValue * QHighDpiScaling::factor(context);
}

template <typename T>
T toNativePixels(const T &pointValue, const QScreen *screen)
{
if (!QHighDpiScaling::isActive())
return pointValue;

return pointValue * QHighDpiScaling::factor(screen);
}


// Any QVector<T> where T has operator/()
template <typename T>
QVector<T> fromNativePixels(const QVector<T> &pixelValues, const QWindow *window)
Expand Down
5 changes: 5 additions & 0 deletions src/gui/kernel/qpalette.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1006,6 +1006,8 @@ QDataStream &operator<<(QDataStream &s, const QPalette &p)
max = QPalette::HighlightedText + 1;
else if (s.version() <= QDataStream::Qt_4_3)
max = QPalette::AlternateBase + 1;
else if (s.version() <= QDataStream::Qt_5_11)
max = QPalette::ToolTipText + 1;
for (int r = 0; r < max; r++)
s << p.d->br[grp][r];
}
Expand Down Expand Up @@ -1046,6 +1048,9 @@ QDataStream &operator>>(QDataStream &s, QPalette &p)
} else if (s.version() <= QDataStream::Qt_4_3) {
p = QPalette();
max = QPalette::AlternateBase + 1;
} else if (s.version() <= QDataStream::Qt_5_11) {
p = QPalette();
max = QPalette::ToolTipText + 1;
}

QBrush tmp;
Expand Down
Loading

0 comments on commit a275f1e

Please sign in to comment.