Merge "Merge remote-tracking branch 'origin/5.8' into dev" into refs/staging/dev
This commit is contained in:
commit
e9f0766d12
@ -1,3 +1,4 @@
|
||||
CONFIG += precompile_header
|
||||
PRECOMPILED_DIR = .pch
|
||||
PRECOMPILED_HEADER = header.h
|
||||
SOURCES = source.cpp
|
||||
|
@ -612,7 +612,7 @@ MakefileGenerator::init()
|
||||
int x;
|
||||
|
||||
//build up a list of compilers
|
||||
QList<Compiler> compilers;
|
||||
QVector<Compiler> compilers;
|
||||
{
|
||||
const char *builtins[] = { "OBJECTS", "SOURCES", "PRECOMPILED_HEADER", 0 };
|
||||
for(x = 0; builtins[x]; ++x) {
|
||||
|
@ -155,6 +155,8 @@ protected:
|
||||
};
|
||||
uint flags, type;
|
||||
};
|
||||
friend class QTypeInfo<Compiler>;
|
||||
|
||||
void initCompiler(const Compiler &comp);
|
||||
enum VPATHFlag {
|
||||
VPATH_NoFlag = 0x00,
|
||||
@ -264,6 +266,7 @@ public:
|
||||
bool isWindowsShell() const { return Option::dir_sep == QLatin1String("\\"); }
|
||||
QString shellQuote(const QString &str);
|
||||
};
|
||||
Q_DECLARE_TYPEINFO(MakefileGenerator::Compiler, Q_MOVABLE_TYPE);
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS(MakefileGenerator::FileFixifyTypes)
|
||||
|
||||
inline void MakefileGenerator::setNoIO(bool o)
|
||||
|
@ -41,10 +41,10 @@ struct SourceDependChildren;
|
||||
class SourceFiles;
|
||||
|
||||
class QMakeLocalFileName {
|
||||
uint is_null : 1;
|
||||
bool is_null;
|
||||
mutable QString real_name, local_name;
|
||||
public:
|
||||
QMakeLocalFileName() : is_null(1) { }
|
||||
QMakeLocalFileName() : is_null(true) {}
|
||||
QMakeLocalFileName(const QString &);
|
||||
bool isNull() const { return is_null; }
|
||||
inline const QString &real() const { return real_name; }
|
||||
|
@ -860,7 +860,6 @@ class VCConfiguration
|
||||
public:
|
||||
// Functions
|
||||
VCConfiguration();
|
||||
~VCConfiguration(){}
|
||||
|
||||
bool suppressUnknownOptionWarnings;
|
||||
DotNET CompilerVersion;
|
||||
@ -936,7 +935,6 @@ class VCFilter
|
||||
public:
|
||||
// Functions
|
||||
VCFilter();
|
||||
~VCFilter(){}
|
||||
|
||||
void addFile(const QString& filename);
|
||||
void addFile(const VCFilterFile& fileInfo);
|
||||
@ -962,7 +960,7 @@ public:
|
||||
VCCLCompilerTool CompilerTool;
|
||||
};
|
||||
|
||||
typedef QList<VCFilter> VCFilterList;
|
||||
typedef QVector<VCFilter> VCFilterList;
|
||||
class VCProjectSingleConfig
|
||||
{
|
||||
public:
|
||||
@ -976,9 +974,6 @@ public:
|
||||
Resources,
|
||||
Extras
|
||||
};
|
||||
// Functions
|
||||
VCProjectSingleConfig(){}
|
||||
~VCProjectSingleConfig(){}
|
||||
|
||||
// Variables
|
||||
QString Name;
|
||||
@ -1009,6 +1004,7 @@ public:
|
||||
const VCFilter &filterByName(const QString &name) const;
|
||||
const VCFilter &filterForExtraCompiler(const QString &compilerName) const;
|
||||
};
|
||||
Q_DECLARE_TYPEINFO(VCProjectSingleConfig, Q_MOVABLE_TYPE);
|
||||
|
||||
// Tree & Flat view of files --------------------------------------------------
|
||||
class VCFilter;
|
||||
|
@ -321,7 +321,7 @@ QMakeEvaluator::quoteValue(const ProString &val)
|
||||
break;
|
||||
case 32:
|
||||
quote = true;
|
||||
// fallthrough
|
||||
Q_FALLTHROUGH();
|
||||
default:
|
||||
ret += c;
|
||||
break;
|
||||
|
@ -318,7 +318,7 @@ ProStringList QMakeEvaluator::split_value_list(const QStringRef &vals, const Pro
|
||||
--x;
|
||||
}
|
||||
}
|
||||
// fallthrough
|
||||
Q_FALLTHROUGH();
|
||||
default:
|
||||
hadWord = true;
|
||||
break;
|
||||
@ -1643,7 +1643,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::expandVariableReferences(
|
||||
tokPtr++;
|
||||
continue;
|
||||
}
|
||||
// fallthrough
|
||||
Q_FALLTHROUGH();
|
||||
default:
|
||||
Q_ASSERT_X(false, "expandVariableReferences", "Unrecognized token");
|
||||
break;
|
||||
@ -2109,7 +2109,7 @@ QString QMakeEvaluator::formatValue(const ProString &val, bool forceQuote)
|
||||
break;
|
||||
case 32:
|
||||
quote = true;
|
||||
// fallthrough
|
||||
Q_FALLTHROUGH();
|
||||
default:
|
||||
ret += c;
|
||||
break;
|
||||
|
@ -44,8 +44,8 @@
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists for the convenience
|
||||
// of QIODevice. This header file may change from version to
|
||||
// This file is not part of the Qt API. It exists purely as an
|
||||
// implementation detail. This header file may change from version to
|
||||
// version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
|
@ -44,8 +44,8 @@
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists for the convenience
|
||||
// of QIODevice. This header file may change from version to
|
||||
// This file is not part of the Qt API. It exists purely as an
|
||||
// implementation detail. This header file may change from version to
|
||||
// version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
|
@ -44,8 +44,8 @@
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists for the convenience
|
||||
// of QIODevice. This header file may change from version to
|
||||
// This file is not part of the Qt API. It exists purely as an
|
||||
// implementation detail. This header file may change from version to
|
||||
// version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
|
@ -44,8 +44,8 @@
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists for the convenience
|
||||
// of QIODevice. This header file may change from version to
|
||||
// This file is not part of the Qt API. It exists purely as an
|
||||
// implementation detail. This header file may change from version to
|
||||
// version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
|
@ -44,8 +44,8 @@
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists for the convenience
|
||||
// of QIODevice. This header file may change from version to
|
||||
// This file is not part of the Qt API. It exists purely as an
|
||||
// implementation detail. This header file may change from version to
|
||||
// version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
|
@ -411,7 +411,7 @@ QByteArray QIconvCodec::convertFromUnicode(const QChar *uc, int len, ConverterSt
|
||||
switch (errno) {
|
||||
case EILSEQ:
|
||||
++invalidCount;
|
||||
// fall through
|
||||
Q_FALLTHROUGH();
|
||||
case EINVAL:
|
||||
{
|
||||
inBytes += sizeof(QChar);
|
||||
|
@ -44,9 +44,9 @@
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists for the convenience
|
||||
// of the QLibrary class. This header file may change from
|
||||
// version to version without notice, or even be removed.
|
||||
// This file is not part of the Qt API. It exists purely as an
|
||||
// implementation detail. This header file may change from version to
|
||||
// version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
|
@ -288,7 +288,7 @@ QString QJisCodec::convertToUnicode(const char* chars, int len, ConverterState *
|
||||
result += QLatin1Char(ch);
|
||||
break;
|
||||
}
|
||||
/* fall through */
|
||||
Q_FALLTHROUGH();
|
||||
case JISX0201_Latin:
|
||||
u = conv->jisx0201ToUnicode(ch);
|
||||
result += QValidChar(u);
|
||||
|
@ -1341,6 +1341,18 @@
|
||||
Q_ASSUME_IMPL(valueOfExpression);\
|
||||
} while (0)
|
||||
|
||||
#if QT_HAS_CPP_ATTRIBUTE(fallthrough)
|
||||
# define Q_FALLTHROUGH() [[fallthrough]]
|
||||
#elif defined(__cplusplus)
|
||||
/* Clang can not parse namespaced attributes in C mode, but defines __has_cpp_attribute */
|
||||
# if QT_HAS_CPP_ATTRIBUTE(clang::fallthrough)
|
||||
# define Q_FALLTHROUGH() [[clang::fallthrough]]
|
||||
# endif
|
||||
#endif
|
||||
#ifndef Q_FALLTHROUGH
|
||||
# define Q_FALLTHROUGH() (void)0
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
Sanitize compiler feature availability
|
||||
|
@ -2956,6 +2956,20 @@ QString QSysInfo::machineHostName()
|
||||
\sa Q_ASSERT(), Q_ASSUME(), qFatal()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\macro void Q_FALLTHROUGH()
|
||||
\relates <QtGlobal>
|
||||
\since 5.8
|
||||
|
||||
Can be used in switch statements at the end of case block to tell the compiler
|
||||
and other developers that that the lack of a break statement is intentional.
|
||||
|
||||
This is useful since a missing break statement is often a bug, and some
|
||||
compilers can be configured to emit warnings when one is not found.
|
||||
|
||||
\sa Q_UNREACHABLE()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\macro void Q_CHECK_PTR(void *pointer)
|
||||
\relates <QtGlobal>
|
||||
|
@ -349,7 +349,7 @@ static QString readSymLink(const QFileSystemEntry &link)
|
||||
if (matchVolName.indexIn(result) == 0) {
|
||||
DWORD len;
|
||||
wchar_t buffer[MAX_PATH];
|
||||
QString volumeName = result.mid(0, matchVolName.matchedLength()).prepend(QLatin1String("\\\\?\\"));
|
||||
const QString volumeName = QLatin1String("\\\\?\\") + result.leftRef(matchVolName.matchedLength());
|
||||
if (GetVolumePathNamesForVolumeName(reinterpret_cast<LPCWSTR>(volumeName.utf16()), buffer, MAX_PATH, &len) != 0)
|
||||
result.replace(0,matchVolName.matchedLength(), QString::fromWCharArray(buffer));
|
||||
}
|
||||
|
@ -44,9 +44,9 @@
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists for the convenience
|
||||
// of the QLibrary class. This header file may change from
|
||||
// version to version without notice, or even be removed.
|
||||
// This file is not part of the Qt API. It exists purely as an
|
||||
// implementation detail. This header file may change from version to
|
||||
// version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
|
@ -44,9 +44,9 @@
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists for the convenience
|
||||
// of the QLibrary class. This header file may change from
|
||||
// version to version without notice, or even be removed.
|
||||
// This file is not part of the Qt API. It exists purely as an
|
||||
// implementation detail. This header file may change from version to
|
||||
// version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
|
@ -44,9 +44,9 @@
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists for the convenience
|
||||
// of the QLibrary class. This header file may change from
|
||||
// version to version without notice, or even be removed.
|
||||
// This file is not part of the Qt API. It exists purely as an
|
||||
// implementation detail. This header file may change from version to
|
||||
// version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
|
@ -44,9 +44,9 @@
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists for the convenience
|
||||
// of the QLibrary class. This header file may change from
|
||||
// version to version without notice, or even be removed.
|
||||
// This file is not part of the Qt API. It exists purely as an
|
||||
// implementation detail. This header file may change from version to
|
||||
// version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
|
@ -44,9 +44,9 @@
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists for the convenience
|
||||
// of the QLibrary class. This header file may change from
|
||||
// version to version without notice, or even be removed.
|
||||
// This file is not part of the Qt API. It exists purely as an
|
||||
// implementation detail. This header file may change from version to
|
||||
// version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
|
@ -44,9 +44,9 @@
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists for the convenience
|
||||
// of the QLibrary class. This header file may change from
|
||||
// version to version without notice, or even be removed.
|
||||
// This file is not part of the Qt API. It exists purely as an
|
||||
// implementation detail. This header file may change from version to
|
||||
// version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
|
@ -44,9 +44,9 @@
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists for the convenience of
|
||||
// qurl*.cpp This header file may change from version to version without
|
||||
// notice, or even be removed.
|
||||
// This file is not part of the Qt API. It exists purely as an
|
||||
// implementation detail. This header file may change from version to
|
||||
// version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
|
@ -813,7 +813,7 @@ StNormal:
|
||||
++i;
|
||||
goto StSkipSpaces;
|
||||
}
|
||||
// fallthrough
|
||||
Q_FALLTHROUGH();
|
||||
default: {
|
||||
int j = i + 1;
|
||||
while (j < to) {
|
||||
|
@ -742,7 +742,7 @@ void QWinSettingsPrivate::set(const QString &uKey, const QVariant &value)
|
||||
}
|
||||
|
||||
case QVariant::ByteArray:
|
||||
// fallthrough intended
|
||||
Q_FALLTHROUGH();
|
||||
|
||||
default: {
|
||||
// If the string does not contain '\0', we can use REG_SZ, the native registry
|
||||
|
@ -339,7 +339,7 @@ bool Value::isValid(const Base *b) const
|
||||
case QJsonValue::Double:
|
||||
if (latinOrIntValue)
|
||||
break;
|
||||
// fall through
|
||||
Q_FALLTHROUGH();
|
||||
case QJsonValue::String:
|
||||
case QJsonValue::Array:
|
||||
case QJsonValue::Object:
|
||||
@ -418,7 +418,7 @@ uint Value::valueToStore(const QJsonValue &v, uint offset)
|
||||
if (c != INT_MAX)
|
||||
return c;
|
||||
}
|
||||
// fall through
|
||||
Q_FALLTHROUGH();
|
||||
case QJsonValue::String:
|
||||
case QJsonValue::Array:
|
||||
case QJsonValue::Object:
|
||||
|
@ -44,9 +44,9 @@
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists for the convenience
|
||||
// of the QLibrary class. This header file may change from
|
||||
// version to version without notice, or even be removed.
|
||||
// This file is not part of the Qt API. It exists purely as an
|
||||
// implementation detail. This header file may change from version to
|
||||
// version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
|
@ -1622,16 +1622,9 @@ namespace QtPrivate {
|
||||
{ return -1; }
|
||||
};
|
||||
|
||||
#ifndef Q_COMPILER_VARIADIC_TEMPLATES
|
||||
// Function pointers don't derive from QObject
|
||||
template <class Result> struct IsPointerToTypeDerivedFromQObject<Result(*)()> { enum { Value = false }; };
|
||||
template <class Result, class Arg0> struct IsPointerToTypeDerivedFromQObject<Result(*)(Arg0)> { enum { Value = false }; };
|
||||
template <class Result, class Arg0, class Arg1> struct IsPointerToTypeDerivedFromQObject<Result(*)(Arg0, Arg1)> { enum { Value = false }; };
|
||||
template <class Result, class Arg0, class Arg1, class Arg2> struct IsPointerToTypeDerivedFromQObject<Result(*)(Arg0, Arg1, Arg2)> { enum { Value = false }; };
|
||||
#else
|
||||
template <typename Result, typename... Args>
|
||||
struct IsPointerToTypeDerivedFromQObject<Result(*)(Args...)> { enum { Value = false }; };
|
||||
#endif
|
||||
|
||||
template<typename T>
|
||||
struct QMetaTypeTypeFlags
|
||||
|
@ -122,7 +122,7 @@ QVariant QMimeDataPrivate::retrieveTypedData(const QString &format, QVariant::Ty
|
||||
const QList<QVariant> list = data.toList();
|
||||
for (int i = 0; i < list.size(); ++i) {
|
||||
if (list.at(i).type() == QVariant::Url) {
|
||||
text.append(list.at(i).toUrl().toDisplayString() + QLatin1Char('\n'));
|
||||
text += list.at(i).toUrl().toDisplayString() + QLatin1Char('\n');
|
||||
++numUrls;
|
||||
}
|
||||
}
|
||||
@ -167,7 +167,7 @@ QVariant QMimeDataPrivate::retrieveTypedData(const QString &format, QVariant::Ty
|
||||
case QVariant::List: {
|
||||
if (format != QLatin1String("text/uri-list"))
|
||||
break;
|
||||
// fall through
|
||||
Q_FALLTHROUGH();
|
||||
}
|
||||
case QVariant::Url: {
|
||||
QByteArray ba = data.toByteArray();
|
||||
|
@ -149,12 +149,13 @@ QString QSystemError::toString() const
|
||||
return windowsErrorString(errorCode);
|
||||
#else
|
||||
//unix: fall through as native and standard library are the same
|
||||
Q_FALLTHROUGH();
|
||||
#endif
|
||||
case StandardLibraryError:
|
||||
return standardLibraryErrorString(errorCode);
|
||||
default:
|
||||
qWarning("invalid error scope");
|
||||
//fall through
|
||||
Q_FALLTHROUGH();
|
||||
case NoError:
|
||||
return QLatin1String("No error");
|
||||
}
|
||||
|
@ -468,7 +468,6 @@ void QTimerInfoList::registerTimer(int timerId, int interval, Qt::TimerType time
|
||||
// above 20 s, 5% inaccuracy is above 1 s, so we convert to VeryCoarseTimer
|
||||
if (interval >= 20000) {
|
||||
t->timerType = Qt::VeryCoarseTimer;
|
||||
// fall through
|
||||
} else {
|
||||
t->timeout = expected;
|
||||
if (interval <= 20) {
|
||||
@ -479,7 +478,7 @@ void QTimerInfoList::registerTimer(int timerId, int interval, Qt::TimerType time
|
||||
}
|
||||
break;
|
||||
}
|
||||
// fall through
|
||||
Q_FALLTHROUGH();
|
||||
case Qt::VeryCoarseTimer:
|
||||
// the very coarse timer is based on full second precision,
|
||||
// so we keep the interval in seconds (round to closest second)
|
||||
|
@ -489,8 +489,7 @@ bool QTranslator::load(const QString & filename, const QString & directory,
|
||||
const QString suffixOrDotQM = suffix.isNull() ? dotQmLiteral() : suffix;
|
||||
QStringRef fname(&filename);
|
||||
QString realname;
|
||||
QString delims;
|
||||
delims = search_delimiters.isNull() ? QStringLiteral("_.") : search_delimiters;
|
||||
const QString delims = search_delimiters.isNull() ? QStringLiteral("_.") : search_delimiters;
|
||||
|
||||
for (;;) {
|
||||
QFileInfo fi;
|
||||
|
@ -203,7 +203,7 @@ static qlonglong qConvertToNumber(const QVariant::Private *d, bool *ok)
|
||||
case QMetaType::QJsonValue:
|
||||
if (!v_cast<QJsonValue>(d)->isDouble())
|
||||
break;
|
||||
// no break
|
||||
Q_FALLTHROUGH();
|
||||
#endif
|
||||
case QVariant::Double:
|
||||
case QVariant::Int:
|
||||
@ -278,7 +278,7 @@ static qulonglong qConvertToUnsignedNumber(const QVariant::Private *d, bool *ok)
|
||||
case QMetaType::QJsonValue:
|
||||
if (!v_cast<QJsonValue>(d)->isDouble())
|
||||
break;
|
||||
// no break
|
||||
Q_FALLTHROUGH();
|
||||
#endif
|
||||
case QVariant::Double:
|
||||
case QVariant::Int:
|
||||
@ -3119,7 +3119,7 @@ bool QVariant::canConvert(int targetTypeId) const
|
||||
case QVariant::Int:
|
||||
if (currentType == QVariant::KeySequence)
|
||||
return true;
|
||||
// fall through
|
||||
Q_FALLTHROUGH();
|
||||
case QVariant::UInt:
|
||||
case QVariant::LongLong:
|
||||
case QVariant::ULongLong:
|
||||
|
@ -217,22 +217,24 @@ bool QMimeBinaryProvider::isValid()
|
||||
bool QMimeBinaryProvider::CacheFileList::checkCacheChanged()
|
||||
{
|
||||
bool somethingChanged = false;
|
||||
QMutableListIterator<CacheFile *> it(*this);
|
||||
while (it.hasNext()) {
|
||||
CacheFile *cacheFile = it.next();
|
||||
for (CacheFile *cacheFile : qAsConst(*this)) {
|
||||
QFileInfo fileInfo(cacheFile->file);
|
||||
if (!fileInfo.exists()) { // This can't happen by just running update-mime-database. But the user could use rm -rf :-)
|
||||
delete cacheFile;
|
||||
it.remove();
|
||||
somethingChanged = true;
|
||||
} else if (fileInfo.lastModified() > cacheFile->m_mtime) {
|
||||
if (!cacheFile->reload()) {
|
||||
delete cacheFile;
|
||||
it.remove();
|
||||
}
|
||||
if (!fileInfo.exists() || fileInfo.lastModified() > cacheFile->m_mtime) {
|
||||
// Deletion can't happen by just running update-mime-database.
|
||||
// But the user could use rm -rf :-)
|
||||
cacheFile->reload(); // will mark itself as invalid on failure
|
||||
somethingChanged = true;
|
||||
}
|
||||
}
|
||||
if (somethingChanged) {
|
||||
auto deleteIfNoLongerValid = [](CacheFile *cacheFile) -> bool {
|
||||
const bool invalid = !cacheFile->isValid();
|
||||
if (invalid)
|
||||
delete cacheFile;
|
||||
return invalid;
|
||||
};
|
||||
erase(std::remove_if(begin(), end(), deleteIfNoLongerValid), end());
|
||||
}
|
||||
return somethingChanged;
|
||||
}
|
||||
|
||||
|
@ -91,8 +91,6 @@ public:
|
||||
QObject *instance(int index) const;
|
||||
};
|
||||
|
||||
#ifdef Q_COMPILER_VARIADIC_TEMPLATES
|
||||
|
||||
template <class PluginInterface, class FactoryInterface, typename ...Args>
|
||||
PluginInterface *qLoadPlugin(const QFactoryLoader *loader, const QString &key, Args &&...args)
|
||||
{
|
||||
@ -106,68 +104,6 @@ PluginInterface *qLoadPlugin(const QFactoryLoader *loader, const QString &key, A
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
template <class PluginInterface, class FactoryInterface>
|
||||
PluginInterface *qLoadPlugin(const QFactoryLoader *loader, const QString &key)
|
||||
{
|
||||
const int index = loader->indexOf(key);
|
||||
if (index != -1) {
|
||||
QObject *factoryObject = loader->instance(index);
|
||||
if (FactoryInterface *factory = qobject_cast<FactoryInterface *>(factoryObject))
|
||||
if (PluginInterface *result = factory->create(key))
|
||||
return result;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
template <class PluginInterface, class FactoryInterface, class P1>
|
||||
PluginInterface *qLoadPlugin(const QFactoryLoader *loader,
|
||||
const QString &key,
|
||||
P1 &&p1)
|
||||
{
|
||||
const int index = loader->indexOf(key);
|
||||
if (index != -1) {
|
||||
QObject *factoryObject = loader->instance(index);
|
||||
if (FactoryInterface *factory = qobject_cast<FactoryInterface *>(factoryObject))
|
||||
if (PluginInterface *result = factory->create(key, std::forward<P1>(p1)))
|
||||
return result;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
template <class PluginInterface, class FactoryInterface, class P1, class P2>
|
||||
PluginInterface *qLoadPlugin(const QFactoryLoader *loader,
|
||||
const QString &key,
|
||||
P1 &&p1, P2 &&p2)
|
||||
{
|
||||
const int index = loader->indexOf(key);
|
||||
if (index != -1) {
|
||||
QObject *factoryObject = loader->instance(index);
|
||||
if (FactoryInterface *factory = qobject_cast<FactoryInterface *>(factoryObject))
|
||||
if (PluginInterface *result = factory->create(key, std::forward<P1>(p1), std::forward<P2>(p2)))
|
||||
return result;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
template <class PluginInterface, class FactoryInterface, class P1, class P2, class P3>
|
||||
PluginInterface *qLoadPlugin(const QFactoryLoader *loader,
|
||||
const QString &key,
|
||||
P1 &&p1, P2 &&p2, P3 &&p3)
|
||||
{
|
||||
const int index = loader->indexOf(key);
|
||||
if (index != -1) {
|
||||
QObject *factoryObject = loader->instance(index);
|
||||
if (FactoryInterface *factory = qobject_cast<FactoryInterface *>(factoryObject))
|
||||
if (PluginInterface *result = factory->create(key, std::forward<P1>(p1), std::forward<P2>(p2), std::forward<P3>(p3)))
|
||||
return result;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
template <class PluginInterface, class FactoryInterface, typename Arg>
|
||||
Q_DECL_DEPRECATED PluginInterface *qLoadPlugin1(const QFactoryLoader *loader, const QString &key, Arg &&arg)
|
||||
{ return qLoadPlugin<PluginInterface, FactoryInterface>(loader, key, std::forward<Arg>(arg)); }
|
||||
|
@ -44,8 +44,8 @@
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists for the convenience
|
||||
// of QSettings. This header file may change from version to
|
||||
// This file is not part of the Qt API. It exists purely as an
|
||||
// implementation detail. This header file may change from version to
|
||||
// version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
|
@ -2656,7 +2656,7 @@ static void setTimeSpec(QDateTimeData &d, Qt::TimeSpec spec, int offsetSeconds)
|
||||
case Qt::TimeZone:
|
||||
// Use system time zone instead
|
||||
spec = Qt::LocalTime;
|
||||
// fallthrough
|
||||
Q_FALLTHROUGH();
|
||||
case Qt::UTC:
|
||||
case Qt::LocalTime:
|
||||
offsetSeconds = 0;
|
||||
|
@ -602,7 +602,7 @@ int QDateTimeParser::sectionMaxSize(Section s, int count) const
|
||||
return 2;
|
||||
#else
|
||||
mcount = 7;
|
||||
// fall through
|
||||
Q_FALLTHROUGH();
|
||||
#endif
|
||||
case MonthSection:
|
||||
#ifdef QT_NO_TEXTDATE
|
||||
@ -770,7 +770,8 @@ int QDateTimeParser::parseSection(const QDateTime ¤tValue, int sectionInde
|
||||
state = Intermediate;
|
||||
}
|
||||
break;
|
||||
} // else: fall through
|
||||
}
|
||||
Q_FALLTHROUGH();
|
||||
case DaySection:
|
||||
case YearSection:
|
||||
case YearSection2Digits:
|
||||
@ -1155,7 +1156,7 @@ end:
|
||||
done = true;
|
||||
break;
|
||||
}
|
||||
// fallthrough
|
||||
Q_FALLTHROUGH();
|
||||
default: {
|
||||
int toMin;
|
||||
int toMax;
|
||||
@ -1489,7 +1490,7 @@ QDateTimeParser::FieldInfo QDateTimeParser::fieldInfo(int index) const
|
||||
switch (sn.type) {
|
||||
case MSecSection:
|
||||
ret |= Fraction;
|
||||
// fallthrough
|
||||
Q_FALLTHROUGH();
|
||||
case SecondSection:
|
||||
case MinuteSection:
|
||||
case Hour24Section:
|
||||
@ -1509,7 +1510,7 @@ QDateTimeParser::FieldInfo QDateTimeParser::fieldInfo(int index) const
|
||||
switch (sn.count) {
|
||||
case 2:
|
||||
ret |= FixedWidth;
|
||||
// fallthrough
|
||||
Q_FALLTHROUGH();
|
||||
case 1:
|
||||
ret |= (Numeric|AllowPartial);
|
||||
break;
|
||||
|
@ -136,8 +136,12 @@ public:
|
||||
Node *i;
|
||||
inline iterator() : i(0) {}
|
||||
inline iterator(Node *n) : i(n) {}
|
||||
inline iterator(const iterator &o) : i(o.i) {}
|
||||
inline iterator &operator=(const iterator &o) { i = o.i; return *this; }
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
|
||||
iterator(const iterator &other) Q_DECL_NOTHROW : i(other.i) {}
|
||||
iterator &operator=(const iterator &other) Q_DECL_NOTHROW { i = other.i; return *this; }
|
||||
iterator(iterator &&other) Q_DECL_NOTHROW : i(other.i) {}
|
||||
iterator &operator=(iterator &&other) Q_DECL_NOTHROW { return *this = other; }
|
||||
#endif
|
||||
inline T &operator*() const { return i->t; }
|
||||
inline T *operator->() const { return &i->t; }
|
||||
inline bool operator==(const iterator &o) const { return i == o.i; }
|
||||
@ -169,9 +173,13 @@ public:
|
||||
Node *i;
|
||||
inline const_iterator() : i(0) {}
|
||||
inline const_iterator(Node *n) : i(n) {}
|
||||
inline const_iterator(const const_iterator &o) : i(o.i){}
|
||||
inline const_iterator(iterator ci) : i(ci.i){}
|
||||
inline const_iterator &operator=(const const_iterator &o) { i = o.i; return *this; }
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
|
||||
const_iterator(const const_iterator &other) Q_DECL_NOTHROW : i(other.i) {}
|
||||
const_iterator &operator=(const const_iterator &other) Q_DECL_NOTHROW { i = other.i; return *this; }
|
||||
const_iterator(const_iterator &&other) Q_DECL_NOTHROW : i(other.i) {}
|
||||
const_iterator &operator=(const_iterator &&other) Q_DECL_NOTHROW { return *this = other; }
|
||||
#endif
|
||||
inline const T &operator*() const { return i->t; }
|
||||
inline const T *operator->() const { return &i->t; }
|
||||
inline bool operator==(const const_iterator &o) const { return i == o.i; }
|
||||
|
@ -3011,7 +3011,7 @@ int QRegExpEngine::getEscape()
|
||||
case 'I':
|
||||
if (xmlSchemaExtensions) {
|
||||
yyCharClass->setNegative(!yyCharClass->negative());
|
||||
// fall through
|
||||
Q_FALLTHROUGH();
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
@ -3051,7 +3051,7 @@ int QRegExpEngine::getEscape()
|
||||
case 'C':
|
||||
if (xmlSchemaExtensions) {
|
||||
yyCharClass->setNegative(!yyCharClass->negative());
|
||||
// fall through
|
||||
Q_FALLTHROUGH();
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
@ -3097,7 +3097,7 @@ int QRegExpEngine::getEscape()
|
||||
case 'P':
|
||||
if (xmlSchemaExtensions) {
|
||||
yyCharClass->setNegative(!yyCharClass->negative());
|
||||
// fall through
|
||||
Q_FALLTHROUGH();
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
|
@ -67,10 +67,6 @@ QT_END_NAMESPACE
|
||||
#endif
|
||||
#include <QtCore/qhashfunctions.h>
|
||||
|
||||
#if defined(Q_COMPILER_RVALUE_REFS) && defined(Q_COMPILER_VARIADIC_TEMPLATES)
|
||||
# include <utility> // for std::forward
|
||||
#endif
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
|
||||
@ -428,7 +424,6 @@ public:
|
||||
|
||||
QWeakPointer<T> toWeakRef() const;
|
||||
|
||||
#if defined(Q_COMPILER_RVALUE_REFS) && defined(Q_COMPILER_VARIADIC_TEMPLATES)
|
||||
template <typename... Args>
|
||||
static QSharedPointer create(Args && ...arguments)
|
||||
{
|
||||
@ -450,49 +445,6 @@ public:
|
||||
result.enableSharedFromThis(result.data());
|
||||
return result;
|
||||
}
|
||||
#else
|
||||
static inline QSharedPointer create()
|
||||
{
|
||||
typedef QtSharedPointer::ExternalRefCountWithContiguousData<T> Private;
|
||||
# ifdef QT_SHAREDPOINTER_TRACK_POINTERS
|
||||
typename Private::DestroyerFn destroy = &Private::safetyCheckDeleter;
|
||||
# else
|
||||
typename Private::DestroyerFn destroy = &Private::deleter;
|
||||
# endif
|
||||
QSharedPointer result(Qt::Uninitialized);
|
||||
result.d = Private::create(&result.value, destroy);
|
||||
|
||||
// now initialize the data
|
||||
new (result.data()) T();
|
||||
# ifdef QT_SHAREDPOINTER_TRACK_POINTERS
|
||||
internalSafetyCheckAdd(result.d, result.value);
|
||||
# endif
|
||||
result.d->setQObjectShared(result.value, true);
|
||||
result.enableSharedFromThis(result.data());
|
||||
return result;
|
||||
}
|
||||
|
||||
template <typename Arg>
|
||||
static inline QSharedPointer create(const Arg &arg)
|
||||
{
|
||||
typedef QtSharedPointer::ExternalRefCountWithContiguousData<T> Private;
|
||||
# ifdef QT_SHAREDPOINTER_TRACK_POINTERS
|
||||
typename Private::DestroyerFn destroy = &Private::safetyCheckDeleter;
|
||||
# else
|
||||
typename Private::DestroyerFn destroy = &Private::deleter;
|
||||
# endif
|
||||
QSharedPointer result(Qt::Uninitialized);
|
||||
result.d = Private::create(&result.value, destroy);
|
||||
|
||||
// now initialize the data
|
||||
new (result.data()) T(arg);
|
||||
# ifdef QT_SHAREDPOINTER_TRACK_POINTERS
|
||||
internalSafetyCheckAdd(result.d, result.value);
|
||||
# endif
|
||||
result.d->setQObjectShared(result.value, true);
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
private:
|
||||
explicit QSharedPointer(Qt::Initialization) {}
|
||||
|
@ -522,13 +522,13 @@ static void getLineBreaks(const ushort *string, quint32 len, QCharAttributes *at
|
||||
// do not change breaks before and after the expression
|
||||
for (quint32 j = nestart + 1; j < pos; ++j)
|
||||
attributes[j].lineBreak = false;
|
||||
// fall through
|
||||
Q_FALLTHROUGH();
|
||||
case LB::NS::None:
|
||||
nelast = LB::NS::XX; // reset state
|
||||
break;
|
||||
case LB::NS::Start:
|
||||
nestart = i;
|
||||
// fall through
|
||||
Q_FALLTHROUGH();
|
||||
default:
|
||||
nelast = necur;
|
||||
break;
|
||||
|
@ -976,11 +976,11 @@ bool QXmlStreamReaderPrivate::scanUntil(const char *str, short tokenToInject)
|
||||
case '\r':
|
||||
if ((c = filterCarriageReturn()) == 0)
|
||||
break;
|
||||
// fall through
|
||||
Q_FALLTHROUGH();
|
||||
case '\n':
|
||||
++lineNumber;
|
||||
lastLineStart = characterOffset + readBufferPos;
|
||||
// fall through
|
||||
Q_FALLTHROUGH();
|
||||
case '\t':
|
||||
textBuffer += QChar(c);
|
||||
continue;
|
||||
@ -1158,11 +1158,11 @@ inline int QXmlStreamReaderPrivate::fastScanLiteralContent()
|
||||
case '\r':
|
||||
if (filterCarriageReturn() == 0)
|
||||
return n;
|
||||
// fall through
|
||||
Q_FALLTHROUGH();
|
||||
case '\n':
|
||||
++lineNumber;
|
||||
lastLineStart = characterOffset + readBufferPos;
|
||||
// fall through
|
||||
Q_FALLTHROUGH();
|
||||
case ' ':
|
||||
case '\t':
|
||||
if (normalizeLiterals)
|
||||
@ -1179,7 +1179,7 @@ inline int QXmlStreamReaderPrivate::fastScanLiteralContent()
|
||||
putChar(c);
|
||||
return n;
|
||||
}
|
||||
// fall through
|
||||
Q_FALLTHROUGH();
|
||||
default:
|
||||
if (c < 0x20) {
|
||||
putChar(c);
|
||||
@ -1201,11 +1201,11 @@ inline int QXmlStreamReaderPrivate::fastScanSpace()
|
||||
case '\r':
|
||||
if ((c = filterCarriageReturn()) == 0)
|
||||
return n;
|
||||
// fall through
|
||||
Q_FALLTHROUGH();
|
||||
case '\n':
|
||||
++lineNumber;
|
||||
lastLineStart = characterOffset + readBufferPos;
|
||||
// fall through
|
||||
Q_FALLTHROUGH();
|
||||
case ' ':
|
||||
case '\t':
|
||||
textBuffer += QChar(c);
|
||||
@ -1259,11 +1259,11 @@ inline int QXmlStreamReaderPrivate::fastScanContentCharList()
|
||||
case '\r':
|
||||
if ((c = filterCarriageReturn()) == 0)
|
||||
return n;
|
||||
// fall through
|
||||
Q_FALLTHROUGH();
|
||||
case '\n':
|
||||
++lineNumber;
|
||||
lastLineStart = characterOffset + readBufferPos;
|
||||
// fall through
|
||||
Q_FALLTHROUGH();
|
||||
case ' ':
|
||||
case '\t':
|
||||
textBuffer += QChar(ushort(c));
|
||||
@ -1275,7 +1275,7 @@ inline int QXmlStreamReaderPrivate::fastScanContentCharList()
|
||||
putChar(c);
|
||||
return n;
|
||||
}
|
||||
// fall through
|
||||
Q_FALLTHROUGH();
|
||||
default:
|
||||
if (c < 0x20) {
|
||||
putChar(c);
|
||||
@ -1339,7 +1339,7 @@ inline int QXmlStreamReaderPrivate::fastScanName(int *prefix)
|
||||
putChar(c);
|
||||
return n;
|
||||
}
|
||||
// fall through
|
||||
Q_FALLTHROUGH();
|
||||
default:
|
||||
textBuffer += QChar(c);
|
||||
++n;
|
||||
@ -2123,7 +2123,7 @@ QString QXmlStreamReader::readElementText(ReadElementTextBehaviour behaviour)
|
||||
result += readElementText(behaviour);
|
||||
break;
|
||||
}
|
||||
// Fall through (for ErrorOnUnexpectedElement)
|
||||
Q_FALLTHROUGH();
|
||||
default:
|
||||
if (d->error || behaviour == ErrorOnUnexpectedElement) {
|
||||
if (!d->error)
|
||||
|
@ -1048,7 +1048,7 @@ bool QXmlStreamReaderPrivate::parse()
|
||||
dtdName.clear();
|
||||
dtdPublicId.clear();
|
||||
dtdSystemId.clear();
|
||||
// fall through
|
||||
Q_FALLTHROUGH();
|
||||
case QXmlStreamReader::Comment:
|
||||
case QXmlStreamReader::Characters:
|
||||
isCDATA = false;
|
||||
@ -1080,7 +1080,7 @@ bool QXmlStreamReaderPrivate::parse()
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
// fall through
|
||||
Q_FALLTHROUGH();
|
||||
default:
|
||||
clearTextBuffer();
|
||||
;
|
||||
@ -1124,7 +1124,7 @@ bool QXmlStreamReaderPrivate::parse()
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
// fall through
|
||||
Q_FALLTHROUGH();
|
||||
case ~0U: {
|
||||
token = EOF_SYMBOL;
|
||||
if (!tagsDone && !inParseEntity) {
|
||||
@ -1338,7 +1338,7 @@ bool QXmlStreamReaderPrivate::parse()
|
||||
case 17:
|
||||
case 18:
|
||||
dtdName = symString(3);
|
||||
// fall through
|
||||
Q_FALLTHROUGH();
|
||||
|
||||
case 19:
|
||||
case 20:
|
||||
@ -1480,7 +1480,7 @@ bool QXmlStreamReaderPrivate::parse()
|
||||
if (entityDeclaration.parameter)
|
||||
raiseWellFormedError(QXmlStream::tr("NDATA in parameter entity declaration."));
|
||||
}
|
||||
//fall through
|
||||
Q_FALLTHROUGH();
|
||||
|
||||
case 94:
|
||||
case 95: {
|
||||
@ -1588,7 +1588,7 @@ bool QXmlStreamReaderPrivate::parse()
|
||||
|
||||
case 129:
|
||||
isWhitespace = false;
|
||||
// fall through
|
||||
Q_FALLTHROUGH();
|
||||
|
||||
case 130:
|
||||
sym(1).len += fastScanContentCharList();
|
||||
@ -1760,7 +1760,7 @@ bool QXmlStreamReaderPrivate::parse()
|
||||
|
||||
case 236:
|
||||
isEmptyElement = true;
|
||||
// fall through
|
||||
Q_FALLTHROUGH();
|
||||
|
||||
case 237:
|
||||
setType(QXmlStreamReader::StartElement);
|
||||
|
@ -318,7 +318,7 @@ void QDBusMarshaller::open(QDBusMarshaller &sub, int code, const char *signature
|
||||
case DBUS_TYPE_ARRAY:
|
||||
*ba += char(code);
|
||||
*ba += signature;
|
||||
// fall through
|
||||
Q_FALLTHROUGH();
|
||||
|
||||
case DBUS_TYPE_DICT_ENTRY:
|
||||
sub.closeCode = 0;
|
||||
@ -495,9 +495,9 @@ bool QDBusMarshaller::appendVariantInternal(const QVariant &arg)
|
||||
return true;
|
||||
|
||||
default:
|
||||
; // fall through
|
||||
;
|
||||
}
|
||||
// fall through
|
||||
Q_FALLTHROUGH();
|
||||
|
||||
case DBUS_TYPE_STRUCT:
|
||||
case DBUS_STRUCT_BEGIN_CHAR:
|
||||
@ -513,7 +513,7 @@ bool QDBusMarshaller::appendVariantInternal(const QVariant &arg)
|
||||
append(qvariant_cast<QDBusUnixFileDescriptor>(arg));
|
||||
return true;
|
||||
}
|
||||
// fall through
|
||||
Q_FALLTHROUGH();
|
||||
|
||||
default:
|
||||
qWarning("QDBusMarshaller::appendVariantInternal: Found unknown D-BUS type '%s'",
|
||||
|
@ -373,7 +373,7 @@ int QDBusMetaType::signatureToType(const char *signature)
|
||||
return qMetaTypeId<QList<QDBusSignature> >();
|
||||
|
||||
}
|
||||
// fall through
|
||||
Q_FALLTHROUGH();
|
||||
default:
|
||||
return QMetaType::UnknownType;
|
||||
}
|
||||
|
@ -59,10 +59,10 @@ static inline QString typeNameToXml(const char *typeName)
|
||||
{
|
||||
// ### copied from qtextdocument.cpp
|
||||
// ### move this into Qt Core at some point
|
||||
QString plain = QLatin1String(typeName);
|
||||
const QLatin1String plain(typeName);
|
||||
QString rich;
|
||||
rich.reserve(int(plain.length() * 1.1));
|
||||
for (int i = 0; i < plain.length(); ++i) {
|
||||
rich.reserve(int(plain.size() * 1.1));
|
||||
for (int i = 0; i < plain.size(); ++i) {
|
||||
if (plain.at(i) == QLatin1Char('<'))
|
||||
rich += QLatin1String("<");
|
||||
else if (plain.at(i) == QLatin1Char('>'))
|
||||
|
@ -1888,7 +1888,7 @@ void QImage::invertPixels(InvertMode mode)
|
||||
case QImage::Format_RGBA8888:
|
||||
if (mode == InvertRgba)
|
||||
break;
|
||||
// no break
|
||||
Q_FALLTHROUGH();
|
||||
case QImage::Format_RGBX8888:
|
||||
#if Q_BYTE_ORDER == Q_BIG_ENDIAN
|
||||
xorbits = 0xffffff00;
|
||||
@ -1900,7 +1900,7 @@ void QImage::invertPixels(InvertMode mode)
|
||||
case QImage::Format_ARGB32:
|
||||
if (mode == InvertRgba)
|
||||
break;
|
||||
// no break
|
||||
Q_FALLTHROUGH();
|
||||
case QImage::Format_RGB32:
|
||||
xorbits = 0x00ffffff;
|
||||
break;
|
||||
|
@ -1151,7 +1151,7 @@ bool QImageReader::autoTransform() const
|
||||
case QImageReaderPrivate::UsePluginDefault:
|
||||
if (d->initHandler())
|
||||
return d->handler->supportsOption(QImageIOHandler::TransformedByDefault);
|
||||
// no break
|
||||
Q_FALLTHROUGH();
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -44,13 +44,12 @@
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists for the convenience
|
||||
// of QAbstractItemModel*. This header file may change from version
|
||||
// to version without notice, or even be removed.
|
||||
// This file is not part of the Qt API. It exists purely as an
|
||||
// implementation detail. This header file may change from version to
|
||||
// version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
//
|
||||
|
||||
#include <QtGui/private/qtguiglobal_p.h>
|
||||
#include <QtGui/qpaintengine.h>
|
||||
|
@ -113,10 +113,10 @@ int QBlittablePlatformPixmap::metric(QPaintDevice::PaintDeviceMetric metric) con
|
||||
return qRound(h * 25.4 / qt_defaultDpiY());
|
||||
case QPaintDevice::PdmDepth:
|
||||
return 32;
|
||||
case QPaintDevice::PdmDpiX: // fall-through
|
||||
case QPaintDevice::PdmDpiX:
|
||||
case QPaintDevice::PdmPhysicalDpiX:
|
||||
return qt_defaultDpiX();
|
||||
case QPaintDevice::PdmDpiY: // fall-through
|
||||
case QPaintDevice::PdmDpiY:
|
||||
case QPaintDevice::PdmPhysicalDpiY:
|
||||
return qt_defaultDpiY();
|
||||
case QPaintDevice::PdmDevicePixelRatio:
|
||||
|
@ -44,9 +44,9 @@
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists for the convenience
|
||||
// of the QLibrary class. This header file may change from
|
||||
// version to version without notice, or even be removed.
|
||||
// This file is not part of the Qt API. It exists purely as an
|
||||
// implementation detail. This header file may change from version to
|
||||
// version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
|
@ -44,9 +44,9 @@
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists for the convenience
|
||||
// of the QLibrary class. This header file may change from
|
||||
// version to version without notice, or even be removed.
|
||||
// This file is not part of the Qt API. It exists purely as an
|
||||
// implementation detail. This header file may change from version to
|
||||
// version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
|
@ -44,9 +44,9 @@
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists for the convenience
|
||||
// of the QLibrary class. This header file may change from
|
||||
// version to version without notice, or even be removed.
|
||||
// This file is not part of the Qt API. It exists purely as an
|
||||
// implementation detail. This header file may change from version to
|
||||
// version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
|
@ -44,9 +44,9 @@
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists for the convenience
|
||||
// of the QLibrary class. This header file may change from
|
||||
// version to version without notice, or even be removed.
|
||||
// This file is not part of the Qt API. It exists purely as an
|
||||
// implementation detail. This header file may change from version to
|
||||
// version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
|
@ -149,17 +149,12 @@ Qt::DropAction QDragManager::drag(QDrag *o)
|
||||
|
||||
#if !(defined(QT_NO_DRAGANDDROP) && defined(QT_NO_CLIPBOARD))
|
||||
|
||||
static QStringList imageReadMimeFormats()
|
||||
static QStringList imageMimeFormats(const QList<QByteArray> &imageFormats)
|
||||
{
|
||||
QStringList formats;
|
||||
QList<QByteArray> imageFormats = QImageReader::supportedImageFormats();
|
||||
const int numImageFormats = imageFormats.size();
|
||||
formats.reserve(numImageFormats);
|
||||
for (int i = 0; i < numImageFormats; ++i) {
|
||||
QString format = QLatin1String("image/");
|
||||
format += QString::fromLatin1(imageFormats.at(i).toLower());
|
||||
formats.append(format);
|
||||
}
|
||||
formats.reserve(imageFormats.size());
|
||||
for (const auto &format : imageFormats)
|
||||
formats.append(QLatin1String("image/") + QLatin1String(format.toLower()));
|
||||
|
||||
//put png at the front because it is best
|
||||
int pngIndex = formats.indexOf(QLatin1String("image/png"));
|
||||
@ -169,25 +164,15 @@ static QStringList imageReadMimeFormats()
|
||||
return formats;
|
||||
}
|
||||
|
||||
|
||||
static QStringList imageWriteMimeFormats()
|
||||
static inline QStringList imageReadMimeFormats()
|
||||
{
|
||||
QStringList formats;
|
||||
QList<QByteArray> imageFormats = QImageWriter::supportedImageFormats();
|
||||
const int numImageFormats = imageFormats.size();
|
||||
formats.reserve(numImageFormats);
|
||||
for (int i = 0; i < numImageFormats; ++i) {
|
||||
QString format = QLatin1String("image/");
|
||||
format += QString::fromLatin1(imageFormats.at(i).toLower());
|
||||
formats.append(format);
|
||||
}
|
||||
return imageMimeFormats(QImageReader::supportedImageFormats());
|
||||
}
|
||||
|
||||
//put png at the front because it is best
|
||||
int pngIndex = formats.indexOf(QLatin1String("image/png"));
|
||||
if (pngIndex != -1 && pngIndex != 0)
|
||||
formats.move(pngIndex, 0);
|
||||
|
||||
return formats;
|
||||
static inline QStringList imageWriteMimeFormats()
|
||||
{
|
||||
return imageMimeFormats(QImageWriter::supportedImageFormats());
|
||||
}
|
||||
|
||||
QInternalMimeData::QInternalMimeData()
|
||||
|
@ -154,14 +154,14 @@ bool QPlatformGraphicsBufferHelper::bindSWToTexture(const QPlatformGraphicsBuffe
|
||||
switch (imageformat) {
|
||||
case QImage::Format_ARGB32_Premultiplied:
|
||||
premultiplied = true;
|
||||
// no break
|
||||
Q_FALLTHROUGH();
|
||||
case QImage::Format_RGB32:
|
||||
case QImage::Format_ARGB32:
|
||||
swizzle = true;
|
||||
break;
|
||||
case QImage::Format_RGBA8888_Premultiplied:
|
||||
premultiplied = true;
|
||||
// no break
|
||||
Q_FALLTHROUGH();
|
||||
case QImage::Format_RGBX8888:
|
||||
case QImage::Format_RGBA8888:
|
||||
break;
|
||||
|
@ -22,12 +22,9 @@ qtConfig(opengl(es2)?) {
|
||||
opengl/qopenglpaintengine_p.h \
|
||||
opengl/qopenglengineshadersource_p.h \
|
||||
opengl/qopenglcustomshaderstage_p.h \
|
||||
opengl/qtriangulatingstroker_p.h \
|
||||
opengl/qopengltextureglyphcache_p.h \
|
||||
opengl/qopenglshadercache_p.h \
|
||||
opengl/qopenglshadercache_meego_p.h \
|
||||
opengl/qtriangulator_p.h \
|
||||
opengl/qrbtree_p.h \
|
||||
opengl/qopenglversionfunctions.h \
|
||||
opengl/qopenglversionfunctionsfactory_p.h \
|
||||
opengl/qopenglvertexarrayobject.h \
|
||||
@ -51,9 +48,7 @@ qtConfig(opengl(es2)?) {
|
||||
opengl/qopengl2pexvertexarray.cpp \
|
||||
opengl/qopenglpaintengine.cpp \
|
||||
opengl/qopenglcustomshaderstage.cpp \
|
||||
opengl/qtriangulatingstroker.cpp \
|
||||
opengl/qopengltextureglyphcache.cpp \
|
||||
opengl/qtriangulator.cpp \
|
||||
opengl/qopenglversionfunctions.cpp \
|
||||
opengl/qopenglversionfunctionsfactory.cpp \
|
||||
opengl/qopenglvertexarrayobject.cpp \
|
||||
|
@ -44,9 +44,9 @@
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists for the convenience
|
||||
// of the QLibrary class. This header file may change from
|
||||
// version to version without notice, or even be removed.
|
||||
// This file is not part of the Qt API. It exists purely as an
|
||||
// implementation detail. This header file may change from version to
|
||||
// version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
|
@ -520,8 +520,8 @@ void QOpenGLTextureBlitter::release()
|
||||
}
|
||||
|
||||
/*!
|
||||
Enables or disables swizzling for the red and blue color
|
||||
channels. An BGRA to RGBA conversion (occurring in the shader on
|
||||
Sets whether swizzling is enabled for the red and blue color channels to
|
||||
\a swizzle. An BGRA to RGBA conversion (occurring in the shader on
|
||||
the GPU, instead of a slow CPU-side transformation) can be useful
|
||||
when the source texture contains data from a QImage with a format
|
||||
like QImage::Format_ARGB32 which maps to BGRA on little endian
|
||||
@ -538,10 +538,11 @@ void QOpenGLTextureBlitter::setRedBlueSwizzle(bool swizzle)
|
||||
}
|
||||
|
||||
/*!
|
||||
Changes the opacity. The default opacity is 1.0.
|
||||
Changes the opacity to \a opacity. The default opacity is 1.0.
|
||||
|
||||
\note the blitter does not alter the blend state. It is up to the
|
||||
caller of blit() to ensure the correct blend settings are active.
|
||||
|
||||
*/
|
||||
void QOpenGLTextureBlitter::setOpacity(float opacity)
|
||||
{
|
||||
@ -613,7 +614,7 @@ void QOpenGLTextureBlitter::blit(GLuint texture,
|
||||
the source dimensions and will in most cases be set to (0, 0,
|
||||
image width, image height).
|
||||
|
||||
For unscaled output the size of \a target and \viewport should
|
||||
For unscaled output the size of \a target and \a viewport should
|
||||
match.
|
||||
|
||||
\sa blit()
|
||||
|
@ -44,9 +44,9 @@
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists for the convenience
|
||||
// of the QLibrary class. This header file may change from
|
||||
// version to version without notice, or even be removed.
|
||||
// This file is not part of the Qt API. It exists purely as an
|
||||
// implementation detail. This header file may change from version to
|
||||
// version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
|
@ -42,6 +42,7 @@ HEADERS += \
|
||||
painting/qpolygonclipper_p.h \
|
||||
painting/qrasterdefs_p.h \
|
||||
painting/qrasterizer_p.h \
|
||||
painting/qrbtree_p.h \
|
||||
painting/qregion.h \
|
||||
painting/qrgb.h \
|
||||
painting/qrgba64.h \
|
||||
@ -49,6 +50,8 @@ HEADERS += \
|
||||
painting/qstroker_p.h \
|
||||
painting/qtextureglyphcache_p.h \
|
||||
painting/qtransform.h \
|
||||
painting/qtriangulatingstroker_p.h \
|
||||
painting/qtriangulator_p.h \
|
||||
painting/qplatformbackingstore.h \
|
||||
painting/qpathsimplifier_p.h
|
||||
|
||||
@ -92,6 +95,8 @@ SOURCES += \
|
||||
painting/qstroker.cpp \
|
||||
painting/qtextureglyphcache.cpp \
|
||||
painting/qtransform.cpp \
|
||||
painting/qtriangulatingstroker.cpp \
|
||||
painting/qtriangulator.cpp \
|
||||
painting/qplatformbackingstore.cpp \
|
||||
painting/qpathsimplifier.cpp
|
||||
|
||||
|
@ -343,14 +343,6 @@ bool qt_get_named_rgb(const QChar *name, int len, QRgb *rgb)
|
||||
return get_named_rgb(name_no_space, rgb);
|
||||
}
|
||||
|
||||
|
||||
uint qt_get_rgb_val(const char *name)
|
||||
{
|
||||
QRgb r = 0;
|
||||
qt_get_named_rgb(name,&r);
|
||||
return r;
|
||||
}
|
||||
|
||||
QStringList qt_get_colornames()
|
||||
{
|
||||
int i = 0;
|
||||
@ -368,10 +360,6 @@ bool qt_get_named_rgb(const char *, QRgb*)
|
||||
return false;
|
||||
}
|
||||
|
||||
uint qt_get_rgb_val(const char *)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
QStringList qt_get_colornames()
|
||||
{
|
||||
return QStringList();
|
||||
|
@ -57,7 +57,6 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
uint qt_get_rgb_val(const char *name);
|
||||
bool qt_get_named_rgb(const char *, QRgb*);
|
||||
bool qt_get_named_rgb(const QChar *, int len, QRgb*);
|
||||
bool qt_get_hex_rgb(const char *, QRgb *);
|
||||
|
@ -197,7 +197,7 @@ void qDrawEdge(QPainter *p, qreal x1, qreal y1, qreal x2, qreal y2, qreal dw1, q
|
||||
if ((style == BorderStyle_Outset && (edge == TopEdge || edge == LeftEdge))
|
||||
|| (style == BorderStyle_Inset && (edge == BottomEdge || edge == RightEdge)))
|
||||
c = c.color().lighter();
|
||||
// fall through!
|
||||
Q_FALLTHROUGH();
|
||||
case BorderStyle_Solid: {
|
||||
p->setPen(Qt::NoPen);
|
||||
p->setBrush(c);
|
||||
|
@ -2245,45 +2245,48 @@ static const uint * QT_FASTCALL fetchTransformedBilinearARGB32PM(uint *buffer, c
|
||||
const int16x8_t v_disty_ = vshlq_n_s16(v_disty, 4);
|
||||
int32x4_t v_fdx = vdupq_n_s32(fdx*4);
|
||||
|
||||
ptrdiff_t secondLine = reinterpret_cast<const uint *>(s2) - reinterpret_cast<const uint *>(s1);
|
||||
|
||||
union Vect_buffer { int32x4_t vect; quint32 i[4]; };
|
||||
Vect_buffer v_fx;
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
v_fx.i[i] = fx;
|
||||
fx += fdx;
|
||||
}
|
||||
int32x4_t v_fx = vmovq_n_s32(fx);
|
||||
fx += fdx;
|
||||
v_fx = vsetq_lane_s32(fx, v_fx, 1);
|
||||
fx += fdx;
|
||||
v_fx = vsetq_lane_s32(fx, v_fx, 2);
|
||||
fx += fdx;
|
||||
v_fx = vsetq_lane_s32(fx, v_fx, 3);
|
||||
fx += fdx;
|
||||
|
||||
const int32x4_t v_ffff_mask = vdupq_n_s32(0x0000ffff);
|
||||
const int32x4_t v_fx_r = vdupq_n_s32(0x0800);
|
||||
|
||||
while (b < boundedEnd) {
|
||||
uint32x4x2_t v_top, v_bot;
|
||||
|
||||
Vect_buffer tl, tr, bl, br;
|
||||
int32x4_t v_fx_shifted = vshrq_n_s32(v_fx, 16);
|
||||
|
||||
Vect_buffer v_fx_shifted;
|
||||
v_fx_shifted.vect = vshrq_n_s32(v_fx.vect, 16);
|
||||
|
||||
int32x4_t v_distx = vshrq_n_s32(vaddq_s32(vandq_s32(v_fx.vect, v_ffff_mask), v_fx_r), 12);
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
int x1 = v_fx_shifted.i[i];
|
||||
const uint *addr_tl = reinterpret_cast<const uint *>(s1) + x1;
|
||||
const uint *addr_tr = addr_tl + 1;
|
||||
tl.i[i] = *addr_tl;
|
||||
tr.i[i] = *addr_tr;
|
||||
bl.i[i] = *(addr_tl+secondLine);
|
||||
br.i[i] = *(addr_tr+secondLine);
|
||||
}
|
||||
int x1 = vgetq_lane_s32(v_fx_shifted, 0);
|
||||
v_top = vld2q_lane_u32(s1 + x1, v_top, 0);
|
||||
v_bot = vld2q_lane_u32(s2 + x1, v_bot, 0);
|
||||
x1 = vgetq_lane_s32(v_fx_shifted, 1);
|
||||
v_top = vld2q_lane_u32(s1 + x1, v_top, 1);
|
||||
v_bot = vld2q_lane_u32(s2 + x1, v_bot, 1);
|
||||
x1 = vgetq_lane_s32(v_fx_shifted, 2);
|
||||
v_top = vld2q_lane_u32(s1 + x1, v_top, 2);
|
||||
v_bot = vld2q_lane_u32(s2 + x1, v_bot, 2);
|
||||
x1 = vgetq_lane_s32(v_fx_shifted, 3);
|
||||
v_top = vld2q_lane_u32(s1 + x1, v_top, 3);
|
||||
v_bot = vld2q_lane_u32(s2 + x1, v_bot, 3);
|
||||
|
||||
int32x4_t v_distx = vshrq_n_s32(vaddq_s32(vandq_s32(v_fx, v_ffff_mask), v_fx_r), 12);
|
||||
v_distx = vorrq_s32(v_distx, vshlq_n_s32(v_distx, 16));
|
||||
|
||||
interpolate_4_pixels_16_neon(vreinterpretq_s16_s32(tl.vect), vreinterpretq_s16_s32(tr.vect), vreinterpretq_s16_s32(bl.vect), vreinterpretq_s16_s32(br.vect), vreinterpretq_s16_s32(v_distx), v_disty, v_disty_, colorMask, invColorMask, v_256, b);
|
||||
interpolate_4_pixels_16_neon(
|
||||
vreinterpretq_s16_u32(v_top.val[0]), vreinterpretq_s16_u32(v_top.val[1]),
|
||||
vreinterpretq_s16_u32(v_bot.val[0]), vreinterpretq_s16_u32(v_bot.val[1]),
|
||||
vreinterpretq_s16_s32(v_distx), v_disty, v_disty_,
|
||||
colorMask, invColorMask, v_256, b);
|
||||
b+=4;
|
||||
v_fx.vect = vaddq_s32(v_fx.vect, v_fdx);
|
||||
v_fx = vaddq_s32(v_fx, v_fdx);
|
||||
}
|
||||
fx = v_fx.i[0];
|
||||
fx = vgetq_lane_s32(v_fx, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -2419,6 +2422,87 @@ static const uint * QT_FASTCALL fetchTransformedBilinearARGB32PM(uint *buffer, c
|
||||
}
|
||||
fx = _mm_cvtsi128_si32(v_fx);
|
||||
fy = _mm_cvtsi128_si32(v_fy);
|
||||
#elif defined(__ARM_NEON__)
|
||||
BILINEAR_ROTATE_BOUNDS_PROLOG
|
||||
|
||||
const int16x8_t colorMask = vdupq_n_s16(0x00ff);
|
||||
const int16x8_t invColorMask = vmvnq_s16(colorMask);
|
||||
const int16x8_t v_256 = vdupq_n_s16(256);
|
||||
int32x4_t v_fdx = vdupq_n_s32(fdx * 4);
|
||||
int32x4_t v_fdy = vdupq_n_s32(fdy * 4);
|
||||
|
||||
const uchar *textureData = data->texture.imageData;
|
||||
const int bytesPerLine = data->texture.bytesPerLine;
|
||||
|
||||
int32x4_t v_fx = vmovq_n_s32(fx);
|
||||
int32x4_t v_fy = vmovq_n_s32(fy);
|
||||
fx += fdx; fy += fdy;
|
||||
v_fx = vsetq_lane_s32(fx, v_fx, 1);
|
||||
v_fy = vsetq_lane_s32(fy, v_fy, 1);
|
||||
fx += fdx; fy += fdy;
|
||||
v_fx = vsetq_lane_s32(fx, v_fx, 2);
|
||||
v_fy = vsetq_lane_s32(fy, v_fy, 2);
|
||||
fx += fdx; fy += fdy;
|
||||
v_fx = vsetq_lane_s32(fx, v_fx, 3);
|
||||
v_fy = vsetq_lane_s32(fy, v_fy, 3);
|
||||
fx += fdx; fy += fdy;
|
||||
|
||||
const int32x4_t v_ffff_mask = vdupq_n_s32(0x0000ffff);
|
||||
const int32x4_t v_round = vdupq_n_s32(0x0800);
|
||||
|
||||
while (b < boundedEnd) {
|
||||
uint32x4x2_t v_top, v_bot;
|
||||
|
||||
int32x4_t v_fx_shifted, v_fy_shifted;
|
||||
v_fx_shifted = vshrq_n_s32(v_fx, 16);
|
||||
v_fy_shifted = vshrq_n_s32(v_fy, 16);
|
||||
|
||||
int x1 = vgetq_lane_s32(v_fx_shifted, 0);
|
||||
int y1 = vgetq_lane_s32(v_fy_shifted, 0);
|
||||
const uchar *sl = textureData + bytesPerLine * y1;
|
||||
const uint *s1 = reinterpret_cast<const uint *>(sl);
|
||||
const uint *s2 = reinterpret_cast<const uint *>(sl + bytesPerLine);
|
||||
v_top = vld2q_lane_u32(s1 + x1, v_top, 0);
|
||||
v_bot = vld2q_lane_u32(s2 + x1, v_bot, 0);
|
||||
x1 = vgetq_lane_s32(v_fx_shifted, 1);
|
||||
y1 = vgetq_lane_s32(v_fy_shifted, 1);
|
||||
sl = textureData + bytesPerLine * y1;
|
||||
s1 = reinterpret_cast<const uint *>(sl);
|
||||
s2 = reinterpret_cast<const uint *>(sl + bytesPerLine);
|
||||
v_top = vld2q_lane_u32(s1 + x1, v_top, 1);
|
||||
v_bot = vld2q_lane_u32(s2 + x1, v_bot, 1);
|
||||
x1 = vgetq_lane_s32(v_fx_shifted, 2);
|
||||
y1 = vgetq_lane_s32(v_fy_shifted, 2);
|
||||
sl = textureData + bytesPerLine * y1;
|
||||
s1 = reinterpret_cast<const uint *>(sl);
|
||||
s2 = reinterpret_cast<const uint *>(sl + bytesPerLine);
|
||||
v_top = vld2q_lane_u32(s1 + x1, v_top, 2);
|
||||
v_bot = vld2q_lane_u32(s2 + x1, v_bot, 2);
|
||||
x1 = vgetq_lane_s32(v_fx_shifted, 3);
|
||||
y1 = vgetq_lane_s32(v_fy_shifted, 3);
|
||||
sl = textureData + bytesPerLine * y1;
|
||||
s1 = reinterpret_cast<const uint *>(sl);
|
||||
s2 = reinterpret_cast<const uint *>(sl + bytesPerLine);
|
||||
v_top = vld2q_lane_u32(s1 + x1, v_top, 3);
|
||||
v_bot = vld2q_lane_u32(s2 + x1, v_bot, 3);
|
||||
|
||||
int32x4_t v_distx = vshrq_n_s32(vaddq_s32(vandq_s32(v_fx, v_ffff_mask), v_round), 12);
|
||||
int32x4_t v_disty = vshrq_n_s32(vaddq_s32(vandq_s32(v_fy, v_ffff_mask), v_round), 12);
|
||||
v_distx = vorrq_s32(v_distx, vshlq_n_s32(v_distx, 16));
|
||||
v_disty = vorrq_s32(v_disty, vshlq_n_s32(v_disty, 16));
|
||||
int16x8_t v_disty_ = vshlq_n_s16(vreinterpretq_s16_s32(v_disty), 4);
|
||||
|
||||
interpolate_4_pixels_16_neon(
|
||||
vreinterpretq_s16_u32(v_top.val[0]), vreinterpretq_s16_u32(v_top.val[1]),
|
||||
vreinterpretq_s16_u32(v_bot.val[0]), vreinterpretq_s16_u32(v_bot.val[1]),
|
||||
vreinterpretq_s16_s32(v_distx), vreinterpretq_s16_s32(v_disty),
|
||||
v_disty_, colorMask, invColorMask, v_256, b);
|
||||
b += 4;
|
||||
v_fx = vaddq_s32(v_fx, v_fdx);
|
||||
v_fy = vaddq_s32(v_fy, v_fdy);
|
||||
}
|
||||
fx = vgetq_lane_s32(v_fx, 0);
|
||||
fy = vgetq_lane_s32(v_fy, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -1760,7 +1760,7 @@ static bool bool_op(bool a, bool b, QPathClipper::Operation op)
|
||||
switch (op) {
|
||||
case QPathClipper::BoolAnd:
|
||||
return a && b;
|
||||
case QPathClipper::BoolOr: // fall-through
|
||||
case QPathClipper::BoolOr:
|
||||
case QPathClipper::Simplify:
|
||||
return a || b;
|
||||
case QPathClipper::BoolSub:
|
||||
@ -1956,7 +1956,7 @@ QPointF intersectLine(const QPointF &a, const QPointF &b, qreal t)
|
||||
{
|
||||
QLineF line(a, b);
|
||||
switch (edge) {
|
||||
case Left: // fall-through
|
||||
case Left:
|
||||
case Right:
|
||||
return line.pointAt((t - a.x()) / (b.x() - a.x()));
|
||||
default:
|
||||
|
@ -2091,7 +2091,7 @@ int QPdfEnginePrivate::generateLinearGradientShader(const QLinearGradient *gradi
|
||||
break;
|
||||
case QGradient::ReflectSpread:
|
||||
reflect = true;
|
||||
// fall through
|
||||
Q_FALLTHROUGH();
|
||||
case QGradient::RepeatSpread: {
|
||||
// calculate required bounds
|
||||
QRectF pageRect = m_pageLayout.fullRectPixels(resolution);
|
||||
@ -2154,7 +2154,7 @@ int QPdfEnginePrivate::generateRadialGradientShader(const QRadialGradient *gradi
|
||||
break;
|
||||
case QGradient::ReflectSpread:
|
||||
reflect = true;
|
||||
// fall through
|
||||
Q_FALLTHROUGH();
|
||||
case QGradient::RepeatSpread: {
|
||||
Q_ASSERT(qFuzzyIsNull(r0)); // QPainter emulates if this is not 0
|
||||
|
||||
|
@ -471,14 +471,14 @@ GLuint QPlatformBackingStore::toTexture(const QRegion &dirtyRegion, QSize *textu
|
||||
switch (image.format()) {
|
||||
case QImage::Format_ARGB32_Premultiplied:
|
||||
*flags |= TexturePremultiplied;
|
||||
// no break
|
||||
Q_FALLTHROUGH();
|
||||
case QImage::Format_RGB32:
|
||||
case QImage::Format_ARGB32:
|
||||
*flags |= TextureSwizzle;
|
||||
break;
|
||||
case QImage::Format_RGBA8888_Premultiplied:
|
||||
*flags |= TexturePremultiplied;
|
||||
// no break
|
||||
Q_FALLTHROUGH();
|
||||
case QImage::Format_RGBX8888:
|
||||
case QImage::Format_RGBA8888:
|
||||
break;
|
||||
|
@ -446,7 +446,7 @@ QTransform &QTransform::translate(qreal dx, qreal dy)
|
||||
break;
|
||||
case TxProject:
|
||||
m_33 += dx*m_13 + dy*m_23;
|
||||
// Fall through
|
||||
Q_FALLTHROUGH();
|
||||
case TxShear:
|
||||
case TxRotate:
|
||||
affine._dx += dx*affine._m11 + dy*affine._m21;
|
||||
@ -508,12 +508,12 @@ QTransform & QTransform::scale(qreal sx, qreal sy)
|
||||
case TxProject:
|
||||
m_13 *= sx;
|
||||
m_23 *= sy;
|
||||
// fall through
|
||||
Q_FALLTHROUGH();
|
||||
case TxRotate:
|
||||
case TxShear:
|
||||
affine._m12 *= sx;
|
||||
affine._m21 *= sy;
|
||||
// fall through
|
||||
Q_FALLTHROUGH();
|
||||
case TxScale:
|
||||
affine._m11 *= sx;
|
||||
affine._m22 *= sy;
|
||||
@ -581,7 +581,7 @@ QTransform & QTransform::shear(qreal sh, qreal sv)
|
||||
m_13 += tm13;
|
||||
m_23 += tm23;
|
||||
}
|
||||
// fall through
|
||||
Q_FALLTHROUGH();
|
||||
case TxRotate:
|
||||
case TxShear: {
|
||||
qreal tm11 = sv*affine._m21;
|
||||
@ -663,7 +663,7 @@ QTransform & QTransform::rotate(qreal a, Qt::Axis axis)
|
||||
qreal tm23 = -sina*m_13 + cosa*m_23;
|
||||
m_13 = tm13;
|
||||
m_23 = tm23;
|
||||
// fall through
|
||||
Q_FALLTHROUGH();
|
||||
}
|
||||
case TxRotate:
|
||||
case TxShear: {
|
||||
@ -742,7 +742,7 @@ QTransform & QTransform::rotateRadians(qreal a, Qt::Axis axis)
|
||||
qreal tm23 = -sina*m_13 + cosa*m_23;
|
||||
m_13 = tm13;
|
||||
m_23 = tm23;
|
||||
// fall through
|
||||
Q_FALLTHROUGH();
|
||||
}
|
||||
case TxRotate:
|
||||
case TxShear: {
|
||||
|
@ -50,9 +50,10 @@
|
||||
#include <QtCore/qglobal.h>
|
||||
#include <QtCore/qpoint.h>
|
||||
#include <QtCore/qalgorithms.h>
|
||||
|
||||
#include <private/qopenglcontext_p.h>
|
||||
#include <private/qopenglextensions_p.h>
|
||||
#ifndef QT_NO_OPENGL
|
||||
# include <private/qopenglcontext_p.h>
|
||||
# include <private/qopenglextensions_p.h>
|
||||
#endif
|
||||
#include <private/qrbtree_p.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
@ -873,7 +874,7 @@ void QTriangulator<T>::initialize(const QVectorPath &path, const QTransform &mat
|
||||
case QPainterPath::MoveToElement:
|
||||
if (!m_indices.isEmpty())
|
||||
m_indices.push_back(T(-1)); // Q_TRIANGULATE_END_OF_POLYGON
|
||||
// Fall through.
|
||||
Q_FALLTHROUGH();
|
||||
case QPainterPath::LineToElement:
|
||||
m_indices.push_back(T(m_vertices.size()));
|
||||
m_vertices.resize(m_vertices.size() + 1);
|
||||
@ -2099,7 +2100,7 @@ void QTriangulator<T>::SimpleToMonotone::monotoneDecomposition()
|
||||
} else {
|
||||
qWarning("Inconsistent polygon. (#3)");
|
||||
}
|
||||
// Fall through.
|
||||
Q_FALLTHROUGH();
|
||||
case StartVertex:
|
||||
if (m_clockwiseOrder) {
|
||||
leftEdgeNode = searchEdgeLeftOfEdge(j);
|
||||
@ -2128,7 +2129,7 @@ void QTriangulator<T>::SimpleToMonotone::monotoneDecomposition()
|
||||
} else {
|
||||
qWarning("Inconsistent polygon. (#4)");
|
||||
}
|
||||
// Fall through.
|
||||
Q_FALLTHROUGH();
|
||||
case EndVertex:
|
||||
if (m_clockwiseOrder) {
|
||||
if (m_edges.at(m_edges.at(i).helper).type == MergeVertex)
|
||||
@ -2267,10 +2268,14 @@ void QTriangulator<T>::MonotoneToTriangles::decompose()
|
||||
|
||||
static bool hasElementIndexUint()
|
||||
{
|
||||
#ifndef QT_NO_OPENGL
|
||||
QOpenGLContext *context = QOpenGLContext::currentContext();
|
||||
if (!context)
|
||||
return false;
|
||||
return static_cast<QOpenGLExtensions *>(context->functions())->hasOpenGLExtension(QOpenGLExtensions::ElementIndexUint);
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
Q_GUI_EXPORT QTriangleSet qTriangulate(const qreal *polygon,
|
@ -2111,7 +2111,7 @@ QString Scanner::preprocess(const QString &input, bool *hasEscapeSequences)
|
||||
|
||||
hexCount = qMin(hexCount, 6);
|
||||
bool ok = false;
|
||||
ushort code = output.mid(hexStart, hexCount).toUShort(&ok, 16);
|
||||
ushort code = output.midRef(hexStart, hexCount).toUShort(&ok, 16);
|
||||
if (ok) {
|
||||
output.replace(hexStart - 1, hexCount + 1, QChar(code));
|
||||
i = hexStart;
|
||||
|
@ -44,9 +44,9 @@
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists for the convenience
|
||||
// of the QLibrary class. This header file may change from
|
||||
// version to version without notice, or even be removed.
|
||||
// This file is not part of the Qt API. It exists purely as an
|
||||
// implementation detail. This header file may change from version to
|
||||
// version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
|
@ -1376,6 +1376,7 @@ void QFont::setStyleStrategy(StyleStrategy s)
|
||||
Predefined stretch values that follow the CSS naming convention. The higher
|
||||
the value, the more stretched the text is.
|
||||
|
||||
\value AnyStretch 0 Accept any stretch matched using the other QFont properties (added in Qt 5.8)
|
||||
\value UltraCondensed 50
|
||||
\value ExtraCondensed 62
|
||||
\value Condensed 75
|
||||
@ -1402,20 +1403,25 @@ int QFont::stretch() const
|
||||
/*!
|
||||
Sets the stretch factor for the font.
|
||||
|
||||
The stretch factor changes the width of all characters in the font
|
||||
by \a factor percent. For example, setting \a factor to 150
|
||||
The stretch factor matches a condensed or expanded version of the font or
|
||||
applies a stretch transform that changes the width of all characters
|
||||
in the font by \a factor percent. For example, setting \a factor to 150
|
||||
results in all characters in the font being 1.5 times (ie. 150%)
|
||||
wider. The default stretch factor is 100. The minimum stretch
|
||||
factor is 1, and the maximum stretch factor is 4000.
|
||||
wider. The minimum stretch factor is 1, and the maximum stretch factor
|
||||
is 4000. The default stretch factor is \c AnyStretch, which will accept
|
||||
any stretch factor and not apply any transform on the font.
|
||||
|
||||
The stretch factor is only applied to outline fonts. The stretch
|
||||
factor is ignored for bitmap fonts.
|
||||
|
||||
\note When matching a font with a native non-default stretch factor,
|
||||
requesting a stretch of 100 will stretch it back to a medium width font.
|
||||
|
||||
\sa stretch(), QFont::Stretch
|
||||
*/
|
||||
void QFont::setStretch(int factor)
|
||||
{
|
||||
if (factor < 1 || factor > 4000) {
|
||||
if (factor < 0 || factor > 4000) {
|
||||
qWarning("QFont::setStretch: Parameter '%d' out of range", factor);
|
||||
return;
|
||||
}
|
||||
|
@ -113,6 +113,7 @@ public:
|
||||
};
|
||||
|
||||
enum Stretch {
|
||||
AnyStretch = 0,
|
||||
UltraCondensed = 50,
|
||||
ExtraCondensed = 62,
|
||||
Condensed = 75,
|
||||
|
@ -71,7 +71,7 @@ struct QFontDef
|
||||
inline QFontDef()
|
||||
: pointSize(-1.0), pixelSize(-1),
|
||||
styleStrategy(QFont::PreferDefault), styleHint(QFont::AnyStyle),
|
||||
weight(50), fixedPitch(false), style(QFont::StyleNormal), stretch(100),
|
||||
weight(50), fixedPitch(false), style(QFont::StyleNormal), stretch(QFont::AnyStretch),
|
||||
hintingPreference(QFont::PreferDefaultHinting), ignorePitch(true),
|
||||
fixedPitchComputed(0), reserved(0)
|
||||
{
|
||||
|
@ -951,12 +951,14 @@ QFontEngine *loadSingleEngine(int script,
|
||||
}
|
||||
}
|
||||
|
||||
// If the font data's native stretch matches the requested stretch we need to set stretch to 100
|
||||
// to avoid the fontengine synthesizing stretch. If they didn't match exactly we need to calculate
|
||||
// the new stretch factor. This only done if not matched by styleName.
|
||||
// To avoid synthesized stretch we need a matching stretch to be 100 after this point.
|
||||
// If stretch didn't match exactly we need to calculate the new stretch factor.
|
||||
// This only done if not matched by styleName.
|
||||
if (style->key.stretch != 0 && request.stretch != 0
|
||||
&& (request.styleName.isEmpty() || request.styleName != style->styleName)) {
|
||||
def.stretch = (request.stretch * 100 + 50) / style->key.stretch;
|
||||
def.stretch = (request.stretch * 100 + style->key.stretch / 2) / style->key.stretch;
|
||||
} else {
|
||||
def.stretch = 100;
|
||||
}
|
||||
|
||||
engine = pfdb->fontEngine(def, size->handle);
|
||||
@ -1219,7 +1221,8 @@ static int match(int script, const QFontDef &request,
|
||||
QtFontStyle::Key styleKey;
|
||||
styleKey.style = request.style;
|
||||
styleKey.weight = request.weight;
|
||||
styleKey.stretch = request.stretch;
|
||||
// Prefer a stretch closest to 100.
|
||||
styleKey.stretch = request.stretch ? request.stretch : 100;
|
||||
char pitch = request.ignorePitch ? '*' : request.fixedPitch ? 'm' : 'p';
|
||||
|
||||
|
||||
@ -2740,8 +2743,6 @@ void QFontDatabase::load(const QFontPrivate *d, int script)
|
||||
}
|
||||
if (req.pointSize < 0)
|
||||
req.pointSize = req.pixelSize*72.0/d->dpi;
|
||||
if (req.stretch == 0)
|
||||
req.stretch = 100;
|
||||
|
||||
// respect the fallback families that might be passed through the request
|
||||
const QStringList fallBackFamilies = familyList(req);
|
||||
|
@ -418,6 +418,13 @@ glyph_metrics_t QFontEngine::boundingBox(glyph_t glyph, const QTransform &matrix
|
||||
return metrics;
|
||||
}
|
||||
|
||||
QFixed QFontEngine::calculatedCapHeight() const
|
||||
{
|
||||
const glyph_t glyph = glyphIndex('H');
|
||||
glyph_metrics_t bb = const_cast<QFontEngine *>(this)->boundingBox(glyph);
|
||||
return bb.height;
|
||||
}
|
||||
|
||||
QFixed QFontEngine::xHeight() const
|
||||
{
|
||||
const glyph_t glyph = glyphIndex('x');
|
||||
@ -1703,6 +1710,11 @@ QFixed QFontEngineBox::ascent() const
|
||||
return _size;
|
||||
}
|
||||
|
||||
QFixed QFontEngineBox::capHeight() const
|
||||
{
|
||||
return _size;
|
||||
}
|
||||
|
||||
QFixed QFontEngineBox::descent() const
|
||||
{
|
||||
return 0;
|
||||
@ -2163,6 +2175,9 @@ glyph_metrics_t QFontEngineMulti::boundingBox(glyph_t glyph)
|
||||
QFixed QFontEngineMulti::ascent() const
|
||||
{ return engine(0)->ascent(); }
|
||||
|
||||
QFixed QFontEngineMulti::capHeight() const
|
||||
{ return engine(0)->capHeight(); }
|
||||
|
||||
QFixed QFontEngineMulti::descent() const
|
||||
{ return engine(0)->descent(); }
|
||||
|
||||
|
@ -414,6 +414,7 @@ QFontEngine::Properties QFreetypeFace::properties() const
|
||||
p.italicAngle = 0;
|
||||
p.capHeight = p.ascent;
|
||||
p.lineWidth = face->underline_thickness;
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
@ -585,8 +586,7 @@ static void convertRGBToARGB_helper(const uchar *src, uint *dst, int width, int
|
||||
uchar green = src[x + 1];
|
||||
uchar blue = src[x + 1 + offs];
|
||||
LcdFilter::filterPixel(red, green, blue);
|
||||
// alpha = green
|
||||
*dd++ = (green << 24) | (red << 16) | (green << 8) | blue;
|
||||
*dd++ = (0xFF << 24) | (red << 16) | (green << 8) | blue;
|
||||
}
|
||||
dst += width;
|
||||
src += src_pitch;
|
||||
@ -611,8 +611,7 @@ static void convertRGBToARGB_V_helper(const uchar *src, uint *dst, int width, in
|
||||
uchar green = src[x + src_pitch];
|
||||
uchar blue = src[x + src_pitch + offs];
|
||||
LcdFilter::filterPixel(red, green, blue);
|
||||
// alpha = green
|
||||
*dst++ = (green << 24) | (red << 16) | (green << 8) | blue;
|
||||
*dst++ = (0XFF << 24) | (red << 16) | (green << 8) | blue;
|
||||
}
|
||||
src += 3*src_pitch;
|
||||
}
|
||||
@ -1299,6 +1298,18 @@ QFixed QFontEngineFT::ascent() const
|
||||
return v;
|
||||
}
|
||||
|
||||
QFixed QFontEngineFT::capHeight() const
|
||||
{
|
||||
TT_OS2 *os2 = (TT_OS2 *)FT_Get_Sfnt_Table(freetype->face, ft_sfnt_os2);
|
||||
if (os2 && os2->version >= 2) {
|
||||
lockFace();
|
||||
QFixed answer = QFixed::fromFixed(FT_MulFix(os2->sCapHeight, freetype->face->size->metrics.y_scale));
|
||||
unlockFace();
|
||||
return answer;
|
||||
}
|
||||
return calculatedCapHeight();
|
||||
}
|
||||
|
||||
QFixed QFontEngineFT::descent() const
|
||||
{
|
||||
QFixed v = QFixed::fromFixed(-metrics.descender);
|
||||
@ -1317,33 +1328,25 @@ QFixed QFontEngineFT::leading() const
|
||||
|
||||
QFixed QFontEngineFT::xHeight() const
|
||||
{
|
||||
if (!isScalableBitmap()) {
|
||||
TT_OS2 *os2 = (TT_OS2 *)FT_Get_Sfnt_Table(freetype->face, ft_sfnt_os2);
|
||||
if (os2 && os2->sxHeight) {
|
||||
lockFace();
|
||||
QFixed answer = QFixed(os2->sxHeight * freetype->face->size->metrics.y_ppem) / emSquareSize();
|
||||
unlockFace();
|
||||
return answer;
|
||||
}
|
||||
} else {
|
||||
return QFixed(freetype->face->size->metrics.y_ppem) * scalableBitmapScaleFactor;
|
||||
TT_OS2 *os2 = (TT_OS2 *)FT_Get_Sfnt_Table(freetype->face, ft_sfnt_os2);
|
||||
if (os2 && os2->sxHeight) {
|
||||
lockFace();
|
||||
QFixed answer = QFixed(os2->sxHeight * freetype->face->size->metrics.y_ppem) / emSquareSize();
|
||||
unlockFace();
|
||||
return answer;
|
||||
}
|
||||
|
||||
return QFontEngine::xHeight();
|
||||
}
|
||||
|
||||
QFixed QFontEngineFT::averageCharWidth() const
|
||||
{
|
||||
if (!isScalableBitmap()) {
|
||||
TT_OS2 *os2 = (TT_OS2 *)FT_Get_Sfnt_Table(freetype->face, ft_sfnt_os2);
|
||||
if (os2 && os2->xAvgCharWidth) {
|
||||
lockFace();
|
||||
QFixed answer = QFixed(os2->xAvgCharWidth * freetype->face->size->metrics.x_ppem) / emSquareSize();
|
||||
unlockFace();
|
||||
return answer;
|
||||
}
|
||||
} else {
|
||||
const qreal aspectRatio = (qreal)xsize / ysize;
|
||||
return QFixed::fromReal(fontDef.pixelSize * aspectRatio);
|
||||
TT_OS2 *os2 = (TT_OS2 *)FT_Get_Sfnt_Table(freetype->face, ft_sfnt_os2);
|
||||
if (os2 && os2->xAvgCharWidth) {
|
||||
lockFace();
|
||||
QFixed answer = QFixed(os2->xAvgCharWidth * freetype->face->size->metrics.x_ppem) / emSquareSize();
|
||||
unlockFace();
|
||||
return answer;
|
||||
}
|
||||
|
||||
return QFontEngine::averageCharWidth();
|
||||
@ -1842,7 +1845,7 @@ static inline QImage alphaMapFromGlyphData(QFontEngineFT::Glyph *glyph, QFontEng
|
||||
bytesPerLine = (glyph->width + 3) & ~3;
|
||||
break;
|
||||
case QFontEngine::Format_A32:
|
||||
format = QImage::Format_ARGB32;
|
||||
format = QImage::Format_RGB32;
|
||||
bytesPerLine = glyph->width * 4;
|
||||
break;
|
||||
default:
|
||||
|
@ -209,6 +209,7 @@ private:
|
||||
int synthesized() const Q_DECL_OVERRIDE;
|
||||
|
||||
QFixed ascent() const Q_DECL_OVERRIDE;
|
||||
QFixed capHeight() const Q_DECL_OVERRIDE;
|
||||
QFixed descent() const Q_DECL_OVERRIDE;
|
||||
QFixed leading() const Q_DECL_OVERRIDE;
|
||||
QFixed xHeight() const Q_DECL_OVERRIDE;
|
||||
|
@ -211,6 +211,7 @@ public:
|
||||
glyph_metrics_t tightBoundingBox(const QGlyphLayout &glyphs);
|
||||
|
||||
virtual QFixed ascent() const = 0;
|
||||
virtual QFixed capHeight() const = 0;
|
||||
virtual QFixed descent() const = 0;
|
||||
virtual QFixed leading() const = 0;
|
||||
virtual QFixed xHeight() const;
|
||||
@ -348,6 +349,7 @@ protected:
|
||||
QFixed lastRightBearing(const QGlyphLayout &glyphs, bool round = false);
|
||||
|
||||
inline void setUserData(const QVariant &userData) { m_userData = userData; }
|
||||
QFixed calculatedCapHeight() const;
|
||||
|
||||
private:
|
||||
struct GlyphCacheEntry {
|
||||
@ -414,6 +416,7 @@ public:
|
||||
virtual QFontEngine *cloneWithSize(qreal pixelSize) const Q_DECL_OVERRIDE;
|
||||
|
||||
virtual QFixed ascent() const Q_DECL_OVERRIDE;
|
||||
virtual QFixed capHeight() const Q_DECL_OVERRIDE;
|
||||
virtual QFixed descent() const Q_DECL_OVERRIDE;
|
||||
virtual QFixed leading() const Q_DECL_OVERRIDE;
|
||||
virtual qreal maxCharWidth() const Q_DECL_OVERRIDE;
|
||||
@ -451,6 +454,7 @@ public:
|
||||
virtual void getGlyphBearings(glyph_t glyph, qreal *leftBearing = 0, qreal *rightBearing = 0) Q_DECL_OVERRIDE;
|
||||
|
||||
virtual QFixed ascent() const Q_DECL_OVERRIDE;
|
||||
virtual QFixed capHeight() const Q_DECL_OVERRIDE;
|
||||
virtual QFixed descent() const Q_DECL_OVERRIDE;
|
||||
virtual QFixed leading() const Q_DECL_OVERRIDE;
|
||||
virtual QFixed xHeight() const Q_DECL_OVERRIDE;
|
||||
|
@ -459,6 +459,11 @@ QFixed QFontEngineQPF2::ascent() const
|
||||
return QFixed::fromReal(extractHeaderField(fontData, Tag_Ascent).value<qreal>());
|
||||
}
|
||||
|
||||
QFixed QFontEngineQPF2::capHeight() const
|
||||
{
|
||||
return calculatedCapHeight();
|
||||
}
|
||||
|
||||
QFixed QFontEngineQPF2::descent() const
|
||||
{
|
||||
return QFixed::fromReal(extractHeaderField(fontData, Tag_Descent).value<qreal>());
|
||||
|
@ -172,6 +172,7 @@ public:
|
||||
glyph_metrics_t boundingBox(glyph_t glyph) Q_DECL_OVERRIDE;
|
||||
|
||||
QFixed ascent() const Q_DECL_OVERRIDE;
|
||||
QFixed capHeight() const Q_DECL_OVERRIDE;
|
||||
QFixed descent() const Q_DECL_OVERRIDE;
|
||||
QFixed leading() const Q_DECL_OVERRIDE;
|
||||
qreal maxCharWidth() const Q_DECL_OVERRIDE;
|
||||
|
@ -274,6 +274,24 @@ int QFontMetrics::ascent() const
|
||||
return qRound(engine->ascent());
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the cap height of the font.
|
||||
|
||||
\since 5.8
|
||||
|
||||
The cap height of a font is the height of a capital letter above
|
||||
the baseline. It specifically is the height of capital letters
|
||||
that are flat - such as H or I - as opposed to round letters such
|
||||
as O, or pointed letters like A, both of which may display overshoot.
|
||||
|
||||
\sa ascent()
|
||||
*/
|
||||
int QFontMetrics::capHeight() const
|
||||
{
|
||||
QFontEngine *engine = d->engineForScript(QChar::Script_Common);
|
||||
Q_ASSERT(engine != 0);
|
||||
return qRound(engine->capHeight());
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the descent of the font.
|
||||
@ -1138,6 +1156,24 @@ qreal QFontMetricsF::ascent() const
|
||||
return engine->ascent().toReal();
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the cap height of the font.
|
||||
|
||||
\since 5.8
|
||||
|
||||
The cap height of a font is the height of a capital letter above
|
||||
the baseline. It specifically is the height of capital letters
|
||||
that are flat - such as H or I - as opposed to round letters such
|
||||
as O, or pointed letters like A, both of which may display overshoot.
|
||||
|
||||
\sa ascent()
|
||||
*/
|
||||
qreal QFontMetricsF::capHeight() const
|
||||
{
|
||||
QFontEngine *engine = d->engineForScript(QChar::Script_Common);
|
||||
Q_ASSERT(engine != 0);
|
||||
return engine->capHeight().toReal();
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the descent of the font.
|
||||
|
@ -73,6 +73,7 @@ public:
|
||||
{ qSwap(d, other.d); }
|
||||
|
||||
int ascent() const;
|
||||
int capHeight() const;
|
||||
int descent() const;
|
||||
int height() const;
|
||||
int leading() const;
|
||||
@ -146,6 +147,7 @@ public:
|
||||
void swap(QFontMetricsF &other) { qSwap(d, other.d); }
|
||||
|
||||
qreal ascent() const;
|
||||
qreal capHeight() const;
|
||||
qreal descent() const;
|
||||
qreal height() const;
|
||||
qreal leading() const;
|
||||
|
@ -740,7 +740,7 @@ static void convertPath(const QPainterPath &path, QVector<TTF_POINT> *points, QV
|
||||
points->takeLast();
|
||||
endPoints->append(points->size() - 1);
|
||||
}
|
||||
// fall through
|
||||
Q_FALLTHROUGH();
|
||||
case QPainterPath::LineToElement:
|
||||
p.flags = OnCurve;
|
||||
break;
|
||||
@ -966,7 +966,7 @@ static QTtfGlyph generateGlyph(int index, const QPainterPath &path, qreal advanc
|
||||
glyph.advanceWidth = qRound(advance * 2048. / ppem);
|
||||
glyph.lsb = qRound(lsb * 2048. / ppem);
|
||||
|
||||
if (!path.elementCount()) {
|
||||
if (path.isEmpty()) {
|
||||
//qDebug("glyph %d is empty", index);
|
||||
lsb = 0;
|
||||
glyph.xMin = glyph.xMax = glyph.yMin = glyph.yMax = 0;
|
||||
|
@ -324,6 +324,23 @@ qreal QRawFont::ascent() const
|
||||
return d->isValid() ? d->fontEngine->ascent().toReal() : 0.0;
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the cap height of this QRawFont in pixel units.
|
||||
|
||||
\since 5.8
|
||||
|
||||
The cap height of a font is the height of a capital letter above
|
||||
the baseline. It specifically is the height of capital letters
|
||||
that are flat - such as H or I - as opposed to round letters such
|
||||
as O, or pointed letters like A, both of which may display overshoot.
|
||||
|
||||
\sa QFontMetricsF::capHeight()
|
||||
*/
|
||||
qreal QRawFont::capHeight() const
|
||||
{
|
||||
return d->isValid() ? d->fontEngine->capHeight().toReal() : 0.0;
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the descent of this QRawFont in pixel units.
|
||||
|
||||
|
@ -118,6 +118,7 @@ public:
|
||||
QFont::HintingPreference hintingPreference() const;
|
||||
|
||||
qreal ascent() const;
|
||||
qreal capHeight() const;
|
||||
qreal descent() const;
|
||||
qreal leading() const;
|
||||
qreal xHeight() const;
|
||||
|
@ -438,7 +438,7 @@ bool QTextCursorPrivate::movePosition(QTextCursor::MoveOperation op, QTextCursor
|
||||
if (relativePos < blockIt.length()-1)
|
||||
++position;
|
||||
|
||||
// FALL THROUGH!
|
||||
Q_FALLTHROUGH();
|
||||
}
|
||||
case QTextCursor::PreviousWord:
|
||||
case QTextCursor::WordLeft:
|
||||
@ -590,9 +590,9 @@ bool QTextCursorPrivate::movePosition(QTextCursor::MoveOperation op, QTextCursor
|
||||
adjustX = false;
|
||||
break;
|
||||
}
|
||||
case QTextCursor::NextCell: // fall through
|
||||
case QTextCursor::PreviousCell: // fall through
|
||||
case QTextCursor::NextRow: // fall through
|
||||
case QTextCursor::NextCell:
|
||||
case QTextCursor::PreviousCell:
|
||||
case QTextCursor::NextRow:
|
||||
case QTextCursor::PreviousRow: {
|
||||
QTextTable *table = qobject_cast<QTextTable *>(priv->frameAt(position));
|
||||
if (!table)
|
||||
|
@ -131,7 +131,7 @@ static bool isValidBlockSeparator(QChar ch)
|
||||
|| ch == QTextEndOfFrame;
|
||||
}
|
||||
|
||||
static bool noBlockInString(const QString &str)
|
||||
static bool noBlockInString(const QStringRef &str)
|
||||
{
|
||||
return !str.contains(QChar::ParagraphSeparator)
|
||||
&& !str.contains(QTextBeginningOfFrame)
|
||||
@ -320,7 +320,7 @@ void QTextDocumentPrivate::setLayout(QAbstractTextDocumentLayout *layout)
|
||||
void QTextDocumentPrivate::insert_string(int pos, uint strPos, uint length, int format, QTextUndoCommand::Operation op)
|
||||
{
|
||||
// ##### optimize when only appending to the fragment!
|
||||
Q_ASSERT(noBlockInString(text.mid(strPos, length)));
|
||||
Q_ASSERT(noBlockInString(text.midRef(strPos, length)));
|
||||
|
||||
split(pos);
|
||||
uint x = fragments.insert_single(pos, length);
|
||||
@ -476,7 +476,7 @@ void QTextDocumentPrivate::insert(int pos, const QString &str, int format)
|
||||
if (str.size() == 0)
|
||||
return;
|
||||
|
||||
Q_ASSERT(noBlockInString(str));
|
||||
Q_ASSERT(noBlockInString(QStringRef(&str)));
|
||||
|
||||
int strPos = text.length();
|
||||
text.append(str);
|
||||
@ -494,7 +494,7 @@ int QTextDocumentPrivate::remove_string(int pos, uint length, QTextUndoCommand::
|
||||
|
||||
Q_ASSERT(blocks.size(b) > length);
|
||||
Q_ASSERT(x && fragments.position(x) == (uint)pos && fragments.size(x) == length);
|
||||
Q_ASSERT(noBlockInString(text.mid(fragments.fragment(x)->stringPosition, length)));
|
||||
Q_ASSERT(noBlockInString(text.midRef(fragments.fragment(x)->stringPosition, length)));
|
||||
|
||||
blocks.setSize(b, blocks.size(b)-length);
|
||||
|
||||
@ -629,7 +629,7 @@ void QTextDocumentPrivate::move(int pos, int to, int length, QTextUndoCommand::O
|
||||
|
||||
if (key+1 != blocks.position(b)) {
|
||||
// qDebug("remove_string from %d length %d", key, X->size_array[0]);
|
||||
Q_ASSERT(noBlockInString(text.mid(X->stringPosition, X->size_array[0])));
|
||||
Q_ASSERT(noBlockInString(text.midRef(X->stringPosition, X->size_array[0])));
|
||||
w = remove_string(key, X->size_array[0], op);
|
||||
|
||||
if (needsInsert) {
|
||||
|
@ -827,7 +827,7 @@ bool QTextHtmlImporter::closeTag()
|
||||
case Html_div:
|
||||
if (closedNode->children.isEmpty())
|
||||
break;
|
||||
// fall through
|
||||
Q_FALLTHROUGH();
|
||||
default:
|
||||
if (closedNode->isBlock())
|
||||
blockTagClosed = true;
|
||||
|
@ -508,7 +508,7 @@ static bool bidiItemize(QTextEngine *engine, QScriptAnalysis *analysis, QBidiCon
|
||||
case QChar::DirAN:
|
||||
if (eor >= 0)
|
||||
appendItems(analysis, sor, eor, control, dir);
|
||||
// fall through
|
||||
Q_FALLTHROUGH();
|
||||
case QChar::DirR:
|
||||
case QChar::DirAL:
|
||||
dir = QChar::DirR; eor = current; status.eor = QChar::DirR; break;
|
||||
@ -564,7 +564,7 @@ static bool bidiItemize(QTextEngine *engine, QScriptAnalysis *analysis, QBidiCon
|
||||
status.eor = QChar::DirON;
|
||||
dir = QChar::DirAN;
|
||||
}
|
||||
// fall through
|
||||
Q_FALLTHROUGH();
|
||||
case QChar::DirEN:
|
||||
case QChar::DirL:
|
||||
eor = current;
|
||||
@ -744,7 +744,7 @@ static bool bidiItemize(QTextEngine *engine, QScriptAnalysis *analysis, QBidiCon
|
||||
status.last = QChar::DirL;
|
||||
break;
|
||||
}
|
||||
// fall through
|
||||
Q_FALLTHROUGH();
|
||||
default:
|
||||
status.last = dirCurrent;
|
||||
}
|
||||
@ -1664,7 +1664,7 @@ void QTextEngine::itemize() const
|
||||
analysis->bidiLevel = control.baseLevel();
|
||||
break;
|
||||
}
|
||||
// fall through
|
||||
Q_FALLTHROUGH();
|
||||
default:
|
||||
analysis->flags = QScriptAnalysis::None;
|
||||
break;
|
||||
@ -2251,7 +2251,6 @@ void QTextEngine::justify(const QScriptLine &line)
|
||||
case Justification_Prohibited:
|
||||
break;
|
||||
case Justification_Space:
|
||||
// fall through
|
||||
case Justification_Arabic_Space:
|
||||
if (kashida_pos >= 0) {
|
||||
// qDebug("kashida position at %d in word", kashida_pos);
|
||||
@ -2264,7 +2263,7 @@ void QTextEngine::justify(const QScriptLine &line)
|
||||
}
|
||||
kashida_pos = -1;
|
||||
kashida_type = Justification_Arabic_Normal;
|
||||
// fall through
|
||||
Q_FALLTHROUGH();
|
||||
case Justification_Character:
|
||||
set(&justificationPoints[nPoints++], justification, g.mid(i), fontEngine(si));
|
||||
maxJustify = qMax(maxJustify, justification);
|
||||
@ -2712,7 +2711,7 @@ static QString stringMidRetainingBidiCC(const QString &string,
|
||||
suffix += c;
|
||||
}
|
||||
|
||||
return prefix + ellidePrefix + string.mid(midStart, midLength) + ellideSuffix + suffix;
|
||||
return prefix + ellidePrefix + string.midRef(midStart, midLength) + ellideSuffix + suffix;
|
||||
}
|
||||
|
||||
QString QTextEngine::elidedText(Qt::TextElideMode mode, const QFixed &width, int flags, int from, int count) const
|
||||
@ -2875,7 +2874,7 @@ QString QTextEngine::elidedText(Qt::TextElideMode mode, const QFixed &width, int
|
||||
if (prevCharJoins(layoutData->string, rightPos))
|
||||
ellipsisText.append(QChar(0x200d) /* ZWJ */);
|
||||
|
||||
return layoutData->string.mid(from, leftPos - from) + ellipsisText + layoutData->string.mid(rightPos, to - rightPos);
|
||||
return layoutData->string.midRef(from, leftPos - from) + ellipsisText + layoutData->string.midRef(rightPos, to - rightPos);
|
||||
}
|
||||
|
||||
return layoutData->string.mid(from, to - from);
|
||||
@ -2967,9 +2966,8 @@ QFixed QTextEngine::calculateTabWidth(int item, QFixed x) const
|
||||
switch (tabSpec.type) {
|
||||
case QTextOption::CenterTab:
|
||||
length /= 2;
|
||||
// fall through
|
||||
Q_FALLTHROUGH();
|
||||
case QTextOption::DelimiterTab:
|
||||
// fall through
|
||||
case QTextOption::RightTab:
|
||||
tab = QFixed::fromReal(tabSpec.position) * dpiScale - length;
|
||||
if (tab < x) // default to tab taking no space
|
||||
|
@ -1871,7 +1871,7 @@ QVector<QCss::Declaration> standardDeclarationForNode(const QTextHtmlParserNode
|
||||
decls << decl;
|
||||
if (node.id == Html_b || node.id == Html_strong)
|
||||
break;
|
||||
// Delibrate fall through
|
||||
Q_FALLTHROUGH();
|
||||
case Html_big:
|
||||
case Html_small:
|
||||
if (node.id != Html_th) {
|
||||
@ -1892,7 +1892,7 @@ QVector<QCss::Declaration> standardDeclarationForNode(const QTextHtmlParserNode
|
||||
decls << decl;
|
||||
break;
|
||||
}
|
||||
// Delibrate fall through
|
||||
Q_FALLTHROUGH();
|
||||
case Html_center:
|
||||
case Html_td:
|
||||
decl = QCss::Declaration();
|
||||
@ -1969,7 +1969,7 @@ QVector<QCss::Declaration> standardDeclarationForNode(const QTextHtmlParserNode
|
||||
}
|
||||
if (node.id != Html_pre)
|
||||
break;
|
||||
// Delibrate fall through
|
||||
Q_FALLTHROUGH();
|
||||
case Html_br:
|
||||
case Html_nobr:
|
||||
decl = QCss::Declaration();
|
||||
|
@ -48,9 +48,9 @@
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists for the convenience
|
||||
// of the QLibrary class. This header file may change from
|
||||
// version to version without notice, or even be removed.
|
||||
// This file is not part of the Qt API. It exists purely as an
|
||||
// implementation detail. This header file may change from version to
|
||||
// version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user