Merge "Merge remote-tracking branch 'origin/release' into stable" into refs/staging/stable

This commit is contained in:
Frederik Gladhorn 2013-11-20 12:18:23 +01:00 committed by The Qt Project
commit c83c08d84f
101 changed files with 1382 additions and 549 deletions

View File

@ -1,4 +1,16 @@
SOURCES = icu.cpp
CONFIG += console
CONFIG -= qt dylib
unix:LIBS += -licuuc -licui18n
win32:LIBS += -licuin
win32 {
CONFIG(static, static|shared) {
CONFIG(debug, debug|release) {
LIBS += -lsicuind -lsicuucd -lsicudtd
} else {
LIBS += -lsicuin -lsicuuc -lsicudt
}
} else {
LIBS += -licuin -licuuc
}
} else {
LIBS += -licui18n -licuuc
}

2
configure vendored
View File

@ -3758,6 +3758,8 @@ Qt/Mac only:
-sdk <sdk> ......... Build Qt using Apple provided SDK <sdk>. The argument should be
one of the available SDKs as listed by 'xcodebuild -showsdks'.
Note that the argument applies only to Qt libraries and applications built
using the target mkspec - not host tools such as qmake, moc, rcc, etc.
EOF
fi

8
dist/changes-5.2.0 vendored
View File

@ -158,6 +158,14 @@ Changes in Qt 5.2.0
* Platform Specific Changes *
****************************************************************************
Qt for Windows
--------------
- QCoreApplication::arguments() changed the handling of single quotes, double quotes
and the backslash character, in order to match what argv[] contains.
In particular, single quotes are no longer removed from the argument string.
(QTBUG-15379, QTBUG-30628)
Qt for Android
--------------
- Project structure and deployment has changed with the introduction of

View File

@ -15,6 +15,7 @@ defines += Q_QDOC \
Q_NO_USING_KEYWORD \
__cplusplus \
Q_COMPILER_INITIALIZER_LISTS \
Q_COMPILER_UNIFORM_INIT \
Q_COMPILER_RVALUE_REFS
Cpp.ignoretokens += \

View File

@ -19,13 +19,8 @@ qt:!isEmpty(QT_CONFIG) {
contains(QT_CONFIG, static):contains(QT_CONFIG, c++11): CONFIG += c++11
}
isEmpty(_QMAKE_CACHE_) {
warning("No .qmake.cache is present. This significantly slows down qmake with this makespec.")
warning("Call 'cache()' in the top-level project file to rectify this problem.")
} else {
cache(QMAKE_XCODE_DEVELOPER_PATH)
cache(QMAKE_XCODE_VERSION)
}
cache(QMAKE_XCODE_DEVELOPER_PATH, stash)
cache(QMAKE_XCODE_VERSION, stash)
QMAKE_XCODE_LIBRARY_SUFFIX = $$qtPlatformTargetSuffix()

View File

@ -8,7 +8,7 @@ contains(QMAKE_MAC_SDK, .*/.*): \
isEmpty(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.path) {
QMAKE_MAC_SDK_PATH = $$system("/usr/bin/xcodebuild -sdk $$QMAKE_MAC_SDK -version Path 2>/dev/null")
isEmpty(QMAKE_MAC_SDK_PATH): error("Could not resolve SDK path for \'$$QMAKE_MAC_SDK\'")
!isEmpty(_QMAKE_CACHE_): cache(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.path, set, QMAKE_MAC_SDK_PATH)
cache(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.path, set stash, QMAKE_MAC_SDK_PATH)
} else {
QMAKE_MAC_SDK_PATH = $$eval(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.path)
}
@ -41,7 +41,7 @@ for(tool, $$list(QMAKE_CC QMAKE_CXX QMAKE_FIX_RPATH QMAKE_AR QMAKE_RANLIB QMAKE_
isEmpty(sysrooted): next()
$$tool = $$sysrooted $$member(value, 1, -1)
!isEmpty(_QMAKE_CACHE_): cache($$tool_variable, set, $$tool)
cache($$tool_variable, set stash, $$tool)
}
isEmpty(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.platform_name) {
@ -52,7 +52,7 @@ isEmpty(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.platform_name) {
"sed 's/.*Value: \\(.*\\)/\\1/'")
isEmpty(QMAKE_MAC_PLATFORM_NAME): error("Could not resolve platform name for SDK '$$QMAKE_MAC_SDK'")
!isEmpty(_QMAKE_CACHE_): cache(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.platform_name, set, QMAKE_MAC_PLATFORM_NAME)
cache(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.platform_name, set stash, QMAKE_MAC_PLATFORM_NAME)
} else {
QMAKE_MAC_PLATFORM_NAME = $$eval(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.platform_name)
}

View File

@ -83,7 +83,7 @@ contains(qt_module_deps, qml): \
qtPrepareTool(QMLIMPORTSCANNER, qmlimportscanner)
for (MODULE, QT_MODULES) {
PATH = $$eval(QT.$${MODULE}.qml)
!isEmpty(PATH): QMLPATHS += $$PATH
!isEmpty(PATH):exists($$PATH): QMLPATHS += $$PATH
}
QMLPATHS = $$unique(QMLPATHS)
for (QMLPATH, QMLPATHS): \

View File

@ -95,7 +95,7 @@ mac:CONFIG(shared, static|shared):contains(QT_CONFIG, qt_framework) {
#QMAKE_FRAMEWORK_VERSION = 4.0
CONFIG += lib_bundle sliced_bundle qt_framework
CONFIG -= qt_install_headers #no need to install these as well
!debug_and_release|if(build_all:CONFIG(release, debug|release)) {
!debug_and_release|!build_all|CONFIG(release, debug|release) {
FRAMEWORK_HEADERS.version = Versions
FRAMEWORK_HEADERS.files = $$SYNCQT.HEADER_FILES $$SYNCQT.HEADER_CLASSES
FRAMEWORK_HEADERS.path = Headers

View File

@ -2773,7 +2773,7 @@
Basic test functions are implemented as built-in functions.
\section2 cache(variablename, [set|add|sub] [transient] [super], [source variablename])
\section2 cache(variablename, [set|add|sub] [transient] [super|stash], [source variablename])
This is an internal function that you will typically not need.

View File

@ -1590,11 +1590,11 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
}
case T_CACHE: {
if (args.count() > 3) {
evalError(fL1S("cache(var, [set|add|sub] [transient] [super], [srcvar]) requires one to three arguments."));
evalError(fL1S("cache(var, [set|add|sub] [transient] [super|stash], [srcvar]) requires one to three arguments."));
return ReturnFalse;
}
bool persist = true;
bool super = false;
enum { TargetStash, TargetCache, TargetSuper } target = TargetCache;
enum { CacheSet, CacheAdd, CacheSub } mode = CacheSet;
ProKey srcvar;
if (args.count() >= 2) {
@ -1603,7 +1603,9 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
if (m_tmp3 == QLatin1String("transient")) {
persist = false;
} else if (m_tmp3 == QLatin1String("super")) {
super = true;
target = TargetSuper;
} else if (m_tmp3 == QLatin1String("stash")) {
target = TargetStash;
} else if (m_tmp3 == QLatin1String("set")) {
mode = CacheSet;
} else if (m_tmp3 == QLatin1String("add")) {
@ -1642,7 +1644,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
m_option->mutex.lock();
#endif
QMakeBaseEnv *baseEnv =
m_option->baseEnvs.value(QMakeBaseKey(m_buildRoot, hostBuild));
m_option->baseEnvs.value(QMakeBaseKey(m_buildRoot, m_stashfile, hostBuild));
#ifdef PROEVALUATOR_THREAD_SAFE
// It's ok to unlock this before locking baseEnv,
// as we have no intention to initialize the env.
@ -1675,21 +1677,23 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
removeEach(&newval, diffval);
}
if (oldval != newval) {
baseEval->valuesRef(dstvar) = newval;
if (super) {
do {
if (dstvar == QLatin1String("QMAKEPATH")) {
baseEval->m_qmakepath = newval.toQStringList();
baseEval->updateMkspecPaths();
} else if (dstvar == QLatin1String("QMAKEFEATURES")) {
baseEval->m_qmakefeatures = newval.toQStringList();
} else {
break;
}
baseEval->updateFeaturePaths();
if (hostBuild == m_hostBuild)
m_featureRoots = baseEval->m_featureRoots;
} while (false);
if (target != TargetStash || !m_stashfile.isEmpty()) {
baseEval->valuesRef(dstvar) = newval;
if (target == TargetSuper) {
do {
if (dstvar == QLatin1String("QMAKEPATH")) {
baseEval->m_qmakepath = newval.toQStringList();
baseEval->updateMkspecPaths();
} else if (dstvar == QLatin1String("QMAKEFEATURES")) {
baseEval->m_qmakefeatures = newval.toQStringList();
} else {
break;
}
baseEval->updateFeaturePaths();
if (hostBuild == m_hostBuild)
m_featureRoots = baseEval->m_featureRoots;
} while (false);
}
}
changed = true;
}
@ -1720,16 +1724,16 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
varstr += QLatin1Char('\n');
}
QString fn;
if (super) {
if (target == TargetSuper) {
if (m_superfile.isEmpty()) {
m_superfile = m_outputDir + QLatin1String("/.qmake.super");
m_superfile = QDir::cleanPath(m_outputDir + QLatin1String("/.qmake.super"));
printf("Info: creating super cache file %s\n", qPrintable(m_superfile));
valuesRef(ProKey("_QMAKE_SUPER_CACHE_")) << ProString(m_superfile);
}
fn = m_superfile;
} else {
} else if (target == TargetCache) {
if (m_cachefile.isEmpty()) {
m_cachefile = m_outputDir + QLatin1String("/.qmake.cache");
m_cachefile = QDir::cleanPath(m_outputDir + QLatin1String("/.qmake.cache"));
printf("Info: creating cache file %s\n", qPrintable(m_cachefile));
valuesRef(ProKey("_QMAKE_CACHE_")) << ProString(m_cachefile);
// We could update m_{source,build}Root and m_featureRoots here, or even
@ -1739,6 +1743,14 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
// The sub-projects will find the new cache all by themselves.
}
fn = m_cachefile;
} else {
fn = m_stashfile;
if (fn.isEmpty())
fn = QDir::cleanPath(m_outputDir + QLatin1String("/.qmake.stash"));
if (!m_vfs->exists(fn)) {
printf("Info: creating stash file %s\n", qPrintable(fn));
valuesRef(ProKey("_QMAKE_STASH_")) << ProString(fn);
}
}
return writeFile(fL1S("cache "), fn, QIODevice::Append, varstr);
}

View File

@ -79,19 +79,19 @@ QT_BEGIN_NAMESPACE
#define fL1S(s) QString::fromLatin1(s)
QMakeBaseKey::QMakeBaseKey(const QString &_root, bool _hostBuild)
: root(_root), hostBuild(_hostBuild)
QMakeBaseKey::QMakeBaseKey(const QString &_root, const QString &_stash, bool _hostBuild)
: root(_root), stash(_stash), hostBuild(_hostBuild)
{
}
uint qHash(const QMakeBaseKey &key)
{
return qHash(key.root) ^ (uint)key.hostBuild;
return qHash(key.root) ^ qHash(key.stash) ^ (uint)key.hostBuild;
}
bool operator==(const QMakeBaseKey &one, const QMakeBaseKey &two)
{
return one.root == two.root && one.hostBuild == two.hostBuild;
return one.root == two.root && one.stash == two.stash && one.hostBuild == two.hostBuild;
}
QMakeBaseEnv::QMakeBaseEnv()
@ -1139,6 +1139,19 @@ bool QMakeEvaluator::prepareProject(const QString &inDir)
dir = qdfi.path();
}
dir = m_outputDir;
forever {
QString stashfile = dir + QLatin1String("/.qmake.stash");
if (dir == (!superdir.isEmpty() ? superdir : m_buildRoot) || m_vfs->exists(stashfile)) {
m_stashfile = QDir::cleanPath(stashfile);
break;
}
QFileInfo qdfi(dir);
if (qdfi.isRoot())
break;
dir = qdfi.path();
}
return true;
}
@ -1253,6 +1266,12 @@ bool QMakeEvaluator::loadSpec()
m_cachefile, QMakeHandler::EvalConfigFile, LoadProOnly) != ReturnTrue)
return false;
}
if (!m_stashfile.isEmpty() && m_vfs->exists(m_stashfile)) {
valuesRef(ProKey("_QMAKE_STASH_")) << ProString(m_stashfile);
if (evaluateFile(
m_stashfile, QMakeHandler::EvalConfigFile, LoadProOnly) != ReturnTrue)
return false;
}
return true;
}
@ -1330,7 +1349,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProFile(
#ifdef PROEVALUATOR_THREAD_SAFE
m_option->mutex.lock();
#endif
QMakeBaseEnv **baseEnvPtr = &m_option->baseEnvs[QMakeBaseKey(m_buildRoot, m_hostBuild)];
QMakeBaseEnv **baseEnvPtr = &m_option->baseEnvs[QMakeBaseKey(m_buildRoot, m_stashfile, m_hostBuild)];
if (!*baseEnvPtr)
*baseEnvPtr = new QMakeBaseEnv;
QMakeBaseEnv *baseEnv = *baseEnvPtr;
@ -1357,6 +1376,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProFile(
baseEval->m_superfile = m_superfile;
baseEval->m_conffile = m_conffile;
baseEval->m_cachefile = m_cachefile;
baseEval->m_stashfile = m_stashfile;
baseEval->m_sourceRoot = m_sourceRoot;
baseEval->m_buildRoot = m_buildRoot;
baseEval->m_hostBuild = m_hostBuild;

View File

@ -298,6 +298,7 @@ public:
QString m_superfile;
QString m_conffile;
QString m_cachefile;
QString m_stashfile;
QString m_sourceRoot;
QString m_buildRoot;
QStringList m_qmakepath;

View File

@ -66,9 +66,10 @@ class QMakeEvaluator;
class QMakeBaseKey
{
public:
QMakeBaseKey(const QString &_root, bool _hostBuild);
QMakeBaseKey(const QString &_root, const QString &_stash, bool _hostBuild);
QString root;
QString stash;
bool hostBuild;
};

View File

@ -192,6 +192,7 @@ public class QtActivityDelegate
@Override
public void run() {
m_imm.restartInput(m_editText);
m_editText.m_optionsChanged = false;
}
}, 5);
}
@ -279,6 +280,10 @@ public class QtActivityDelegate
}
}
});
if (m_editText.m_optionsChanged) {
m_imm.restartInput(m_editText);
m_editText.m_optionsChanged = false;
}
}
}, 15);
}

View File

@ -53,22 +53,32 @@ public class QtEditText extends View
int m_initialCapsMode = 0;
int m_imeOptions = 0;
int m_inputType = InputType.TYPE_CLASS_TEXT;
boolean m_optionsChanged = false;
QtActivityDelegate m_activityDelegate;
public void setImeOptions(int m_imeOptions)
{
if (m_imeOptions == this.m_imeOptions)
return;
this.m_imeOptions = m_imeOptions;
m_optionsChanged = true;
}
public void setInitialCapsMode(int m_initialCapsMode)
{
if (m_initialCapsMode == this.m_initialCapsMode)
return;
this.m_initialCapsMode = m_initialCapsMode;
m_optionsChanged = true;
}
public void setInputType(int m_inputType)
{
if (m_inputType == this.m_inputType)
return;
this.m_inputType = m_inputType;
m_optionsChanged = true;
}
public QtEditText(Context context, QtActivityDelegate activityDelegate)

View File

@ -465,6 +465,7 @@
* N2659 Q_COMPILER_THREAD_LOCAL
* N2765 Q_COMPILER_UDL
* N2442 Q_COMPILER_UNICODE_STRINGS
* N2640 Q_COMPILER_UNIFORM_INIT
* N2544 Q_COMPILER_UNRESTRICTED_UNIONS
* N1653 Q_COMPILER_VARIADIC_MACROS
* N2242 N2555 Q_COMPILER_VARIADIC_TEMPLATES
@ -502,6 +503,7 @@
// constexpr support is only partial
//# define Q_COMPILER_CONSTEXPR
# define Q_COMPILER_INITIALIZER_LISTS
# define Q_COMPILER_UNIFORM_INIT
# define Q_COMPILER_NOEXCEPT
# endif
# if __INTEL_COMPILER >= 1400
@ -573,6 +575,7 @@
# endif
# if __has_feature(cxx_generalized_initializers)
# define Q_COMPILER_INITIALIZER_LISTS
# define Q_COMPILER_UNIFORM_INIT /* both covered by this feature macro, according to docs */
# endif
# if __has_feature(cxx_lambdas)
# define Q_COMPILER_LAMBDA
@ -645,6 +648,7 @@
# define Q_COMPILER_DELETE_MEMBERS
# define Q_COMPILER_EXTERN_TEMPLATES
# define Q_COMPILER_INITIALIZER_LISTS
# define Q_COMPILER_UNIFORM_INIT
# define Q_COMPILER_UNICODE_STRINGS
# define Q_COMPILER_VARIADIC_TEMPLATES
# endif
@ -718,8 +722,9 @@
# define Q_COMPILER_DECLTYPE
# define Q_COMPILER_RVALUE_REFS
# define Q_COMPILER_STATIC_ASSERT
// MSVC has std::initilizer_list, but does not support the braces initialization
// MSVC's library has std::initilizer_list, but the compiler does not support the braces initialization
//# define Q_COMPILER_INITIALIZER_LISTS
//# define Q_COMPILER_UNIFORM_INIT
# endif
# if _MSC_VER >= 1700
/* C++11 features supported in VC11 = VC2012: */

View File

@ -348,22 +348,28 @@ void QFileSelectorPrivate::updateSelectors()
QStringList QFileSelectorPrivate::platformSelectors()
{
QStringList ret;
#if defined(Q_OS_LINUX_ANDROID)
ret << QStringLiteral("android");
#elif defined(Q_OS_BLACKBERRY)
ret << QStringLiteral("blackberry");
#elif defined(Q_OS_IOS)
ret << QStringLiteral("ios");
#elif defined(Q_OS_WINCE)
ret << QStringLiteral("wince");
#elif defined(Q_OS_WIN)
#if defined(Q_OS_WIN)
ret << QStringLiteral("windows");
#elif defined(Q_OS_LINUX)
ret << QStringLiteral("linux");
#elif defined(Q_OS_OSX)
ret << QStringLiteral("osx");
# if defined(Q_OS_WINCE)
ret << QStringLiteral("wince");
# endif
#elif defined(Q_OS_UNIX)
ret << QStringLiteral("generic_unix");
ret << QStringLiteral("unix");
# if defined(Q_OS_LINUX_ANDROID)
ret << QStringLiteral("android");
# elif defined(Q_OS_BLACKBERRY)
ret << QStringLiteral("blackberry");
# elif defined(Q_OS_IOS)
ret << QStringLiteral("ios");
# elif defined(Q_OS_LINUX)
ret << QStringLiteral("linux");
# elif defined(Q_OS_MAC)
ret << QStringLiteral("mac");
# else
struct utsname u;
if (uname(&u) != -1)
ret << QString::fromLatin1(u.sysname).toLower();
# endif
#endif
return ret;
}

View File

@ -52,7 +52,7 @@ class Q_CORE_EXPORT QFileSelector : public QObject
{
Q_OBJECT
public:
QFileSelector(QObject *parent = 0);
explicit QFileSelector(QObject *parent = 0);
~QFileSelector();
QString select(const QString &filePath) const;

View File

@ -1027,7 +1027,7 @@ bool QCoreApplication::closingDown()
You can call this function occasionally when your program is busy
performing a long operation (e.g. copying a file).
In event you are running a local loop which calls this function
In the event that you are running a local loop which calls this function
continuously, without an event loop, the
\l{QEvent::DeferredDelete}{DeferredDelete} events will
not be processed. This can affect the behaviour of widgets,

View File

@ -82,7 +82,7 @@ public:
Sha1 = 5 // 0 1 0 1
};
#if defined(Q_COMPILER_INITIALIZER_LISTS) && !defined(Q_QDOC)
#if defined(Q_COMPILER_UNIFORM_INIT) && !defined(Q_QDOC)
Q_DECL_CONSTEXPR QUuid() : data1(0), data2(0), data3(0), data4{0,0,0,0,0,0,0,0} {}
Q_DECL_CONSTEXPR QUuid(uint l, ushort w1, ushort w2, uchar b1, uchar b2, uchar b3,
@ -147,7 +147,7 @@ public:
#if defined(Q_OS_WIN)
// On Windows we have a type GUID that is used by the platform API, so we
// provide convenience operators to cast from and to this type.
#if defined(Q_COMPILER_INITIALIZER_LISTS) && !defined(Q_QDOC)
#if defined(Q_COMPILER_UNIFORM_INIT) && !defined(Q_QDOC)
Q_DECL_CONSTEXPR QUuid(const GUID &guid)
: data1(guid.Data1), data2(guid.Data2), data3(guid.Data3),
data4{guid.Data4[0], guid.Data4[1], guid.Data4[2], guid.Data4[3],

View File

@ -99,7 +99,7 @@ QCollator::QCollator(const QCollator &other)
*/
QCollator::~QCollator()
{
if (!d->ref.deref())
if (d && !d->ref.deref())
delete d;
}
@ -109,14 +109,41 @@ QCollator::~QCollator()
QCollator &QCollator::operator=(const QCollator &other)
{
if (this != &other) {
if (!d->ref.deref())
if (d && !d->ref.deref())
delete d;
d = other.d;
d->ref.ref();
if (d) d->ref.ref();
}
return *this;
}
/*
\fn void QCollator::QCollator(QCollator &&other)
Move constructor. Moves from \a other into this collator.
Note that a moved-from QCollator can only be destroyed or assigned
to. The effect of calling other functions than the destructor or
one of the assignment operators is undefined.
*/
/*
\fn QCollator &QCollator::operator=(QCollator &&other)
Move-assigns from \a other to this collator.
Note that a moved-from QCollator can only be destroyed or assigned
to. The effect of calling other functions than the destructor or
one of the assignment operators is undefined.
*/
/*!
\fn void QCollator::swap(QCollator &other)
Swaps this collator with \a other. This function is very fast and
never fails.
*/
/*!
\internal
*/
@ -301,12 +328,13 @@ QCollatorSortKey& QCollatorSortKey::operator=(const QCollatorSortKey &other)
}
/*!
\fn bool QCollatorSortKey::operator<(const QCollatorSortKey &otherKey) const
\fn bool operator<(const QCollatorSortKey &lhs, const QCollatorSortKey &rhs)
\relates QCollatorSortKey
According to the QCollator that created the key, returns \c true if the
key should be sorted before than \a otherKey; otherwise returns \c false.
According to the QCollator that created the keys, returns \c true if \a lhs
should be sorted before \a rhs; otherwise returns \c false.
\sa compare()
\sa QCollatorSortKey::compare()
*/
/*!

View File

@ -61,10 +61,11 @@ public:
QCollatorSortKey &operator=(const QCollatorSortKey &other);
#ifdef Q_COMPILER_RVALUE_REFS
inline QCollatorSortKey &operator=(QCollatorSortKey &&other)
{ qSwap(d, other.d); return *this; }
{ swap(other); return *this; }
#endif
void swap(QCollatorSortKey &other)
{ d.swap(other.d); }
bool operator<(const QCollatorSortKey &key) const;
int compare(const QCollatorSortKey &key) const;
protected:
@ -76,13 +77,27 @@ private:
QCollatorSortKey();
};
inline bool operator<(const QCollatorSortKey &lhs, const QCollatorSortKey &rhs)
{
return lhs.compare(rhs) < 0;
}
class Q_CORE_EXPORT QCollator
{
public:
QCollator(const QLocale &locale = QLocale());
explicit QCollator(const QLocale &locale = QLocale());
QCollator(const QCollator &);
~QCollator();
QCollator &operator=(const QCollator &);
#ifdef Q_COMPILER_RVALUE_REFS
QCollator(QCollator &&other)
: d(other.d) { other.d = 0; }
QCollator &operator=(QCollator &&other)
{ swap(other); return *this; }
#endif
void swap(QCollator &other)
{ qSwap(d, other.d); }
void setLocale(const QLocale &locale);
QLocale locale() const;
@ -111,6 +126,9 @@ private:
void detach();
};
Q_DECLARE_SHARED(QCollatorSortKey)
Q_DECLARE_SHARED(QCollator)
QT_END_NAMESPACE
#endif // QCOLLATOR_P_H

View File

@ -151,11 +151,6 @@ QCollatorSortKey QCollator::sortKey(const QString &string) const
return QCollatorSortKey(new QCollatorSortKeyPrivate(result));
}
bool QCollatorSortKey::operator<(const QCollatorSortKey &otherKey) const
{
return d->m_key < otherKey.d->m_key;
}
int QCollatorSortKey::compare(const QCollatorSortKey &otherKey) const
{
return qstrcmp(d->m_key, otherKey.d->m_key);

View File

@ -162,11 +162,6 @@ QCollatorSortKey QCollator::sortKey(const QString &string) const
return QCollatorSortKey(new QCollatorSortKeyPrivate(ret));
}
bool QCollatorSortKey::operator<(const QCollatorSortKey &key) const
{
return compare(key) < 0;
}
int QCollatorSortKey::compare(const QCollatorSortKey &key) const
{
SInt32 order;

View File

@ -135,11 +135,6 @@ QCollatorSortKey QCollator::sortKey(const QString &string) const
return QCollatorSortKey(new QCollatorSortKeyPrivate(result));
}
bool QCollatorSortKey::operator<(const QCollatorSortKey &otherKey) const
{
return compare(otherKey) < 0;
}
int QCollatorSortKey::compare(const QCollatorSortKey &otherKey) const
{
return std::wcscmp(d->m_key.constData(),

View File

@ -155,11 +155,6 @@ QCollatorSortKey QCollator::sortKey(const QString &string) const
return QCollatorSortKey(new QCollatorSortKeyPrivate(ret));
}
bool QCollatorSortKey::operator<(const QCollatorSortKey &otherKey) const
{
return d->m_key < otherKey.d->m_key;
}
int QCollatorSortKey::compare(const QCollatorSortKey &otherKey) const
{
return d->m_key.compare(otherKey.d->m_key);

View File

@ -897,6 +897,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
*/
/*! \fn const Key &QMap::firstKey() const
\since 5.2
Returns a reference to the smallest key in the map.
This function assumes that the map is not empty.
@ -907,6 +908,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
*/
/*! \fn const Key &QMap::lastKey() const
\since 5.2
Returns a reference to the largest key in the map.
This function assumes that the map is not empty.
@ -917,6 +919,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
*/
/*! \fn T &QMap::first()
\since 5.2
Returns a reference to the first value in the map, that is the value mapped
to the smallest key. This function assumes that the map is not empty.
@ -927,11 +930,13 @@ void QMapDataBase::freeData(QMapDataBase *d)
*/
/*! \fn const T &QMap::first() const
\since 5.2
\overload
*/
/*! \fn T &QMap::last()
\since 5.2
Returns a reference to the last value in the map, that is the value mapped
to the largest key. This function assumes that the map is not empty.
@ -942,6 +947,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
*/
/*! \fn const T &QMap::last() const
\since 5.2
\overload
*/

View File

@ -422,13 +422,18 @@ QTimeZone &QTimeZone::operator=(const QTimeZone &other)
return *this;
}
/*
\fn void QTimeZone::swap(QTimeZone &other)
Swaps this timezone with \a other. This function is very fast and
never fails.
*/
/*!
\fn QTimeZone &QTimeZone::operator=(QTimeZone &&other)
Move-assigns \a other to this QTimeZone instance, transferring the
ownership of the managed pointer to this instance.
\since 5.2
*/
/*!

View File

@ -78,8 +78,8 @@ public:
QTimeZone();
explicit QTimeZone(const QByteArray &olsenId);
QTimeZone(int offsetSeconds);
QTimeZone(const QByteArray &zoneId, int offsetSeconds, const QString &name,
explicit QTimeZone(int offsetSeconds);
/*implicit*/ QTimeZone(const QByteArray &zoneId, int offsetSeconds, const QString &name,
const QString &abbreviation, QLocale::Country country = QLocale::AnyCountry,
const QString &comment = QString());
QTimeZone(const QTimeZone &other);
@ -87,9 +87,12 @@ public:
QTimeZone &operator=(const QTimeZone &other);
#ifdef Q_COMPILER_RVALUE_REFS
QTimeZone &operator=(QTimeZone &&other) { std::swap(d, other.d); return *this; }
QTimeZone &operator=(QTimeZone &&other) { swap(other); return *this; }
#endif
void swap(QTimeZone &other)
{ d.swap(other.d); }
bool operator==(const QTimeZone &other) const;
bool operator!=(const QTimeZone &other) const;
@ -149,6 +152,7 @@ private:
};
Q_DECLARE_TYPEINFO(QTimeZone::OffsetData, Q_MOVABLE_TYPE);
Q_DECLARE_SHARED(QTimeZone)
#ifndef QT_NO_DATASTREAM
Q_CORE_EXPORT QDataStream &operator<<(QDataStream &ds, const QTimeZone &tz);

View File

@ -77,7 +77,21 @@ unset(_qt5gui_OPENGL_INCLUDE_DIR CACHE)
macro(_qt5gui_find_extra_libs Name Libs LibDir IncDirs)
set(Qt5Gui_${Name}_LIBRARIES)
!!IF !mac
set(Qt5Gui_${Name}_INCLUDE_DIRS ${IncDirs})
!!ELSE
foreach(_dir ${IncDirs})
if (EXISTS ${_dir})
list(APPEND Qt5Gui_${Name}_INCLUDE_DIRS ${_dir})
else()
find_path(_actual_dir ${_dir}) # Look in sdk directories
if (_actual_dir)
list(APPEND Qt5Gui_${Name}_INCLUDE_DIRS ${_actual_dir})
endif()
unset(_actual_dir CACHE)
endif()
endforeach()
!!ENDIF
foreach(_lib ${Libs})
string(REGEX REPLACE "[^_A-Za-z0-9]" "_" _cmake_lib_name ${_lib})
if (NOT TARGET Qt5::Gui_${_cmake_lib_name})
@ -100,7 +114,7 @@ macro(_qt5gui_find_extra_libs Name Libs LibDir IncDirs)
endif()
endif()
add_library(Qt5::Gui_${_cmake_lib_name} SHARED IMPORTED)
set_property(TARGET Qt5::Gui_${_cmake_lib_name} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${IncDirs})
set_property(TARGET Qt5::Gui_${_cmake_lib_name} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${Qt5Gui_${Name}_INCLUDE_DIRS})
set_property(TARGET Qt5::Gui_${_cmake_lib_name} APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
_qt5_Gui_check_file_exists(\"${Qt5Gui_${_cmake_lib_name}_LIBRARY}\")
@ -130,7 +144,7 @@ macro(_qt5gui_find_extra_libs Name Libs LibDir IncDirs)
list(APPEND Qt5Gui_${Name}_LIBRARIES Qt5::Gui_${_cmake_lib_name})
endforeach()
if (NOT CMAKE_CROSSCOMPILING)
foreach(_dir ${IncDirs})
foreach(_dir ${Qt5Gui_${Name}_INCLUDE_DIRS})
_qt5_Gui_check_file_exists(${_dir})
endforeach()
endif()

View File

@ -3852,6 +3852,9 @@ static InPlace_Image_Converter inplace_converter_map[QImage::NImageFormats][QIma
{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
}, // Format_RGB444
{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
}, // Format_ARGB4444_Premultiplied
{
0,
0,

View File

@ -56,9 +56,7 @@
#include <private/qopenglextensions_p.h>
#include <private/qopenglversionfunctionsfactory_p.h>
#if !defined(QT_OPENGL_ES_2)
#include <private/qopengltexturehelper_p.h>
#endif
#include <QDebug>
@ -527,10 +525,8 @@ void QOpenGLContext::destroy()
d->versionFunctions.clear();
qDeleteAll(d->versionFunctionsBackend);
d->versionFunctionsBackend.clear();
#if !defined(QT_OPENGL_ES_2)
delete d->textureFunctions;
d->textureFunctions = 0;
#endif
}
/*!
@ -984,7 +980,6 @@ void QOpenGLContext::removeFunctionsBackend(const QOpenGLVersionStatus &v)
d->versionFunctionsBackend.remove(v);
}
#if !defined(QT_OPENGL_ES_2)
/*!
\internal
*/
@ -1002,7 +997,6 @@ void QOpenGLContext::setTextureFunctions(QOpenGLTextureHelper* textureFuncs)
Q_D(QOpenGLContext);
d->textureFunctions = textureFuncs;
}
#endif
/*!
\class QOpenGLContextGroup

View File

@ -221,10 +221,8 @@ private:
QOpenGLVersionFunctionsBackend *backend);
void removeFunctionsBackend(const QOpenGLVersionStatus &v);
#if !defined(QT_OPENGL_ES_2)
QOpenGLTextureHelper* textureFunctions() const;
void setTextureFunctions(QOpenGLTextureHelper* textureFuncs);
#endif
void destroy();
};

View File

@ -1662,7 +1662,7 @@ void QWindow::show()
bool isPopup = d_func()->windowFlags & Qt::Popup & ~Qt::Window;
if (!isPopup && qApp->styleHints()->showIsFullScreen())
showFullScreen();
else if (!isPopup && QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::ShowIsMaximized).toBool())
else if (!isPopup && !(d_func()->windowFlags & Qt::Dialog & ~Qt::Window) && QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::ShowIsMaximized).toBool())
showMaximized();
else
showNormal();

View File

@ -53,6 +53,17 @@ contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles2) {
opengl/qopenglvertexarrayobject.cpp \
opengl/qopengldebug.cpp
!wince* {
HEADERS += opengl/qopengltexture.h \
opengl/qopengltexture_p.h \
opengl/qopengltexturehelper_p.h \
opengl/qopenglpixeltransferoptions.h
SOURCES += opengl/qopengltexture.cpp \
opengl/qopengltexturehelper.cpp \
opengl/qopenglpixeltransferoptions.cpp
}
!contains(QT_CONFIG, opengles2) {
HEADERS += opengl/qopenglfunctions_1_0.h \
opengl/qopenglfunctions_1_1.h \
@ -77,11 +88,7 @@ contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles2) {
opengl/qopenglfunctions_4_2_compatibility.h \
opengl/qopenglfunctions_4_3_compatibility.h \
opengl/qopenglqueryhelper_p.h \
opengl/qopengltimerquery.h \
opengl/qopengltexture.h \
opengl/qopengltexture_p.h \
opengl/qopengltexturehelper_p.h \
opengl/qopenglpixeltransferoptions.h
opengl/qopengltimerquery.h
SOURCES += opengl/qopenglfunctions_1_0.cpp \
opengl/qopenglfunctions_1_1.cpp \
@ -105,10 +112,7 @@ contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles2) {
opengl/qopenglfunctions_4_1_compatibility.cpp \
opengl/qopenglfunctions_4_2_compatibility.cpp \
opengl/qopenglfunctions_4_3_compatibility.cpp \
opengl/qopengltimerquery.cpp \
opengl/qopengltexture.cpp \
opengl/qopengltexturehelper.cpp \
opengl/qopenglpixeltransferoptions.cpp
opengl/qopengltimerquery.cpp
}
contains(QT_CONFIG, opengles2) {

View File

@ -60,6 +60,14 @@ public:
QOpenGLPixelTransferOptions &operator=(const QOpenGLPixelTransferOptions &);
~QOpenGLPixelTransferOptions();
#ifdef Q_COMPILER_RVALUE_REFS
QOpenGLPixelTransferOptions &operator=(QOpenGLPixelTransferOptions &&other)
{ swap(other); return *this; }
#endif
void swap(QOpenGLPixelTransferOptions &other)
{ data.swap(other.data); }
void setAlignment(int alignment);
int alignment() const;
@ -88,6 +96,8 @@ private:
QSharedDataPointer<QOpenGLPixelTransferOptionsData> data;
};
Q_DECLARE_SHARED(QOpenGLPixelTransferOptions)
QT_END_NAMESPACE
#endif // QT_NO_OPENGL

View File

@ -50,6 +50,11 @@
QT_BEGIN_NAMESPACE
//this is to work around GL_TEXTURE_WRAP_R_OES which also has 0x8072 as value
#if !defined(GL_TEXTURE_WRAP_R)
#define GL_TEXTURE_WRAP_R 0x8072
#endif
QOpenGLTexturePrivate::QOpenGLTexturePrivate(QOpenGLTexture::Target textureTarget,
QOpenGLTexture *qq)
: q_ptr(qq),
@ -1255,6 +1260,13 @@ QOpenGLTexture *QOpenGLTexturePrivate::createTextureView(QOpenGLTexture::Target
\value SRGB_Alpha_DXT3 Equivalent to GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT
\value SRGB_Alpha_DXT5 Equivalent to GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT
\value SRGB_BP_UNorm Equivalent to GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB
\value DepthFormat Equivalent to GL_DEPTH_COMPONENT (OpenGL ES 2 only and when OES_depth_texture is present)
\value AlphaFormat Equivalent to GL_ALPHA (OpenGL ES 2 only)
\value RGBFormat Equivalent to GL_RGB (OpenGL ES 2 only)
\value RGBAFormat Equivalent to GL_RGBA (OpenGL ES 2 only)
\value LuminanceFormat Equivalent to GL_LUMINANCE (OpenGL ES 2 only)
\value LuminanceAlphaFormat Equivalent to GL_LUMINANCE_ALPHA (OpenGL ES 2 only)
*/
/*!
@ -1289,6 +1301,10 @@ QOpenGLTexture *QOpenGLTexturePrivate::createTextureView(QOpenGLTexture::Target
\value BGRA_Integer Equivalent to GL_BGRA_INTEGER
\value Depth Equivalent to GL_DEPTH_COMPONENT
\value DepthStencil Equivalent to GL_DEPTH_STENCIL
\value Alpha Equivalent to GL_ALPHA (OpenGL ES 2 only)
\value Luminance Equivalent to GL_LUMINANCE (OpenGL ES 2 only)
\value LuminanceAlpha Equivalent to GL_LUMINANCE_ALPHA (OpenGL ES 2 only)
*/
/*!
@ -1303,6 +1319,7 @@ QOpenGLTexture *QOpenGLTexturePrivate::createTextureView(QOpenGLTexture::Target
\value Int32 Equivalent to GL_INT
\value UInt32 Equivalent to GL_UNSIGNED_INT
\value Float16 Equivalent to GL_HALF_FLOAT
\value Float16OES Equivalent to GL_HALF_FLOAT_OES
\value Float32 Equivalent to GL_FLOAT
\value UInt32_RGB9_E5 Equivalent to GL_UNSIGNED_INT_5_9_9_9_REV
\value UInt32_RG11B10F Equivalent to GL_UNSIGNED_INT_10F_11F_11F_REV
@ -1752,6 +1769,12 @@ void QOpenGLTexture::setFormat(TextureFormat format)
case D32:
case D32F:
case D32FS8X24:
case DepthFormat:
case AlphaFormat:
case RGBFormat:
case RGBAFormat:
case LuminanceFormat:
case LuminanceAlphaFormat:
d->formatClass = FormatClass_Unique;
break;
}
@ -2242,6 +2265,7 @@ bool QOpenGLTexture::hasFeature(Feature feature)
bool supported = false;
switch (feature) {
#if !defined(QT_OPENGL_ES_2)
case ImmutableMultisampleStorage:
case TextureBuffer:
case StencilTexturing:
@ -2289,16 +2313,38 @@ bool QOpenGLTexture::hasFeature(Feature feature)
break;
}
#else
case Texture3D:
supported = ctx->hasExtension(QByteArrayLiteral("GL_OES_texture_3D"));
break;
case AnisotropicFiltering:
supported = ctx->hasExtension(QByteArrayLiteral("GL_EXT_texture_filter_anisotropic"));
break;
case NPOTTextures:
case NPOTTextureRepeat:
supported = f.version() >= qMakePair(3,0);
if (!supported) {
supported = ctx->hasExtension(QByteArrayLiteral("GL_OES_texture_npot"));
if (!supported)
supported = ctx->hasExtension(QByteArrayLiteral("GL_ARB_texture_non_power_of_two"));
}
default:
break;
}
#endif
return supported;
}
/*!
Sets the base mipmap level used for all texture lookups with this texture to \a baseLevel.
\note This function has no effect on Qt built for OpenGL ES 2.
\sa mipBaseLevel(), setMipMaxLevel(), setMipLevelRange()
*/
void QOpenGLTexture::setMipBaseLevel(int baseLevel)
{
#if !defined(QT_OPENGL_ES_2)
Q_D(QOpenGLTexture);
d->create();
Q_ASSERT(d->textureId);
@ -2306,6 +2352,10 @@ void QOpenGLTexture::setMipBaseLevel(int baseLevel)
Q_ASSERT(baseLevel <= d->maxLevel);
d->baseLevel = baseLevel;
d->texFuncs->glTextureParameteri(d->textureId, d->target, GL_TEXTURE_BASE_LEVEL, baseLevel);
#else
Q_UNUSED(baseLevel);
qWarning("QOpenGLTexture: Mipmap base level is not supported");
#endif
}
/*!
@ -2323,10 +2373,12 @@ int QOpenGLTexture::mipBaseLevel() const
/*!
Sets the maximum mipmap level used for all texture lookups with this texture to \a maxLevel.
\note This function has no effect on Qt built for OpenGL ES 2.
\sa mipMaxLevel(), setMipBaseLevel(), setMipLevelRange()
*/
void QOpenGLTexture::setMipMaxLevel(int maxLevel)
{
#if !defined(QT_OPENGL_ES_2)
Q_D(QOpenGLTexture);
d->create();
Q_ASSERT(d->textureId);
@ -2334,6 +2386,10 @@ void QOpenGLTexture::setMipMaxLevel(int maxLevel)
Q_ASSERT(d->baseLevel <= maxLevel);
d->maxLevel = maxLevel;
d->texFuncs->glTextureParameteri(d->textureId, d->target, GL_TEXTURE_MAX_LEVEL, maxLevel);
#else
Q_UNUSED(maxLevel);
qWarning("QOpenGLTexture: Mipmap max level is not supported");
#endif
}
/*!
@ -2351,10 +2407,12 @@ int QOpenGLTexture::mipMaxLevel() const
Sets the range of mipmap levels that can be used for texture lookups with this texture
to range from \a baseLevel to \a maxLevel.
\note This function has no effect on Qt built for OpenGL ES 2.
\sa setMipBaseLevel(), setMipMaxLevel(), mipLevelRange()
*/
void QOpenGLTexture::setMipLevelRange(int baseLevel, int maxLevel)
{
#if !defined(QT_OPENGL_ES_2)
Q_D(QOpenGLTexture);
d->create();
Q_ASSERT(d->textureId);
@ -2362,6 +2420,11 @@ void QOpenGLTexture::setMipLevelRange(int baseLevel, int maxLevel)
Q_ASSERT(baseLevel <= maxLevel);
d->texFuncs->glTextureParameteri(d->textureId, d->target, GL_TEXTURE_BASE_LEVEL, baseLevel);
d->texFuncs->glTextureParameteri(d->textureId, d->target, GL_TEXTURE_MAX_LEVEL, maxLevel);
#else
Q_UNUSED(baseLevel);
Q_UNUSED(maxLevel);
qWarning("QOpenGLTexture: Mipmap level range is not supported");
#endif
}
/*!
@ -2451,11 +2514,12 @@ void QOpenGLTexture::generateMipMaps(int baseLevel, bool resetBaseLevel)
This function maps \a component to the output \a value.
\note This function has no effect on Mac and Qt built for OpenGL ES 2.
\sa swizzleMask()
*/
void QOpenGLTexture::setSwizzleMask(SwizzleComponent component, SwizzleValue value)
{
#if !defined(Q_OS_MAC)
#if !defined(Q_OS_MAC) && !defined(QT_OPENGL_ES_2)
Q_D(QOpenGLTexture);
d->create();
Q_ASSERT(d->texFuncs);
@ -2467,9 +2531,9 @@ void QOpenGLTexture::setSwizzleMask(SwizzleComponent component, SwizzleValue val
d->swizzleMask[component - SwizzleRed] = value;
d->texFuncs->glTextureParameteri(d->textureId, d->target, component, value);
#else
qWarning("Texture swizzling is not supported");
Q_UNUSED(component);
Q_UNUSED(value);
qWarning("QOpenGLTexture: Texture swizzling is not supported");
#endif
}
@ -2479,7 +2543,7 @@ void QOpenGLTexture::setSwizzleMask(SwizzleComponent component, SwizzleValue val
void QOpenGLTexture::setSwizzleMask(SwizzleValue r, SwizzleValue g,
SwizzleValue b, SwizzleValue a)
{
#if !defined(Q_OS_MAC)
#if !defined(Q_OS_MAC) && !defined(QT_OPENGL_ES_2)
Q_D(QOpenGLTexture);
d->create();
Q_ASSERT(d->texFuncs);
@ -2495,11 +2559,11 @@ void QOpenGLTexture::setSwizzleMask(SwizzleValue r, SwizzleValue g,
d->swizzleMask[3] = a;
d->texFuncs->glTextureParameteriv(d->textureId, d->target, GL_TEXTURE_SWIZZLE_RGBA, swizzleMask);
#else
qWarning("Texture swizzling is not supported");
Q_UNUSED(r);
Q_UNUSED(g);
Q_UNUSED(b);
Q_UNUSED(a);
qWarning("QOpenGLTexture: Texture swizzling is not supported");
#endif
}
@ -2520,11 +2584,12 @@ QOpenGLTexture::SwizzleValue QOpenGLTexture::swizzleMask(SwizzleComponent compon
shader will access the depth component as a single float, as normal. But when
the parameter is set to StencilMode?, the shader will access the stencil component.
\note This function has no effect on Mac and Qt built for OpenGL ES 2.
\sa depthStencilMode()
*/
void QOpenGLTexture::setDepthStencilMode(QOpenGLTexture::DepthStencilMode mode)
{
#if !defined(Q_OS_MAC)
#if !defined(Q_OS_MAC) && !defined(QT_OPENGL_ES_2)
Q_D(QOpenGLTexture);
d->create();
Q_ASSERT(d->texFuncs);
@ -2537,7 +2602,7 @@ void QOpenGLTexture::setDepthStencilMode(QOpenGLTexture::DepthStencilMode mode)
d->texFuncs->glTextureParameteri(d->textureId, d->target, GL_DEPTH_STENCIL_TEXTURE_MODE, mode);
#else
Q_UNUSED(mode);
qWarning("DepthStencil Mode is not supported");
qWarning("QOpenGLTexture: DepthStencil Mode is not supported");
#endif
}
@ -2706,10 +2771,12 @@ QOpenGLTexture::WrapMode QOpenGLTexture::wrapMode(QOpenGLTexture::CoordinateDire
/*!
Sets the border color of the texture to \a color.
\note This function has no effect on Mac and Qt built for OpenGL ES 2.
\sa borderColor()
*/
void QOpenGLTexture::setBorderColor(QColor color)
{
#if !defined(QT_OPENGL_ES_2)
Q_D(QOpenGLTexture);
d->create();
Q_ASSERT(d->texFuncs);
@ -2723,6 +2790,10 @@ void QOpenGLTexture::setBorderColor(QColor color)
for (int i = 0; i < 4; ++i)
d->borderColor.append(QVariant(values[i]));
d->texFuncs->glTextureParameterfv(d->textureId, d->target, GL_TEXTURE_BORDER_COLOR, values);
#else
Q_UNUSED(color);
qWarning("QOpenGLTexture: Border color is not supported");
#endif
}
/*!
@ -2730,6 +2801,7 @@ void QOpenGLTexture::setBorderColor(QColor color)
*/
void QOpenGLTexture::setBorderColor(float r, float g, float b, float a)
{
#if !defined(QT_OPENGL_ES_2)
Q_D(QOpenGLTexture);
d->create();
Q_ASSERT(d->texFuncs);
@ -2743,6 +2815,13 @@ void QOpenGLTexture::setBorderColor(float r, float g, float b, float a)
for (int i = 0; i < 4; ++i)
d->borderColor.append(QVariant(values[i]));
d->texFuncs->glTextureParameterfv(d->textureId, d->target, GL_TEXTURE_BORDER_COLOR, values);
#else
Q_UNUSED(r);
Q_UNUSED(g);
Q_UNUSED(b);
Q_UNUSED(a);
qWarning("QOpenGLTexture: Border color is not supported");
#endif
}
/*!
@ -2750,6 +2829,7 @@ void QOpenGLTexture::setBorderColor(float r, float g, float b, float a)
*/
void QOpenGLTexture::setBorderColor(int r, int g, int b, int a)
{
#if !defined(QT_OPENGL_ES_2)
Q_D(QOpenGLTexture);
d->create();
Q_ASSERT(d->texFuncs);
@ -2763,6 +2843,13 @@ void QOpenGLTexture::setBorderColor(int r, int g, int b, int a)
for (int i = 0; i < 4; ++i)
d->borderColor.append(QVariant(values[i]));
d->texFuncs->glTextureParameteriv(d->textureId, d->target, GL_TEXTURE_BORDER_COLOR, values);
#else
Q_UNUSED(r);
Q_UNUSED(g);
Q_UNUSED(b);
Q_UNUSED(a);
qWarning("QOpenGLTexture: Border color is not supported");
#endif
// TODO Handle case of using glTextureParameterIiv() based on format
}
@ -2772,6 +2859,7 @@ void QOpenGLTexture::setBorderColor(int r, int g, int b, int a)
*/
void QOpenGLTexture::setBorderColor(uint r, uint g, uint b, uint a)
{
#if !defined(QT_OPENGL_ES_2)
Q_D(QOpenGLTexture);
d->create();
Q_ASSERT(d->texFuncs);
@ -2785,6 +2873,13 @@ void QOpenGLTexture::setBorderColor(uint r, uint g, uint b, uint a)
for (int i = 0; i < 4; ++i)
d->borderColor.append(QVariant(values[i]));
d->texFuncs->glTextureParameteriv(d->textureId, d->target, GL_TEXTURE_BORDER_COLOR, values);
#else
Q_UNUSED(r);
Q_UNUSED(g);
Q_UNUSED(b);
Q_UNUSED(a);
qWarning("QOpenGLTexture: Border color is not supported");
#endif
// TODO Handle case of using glTextureParameterIuiv() based on format
}
@ -2862,10 +2957,12 @@ void QOpenGLTexture::borderColor(unsigned int *border) const
Sets the minimum level of detail to \a value. This limits the selection of highest
resolution mipmap (lowest mipmap level). The default value is -1000.
\note This function has no effect on Qt built for OpenGL ES 2.
\sa minimumLevelOfDetail(), setMaximumLevelOfDetail(), setLevelOfDetailRange()
*/
void QOpenGLTexture::setMinimumLevelOfDetail(float value)
{
#if !defined(QT_OPENGL_ES_2)
Q_D(QOpenGLTexture);
d->create();
Q_ASSERT(d->texFuncs);
@ -2873,6 +2970,10 @@ void QOpenGLTexture::setMinimumLevelOfDetail(float value)
Q_ASSERT(value < d->maxLevelOfDetail);
d->minLevelOfDetail = value;
d->texFuncs->glTextureParameterf(d->textureId, d->target, GL_TEXTURE_MIN_LOD, value);
#else
Q_UNUSED(value);
qWarning("QOpenGLTexture: Detail level is not supported");
#endif
}
/*!
@ -2890,10 +2991,12 @@ float QOpenGLTexture::minimumLevelOfDetail() const
Sets the maximum level of detail to \a value. This limits the selection of lowest
resolution mipmap (highest mipmap level). The default value is 1000.
\note This function has no effect on Qt built for OpenGL ES 2.
\sa maximumLevelOfDetail(), setMinimumLevelOfDetail(), setLevelOfDetailRange()
*/
void QOpenGLTexture::setMaximumLevelOfDetail(float value)
{
#if !defined(QT_OPENGL_ES_2)
Q_D(QOpenGLTexture);
d->create();
Q_ASSERT(d->texFuncs);
@ -2901,6 +3004,10 @@ void QOpenGLTexture::setMaximumLevelOfDetail(float value)
Q_ASSERT(value > d->minLevelOfDetail);
d->maxLevelOfDetail = value;
d->texFuncs->glTextureParameterf(d->textureId, d->target, GL_TEXTURE_MAX_LOD, value);
#else
Q_UNUSED(value);
qWarning("QOpenGLTexture: Detail level is not supported");
#endif
}
/*!
@ -2917,10 +3024,12 @@ float QOpenGLTexture::maximumLevelOfDetail() const
/*!
Sets the minimum and maximum level of detail parameters.
\note This function has no effect on Qt built for OpenGL ES 2.
\sa levelOfDetailRange(), setMinimumLevelOfDetail(), setMaximumLevelOfDetail()
*/
void QOpenGLTexture::setLevelOfDetailRange(float min, float max)
{
#if !defined(QT_OPENGL_ES_2)
Q_D(QOpenGLTexture);
d->create();
Q_ASSERT(d->texFuncs);
@ -2930,6 +3039,11 @@ void QOpenGLTexture::setLevelOfDetailRange(float min, float max)
d->maxLevelOfDetail = max;
d->texFuncs->glTextureParameterf(d->textureId, d->target, GL_TEXTURE_MIN_LOD, min);
d->texFuncs->glTextureParameterf(d->textureId, d->target, GL_TEXTURE_MAX_LOD, max);
#else
Q_UNUSED(min);
Q_UNUSED(max);
qWarning("QOpenGLTexture: Detail level is not supported");
#endif
}
/*!
@ -2946,16 +3060,22 @@ QPair<float, float> QOpenGLTexture::levelOfDetailRange() const
/*!
Sets the level of detail bias parameter.
\note This function has no effect on Qt built for OpenGL ES 2.
\sa levelofDetailBias()
*/
void QOpenGLTexture::setLevelofDetailBias(float bias)
{
#if !defined(QT_OPENGL_ES_2)
Q_D(QOpenGLTexture);
d->create();
Q_ASSERT(d->texFuncs);
Q_ASSERT(d->textureId);
d->levelOfDetailBias = bias;
d->texFuncs->glTextureParameterf(d->textureId, d->target, GL_TEXTURE_LOD_BIAS, bias);
#else
Q_UNUSED(bias);
qWarning("QOpenGLTexture: Detail level is not supported");
#endif
}
/*!

View File

@ -96,8 +96,8 @@ public:
DontResetTextureUnit
};
QOpenGLTexture(Target target);
QOpenGLTexture(const QImage& image, MipMapGeneration genMipMaps = GenerateMipMaps);
explicit QOpenGLTexture(Target target);
explicit QOpenGLTexture(const QImage& image, MipMapGeneration genMipMaps = GenerateMipMaps);
~QOpenGLTexture();
// Creation and destruction
@ -222,7 +222,16 @@ public:
SRGB_Alpha_DXT1 = 0x8C4D, // GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT
SRGB_Alpha_DXT3 = 0x8C4E, // GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT
SRGB_Alpha_DXT5 = 0x8C4F, // GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT
SRGB_BP_UNorm = 0x8E8D // GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB
SRGB_BP_UNorm = 0x8E8D, // GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB
// ES 2 formats
DepthFormat = 0x1902, // GL_DEPTH_COMPONENT
AlphaFormat = 0x1906, // GL_ALPHA
RGBFormat = 0x1907, // GL_RGB
RGBAFormat = 0x1908, // GL_RGBA
LuminanceFormat = 0x1909, // GL_LUMINANCE
LuminanceAlphaFormat = 0x190A
};
// This is not used externally yet but is reserved to allow checking of
@ -296,7 +305,10 @@ public:
RGBA_Integer = 0x8D99, // GL_RGBA_INTEGER
BGRA_Integer = 0x8D9B, // GL_BGRA_INTEGER
Depth = 0x1902, // GL_DEPTH_COMPONENT
DepthStencil = 0x84F9 // GL_DEPTH_STENCIL
DepthStencil = 0x84F9, // GL_DEPTH_STENCIL
Alpha = 0x1906, // GL_ALPHA
Luminance = 0x1909, // GL_LUMINANCE
LuminanceAlpha = 0x190A // GL_LUMINANCE_ALPHA
};
enum PixelType {
@ -308,6 +320,7 @@ public:
Int32 = 0x1404, // GL_INT
UInt32 = 0x1405, // GL_UNSIGNED_INT
Float16 = 0x140B, // GL_HALF_FLOAT
Float16OES = 0x8D61, // GL_HALF_FLOAT_OES
Float32 = 0x1406, // GL_FLOAT
UInt32_RGB9_E5 = 0x8C3E, // GL_UNSIGNED_INT_5_9_9_9_REV
UInt32_RG11B10F = 0x8C3B, // GL_UNSIGNED_INT_10F_11F_11F_REV

View File

@ -48,6 +48,7 @@ QT_BEGIN_NAMESPACE
QOpenGLTextureHelper::QOpenGLTextureHelper(QOpenGLContext *context)
{
// Resolve EXT_direct_state_access entry points if present
#if !defined(QT_OPENGL_ES_2)
if (context->hasExtension(QByteArrayLiteral("GL_EXT_direct_state_access"))) {
TextureParameteriEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLenum , GLint )>(context->getProcAddress(QByteArrayLiteral("glTextureParameteriEXT")));
TextureParameterivEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLenum , const GLint *)>(context->getProcAddress(QByteArrayLiteral("glTextureParameterivEXT")));
@ -96,6 +97,7 @@ QOpenGLTextureHelper::QOpenGLTextureHelper(QOpenGLContext *context)
CompressedTextureImage2D = &QOpenGLTextureHelper::dsa_CompressedTextureImage2D;
CompressedTextureImage3D = &QOpenGLTextureHelper::dsa_CompressedTextureImage3D;
} else {
#endif
// Use our own DSA emulation
TextureParameteri = &QOpenGLTextureHelper::qt_TextureParameteri;
TextureParameteriv = &QOpenGLTextureHelper::qt_TextureParameteriv;
@ -117,9 +119,21 @@ QOpenGLTextureHelper::QOpenGLTextureHelper(QOpenGLContext *context)
CompressedTextureImage1D = &QOpenGLTextureHelper::qt_CompressedTextureImage1D;
CompressedTextureImage2D = &QOpenGLTextureHelper::qt_CompressedTextureImage2D;
CompressedTextureImage3D = &QOpenGLTextureHelper::qt_CompressedTextureImage3D;
#if defined(QT_OPENGL_ES_2)
if (context->hasExtension(QByteArrayLiteral("GL_OES_texture_3D"))) {
TexImage3D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid*)>(context->getProcAddress(QByteArrayLiteral("glTexImage3DOES")));
TexSubImage3D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid*)>(context->getProcAddress(QByteArrayLiteral("glTexSubImage3DOES")));
CompressedTexImage3D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid*)>(context->getProcAddress(QByteArrayLiteral("glCompressedTexImage3DOES")));
CompressedTexSubImage3D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid*)>(context->getProcAddress(QByteArrayLiteral("glCompressedTexSubImage3DOES")));
}
#endif
#if !defined(QT_OPENGL_ES_2)
}
#endif
// Some DSA functions are part of NV_texture_multisample instead
#if !defined(QT_OPENGL_ES_2)
if (context->hasExtension(QByteArrayLiteral("GL_NV_texture_multisample"))) {
TextureImage3DMultisampleNV = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLsizei , GLint , GLsizei , GLsizei , GLsizei , GLboolean )>(context->getProcAddress(QByteArrayLiteral("glTextureImage3DMultisampleNV")));
TextureImage2DMultisampleNV = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLsizei , GLint , GLsizei , GLsizei , GLboolean )>(context->getProcAddress(QByteArrayLiteral("glTextureImage2DMultisampleNV")));
@ -127,9 +141,12 @@ QOpenGLTextureHelper::QOpenGLTextureHelper(QOpenGLContext *context)
TextureImage3DMultisample = &QOpenGLTextureHelper::dsa_TextureImage3DMultisample;
TextureImage2DMultisample = &QOpenGLTextureHelper::dsa_TextureImage2DMultisample;
} else {
#endif
TextureImage3DMultisample = &QOpenGLTextureHelper::qt_TextureImage3DMultisample;
TextureImage2DMultisample = &QOpenGLTextureHelper::qt_TextureImage2DMultisample;
#if !defined(QT_OPENGL_ES_2)
}
#endif
#if defined(Q_OS_WIN)
HMODULE handle = GetModuleHandleA("opengl32.dll");

View File

@ -256,6 +256,7 @@ public:
}
private:
#if !defined(QT_OPENGL_ES_2)
// DSA wrapper (so we can use pointer to member function as switch)
inline void dsa_TextureParameteri(GLuint texture, GLenum target, GLenum pname, GLint param)
{
@ -403,6 +404,7 @@ private:
{
CompressedTextureImage3DEXT(texture, target, level, internalFormat, width, height, depth, border, imageSize, bits);
}
#endif
// DSA-like API
@ -899,6 +901,7 @@ public:
int val = 0;
glGetIntegerv(GL_UNPACK_ALIGNMENT, &val);
options.setAlignment(val);
#if !defined(QT_OPENGL_ES_2)
glGetIntegerv(GL_UNPACK_SKIP_IMAGES, &val);
options.setSkipImages(val);
glGetIntegerv(GL_UNPACK_SKIP_ROWS, &val);
@ -914,12 +917,14 @@ public:
options.setLeastSignificantByteFirst(b);
glGetBooleanv(GL_UNPACK_SWAP_BYTES, &b);
options.setSwapBytesEnabled(b);
#endif
return options;
}
inline void setPixelUploadOptions(const QOpenGLPixelTransferOptions &options)
{
glPixelStorei(GL_UNPACK_ALIGNMENT, options.alignment());
#if !defined(QT_OPENGL_ES_2)
glPixelStorei(GL_UNPACK_SKIP_IMAGES, options.skipImages());
glPixelStorei(GL_UNPACK_SKIP_ROWS, options.skipRows());
glPixelStorei(GL_UNPACK_SKIP_PIXELS, options.skipPixels());
@ -927,6 +932,7 @@ public:
glPixelStorei(GL_UNPACK_ROW_LENGTH, options.rowLength());
glPixelStorei(GL_UNPACK_LSB_FIRST, options.isLeastSignificantBitFirst());
glPixelStorei(GL_UNPACK_SWAP_BYTES, options.isSwapBytesEnabled());
#endif
}
private:
@ -982,6 +988,7 @@ private:
CompressedTextureImage2DMemberFunc CompressedTextureImage2D;
CompressedTextureImage3DMemberFunc CompressedTextureImage3D;
#if !defined(QT_OPENGL_ES_2)
// Raw function pointers for core and DSA functions
// EXT_direct_state_access used when DSA is available
@ -1012,6 +1019,7 @@ private:
// Plus some missing ones that are in the NV_texture_multisample extension instead
void (QOPENGLF_APIENTRYP TextureImage3DMultisampleNV)(GLuint texture, GLenum target, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations);
void (QOPENGLF_APIENTRYP TextureImage2DMultisampleNV)(GLuint texture, GLenum target, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations);
#endif
// OpenGL 1.0
void (QOPENGLF_APIENTRYP GetIntegerv)(GLenum pname, GLint *params);

View File

@ -48,7 +48,7 @@
QT_BEGIN_NAMESPACE
QFbWindow::QFbWindow(QWindow *window)
: QPlatformWindow(window), mBackingStore(0)
: QPlatformWindow(window), mBackingStore(0), mWindowState(Qt::WindowNoState)
{
static QAtomicInt winIdGenerator(1);
mWindowId = winIdGenerator.fetchAndAddRelaxed(1);

View File

@ -67,12 +67,32 @@ namespace QtAndroidInput
static QPointer<QWindow> m_mouseGrabber;
static int m_lastCursorPos = -1;
void updateSelection(int selStart, int selEnd, int candidatesStart, int candidatesEnd)
{
AttachedJNIEnv env;
if (!env.jniEnv)
return;
#ifdef QT_DEBUG_ANDROID_IM_PROTOCOL
qDebug() << ">>> UPDATESELECTION" << selStart << selEnd << candidatesStart << candidatesEnd;
#endif
if (candidatesStart == -1 && candidatesEnd == -1 && selStart == selEnd) {
// Qt only gives us position inside the block, so if we move to the
// same position in another block, the Android keyboard will believe
// we have not changed position, and be terribly confused.
if (selStart == m_lastCursorPos) {
#ifdef QT_DEBUG_ANDROID_IM_PROTOCOL
qDebug() << ">>> FAKEUPDATESELECTION" << selStart+1;
#endif
env.jniEnv->CallStaticVoidMethod(applicationClass(), m_updateSelectionMethodID,
selStart+1, selEnd+1, candidatesStart, candidatesEnd);
}
m_lastCursorPos = selStart;
} else {
m_lastCursorPos = -1;
}
env.jniEnv->CallStaticVoidMethod(applicationClass(), m_updateSelectionMethodID,
selStart, selEnd, candidatesStart, candidatesEnd);
}

View File

@ -142,7 +142,7 @@ namespace QtAndroidMenu
void setActiveTopLevelWindow(QWindow *window)
{
Qt::WindowFlags flags = window->flags();
Qt::WindowFlags flags = window ? window->flags() : Qt::WindowFlags();
bool isNonRegularWindow = flags & (Qt::Desktop | Qt::Popup | Qt::Dialog | Qt::Sheet) & ~Qt::Window;
if (isNonRegularWindow)
return;

View File

@ -141,6 +141,15 @@ bool QAndroidPlatformMenu::isVisible() const
return m_isVisible;
}
void QAndroidPlatformMenu::showPopup(const QWindow *parentWindow, QPoint pos, const QPlatformMenuItem *item)
{
Q_UNUSED(parentWindow);
Q_UNUSED(pos);
Q_UNUSED(item);
setVisible(true);
QtAndroidMenu::showContextMenu(this);
}
QPlatformMenuItem *QAndroidPlatformMenu::menuItemAt(int position) const
{
if (position < m_menuItems.size())
@ -154,7 +163,6 @@ QPlatformMenuItem *QAndroidPlatformMenu::menuItemForTag(quintptr tag) const
if (menuItem->tag() == tag)
return menuItem;
}
return 0;
}

View File

@ -71,6 +71,7 @@ public:
bool isEnabled() const;
void setVisible(bool visible);
bool isVisible() const;
void showPopup(const QWindow *parentWindow, QPoint pos, const QPlatformMenuItem *item);
QPlatformMenuItem *menuItemAt(int position) const;
QPlatformMenuItem *menuItemForTag(quintptr tag) const;

View File

@ -46,7 +46,6 @@
QAndroidPlatformWindow::QAndroidPlatformWindow(QWindow *window)
: QFbWindow(window)
, m_state(Qt::WindowNoState)
{
}
@ -65,9 +64,9 @@ void QAndroidPlatformWindow::updateStatusBarVisibility()
Qt::WindowFlags flags = window()->flags();
bool isNonRegularWindow = flags & (Qt::Popup | Qt::Dialog | Qt::Sheet) & ~Qt::Window;
if (!isNonRegularWindow) {
if (m_state & Qt::WindowFullScreen)
if (mWindowState & Qt::WindowFullScreen)
QtAndroid::hideStatusBar();
else if (m_state & Qt::WindowMaximized)
else if (mWindowState & Qt::WindowMaximized)
QtAndroid::showStatusBar();
}
}
@ -80,10 +79,9 @@ void QAndroidPlatformWindow::raise()
void QAndroidPlatformWindow::setWindowState(Qt::WindowState state)
{
if (m_state == state)
if (mWindowState == state)
return;
m_state = state;
if (window()->isVisible())
updateStatusBarVisibility();

View File

@ -59,9 +59,6 @@ public:
public slots:
void setGeometry(const QRect &rect);
private:
Qt::WindowState m_state;
};
#endif // ANDROIDPLATFORMWINDOW_H

View File

@ -115,8 +115,8 @@ QT_USE_NAMESPACE
QCocoaPostMessageArgs *args = reinterpret_cast<QCocoaPostMessageArgs *>(lower | (upper << 32));
// Special case for convenience: if the argument is an NSNumber, we unbox it directly.
// Use NSValue instead if this behaviour is unwanted.
id a1 = ([args->arg1 isKindOfClass:[NSNumber class]]) ? (id)[args->arg1 intValue] : args->arg1;
id a2 = ([args->arg2 isKindOfClass:[NSNumber class]]) ? (id)[args->arg2 intValue] : args->arg2;
id a1 = ([args->arg1 isKindOfClass:[NSNumber class]]) ? (id)[args->arg1 longValue] : args->arg1;
id a2 = ([args->arg2 isKindOfClass:[NSNumber class]]) ? (id)[args->arg2 longValue] : args->arg2;
switch (args->argCount) {
case 0:
[args->target performSelector:args->selector];

View File

@ -77,6 +77,7 @@ public:
private:
void setActiveWindow(QWindow *window);
void updateSurfaceFormat();
NSOpenGLContext *m_context;
NSOpenGLContext *m_shareContext;

View File

@ -48,6 +48,74 @@
#import <Cocoa/Cocoa.h>
static inline QByteArray getGlString(GLenum param)
{
if (const GLubyte *s = glGetString(param))
return QByteArray(reinterpret_cast<const char*>(s));
return QByteArray();
}
#if !defined(GL_CONTEXT_FLAGS)
#define GL_CONTEXT_FLAGS 0x821E
#endif
#if !defined(GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT)
#define GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT 0x0001
#endif
#if !defined(GL_CONTEXT_PROFILE_MASK)
#define GL_CONTEXT_PROFILE_MASK 0x9126
#endif
#if !defined(GL_CONTEXT_CORE_PROFILE_BIT)
#define GL_CONTEXT_CORE_PROFILE_BIT 0x00000001
#endif
#if !defined(GL_CONTEXT_COMPATIBILITY_PROFILE_BIT)
#define GL_CONTEXT_COMPATIBILITY_PROFILE_BIT 0x00000002
#endif
static void updateFormatFromContext(QSurfaceFormat *format)
{
Q_ASSERT(format);
// Update the version, profile, and context bit of the format
int major = 0, minor = 0;
QByteArray versionString(getGlString(GL_VERSION));
if (QPlatformOpenGLContext::parseOpenGLVersion(versionString, major, minor)) {
format->setMajorVersion(major);
format->setMinorVersion(minor);
}
format->setProfile(QSurfaceFormat::NoProfile);
Q_ASSERT(format->renderableType() == QSurfaceFormat::OpenGL);
if (format->version() < qMakePair(3, 0)) {
format->setOption(QSurfaceFormat::DeprecatedFunctions);
return;
}
// Version 3.0 onwards - check if it includes deprecated functionality
GLint value = 0;
glGetIntegerv(GL_CONTEXT_FLAGS, &value);
if (!(value & GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT))
format->setOption(QSurfaceFormat::DeprecatedFunctions);
// Debug context option not supported on OS X
if (format->version() < qMakePair(3, 2))
return;
// Version 3.2 and newer have a profile
value = 0;
glGetIntegerv(GL_CONTEXT_PROFILE_MASK, &value);
if (value & GL_CONTEXT_CORE_PROFILE_BIT)
format->setProfile(QSurfaceFormat::CoreProfile);
else if (value & GL_CONTEXT_COMPATIBILITY_PROFILE_BIT)
format->setProfile(QSurfaceFormat::CompatibilityProfile);
}
QCocoaGLContext::QCocoaGLContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share)
: m_context(nil),
m_shareContext(nil),
@ -82,6 +150,8 @@ QCocoaGLContext::QCocoaGLContext(const QSurfaceFormat &format, QPlatformOpenGLCo
int zeroOpacity = 0;
[m_context setValues:&zeroOpacity forParameter:NSOpenGLCPSurfaceOpacity];
}
updateSurfaceFormat();
}
QCocoaGLContext::~QCocoaGLContext()
@ -137,6 +207,74 @@ void QCocoaGLContext::setActiveWindow(QWindow *window)
[(QNSView *) cocoaWindow->contentView() setQCocoaGLContext:this];
}
void QCocoaGLContext::updateSurfaceFormat()
{
// At present it is impossible to turn an option off on a QSurfaceFormat (see
// https://codereview.qt-project.org/#change,70599). So we have to populate
// the actual surface format from scratch
QSurfaceFormat requestedFormat = m_format;
m_format = QSurfaceFormat();
m_format.setRenderableType(QSurfaceFormat::OpenGL);
// CoreGL doesn't require a drawable to make the context current
CGLContextObj oldContext = CGLGetCurrentContext();
CGLContextObj ctx = static_cast<CGLContextObj>([m_context CGLContextObj]);
CGLSetCurrentContext(ctx);
// Get the data that OpenGL provides
updateFormatFromContext(&m_format);
// Get the data contained within the pixel format
CGLPixelFormatObj cglPixelFormat = static_cast<CGLPixelFormatObj>(CGLGetPixelFormat(ctx));
NSOpenGLPixelFormat *pixelFormat = [[NSOpenGLPixelFormat alloc] initWithCGLPixelFormatObj:cglPixelFormat];
int colorSize = -1;
[pixelFormat getValues:&colorSize forAttribute:NSOpenGLPFAColorSize forVirtualScreen:0];
if (colorSize > 0) {
// This seems to return the total color buffer depth, including alpha
m_format.setRedBufferSize(colorSize / 4);
m_format.setGreenBufferSize(colorSize / 4);
m_format.setBlueBufferSize(colorSize / 4);
}
// The pixel format always seems to return 8 for alpha. However, the framebuffer only
// seems to have alpha enabled if we requested it explicitly. I can't find any other
// attribute to check explicitly for this so we use our best guess for alpha.
int alphaSize = -1;
[pixelFormat getValues:&alphaSize forAttribute:NSOpenGLPFAAlphaSize forVirtualScreen:0];
if (alphaSize > 0 && requestedFormat.alphaBufferSize() > 0)
m_format.setAlphaBufferSize(alphaSize);
int depthSize = -1;
[pixelFormat getValues:&depthSize forAttribute:NSOpenGLPFADepthSize forVirtualScreen:0];
if (depthSize > 0)
m_format.setDepthBufferSize(depthSize);
int stencilSize = -1;
[pixelFormat getValues:&stencilSize forAttribute:NSOpenGLPFAStencilSize forVirtualScreen:0];
if (stencilSize > 0)
m_format.setStencilBufferSize(stencilSize);
int samples = -1;
[pixelFormat getValues:&samples forAttribute:NSOpenGLPFASamples forVirtualScreen:0];
if (samples > 0)
m_format.setSamples(samples);
int doubleBuffered = -1;
[pixelFormat getValues:&doubleBuffered forAttribute:NSOpenGLPFADoubleBuffer forVirtualScreen:0];
m_format.setSwapBehavior(doubleBuffered == 1 ? QSurfaceFormat::DoubleBuffer : QSurfaceFormat::SingleBuffer);
int steroBuffers = -1;
[pixelFormat getValues:&steroBuffers forAttribute:NSOpenGLPFAStereo forVirtualScreen:0];
if (steroBuffers == 1)
m_format.setOption(QSurfaceFormat::StereoBuffers);
[pixelFormat release];
// Restore the original context
CGLSetCurrentContext(oldContext);
}
void QCocoaGLContext::doneCurrent()
{
if (m_currentWindow && m_currentWindow.data()->handle())

View File

@ -470,14 +470,12 @@ NSUInteger QCocoaWindow::windowStyleMask(Qt::WindowFlags flags)
styleMask = (NSUtilityWindowMask | NSResizableWindowMask | NSClosableWindowMask |
NSMiniaturizableWindowMask | NSTitledWindowMask);
} else {
// Filter flags for supported properties
flags &= Qt::WindowType_Mask | Qt::FramelessWindowHint | Qt::WindowTitleHint |
Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint | Qt::CustomizeWindowHint;
if (flags == Qt::Window) {
if (type == Qt::Window && !(flags & Qt::CustomizeWindowHint)) {
styleMask = (NSResizableWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSTitledWindowMask);
} else if ((flags & Qt::Dialog) == Qt::Dialog) {
} else if (type == Qt::Dialog) {
if (flags & Qt::CustomizeWindowHint) {
styleMask = NSResizableWindowMask;
if (flags & Qt::WindowMaximizeButtonHint)
styleMask = NSResizableWindowMask;
if (flags & Qt::WindowTitleHint)
styleMask |= NSTitledWindowMask;
if (flags & Qt::WindowCloseButtonHint)
@ -488,7 +486,7 @@ NSUInteger QCocoaWindow::windowStyleMask(Qt::WindowFlags flags)
styleMask = NSResizableWindowMask | NSClosableWindowMask | NSTitledWindowMask;
}
} else if (!(flags & Qt::FramelessWindowHint)) {
if ((flags & Qt::Dialog) || (flags & Qt::WindowMaximizeButtonHint))
if (flags & Qt::WindowMaximizeButtonHint)
styleMask |= NSResizableWindowMask;
if (flags & Qt::WindowTitleHint)
styleMask |= NSTitledWindowMask;

View File

@ -60,11 +60,7 @@
self.qiosViewController = [[[QIOSViewController alloc] init] autorelease];
self.window.rootViewController = self.qiosViewController;
#ifdef QT_DEBUG
self.window.backgroundColor = [UIColor cyanColor];
#endif
[self.window makeKeyAndVisible];
self.window.hidden = NO;
return YES;
}

View File

@ -48,6 +48,8 @@
QT_BEGIN_NAMESPACE
class QIOSWindow;
class QIOSContext : public QObject, public QPlatformOpenGLContext
{
Q_OBJECT
@ -87,7 +89,7 @@ private:
static void deleteBuffers(const FramebufferObject &framebufferObject);
mutable QHash<QWindow *, FramebufferObject> m_framebufferObjects;
mutable QHash<QIOSWindow *, FramebufferObject> m_framebufferObjects;
};
QT_END_NAMESPACE

View File

@ -113,7 +113,7 @@ void QIOSContext::swapBuffers(QPlatformSurface *surface)
{
Q_ASSERT(surface && surface->surface()->surfaceType() == QSurface::OpenGLSurface);
Q_ASSERT(surface->surface()->surfaceClass() == QSurface::Window);
QWindow *window = static_cast<QWindow *>(surface->surface());
QIOSWindow *window = static_cast<QIOSWindow *>(surface);
Q_ASSERT(m_framebufferObjects.contains(window));
[EAGLContext setCurrentContext:m_eaglContext];
@ -124,7 +124,7 @@ void QIOSContext::swapBuffers(QPlatformSurface *surface)
GLuint QIOSContext::defaultFramebufferObject(QPlatformSurface *surface) const
{
Q_ASSERT(surface && surface->surface()->surfaceClass() == QSurface::Window);
QWindow *window = static_cast<QWindow *>(surface->surface());
QIOSWindow *window = static_cast<QIOSWindow *>(surface);
FramebufferObject &framebufferObject = m_framebufferObjects[window];
@ -155,8 +155,7 @@ GLuint QIOSContext::defaultFramebufferObject(QPlatformSurface *surface) const
}
// Ensure that the FBO's buffers match the size of the layer
QIOSWindow *platformWindow = static_cast<QIOSWindow *>(surface);
UIView *view = reinterpret_cast<UIView *>(platformWindow->winId());
UIView *view = reinterpret_cast<UIView *>(window->winId());
CAEAGLLayer *layer = static_cast<CAEAGLLayer *>(view.layer);
if (framebufferObject.renderbufferWidth != (layer.frame.size.width * layer.contentsScale) ||
framebufferObject.renderbufferHeight != (layer.frame.size.height * layer.contentsScale)) {
@ -191,7 +190,7 @@ GLuint QIOSContext::defaultFramebufferObject(QPlatformSurface *surface) const
void QIOSContext::windowDestroyed(QObject *object)
{
QWindow *window = static_cast<QWindow *>(object);
QIOSWindow *window = static_cast<QIOSWindow *>(object);
if (m_framebufferObjects.contains(window)) {
EAGLContext *originalContext = [EAGLContext currentContext];
[EAGLContext setCurrentContext:m_eaglContext];

View File

@ -101,6 +101,8 @@ QIOSIntegration::~QIOSIntegration()
bool QIOSIntegration::hasCapability(Capability cap) const
{
switch (cap) {
case BufferQueueingOpenGL:
return true;
case OpenGL:
case ThreadedOpenGL:
return true;

View File

@ -123,8 +123,6 @@ QIOSScreen::QIOSScreen(unsigned int screenIndex)
, m_uiScreen([[UIScreen screens] objectAtIndex:qMin(NSUInteger(screenIndex), [[UIScreen screens] count] - 1)])
, m_orientationListener(0)
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
QString deviceIdentifier = deviceModelIdentifier();
if (deviceIdentifier == QStringLiteral("iPhone2,1") /* iPhone 3GS */
@ -153,8 +151,6 @@ QIOSScreen::QIOSScreen(unsigned int screenIndex)
// When in a non-mixed environment, let QScreen follow the current interface orientation:
setPrimaryOrientation(toQtScreenOrientation(UIDeviceOrientation(qiosViewController().interfaceOrientation)));
}
[pool release];
}
QIOSScreen::~QIOSScreen()

View File

@ -48,14 +48,6 @@
@implementation QIOSViewController
- (void)viewDidLoad
{
#ifdef QT_DEBUG
if (!self.nibName)
self.view.backgroundColor = [UIColor magentaColor];
#endif
}
-(BOOL)shouldAutorotate
{
// Until a proper orientation and rotation API is in place, we always auto rotate.

View File

@ -58,8 +58,10 @@ QT_BEGIN_NAMESPACE
@class QUIView;
class QIOSWindow : public QPlatformWindow
class QIOSWindow : public QObject, public QPlatformWindow
{
Q_OBJECT
public:
explicit QIOSWindow(QWindow *window);
~QIOSWindow();
@ -87,7 +89,6 @@ private:
QRect m_normalGeometry;
int m_windowLevel;
qreal m_devicePixelRatio;
void raiseOrLower(bool raise);
void updateWindowLevel();

View File

@ -127,6 +127,32 @@
return self;
}
- (void)willMoveToWindow:(UIWindow *)newWindow
{
// UIKIt will normally set the scale factor of a view to match the corresponding
// screen scale factor, but views backed by CAEAGLLayers need to do this manually.
self.contentScaleFactor = newWindow && newWindow.screen ?
newWindow.screen.scale : [[UIScreen mainScreen] scale];
// FIXME: Allow the scale factor to be customized through QSurfaceFormat.
}
- (void)didAddSubview:(UIView *)subview
{
if ([subview isKindOfClass:[QUIView class]])
self.clipsToBounds = YES;
}
- (void)willRemoveSubview:(UIView *)subview
{
for (UIView *view in self.subviews) {
if (view != subview && [view isKindOfClass:[QUIView class]])
return;
}
self.clipsToBounds = NO;
}
- (void)layoutSubviews
{
// This method is the de facto way to know that view has been resized,
@ -331,19 +357,9 @@ QIOSWindow::QIOSWindow(QWindow *window)
, m_view([[QUIView alloc] initWithQIOSWindow:this])
, m_normalGeometry(QPlatformWindow::geometry())
, m_windowLevel(0)
, m_devicePixelRatio(1.0)
{
setParent(parent());
setParent(QPlatformWindow::parent());
setWindowState(window->windowState());
// Retina support: get screen scale factor and set it in the content view.
// This will make framebufferObject() create a 2x frame buffer on retina
// displays. Also set m_devicePixelRatio which is used for scaling the
// paint device.
if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)] == YES) {
m_devicePixelRatio = [[UIScreen mainScreen] scale];
[m_view setContentScaleFactor: m_devicePixelRatio];
}
}
QIOSWindow::~QIOSWindow()
@ -456,6 +472,8 @@ void QIOSWindow::requestActivateWindow()
if (!window()->isTopLevel() || blockedByModal())
return;
[m_view.window makeKeyWindow];
raise();
QPlatformInputContext *context = QGuiApplicationPrivate::platformIntegration()->inputContext();
static_cast<QIOSInputContext *>(context)->focusViewChanged(m_view);
@ -522,7 +540,9 @@ void QIOSWindow::handleContentOrientationChange(Qt::ScreenOrientation orientatio
qreal QIOSWindow::devicePixelRatio() const
{
return m_devicePixelRatio;
return m_view.contentScaleFactor;
}
#include "moc_qioswindow.cpp"
QT_END_NAMESPACE

View File

@ -438,7 +438,14 @@ void QQnxScreenEventHandler::handleTouchEvent(screen_event_t event, int qnxType)
m_touchPoints[touchId].normalPosition =
QPointF(static_cast<qreal>(pos[0]) / screenSize.width(),
static_cast<qreal>(pos[1]) / screenSize.height());
m_touchPoints[touchId].area = QRectF( pos[0], pos[1], 0.0, 0.0 );
m_touchPoints[touchId].area = QRectF(w->geometry().left() + windowPos[0],
w->geometry().top() + windowPos[1], 0.0, 0.0);
QWindow *parent = w->parent();
while (parent) {
m_touchPoints[touchId].area.translate(parent->geometry().topLeft());
parent = parent->parent();
}
// determine event type and update state of current touch point
QEvent::Type type = QEvent::None;
@ -473,8 +480,8 @@ void QQnxScreenEventHandler::handleTouchEvent(screen_event_t event, int qnxType)
// inject event into Qt
QWindowSystemInterface::handleTouchEvent(w, m_touchDevice, pointList);
qScreenEventDebug() << Q_FUNC_INFO << "Qt touch, w =" << w
<< ", p=(" << pos[0] << "," << pos[1]
<< "), t=" << type;
<< ", p=" << m_touchPoints[touchId].area.topLeft()
<< ", t=" << type;
}
}
}

View File

@ -431,11 +431,28 @@ void QGLXContext::queryDummyContext()
if (skip)
return;
QOffscreenSurface surface;
surface.create();
QOpenGLContext *oldContext = QOpenGLContext::currentContext();
QSurface *oldSurface = 0;
if (oldContext)
oldSurface = oldContext->surface();
QScopedPointer<QSurface> surface;
const char *vendor = glXGetClientString(glXGetCurrentDisplay(), GLX_VENDOR);
if (vendor && !strcmp(vendor, "ATI")) {
QWindow *window = new QWindow;
window->resize(64, 64);
window->setSurfaceType(QSurface::OpenGLSurface);
window->create();
surface.reset(window);
} else {
QOffscreenSurface *offSurface = new QOffscreenSurface;
offSurface->create();
surface.reset(offSurface);
}
QOpenGLContext context;
context.create();
context.makeCurrent(&surface);
context.makeCurrent(surface.data());
const char *renderer = (const char *) glGetString(GL_RENDERER);
@ -446,6 +463,10 @@ void QGLXContext::queryDummyContext()
break;
}
}
context.doneCurrent();
if (oldContext && oldSurface)
oldContext->makeCurrent(oldSurface);
}
bool QGLXContext::supportsThreading()

View File

@ -87,8 +87,16 @@ QVariant QGtk2Theme::themeHint(QPlatformTheme::ThemeHint hint) const
bool QGtk2Theme::usePlatformNativeDialog(DialogType type) const
{
Q_UNUSED(type);
return true;
switch (type) {
case ColorDialog:
return true;
case FileDialog:
return true;
case FontDialog:
return true;
default:
return false;
}
}
QPlatformDialogHelper *QGtk2Theme::createPlatformDialogHelper(DialogType type) const

View File

@ -67,6 +67,8 @@ QT_BEGIN_NAMESPACE
Q_GUI_EXPORT HBITMAP qt_pixmapToWinHBITMAP(const QPixmap &p, int hbitmapFormat = 0);
extern QPainterPath qt_regionToPath(const QRegion &region);
Q_PRINTSUPPORT_EXPORT QSizeF qt_SizeFromUnitToMillimeter(const QSizeF &, QPrinter::Unit, double);
Q_PRINTSUPPORT_EXPORT double qt_multiplierForUnit(QPrinter::Unit unit, int resolution);
// #define QT_DEBUG_DRAW
@ -114,6 +116,52 @@ static const struct {
{ 0, QPrinter::Custom }
};
// Return a list of printer paper sizes in millimeters with the corresponding dmPaperSize value
static QList<QPair<QSizeF, int> > printerPaperSizes(const QString &printerName)
{
QList<QPair<QSizeF, int> > result;
const wchar_t *name = reinterpret_cast<const wchar_t*>(printerName.utf16());
DWORD paperNameCount = DeviceCapabilities(name, NULL, DC_PAPERS, NULL, NULL);
if ((int)paperNameCount > 0) {
// If they are not equal, then there seems to be a problem with the driver
if (paperNameCount != DeviceCapabilities(name, NULL, DC_PAPERSIZE, NULL, NULL))
return result;
QScopedArrayPointer<wchar_t> papersNames(new wchar_t[paperNameCount]);
paperNameCount = DeviceCapabilities(name, NULL, DC_PAPERS, papersNames.data(), NULL);
result.reserve(paperNameCount);
QScopedArrayPointer<POINT> paperSizes(new POINT[paperNameCount]);
paperNameCount = DeviceCapabilities(name, NULL, DC_PAPERSIZE, (wchar_t *)paperSizes.data(), NULL);
for (int i=0; i <(int)paperNameCount; i++)
result.push_back(qMakePair(QSizeF(paperSizes[i].x / 10, paperSizes[i].y / 10), papersNames[i]));
}
return result;
}
// Find the best-matching printer paper for size in millimeters.
static inline int findCustomPaperSize(const QSizeF &needlePt, const QString &printerName)
{
const QList<QPair<QSizeF, int> > sizes = printerPaperSizes(printerName);
const qreal nw = needlePt.width();
const qreal nh = needlePt.height();
for (int i = 0; i < sizes.size(); ++i) {
if (qAbs(nw - sizes.at(i).first.width()) <= 1 && qAbs(nh - sizes.at(i).first.height()) <= 1)
return sizes.at(i).second;
}
return -1;
}
static inline void setDevModePaperFlags(DEVMODE *devMode, bool custom)
{
if (custom) {
devMode->dmPaperSize = DMPAPER_USER;
devMode->dmFields |= DM_PAPERLENGTH | DM_PAPERWIDTH;
} else {
devMode->dmFields &= ~(DM_PAPERLENGTH | DM_PAPERWIDTH);
devMode->dmPaperLength = 0;
devMode->dmPaperWidth = 0;
}
}
QPrinter::PaperSize mapDevmodePaperSize(int s)
{
int i = 0;
@ -1293,6 +1341,7 @@ void QWin32PrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &
break;
d->devMode->dmPaperSize = mapPaperSizeDevmode(QPrinter::PaperSize(value.toInt()));
d->has_custom_paper_size = (QPrinter::PaperSize(value.toInt()) == QPrinter::Custom);
setDevModePaperFlags(d->devMode, d->has_custom_paper_size);
d->doReinit();
break;
case PPK_PaperName:
@ -1320,9 +1369,19 @@ void QWin32PrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &
wchar_t *papers = new wchar_t[size];
size = DeviceCapabilities(reinterpret_cast<const wchar_t*>(d->name.utf16()),
NULL, DC_PAPERS, papers, NULL);
d->has_custom_paper_size = false;
d->devMode->dmPaperSize = papers[paperPos];
d->doReinit();
QScopedArrayPointer<POINT> paperSizes(new POINT[size]);
DWORD paperNameCount = DeviceCapabilities(reinterpret_cast<const wchar_t*>(d->name.utf16()), NULL, DC_PAPERSIZE, (wchar_t *)paperSizes.data(), NULL);
if (paperNameCount == size) {
const double multiplier = qt_multiplierForUnit(QPrinter::Millimeter, d->resolution);
d->paper_size = QSizeF((paperSizes[paperPos].x / 10.0) * multiplier, (paperSizes[paperPos].y / 10.0) * multiplier);
// Our sizes may not match the paper name's size exactly
// So we treat it as custom so we know the paper size is correct
d->has_custom_paper_size = true;
d->devMode->dmPaperSize = papers[paperPos];
setDevModePaperFlags(d->devMode, false);
d->doReinit();
}
delete [] papers;
}
}
@ -1373,6 +1432,7 @@ void QWin32PrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &
break;
d->has_custom_paper_size = false;
d->devMode->dmPaperSize = value.toInt();
setDevModePaperFlags(d->devMode, d->has_custom_paper_size);
d->doReinit();
break;
@ -1382,30 +1442,17 @@ void QWin32PrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &
d->paper_size = value.toSizeF();
if (!d->devMode)
break;
int orientation = d->devMode->dmOrientation;
DWORD needed = 0;
DWORD returned = 0;
if (!EnumForms(d->hPrinter, 1, 0, 0, &needed, &returned)) {
BYTE *forms = (BYTE *) malloc(needed);
if (EnumForms(d->hPrinter, 1, forms, needed, &needed, &returned)) {
for (DWORD i=0; i< returned; ++i) {
FORM_INFO_1 *formArray = reinterpret_cast<FORM_INFO_1 *>(forms);
// the form sizes are specified in 1000th of a mm,
// convert the size to Points
QSizeF size((formArray[i].Size.cx * 72/25.4)/1000.0,
(formArray[i].Size.cy * 72/25.4)/1000.0);
if (qAbs(d->paper_size.width() - size.width()) <= 2
&& qAbs(d->paper_size.height() - size.height()) <= 2)
{
d->devMode->dmPaperSize = i + 1;
break;
}
}
}
free(forms);
const QSizeF sizeMM = qt_SizeFromUnitToMillimeter(d->paper_size, QPrinter::Point, d->resolution);
const int match = findCustomPaperSize(sizeMM, d->name);
setDevModePaperFlags(d->devMode, (match >= 0) ? false : true);
if (match >= 0) {
d->devMode->dmPaperSize = match;
if (d->devMode->dmOrientation != DMORIENT_PORTRAIT)
qSwap(d->paper_size.rwidth(), d->paper_size.rheight());
} else {
d->devMode->dmPaperLength = qRound(sizeMM.height() * 10.0);
d->devMode->dmPaperWidth = qRound(sizeMM.width() * 10.0);
}
if (orientation != DMORIENT_PORTRAIT)
d->paper_size = QSizeF(d->paper_size.height(), d->paper_size.width());
break;
}
@ -1692,7 +1739,7 @@ QList<QPair<QString, QSizeF> > QWin32PrintEngine::supportedSizesWithNames(const
for (int i=0;i<(int)size;i++) {
wchar_t *paper = papers + (i * 64);
QString str = QString::fromWCharArray(paper, qwcsnlen(paper, 64));
paperSizes << qMakePair(str, QSizeF(points[i].x / 10, points[i].y / 10));
paperSizes << qMakePair(str, QSizeF(points[i].x / 10.0, points[i].y / 10.0));
}
delete [] points;
}
@ -1908,30 +1955,19 @@ static void draw_text_item_win(const QPointF &pos, const QTextItemInt &ti, HDC h
SelectObject(hdc, old_font);
}
void QWin32PrintEnginePrivate::updateCustomPaperSize()
{
uint paperSize = devMode->dmPaperSize;
const uint paperSize = devMode->dmPaperSize;
has_custom_paper_size = true;
if (paperSize > 0 && mapDevmodePaperSize(paperSize) == QPrinter::Custom) {
has_custom_paper_size = true;
DWORD needed = 0;
DWORD returned = 0;
if (!EnumForms(hPrinter, 1, 0, 0, &needed, &returned)) {
BYTE *forms = (BYTE *) malloc(needed);
if (EnumForms(hPrinter, 1, forms, needed, &needed, &returned)) {
if (paperSize <= returned) {
FORM_INFO_1 *formArray = (FORM_INFO_1 *) forms;
int width = formArray[paperSize - 1].Size.cx; // 1/1000 of a mm
int height = formArray[paperSize - 1].Size.cy; // 1/1000 of a mm
paper_size = QSizeF((width * 72 /25.4) / 1000.0, (height * 72 / 25.4) / 1000.0);
} else {
has_custom_paper_size = false;
}
const QList<QPair<QSizeF, int> > paperSizes = printerPaperSizes(name);
for (int i=0; i<paperSizes.size(); i++) {
if ((uint)paperSizes.at(i).second == paperSize) {
paper_size = paperSizes.at(paperSize).first;
has_custom_paper_size = false;
break;
}
free(forms);
}
} else {
has_custom_paper_size = false;
}
}

View File

@ -37,123 +37,123 @@
\list
\li \l {04-qdoc-commands-textmarkup.html#a-command} {\\a}
\li \l {11-qdoc-commands-specialcontent.html#abstract-command} {\\abstract}
\li \l {12-0-qdoc-commands-miscellaneous.html#annotatedlist-command} {\\annotatedlist}
\li \l {04-qdoc-commands-textmarkup.html#b-command} {\\b} \span {class="newStuff"} {(new 5/3/2012)}
\li \l {04-qdoc-commands-textmarkup.html#b-command} {\\bold} \span {class="newStuff"} {(deprecated, use \\b)}
\li \l {11-qdoc-commands-specialcontent.html#brief-command} {\\brief}
\li \l {04-qdoc-commands-textmarkup.html#c-command} {\\c}
\li \l {09-qdoc-commands-includingimages.html#caption-command} {\\caption}
\li \l {05-qdoc-commands-documentstructure.html#chapter-command} {\\chapter}
\li \l {13-qdoc-commands-topics.html#class-command} {\\class}
\li \l {06-qdoc-commands-includecodeinline.html#code-command} {\\code}
\li \l {07-0-qdoc-commands-includingexternalcode.html#codeline-command} {\\codeline},
\li \l {16-qdoc-commands-status.html#compat-command} {\\compat}
\li \l {15-qdoc-commands-navigation.html#contentspage-command} {\\contentspage}
\li \l {16-qdoc-commands-status.html#default-command} {\\default}
\li \l {21-0-qdoc-creating-dita-maps.html#ditamap-command} {\\ditamap} \span {class="newStuff"} {(new 05/03/12)}
\li \l {04-qdoc-commands-textmarkup.html#div-command} {\\div}
\li \l {07-0-qdoc-commands-includingexternalcode.html#dots-command} {\\dots}
\li \l {04-qdoc-commands-textmarkup.html#e-command} {\\e} \span {class="newStuff"} {(new 5/3/2012)}
\li \l {12-0-qdoc-commands-miscellaneous.html#else-command} {\\else}
\li \l {12-0-qdoc-commands-miscellaneous.html#endif-command} {\\endif}
\li \l {13-qdoc-commands-topics.html#enum-command} {\\enum}
\li \l {13-qdoc-commands-topics.html#example-command} {\\example}
\li \l {13-qdoc-commands-topics.html#externalpage-command} {\\externalpage}
\li \l {13-qdoc-commands-topics.html#fn-command} {\\fn}
\li \l {11-qdoc-commands-specialcontent.html#footnote-command} {\\footnote}
\li \l {12-0-qdoc-commands-miscellaneous.html#generatelist-command} {\\generatelist}
\li \l {13-qdoc-commands-topics.html#group-command} {\\group}
\li \l {10-qdoc-commands-tablesandlists.html#header-command} {\\header}
\li \l {13-qdoc-commands-topics.html#headerfile-command} {\\headerfile}
\li \l {04-qdoc-commands-textmarkup.html#e-command} {\\i} \span {class="newStuff"} {(deprecated, use \\e)}
\li \l {12-0-qdoc-commands-miscellaneous.html#if-command} {\\if}
\li \l {09-qdoc-commands-includingimages.html#image-command} {\\image}
\li \l {12-0-qdoc-commands-miscellaneous.html#include-command} {\\include}
\li \l {15-qdoc-commands-navigation.html#indexpage-command} {\\indexpage}
\li \l {19-qdoc-commands-grouping.html#ingroup-command} {\\ingroup}
\li \l {18-qdoc-commands-relating.html#inherits-command}{\\inherits}
\li \l {09-qdoc-commands-includingimages.html#inlineimage-command} {\\inlineimage}
\li \l {19-qdoc-commands-grouping.html#inmodule-command} {\\inmodule}
\li \l {13-qdoc-commands-topics.html#inqmlmodule-command} {\\inqmlmodule}
\li \l {13-qdoc-commands-topics.html#instantiates-command} {\\instantiates} \span {class="newStuff"} {(new 27/7/2012)}
\li \l {16-qdoc-commands-status.html#internal-command} {\\internal}
\li \l {08-qdoc-commands-creatinglinks.html#keyword-command} {\\keyword}
\li \l {08-qdoc-commands-creatinglinks.html#l-command} {\\l}
\li \l {11-qdoc-commands-specialcontent.html#legalese-command} {\\legalese}
\li \l {10-qdoc-commands-tablesandlists.html#li-command} {\\li} \span {class="newStuff"} {(new 5/3/2012)}
\li \l {10-qdoc-commands-tablesandlists.html#list-command} {\\list}
\li \l {13-qdoc-commands-topics.html#macro-command} {\\macro}
\li \l {19-qdoc-commands-grouping.html#mainclass-command} {\\mainclass}
\li \l {21-0-qdoc-creating-dita-maps.html#mapref-command} {\\mapref} \span {class="newStuff"} {(new 05/03/12)}
\li \l {12-0-qdoc-commands-miscellaneous.html#meta-command} {\\meta}
\li \l {13-qdoc-commands-topics.html#module-command} {\\module}
\li \l {13-qdoc-commands-topics.html#namespace-command} {\\namespace}
\li \l {15-qdoc-commands-navigation.html#nextpage-command} {\\nextpage}
\li \l {06-qdoc-commands-includecodeinline.html#newcode-command} {\\newcode}
\li \l {17-qdoc-commands-thread.html#nonreentrant-command} {\\nonreentrant}
\li \l {11-qdoc-commands-specialcontent.html#note-command} {\\note}
\li \l {10-qdoc-commands-tablesandlists.html#li-command} {\\o} \span {class="newStuff"} {(deprecated, use \\li)}
\li \l {a-command} {\\a}
\li \l {abstract-command} {\\abstract}
\li \l {annotatedlist-command} {\\annotatedlist}
\li \l {b-command} {\\b} \span {class="newStuff"}
\li \l {b-command} {\\bold} \span {class="newStuff"} {(deprecated, use \\b)}
\li \l {brief-command} {\\brief}
\li \l {c-command} {\\c}
\li \l {caption-command} {\\caption}
\li \l {chapter-command} {\\chapter}
\li \l {class-command} {\\class}
\li \l {code-command} {\\code}
\li \l {codeline-command} {\\codeline},
\li \l {compat-command} {\\compat}
\li \l {contentspage-command} {\\contentspage}
\li \l {default-command} {\\default}
\li \l {ditamap-command} {\\ditamap} \span {class="newStuff"}
\li \l {div-command} {\\div}
\li \l {dots-command} {\\dots}
\li \l {e-command} {\\e} \span {class="newStuff"}
\li \l {else-command} {\\else}
\li \l {endif-command} {\\endif}
\li \l {enum-command} {\\enum}
\li \l {example-command} {\\example}
\li \l {externalpage-command} {\\externalpage}
\li \l {fn-command} {\\fn}
\li \l {footnote-command} {\\footnote}
\li \l {generatelist-command} {\\generatelist}
\li \l {group-command} {\\group}
\li \l {header-command} {\\header}
\li \l {headerfile-command} {\\headerfile}
\li \l {e-command} {\\i} \span {class="newStuff"} {(deprecated, use \\e)}
\li \l {if-command} {\\if}
\li \l {image-command} {\\image}
\li \l {include-command} {\\include}
\li \l {indexpage-command} {\\indexpage}
\li \l {ingroup-command} {\\ingroup}
\li \l {inherits-command}{\\inherits}
\li \l {inlineimage-command} {\\inlineimage}
\li \l {inmodule-command} {\\inmodule}
\li \l {inqmlmodule-command} {\\inqmlmodule}
\li \l {instantiates-command} {\\instantiates} \span {class="newStuff"} {(new 27/7/2012)}
\li \l {internal-command} {\\internal}
\li \l {keyword-command} {\\keyword}
\li \l {l-command} {\\l}
\li \l {legalese-command} {\\legalese}
\li \l {li-command} {\\li} \span {class="newStuff"}
\li \l {list-command} {\\list}
\li \l {macro-command} {\\macro}
\li \l {mainclass-command} {\\mainclass}
\li \l {mapref-command} {\\mapref} \span {class="newStuff"}
\li \l {meta-command} {\\meta}
\li \l {module-command} {\\module}
\li \l {namespace-command} {\\namespace}
\li \l {nextpage-command} {\\nextpage}
\li \l {newcode-command} {\\newcode}
\li \l {nonreentrant-command} {\\nonreentrant}
\li \l {note-command} {\\note}
\li \l {li-command} {\\o} \span {class="newStuff"} {(deprecated, use \\li)}
\li \l {16-qdoc-commands-status.html#obsolete-command} {\\obsolete}
\li \l {06-qdoc-commands-includecodeinline.html#oldcode-command} {\\oldcode}
\li \l {12-0-qdoc-commands-miscellaneous.html#omit-command} {\\omit}
\li \l {10-qdoc-commands-tablesandlists.html#omitvalue-command} {\\omitvalue}
\li \l {18-qdoc-commands-relating.html#overload-command} {\\overload}
\li \l {13-qdoc-commands-topics.html#page-command} {\\page}
\li \l {05-qdoc-commands-documentstructure.html#part-command} {\\part}
\li \l {16-qdoc-commands-status.html#preliminary-command} {\\preliminary}
\li \l {15-qdoc-commands-navigation.html#previouspage-command} {\\previouspage}
\li \l {07-0-qdoc-commands-includingexternalcode.html#printline-command} {\\printline}
\li \l {07-0-qdoc-commands-includingexternalcode.html#printto-command} {\\printto}
\li \l {07-0-qdoc-commands-includingexternalcode.html#printuntil-command} {\\printuntil}
\li \l {13-qdoc-commands-topics.html#property-command} {\\property}
\li \l {13-qdoc-commands-topics.html#qmlattachedproperty-command} {\\qmlattachedproperty}
\li \l {13-qdoc-commands-topics.html#qmlattachedsignal-command} {\\qmlattachedsignal}
\li \l {13-qdoc-commands-topics.html#qmlbasictype-command} {\\qmlbasictype}
\li \l {13-qdoc-commands-topics.html#qmlclass-command} {\\qmlclass} \span {class="newStuff"} {(deprecated, use \\qmltype)}
\li \l {13-qdoc-commands-topics.html#qmltype-command} {\\qmltype} \span {class="newStuff"} {(new 27/7/2012)}
\li \l {13-qdoc-commands-topics.html#qmlmethod-command} {\\qmlmethod}
\li \l {13-qdoc-commands-topics.html#qmlproperty-command} {\\qmlproperty}
\li \l {13-qdoc-commands-topics.html#qmlsignal-command} {\\qmlsignal}
\li \l {13-qdoc-commands-topics.html#qmlmodule-command} {\\qmlmodule}
\li \l {11-qdoc-commands-specialcontent.html#quotation-command} {\\quotation}
\li \l {07-0-qdoc-commands-includingexternalcode.html#quotefile-command} {\\quotefile}
\li \l {07-0-qdoc-commands-includingexternalcode.html#quotefromfile-command} {\\quotefromfile}
\li \l {12-0-qdoc-commands-miscellaneous.html#raw-command} {\\raw} \span {class="newStuff"} {(avoid)}
\li \l {17-qdoc-commands-thread.html#reentrant-command} {\\reentrant}
\li \l {18-qdoc-commands-relating.html#reimp-command} {\\reimp}
\li \l {18-qdoc-commands-relating.html#relates-command} {\\relates}
\li \l {10-qdoc-commands-tablesandlists.html#row-command} {\\row}
\li \l {08-qdoc-commands-creatinglinks.html#sa-command} {\\sa}
\li \l {05-qdoc-commands-documentstructure.html#sectionOne-command} {\\section1}
\li \l {05-qdoc-commands-documentstructure.html#sectionTwo-command} {\\section2}
\li \l {05-qdoc-commands-documentstructure.html#sectionThree-command} {\\section3}
\li \l {05-qdoc-commands-documentstructure.html#sectionFour-command} {\\section4}
\li \l {13-qdoc-commands-topics.html#service-command} {\\service}
\li \l {16-qdoc-commands-status.html#since-command} {\\since}
\li \l {07-0-qdoc-commands-includingexternalcode.html#skipline-command} {\\skipline}
\li \l {07-0-qdoc-commands-includingexternalcode.html#skipto-command} {\\skipto}
\li \l {07-0-qdoc-commands-includingexternalcode.html#skipuntil-command} {\\skipuntil}
\li \l {07-0-qdoc-commands-includingexternalcode.html#snippet-command} {\\snippet},
\li \l {04-qdoc-commands-textmarkup.html#span-command} {\\span}
\li \l {15-qdoc-commands-navigation.html#startpage-command} {\\startpage}
\li \l {04-qdoc-commands-textmarkup.html#sub-command} {\\sub}
\li \l {20-qdoc-commands-namingthings.html#subtitle-command} {\\subtitle}
\li \l {04-qdoc-commands-textmarkup.html#sup-command} {\\sup}
\li \l {10-qdoc-commands-tablesandlists.html#table-command} {\\table}
\li \l {11-qdoc-commands-specialcontent.html#tableofcontents-command} {\\tableofcontents}
\li \l {08-qdoc-commands-creatinglinks.html#target-command} {\\target}
\li \l {17-qdoc-commands-thread.html#threadsafe-command} {\\threadsafe}
\li \l {20-qdoc-commands-namingthings.html#title-command} {\\title}
\li \l {21-0-qdoc-creating-dita-maps.html#topicref-command} {\\topicref} \span {class="newStuff"} {(new 05/03/12)}
\li \l {04-qdoc-commands-textmarkup.html#tt-command} {\\tt}
\li \l {13-qdoc-commands-topics.html#typedef-command} {\\typedef}
\li \l {04-qdoc-commands-textmarkup.html#uicontrol-command} {\\uicontrol} {(new 25/3/2012)}
\li \l {04-qdoc-commands-textmarkup.html#underline-command} {\\underline}
\li \l {13-qdoc-commands-topics.html#variable-command} {\\variable}
\li \l {10-qdoc-commands-tablesandlists.html#value-command} {\\value}
\li \l {11-qdoc-commands-specialcontent.html#warning-command} {\\warning}
\li \l {obsolete-command} {\\obsolete}
\li \l {oldcode-command} {\\oldcode}
\li \l {omit-command} {\\omit}
\li \l {omitvalue-command} {\\omitvalue}
\li \l {overload-command} {\\overload}
\li \l {page-command} {\\page}
\li \l {part-command} {\\part}
\li \l {preliminary-command} {\\preliminary}
\li \l {previouspage-command} {\\previouspage}
\li \l {printline-command} {\\printline}
\li \l {printto-command} {\\printto}
\li \l {printuntil-command} {\\printuntil}
\li \l {property-command} {\\property}
\li \l {qmlattachedproperty-command} {\\qmlattachedproperty}
\li \l {qmlattachedsignal-command} {\\qmlattachedsignal}
\li \l {qmlbasictype-command} {\\qmlbasictype}
\li \l {qmlclass-command} {\\qmlclass} \span {class="newStuff"} {(deprecated, use \\qmltype)}
\li \l {qmltype-command} {\\qmltype} \span {class="newStuff"}
\li \l {qmlmethod-command} {\\qmlmethod}
\li \l {qmlproperty-command} {\\qmlproperty}
\li \l {qmlsignal-command} {\\qmlsignal}
\li \l {qmlmodule-command} {\\qmlmodule}
\li \l {quotation-command} {\\quotation}
\li \l {quotefile-command} {\\quotefile}
\li \l {quotefromfile-command} {\\quotefromfile}
\li \l {raw-command} {\\raw} \span {class="newStuff"} {(avoid)}
\li \l {reentrant-command} {\\reentrant}
\li \l {reimp-command} {\\reimp}
\li \l {relates-command} {\\relates}
\li \l {row-command} {\\row}
\li \l {sa-command} {\\sa}
\li \l {sectionOne-command} {\\section1}
\li \l {sectionTwo-command} {\\section2}
\li \l {sectionThree-command} {\\section3}
\li \l {sectionFour-command} {\\section4}
\li \l {service-command} {\\service}
\li \l {since-command} {\\since}
\li \l {skipline-command} {\\skipline}
\li \l {skipto-command} {\\skipto}
\li \l {skipuntil-command} {\\skipuntil}
\li \l {snippet-command} {\\snippet},
\li \l {span-command} {\\span}
\li \l {startpage-command} {\\startpage}
\li \l {sub-command} {\\sub}
\li \l {subtitle-command} {\\subtitle}
\li \l {sup-command} {\\sup}
\li \l {table-command} {\\table}
\li \l {tableofcontents-command} {\\tableofcontents}
\li \l {target-command} {\\target}
\li \l {threadsafe-command} {\\threadsafe}
\li \l {title-command} {\\title}
\li \l {topicref-command} {\\topicref} \span {class="newStuff"}
\li \l {tt-command} {\\tt}
\li \l {typedef-command} {\\typedef}
\li \l {uicontrol-command} {\\uicontrol}
\li \l {underline-command} {\\underline}
\li \l {variable-command} {\\variable}
\li \l {value-command} {\\value}
\li \l {warning-command} {\\warning}
\endlist
*/

View File

@ -46,28 +46,28 @@
below the \l {Topic Commands} {topic} command.
\list
\li \l {16-qdoc-commands-status.html#compat-command}{\\compat},
\li \l {15-qdoc-commands-navigation.html#contentspage-command}{\\contentspage},
\li \l {15-qdoc-commands-navigation.html#indexpage-command}{\\indexpage},
\li \l {19-qdoc-commands-grouping.html#ingroup-command}{\\ingroup},
\li \l {18-qdoc-commands-relating.html#inherits-command}{\\inherits},
\li \l {19-qdoc-commands-grouping.html#inmodule-command}{\\inmodule},
\li \l {16-qdoc-commands-status.html#internal-command}{\\internal},
\li \l {19-qdoc-commands-grouping.html#mainclass-command}{\\mainclass},
\li \l {15-qdoc-commands-navigation.html#nextpage-command}{\\nextpage},
\li \l {17-qdoc-commands-thread.html#nonreentrant-command}{\\nonreentrant},
\li \l {16-qdoc-commands-status.html#obsolete-command}{\\obsolete},
\li \l {18-qdoc-commands-relating.html#overload-command}{\\overload},
\li \l {16-qdoc-commands-status.html#preliminary-command}{\\preliminary},
\li \l {15-qdoc-commands-navigation.html#previouspage-command}{\\previouspage},
\li \l {17-qdoc-commands-thread.html#reentrant-command}{\\reentrant},
\li \l {18-qdoc-commands-relating.html#reimp-command}{\\reimp},
\li \l {18-qdoc-commands-relating.html#relates-command}{\\relates},
\li \l {16-qdoc-commands-status.html#since-command}{\\since},
\li \l {15-qdoc-commands-navigation.html#startpage-command}{\\startpage},
\li \l {20-qdoc-commands-namingthings.html#subtitle-command}{\\subtitle}
\li \l {17-qdoc-commands-thread.html#threadsafe-command}{\\threadsafe},
\li \l {20-qdoc-commands-namingthings.html#title-command}{\\title}
\li \l {compat-command}{\\compat},
\li \l {contentspage-command}{\\contentspage},
\li \l {indexpage-command}{\\indexpage},
\li \l {ingroup-command}{\\ingroup},
\li \l {inherits-command}{\\inherits},
\li \l {inmodule-command}{\\inmodule},
\li \l {internal-command}{\\internal},
\li \l {mainclass-command}{\\mainclass},
\li \l {nextpage-command}{\\nextpage},
\li \l {nonreentrant-command}{\\nonreentrant},
\li \l {obsolete-command}{\\obsolete},
\li \l {overload-command}{\\overload},
\li \l {preliminary-command}{\\preliminary},
\li \l {previouspage-command}{\\previouspage},
\li \l {reentrant-command}{\\reentrant},
\li \l {reimp-command}{\\reimp},
\li \l {relates-command}{\\relates},
\li \l {since-command}{\\since},
\li \l {startpage-command}{\\startpage},
\li \l {subtitle-command}{\\subtitle}
\li \l {threadsafe-command}{\\threadsafe},
\li \l {title-command}{\\title}
\endlist
*/
@ -297,7 +297,7 @@
\section1 \\default
The \\default command is for marking a QML property as the
\l {http://qt-project.org/doc/qt-4.7/qdeclarativeintroduction.html#default-properties}
\l {default-properties}
{default property}. The word \span {class="newStuff"} {default} is shown in red in
the documentation of the property.
@ -314,7 +314,7 @@
\endcode
See how QDoc renders this property on the reference page for the
\l {http://qt-project.org/doc/qt-4.7/qml-state.html#changes-prop} {State}
\l {changes-prop} {State}
type.
\target obsolete-command
@ -448,7 +448,7 @@
\list
\li ...
\li Joining
\l {http://qt-project.org/doc/qt-5.0/qtcore/qchar.html#Joining-enum}
\l {Joining-enum}
{joining}()
const \c (preliminary)
\li ...
@ -497,7 +497,7 @@
configuration variable. For that reason this reference will change
according to the current documentation project.
See also \l {25-qdoc-configuration-derivedprojects.html#project}
See also \l {project}
{\c project}.
*/
@ -794,7 +794,7 @@
</h3>
\endraw
This function overloads \l {http://qt-project.org/doc/qt-5.0/qtwidgets/qwidget.html#addAction} {addAction()}
This function overloads \l {addAction} {addAction()}
This convenience function creates a new action with an
\e icon and some \e text. The function adds the newly
@ -802,7 +802,7 @@
returns it.
See also
\l {http://qt-project.org/doc/qt-5.0/qtwidgets/qwidget.html#addAction}
\l {addAction}
{QWidget::addAction}().
\endquotation

View File

@ -80,7 +80,7 @@
\endcode
From the QDoc comment above, QDoc generates the HTML page
\l {http://qt-project.org/doc/qt-5.0/qtcore/qobject.html#details}
\l {details}
{QObject Class Reference}.
This manual explains how to use the QDoc commands in QDoc comments
@ -120,7 +120,7 @@
also specify \e {DITAXML} to get DITA XML output instead.
Next, QDoc uses the values of the
\l {22-qdoc-configuration-generalvariables.html#headerdirs-variable}
\l {headerdirs-variable}
{headerdirs} variable and/or the \l
{22-qdoc-configuration-generalvariables.html#headers-variable}
{headers} variable to find and parse all the header files for your

View File

@ -37,72 +37,72 @@
appearance and logical structure.
\list
\li \l {04-qdoc-commands-textmarkup.html#a-command} {\\a}
\li \l {11-qdoc-commands-specialcontent.html#abstract-command} {\\abstract}
\li \l {12-0-qdoc-commands-miscellaneous.html#annotatedlist-command} {\\annotatedlist}
\li \l {04-qdoc-commands-textmarkup.html#b-command} {\\b} \span {class="newStuff"} {(new 5/3/2012)}
\li \l {04-qdoc-commands-textmarkup.html#b-command} {\\bold} {(deprecated, use \\b)}
\li \l {11-qdoc-commands-specialcontent.html#brief-command} {\\brief}
\li \l {04-qdoc-commands-textmarkup.html#c-command} {\\c}
\li \l {09-qdoc-commands-includingimages.html#caption-command} {\\caption}
\li \l {05-qdoc-commands-documentstructure.html#chapter-command} {\\chapter}
\li \l {06-qdoc-commands-includecodeinline.html#code-command} {\\code}
\li \l {07-0-qdoc-commands-includingexternalcode.html#codeline-command} {\\codeline}
\li \l {04-qdoc-commands-textmarkup.html#div-command} {\\div}
\li \l {07-0-qdoc-commands-includingexternalcode.html#dots-command} {\\dots}
\li \l {04-qdoc-commands-textmarkup.html#e-command} {\\e} \span {class="newStuff"} {(new 5/3/2012)}
\li \l {12-0-qdoc-commands-miscellaneous.html#else-command} {\\else}
\li \l {12-0-qdoc-commands-miscellaneous.html#endif-command} {\\endif}
\li \l {11-qdoc-commands-specialcontent.html#footnote-command} {\\footnote}
\li \l {12-0-qdoc-commands-miscellaneous.html#generatelist-command} {\\generatelist}
\li \l {10-qdoc-commands-tablesandlists.html#header-command} {\\header}
\li \l {04-qdoc-commands-textmarkup.html#e-command} {\\i} \span {class="newStuff"} {(deprecated, use \\e)}
\li \l {12-0-qdoc-commands-miscellaneous.html#if-command} {\\if}
\li \l {09-qdoc-commands-includingimages.html#image-command} {\\image}
\li \l {12-0-qdoc-commands-miscellaneous.html#include-command} {\\include}
\li \l {12-0-qdoc-commands-miscellaneous.html#include-command} {\\input}
\li \l {09-qdoc-commands-includingimages.html#inlineimage-command} {\\inlineimage}
\li \l {08-qdoc-commands-creatinglinks.html#keyword-command} {\\keyword}
\li \l {08-qdoc-commands-creatinglinks.html#l-command} {\\l}
\li \l {11-qdoc-commands-specialcontent.html#legalese-command} {\\legalese}
\li \l {10-qdoc-commands-tablesandlists.html#li-command} {\\li} \span {class="newStuff"} {(new 5/3/2012)}
\li \l {10-qdoc-commands-tablesandlists.html#list-command} {\\list}
\li \l {12-0-qdoc-commands-miscellaneous.html#meta-command} {\\meta}
\li \l {06-qdoc-commands-includecodeinline.html#newcode-command} {\\newcode}
\li \l {10-qdoc-commands-tablesandlists.html#li-command} {\\o} \span {class="newStuff"} {(deprecated, use \\li)}
\li \l {11-qdoc-commands-specialcontent.html#note-command} {\\note}
\li \l {06-qdoc-commands-includecodeinline.html#oldcode-command} {\\oldcode}
\li \l {12-0-qdoc-commands-miscellaneous.html#omit-command} {\\omit}
\li \l {05-qdoc-commands-documentstructure.html#part-command} {\\part}
\li \l {07-0-qdoc-commands-includingexternalcode.html#printline-command} {\\printline}
\li \l {07-0-qdoc-commands-includingexternalcode.html#printto-command} {\\printto}
\li \l {07-0-qdoc-commands-includingexternalcode.html#printuntil-command} {\\printuntil}
\li \l {11-qdoc-commands-specialcontent.html#quotation-command} {\\quotation}
\li \l {07-0-qdoc-commands-includingexternalcode.html#quotefile-command} {\\quotefile}
\li \l {07-0-qdoc-commands-includingexternalcode.html#quotefromfile-command} {\\quotefromfile}
\li \l {12-0-qdoc-commands-miscellaneous.html#raw-command} {\\raw}
\li \l {10-qdoc-commands-tablesandlists.html#row-command} {\\row}
\li \l {08-qdoc-commands-creatinglinks.html#sa-command} {\\sa}
\li \l {05-qdoc-commands-documentstructure.html#sectionOne-command} {\\section1}
\li \l {05-qdoc-commands-documentstructure.html#sectionTwo-command} {\\section2}
\li \l {05-qdoc-commands-documentstructure.html#sectionThree-command} {\\section3}
\li \l {05-qdoc-commands-documentstructure.html#sectionFour-command} {\\section4}
\li \l {07-0-qdoc-commands-includingexternalcode.html#skipline-command} {\\skipline}
\li \l {07-0-qdoc-commands-includingexternalcode.html#skipto-command} {\\skipto}
\li \l {07-0-qdoc-commands-includingexternalcode.html#skipuntil-command} {\\skipuntil}
\li \l {07-0-qdoc-commands-includingexternalcode.html#snippet-command} {\\snippet}
\li \l {04-qdoc-commands-textmarkup.html#span-command} {\\span}
\li \l {04-qdoc-commands-textmarkup.html#sub-command} {\\sub}
\li \l {04-qdoc-commands-textmarkup.html#sup-command} {\\sup}
\li \l {10-qdoc-commands-tablesandlists.html#table-command} {\\table}
\li \l {11-qdoc-commands-specialcontent.html#tableofcontents-command} {\\tableofcontents}
\li \l {08-qdoc-commands-creatinglinks.html#target-command} {\\target}
\li \l {04-qdoc-commands-textmarkup.html#tt-command} {\\tt}
\li \l {04-qdoc-commands-textmarkup.html#uicontrol-command} {\\uicontrol} {(new 25/3/2012)}
\li \l {04-qdoc-commands-textmarkup.html#underline-command} {\\underline}
\li \l {12-0-qdoc-commands-miscellaneous.html#raw-command} {\\unicode}
\li \l {11-qdoc-commands-specialcontent.html#warning-command} {\\warning}
\li \l {04-qdoc-commands-textmarkup.html#backslash-command} {\\\\}
\li \l {a-command} {\\a}
\li \l {abstract-command} {\\abstract}
\li \l {annotatedlist-command} {\\annotatedlist}
\li \l {b-command} {\\b} \span {class="newStuff"}
\li \l {b-command} {\\bold} {(deprecated, use \\b)}
\li \l {brief-command} {\\brief}
\li \l {c-command} {\\c}
\li \l {caption-command} {\\caption}
\li \l {chapter-command} {\\chapter}
\li \l {code-command} {\\code}
\li \l {codeline-command} {\\codeline}
\li \l {div-command} {\\div}
\li \l {dots-command} {\\dots}
\li \l {e-command} {\\e} \span {class="newStuff"}
\li \l {else-command} {\\else}
\li \l {endif-command} {\\endif}
\li \l {footnote-command} {\\footnote}
\li \l {generatelist-command} {\\generatelist}
\li \l {header-command} {\\header}
\li \l {e-command} {\\i} \span {class="newStuff"} {(deprecated, use \\e)}
\li \l {if-command} {\\if}
\li \l {image-command} {\\image}
\li \l {include-command} {\\include}
\li \l {include-command} {\\input}
\li \l {inlineimage-command} {\\inlineimage}
\li \l {keyword-command} {\\keyword}
\li \l {l-command} {\\l}
\li \l {legalese-command} {\\legalese}
\li \l {li-command} {\\li} \span {class="newStuff"}
\li \l {list-command} {\\list}
\li \l {meta-command} {\\meta}
\li \l {newcode-command} {\\newcode}
\li \l {li-command} {\\o} \span {class="newStuff"} {(deprecated, use \\li)}
\li \l {note-command} {\\note}
\li \l {oldcode-command} {\\oldcode}
\li \l {omit-command} {\\omit}
\li \l {part-command} {\\part}
\li \l {printline-command} {\\printline}
\li \l {printto-command} {\\printto}
\li \l {printuntil-command} {\\printuntil}
\li \l {quotation-command} {\\quotation}
\li \l {quotefile-command} {\\quotefile}
\li \l {quotefromfile-command} {\\quotefromfile}
\li \l {raw-command} {\\raw}
\li \l {row-command} {\\row}
\li \l {sa-command} {\\sa}
\li \l {sectionOne-command} {\\section1}
\li \l {sectionTwo-command} {\\section2}
\li \l {sectionThree-command} {\\section3}
\li \l {sectionFour-command} {\\section4}
\li \l {skipline-command} {\\skipline}
\li \l {skipto-command} {\\skipto}
\li \l {skipuntil-command} {\\skipuntil}
\li \l {snippet-command} {\\snippet}
\li \l {span-command} {\\span}
\li \l {sub-command} {\\sub}
\li \l {sup-command} {\\sup}
\li \l {table-command} {\\table}
\li \l {tableofcontents-command} {\\tableofcontents}
\li \l {target-command} {\\target}
\li \l {tt-command} {\\tt}
\li \l {uicontrol-command} {\\uicontrol} {(new 25/3/2012)}
\li \l {underline-command} {\\underline}
\li \l {raw-command} {\\unicode}
\li \l {warning-command} {\\warning}
\li \l {backslash-command} {\\\\}
\endlist
*/
@ -1826,7 +1826,7 @@
\endcode
For the one-parameter version, the braces can often be omitted.
The \\l command supports several kinds of links:
The \\l command supports several ways of linking:
\list
@ -1855,9 +1855,6 @@
\li \c {\l {Shared Classes}} - A keyword named in a \l
{keyword-command} {\\keyword} command.
\li \c {\l network.html} - The file name used in a \l
{page-command} {\\page} command.
\li \c {\l http://qt-project.org/} - A URL.
\endlist
@ -1974,22 +1971,15 @@
\endcode
The target name \e{capturing parentheses} can be linked from
within the same document containing the target in two ways:
within the same document containing the target in the following way:
\list
\li \c {\l {capturing parentheses}} (from within the same QDoc comment)
\li \c {\l qregexp.html#capturing-parentheses} (from elsewhere in the same document)
\endlist
\note The brackets in the link example are required because the
target name contains spaces.
The target name can be linked to in the following way from other documents:
\list
\li \c {\l http://qt-project.org/doc/qt-5.0/qtcore/qregexp.html#capturing-parentheses}
\endlist
See also \l {l-command} {\\l}, \l {sa-command} {\\sa} and \l
{keyword-command} {\\keyword}.
@ -2042,7 +2032,7 @@
\quotation
When a string is surrounded by slashes, it is
interpreted as a \l {QRegExp}{regular expression}.
interpreted as a \l {regular expression}.
\endquotation
If the keyword text contains spaces, the brackets are required.
@ -2961,15 +2951,16 @@
\target brief class
When the \\brief command is used to describe a class, the brief
text should be a complete sentence and must start like this:
When the \\brief command is used to describe a class, we recommend
using a complete sentence like this:
\code
The <classname> class is|provides|contains|specifies...
\endcode
\warning The brief statement is used as the first paragraph of the
detailed description. Do not repeat the sentence.
\warning Do not repeat your detailed description with the same sentence as
the brief statement will be the first paragraph of the detailed
description.
\code
/ *!

View File

@ -63,7 +63,7 @@
Some configuration variables accept a list of strings as their
value, for example:
\l {22-qdoc-configuration-generalvariables.html#sourcedirs-variable}
\l {sourcedirs-variable}
{\c{sourcedirs}}, while others accept only a single string. Double
quotes around a value string are optional, but including them allows
you to use special characters like '=' and ' \" ' within the value
@ -87,39 +87,39 @@
\section1 Variable List
\list
\li \l {22-qdoc-configuration-generalvariables.html#alias-variable} {alias}
\li \l {23-qdoc-configuration-cppvariables.html#Cpp.ignoredirectives-variable} {Cpp.ignoredirectives}
\li \l {23-qdoc-configuration-cppvariables.html#Cpp.ignoretokens-variable} {Cpp.ignoretokens}
\li \l {22-qdoc-configuration-generalvariables.html#defines-variable} {defines}
\li \l {22-qdoc-configuration-generalvariables.html#edition-variable} {edition}
\li \l {22-qdoc-configuration-generalvariables.html#exampledirs-variable} {exampledirs}
\li \l {22-qdoc-configuration-generalvariables.html#examples-variable} {examples}
\li \l {22-qdoc-configuration-generalvariables.html#examples.fileextensions-variable} {examples.fileextensions}
\li \l {22-qdoc-configuration-generalvariables.html#excludedirs-variable} {excludedirs}
\li \l {22-qdoc-configuration-generalvariables.html#excludefiles-variable} {excludefiles}
\li \l {22-qdoc-configuration-generalvariables.html#extraimages-variable} {extraimages}
\li \l {22-qdoc-configuration-generalvariables.html#falsehoods-variable} {falsehoods}
\li \l {22-qdoc-configuration-generalvariables.html#headerdirs-variable} {headerdirs}
\li \l {22-qdoc-configuration-generalvariables.html#headers-variable} {headers}
\li \l {22-qdoc-configuration-generalvariables.html#headers.fileextensions-variable} {headers.fileextensions}
\li \l {24-qdoc-configuration-htmlvariables.html#HTML.footer-variable} {HTML.footer}
\li \l {24-qdoc-configuration-htmlvariables.html#HTML.postheader-variable} {HTML.postheader}
\li \l {24-qdoc-configuration-htmlvariables.html#HTML.style-variable} {HTML.style}
\li \l {22-qdoc-configuration-generalvariables.html#imagedirs-variable} {imagedirs}
\li \l {22-qdoc-configuration-generalvariables.html#images-variable} {images}
\li \l {22-qdoc-configuration-generalvariables.html#images.fileextensions-variable} {images.fileextensions}
\li \l {22-qdoc-configuration-generalvariables.html#language-variable} {language}
\li \l {22-qdoc-configuration-generalvariables.html#macro-variable} {macro}
\li \l {22-qdoc-configuration-generalvariables.html#manifestmeta-variable} {manifestmeta}
\li \l {22-qdoc-configuration-generalvariables.html#outputdir-variable} {outputdir}
\li \l {22-qdoc-configuration-generalvariables.html#outputformats-variable} {outputformats}
\li \l {22-qdoc-configuration-generalvariables.html#sourcedirs-variable} {sourcedirs}
\li \l {22-qdoc-configuration-generalvariables.html#sources-variable} {sources}
\li \l {22-qdoc-configuration-generalvariables.html#sources.fileextensions-variable} {sources.fileextensions}
\li \l {22-qdoc-configuration-generalvariables.html#spurious-variable} {spurious}
\li \l {22-qdoc-configuration-generalvariables.html#tabsize-variable} {tabsize}
\li \l {22-qdoc-configuration-generalvariables.html#version-variable} {version}
\li \l {22-qdoc-configuration-generalvariables.html#versionsym-variable} {versionsym}
\li \l {alias-variable} {alias}
\li \l {Cpp.ignoredirectives-variable} {Cpp.ignoredirectives}
\li \l {Cpp.ignoretokens-variable} {Cpp.ignoretokens}
\li \l {defines-variable} {defines}
\li \l {edition-variable} {edition}
\li \l {exampledirs-variable} {exampledirs}
\li \l {examples-variable} {examples}
\li \l {examples.fileextensions-variable} {examples.fileextensions}
\li \l {excludedirs-variable} {excludedirs}
\li \l {excludefiles-variable} {excludefiles}
\li \l {extraimages-variable} {extraimages}
\li \l {falsehoods-variable} {falsehoods}
\li \l {headerdirs-variable} {headerdirs}
\li \l {headers-variable} {headers}
\li \l {headers.fileextensions-variable} {headers.fileextensions}
\li \l {HTML.footer-variable} {HTML.footer}
\li \l {HTML.postheader-variable} {HTML.postheader}
\li \l {HTML.style-variable} {HTML.style}
\li \l {imagedirs-variable} {imagedirs}
\li \l {images-variable} {images}
\li \l {images.fileextensions-variable} {images.fileextensions}
\li \l {language-variable} {language}
\li \l {macro-variable} {macro}
\li \l {manifestmeta-variable} {manifestmeta}
\li \l {outputdir-variable} {outputdir}
\li \l {outputformats-variable} {outputformats}
\li \l {sourcedirs-variable} {sourcedirs}
\li \l {sources-variable} {sources}
\li \l {sources.fileextensions-variable} {sources.fileextensions}
\li \l {spurious-variable} {spurious}
\li \l {tabsize-variable} {tabsize}
\li \l {version-variable} {version}
\li \l {versionsym-variable} {versionsym}
\endlist
\section1 Categories
@ -1574,7 +1574,7 @@
dita.metadata.default.audience = programmer
\endcode
See the \l {12-0-qdoc-commands-miscellaneous.html#meta-command}
See the \l {meta-command}
{\\meta} command for more details on DITA metadata.
*/

View File

@ -2858,6 +2858,21 @@ int QTreeView::sizeHintForColumn(int column) const
int offset = 0;
int start = d->firstVisibleItem(&offset);
int end = d->lastVisibleItem(start, offset);
if (start < 0 || end < 0 || end == viewItems.size() - 1) {
end = viewItems.size() - 1;
if (maximumProcessRows < 0) {
start = 0;
} else if (maximumProcessRows == 0) {
start = qMax(0, end - 1);
int remainingHeight = viewport()->height();
while (start > 0 && remainingHeight > 0) {
remainingHeight -= d->itemHeight(start);
--start;
}
} else {
start = qMax(0, end - maximumProcessRows);
}
}
int rowsProcessed = 0;
@ -3606,8 +3621,11 @@ int QTreeViewPrivate::firstVisibleItem(int *offset) const
int QTreeViewPrivate::lastVisibleItem(int firstVisual, int offset) const
{
if (firstVisual < 0 || offset < 0)
if (firstVisual < 0 || offset < 0) {
firstVisual = firstVisibleItem(&offset);
if (firstVisual < 0)
return -1;
}
int y = - offset;
int value = viewport->height();

View File

@ -7012,7 +7012,7 @@ void QWidget::show()
bool isPopup = data->window_flags & Qt::Popup & ~Qt::Window;
if (isWindow() && !isPopup && qApp->styleHints()->showIsFullScreen())
showFullScreen();
else if (isWindow() && !isPopup && QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::ShowIsMaximized).toBool())
else if (isWindow() && !(data->window_flags & Qt::Dialog & ~Qt::Window) && !isPopup && QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::ShowIsMaximized).toBool())
showMaximized();
else
setVisible(true);

View File

@ -53,7 +53,7 @@ class QKeySequenceEditPrivate;
class Q_WIDGETS_EXPORT QKeySequenceEdit : public QWidget
{
Q_OBJECT
Q_PROPERTY(QKeySequence keySequence READ keySequence WRITE setKeySequence RESET clear NOTIFY keySequenceChanged USER true)
Q_PROPERTY(QKeySequence keySequence READ keySequence WRITE setKeySequence NOTIFY keySequenceChanged USER true)
public:
explicit QKeySequenceEdit(QWidget *parent = 0);

View File

@ -426,7 +426,9 @@ private:
// The limit to the amount of times the DTD parsing functions can be called
// for the DTD currently being parsed.
int dtdRecursionLimit;
static const int dtdRecursionLimit = 2;
// The maximum amount of characters an entity value may contain, after expansion.
static const int entityCharacterLimit = 1024;
const QString &string();
void stringClear();
@ -497,7 +499,7 @@ private:
void parseFailed(ParseFunction where, int state);
void pushParseState(ParseFunction function, int state);
bool isPartiallyExpandedEntityValueTooLarge(QString *errorMessage);
bool isExpandedEntityValueTooLarge(QString *errorMessage);
Q_DECLARE_PUBLIC(QXmlSimpleReader)
QXmlSimpleReader *q_ptr;
@ -2763,8 +2765,6 @@ QXmlSimpleReaderPrivate::QXmlSimpleReaderPrivate(QXmlSimpleReader *reader)
useNamespacePrefixes = false;
reportWhitespaceCharData = true;
reportEntities = false;
dtdRecursionLimit = 2;
}
QXmlSimpleReaderPrivate::~QXmlSimpleReaderPrivate()
@ -6657,30 +6657,43 @@ bool QXmlSimpleReaderPrivate::parseChoiceSeq()
return false;
}
bool QXmlSimpleReaderPrivate::isPartiallyExpandedEntityValueTooLarge(QString *errorMessage)
bool QXmlSimpleReaderPrivate::isExpandedEntityValueTooLarge(QString *errorMessage)
{
const QString value = string();
QMap<QString, int> referencedEntityCounts;
foreach (QString entityName, entities.keys()) {
for (int i = 0; i < value.size() && i != -1; ) {
i = value.indexOf(entityName, i);
if (i != -1) {
// The entityName we're currently trying to find
// was matched in this string; increase our count.
++referencedEntityCounts[entityName];
i += entityName.size();
QMap<QString, int> literalEntitySizes;
// The entity at (QMap<QString,) referenced the entities at (QMap<QString,) (int>) times.
QMap<QString, QMap<QString, int> > referencesToOtherEntities;
QMap<QString, int> expandedSizes;
// For every entity, check how many times all entity names were referenced in its value.
foreach (QString toSearch, entities.keys()) {
// The amount of characters that weren't entity names, but literals, like 'X'.
QString leftOvers = entities.value(toSearch);
// How many times was entityName referenced by toSearch?
foreach (QString entityName, entities.keys()) {
for (int i = 0; i < leftOvers.size() && i != -1; ) {
i = leftOvers.indexOf(QString::fromLatin1("&%1;").arg(entityName), i);
if (i != -1) {
leftOvers.remove(i, entityName.size() + 2);
// The entityName we're currently trying to find was matched in this string; increase our count.
++referencesToOtherEntities[toSearch][entityName];
}
}
}
literalEntitySizes[toSearch] = leftOvers.size();
}
foreach (QString entityName, referencedEntityCounts.keys()) {
const int timesReferenced = referencedEntityCounts[entityName];
const QString entityValue = entities[entityName];
if (entityValue.size() * timesReferenced > 1024) {
foreach (QString entity, referencesToOtherEntities.keys()) {
expandedSizes[entity] = literalEntitySizes[entity];
foreach (QString referenceTo, referencesToOtherEntities.value(entity).keys()) {
const int references = referencesToOtherEntities.value(entity).value(referenceTo);
// The total size of an entity's value is the expanded size of all of its referenced entities, plus its literal size.
expandedSizes[entity] += expandedSizes[referenceTo] * references + literalEntitySizes[referenceTo] * references;
}
if (expandedSizes[entity] > entityCharacterLimit) {
if (errorMessage) {
*errorMessage = QString::fromLatin1("The XML entity \"%1\""
"expands too a string that is too large to process when "
"referencing \"%2\" %3 times.").arg(entityName).arg(entityName).arg(timesReferenced);
*errorMessage = QString::fromLatin1("The XML entity \"%1\" expands too a string that is too large to process (%2 characters > %3).");
*errorMessage = (*errorMessage).arg(entity).arg(expandedSizes[entity]).arg(entityCharacterLimit);
}
return true;
}
@ -6783,10 +6796,7 @@ bool QXmlSimpleReaderPrivate::parseEntityDecl()
case EValue:
if ( !entityExist(name())) {
QString errorMessage;
if (isPartiallyExpandedEntityValueTooLarge(&errorMessage)) {
// The entity at entityName is entityValue.size() characters
// long in its unexpanded form, and was mentioned timesReferenced times,
// resulting in a string that would be greater than 1024 characters.
if (isExpandedEntityValueTooLarge(&errorMessage)) {
reportParseError(errorMessage);
return false;
}

View File

@ -11,13 +11,27 @@
<file>extras/+custom3/+custom5/test</file>
<file>extras/+custom5/+custom3/test</file>
<file>platforms/test</file>
<file>platforms/+unix/+android/test</file>
<file>platforms/+unix/+blackberry/test</file>
<file>platforms/+unix/+ios/test</file>
<file>platforms/+unix/+mac/test</file>
<file>platforms/+windows/+wince/test</file>
<file>platforms/+windows/test</file>
<file>platforms/+windows/test2</file>
<file>platforms/+unix/+linux/test</file>
<file>platforms/+unix/test</file>
<file>platforms/test2</file>
<file>platforms/+android/test2</file>
<file>platforms/+blackberry/test2</file>
<file>platforms/+ios/test2</file>
<file>platforms/+mac/test2</file>
<file>platforms/+linux/test2</file>
<file>platforms/+wince/test2</file>
<file>platforms/+android/test</file>
<file>platforms/+blackberry/test</file>
<file>platforms/+ios/test</file>
<file>platforms/+osx/test</file>
<file>platforms/+wince/test</file>
<file>platforms/+windows/test</file>
<file>platforms/+mac/test</file>
<file>platforms/+linux/test</file>
<file>platforms/+generic_unix/test</file>
<file>platforms/+wince/test</file>
</qresource>
</RCC>

View File

@ -91,9 +91,33 @@ void tst_QFileSelector::basicTest_data()
QTest::addColumn<QString>("expectedPath");
QString test("/test");// '/' is here so dir string can also be selector string
QTest::newRow("platform") << QString(":/platforms/test") << QStringList()
<< QString(":/platforms/") + QLatin1Char(selectorIndicator)
+ QFileSelectorPrivate::platformSelectors().first() + test;
QString test2("/test2");
QString expectedPlatform1File(":/platforms");
QString expectedPlatform2File(""); //Only the last selector
#if defined(Q_OS_UNIX) && !defined(Q_OS_ANDROID) && !defined(Q_OS_BLACKBERRY) && !defined(Q_OS_IOS) && !defined(Q_OS_LINUX) && !defined(Q_OS_MAC)
/* We are only aware of specific unixes, and do not have test files for any of the others.
However those unixes can get a selector added from the result of a uname call, so this will
lead to a case where we don't have that file so we can't expect the concatenation of platform
selectors to work. It should just find the +unix/test file.*/
expectedPlatform1File = QString(":/platforms/") + QLatin1Char(selectorIndicator)
+ QString("unix/test");
expectedPlatform2File = QString(":/platforms/test2");
#else
foreach (const QString &selector, QFileSelectorPrivate::platformSelectors()) {
expectedPlatform1File = expectedPlatform1File + QLatin1Char('/') + QLatin1Char(selectorIndicator)
+ selector;
expectedPlatform2File = selector;
}
expectedPlatform1File += test;
expectedPlatform2File = QLatin1String(":/platforms/") + QLatin1Char(selectorIndicator)
+ expectedPlatform2File + test2;
#endif
QTest::newRow("platform1") << QString(":/platforms/test") << QStringList()
<< expectedPlatform1File;
QTest::newRow("platform2") << QString(":/platforms/test2") << QStringList()
<< expectedPlatform2File;
QString resourceTestPath(":/extras/test");
QString custom1("custom1");

View File

@ -64,6 +64,7 @@ private slots:
void isNull();
void equal();
void notEqual();
void cpp11();
// Only in Qt > 3.2.x
void generate();
@ -245,6 +246,17 @@ void tst_QUuid::notEqual()
QVERIFY( uuidA != uuidB );
}
void tst_QUuid::cpp11() {
#ifdef Q_COMPILER_UNIFORM_INIT
// "{fc69b59e-cc34-4436-a43c-ee95d128b8c5}" cf, initTestCase
Q_DECL_CONSTEXPR QUuid u1{0xfc69b59e, 0xcc34, 0x4436, 0xa4, 0x3c, 0xee, 0x95, 0xd1, 0x28, 0xb8, 0xc5};
Q_DECL_CONSTEXPR QUuid u2 = {0xfc69b59e, 0xcc34, 0x4436, 0xa4, 0x3c, 0xee, 0x95, 0xd1, 0x28, 0xb8, 0xc5};
Q_UNUSED(u1);
Q_UNUSED(u2);
#else
QSKIP("This compiler is not in C++11 mode or it doesn't support uniform initialization");
#endif
}
void tst_QUuid::generate()
{

View File

@ -1027,7 +1027,7 @@ void tst_QAlgorithms::binaryFindOnLargeContainer() const
}
// alternative implementation of qPopulationCount for comparison:
static const uint bitsSetInNibble[] = {
static Q_DECL_CONSTEXPR const uint bitsSetInNibble[] = {
0, 1, 1, 2, 1, 2, 2, 3,
1, 2, 2, 3, 2, 3, 3, 4,
};

View File

@ -0,0 +1,7 @@
CONFIG += testcase parallel_test
TARGET = tst_qcollator
QT = core testlib
SOURCES = tst_qcollator.cpp
DEFINES += QT_NO_CAST_TO_ASCII
contains(QT_CONFIG,icu):DEFINES += QT_USE_ICU
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0

View File

@ -0,0 +1,92 @@
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the test suite of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include <QtTest/QtTest>
#include <qlocale.h>
#include <qcollator.h>
#include <cstring>
class tst_QCollator : public QObject
{
Q_OBJECT
private Q_SLOTS:
void moveSemantics();
};
#ifdef Q_COMPILER_RVALUE_REFS
static bool dpointer_is_null(QCollator &c)
{
char mem[sizeof c];
using namespace std;
memcpy(mem, &c, sizeof c);
for (size_t i = 0; i < sizeof c; ++i)
if (mem[i])
return false;
return true;
}
#endif
void tst_QCollator::moveSemantics()
{
#ifdef Q_COMPILER_RVALUE_REFS
const QLocale de_AT(QLocale::German, QLocale::Austria);
QCollator c1(de_AT);
QCOMPARE(c1.locale(), de_AT);
QCollator c2(std::move(c1));
QCOMPARE(c2.locale(), de_AT);
QVERIFY(dpointer_is_null(c1));
c1 = std::move(c2);
QCOMPARE(c1.locale(), de_AT);
QVERIFY(dpointer_is_null(c2));
#else
QSKIP("The compiler is not in C++11 mode or does not support move semantics.");
#endif
}
QTEST_APPLESS_MAIN(tst_QCollator)
#include "tst_qcollator.moc"

View File

@ -8,6 +8,7 @@ SUBDIRS=\
qbytedatabuffer \
qcache \
qchar \
qcollator \
qcommandlineparser \
qcontiguouscache \
qcryptographichash \

View File

@ -113,6 +113,8 @@ private slots:
void testCustomPageSizes();
void customPaperSizeAndMargins_data();
void customPaperSizeAndMargins();
void customPaperNameSettingBySize();
void customPaperNameSettingByName();
#if !defined(QT_NO_COMPLETER) && !defined(QT_NO_FILEDIALOG)
void printDialogCompleter();
#endif
@ -967,6 +969,13 @@ void tst_QPrinter::errorReporting()
painter.end();
}
static QByteArray msgSizeMismatch(const QSizeF &actual, const QSizeF &expected)
{
QString result;
QDebug(&result) << "Paper size mismatch" << actual << "!=" << expected;
return result.toLocal8Bit();
}
void tst_QPrinter::testCustomPageSizes()
{
QPrinter p;
@ -975,12 +984,16 @@ void tst_QPrinter::testCustomPageSizes()
p.setPaperSize(customSize, QPrinter::Inch);
QSizeF paperSize = p.paperSize(QPrinter::Inch);
QCOMPARE(paperSize, customSize);
// Due to the different calculations, the sizes may be off by a fraction so we have to check it manually
// instead of relying on QSizeF comparison
QVERIFY2(sqrt(pow(paperSize.width() - customSize.width(), 2.0) + pow(paperSize.height() - customSize.height(), 2.0)) < 0.01,
msgSizeMismatch(paperSize, customSize));
QPrinter p2(QPrinter::HighResolution);
p2.setPaperSize(customSize, QPrinter::Inch);
paperSize = p.paperSize(QPrinter::Inch);
QCOMPARE(paperSize, customSize);
QVERIFY2(sqrt(pow(paperSize.width() - customSize.width(), 2.0) + pow(paperSize.height() - customSize.height(), 2.0)) < 0.01,
msgSizeMismatch(paperSize, customSize));
}
void tst_QPrinter::customPaperSizeAndMargins_data()
@ -1193,6 +1206,68 @@ void tst_QPrinter::testPageMetrics()
QCOMPARE(printer.pageSizeMM(), QSizeF(widthMMf, heightMMf));
}
void tst_QPrinter::customPaperNameSettingBySize()
{
#ifndef Q_OS_WIN
QSKIP("Currently this triggers a problem on non Windows platforms, this will be fixed separately - QTBUG-34521");
#endif
QPrinter printer(QPrinter::HighResolution);
QPrinterInfo info(printer);
QList<QPair<QString, QSizeF> > sizes = info.supportedSizesWithNames();
if (sizes.size() == 0)
QSKIP("No printers installed on this machine");
for (int i=0; i<sizes.size(); i++) {
printer.setPaperSize(sizes.at(i).second, QPrinter::Millimeter);
QCOMPARE(sizes.at(i).second, printer.paperSize(QPrinter::Millimeter));
// Some printers have the same size under different names which can cause a problem for the test
// So we iterate up to the current position to check
QSizeF paperSize = sizes.at(i).second;
QString paperName = printer.paperName();
bool paperNameFound = (sizes.at(i).first == paperName);
if (!paperNameFound) {
for (int j=0; j<i; j++) {
if (sizes.at(j).second == paperSize && sizes.at(j).first == paperName) {
paperNameFound = true;
break;
}
}
}
// Fail with the original values
if (!paperNameFound)
QCOMPARE(sizes.at(i).first, printer.paperName());
}
// Check setting a custom size after setting a standard one works
QSizeF customSize(200, 200);
printer.setPaperSize(customSize, QPrinter::Millimeter);
QCOMPARE(printer.paperSize(QPrinter::Millimeter), customSize);
QCOMPARE(printer.paperSize(), QPrinter::Custom);
// Finally check setting a standard size after a custom one works
printer.setPaperSize(sizes.at(0).second, QPrinter::Millimeter);
QCOMPARE(printer.paperName(), sizes.at(0).first);
QCOMPARE(printer.paperSize(QPrinter::Millimeter), sizes.at(0).second);
}
void tst_QPrinter::customPaperNameSettingByName()
{
#ifndef Q_OS_WIN
QSKIP("Currently this triggers a problem on non Windows platforms, this will be fixed separately - QTBUG-34521");
#endif
QPrinter printer(QPrinter::HighResolution);
QPrinterInfo info(printer);
QList<QPair<QString, QSizeF> > sizes = info.supportedSizesWithNames();
if (sizes.size() == 0)
QSKIP("No printers installed on this machine");
for (int i=0; i<sizes.size(); i++) {
printer.setPaperName(sizes.at(i).first);
QCOMPARE(sizes.at(i).first, printer.paperName());
QSizeF paperSize = printer.paperSize(QPrinter::Millimeter);
QVERIFY2(sqrt(pow(sizes.at(i).second.width() - paperSize.width(), 2.0) + pow(sizes.at(i).second.height() - paperSize.height(), 2.0)) < 0.01,
msgSizeMismatch(sizes.at(i).second, paperSize));
}
}
#endif // QT_NO_PRINTER
QTEST_MAIN(tst_QPrinter)

View File

@ -6458,6 +6458,12 @@ public:
void tst_QGraphicsItem::ensureUpdateOnTextItem()
{
#ifdef Q_OS_MAC
if (QSysInfo::MacintoshVersion == QSysInfo::MV_10_7) {
QSKIP("This test is unstable on 10.7 in CI");
}
#endif
QGraphicsScene scene;
QGraphicsView view(&scene);
view.show();

View File

@ -259,6 +259,7 @@ private slots:
void taskQTBUG_25333_adjustViewOptionsForIndex();
void taskQTBUG_18539_emitLayoutChanged();
void taskQTBUG_8176_emitOnExpandAll();
void taskQTBUG_34717_collapseAtBottom();
void testInitialFocus();
};
@ -4240,6 +4241,35 @@ void tst_QTreeView::taskQTBUG_8176_emitOnExpandAll()
QCOMPARE(spy2.size(), 1); // item2 is collapsed
}
// From QTBUG_34717 (QTreeWidget crashes when scrolling to the end
// of an expanded tree, then collapse all)
// The test passes simply if it doesn't crash.
void tst_QTreeView::taskQTBUG_34717_collapseAtBottom()
{
QTreeWidget treeWidget;
treeWidget.header()->setSectionResizeMode(QHeaderView::ResizeToContents);
treeWidget.setColumnCount(2);
QTreeWidgetItem *mainItem = new QTreeWidgetItem(&treeWidget, QStringList() << "Root");
for (int i = 0; i < 200; ++i) {
QTreeWidgetItem *item = new QTreeWidgetItem(mainItem, QStringList(QString("Item")));
new QTreeWidgetItem(item, QStringList() << "Child" << "1");
new QTreeWidgetItem(item, QStringList() << "Child" << "2");
new QTreeWidgetItem(item, QStringList() << "Child" << "3");
}
treeWidget.show();
treeWidget.expandAll();
treeWidget.scrollToBottom();
treeWidget.collapseAll();
treeWidget.setAnimated(true);
treeWidget.expandAll();
treeWidget.scrollToBottom();
mainItem->setExpanded(false);
PublicView *pview = (PublicView*) &treeWidget;
QVERIFY(pview->sizeHintForColumn(1) >= 0);
}
void tst_QTreeView::testInitialFocus()
{
QTreeWidget treeWidget;

View File

@ -809,7 +809,7 @@ void tst_QXmlSimpleReader::dtdRecursionLimit()
xmlReader.setDeclHandler(&handler);
xmlReader.setErrorHandler(&handler);
QVERIFY(!xmlReader.parse(source));
QVERIFY(handler.recursionCount == 1);
QCOMPARE(handler.recursionCount, 2);
}
}

View File

@ -183,7 +183,7 @@ Configure::Configure(int& argc, char** argv)
dictionary[ "PLUGIN_MANIFESTS" ] = "yes";
dictionary[ "DIRECTWRITE" ] = "no";
dictionary[ "NIS" ] = "no";
dictionary[ "NEON" ] = "no";
dictionary[ "NEON" ] = "auto";
dictionary[ "LARGE_FILE" ] = "yes";
dictionary[ "FONT_CONFIG" ] = "no";
dictionary[ "POSIX_IPC" ] = "no";
@ -1641,6 +1641,7 @@ void Configure::applySpecSpecifics()
dictionary[ "QT_CUPS" ] = "no";
dictionary[ "QT_GLIB" ] = "no";
dictionary[ "QT_ICONV" ] = "no";
dictionary[ "FONT_CONFIG" ] = "auto";
dictionary["DECORATIONS"] = "default windows styled";
} else if ((platform() == QNX) || (platform() == BLACKBERRY)) {
@ -1648,6 +1649,7 @@ void Configure::applySpecSpecifics()
dictionary["SLOG2"] = "auto";
dictionary["QT_XKBCOMMON"] = "no";
dictionary[ "ANGLE" ] = "no";
dictionary[ "FONT_CONFIG" ] = "auto";
} else if (platform() == ANDROID) {
dictionary[ "REDUCE_EXPORTS" ] = "yes";
dictionary[ "BUILD" ] = "release";
@ -2096,7 +2098,7 @@ bool Configure::checkAvailability(const QString &part)
available = findFile("pcre.h");
else if (part == "ICU")
available = findFile("unicode/utypes.h") && findFile("unicode/ucol.h") && findFile("unicode/ustring.h");
available = tryCompileProject("unix/icu");
else if (part == "ANGLE") {
available = checkAngleAvailability();
@ -2200,6 +2202,10 @@ bool Configure::checkAvailability(const QString &part)
available = (platform() == QNX || platform() == BLACKBERRY) && compilerSupportsFlag("qcc -fstack-protector-strong");
} else if (part == "SLOG2") {
available = tryCompileProject("unix/slog2");
} else if (part == "NEON") {
available = (dictionary["QT_ARCH"] == "arm") && tryCompileProject("unix/neon");
} else if (part == "FONT_CONFIG") {
available = tryCompileProject("unix/fontconfig");
}
return available;
@ -2212,6 +2218,9 @@ void Configure::autoDetection()
{
cout << "Running configuration tests..." << endl;
// Auto-detect CPU architectures.
detectArch();
if (dictionary["C++11"] == "auto") {
if (!dictionary["QMAKESPEC"].contains("msvc"))
dictionary["C++11"] = tryCompileProject("common/c++11") ? "yes" : "no";
@ -2295,6 +2304,8 @@ void Configure::autoDetection()
dictionary["AVX2"] = checkAvailability("AVX2") ? "yes" : "no";
if (dictionary["IWMMXT"] == "auto")
dictionary["IWMMXT"] = checkAvailability("IWMMXT") ? "yes" : "no";
if (dictionary["NEON"] == "auto")
dictionary["NEON"] = checkAvailability("NEON") ? "yes" : "no";
if (dictionary["OPENSSL"] == "auto")
dictionary["OPENSSL"] = checkAvailability("OPENSSL") ? "yes" : "no";
if (dictionary["DBUS"] == "auto")
@ -2339,6 +2350,9 @@ void Configure::autoDetection()
if (dictionary["QT_EVENTFD"] == "auto")
dictionary["QT_EVENTFD"] = checkAvailability("QT_EVENTFD") ? "yes" : "no";
if (dictionary["FONT_CONFIG"] == "auto")
dictionary["FONT_CONFIG"] = checkAvailability("FONT_CONFIG") ? "yes" : "no";
// Mark all unknown "auto" to the default value..
for (QMap<QString,QString>::iterator i = dictionary.begin(); i != dictionary.end(); ++i) {
if (i.value() == "auto")
@ -3522,6 +3536,7 @@ void Configure::displayConfig()
sout << " JPEG support............" << dictionary[ "JPEG" ] << endl;
sout << " PNG support............." << dictionary[ "PNG" ] << endl;
sout << " FreeType support........" << dictionary[ "FREETYPE" ] << endl;
sout << " Fontconfig support......" << dictionary[ "FONT_CONFIG" ] << endl;
sout << " HarfBuzz-NG support....." << dictionary[ "HARFBUZZ" ] << endl;
sout << " PCRE support............" << dictionary[ "PCRE" ] << endl;
sout << " ICU support............." << dictionary[ "ICU" ] << endl;

Some files were not shown because too many files have changed in this diff Show More