summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2018-12-15 01:00:31 +0100
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2018-12-15 01:00:31 +0100
commit4b04e47be90ae809d6061403a9fb43da13d56902 (patch)
treec66b8d9d842a5213e6ba37a64d0baa669015bc20 /src
parentd9004632839a8cdb36f9bc82b7a7a3ad7d64d419 (diff)
parente9c08f8287556742fbb927653b4c2d071923e5a7 (diff)
Merge remote-tracking branch 'origin/5.12' into dev
Diffstat (limited to 'src')
-rw-r--r--src/corelib/doc/snippets/code/src_corelib_global_qglobal.cpp12
-rw-r--r--src/tools/uic/cpp/cppwriteinitialization.cpp19
-rw-r--r--src/widgets/widgets/qabstractslider.cpp9
3 files changed, 29 insertions, 11 deletions
diff --git a/src/corelib/doc/snippets/code/src_corelib_global_qglobal.cpp b/src/corelib/doc/snippets/code/src_corelib_global_qglobal.cpp
index 0248640369..03904659f5 100644
--- a/src/corelib/doc/snippets/code/src_corelib_global_qglobal.cpp
+++ b/src/corelib/doc/snippets/code/src_corelib_global_qglobal.cpp
@@ -279,21 +279,23 @@ const TInputType &myMin(const TInputType &value1, const TInputType &value2)
void myMessageOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg)
{
QByteArray localMsg = msg.toLocal8Bit();
+ const char *file = context.file ? context.file : "";
+ const char *function = context.function ? context.function : "";
switch (type) {
case QtDebugMsg:
- fprintf(stderr, "Debug: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function);
+ fprintf(stderr, "Debug: %s (%s:%u, %s)\n", localMsg.constData(), file, context.line, function);
break;
case QtInfoMsg:
- fprintf(stderr, "Info: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function);
+ fprintf(stderr, "Info: %s (%s:%u, %s)\n", localMsg.constData(), file, context.line, function);
break;
case QtWarningMsg:
- fprintf(stderr, "Warning: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function);
+ fprintf(stderr, "Warning: %s (%s:%u, %s)\n", localMsg.constData(), file, context.line, function);
break;
case QtCriticalMsg:
- fprintf(stderr, "Critical: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function);
+ fprintf(stderr, "Critical: %s (%s:%u, %s)\n", localMsg.constData(), file, context.line, function);
break;
case QtFatalMsg:
- fprintf(stderr, "Fatal: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function);
+ fprintf(stderr, "Fatal: %s (%s:%u, %s)\n", localMsg.constData(), file, context.line, function);
break;
}
}
diff --git a/src/tools/uic/cpp/cppwriteinitialization.cpp b/src/tools/uic/cpp/cppwriteinitialization.cpp
index 6313d6b2d3..9db20a5395 100644
--- a/src/tools/uic/cpp/cppwriteinitialization.cpp
+++ b/src/tools/uic/cpp/cppwriteinitialization.cpp
@@ -36,6 +36,7 @@
#include <language.h>
#include <qtextstream.h>
+#include <qversionnumber.h>
#include <qdebug.h>
#include <algorithm>
@@ -1747,6 +1748,13 @@ QString WriteInitialization::domColor2QString(const DomColor *c)
.arg(c->elementBlue());
}
+static inline QVersionNumber colorRoleVersionAdded(const QString &roleName)
+{
+ if (roleName == QLatin1String("PlaceholderText"))
+ return QVersionNumber(5, 12, 0);
+ return QVersionNumber();
+}
+
void WriteInitialization::writeColorGroup(DomColorGroup *colorGroup, const QString &group, const QString &paletteName)
{
if (!colorGroup)
@@ -1767,10 +1775,19 @@ void WriteInitialization::writeColorGroup(DomColorGroup *colorGroup, const QStri
const auto &colorRoles = colorGroup->elementColorRole();
for (const DomColorRole *colorRole : colorRoles) {
if (colorRole->hasAttributeRole()) {
+ const QString roleName = colorRole->attributeRole();
+ const QVersionNumber versionAdded = colorRoleVersionAdded(roleName);
const QString brushName = writeBrushInitialization(colorRole->elementBrush());
+ if (!versionAdded.isNull()) {
+ m_output << "#if QT_VERSION >= QT_VERSION_CHECK("
+ << versionAdded.majorVersion() << ", " << versionAdded.minorVersion()
+ << ", " << versionAdded.microVersion() << ")\n";
+ }
m_output << m_indent << paletteName << ".setBrush(" << group
- << ", " << "QPalette::" << colorRole->attributeRole()
+ << ", " << "QPalette::" << roleName
<< ", " << brushName << ");\n";
+ if (!versionAdded.isNull())
+ m_output << "#endif\n";
}
}
}
diff --git a/src/widgets/widgets/qabstractslider.cpp b/src/widgets/widgets/qabstractslider.cpp
index 99ee1eccb7..2172ebc99c 100644
--- a/src/widgets/widgets/qabstractslider.cpp
+++ b/src/widgets/widgets/qabstractslider.cpp
@@ -829,7 +829,6 @@ void QAbstractSlider::keyPressEvent(QKeyEvent *ev)
break;
#endif
- // It seems we need to use invertedAppearance for Left and right, otherwise, things look weird.
case Qt::Key_Left:
#ifdef QT_KEYPAD_NAVIGATION
// In QApplication::KeypadNavigationDirectional, we want to change the slider
@@ -848,9 +847,9 @@ void QAbstractSlider::keyPressEvent(QKeyEvent *ev)
else
#endif
if (isRightToLeft())
- action = d->invertedAppearance ? SliderSingleStepSub : SliderSingleStepAdd;
+ action = d->invertedControls ? SliderSingleStepSub : SliderSingleStepAdd;
else
- action = !d->invertedAppearance ? SliderSingleStepSub : SliderSingleStepAdd;
+ action = !d->invertedControls ? SliderSingleStepSub : SliderSingleStepAdd;
break;
case Qt::Key_Right:
#ifdef QT_KEYPAD_NAVIGATION
@@ -868,9 +867,9 @@ void QAbstractSlider::keyPressEvent(QKeyEvent *ev)
else
#endif
if (isRightToLeft())
- action = d->invertedAppearance ? SliderSingleStepAdd : SliderSingleStepSub;
+ action = d->invertedControls ? SliderSingleStepAdd : SliderSingleStepSub;
else
- action = !d->invertedAppearance ? SliderSingleStepAdd : SliderSingleStepSub;
+ action = !d->invertedControls ? SliderSingleStepAdd : SliderSingleStepSub;
break;
case Qt::Key_Up:
#ifdef QT_KEYPAD_NAVIGATION