Merge remote-tracking branch 'origin/5.14' into 5.15

Change-Id: I7b6e6c687d8d60b4a54e6b9dada025ef66c53d96
This commit is contained in:
Qt Forward Merge Bot 2020-01-02 01:00:06 +01:00
commit 51df9bd251
14 changed files with 426 additions and 51 deletions

View File

@ -1969,7 +1969,8 @@ QString QLocale::toString(qlonglong i) const
{
int flags = d->m_numberOptions & OmitGroupSeparator
? 0
: QLocaleData::ThousandsGroup;
: (d->m_data->m_country_id == Country::India)
? QLocaleData::IndianNumberGrouping : QLocaleData::ThousandsGroup;
return d->m_data->longLongToString(i, -1, 10, -1, flags);
}
@ -1984,7 +1985,8 @@ QString QLocale::toString(qulonglong i) const
{
int flags = d->m_numberOptions & OmitGroupSeparator
? 0
: QLocaleData::ThousandsGroup;
: (d->m_data->m_country_id == Country::India)
? QLocaleData::IndianNumberGrouping : QLocaleData::ThousandsGroup;
return d->m_data->unsLongLongToString(i, -1, 10, -1, flags);
}
@ -3626,11 +3628,20 @@ QT_WARNING_DISABLE_MSVC(4146)
QT_WARNING_POP
uint cnt_thousand_sep = 0;
if (flags & ThousandsGroup && base == 10) {
if (base == 10){
if (flags & ThousandsGroup) {
for (int i = num_str.length() - 3; i > 0; i -= 3) {
num_str.insert(i, group);
++cnt_thousand_sep;
}
} else if (flags & IndianNumberGrouping) {
if (num_str.length() > 3)
num_str.insert(num_str.length() - 3 , group);
for (int i = num_str.length() - 6; i > 0; i -= 2) {
num_str.insert(i, group);
++cnt_thousand_sep;
}
}
}
for (int i = num_str.length()/* - cnt_thousand_sep*/; i < precision; ++i)
@ -3713,11 +3724,20 @@ QString QLocaleData::unsLongLongToString(const QChar zero, const QChar group,
}
uint cnt_thousand_sep = 0;
if (flags & ThousandsGroup && base == 10) {
if (base == 10) {
if (flags & ThousandsGroup) {
for (int i = num_str.length() - 3; i > 0; i -=3) {
num_str.insert(i, group);
++cnt_thousand_sep;
}
} else if (flags & IndianNumberGrouping) {
if (num_str.length() > 3)
num_str.insert(num_str.length() - 3 , group);
for (int i = num_str.length() - 6; i > 0; i -= 2) {
num_str.insert(i, group);
++cnt_thousand_sep;
}
}
}
const int zeroPadding = precision - num_str.length()/* + cnt_thousand_sep*/;
@ -3851,7 +3871,10 @@ bool QLocaleData::numberToCLocale(QStringView s, QLocale::NumberOptions number_o
// check distance from the last separator or from the beginning of the digits
// ### FIXME: Some locales allow other groupings!
// See https://en.wikipedia.org/wiki/Thousands_separator
if (last_separator_idx != -1 && idx - last_separator_idx != 4)
if (m_country_id == QLocale::India) {
if (last_separator_idx != -1 && idx - last_separator_idx != 3)
return false;
} else if (last_separator_idx != -1 && idx - last_separator_idx != 4)
return false;
if (last_separator_idx == -1
&& (start_of_digits_idx == -1 || idx - start_of_digits_idx > 3)) {

View File

@ -213,7 +213,8 @@ public:
ShowBase = 0x80,
UppercaseBase = 0x100,
ZeroPadExponent = 0x200,
ForcePoint = 0x400
ForcePoint = 0x400,
IndianNumberGrouping= 0x800
};
enum NumberMode { IntegerMode, DoubleStandardMode, DoubleScientificMode };

View File

@ -2867,7 +2867,7 @@ static const char *pcreCompileErrorCodes[] =
QT_TRANSLATE_NOOP("QRegularExpression", "numbers out of order in {} quantifier"),
QT_TRANSLATE_NOOP("QRegularExpression", "number too big in {} quantifier"),
QT_TRANSLATE_NOOP("QRegularExpression", "missing terminating ] for character class"),
QT_TRANSLATE_NOOP("QRegularExpression", "invalid escape sequence in character class"),
QT_TRANSLATE_NOOP("QRegularExpression", "escape sequence is invalid in character class"),
QT_TRANSLATE_NOOP("QRegularExpression", "range out of order in character class"),
QT_TRANSLATE_NOOP("QRegularExpression", "quantifier does not follow a repeatable item"),
QT_TRANSLATE_NOOP("QRegularExpression", "internal error: unexpected repeat"),
@ -2884,46 +2884,46 @@ static const char *pcreCompileErrorCodes[] =
QT_TRANSLATE_NOOP("QRegularExpression", "failed to allocate heap memory"),
QT_TRANSLATE_NOOP("QRegularExpression", "unmatched closing parenthesis"),
QT_TRANSLATE_NOOP("QRegularExpression", "internal error: code overflow"),
QT_TRANSLATE_NOOP("QRegularExpression", "letter or underscore expected after (?< or (?'"),
QT_TRANSLATE_NOOP("QRegularExpression", "missing closing parenthesis for condition"),
QT_TRANSLATE_NOOP("QRegularExpression", "lookbehind assertion is not fixed length"),
QT_TRANSLATE_NOOP("QRegularExpression", "malformed number or name after (?("),
QT_TRANSLATE_NOOP("QRegularExpression", "conditional group contains more than two branches"),
QT_TRANSLATE_NOOP("QRegularExpression", "a relative value of zero is not allowed"),
QT_TRANSLATE_NOOP("QRegularExpression", "conditional subpattern contains more than two branches"),
QT_TRANSLATE_NOOP("QRegularExpression", "assertion expected after (?( or (?(?C)"),
QT_TRANSLATE_NOOP("QRegularExpression", "(?R or (?[+-]digits must be followed by )"),
QT_TRANSLATE_NOOP("QRegularExpression", "digit expected after (?+ or (?-"),
QT_TRANSLATE_NOOP("QRegularExpression", "unknown POSIX class name"),
QT_TRANSLATE_NOOP("QRegularExpression", "internal error in pcre2_study(): should not occur"),
QT_TRANSLATE_NOOP("QRegularExpression", "this version of PCRE2 does not have Unicode support"),
QT_TRANSLATE_NOOP("QRegularExpression", "parentheses are too deeply nested (stack check)"),
QT_TRANSLATE_NOOP("QRegularExpression", "character code point value in \\x{} or \\o{} is too large"),
QT_TRANSLATE_NOOP("QRegularExpression", "invalid condition (?(0)"),
QT_TRANSLATE_NOOP("QRegularExpression", "\\C is not allowed in a lookbehind assertion"),
QT_TRANSLATE_NOOP("QRegularExpression", "PCRE does not support \\L, \\l, \\N{name}, \\U, or \\u"),
QT_TRANSLATE_NOOP("QRegularExpression", "lookbehind is too complicated"),
QT_TRANSLATE_NOOP("QRegularExpression", "\\C is not allowed in a lookbehind assertion in UTF-" "16" " mode"),
QT_TRANSLATE_NOOP("QRegularExpression", "PCRE2 does not support \\F, \\L, \\l, \\N{name}, \\U, or \\u"),
QT_TRANSLATE_NOOP("QRegularExpression", "number after (?C is greater than 255"),
QT_TRANSLATE_NOOP("QRegularExpression", "closing parenthesis for (?C expected"),
QT_TRANSLATE_NOOP("QRegularExpression", "invalid escape sequence in (*VERB) name"),
QT_TRANSLATE_NOOP("QRegularExpression", "unrecognized character after (?P"),
QT_TRANSLATE_NOOP("QRegularExpression", "syntax error in subpattern name (missing terminator)"),
QT_TRANSLATE_NOOP("QRegularExpression", "syntax error in subpattern name (missing terminator?)"),
QT_TRANSLATE_NOOP("QRegularExpression", "two named subpatterns have the same name (PCRE2_DUPNAMES not set)"),
QT_TRANSLATE_NOOP("QRegularExpression", "group name must start with a non-digit"),
QT_TRANSLATE_NOOP("QRegularExpression", "subpattern name must start with a non-digit"),
QT_TRANSLATE_NOOP("QRegularExpression", "this version of PCRE2 does not have support for \\P, \\p, or \\X"),
QT_TRANSLATE_NOOP("QRegularExpression", "malformed \\P or \\p sequence"),
QT_TRANSLATE_NOOP("QRegularExpression", "unknown property name after \\P or \\p"),
QT_TRANSLATE_NOOP("QRegularExpression", "subpattern name is too long (maximum " "10000" " characters)"),
QT_TRANSLATE_NOOP("QRegularExpression", "too many named subpatterns (maximum " "256" ")"),
QT_TRANSLATE_NOOP("QRegularExpression", "subpattern name is too long (maximum " "32" " code units)"),
QT_TRANSLATE_NOOP("QRegularExpression", "too many named subpatterns (maximum " "10000" ")"),
QT_TRANSLATE_NOOP("QRegularExpression", "invalid range in character class"),
QT_TRANSLATE_NOOP("QRegularExpression", "octal value is greater than \\377 in 8-bit non-UTF-8 mode"),
QT_TRANSLATE_NOOP("QRegularExpression", "internal error: overran compiling workspace"),
QT_TRANSLATE_NOOP("QRegularExpression", "internal error: previously-checked referenced subpattern not found"),
QT_TRANSLATE_NOOP("QRegularExpression", "DEFINE group contains more than one branch"),
QT_TRANSLATE_NOOP("QRegularExpression", "DEFINE subpattern contains more than one branch"),
QT_TRANSLATE_NOOP("QRegularExpression", "missing opening brace after \\o"),
QT_TRANSLATE_NOOP("QRegularExpression", "internal error: unknown newline setting"),
QT_TRANSLATE_NOOP("QRegularExpression", "\\g is not followed by a braced, angle-bracketed, or quoted name/number or by a plain number"),
QT_TRANSLATE_NOOP("QRegularExpression", "a numbered reference must not be zero"),
QT_TRANSLATE_NOOP("QRegularExpression", "an argument is not allowed for (*ACCEPT), (*FAIL), or (*COMMIT)"),
QT_TRANSLATE_NOOP("QRegularExpression", "(?R (recursive pattern call) must be followed by a closing parenthesis"),
QT_TRANSLATE_NOOP("QRegularExpression", "obsolete error (should not occur)"),
QT_TRANSLATE_NOOP("QRegularExpression", "(*VERB) not recognized or malformed"),
QT_TRANSLATE_NOOP("QRegularExpression", "number is too big"),
QT_TRANSLATE_NOOP("QRegularExpression", "subpattern number is too big"),
QT_TRANSLATE_NOOP("QRegularExpression", "subpattern name expected"),
QT_TRANSLATE_NOOP("QRegularExpression", "digit expected after (?+"),
QT_TRANSLATE_NOOP("QRegularExpression", "internal error: parsed pattern overflow"),
QT_TRANSLATE_NOOP("QRegularExpression", "non-octal character in \\o{} (closing brace missing?)"),
QT_TRANSLATE_NOOP("QRegularExpression", "different names for subpatterns of the same number are not allowed"),
QT_TRANSLATE_NOOP("QRegularExpression", "(*MARK) must have an argument"),
@ -2931,16 +2931,16 @@ static const char *pcreCompileErrorCodes[] =
QT_TRANSLATE_NOOP("QRegularExpression", "\\c must be followed by a printable ASCII character"),
QT_TRANSLATE_NOOP("QRegularExpression", "\\c must be followed by a letter or one of [\\]^_?"),
QT_TRANSLATE_NOOP("QRegularExpression", "\\k is not followed by a braced, angle-bracketed, or quoted name"),
QT_TRANSLATE_NOOP("QRegularExpression", "internal error: unknown opcode in find_fixedlength()"),
QT_TRANSLATE_NOOP("QRegularExpression", "internal error: unknown meta code in check_lookbehinds()"),
QT_TRANSLATE_NOOP("QRegularExpression", "\\N is not supported in a class"),
QT_TRANSLATE_NOOP("QRegularExpression", "SPARE ERROR"),
QT_TRANSLATE_NOOP("QRegularExpression", "callout string is too long"),
QT_TRANSLATE_NOOP("QRegularExpression", "disallowed Unicode code point (>= 0xd800 && <= 0xdfff)"),
QT_TRANSLATE_NOOP("QRegularExpression", "using UTF is disabled by the application"),
QT_TRANSLATE_NOOP("QRegularExpression", "using UCP is disabled by the application"),
QT_TRANSLATE_NOOP("QRegularExpression", "name is too long in (*MARK), (*PRUNE), (*SKIP), or (*THEN)"),
QT_TRANSLATE_NOOP("QRegularExpression", "character code point value in \\u.... sequence is too large"),
QT_TRANSLATE_NOOP("QRegularExpression", "digits missing in \\x{} or \\o{}"),
QT_TRANSLATE_NOOP("QRegularExpression", "syntax error in (?(VERSION condition"),
QT_TRANSLATE_NOOP("QRegularExpression", "digits missing in \\x{} or \\o{} or \\N{U+}"),
QT_TRANSLATE_NOOP("QRegularExpression", "syntax error or number too big in (?(VERSION condition"),
QT_TRANSLATE_NOOP("QRegularExpression", "internal error: unknown opcode in auto_possessify()"),
QT_TRANSLATE_NOOP("QRegularExpression", "missing terminating delimiter for callout with string argument"),
QT_TRANSLATE_NOOP("QRegularExpression", "unrecognized string delimiter follows (?C"),
@ -2950,6 +2950,16 @@ static const char *pcreCompileErrorCodes[] =
QT_TRANSLATE_NOOP("QRegularExpression", "regular expression is too complicated"),
QT_TRANSLATE_NOOP("QRegularExpression", "lookbehind assertion is too long"),
QT_TRANSLATE_NOOP("QRegularExpression", "pattern string is longer than the limit set by the application"),
QT_TRANSLATE_NOOP("QRegularExpression", "internal error: unknown code in parsed pattern"),
QT_TRANSLATE_NOOP("QRegularExpression", "internal error: bad code value in parsed_skip()"),
QT_TRANSLATE_NOOP("QRegularExpression", "PCRE2_EXTRA_ALLOW_SURROGATE_ESCAPES is not allowed in UTF-16 mode"),
QT_TRANSLATE_NOOP("QRegularExpression", "invalid option bits with PCRE2_LITERAL"),
QT_TRANSLATE_NOOP("QRegularExpression", "\\N{U+dddd} is supported only in Unicode (UTF) mode"),
QT_TRANSLATE_NOOP("QRegularExpression", "invalid hyphen in option setting"),
QT_TRANSLATE_NOOP("QRegularExpression", "(*alpha_assertion) not recognized"),
QT_TRANSLATE_NOOP("QRegularExpression", "script runs require Unicode support, which this version of PCRE2 does not have"),
QT_TRANSLATE_NOOP("QRegularExpression", "too many capturing groups (maximum 65535)"),
QT_TRANSLATE_NOOP("QRegularExpression", "atomic assertion expected after (?( or (?(?C)"),
QT_TRANSLATE_NOOP("QRegularExpression", "no error"),
QT_TRANSLATE_NOOP("QRegularExpression", "no match"),
QT_TRANSLATE_NOOP("QRegularExpression", "partial match"),
@ -2987,7 +2997,7 @@ static const char *pcreCompileErrorCodes[] =
QT_TRANSLATE_NOOP("QRegularExpression", "bad option value"),
QT_TRANSLATE_NOOP("QRegularExpression", "invalid replacement string"),
QT_TRANSLATE_NOOP("QRegularExpression", "bad offset into UTF string"),
QT_TRANSLATE_NOOP("QRegularExpression", "callout error code"), /* Never returned by PCRE2 itself */
QT_TRANSLATE_NOOP("QRegularExpression", "callout error code"),
QT_TRANSLATE_NOOP("QRegularExpression", "invalid data in workspace for DFA restart"),
QT_TRANSLATE_NOOP("QRegularExpression", "too much recursion for DFA matching"),
QT_TRANSLATE_NOOP("QRegularExpression", "backreference condition or recursion test is not supported for DFA matching"),
@ -3003,15 +3013,20 @@ static const char *pcreCompileErrorCodes[] =
QT_TRANSLATE_NOOP("QRegularExpression", "non-unique substring name"),
QT_TRANSLATE_NOOP("QRegularExpression", "NULL argument passed"),
QT_TRANSLATE_NOOP("QRegularExpression", "nested recursion at the same subject position"),
QT_TRANSLATE_NOOP("QRegularExpression", "recursion limit exceeded"),
QT_TRANSLATE_NOOP("QRegularExpression", "matching depth limit exceeded"),
QT_TRANSLATE_NOOP("QRegularExpression", "requested value is not available"),
QT_TRANSLATE_NOOP("QRegularExpression", "requested value is not set"),
QT_TRANSLATE_NOOP("QRegularExpression", "offset limit set without PCRE2_USE_OFFSET_LIMIT"),
QT_TRANSLATE_NOOP("QRegularExpression", "bad escape sequence in replacement string"),
QT_TRANSLATE_NOOP("QRegularExpression", "expected closing curly bracket in replacement string"),
QT_TRANSLATE_NOOP("QRegularExpression", "bad substitution in replacement string"),
QT_TRANSLATE_NOOP("QRegularExpression", "match with end before start is not supported"),
QT_TRANSLATE_NOOP("QRegularExpression", "too many replacements (more than INT_MAX)")
QT_TRANSLATE_NOOP("QRegularExpression", "match with end before start or start moved backwards is not supported"),
QT_TRANSLATE_NOOP("QRegularExpression", "too many replacements (more than INT_MAX)"),
QT_TRANSLATE_NOOP("QRegularExpression", "bad serialized data"),
QT_TRANSLATE_NOOP("QRegularExpression", "heap limit exceeded"),
QT_TRANSLATE_NOOP("QRegularExpression", "invalid syntax"),
QT_TRANSLATE_NOOP("QRegularExpression", "internal error - duplicate substitution match"),
QT_TRANSLATE_NOOP("QRegularExpression", "PCRE2_MATCH_INVALID_UTF is not supported for DFA matching")
};
#endif // #if 0

View File

@ -694,7 +694,7 @@ void QWasmCompositor::frame()
if (m_context.isNull()) {
m_context.reset(new QOpenGLContext());
//mContext->setFormat(mScreen->format());
m_context->setFormat(someWindow->window()->requestedFormat());
m_context->setScreen(screen()->screen());
m_context->create();
}

View File

@ -68,6 +68,7 @@ QByteArray QWasmCursor::cursorShapeToHtml(Qt::CursorShape shape)
cursorName = "default";
break;
case Qt::UpArrowCursor:
cursorName = "n-resize";
break;
case Qt::CrossCursor:
cursorName = "crosshair";
@ -91,7 +92,8 @@ QByteArray QWasmCursor::cursorShapeToHtml(Qt::CursorShape shape)
cursorName = "nwse-resize";
break;
case Qt::SizeAllCursor:
break; // no equivalent?
cursorName = "move";
break;
case Qt::BlankCursor:
cursorName = "none";
break;
@ -111,18 +113,23 @@ QByteArray QWasmCursor::cursorShapeToHtml(Qt::CursorShape shape)
cursorName = "help";
break;
case Qt::BusyCursor:
cursorName = "wait";
cursorName = "progress";
break;
case Qt::OpenHandCursor:
break; // no equivalent?
cursorName = "grab";
break;
case Qt::ClosedHandCursor:
break; // no equivalent?
cursorName = "grabbing";
break;
case Qt::DragCopyCursor:
break; // no equivalent?
cursorName = "copy";
break;
case Qt::DragMoveCursor:
break; // no equivalent?
cursorName = "default";
break;
case Qt::DragLinkCursor:
break; // no equivalent?
cursorName = "alias";
break;
default:
break;
}

View File

@ -4569,7 +4569,7 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid
case PM_MenuPanelWidth:
case PM_TabBarBaseOverlap:
case PM_TabBarBaseHeight:
ret = proxy()->pixelMetric(PM_DefaultFrameWidth, opt);
ret = proxy()->pixelMetric(PM_DefaultFrameWidth, opt, widget);
break;
case PM_MdiSubWindowFrameWidth:
@ -4801,7 +4801,7 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid
break;
case PM_TabBarIconSize:
ret = proxy()->pixelMetric(PM_SmallIconSize, opt);
ret = proxy()->pixelMetric(PM_SmallIconSize, opt, widget);
break;
case PM_ListViewIconSize:
#if QT_CONFIG(filedialog)
@ -4809,7 +4809,7 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid
ret = int(QStyleHelper::dpiScaled(24., opt));
else
#endif
ret = proxy()->pixelMetric(PM_SmallIconSize, opt);
ret = proxy()->pixelMetric(PM_SmallIconSize, opt, widget);
break;
case PM_ButtonIconSize:
@ -4817,7 +4817,7 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid
ret = int(QStyleHelper::dpiScaled(16, opt));
break;
case PM_IconViewIconSize:
ret = proxy()->pixelMetric(PM_LargeIconSize, opt);
ret = proxy()->pixelMetric(PM_LargeIconSize, opt, widget);
break;
case PM_LargeIconSize:
@ -4855,13 +4855,13 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid
ret = int(QStyleHelper::dpiScaled(16, opt));
break;
case PM_ScrollView_ScrollBarSpacing:
ret = 2 * proxy()->pixelMetric(PM_DefaultFrameWidth, opt);
ret = 2 * proxy()->pixelMetric(PM_DefaultFrameWidth, opt, widget);
break;
case PM_ScrollView_ScrollBarOverlap:
ret = 0;
break;
case PM_SubMenuOverlap:
ret = -proxy()->pixelMetric(QStyle::PM_MenuPanelWidth, opt);
ret = -proxy()->pixelMetric(QStyle::PM_MenuPanelWidth, opt, widget);
break;
case PM_TreeViewIndentation:
ret = int(QStyleHelper::dpiScaled(20, opt));

View File

@ -1364,6 +1364,8 @@ void QMainWindow::setUnifiedTitleAndToolBarOnMac(bool set)
createWinId();
QPlatformNativeInterface *nativeInterface = QGuiApplication::platformNativeInterface();
if (!nativeInterface)
return; // Not Cocoa platform plugin.
QPlatformNativeInterface::NativeResourceForIntegrationFunction function =
nativeInterface->nativeResourceFunctionForIntegration("setContentBorderEnabled");
if (!function)

View File

@ -360,6 +360,8 @@ void QToolBarLayout::updateMacBorderMetrics()
return;
QPlatformNativeInterface *nativeInterface = QApplication::platformNativeInterface();
if (!nativeInterface)
return; // Not Cocoa platform plugin.
QPlatformNativeInterface::NativeResourceForIntegrationFunction function =
nativeInterface->nativeResourceFunctionForIntegration("registerContentBorderArea");
if (!function)

View File

@ -147,6 +147,8 @@ private slots:
void systemLocale_data();
void systemLocale();
void IndianNumberGrouping();
// *** ORDER-DEPENDENCY *** (This Is Bad.)
// Test order is determined by order of declaration here: *all* tests that
// QLocale::setDefault() *must* appear *after* all other tests !
@ -2991,5 +2993,56 @@ void tst_QLocale::systemLocale()
QCOMPARE(QLocale::system(), originalSystemLocale);
}
void tst_QLocale::IndianNumberGrouping()
{
QLocale indian(QLocale::Hindi, QLocale::India);
qint8 int8 = 100;
QString strResult8("100");
QCOMPARE(indian.toString(int8), strResult8);
QCOMPARE(indian.toShort(strResult8), short(int8));
quint8 uint8 = 100;
QCOMPARE(indian.toString(uint8), strResult8);
QCOMPARE(indian.toShort(strResult8), short(uint8));
// Boundary case 1000 for short and ushort
short shortInt = 1000;
QString strResult16("1,000");
QCOMPARE(indian.toString(shortInt), strResult16);
QCOMPARE(indian.toShort(strResult16), shortInt);
ushort uShortInt = 1000;
QCOMPARE(indian.toString(uShortInt), strResult16);
QCOMPARE(indian.toUShort(strResult16), uShortInt);
shortInt = 10000;
strResult16 = "10,000";
QCOMPARE(indian.toString(shortInt), strResult16);
QCOMPARE(indian.toShort(strResult16), shortInt);
uShortInt = 10000;
QCOMPARE(indian.toString(uShortInt), strResult16);
QCOMPARE(indian.toUShort(strResult16), uShortInt);
int intInt = 1000000000;
QString strResult32("1,00,00,00,000");
QCOMPARE(indian.toString(intInt), strResult32);
QCOMPARE(indian.toInt(strResult32), intInt);
uint uIntInt = 1000000000;
QCOMPARE(indian.toString(uIntInt), strResult32);
QCOMPARE(indian.toUInt(strResult32), uIntInt);
QString strResult64("10,00,00,00,00,00,00,00,000");
qint64 int64 = Q_INT64_C(1000000000000000000);
QCOMPARE(indian.toString(int64), strResult64);
QCOMPARE(indian.toLongLong(strResult64), int64);
quint64 uint64 = Q_UINT64_C(1000000000000000000);
QCOMPARE(indian.toString(uint64), strResult64);
QCOMPARE(indian.toULongLong(strResult64), uint64);
}
QTEST_MAIN(tst_QLocale)
#include "tst_qlocale.moc"

View File

@ -0,0 +1,76 @@
/****************************************************************************
**
** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** 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 The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** BSD License Usage
** Alternatively, you may use this file under the terms of the BSD license
** as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
** * Neither the name of The Qt Company Ltd nor the names of its
** contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "MainWindow.h"
#include "ui_MainWindow.h"
#include <QPushButton>
#include <QVariant>
#include <QApplication>
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
{
ui->setupUi(this);
for (int i = 0; i <= Qt::LastCursor; i++) {
auto shape = Qt::CursorShape(i);
auto button =
new QPushButton(QVariant::fromValue(shape).toString(), this);
ui->buttonsLayout->addWidget(button);
QObject::connect(button, &QPushButton::clicked,
[this, shape]() { ui->cursorWidget->setCursor(shape); });
}
}
MainWindow::~MainWindow()
{
delete ui;
}

View File

@ -0,0 +1,70 @@
/****************************************************************************
**
** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** 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 The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** BSD License Usage
** Alternatively, you may use this file under the terms of the BSD license
** as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
** * Neither the name of The Qt Company Ltd nor the names of its
** contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
****************************************************************************/
#pragma once
#include <QMainWindow>
QT_BEGIN_NAMESPACE
namespace Ui {
class MainWindow;
}
QT_END_NAMESPACE
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow(QWidget *parent = nullptr);
~MainWindow();
private:
Ui::MainWindow *ui;
};

View File

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>700</width>
<height>520</height>
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QWidget" name="buttons" native="true">
<property name="maximumSize">
<size>
<width>200</width>
<height>16777215</height>
</size>
</property>
<layout class="QVBoxLayout" name="buttonsLayout"/>
</widget>
</item>
<item>
<widget class="QWidget" name="cursorWidget" native="true">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Push the button to activate cursor and move mouse th this area.</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="textInteractionFlags">
<set>Qt::NoTextInteraction</set>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -0,0 +1,13 @@
QT += core gui widgets
SOURCES += \
main.cpp \
MainWindow.cpp
HEADERS += \
MainWindow.h
FORMS += \
MainWindow.ui
LIBS += -lidbfs.js

View File

@ -0,0 +1,60 @@
/****************************************************************************
**
** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** 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 The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** BSD License Usage
** Alternatively, you may use this file under the terms of the BSD license
** as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
** * Neither the name of The Qt Company Ltd nor the names of its
** contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "MainWindow.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.showFullScreen();
return a.exec();
}