Merge remote-tracking branch 'origin/dev' into wip/qt6

Change-Id: Ieb8efee9d74229b9f141ec715e3a9557586b51e8
bb10
Alexandru Croitor 2019-06-11 11:16:42 +02:00
commit 4e875d988e
107 changed files with 514 additions and 334 deletions

View File

@ -105,12 +105,12 @@ DEPEND_SRC = \
$(SOURCE_PATH)/src/corelib/serialization/qtextstream.cpp \
$(SOURCE_PATH)/src/corelib/serialization/qxmlstream.cpp \
$(SOURCE_PATH)/src/corelib/serialization/qxmlutils.cpp \
$(SOURCE_PATH)/src/corelib/time/qdatetime.cpp \
$(SOURCE_PATH)/src/corelib/tools/qarraydata.cpp \
$(SOURCE_PATH)/src/corelib/tools/qbitarray.cpp \
$(SOURCE_PATH)/src/corelib/tools/qbytearray.cpp\
$(SOURCE_PATH)/src/corelib/tools/qbytearraymatcher.cpp \
$(SOURCE_PATH)/src/corelib/tools/qcryptographichash.cpp \
$(SOURCE_PATH)/src/corelib/tools/qdatetime.cpp \
$(SOURCE_PATH)/src/corelib/tools/qhash.cpp \
$(SOURCE_PATH)/src/corelib/tools/qlist.cpp \
$(SOURCE_PATH)/src/corelib/tools/qlocale.cpp \
@ -425,7 +425,7 @@ quuid.o: $(SOURCE_PATH)/src/corelib/plugin/quuid.cpp
qfileinfo.o: $(SOURCE_PATH)/src/corelib/io/qfileinfo.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $<
qdatetime.o: $(SOURCE_PATH)/src/corelib/tools/qdatetime.cpp
qdatetime.o: $(SOURCE_PATH)/src/corelib/time/qdatetime.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $<
qstringlist.o: $(SOURCE_PATH)/src/corelib/tools/qstringlist.cpp

View File

@ -196,6 +196,9 @@ qmake_pch.obj:
{$(SOURCE_PATH)\src\corelib\serialization}.cpp{}.obj::
$(CXX) $(CXXFLAGS) $<
{$(SOURCE_PATH)\src\corelib\time}.cpp{}.obj::
$(CXX) $(CXXFLAGS) $<
{$(SOURCE_PATH)\src\corelib\tools}.cpp{}.obj::
$(CXX) $(CXXFLAGS) $<

View File

@ -1467,7 +1467,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
<< "\t\t\t" << writeSettings("name", "Qt Test") << ";\n"
<< "\t\t};\n";
QLatin1Literal testTargetID("TestTargetID");
QLatin1String testTargetID("TestTargetID");
project->values(ProKey("QMAKE_PBX_TARGET_ATTRIBUTES_" + testTargetKey + "_" + testTargetID)).append(keyFor(pbx_dir + "QMAKE_PBX_TARGET"));
project->values(ProKey("QMAKE_PBX_TARGET_ATTRIBUTES_" + testTargetKey)).append(ProKey(testTargetID));
}

View File

@ -199,7 +199,6 @@ MakefileGenerator::initOutPaths()
ProStringList &inputs = project->values((*it2).toKey());
for (ProStringList::Iterator input = inputs.begin(); input != inputs.end(); ++input) {
QString finp = fileFixify((*input).toQString(), FileFixifyFromOutdir);
*input = ProString(finp);
QString path = replaceExtraCompilerVariables(tmp_out, finp, QString(), NoShell);
path = Option::normalizePath(path);
int slash = path.lastIndexOf('/');

View File

@ -36,6 +36,7 @@ qtConfig(animation): include(animation/animation.pri)
include(global/global.pri)
include(thread/thread.pri)
include(tools/tools.pri)
include(time/time.pri)
include(io/io.pri)
include(itemmodels/itemmodels.pri)
include(plugin/plugin.pri)

View File

@ -172,7 +172,7 @@ win32 {
io/qlockfile_unix.cpp \
io/qfilesystemiterator_unix.cpp
!integrity:!uikit {
!integrity:!uikit:!rtems {
SOURCES += io/forkfd_qt.cpp
HEADERS += \
../3rdparty/forkfd/forkfd.h

View File

@ -58,6 +58,11 @@
#include <sys/file.h> // flock
#endif
#if defined(Q_OS_RTEMS)
# undef LOCK_EX
# undef LOCK_NB
#endif
#include <sys/types.h> // kill
#include <signal.h> // kill
#include <unistd.h> // gethostname

View File

@ -812,7 +812,7 @@ void QStorageInfoPrivate::retrieveVolumeInfo()
valid = true;
ready = true;
#if defined(Q_OS_INTEGRITY) || (defined(Q_OS_BSD4) && !defined(Q_OS_NETBSD))
#if defined(Q_OS_INTEGRITY) || (defined(Q_OS_BSD4) && !defined(Q_OS_NETBSD)) || defined(Q_OS_RTEMS)
bytesTotal = statfs_buf.f_blocks * statfs_buf.f_bsize;
bytesFree = statfs_buf.f_bfree * statfs_buf.f_bsize;
bytesAvailable = statfs_buf.f_bavail * statfs_buf.f_bsize;
@ -822,7 +822,7 @@ void QStorageInfoPrivate::retrieveVolumeInfo()
bytesAvailable = statfs_buf.f_bavail * statfs_buf.f_frsize;
#endif
blockSize = statfs_buf.f_bsize;
#if defined(Q_OS_ANDROID) || defined(Q_OS_BSD4) || defined(Q_OS_INTEGRITY)
#if defined(Q_OS_ANDROID) || defined(Q_OS_BSD4) || defined(Q_OS_INTEGRITY) || defined(Q_OS_RTEMS)
#if defined(_STATFS_F_FLAGS)
readOnly = (statfs_buf.f_flags & ST_RDONLY) != 0;
#endif

View File

@ -69,7 +69,7 @@ namespace QSharedMemoryPrivate
#include "qsystemsemaphore.h"
#include "private/qobject_p.h"
#if !defined(Q_OS_WIN) && !defined(Q_OS_ANDROID) && !defined(Q_OS_INTEGRITY)
#if !defined(Q_OS_WIN) && !defined(Q_OS_ANDROID) && !defined(Q_OS_INTEGRITY) && !defined(Q_OS_RTEMS)
# include <sys/sem.h>
#endif

View File

@ -53,7 +53,7 @@
//
#include "qtimezone.h"
#include "qlocale_p.h"
#include "private/qlocale_p.h"
#include "qvector.h"
#if QT_CONFIG(icu)

View File

@ -40,6 +40,7 @@
#include "qtimezone.h"
#include "qtimezoneprivate_p.h"
#include "qdatetime_p.h" // ### Qt 5.14: remove once YearRange is on QDateTime
#include "private/qlocale_tools_p.h"
#include <QtCore/QFile>
#include <QtCore/QHash>
@ -48,8 +49,6 @@
#include <qdebug.h>
#include "qlocale_tools_p.h"
#include <algorithm>
QT_BEGIN_NAMESPACE

34
src/corelib/time/time.pri Normal file
View File

@ -0,0 +1,34 @@
# Qt time / date / zone / calendar module
HEADERS += \
time/qdatetime.h \
time/qdatetime_p.h
SOURCES += time/qdatetime.cpp
qtConfig(timezone) {
HEADERS += \
time/qtimezone.h \
time/qtimezoneprivate_p.h \
time/qtimezoneprivate_data_p.h
SOURCES += \
time/qtimezone.cpp \
time/qtimezoneprivate.cpp
!nacl:darwin: {
SOURCES += time/qtimezoneprivate_mac.mm
} else: android:!android-embedded: {
SOURCES += time/qtimezoneprivate_android.cpp
} else: unix: {
SOURCES += time/qtimezoneprivate_tz.cpp
qtConfig(icu): SOURCES += time/qtimezoneprivate_icu.cpp
} else: qtConfig(icu): {
SOURCES += time/qtimezoneprivate_icu.cpp
} else: win32: {
SOURCES += time/qtimezoneprivate_win.cpp
}
}
qtConfig(datetimeparser) {
HEADERS += time/qdatetimeparser_p.h
SOURCES += time/qdatetimeparser.cpp
}

View File

@ -1439,7 +1439,7 @@ QByteArray &QByteArray::operator=(const char *str)
\note Before Qt 5.14 it was possible to use this operator to access
a character at an out-of-bounds position in the byte array, and
then assign to such position, causing the byte array to be
then assign to such a position, causing the byte array to be
automatically resized. Furthermore, assigning a value to the
returned QByteRef would cause a detach of the byte array, even if the
byte array has been copied in the meanwhile (and the QByteRef kept

View File

@ -58,6 +58,19 @@ private:
char ch;
};
Q_DECL_CONSTEXPR inline bool operator==(char lhs, QLatin1Char rhs) noexcept { return lhs == rhs.toLatin1(); }
Q_DECL_CONSTEXPR inline bool operator!=(char lhs, QLatin1Char rhs) noexcept { return lhs != rhs.toLatin1(); }
Q_DECL_CONSTEXPR inline bool operator<=(char lhs, QLatin1Char rhs) noexcept { return lhs <= rhs.toLatin1(); }
Q_DECL_CONSTEXPR inline bool operator>=(char lhs, QLatin1Char rhs) noexcept { return lhs >= rhs.toLatin1(); }
Q_DECL_CONSTEXPR inline bool operator< (char lhs, QLatin1Char rhs) noexcept { return lhs < rhs.toLatin1(); }
Q_DECL_CONSTEXPR inline bool operator> (char lhs, QLatin1Char rhs) noexcept { return lhs > rhs.toLatin1(); }
Q_DECL_CONSTEXPR inline bool operator==(QLatin1Char lhs, char rhs) noexcept { return lhs.toLatin1() == rhs; }
Q_DECL_CONSTEXPR inline bool operator!=(QLatin1Char lhs, char rhs) noexcept { return lhs.toLatin1() != rhs; }
Q_DECL_CONSTEXPR inline bool operator<=(QLatin1Char lhs, char rhs) noexcept { return lhs.toLatin1() <= rhs; }
Q_DECL_CONSTEXPR inline bool operator>=(QLatin1Char lhs, char rhs) noexcept { return lhs.toLatin1() >= rhs; }
Q_DECL_CONSTEXPR inline bool operator< (QLatin1Char lhs, char rhs) noexcept { return lhs.toLatin1() < rhs; }
Q_DECL_CONSTEXPR inline bool operator> (QLatin1Char lhs, char rhs) noexcept { return lhs.toLatin1() > rhs; }
class Q_CORE_EXPORT QChar {
public:

View File

@ -58,6 +58,10 @@ typedef unsigned char BitSequence;
typedef unsigned long long DataLength;
typedef enum { SUCCESS = 0, FAIL = 1, BAD_HASHLEN = 2 } HashReturn;
#ifdef Q_OS_RTEMS
# undef ALIGN
#endif
#include "../../3rdparty/sha3/KeccakSponge.c"
typedef spongeState hashState;

View File

@ -414,10 +414,10 @@ public:
Q_DECL_DEPRECATED_X("Use QList<T>(list.begin(), list.end()) instead.")
static inline QList<T> fromStdList(const std::list<T> &list)
{ QList<T> tmp; std::copy(list.begin(), list.end(), std::back_inserter(tmp)); return tmp; }
{ return QList<T>(list.begin(), list.end()); }
Q_DECL_DEPRECATED_X("Use std::list<T>(list.begin(), list.end()) instead.")
inline std::list<T> toStdList() const
{ std::list<T> tmp; std::copy(constBegin(), constEnd(), std::back_inserter(tmp)); return tmp; }
{ return std::list<T>(begin(), end()); }
#endif
private:
@ -1105,10 +1105,7 @@ inline int QList<T>::count_impl(const T &t, QListData::ArrayCompatibleLayout) co
template <typename T>
Q_OUTOFLINE_TEMPLATE QVector<T> QList<T>::toVector() const
{
QVector<T> result(size());
for (int i = 0; i < size(); ++i)
result[i] = at(i);
return result;
return QVector<T>(begin(), end());
}
template <typename T>
@ -1120,11 +1117,7 @@ QList<T> QList<T>::fromVector(const QVector<T> &vector)
template <typename T>
Q_OUTOFLINE_TEMPLATE QList<T> QVector<T>::toList() const
{
QList<T> result;
result.reserve(size());
for (int i = 0; i < size(); ++i)
result.append(at(i));
return result;
return QList<T>(begin(), end());
}
template <typename T>

View File

@ -55,7 +55,7 @@
#include "qlocale_p.h"
#include "qlocale_tools_p.h"
#if QT_CONFIG(datetimeparser)
#include "qdatetimeparser_p.h"
#include "private/qdatetimeparser_p.h"
#endif
#include "qnamespace.h"
#include "qdatetime.h"

View File

@ -5800,7 +5800,7 @@ QString QString::trimmed_helper(QString &str)
\note Before Qt 5.14 it was possible to use this operator to access
a character at an out-of-bounds position in the string, and
then assign to such position, causing the string to be
then assign to such a position, causing the string to be
automatically resized. Furthermore, assigning a value to the
returned QCharRef would cause a detach of the string, even if the
string has been copied in the meanwhile (and the QCharRef kept

View File

@ -303,7 +303,7 @@ public:
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
Q_DECL_DEPRECATED_X("Use QVector<T>(vector.begin(), vector.end()) instead.")
static inline QVector<T> fromStdVector(const std::vector<T> &vector)
{ QVector<T> tmp; tmp.reserve(int(vector.size())); std::copy(vector.begin(), vector.end(), std::back_inserter(tmp)); return tmp; }
{ return QVector<T>(vector.begin(), vector.end()); }
Q_DECL_DEPRECATED_X("Use std::vector<T>(vector.begin(), vector.end()) instead.")
inline std::vector<T> toStdVector() const
{ return std::vector<T>(d->begin(), d->end()); }

View File

@ -20,8 +20,6 @@ HEADERS += \
tools/qcontainerfwd.h \
tools/qcontainertools_impl.h \
tools/qcryptographichash.h \
tools/qdatetime.h \
tools/qdatetime_p.h \
tools/qdoublescanprint_p.h \
tools/qeasingcurve.h \
tools/qfreelist_p.h \
@ -86,7 +84,6 @@ SOURCES += \
tools/qbytearraymatcher.cpp \
tools/qcollator.cpp \
tools/qcryptographichash.cpp \
tools/qdatetime.cpp \
tools/qeasingcurve.cpp \
tools/qfreelist.cpp \
tools/qhash.cpp \
@ -154,33 +151,6 @@ qtConfig(icu) {
SOURCES += tools/qcollator_posix.cpp
}
qtConfig(timezone) {
HEADERS += \
tools/qtimezone.h \
tools/qtimezoneprivate_p.h \
tools/qtimezoneprivate_data_p.h
SOURCES += \
tools/qtimezone.cpp \
tools/qtimezoneprivate.cpp
!nacl:darwin: {
SOURCES += tools/qtimezoneprivate_mac.mm
} else: android:!android-embedded: {
SOURCES += tools/qtimezoneprivate_android.cpp
} else: unix: {
SOURCES += tools/qtimezoneprivate_tz.cpp
qtConfig(icu): SOURCES += tools/qtimezoneprivate_icu.cpp
} else: qtConfig(icu): {
SOURCES += tools/qtimezoneprivate_icu.cpp
} else: win32: {
SOURCES += tools/qtimezoneprivate_win.cpp
}
}
qtConfig(datetimeparser) {
HEADERS += tools/qdatetimeparser_p.h
SOURCES += tools/qdatetimeparser.cpp
}
qtConfig(regularexpression) {
QMAKE_USE_PRIVATE += pcre2

View File

@ -75,13 +75,13 @@ int QInputDeviceManager::deviceCount(DeviceType type) const
int QInputDeviceManagerPrivate::deviceCount(QInputDeviceManager::DeviceType type) const
{
return m_deviceCount.value(type);
return m_deviceCount[type];
}
void QInputDeviceManagerPrivate::setDeviceCount(QInputDeviceManager::DeviceType type, int count)
{
Q_Q(QInputDeviceManager);
if (m_deviceCount.value(type) != count) {
if (m_deviceCount[type] != count) {
m_deviceCount[type] = count;
emit q->deviceListChanged(type);
}

View File

@ -69,7 +69,9 @@ public:
DeviceTypePointer,
DeviceTypeKeyboard,
DeviceTypeTouch,
DeviceTypeTablet
DeviceTypeTablet,
NumDeviceTypes
};
QInputDeviceManager(QObject *parent = nullptr);

View File

@ -52,10 +52,11 @@
//
#include <QtGui/private/qtguiglobal_p.h>
#include <QtCore/qmap.h>
#include <private/qobject_p.h>
#include "qinputdevicemanager_p.h"
#include <array>
QT_BEGIN_NAMESPACE
class Q_GUI_EXPORT QInputDeviceManagerPrivate : public QObjectPrivate
@ -68,7 +69,7 @@ public:
int deviceCount(QInputDeviceManager::DeviceType type) const;
void setDeviceCount(QInputDeviceManager::DeviceType type, int count);
QMap<QInputDeviceManager::DeviceType, int> m_deviceCount;
std::array<int, QInputDeviceManager::NumDeviceTypes> m_deviceCount;
Qt::KeyboardModifiers keyboardModifiers;
};

View File

@ -1385,16 +1385,16 @@ QGradient::QGradient(Preset preset)
setCoordinateMode(ObjectMode);
setSpread(PadSpread);
const QJsonValue start = presetData[QLatin1Literal("start")];
const QJsonValue end = presetData[QLatin1Literal("end")];
m_data.linear.x1 = start[QLatin1Literal("x")].toDouble();
m_data.linear.y1 = start[QLatin1Literal("y")].toDouble();
m_data.linear.x2 = end[QLatin1Literal("x")].toDouble();
m_data.linear.y2 = end[QLatin1Literal("y")].toDouble();
const QJsonValue start = presetData[QLatin1String("start")];
const QJsonValue end = presetData[QLatin1String("end")];
m_data.linear.x1 = start[QLatin1String("x")].toDouble();
m_data.linear.y1 = start[QLatin1String("y")].toDouble();
m_data.linear.x2 = end[QLatin1String("x")].toDouble();
m_data.linear.y2 = end[QLatin1String("y")].toDouble();
for (const QJsonValue &stop : presetData[QLatin1String("stops")].toArray()) {
setColorAt(stop[QLatin1Literal("position")].toDouble(),
QColor(QRgb(stop[QLatin1Literal("color")].toInt())));
setColorAt(stop[QLatin1String("position")].toDouble(),
QColor(QRgb(stop[QLatin1String("color")].toInt())));
}
cachedPresets.insert(preset, *this);

View File

@ -904,6 +904,9 @@ QDistanceField::QDistanceField(const QDistanceField &other)
d = other.d;
}
QDistanceField &QDistanceField::operator=(const QDistanceField &)
= default;
QDistanceField::QDistanceField(const QRawFont &font, glyph_t glyph, bool doubleResolution)
{
setGlyph(font, glyph, doubleResolution);

View File

@ -95,6 +95,7 @@ public:
QDistanceField(QFontEngine *fontEngine, glyph_t glyph, bool doubleResolution = false);
QDistanceField(const QPainterPath &path, glyph_t glyph, bool doubleResolution = false);
QDistanceField(const QDistanceField &other);
QDistanceField &operator=(const QDistanceField &other);
bool isNull() const;

View File

@ -564,6 +564,9 @@ Q_GUI_EXPORT QDataStream &operator>>(QDataStream &stream, QTextFormat &fmt)
\value BlockTrailingHorizontalRulerWidth The width of a horizontal ruler element.
\value HeadingLevel The level of a heading, for example 1 corresponds to an HTML H1 tag; otherwise 0.
This enum value has been added in Qt 5.12.
\value BlockCodeFence The character that was used in the "fences" around a Markdown code block.
If the code block was indented rather than fenced, the block should not have this property.
This enum value has been added in Qt 5.14.
\value BlockQuoteLevel The depth of nested quoting on this block: 1 means the block is a top-level block quote.
Blocks that are not block quotes should not have this property.

View File

@ -178,6 +178,7 @@ public:
HeadingLevel = 0x1070,
BlockQuoteLevel = 0x1080,
BlockCodeLanguage = 0x1090,
BlockCodeFence = 0x1091,
BlockMarker = 0x10A0,
// character properties

View File

@ -1635,6 +1635,10 @@ void QTextHtmlParser::applyAttributes(const QStringList &attributes)
else if (key == QLatin1String("type"))
linkType = value;
break;
case Html_pre:
if (key == QLatin1String("class") && value.startsWith(QLatin1String("language-")))
node->blockFormat.setProperty(QTextFormat::BlockCodeLanguage, value.mid(9));
break;
default:
break;
}

View File

@ -165,12 +165,13 @@ int QTextMarkdownImporter::cbEnterBlock(int blockType, void *det)
MD_BLOCK_CODE_DETAIL *detail = static_cast<MD_BLOCK_CODE_DETAIL *>(det);
m_codeBlock = true;
m_blockCodeLanguage = QLatin1String(detail->lang.text, int(detail->lang.size));
m_blockCodeFence = detail->fence_char;
QString info = QLatin1String(detail->info.text, int(detail->info.size));
m_needsInsertBlock = true;
if (m_blockQuoteDepth)
qCDebug(lcMD, "CODE lang '%s' info '%s' inside QUOTE %d", qPrintable(m_blockCodeLanguage), qPrintable(info), m_blockQuoteDepth);
qCDebug(lcMD, "CODE lang '%s' info '%s' fenced with '%c' inside QUOTE %d", qPrintable(m_blockCodeLanguage), qPrintable(info), m_blockCodeFence, m_blockQuoteDepth);
else
qCDebug(lcMD, "CODE lang '%s' info '%s'", qPrintable(m_blockCodeLanguage), qPrintable(info));
qCDebug(lcMD, "CODE lang '%s' info '%s' fenced with '%c'", qPrintable(m_blockCodeLanguage), qPrintable(info), m_blockCodeFence);
} break;
case MD_BLOCK_H: {
MD_BLOCK_H_DETAIL *detail = static_cast<MD_BLOCK_H_DETAIL *>(det);
@ -326,6 +327,7 @@ int QTextMarkdownImporter::cbLeaveBlock(int blockType, void *detail)
case MD_BLOCK_CODE: {
m_codeBlock = false;
m_blockCodeLanguage.clear();
m_blockCodeFence = 0;
if (m_blockQuoteDepth)
qCDebug(lcMD, "CODE ended inside QUOTE %d", m_blockQuoteDepth);
else
@ -540,6 +542,8 @@ void QTextMarkdownImporter::insertBlock()
}
if (m_codeBlock) {
blockFormat.setProperty(QTextFormat::BlockCodeLanguage, m_blockCodeLanguage);
if (m_blockCodeFence)
blockFormat.setProperty(QTextFormat::BlockCodeFence, QString(QLatin1Char(m_blockCodeFence)));
charFormat.setFont(m_monoFont);
} else {
blockFormat.setTopMargin(m_paragraphMargin);

View File

@ -124,6 +124,7 @@ private:
int m_tableCol = -1; // because relative cell movements (e.g. m_cursor->movePosition(QTextCursor::NextCell)) don't work
int m_paragraphMargin = 0;
int m_blockType = 0;
char m_blockCodeFence = 0;
Features m_features;
QTextImageFormat m_imageFormat;
QTextListFormat m_listFormat;

View File

@ -134,6 +134,24 @@ void QTextMarkdownWriter::writeFrame(const QTextFrame *frame)
writeFrame(iterator.currentFrame());
else { // no frame, it's a block
QTextBlock block = iterator.currentBlock();
// Look ahead and detect some cases when we should
// suppress needless blank lines, when there will be a big change in block format
bool nextIsDifferent = false;
bool ending = false;
{
QTextFrame::iterator next = iterator;
++next;
if (next.atEnd()) {
nextIsDifferent = true;
ending = true;
} else {
QTextBlockFormat format = iterator.currentBlock().blockFormat();
QTextBlockFormat nextFormat = next.currentBlock().blockFormat();
if (nextFormat.indent() != format.indent() ||
nextFormat.property(QTextFormat::BlockCodeLanguage) != format.property(QTextFormat::BlockCodeLanguage))
nextIsDifferent = true;
}
}
if (table) {
QTextTableCell cell = table->cellAt(block.position());
if (tableRow < cell.row()) {
@ -150,7 +168,7 @@ void QTextMarkdownWriter::writeFrame(const QTextFrame *frame)
if (lastWasList)
m_stream << Newline;
}
int endingCol = writeBlock(block, !table, table && tableRow == 0);
int endingCol = writeBlock(block, !table, table && tableRow == 0, nextIsDifferent);
m_doubleNewlineWritten = false;
if (table) {
QTextTableCell cell = table->cellAt(block.position());
@ -162,11 +180,19 @@ void QTextMarkdownWriter::writeFrame(const QTextFrame *frame)
m_stream << QString(paddingLen, Space);
for (int col = cell.column(); col < spanEndCol; ++col)
m_stream << "|";
} else if (block.textList() || block.blockFormat().hasProperty(QTextFormat::BlockCodeLanguage)) {
} else if (m_fencedCodeBlock && ending) {
m_stream << m_linePrefix << QString(m_wrappedLineIndent, Space)
<< m_codeBlockFence << Newline << Newline;
m_codeBlockFence.clear();
} else if (m_indentedCodeBlock && nextIsDifferent) {
m_stream << Newline;
} else if (endingCol > 0) {
m_stream << Newline << Newline;
m_doubleNewlineWritten = true;
if (block.textList() || block.blockFormat().hasProperty(QTextFormat::BlockCodeLanguage)) {
m_stream << Newline;
} else {
m_stream << Newline << Newline;
m_doubleNewlineWritten = true;
}
}
lastWasList = block.textList();
}
@ -259,11 +285,13 @@ static void maybeEscapeFirstChar(QString &s)
}
}
int QTextMarkdownWriter::writeBlock(const QTextBlock &block, bool wrap, bool ignoreFormat)
int QTextMarkdownWriter::writeBlock(const QTextBlock &block, bool wrap, bool ignoreFormat, bool ignoreEmpty)
{
if (block.text().isEmpty() && ignoreEmpty)
return 0;
const int ColumnLimit = 80;
QTextBlockFormat blockFmt = block.blockFormat();
bool indentedCodeBlock = false;
bool missedBlankCodeBlockLine = false;
if (block.textList()) { // it's a list-item
auto fmt = block.textList()->format();
const int listLevel = fmt.indent();
@ -324,7 +352,28 @@ int QTextMarkdownWriter::writeBlock(const QTextBlock &block, bool wrap, bool ign
} else if (blockFmt.hasProperty(QTextFormat::BlockTrailingHorizontalRulerWidth)) {
m_stream << "- - -\n"; // unambiguous horizontal rule, not an underline under a heading
return 0;
} else if (blockFmt.hasProperty(QTextFormat::BlockCodeFence) || blockFmt.stringProperty(QTextFormat::BlockCodeLanguage).length() > 0) {
// It's important to preserve blank lines in code blocks. But blank lines in code blocks
// inside block quotes are getting preserved anyway (along with the "> " prefix).
if (!blockFmt.hasProperty(QTextFormat::BlockQuoteLevel))
missedBlankCodeBlockLine = true; // only if we don't get any fragments below
if (!m_fencedCodeBlock) {
QString fenceChar = blockFmt.stringProperty(QTextFormat::BlockCodeFence);
if (fenceChar.isEmpty())
fenceChar = QLatin1String("`");
m_codeBlockFence = QString(3, fenceChar.at(0));
// A block quote can contain an indented code block, but not vice-versa.
m_stream << m_linePrefix << QString(m_wrappedLineIndent, Space) << m_codeBlockFence
<< Space << blockFmt.stringProperty(QTextFormat::BlockCodeLanguage) << Newline;
m_fencedCodeBlock = true;
}
} else if (!blockFmt.indent()) {
if (m_fencedCodeBlock) {
m_stream << m_linePrefix << QString(m_wrappedLineIndent, Space)
<< m_codeBlockFence << Newline;
m_fencedCodeBlock = false;
m_codeBlockFence.clear();
}
m_wrappedLineIndent = 0;
m_linePrefix.clear();
if (blockFmt.hasProperty(QTextFormat::BlockQuoteLevel)) {
@ -337,7 +386,7 @@ int QTextMarkdownWriter::writeBlock(const QTextBlock &block, bool wrap, bool ign
if (blockFmt.hasProperty(QTextFormat::BlockCodeLanguage)) {
// A block quote can contain an indented code block, but not vice-versa.
m_linePrefix += QString(4, Space);
indentedCodeBlock = true;
m_indentedCodeBlock = true;
}
}
if (blockFmt.headingLevel())
@ -358,6 +407,7 @@ int QTextMarkdownWriter::writeBlock(const QTextBlock &block, bool wrap, bool ign
bool strikeOut = false;
QString backticks(Backtick);
for (QTextBlock::Iterator frag = block.begin(); !frag.atEnd(); ++frag) {
missedBlankCodeBlockLine = false;
QString fragmentText = frag.fragment().text();
while (fragmentText.endsWith(Newline))
fragmentText.chop(1);
@ -401,7 +451,7 @@ int QTextMarkdownWriter::writeBlock(const QTextBlock &block, bool wrap, bool ign
bool monoFrag = fontInfo.fixedPitch();
QString markers;
if (!ignoreFormat) {
if (monoFrag != mono && !indentedCodeBlock) {
if (monoFrag != mono && !m_indentedCodeBlock && !m_fencedCodeBlock) {
if (monoFrag)
backticks = QString(adjacentBackticksCount(fragmentText) + 1, Backtick);
markers += backticks;
@ -501,6 +551,8 @@ int QTextMarkdownWriter::writeBlock(const QTextBlock &block, bool wrap, bool ign
m_stream << "~~";
col += 2;
}
if (missedBlankCodeBlockLine)
m_stream << Newline;
return col;
}

View File

@ -67,7 +67,7 @@ public:
bool writeAll(const QTextDocument *document);
void writeTable(const QAbstractItemModel *table);
int writeBlock(const QTextBlock &block, bool table, bool ignoreFormat);
int writeBlock(const QTextBlock &block, bool table, bool ignoreFormat, bool ignoreEmpty);
void writeFrame(const QTextFrame *frame);
private:
@ -82,9 +82,12 @@ private:
QTextDocument::MarkdownFeatures m_features;
QMap<QTextList *, ListInfo> m_listInfo;
QString m_linePrefix;
QString m_codeBlockFence;
int m_wrappedLineIndent = 0;
int m_lastListIndent = 1;
bool m_doubleNewlineWritten = false;
bool m_indentedCodeBlock = false;
bool m_fencedCodeBlock = false;
};
QT_END_NAMESPACE

View File

@ -85,4 +85,9 @@ void QPlatformVulkanInstance::presentQueued(QWindow *window)
Q_UNUSED(window);
}
void QPlatformVulkanInstance::setDebugFilters(const QVector<QVulkanInstance::DebugFilter> &filters)
{
Q_UNUSED(filters);
}
QT_END_NAMESPACE

View File

@ -78,6 +78,7 @@ public:
virtual PFN_vkVoidFunction getInstanceProcAddr(const char *name) = 0;
virtual bool supportsPresent(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, QWindow *window) = 0;
virtual void presentQueued(QWindow *window);
virtual void setDebugFilters(const QVector<QVulkanInstance::DebugFilter> &filters);
private:
QScopedPointer<QPlatformVulkanInstancePrivate> d_ptr;

View File

@ -269,6 +269,7 @@ public:
VkResult errorCode;
QScopedPointer<QVulkanFunctions> funcs;
QHash<VkDevice, QVulkanDeviceFunctions *> deviceFuncs;
QVector<QVulkanInstance::DebugFilter> debugFilters;
};
bool QVulkanInstancePrivate::ensureVulkan()
@ -570,6 +571,7 @@ bool QVulkanInstance::create()
d_ptr->extensions = d_ptr->platformInst->enabledExtensions();
d_ptr->errorCode = VK_SUCCESS;
d_ptr->funcs.reset(new QVulkanFunctions(this));
d_ptr->platformInst->setDebugFilters(d_ptr->debugFilters);
return true;
}
@ -785,6 +787,50 @@ void QVulkanInstance::presentQueued(QWindow *window)
d_ptr->platformInst->presentQueued(window);
}
/*!
\typedef QVulkanInstance::DebugFilter
Typedef for debug filtering callback functions.
\sa installDebugOutputFilter(), removeDebugOutputFilter()
*/
/*!
Installs a \a filter function that is called for every Vulkan debug
message. When the callback returns \c true, the message is stopped (filtered
out) and will not appear on the debug output.
\note Filtering is only effective when NoDebugOutputRedirect is not
\l{setFlags()}{set}. Installing filters has no effect otherwise.
\note This function can be called before create().
\sa removeDebugOutputFilter()
*/
void QVulkanInstance::installDebugOutputFilter(DebugFilter filter)
{
if (!d_ptr->debugFilters.contains(filter)) {
d_ptr->debugFilters.append(filter);
if (d_ptr->platformInst)
d_ptr->platformInst->setDebugFilters(d_ptr->debugFilters);
}
}
/*!
Removes a \a filter function previously installed by
installDebugOutputFilter().
\note This function can be called before create().
\sa installDebugOutputFilter()
*/
void QVulkanInstance::removeDebugOutputFilter(DebugFilter filter)
{
d_ptr->debugFilters.removeOne(filter);
if (d_ptr->platformInst)
d_ptr->platformInst->setDebugFilters(d_ptr->debugFilters);
}
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug dbg, const QVulkanLayer &layer)
{

View File

@ -188,6 +188,11 @@ public:
void presentQueued(QWindow *window);
typedef bool (*DebugFilter)(VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT objectType, uint64_t object,
size_t location, int32_t messageCode, const char *pLayerPrefix, const char *pMessage);
void installDebugOutputFilter(DebugFilter filter);
void removeDebugOutputFilter(DebugFilter filter);
private:
QScopedPointer<QVulkanInstancePrivate> d_ptr;
Q_DISABLE_COPY(QVulkanInstance)

View File

@ -330,6 +330,11 @@ bool QBasicPlatformVulkanInstance::supportsPresent(VkPhysicalDevice physicalDevi
return supported;
}
void QBasicPlatformVulkanInstance::setDebugFilters(const QVector<QVulkanInstance::DebugFilter> &filters)
{
m_debugFilters = filters;
}
void QBasicPlatformVulkanInstance::destroySurface(VkSurfaceKHR surface) const
{
if (m_destroySurface && surface)
@ -345,11 +350,11 @@ static VKAPI_ATTR VkBool32 VKAPI_CALL defaultDebugCallbackFunc(VkDebugReportFlag
const char *pMessage,
void *pUserData)
{
Q_UNUSED(flags);
Q_UNUSED(objectType);
Q_UNUSED(object);
Q_UNUSED(location);
Q_UNUSED(pUserData);
QBasicPlatformVulkanInstance *self = static_cast<QBasicPlatformVulkanInstance *>(pUserData);
for (QVulkanInstance::DebugFilter filter : *self->debugFilters()) {
if (filter(flags, objectType, object, location, messageCode, pLayerPrefix, pMessage))
return VK_FALSE;
}
// not categorized, just route to plain old qDebug
qDebug("vkDebug: %s: %d: %s", pLayerPrefix, messageCode, pMessage);
@ -374,6 +379,7 @@ void QBasicPlatformVulkanInstance::setupDebugOutput()
| VK_DEBUG_REPORT_WARNING_BIT_EXT
| VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT;
dbgCallbackInfo.pfnCallback = defaultDebugCallbackFunc;
dbgCallbackInfo.pUserData = this;
VkResult err = createDebugReportCallback(m_vkInst, &dbgCallbackInfo, nullptr, &m_debugCallback);
if (err != VK_SUCCESS)

View File

@ -73,7 +73,10 @@ public:
QByteArrayList enabledExtensions() const override;
PFN_vkVoidFunction getInstanceProcAddr(const char *name) override;
bool supportsPresent(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, QWindow *window) override;
void setDebugFilters(const QVector<QVulkanInstance::DebugFilter> &filters) override;
void destroySurface(VkSurfaceKHR surface) const;
const QVector<QVulkanInstance::DebugFilter> *debugFilters() const { return &m_debugFilters; }
protected:
void loadVulkanLibrary(const QString &defaultLibraryName);
@ -105,6 +108,7 @@ private:
VkDebugReportCallbackEXT m_debugCallback;
PFN_vkDestroyDebugReportCallbackEXT m_vkDestroyDebugReportCallbackEXT;
QVector<QVulkanInstance::DebugFilter> m_debugFilters;
};
QT_END_NAMESPACE

View File

@ -118,7 +118,7 @@ QSurfaceFormat QIOSContext::format() const
return m_format;
}
#define QT_IOS_GL_STATUS_CASE(val) case val: return QLatin1Literal(#val)
#define QT_IOS_GL_STATUS_CASE(val) case val: return QLatin1String(#val)
static QString fboStatusString(GLenum status)
{

View File

@ -84,7 +84,7 @@ private:
const HCURSOR m_hcursor;
};
typedef QSharedPointer<CursorHandle> CursorHandlePtr;
using CursorHandlePtr = QSharedPointer<CursorHandle>;
class QWindowsCursor : public QPlatformCursor
{

View File

@ -271,7 +271,7 @@ QWindowsNativeDialogBase *QWindowsDialogHelperBase<BaseClass>::ensureNativeDialo
class QWindowsDialogThread : public QThread
{
public:
typedef QSharedPointer<QWindowsNativeDialogBase> QWindowsNativeDialogBasePtr;
using QWindowsNativeDialogBasePtr = QSharedPointer<QWindowsNativeDialogBase>;
explicit QWindowsDialogThread(const QWindowsNativeDialogBasePtr &d, HWND owner)
: m_dialog(d), m_owner(owner) {}
@ -551,7 +551,7 @@ IFileDialogEvents *QWindowsNativeFileDialogEventHandler::create(QWindowsNativeFi
class QWindowsShellItem
{
public:
typedef std::vector<IShellItem *> IShellItems;
using IShellItems = std::vector<IShellItem *>;
explicit QWindowsShellItem(IShellItem *item);
@ -1688,7 +1688,7 @@ class QWindowsXpNativeFileDialog : public QWindowsNativeDialogBase
{
Q_OBJECT
public:
typedef QSharedPointer<QFileDialogOptions> OptionsPtr;
using OptionsPtr = QSharedPointer<QFileDialogOptions>;
static QWindowsXpNativeFileDialog *create(const OptionsPtr &options, const QWindowsFileDialogSharedData &data);
@ -1779,7 +1779,7 @@ static int QT_WIN_CALLBACK xpFileDialogGetExistingDirCallbackProc(HWND hwnd, UIN
#if defined(Q_CC_MINGW) && (!defined(__MINGW64_VERSION_MAJOR) || __MINGW64_VERSION_MAJOR < 3)
typedef ITEMIDLIST *qt_LpItemIdList;
#else
typedef PIDLIST_ABSOLUTE qt_LpItemIdList;
using qt_LpItemIdList = PIDLIST_ABSOLUTE;
#endif
int QWindowsXpNativeFileDialog::existingDirCallback(HWND hwnd, UINT uMsg, LPARAM lParam)
@ -2007,7 +2007,7 @@ QString QWindowsXpFileDialogHelper::selectedNameFilter() const
\ingroup qt-lighthouse-win
*/
typedef QSharedPointer<QColor> SharedPointerColor;
using SharedPointerColor = QSharedPointer<QColor>;
#ifdef USE_NATIVE_COLOR_DIALOG
class QWindowsNativeColorDialog : public QWindowsNativeDialogBase

View File

@ -66,7 +66,7 @@ class QWindowsDialogHelperBase : public BaseClass
{
Q_DISABLE_COPY_MOVE(QWindowsDialogHelperBase)
public:
typedef QSharedPointer<QWindowsNativeDialogBase> QWindowsNativeDialogBasePtr;
using QWindowsNativeDialogBasePtr = QSharedPointer<QWindowsNativeDialogBase>;
~QWindowsDialogHelperBase() { cleanupThread(); }
void exec() override;

View File

@ -120,7 +120,7 @@ class QWindowsMenu : public QPlatformMenu
{
Q_OBJECT
public:
typedef QVector<QWindowsMenuItem *> MenuItems;
using MenuItems = QVector<QWindowsMenuItem *>;
QWindowsMenu();
~QWindowsMenu();
@ -196,7 +196,7 @@ class QWindowsMenuBar : public QPlatformMenuBar
{
Q_OBJECT
public:
typedef QVector<QWindowsMenu *> Menus;
using Menus = QVector<QWindowsMenu *>;
QWindowsMenuBar();
~QWindowsMenuBar() override;

View File

@ -609,8 +609,8 @@ bool QWindowsMouseHandler::translateTouchEvent(QWindow *window, HWND,
QtWindows::WindowsEventType,
MSG msg, LRESULT *)
{
typedef QWindowSystemInterface::TouchPoint QTouchPoint;
typedef QList<QWindowSystemInterface::TouchPoint> QTouchPointList;
using QTouchPoint = QWindowSystemInterface::TouchPoint;
using QTouchPointList = QList<QWindowSystemInterface::TouchPoint>;
if (!QWindowsContext::instance()->initTouch()) {
qWarning("Unable to initialize touch handling.");

View File

@ -72,7 +72,7 @@ static inline QDpi monitorDPI(HMONITOR hMonitor)
return {0, 0};
}
typedef QList<QWindowsScreenData> WindowsScreenDataList;
using WindowsScreenDataList = QList<QWindowsScreenData>;
static bool monitorData(HMONITOR hMonitor, QWindowsScreenData *data)
{

View File

@ -76,7 +76,7 @@ class QWindowsScreen : public QPlatformScreen
{
public:
#ifndef QT_NO_CURSOR
typedef QScopedPointer<QPlatformCursor> CursorPtr;
using CursorPtr = QScopedPointer<QPlatformCursor>;
#endif
explicit QWindowsScreen(const QWindowsScreenData &data);
@ -127,7 +127,7 @@ private:
class QWindowsScreenManager
{
public:
typedef QList<QWindowsScreen *> WindowsScreenList;
using WindowsScreenList = QList<QWindowsScreen *>;
QWindowsScreenManager();

View File

@ -117,7 +117,7 @@ struct QWindowsHwndSystemTrayIconEntry
QWindowsSystemTrayIcon *trayIcon;
};
typedef QVector<QWindowsHwndSystemTrayIconEntry> HwndTrayIconEntries;
using HwndTrayIconEntries = QVector<QWindowsHwndSystemTrayIconEntry>;
Q_GLOBAL_STATIC(HwndTrayIconEntries, hwndTrayIconEntries)

View File

@ -86,7 +86,7 @@
QT_BEGIN_NAMESPACE
typedef QSharedPointer<QWindowCreationContext> QWindowCreationContextPtr;
using QWindowCreationContextPtr = QSharedPointer<QWindowCreationContext>;
enum {
defaultWindowWidth = 160,
@ -494,7 +494,7 @@ static QMargins invisibleMargins(QPoint screenPoint)
struct WindowCreationData
{
typedef QWindowsWindowData WindowData;
using WindowData = QWindowsWindowData;
enum Flags { ForceChild = 0x1, ForceTopLevel = 0x2 };
void fromWindow(const QWindow *w, const Qt::WindowFlags flags, unsigned creationFlags = 0);

View File

@ -455,7 +455,7 @@ static const uchar base_dither_matrix[DITHER_SIZE][DITHER_SIZE] = {
static QPixmap qt_patternForAlpha(uchar alpha, int screen)
{
QPixmap pm;
QString key = QLatin1Literal("$qt-alpha-brush$")
QString key = QLatin1String("$qt-alpha-brush$")
% HexString<uchar>(alpha)
% HexString<int>(screen);

View File

@ -154,10 +154,10 @@ void QTapTestLogger::addIncident(IncidentTypes type, const char *description,
// This is fragile, but unfortunately testlib doesn't plumb
// the expected and actual values to the loggers (yet).
static QRegularExpression verifyRegex(
QLatin1Literal("^'(?<actualexpression>.*)' returned (?<actual>\\w+).+\\((?<message>.*)\\)$"));
QLatin1String("^'(?<actualexpression>.*)' returned (?<actual>\\w+).+\\((?<message>.*)\\)$"));
static QRegularExpression comparRegex(
QLatin1Literal("^(?<message>.*)\n"
QLatin1String("^(?<message>.*)\n"
"\\s*Actual\\s+\\((?<actualexpression>.*)\\)\\s*: (?<actual>.*)\n"
"\\s*Expected\\s+\\((?<expectedexpresssion>.*)\\)\\s*: (?<expected>.*)$"));
@ -168,22 +168,22 @@ void QTapTestLogger::addIncident(IncidentTypes type, const char *description,
if (match.hasMatch()) {
bool isVerify = match.regularExpression() == verifyRegex;
QString message = match.captured(QLatin1Literal("message"));
QString message = match.captured(QLatin1String("message"));
QString expected;
QString actual;
if (isVerify) {
QString expression = QLatin1Literal(" (")
% match.captured(QLatin1Literal("actualexpression")) % QLatin1Char(')') ;
actual = match.captured(QLatin1Literal("actual")).toLower() % expression;
expected = (actual.startsWith(QLatin1Literal("true")) ? QLatin1Literal("false") : QLatin1Literal("true")) % expression;
QString expression = QLatin1String(" (")
% match.captured(QLatin1String("actualexpression")) % QLatin1Char(')') ;
actual = match.captured(QLatin1String("actual")).toLower() % expression;
expected = (actual.startsWith(QLatin1String("true")) ? QLatin1String("false") : QLatin1String("true")) % expression;
if (message.isEmpty())
message = QLatin1Literal("Verification failed");
message = QLatin1String("Verification failed");
} else {
expected = match.captured(QLatin1Literal("expected"))
% QLatin1Literal(" (") % match.captured(QLatin1Literal("expectedexpresssion")) % QLatin1Char(')');
actual = match.captured(QLatin1Literal("actual"))
% QLatin1Literal(" (") % match.captured(QLatin1Literal("actualexpression")) % QLatin1Char(')');
expected = match.captured(QLatin1String("expected"))
% QLatin1String(" (") % match.captured(QLatin1String("expectedexpresssion")) % QLatin1Char(')');
actual = match.captured(QLatin1String("actual"))
% QLatin1String(" (") % match.captured(QLatin1String("actualexpression")) % QLatin1Char(')');
}
QTestCharBuffer diagnosticsYamlish;

View File

@ -72,6 +72,7 @@ SOURCES += \
../../corelib/serialization/qtextstream.cpp \
../../corelib/serialization/qxmlutils.cpp \
../../corelib/serialization/qxmlstream.cpp \
../../corelib/time/qdatetime.cpp \
../../corelib/tools/qbitarray.cpp \
../../corelib/tools/qbytearray.cpp \
../../corelib/tools/qarraydata.cpp \
@ -79,7 +80,6 @@ SOURCES += \
../../corelib/tools/qcommandlineparser.cpp \
../../corelib/tools/qcommandlineoption.cpp \
../../corelib/tools/qcryptographichash.cpp \
../../corelib/tools/qdatetime.cpp \
../../corelib/tools/qhash.cpp \
../../corelib/tools/qlist.cpp \
../../corelib/tools/qlinkedlist.cpp \

View File

@ -249,7 +249,7 @@ QT_CLASS_LIB(QLatin1String, QtCore, qstring.h)
QT_CLASS_LIB(QCharRef, QtCore, qstring.h)
QT_CLASS_LIB(QConstString, QtCore, qstring.h)
QT_CLASS_LIB(QStringRef, QtCore, qstring.h)
QT_CLASS_LIB(QLatin1Literal, QtCore, qstringbuilder.h)
QT_CLASS_LIB(QLatin1Literal, QtCore, qstring.h)
QT_CLASS_LIB(QAbstractConcatenable, QtCore, qstringbuilder.h)
QT_CLASS_LIB(QConcatenable, QtCore, qstringbuilder.h)
QT_CLASS_LIB(QStringBuilder, QtCore, qstringbuilder.h)

View File

@ -14,4 +14,5 @@ SUBDIRS = \
serialization \
statemachine \
thread \
time \
tools

View File

@ -136,8 +136,8 @@ private slots:
void emptyQueryOrFragment();
void hasFragment_data();
void hasFragment();
void setEncodedFragment_data();
void setEncodedFragment();
void setFragment_data();
void setFragment();
void fromEncoded();
void stripTrailingSlash_data();
void stripTrailingSlash();
@ -350,15 +350,15 @@ void tst_QUrl::comparison()
// 6.2.2.1 Make sure hexdecimal characters in percent encoding are
// treated case-insensitively
QUrl url5;
url5.setEncodedQuery("a=%2a");
url5.setQuery(QLatin1String("a=%2a"));
QUrl url6;
url6.setEncodedQuery("a=%2A");
url6.setQuery(QLatin1String("a=%2A"));
QCOMPARE(url5, url6);
QUrl url7;
url7.setEncodedQuery("a=C");
url7.setQuery(QLatin1String("a=C"));
QUrl url8;
url8.setEncodedQuery("a=c");
url8.setQuery(QLatin1String("a=c"));
QVERIFY(url7 != url8);
QVERIFY(url7 < url8);
@ -502,7 +502,7 @@ void tst_QUrl::setUrl()
QVERIFY(url.isValid());
QCOMPARE(url.scheme(), QString::fromLatin1("file"));
QCOMPARE(url.path(), QString::fromLatin1("/"));
QVERIFY(url.encodedQuery().isEmpty());
QVERIFY(url.query().isEmpty());
QVERIFY(url.userInfo().isEmpty());
QVERIFY(url.authority().isEmpty());
QVERIFY(url.fragment().isEmpty());
@ -517,7 +517,7 @@ void tst_QUrl::setUrl()
QVERIFY(url.isValid());
QCOMPARE(url.scheme(), QString::fromLatin1("http"));
QCOMPARE(url.path(), QString());
QVERIFY(url.encodedQuery().isEmpty());
QVERIFY(url.query().isEmpty());
QVERIFY(url.userInfo().isEmpty());
QVERIFY(url.fragment().isEmpty());
QCOMPARE(url.host(), QString::fromLatin1("www.foo.bar"));
@ -536,7 +536,7 @@ void tst_QUrl::setUrl()
QVERIFY(url.isValid());
QCOMPARE(url.scheme(), QString::fromLatin1("http"));
QCOMPARE(url.path(), QString());
QVERIFY(url.encodedQuery().isEmpty());
QVERIFY(url.query().isEmpty());
QCOMPARE(url.userName(), QString::fromLatin1("user:"));
QCOMPARE(url.password(), QString::fromLatin1("pass@"));
QCOMPARE(url.userInfo(), QString::fromLatin1("user%3A:pass@"));
@ -781,7 +781,7 @@ void tst_QUrl::setUrl()
QVERIFY(url.isValid());
QCOMPARE(url.scheme(), QString("http"));
QCOMPARE(url.host(), QString("1.2.3.4"));
QCOMPARE(url.encodedQuery(), QByteArray("foo"));
QCOMPARE(url.query(QUrl::FullyEncoded), QLatin1String("foo"));
}
{
QUrl url;
@ -798,13 +798,13 @@ void tst_QUrl::setUrl()
QCOMPARE(url.scheme(), QString("data"));
QCOMPARE(url.host(), QString());
QCOMPARE(url.path(), QString("text/javascript,d5 = 'five\\u0027s';"));
QCOMPARE(url.encodedPath().constData(), "text/javascript,d5%20%3D%20'five%5Cu0027s'%3B");
QCOMPARE(url.path(QUrl::FullyEncoded), QLatin1String("text/javascript,d5%20%3D%20'five%5Cu0027s'%3B"));
}
{
// invalid port number
QUrl url;
url.setEncodedUrl("foo://tel:2147483648");
url.setUrl(QLatin1String("foo://tel:2147483648"), QUrl::StrictMode);
QVERIFY(!url.isValid());
}
@ -1144,7 +1144,7 @@ void tst_QUrl::toString_constructed_data()
QTest::addColumn<QString>("host");
QTest::addColumn<int>("port");
QTest::addColumn<QString>("path");
QTest::addColumn<QByteArray>("query");
QTest::addColumn<QString>("query");
QTest::addColumn<QString>("fragment");
QTest::addColumn<QString>("asString");
QTest::addColumn<QByteArray>("asEncoded");
@ -1153,19 +1153,19 @@ void tst_QUrl::toString_constructed_data()
QString n("");
QTest::newRow("data1") << n << n << n << QString::fromLatin1("qt-project.org") << -1 << QString::fromLatin1("/index.html")
<< QByteArray() << n << QString::fromLatin1("//qt-project.org/index.html")
<< QString() << n << QString::fromLatin1("//qt-project.org/index.html")
<< QByteArray("//qt-project.org/index.html") << 0u;
QTest::newRow("data2") << QString::fromLatin1("file") << n << n << n << -1 << QString::fromLatin1("/root") << QByteArray()
QTest::newRow("data2") << QString::fromLatin1("file") << n << n << n << -1 << QString::fromLatin1("/root") << QString()
<< n << QString::fromLatin1("file:///root") << QByteArray("file:///root") << 0u;
QTest::newRow("userAndPass") << QString::fromLatin1("http") << QString::fromLatin1("dfaure") << QString::fromLatin1("kde")
<< "kde.org" << 443 << QString::fromLatin1("/") << QByteArray() << n
<< "kde.org" << 443 << QString::fromLatin1("/") << QString() << n
<< QString::fromLatin1("http://dfaure:kde@kde.org:443/") << QByteArray("http://dfaure:kde@kde.org:443/")
<< 0u;
QTest::newRow("PassWithoutUser") << QString::fromLatin1("http") << n << QString::fromLatin1("kde")
<< "kde.org" << 443 << QString::fromLatin1("/") << QByteArray() << n
<< "kde.org" << 443 << QString::fromLatin1("/") << QString() << n
<< QString::fromLatin1("http://:kde@kde.org:443/") << QByteArray("http://:kde@kde.org:443/") << 0u;
QTest::newRow("PassWithoutUser-RemovePassword") << QString::fromLatin1("http") << n << QString::fromLatin1("kde")
<< "kde.org" << 443 << QString::fromLatin1("/") << QByteArray() << n
<< "kde.org" << 443 << QString::fromLatin1("/") << QString() << n
<< QString::fromLatin1("http://kde.org:443/") << QByteArray("http://kde.org:443/")
<< uint(QUrl::RemovePassword);
}
@ -1178,7 +1178,7 @@ void tst_QUrl::toString_constructed()
QFETCH(QString, host);
QFETCH(int, port);
QFETCH(QString, path);
QFETCH(QByteArray, query);
QFETCH(QString, query);
QFETCH(QString, fragment);
QFETCH(QString, asString);
QFETCH(QByteArray, asEncoded);
@ -1198,7 +1198,7 @@ void tst_QUrl::toString_constructed()
if (!path.isEmpty())
url.setPath(path);
if (!query.isEmpty())
url.setEncodedQuery(query);
url.setQuery(query, QUrl::StrictMode);
if (!fragment.isEmpty())
url.setFragment(fragment);
@ -1757,7 +1757,7 @@ void tst_QUrl::symmetry()
QCOMPARE(url.host(QUrl::EncodeUnicode | QUrl::EncodeSpaces), QString::fromUtf8("www.xn--rksmrgs-5wao1o.se"));
QCOMPARE(url.path(), QString::fromLatin1("/pub"));
// this will be encoded ...
QCOMPARE(url.encodedQuery().constData(), QString::fromLatin1("a=b&a=d%C3%B8&a=f").toLatin1().constData());
QCOMPARE(url.query(QUrl::FullyEncoded), QLatin1String("a=b&a=d%C3%B8&a=f"));
QCOMPARE(url.fragment(), QString::fromUtf8("vræl"));
QUrl onlyHost("//qt-project.org");
@ -2009,7 +2009,7 @@ void tst_QUrl::hasQuery()
QUrl qurl(url);
QCOMPARE(qurl.hasQuery(), trueFalse);
QCOMPARE(qurl.encodedQuery().isNull(), !trueFalse);
QCOMPARE(qurl.query().isNull(), !trueFalse);
}
void tst_QUrl::nameprep()
@ -2342,7 +2342,7 @@ void tst_QUrl::tolerantParser()
QVERIFY(url.isValid());
QVERIFY(!url.toString().isEmpty());
QCOMPARE(url.path(), QString("/path with spaces.html"));
url.setEncodedUrl("http://www.example.com/path%20with spaces.html", QUrl::StrictMode);
url.setUrl(QLatin1String("http://www.example.com/path%20with spaces.html"), QUrl::StrictMode);
QVERIFY(!url.isValid());
QVERIFY(url.toString().isEmpty());
}
@ -2392,36 +2392,36 @@ void tst_QUrl::tolerantParser()
QCOMPARE(url.toEncoded(), QByteArray("%25hello.com/f%25"));
QCOMPARE(url.toString(), QString("%25hello.com/f%25"));
url.setEncodedUrl("http://www.host.com/foo.php?P0=[2006-3-8]");
url.setUrl(QLatin1String("http://www.host.com/foo.php?P0=[2006-3-8]"), QUrl::StrictMode);
QVERIFY(url.isValid());
QVERIFY(!url.toString().isEmpty());
url.setEncodedUrl("http://foo.bar/[image][1].jpg");
url.setUrl(QLatin1String("http://foo.bar/[image][1].jpg"), QUrl::StrictMode);
QVERIFY(url.isValid());
QCOMPARE(url.toString(QUrl::FullyEncoded), QString("http://foo.bar/[image][1].jpg"));
QCOMPARE(url.toEncoded(), QByteArray("http://foo.bar/[image][1].jpg"));
QCOMPARE(url.toString(), QString("http://foo.bar/[image][1].jpg"));
url.setEncodedUrl("http://foo.bar/%5Bimage%5D%5B1%5D.jpg");
url.setUrl(QLatin1String("http://foo.bar/%5Bimage%5D%5B1%5D.jpg"), QUrl::StrictMode);
QVERIFY(url.isValid());
QCOMPARE(url.toString(QUrl::FullyEncoded), QString("http://foo.bar/%5Bimage%5D%5B1%5D.jpg"));
QCOMPARE(url.toEncoded(), QByteArray("http://foo.bar/%5Bimage%5D%5B1%5D.jpg"));
QCOMPARE(url.toString(), QString("http://foo.bar/%5Bimage%5D%5B1%5D.jpg"));
url.setEncodedUrl("//[::56:56:56:56:56:56:56]");
url.setUrl(QLatin1String("//[::56:56:56:56:56:56:56]"), QUrl::StrictMode);
QCOMPARE(url.toString(QUrl::FullyEncoded), QString("//[0:56:56:56:56:56:56:56]"));
QCOMPARE(url.toEncoded(), QByteArray("//[0:56:56:56:56:56:56:56]"));
url.setEncodedUrl("data:text/css,div%20{%20border-right:%20solid;%20}");
url.setUrl(QLatin1String("data:text/css,div%20{%20border-right:%20solid;%20}"), QUrl::TolerantMode);
QCOMPARE(url.toString(QUrl::FullyEncoded), QString("data:text/css,div%20%7B%20border-right:%20solid;%20%7D"));
QCOMPARE(url.toEncoded(), QByteArray("data:text/css,div%20%7B%20border-right:%20solid;%20%7D"));
QCOMPARE(url.toString(), QString("data:text/css,div %7B border-right: solid; %7D"));
}
{
QByteArray tsdgeos("http://google.com/c?c=Translation+%C2%BB+trunk|");
const QString tsdgeos = QLatin1String("http://google.com/c?c=Translation+%C2%BB+trunk|");
QUrl tsdgeosQUrl;
tsdgeosQUrl.setEncodedUrl(tsdgeos, QUrl::TolerantMode);
tsdgeosQUrl.setUrl(tsdgeos, QUrl::TolerantMode);
QVERIFY(tsdgeosQUrl.isValid()); // failed in Qt-4.4, works in Qt-4.5
QByteArray tsdgeosExpected("http://google.com/c?c=Translation+%C2%BB+trunk%7C");
QCOMPARE(QString(tsdgeosQUrl.toEncoded()), QString(tsdgeosExpected));
@ -2626,31 +2626,31 @@ void tst_QUrl::emptyQueryOrFragment()
// start with an empty one
QUrl url("http://www.foo.bar/baz");
QVERIFY(!url.hasQuery());
QVERIFY(url.encodedQuery().isNull());
QVERIFY(url.query().isNull());
// add encodedQuery
url.setQuery("abc=def");
QVERIFY(url.hasQuery());
QCOMPARE(url.query(), QString(QLatin1String("abc=def")));
QCOMPARE(url.toString(), QString(QLatin1String("http://www.foo.bar/baz?abc=def")));
url.setEncodedQuery("abc=def");
url.setQuery(QLatin1String("abc=def"));
QCOMPARE(url.toString(), QString(QLatin1String("http://www.foo.bar/baz?abc=def")));
// remove encodedQuery
url.setQuery(QString());
QVERIFY(!url.hasQuery());
QVERIFY(url.encodedQuery().isNull());
QVERIFY(url.query().isNull());
QCOMPARE(url.toString(), QString(QLatin1String("http://www.foo.bar/baz")));
url.setEncodedQuery(QByteArray());
url.setQuery(QString());
QCOMPARE(url.toString(), QString(QLatin1String("http://www.foo.bar/baz")));
// add empty encodedQuery
url.setQuery("");
QVERIFY(url.hasQuery());
QVERIFY(url.encodedQuery().isEmpty());
QVERIFY(!url.encodedQuery().isNull());
QVERIFY(url.query().isEmpty());
QVERIFY(!url.query().isNull());
QCOMPARE(url.toString(), QString(QLatin1String("http://www.foo.bar/baz?")));
url.setEncodedQuery("");
url.setQuery(QLatin1String(""));
QCOMPARE(url.toString(), QString(QLatin1String("http://www.foo.bar/baz?")));
}
}
@ -2682,35 +2682,33 @@ void tst_QUrl::hasFragment()
QCOMPARE(qurl.fragment().isNull(), !trueFalse);
}
void tst_QUrl::setEncodedFragment_data()
void tst_QUrl::setFragment_data()
{
QTest::addColumn<QByteArray>("base");
QTest::addColumn<QByteArray>("fragment");
QTest::addColumn<QByteArray>("expected");
QTest::addColumn<QString>("base");
QTest::addColumn<QString>("fragment");
QTest::addColumn<QString>("expected");
typedef QByteArray BA;
QTest::newRow("null") << BA("http://www.kde.org") << BA() << BA("http://www.kde.org");
QTest::newRow("empty") << BA("http://www.kde.org") << BA("") << BA("http://www.kde.org#");
QTest::newRow("basic test") << BA("http://www.kde.org") << BA("abc") << BA("http://www.kde.org#abc");
QTest::newRow("initial url has fragment") << BA("http://www.kde.org#old") << BA("new") << BA("http://www.kde.org#new");
QTest::newRow("encoded fragment") << BA("http://www.kde.org") << BA("a%20c") << BA("http://www.kde.org#a%20c");
QTest::newRow("with #") << BA("http://www.kde.org") << BA("a#b") << BA("http://www.kde.org#a%23b"); // toString uses "a#b"
QTest::newRow("unicode") << BA("http://www.kde.org") << BA("\xc3\xa9") << BA("http://www.kde.org#%C3%A9");
QTest::newRow("binary") << BA("http://www.kde.org") << BA("\x00\xc0\x80", 3) << BA("http://www.kde.org#%00%C0%80");
QTest::newRow("null") << QString::fromLatin1("http://www.kde.org") << QString() << QString::fromLatin1("http://www.kde.org");
QTest::newRow("empty") << QString::fromLatin1("http://www.kde.org") << QString::fromLatin1("") << QString::fromLatin1("http://www.kde.org#");
QTest::newRow("basic test") << QString::fromLatin1("http://www.kde.org") << QString::fromLatin1("abc") << QString::fromLatin1("http://www.kde.org#abc");
QTest::newRow("initial url has fragment") << QString::fromLatin1("http://www.kde.org#old") << QString::fromLatin1("new") << QString::fromLatin1("http://www.kde.org#new");
QTest::newRow("encoded fragment") << QString::fromLatin1("http://www.kde.org") << QString::fromLatin1("a%20c") << QString::fromLatin1("http://www.kde.org#a%20c");
QTest::newRow("with #") << QString::fromLatin1("http://www.kde.org") << QString::fromLatin1("a#b") << QString::fromLatin1("http://www.kde.org#a%23b"); // toString uses "a#b"
QTest::newRow("unicode") << QString::fromLatin1("http://www.kde.org") << QString::fromUtf8("\xc3\xa9") << QString::fromLatin1("http://www.kde.org#%C3%A9");
}
void tst_QUrl::setEncodedFragment()
void tst_QUrl::setFragment()
{
QFETCH(QByteArray, base);
QFETCH(QByteArray, fragment);
QFETCH(QByteArray, expected);
QFETCH(QString, base);
QFETCH(QString, fragment);
QFETCH(QString, expected);
QUrl u;
u.setEncodedUrl(base, QUrl::TolerantMode);
u.setUrl(base, QUrl::TolerantMode);
QVERIFY(u.isValid());
u.setEncodedFragment(fragment);
u.setFragment(fragment);
QVERIFY(u.isValid());
QCOMPARE(!fragment.isNull(), u.hasFragment());
QCOMPARE(QString::fromLatin1(u.toEncoded()), QString::fromLatin1(expected));
QCOMPARE(QString::fromUtf8(u.toEncoded()), expected);
}
void tst_QUrl::fromEncoded()
@ -3258,14 +3256,14 @@ void tst_QUrl::isEmptyForEncodedUrl()
{
{
QUrl url;
url.setEncodedUrl("LABEL=USB_STICK", QUrl::TolerantMode);
url.setUrl(QLatin1String("LABEL=USB_STICK"), QUrl::TolerantMode);
QVERIFY( url.isValid() );
QCOMPARE( url.path(), QString("LABEL=USB_STICK") );
QVERIFY( !url.isEmpty() );
}
{
QUrl url;
url.setEncodedUrl("LABEL=USB_STICK", QUrl::TolerantMode);
url.setUrl(QLatin1String("LABEL=USB_STICK"), QUrl::TolerantMode);
QVERIFY( url.isValid() );
QVERIFY( !url.isEmpty() );
QCOMPARE( url.path(), QString("LABEL=USB_STICK") );
@ -3277,7 +3275,7 @@ void tst_QUrl::isEmptyForEncodedUrl()
void tst_QUrl::toEncodedNotUsingUninitializedPath()
{
QUrl url;
url.setEncodedPath("/test.txt");
url.setPath(QLatin1String("/test.txt"));
url.setHost("example.com");
QCOMPARE(url.toEncoded().constData(), "//example.com/test.txt");
@ -3657,17 +3655,6 @@ void tst_QUrl::componentEncodings()
QCOMPARE(url.toString(formatting),
(((QString(toString ))))); // the weird () and space is to align the output
if (formatting == QUrl::FullyEncoded) {
QCOMPARE(url.encodedUserName(), userName.toUtf8());
QCOMPARE(url.encodedPassword(), password.toUtf8());
// no encodedUserInfo
QCOMPARE(url.encodedHost(), host.toUtf8());
// no encodedAuthority
QCOMPARE(url.encodedPath(), path.toUtf8());
QCOMPARE(url.encodedQuery(), query.toUtf8());
QCOMPARE(url.encodedFragment(), fragment.toUtf8());
}
// repeat with the URL we got from toString
QUrl url2(toString);
QCOMPARE(url2.userName(formatting), userName);

View File

@ -611,7 +611,7 @@ void tst_QCoreApplication::processEventsAlwaysSendsPostedEvents()
TestApplication app(argc, argv);
ProcessEventsAlwaysSendsPostedEventsObject object;
QTime t;
QElapsedTimer t;
t.start();
int i = 1;
do {

View File

@ -130,7 +130,7 @@ public:
QString m_value;
void setValue(const QString &value) { m_value = value; }
QString getValue() { return m_value; }
void resetValue() { m_value = QLatin1Literal("reset"); }
void resetValue() { m_value = QLatin1String("reset"); }
};
void tst_QMetaProperty::gadget()
@ -140,7 +140,7 @@ void tst_QMetaProperty::gadget()
QVERIFY(valueProp.isValid());
{
MyGadget g;
QString hello = QLatin1Literal("hello");
QString hello = QLatin1String("hello");
QVERIFY(valueProp.writeOnGadget(&g, hello));
QCOMPARE(g.m_value, QLatin1String("hello"));
QCOMPARE(valueProp.readOnGadget(&g), QVariant(hello));
@ -242,7 +242,7 @@ void tst_QMetaProperty::conversion()
QCOMPARE(custom.str, QString());
// or reset resetable
QVERIFY(value7P.write(this, QVariant()));
QCOMPARE(value7, QLatin1Literal("reset"));
QCOMPARE(value7, QLatin1String("reset"));
}
QTEST_MAIN(tst_QMetaProperty)

View File

@ -32,7 +32,6 @@
#include <qcoreapplication.h>
#include <qpointer.h>
#include <qtimer.h>
#include <qregexp.h>
#include <qregularexpression.h>
#include <qmetaobject.h>
#include <qvariant.h>
@ -537,91 +536,91 @@ void tst_QObject::findChildren()
QObject *op = 0;
op = qFindChild<QObject*>(&o, "o1");
op = o.findChild<QObject*>("o1");
QCOMPARE(op, &o1);
op = qFindChild<QObject*>(&o, "o2");
op = o.findChild<QObject*>("o2");
QCOMPARE(op, &o2);
op = qFindChild<QObject*>(&o, "o11");
op = o.findChild<QObject*>("o11");
QCOMPARE(op, &o11);
op = qFindChild<QObject*>(&o, "o12");
op = o.findChild<QObject*>("o12");
QCOMPARE(op, &o12);
op = qFindChild<QObject*>(&o, "o111");
op = o.findChild<QObject*>("o111");
QCOMPARE(op, &o111);
op = qFindChild<QObject*>(&o, "t1");
op = o.findChild<QObject*>("t1");
QCOMPARE(op, static_cast<QObject *>(&t1));
op = qFindChild<QObject*>(&o, "t121");
op = o.findChild<QObject*>("t121");
QCOMPARE(op, static_cast<QObject *>(&t121));
op = qFindChild<QTimer*>(&o, "t1");
op = o.findChild<QTimer*>("t1");
QCOMPARE(op, static_cast<QObject *>(&t1));
op = qFindChild<QTimer*>(&o, "t121");
op = o.findChild<QTimer*>("t121");
QCOMPARE(op, static_cast<QObject *>(&t121));
op = qFindChild<QTimer*>(&o, "o12");
op = o.findChild<QTimer*>("o12");
QCOMPARE(op, static_cast<QObject *>(0));
op = qFindChild<QObject*>(&o, "o");
op = o.findChild<QObject*>("o");
QCOMPARE(op, static_cast<QObject *>(0));
op = qFindChild<QObject*>(&o, "harry");
op = o.findChild<QObject*>("harry");
QCOMPARE(op, static_cast<QObject *>(0));
op = qFindChild<QObject*>(&o, "o1");
op = o.findChild<QObject*>("o1");
QCOMPARE(op, &o1);
QList<QObject*> l;
QList<QTimer*> tl;
l = qFindChildren<QObject*>(&o, "o1");
l = o.findChildren<QObject*>("o1");
QCOMPARE(l.size(), 1);
QCOMPARE(l.at(0), &o1);
l = qFindChildren<QObject*>(&o, "o2");
l = o.findChildren<QObject*>("o2");
QCOMPARE(l.size(), 1);
QCOMPARE(l.at(0), &o2);
l = qFindChildren<QObject*>(&o, "o11");
l = o.findChildren<QObject*>("o11");
QCOMPARE(l.size(), 1);
QCOMPARE(l.at(0), &o11);
l = qFindChildren<QObject*>(&o, "o12");
l = o.findChildren<QObject*>("o12");
QCOMPARE(l.size(), 1);
QCOMPARE(l.at(0), &o12);
l = qFindChildren<QObject*>(&o, "o111");
l = o.findChildren<QObject*>("o111");
QCOMPARE(l.size(), 1);
QCOMPARE(l.at(0), &o111);
l = qFindChildren<QObject*>(&o, "t1");
l = o.findChildren<QObject*>("t1");
QCOMPARE(l.size(), 1);
QCOMPARE(l.at(0), static_cast<QObject *>(&t1));
l = qFindChildren<QObject*>(&o, "t121");
l = o.findChildren<QObject*>("t121");
QCOMPARE(l.size(), 1);
QCOMPARE(l.at(0), static_cast<QObject *>(&t121));
tl = qFindChildren<QTimer*>(&o, "t1");
tl = o.findChildren<QTimer*>("t1");
QCOMPARE(tl.size(), 1);
QCOMPARE(tl.at(0), &t1);
tl = qFindChildren<QTimer*>(&o, "t121");
tl = o.findChildren<QTimer*>("t121");
QCOMPARE(tl.size(), 1);
QCOMPARE(tl.at(0), &t121);
l = qFindChildren<QObject*>(&o, "o");
l = o.findChildren<QObject*>("o");
QCOMPARE(l.size(), 0);
l = qFindChildren<QObject*>(&o, "harry");
l = o.findChildren<QObject*>("harry");
QCOMPARE(l.size(), 0);
tl = qFindChildren<QTimer*>(&o, "o12");
tl = o.findChildren<QTimer*>("o12");
QCOMPARE(tl.size(), 0);
l = qFindChildren<QObject*>(&o, "o1");
l = o.findChildren<QObject*>("o1");
QCOMPARE(l.size(), 1);
QCOMPARE(l.at(0), &o1);
l = qFindChildren<QObject*>(&o, QRegExp("o.*"));
l = o.findChildren<QObject*>(QRegularExpression("^o.*$"));
QCOMPARE(l.size(), 5);
QVERIFY(l.contains(&o1));
QVERIFY(l.contains(&o2));
QVERIFY(l.contains(&o11));
QVERIFY(l.contains(&o12));
QVERIFY(l.contains(&o111));
l = qFindChildren<QObject*>(&o, QRegExp("t.*"));
l = o.findChildren<QObject*>(QRegularExpression("t.*"));
QCOMPARE(l.size(), 2);
QVERIFY(l.contains(&t1));
QVERIFY(l.contains(&t121));
tl = qFindChildren<QTimer*>(&o, QRegExp(".*"));
tl = o.findChildren<QTimer*>(QRegularExpression("^.*$"));
QCOMPARE(tl.size(), 3);
QVERIFY(tl.contains(&t1));
QVERIFY(tl.contains(&t121));
tl = qFindChildren<QTimer*>(&o, QRegExp("o.*"));
tl = o.findChildren<QTimer*>(QRegularExpression("^o.*$"));
QCOMPARE(tl.size(), 0);
l = qFindChildren<QObject*>(&o, QRegExp("harry"));
l = o.findChildren<QObject*>(QRegularExpression("^harry$"));
QCOMPARE(l.size(), 0);
l = o.findChildren<QObject*>(QRegularExpression("o.*"));
@ -645,18 +644,18 @@ void tst_QObject::findChildren()
QCOMPARE(l.size(), 0);
// empty and null string check
op = qFindChild<QObject*>(&o);
op = o.findChild<QObject*>();
QCOMPARE(op, &o1);
op = qFindChild<QObject*>(&o, "");
op = o.findChild<QObject*>("");
QCOMPARE(op, &unnamed);
op = qFindChild<QObject*>(&o, "unnamed");
op = o.findChild<QObject*>("unnamed");
QCOMPARE(op, static_cast<QObject *>(0));
l = qFindChildren<QObject*>(&o);
l = o.findChildren<QObject*>();
QCOMPARE(l.size(), 9);
l = qFindChildren<QObject*>(&o, "");
l = o.findChildren<QObject*>("");
QCOMPARE(l.size(), 2);
l = qFindChildren<QObject*>(&o, "unnamed");
l = o.findChildren<QObject*>("unnamed");
QCOMPARE(l.size(), 0);
tl = o.findChildren<QTimer *>("t1");
@ -724,19 +723,19 @@ void tst_QObject::findChildren()
QCOMPARE(l.size(), 1);
QCOMPARE(l.at(0), &o1);
l = o.findChildren<QObject*>(QRegExp("o.*"), Qt::FindDirectChildrenOnly);
l = o.findChildren<QObject*>(QRegularExpression("^o.*$"), Qt::FindDirectChildrenOnly);
QCOMPARE(l.size(), 2);
QVERIFY(l.contains(&o1));
QVERIFY(l.contains(&o2));
l = o.findChildren<QObject*>(QRegExp("t.*"), Qt::FindDirectChildrenOnly);
l = o.findChildren<QObject*>(QRegularExpression("^t.*$"), Qt::FindDirectChildrenOnly);
QCOMPARE(l.size(), 1);
QVERIFY(l.contains(&t1));
tl = o.findChildren<QTimer*>(QRegExp(".*"), Qt::FindDirectChildrenOnly);
tl = o.findChildren<QTimer*>(QRegularExpression("^.*$"), Qt::FindDirectChildrenOnly);
QCOMPARE(tl.size(), 2);
QVERIFY(tl.contains(&t1));
tl = o.findChildren<QTimer*>(QRegExp("o.*"), Qt::FindDirectChildrenOnly);
tl = o.findChildren<QTimer*>(QRegularExpression("^o.*$"), Qt::FindDirectChildrenOnly);
QCOMPARE(tl.size(), 0);
l = o.findChildren<QObject*>(QRegExp("harry"), Qt::FindDirectChildrenOnly);
l = o.findChildren<QObject*>(QRegularExpression("^harry$"), Qt::FindDirectChildrenOnly);
QCOMPARE(l.size(), 0);
// empty and null string check
@ -1035,18 +1034,16 @@ public Q_SLOTS:
void tst_QObject::connectNotify_connectSlotsByName()
{
ConnectByNameNotifyReceiverObject testObject;
QList<ConnectByNameNotifySenderObject *> senders =
qFindChildren<ConnectByNameNotifySenderObject *>(&testObject);
for (int i = 0; i < senders.size(); ++i) {
ConnectByNameNotifySenderObject *o = senders.at(i);
const QList<ConnectByNameNotifySenderObject *> senders =
testObject.findChildren<ConnectByNameNotifySenderObject *>();
for (ConnectByNameNotifySenderObject *o : senders) {
QVERIFY(o->connectedSignals.isEmpty());
QVERIFY(o->disconnectedSignals.isEmpty());
}
QMetaObject::connectSlotsByName(&testObject);
for (int i = 0; i < senders.size(); ++i) {
ConnectByNameNotifySenderObject *o = senders.at(i);
for (ConnectByNameNotifySenderObject *o : senders) {
QCOMPARE(o->connectedSignals.size(), 1);
QCOMPARE(o->connectedSignals.at(0), QMetaMethod::fromSignal(&ConnectByNameNotifySenderObject::signal1));
QVERIFY(o->disconnectedSignals.isEmpty());
@ -1631,7 +1628,7 @@ void tst_QObject::thread()
QObject object;
// thread affinity for objects with no parent should be the
// current thread
QVERIFY(object.thread() != 0);
QVERIFY(object.thread() != nullptr);
QCOMPARE(object.thread(), currentThread);
// children inherit their parent's thread
QObject child(&object);
@ -1643,7 +1640,7 @@ void tst_QObject::thread()
{
TestThread thr;
QVERIFY(thr.thread() != 0);
QVERIFY(thr.thread() != nullptr);
QCOMPARE(thr.thread(), currentThread);
thr.object = &object;
@ -1802,8 +1799,8 @@ void tst_QObject::moveToThread()
QMetaObject::invokeMethod(object, "deleteLater", Qt::QueuedConnection);
thread.wait();
QVERIFY(opointer == 0);
QVERIFY(cpointer == 0);
QVERIFY(opointer == nullptr);
QVERIFY(cpointer == nullptr);
}
{
@ -2379,7 +2376,7 @@ void tst_QObject::testUserData()
for (int i=0; i<USER_DATA_COUNT; ++i) {
int id = user_data_ids[i];
CustomData *data = static_cast<CustomData *>(my_test_object.userData(id));
QVERIFY(data != 0);
QVERIFY(data != nullptr);
QCOMPARE(data->id, id);
}
}
@ -3627,7 +3624,7 @@ class OverloadObject : public QObject
void sig(int i, int j = 12);
void sig(QObject *o, QObject *p, QObject *q = 0, QObject *r = 0) const;
void other(int a = 0);
void sig(QObject *o, OverloadObject *p = 0, QObject *q = 0, QObject *r = 0);
void sig(QObject *o, OverloadObject *p = 0, QObject *q = 0, QObject *r = nullptr);
void sig(double r = 0.5);
public slots:
void slo(int i, int j = 43)
@ -5982,7 +5979,7 @@ void ConnectToPrivateSlot::test(SenderObject* obj1) {
obj1->signal1();
QCOMPARE(d->receivedCount, 1);
QCOMPARE(d->receivedValue, QVariant());
obj1->signal7(666, QLatin1Literal("_"));
obj1->signal7(666, QLatin1String("_"));
QCOMPARE(d->receivedCount, 2);
QCOMPARE(d->receivedValue, QVariant(666));
QVERIFY(QObjectPrivate::connect(obj1, &SenderObject::signal2, d, &ConnectToPrivateSlotPrivate::thisIsAPrivateSlot, Qt::UniqueConnection));

View File

@ -0,0 +1,6 @@
TEMPLATE = subdirs
SUBDIRS = \
qdate \
qdatetime \
qtime \
qtimezone

View File

@ -16,8 +16,6 @@ SUBDIRS=\
qcommandlineparser \
qcontiguouscache \
qcryptographichash \
qdate \
qdatetime \
qeasingcurve \
qexplicitlyshareddatapointer \
qfreelist \
@ -62,8 +60,6 @@ SUBDIRS=\
qstringref \
qstringview \
qtextboundaryfinder \
qtime \
qtimezone \
qtimeline \
qvarlengtharray \
qvector \

View File

@ -6,6 +6,7 @@ INCLUDEPATH += $$CORE_TEST_PATH
TARGET = tst_qguiapplication
QT += gui-private
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x050E00
SOURCES += tst_qguiapplication.cpp
RESOURCES = tst_qguiapplication.qrc

View File

@ -184,7 +184,7 @@ void tst_QGuiApplication::windowIcon()
class DummyWindow : public QWindow
{
public:
DummyWindow() : m_focusObject(0) {}
DummyWindow() : m_focusObject(nullptr) {}
virtual QObject *focusObject() const
{
@ -204,7 +204,7 @@ public:
void tst_QGuiApplication::focusObject()
{
int argc = 0;
QGuiApplication app(argc, 0);
QGuiApplication app(argc, nullptr);
if (!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::WindowActivation))
QSKIP("QWindow::requestActivate() is not supported.");
@ -271,15 +271,15 @@ void tst_QGuiApplication::focusObject()
void tst_QGuiApplication::allWindows()
{
int argc = 0;
QGuiApplication app(argc, 0);
QGuiApplication app(argc, nullptr);
QWindow *window1 = new QWindow;
QWindow *window2 = new QWindow(window1);
QVERIFY(app.allWindows().contains(window1));
QVERIFY(app.allWindows().contains(window2));
QCOMPARE(app.allWindows().count(), 2);
delete window1;
window1 = 0;
window2 = 0;
window1 = nullptr;
window2 = nullptr;
QVERIFY(!app.allWindows().contains(window2));
QVERIFY(!app.allWindows().contains(window1));
QCOMPARE(app.allWindows().count(), 0);
@ -288,15 +288,15 @@ void tst_QGuiApplication::allWindows()
void tst_QGuiApplication::topLevelWindows()
{
int argc = 0;
QGuiApplication app(argc, 0);
QGuiApplication app(argc, nullptr);
QWindow *window1 = new QWindow;
QWindow *window2 = new QWindow(window1);
QVERIFY(app.topLevelWindows().contains(window1));
QVERIFY(!app.topLevelWindows().contains(window2));
QCOMPARE(app.topLevelWindows().count(), 1);
delete window1;
window1 = 0;
window2 = 0;
window1 = nullptr;
window2 = nullptr;
QVERIFY(!app.topLevelWindows().contains(window2));
QVERIFY(!app.topLevelWindows().contains(window1));
QCOMPARE(app.topLevelWindows().count(), 0);
@ -306,7 +306,7 @@ class ShowCloseShowWindow : public QWindow
{
Q_OBJECT
public:
ShowCloseShowWindow(bool showAgain, QWindow *parent = 0)
ShowCloseShowWindow(bool showAgain, QWindow *parent = nullptr)
: QWindow(parent), showAgain(showAgain)
{
QTimer::singleShot(0, this, SLOT(doClose()));
@ -331,7 +331,7 @@ private:
void tst_QGuiApplication::abortQuitOnShow()
{
int argc = 0;
QGuiApplication app(argc, 0);
QGuiApplication app(argc, nullptr);
const QRect screenGeometry = QGuiApplication::primaryScreen()->availableVirtualGeometry();
QScopedPointer<QWindow> window1(new ShowCloseShowWindow(false));
@ -366,7 +366,7 @@ protected:
}
public:
FocusChangeWindow() : QWindow(), windowDuringFocusAboutToChange(0), windowDuringFocusOut(0) {}
FocusChangeWindow() : QWindow(), windowDuringFocusAboutToChange(nullptr), windowDuringFocusOut(nullptr) {}
QWindow *windowDuringFocusAboutToChange;
QWindow *windowDuringFocusOut;
@ -378,7 +378,7 @@ void tst_QGuiApplication::changeFocusWindow()
QSKIP("WinRt does not support multiple native windows.");
#endif
int argc = 0;
QGuiApplication app(argc, 0);
QGuiApplication app(argc, nullptr);
if (!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::WindowActivation))
QSKIP("QWindow::requestActivate() is not supported.");
@ -430,7 +430,7 @@ void tst_QGuiApplication::changeFocusWindow()
void tst_QGuiApplication::keyboardModifiers()
{
int argc = 0;
QGuiApplication app(argc, 0);
QGuiApplication app(argc, nullptr);
const QRect screenGeometry = QGuiApplication::primaryScreen()->availableVirtualGeometry();
QScopedPointer<QWindow> window(new QWindow);
@ -564,7 +564,7 @@ public:
int leaves;
int enters;
inline explicit BlockableWindow(QWindow *parent = 0)
inline explicit BlockableWindow(QWindow *parent = nullptr)
: QWindow(parent), blocked(false), leaves(0), enters(0) {}
bool event(QEvent *e)
@ -601,7 +601,7 @@ void tst_QGuiApplication::modalWindow()
QSKIP("WinRt does not support multiple native windows.");
#endif
int argc = 0;
QGuiApplication app(argc, 0);
QGuiApplication app(argc, nullptr);
const QRect screenGeometry = QGuiApplication::primaryScreen()->availableVirtualGeometry();
int x = screenGeometry.left() + spacing;
@ -654,7 +654,7 @@ void tst_QGuiApplication::modalWindow()
window2->show();
QVERIFY(QTest::qWaitForWindowExposed(window1.data()));
QVERIFY(QTest::qWaitForWindowExposed(window2.data()));
QCOMPARE(app.modalWindow(), static_cast<QWindow *>(0));
QCOMPARE(app.modalWindow(), static_cast<QWindow *>(nullptr));
QCOMPARE(window1->blocked, 0);
QCOMPARE(childWindow1->blocked, 0);
QCOMPARE(window2->blocked, 0);
@ -698,7 +698,7 @@ void tst_QGuiApplication::modalWindow()
// everything is unblocked when applicationModalWindow1 is hidden
applicationModalWindow1->hide();
QCOMPARE(app.modalWindow(), static_cast<QWindow *>(0));
QCOMPARE(app.modalWindow(), static_cast<QWindow *>(nullptr));
QCOMPARE(window1->blocked, 0);
QCOMPARE(childWindow1->blocked, 0); // QTBUG-32242, blocked status needs to be set on children as well.
QCOMPARE(window2->blocked, 0);
@ -750,7 +750,7 @@ void tst_QGuiApplication::modalWindow()
// hide windowModalWindow2, windowModalWindow1 and window1 are unblocked
windowModalWindow2->hide();
QCOMPARE(app.modalWindow(), static_cast<QWindow *>(0));
QCOMPARE(app.modalWindow(), static_cast<QWindow *>(nullptr));
QCOMPARE(window1->blocked, 0);
QCOMPARE(window2->blocked, 0);
QCOMPARE(windowModalWindow1->blocked, 0);
@ -815,7 +815,7 @@ void tst_QGuiApplication::modalWindow()
// hide windowModalWindow1, everything is unblocked
windowModalWindow1->hide();
QCOMPARE(app.modalWindow(), static_cast<QWindow *>(0));
QCOMPARE(app.modalWindow(), static_cast<QWindow *>(nullptr));
QCOMPARE(window1->blocked, 0);
QCOMPARE(window2->blocked, 0);
QCOMPARE(windowModalWindow1->blocked, 0);
@ -829,7 +829,7 @@ void tst_QGuiApplication::modalWindow()
void tst_QGuiApplication::quitOnLastWindowClosed()
{
int argc = 0;
QGuiApplication app(argc, 0);
QGuiApplication app(argc, nullptr);
const QRect screenGeometry = QGuiApplication::primaryScreen()->availableVirtualGeometry();
QTimer timer;
@ -869,7 +869,7 @@ void tst_QGuiApplication::quitOnLastWindowClosed()
void tst_QGuiApplication::quitOnLastWindowClosedMulti()
{
int argc = 0;
QGuiApplication app(argc, 0);
QGuiApplication app(argc, nullptr);
const QRect screenGeometry = QGuiApplication::primaryScreen()->availableVirtualGeometry();
QTimer timer;
@ -909,7 +909,7 @@ void tst_QGuiApplication::quitOnLastWindowClosedMulti()
void tst_QGuiApplication::dontQuitOnLastWindowClosed()
{
int argc = 0;
QGuiApplication app(argc, 0);
QGuiApplication app(argc, nullptr);
app.setQuitOnLastWindowClosed(false);
QTimer timer;
@ -959,7 +959,7 @@ public:
{
if (key == "testplugin")
return new TestPlugin;
return 0;
return nullptr;
}
};
@ -1069,7 +1069,7 @@ void tst_QGuiApplication::testSetPaletteAttribute()
QVERIFY(!QCoreApplication::testAttribute(Qt::AA_SetPalette));
QPalette palette;
palette.setColor(QPalette::Foreground, Qt::red);
palette.setColor(QPalette::WindowText, Qt::red);
QGuiApplication::setPalette(palette);
QVERIFY(QCoreApplication::testAttribute(Qt::AA_SetPalette));
@ -1126,7 +1126,7 @@ void tst_QGuiApplication::settableStyleHints()
int argc = 0;
QScopedPointer<QGuiApplication> app;
if (appInstance)
app.reset(new QGuiApplication(argc, 0));
app.reset(new QGuiApplication(argc, nullptr));
const int keyboardInputInterval = 555;
QGuiApplication::styleHints()->setKeyboardInputInterval(keyboardInputInterval);

View File

@ -338,9 +338,9 @@ void tst_QBrush::gradientPresets()
QCOMPARE(lg->finalStop(), QPointF(1, 0));
QCOMPARE(lg->stops().size(), 3);
QCOMPARE(lg->stops().at(0), QGradientStop(0, QColor(QLatin1Literal("#ff9a9e"))));
QCOMPARE(lg->stops().at(1), QGradientStop(0.99, QColor(QLatin1Literal("#fad0c4"))));
QCOMPARE(lg->stops().at(2), QGradientStop(1, QColor(QLatin1Literal("#fad0c4"))));
QCOMPARE(lg->stops().at(0), QGradientStop(0, QColor(QLatin1String("#ff9a9e"))));
QCOMPARE(lg->stops().at(1), QGradientStop(0.99, QColor(QLatin1String("#fad0c4"))));
QCOMPARE(lg->stops().at(2), QGradientStop(1, QColor(QLatin1String("#fad0c4"))));
QGradient invalidPreset(QGradient::Preset(-1));

View File

@ -20,21 +20,43 @@ MacFarlane writes:
> equivalent sample of Markdown. Here is a sample of AsciiDoc from the AsciiDoc
> manual:
> 1. List item one.
> +
> List item one continued with a second paragraph followed by an
> Indented block.
> +
> .................
> $ ls *.sh
> $ mv *.sh ~/tmp
> .................
> +
> List item continued with a third paragraph.
>
> 2. List item two continued with an open block.
> ...
>
> ``` AsciiDoc
> 1. List item one.
> +
> List item one continued with a second paragraph followed by an
> Indented block.
> +
> .................
> $ ls *.sh
> $ mv *.sh ~/tmp
> .................
> +
> List item continued with a third paragraph.
>
> 2. List item two continued with an open block.
> ...
> ```
The quotation includes an embedded quotation and a code quotation and ends with
an ellipsis due to being incomplete.
Now let's have an indented code block:
#include <stdio.h>
int main(void)
{
printf("# hello markdown\n");
return 0;
}
and end with a fenced code block:
~~~ pseudocode
#include <something.h>
#include <else.h>
a block {
a statement;
another statement;
}
~~~

View File

@ -419,6 +419,9 @@ void tst_QTextMarkdownWriter::fromHtml_data()
QTest::newRow("image") <<
"<img src=\"/url\" alt=\"foo\" title=\"title\"/>" <<
"![foo](/url \"title\")\n\n";
QTest::newRow("code") <<
"<pre class=\"language-pseudocode\">\n#include \"foo.h\"\n\nblock {\n statement();\n}\n\n</pre>" <<
"``` pseudocode\n#include \"foo.h\"\n\nblock {\n statement();\n}\n```\n\n";
// TODO
// QTest::newRow("escaped number and paren after double newline") <<
// "<p>(The first sentence of this paragraph is a line, the next paragraph has a number</p>13) but that's not part of an ordered list" <<

View File

@ -307,19 +307,19 @@ static QLatin1String modifierToName(Qt::KeyboardModifier modifier)
{
switch (modifier) {
case Qt::NoModifier:
return QLatin1Literal("No");
return QLatin1String("No");
break;
case Qt::ControlModifier:
return QLatin1Literal("Ctrl");
return QLatin1String("Ctrl");
break;
case Qt::ShiftModifier:
return QLatin1Literal("Shift");
return QLatin1String("Shift");
break;
case Qt::AltModifier:
return QLatin1Literal("Alt");
return QLatin1String("Alt");
break;
case Qt::MetaModifier:
return QLatin1Literal("Meta");
return QLatin1String("Meta");
break;
default:
qFatal("Unexpected keyboard modifier");
@ -331,17 +331,17 @@ static QLatin1String sectionToName(const QDateTimeEdit::Section section)
{
switch (section) {
case QDateTimeEdit::SecondSection:
return QLatin1Literal("Second");
return QLatin1String("Second");
case QDateTimeEdit::MinuteSection:
return QLatin1Literal("Minute");
return QLatin1String("Minute");
case QDateTimeEdit::HourSection:
return QLatin1Literal("Hours");
return QLatin1String("Hours");
case QDateTimeEdit::DaySection:
return QLatin1Literal("Day");
return QLatin1String("Day");
case QDateTimeEdit::MonthSection:
return QLatin1Literal("Month");
return QLatin1String("Month");
case QDateTimeEdit::YearSection:
return QLatin1Literal("Year");
return QLatin1String("Year");
default:
qFatal("Unexpected section");
return QLatin1String();
@ -3217,16 +3217,16 @@ void tst_QDateTimeEdit::wheelEvent_data()
QLatin1String sourceName;
switch (source) {
case Qt::MouseEventNotSynthesized:
sourceName = QLatin1Literal("NotSynthesized");
sourceName = QLatin1String("NotSynthesized");
break;
case Qt::MouseEventSynthesizedBySystem:
sourceName = QLatin1Literal("SynthesizedBySystem");
sourceName = QLatin1String("SynthesizedBySystem");
break;
case Qt::MouseEventSynthesizedByQt:
sourceName = QLatin1Literal("SynthesizedByQt");
sourceName = QLatin1String("SynthesizedByQt");
break;
case Qt::MouseEventSynthesizedByApplication:
sourceName = QLatin1Literal("SynthesizedByApplication");
sourceName = QLatin1String("SynthesizedByApplication");
break;
default:
qFatal("Unexpected wheel event source");

View File

@ -221,19 +221,19 @@ static QLatin1String modifierToName(Qt::KeyboardModifier modifier)
{
switch (modifier) {
case Qt::NoModifier:
return QLatin1Literal("No");
return QLatin1String("No");
break;
case Qt::ControlModifier:
return QLatin1Literal("Ctrl");
return QLatin1String("Ctrl");
break;
case Qt::ShiftModifier:
return QLatin1Literal("Shift");
return QLatin1String("Shift");
break;
case Qt::AltModifier:
return QLatin1Literal("Alt");
return QLatin1String("Alt");
break;
case Qt::MetaModifier:
return QLatin1Literal("Meta");
return QLatin1String("Meta");
break;
default:
qFatal("Unexpected keyboard modifier");
@ -1448,16 +1448,16 @@ void tst_QDoubleSpinBox::wheelEvents_data()
QLatin1String sourceName;
switch (source) {
case Qt::MouseEventNotSynthesized:
sourceName = QLatin1Literal("NotSynthesized");
sourceName = QLatin1String("NotSynthesized");
break;
case Qt::MouseEventSynthesizedBySystem:
sourceName = QLatin1Literal("SynthesizedBySystem");
sourceName = QLatin1String("SynthesizedBySystem");
break;
case Qt::MouseEventSynthesizedByQt:
sourceName = QLatin1Literal("SynthesizedByQt");
sourceName = QLatin1String("SynthesizedByQt");
break;
case Qt::MouseEventSynthesizedByApplication:
sourceName = QLatin1Literal("SynthesizedByApplication");
sourceName = QLatin1String("SynthesizedByApplication");
break;
default:
qFatal("Unexpected wheel event source");

View File

@ -222,19 +222,19 @@ static QLatin1String modifierToName(Qt::KeyboardModifier modifier)
{
switch (modifier) {
case Qt::NoModifier:
return QLatin1Literal("No");
return QLatin1String("No");
break;
case Qt::ControlModifier:
return QLatin1Literal("Ctrl");
return QLatin1String("Ctrl");
break;
case Qt::ShiftModifier:
return QLatin1Literal("Shift");
return QLatin1String("Shift");
break;
case Qt::AltModifier:
return QLatin1Literal("Alt");
return QLatin1String("Alt");
break;
case Qt::MetaModifier:
return QLatin1Literal("Meta");
return QLatin1String("Meta");
break;
default:
qFatal("Unexpected keyboard modifier");
@ -1402,16 +1402,16 @@ void tst_QSpinBox::wheelEvents_data()
QLatin1String sourceName;
switch (source) {
case Qt::MouseEventNotSynthesized:
sourceName = QLatin1Literal("NotSynthesized");
sourceName = QLatin1String("NotSynthesized");
break;
case Qt::MouseEventSynthesizedBySystem:
sourceName = QLatin1Literal("SynthesizedBySystem");
sourceName = QLatin1String("SynthesizedBySystem");
break;
case Qt::MouseEventSynthesizedByQt:
sourceName = QLatin1Literal("SynthesizedByQt");
sourceName = QLatin1String("SynthesizedByQt");
break;
case Qt::MouseEventSynthesizedByApplication:
sourceName = QLatin1Literal("SynthesizedByApplication");
sourceName = QLatin1String("SynthesizedByApplication");
break;
default:
qFatal("Unexpected wheel event source");

View File

@ -5,6 +5,7 @@ SUBDIRS = \
mimetypes \
kernel \
thread \
time \
tools \
codecs \
plugin

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