Merge 5.14 into 5.14.1
Change-Id: Ie90edfd16f48e1907fd18288473ac403f62b9032
This commit is contained in:
commit
4f55c41816
@ -1457,6 +1457,11 @@ Configure with '-qreal float' to create a build that is binary-compatible with 5
|
||||
{
|
||||
"type": "emccVersion",
|
||||
"condition": "config.wasm"
|
||||
},
|
||||
{
|
||||
"type": "error",
|
||||
"condition": "config.ios && features.debug && !features.debug_and_release",
|
||||
"message": "Debug build wihtout Release build is not currently supported on ios see QTBUG-71990. Use -debug-and-release."
|
||||
}
|
||||
],
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
dita.metadata.default.author = Qt Project
|
||||
dita.metadata.default.permissions = all
|
||||
dita.metadata.default.publisher = Qt Project
|
||||
dita.metadata.default.copyryear = 2019
|
||||
dita.metadata.default.copyryear = 2020
|
||||
dita.metadata.default.copyrholder = The Qt Company Ltd
|
||||
dita.metadata.default.audience = programmer
|
||||
|
||||
|
@ -78,7 +78,7 @@ HTML.footer += \
|
||||
" <ul id=\"menu-footer-submenu\" class=\"right clearfix\"><li id=\"menu-item-1795\" class=\"menu-item menu-item-type-custom menu-item-object-custom menu-item-1795\"><a title=\"Sign into your account.\" href=\"https://account.qt.io/login\">Sign In</a></li>\n" \
|
||||
" <li id=\"menu-item-10375\" class=\"menu-item menu-item-type-custom menu-item-object-custom menu-item-10375\"><a href=\"mailto:feedback@theqtcompany.com?Subject=Feedback%20about%20doc.qt.io%20site\">Feedback</a></li>\n" \
|
||||
" <li id=\"menu-item-1494\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-1494\"><a href=\"http://qt.io/contact-us/\">Contact us</a></li>\n" \
|
||||
" <li id=\"menu-item-4472\" class=\"menu-item menu-item-type-custom menu-item-object-custom menu-item-4472\"><a href=\"http://qt.io/about-us/\">© 2019 The Qt Company</a></li>\n" \
|
||||
" <li id=\"menu-item-4472\" class=\"menu-item menu-item-type-custom menu-item-object-custom menu-item-4472\"><a href=\"http://qt.io/about-us/\">© 2020 The Qt Company</a></li>\n" \
|
||||
" </ul>\n" \
|
||||
"</div>\n" \
|
||||
"</div>\n" \
|
||||
|
@ -8,7 +8,7 @@ HTML.footer = \
|
||||
"</div>\n" \
|
||||
"<div class=\"footer\">\n" \
|
||||
" <p>\n" \
|
||||
" <acronym title=\"Copyright\">©</acronym> 2019 The Qt Company Ltd.\n" \
|
||||
" <acronym title=\"Copyright\">©</acronym> 2020 The Qt Company Ltd.\n" \
|
||||
" Documentation contributions included herein are the copyrights of\n" \
|
||||
" their respective owners.<br/>" \
|
||||
" The documentation provided herein is licensed under the terms of the" \
|
||||
|
@ -5,7 +5,7 @@
|
||||
HTML.footer = \
|
||||
" </div>\n" \
|
||||
" <p class=\"copy-notice\">\n" \
|
||||
" <acronym title=\"Copyright\">©</acronym> 2019 The Qt Company Ltd.\n" \
|
||||
" <acronym title=\"Copyright\">©</acronym> 2020 The Qt Company Ltd.\n" \
|
||||
" Documentation contributions included herein are the copyrights of\n" \
|
||||
" their respective owners. " \
|
||||
" The documentation provided herein is licensed under the terms of the" \
|
||||
|
@ -238,8 +238,7 @@
|
||||
\snippet threads/mandelbrot/mandelbrotwidget.cpp 1
|
||||
|
||||
The interesting part of the constructor is the
|
||||
qRegisterMetaType() and QObject::connect() calls. Let's start
|
||||
with the \l{QObject::connect()}{connect()} call.
|
||||
QObject::connect() call.
|
||||
|
||||
Although it looks like a standard signal-slot connection between
|
||||
two \l{QObject}s, because the signal is emitted in a different
|
||||
@ -254,9 +253,10 @@
|
||||
With queued connections, Qt must store a copy of the arguments
|
||||
that were passed to the signal so that it can pass them to the
|
||||
slot later on. Qt knows how to take of copy of many C++ and Qt
|
||||
types, but QImage isn't one of them. We must therefore call the
|
||||
template function qRegisterMetaType() before we can use QImage
|
||||
as a parameter in queued connections.
|
||||
types, so, no further action is needed for QImage.
|
||||
If a custom type was used, a call to the template function
|
||||
qRegisterMetaType() would be required before the type
|
||||
could be used as a parameter in queued connections.
|
||||
|
||||
\snippet threads/mandelbrot/mandelbrotwidget.cpp 2
|
||||
\snippet threads/mandelbrot/mandelbrotwidget.cpp 3
|
||||
|
@ -182,6 +182,6 @@
|
||||
In addition to the functions and slots discussed above, we have
|
||||
also implemented several convenience functions to simplify the
|
||||
constructor: \c createIconGroupBox(), \c createMessageGroupBox(),
|
||||
\c createActions() and \c createTrayIcon(). See the \l
|
||||
{desktop/systray/window.cpp}{window.cpp} file for details.
|
||||
\c createActions() and \c createTrayIcon(). See the \c
|
||||
{desktop/systray/window.cpp} file for details.
|
||||
*/
|
||||
|
@ -136,7 +136,7 @@
|
||||
|
||||
\section1 Defining the AddressBook Class
|
||||
|
||||
The \l{tutorials/addressbook/part1/addressbook.h}{\c addressbook.h} file is
|
||||
The \c{tutorials/addressbook/part1/addressbook.h} file is
|
||||
used to define the \c AddressBook class.
|
||||
|
||||
We start by defining \c AddressBook as a QWidget subclass and declaring
|
||||
|
@ -284,6 +284,6 @@
|
||||
instance of the QStandardItemModel class, i.e., a generic model
|
||||
for storing custom data typically used as a repository for
|
||||
standard Qt data types. Each mail description is added to the
|
||||
model using \c addMail(), another convenience function. See \l
|
||||
{itemviews/customsortfiltermodel/main.cpp}{main.cpp} for details.
|
||||
model using \c addMail(), another convenience function. See \c
|
||||
{itemviews/customsortfiltermodel/main.cpp} for details.
|
||||
*/
|
||||
|
@ -320,8 +320,8 @@
|
||||
|
||||
The \c setupShapes() function is called from the constructor and
|
||||
create the QPainterPath objects representing the shapes that are
|
||||
used in the application. For construction details, see the \l
|
||||
{painting/transformations/window.cpp}{window.cpp} example
|
||||
used in the application. For construction details, see the \c
|
||||
{painting/transformations/window.cpp} example
|
||||
file. The shapes are stored in a QList. The QList::append()
|
||||
function inserts the given shape at the end of the list.
|
||||
|
||||
|
@ -36,7 +36,8 @@ build_pass {
|
||||
}
|
||||
}
|
||||
} else: contains(TEMPLATE, "lib"):!static:!QTDIR_build:android_install {
|
||||
!contains(TARGET, "_$${QT_ARCH}"): TARGET = $${TARGET}_$${QT_ARCH}
|
||||
tmpvar = $$str_member(TARGET, -$$str_size(QT_ARCH), -1)
|
||||
!equals(tmpvar, $${QT_ARCH}): TARGET = $${TARGET}_$${QT_ARCH}
|
||||
target.path = /libs/$$ANDROID_TARGET_ARCH/
|
||||
INSTALLS *= target
|
||||
}
|
||||
|
@ -212,14 +212,17 @@ macx-xcode {
|
||||
QMAKE_CXXFLAGS += $(EXPORT_QMAKE_XARCH_CFLAGS)
|
||||
QMAKE_LFLAGS += $(EXPORT_QMAKE_XARCH_LFLAGS)
|
||||
} else {
|
||||
simulator: \
|
||||
simulator {
|
||||
version_identifier = $$simulator.deployment_identifier
|
||||
else: \
|
||||
sysroot_path = $$xcodeSDKInfo(Path, $$simulator.sdk)
|
||||
} else {
|
||||
version_identifier = $$device.deployment_identifier
|
||||
sysroot_path = $$xcodeSDKInfo(Path, $$device.sdk)
|
||||
}
|
||||
version_min_flag = -m$${version_identifier}-version-min=$$deployment_target
|
||||
QMAKE_CFLAGS += -isysroot $$QMAKE_MAC_SDK_PATH $$version_min_flag
|
||||
QMAKE_CXXFLAGS += -isysroot $$QMAKE_MAC_SDK_PATH $$version_min_flag
|
||||
QMAKE_LFLAGS += -Wl,-syslibroot,$$QMAKE_MAC_SDK_PATH $$version_min_flag
|
||||
QMAKE_CFLAGS += -isysroot $$sysroot_path $$version_min_flag
|
||||
QMAKE_CXXFLAGS += -isysroot $$sysroot_path $$version_min_flag
|
||||
QMAKE_LFLAGS += -Wl,-syslibroot,$$sysroot_path $$version_min_flag
|
||||
}
|
||||
|
||||
# Enable precompiled headers for multiple architectures
|
||||
|
@ -1,4 +1,4 @@
|
||||
QMAKE_TARGET_COMPANY = The Qt Company Ltd.
|
||||
isEmpty(QMAKE_TARGET_PRODUCT): QMAKE_TARGET_PRODUCT = Qt5
|
||||
isEmpty(QMAKE_TARGET_DESCRIPTION): QMAKE_TARGET_DESCRIPTION = C++ Application Development Framework
|
||||
QMAKE_TARGET_COPYRIGHT = Copyright (C) 2019 The Qt Company Ltd.
|
||||
QMAKE_TARGET_COPYRIGHT = Copyright (C) 2020 The Qt Company Ltd.
|
||||
|
@ -303,7 +303,9 @@ SUBDIRS = kernel \
|
||||
|
||||
|
||||
#! [51]
|
||||
CONFIG += ordered
|
||||
SUBDIRS += my_executable my_library tests doc
|
||||
my_executable.depends = my_library
|
||||
tests.depends = my_executable
|
||||
#! [51]
|
||||
|
||||
|
||||
|
@ -40,3 +40,21 @@ win32|macx {
|
||||
HEADERS += debugging.h
|
||||
}
|
||||
#! [4]
|
||||
|
||||
#! [5]
|
||||
if(win32|macos):CONFIG(debug, debug|release) {
|
||||
# Do something on Windows and macOS,
|
||||
# but only for the debug configuration.
|
||||
}
|
||||
win32|if(macos:CONFIG(debug, debug|release)) {
|
||||
# Do something on Windows (regardless of debug or release)
|
||||
# and on macOS (only for debug).
|
||||
}
|
||||
#! [5]
|
||||
|
||||
#! [6]
|
||||
win32-* {
|
||||
# Matches every mkspec starting with "win32-"
|
||||
SOURCES += win32_specific.cpp
|
||||
}
|
||||
#! [6]
|
||||
|
@ -936,7 +936,9 @@
|
||||
file.
|
||||
\row \li ordered \li When using the \c subdirs template, this option
|
||||
specifies that the directories listed should be processed in the
|
||||
order in which they are given.
|
||||
order in which they are given. \note The use of this option is discouraged.
|
||||
Specify dependencies as described in the \l{#SUBDIRS}{SUBDIRS}
|
||||
variable documentation.
|
||||
\row \li precompile_header \li Enables support for the use of
|
||||
\l{Using Precompiled Headers}{precompiled headers} in projects.
|
||||
\row \li precompile_header_c (MSVC only) \li Enables support for the use of
|
||||
@ -2730,21 +2732,35 @@
|
||||
|
||||
\snippet code/doc_src_qmake-manual.pro 50
|
||||
|
||||
If you need to ensure that the subdirectories are built in the order in
|
||||
which they are specified, update the \l{#CONFIG}{CONFIG} variable to
|
||||
include the \c ordered option:
|
||||
If you need to ensure that the subdirectories are built in a particular
|
||||
order, use the \c .depends modifier on the relevant \c SUBDIRS elements.
|
||||
|
||||
For example:
|
||||
|
||||
\snippet code/doc_src_qmake-manual.pro 51
|
||||
|
||||
It is possible to modify this default behavior of \c SUBDIRS by giving
|
||||
additional modifiers to \c SUBDIRS elements. Supported modifiers are:
|
||||
The configuration above ensures that \c{my_library} is built before
|
||||
\c{my_executable} and that \c{my_executable} is built before \c{tests}.
|
||||
However, \c{doc} can be built in parallel with the other subdirectories,
|
||||
thus speeding up the build process.
|
||||
|
||||
\note Multiple dependencies can be listed and they will all be built before
|
||||
the target that depends on them.
|
||||
|
||||
\note Using \l{#CONFIG}{CONFIG += ordered} is discouraged as it can slow down
|
||||
multi-core builds. Unlike the example shown above, all builds will happen
|
||||
sequentially even if they don't have dependencies.
|
||||
|
||||
Beside defining the build order, it is possible to modify the default behavior
|
||||
of \c SUBDIRS by giving additional modifiers to \c SUBDIRS elements.
|
||||
Supported modifiers are:
|
||||
|
||||
\table
|
||||
\header \li Modifier \li Effect
|
||||
\row \li .subdir \li Use the specified subdirectory instead of \c SUBDIRS value.
|
||||
\row \li .file \li Specify the subproject \c pro file explicitly. Cannot be
|
||||
used in conjunction with \c .subdir modifier.
|
||||
\row \li .depends \li This subproject depends on specified subproject.
|
||||
\row \li .depends \li This subproject depends on specified subproject(s).
|
||||
\row \li .makefile \li The makefile of subproject.
|
||||
Available only on platforms that use makefiles.
|
||||
\row \li .target \li Base string used for makefile targets related to this
|
||||
@ -4418,6 +4434,20 @@
|
||||
|
||||
\snippet qmake/scopes.pro 4
|
||||
|
||||
If you need to mix both operators, you can use the \c if function to specify
|
||||
operator precedence.
|
||||
|
||||
\snippet qmake/scopes.pro 5
|
||||
|
||||
The condition accepts the wildcard character to match a family of \c{CONFIG}
|
||||
values or mkspec names.
|
||||
|
||||
\snippet qmake/scopes.pro 6
|
||||
|
||||
\note Historically, checking the mkspec name with wildcards like above was
|
||||
qmake's way to check for the platform. Nowadays, we recommend to use values
|
||||
that are defined by the mkspec in the \c QMAKE_PLATFORM variable.
|
||||
|
||||
You can also provide alternative declarations to those within a scope by
|
||||
using an \c else scope. Each \c else scope is processed if the conditions
|
||||
for the preceding scopes are false.
|
||||
|
@ -1520,7 +1520,7 @@ MakefileGenerator::createObjectList(const ProStringList &sources)
|
||||
if (!noIO()) {
|
||||
// Ensure that the final output directory of each object exists
|
||||
QString outRelativePath = fileFixify(dir, FileFixifyBackwards);
|
||||
if (!mkdir(outRelativePath))
|
||||
if (!outRelativePath.isEmpty() && !mkdir(outRelativePath))
|
||||
warn_msg(WarnLogic, "Cannot create directory '%s'", outRelativePath.toLatin1().constData());
|
||||
}
|
||||
} else {
|
||||
|
@ -132,23 +132,6 @@ public class QtActivityLoader extends QtLoader {
|
||||
return;
|
||||
}
|
||||
|
||||
if (Build.VERSION.SDK_INT < 21) {
|
||||
// fatal error, show the error and quit
|
||||
AlertDialog errorDialog = new AlertDialog.Builder(m_activity).create();
|
||||
if (m_contextInfo.metaData.containsKey("android.app.unsupported_android_version"))
|
||||
errorDialog.setMessage(m_contextInfo.metaData.getString("android.app.unsupported_android_version"));
|
||||
else
|
||||
errorDialog.setMessage("Unsupported Android version.");
|
||||
errorDialog.setButton(m_activity.getResources().getString(android.R.string.ok), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
errorDialog.show();
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
m_activity.setTheme(Class.forName("android.R$style").getDeclaredField(QT_ANDROID_DEFAULT_THEME).getInt(null));
|
||||
} catch (Exception e) {
|
||||
|
@ -71,7 +71,7 @@ QTimer *timer = qobject_cast<QTimer *>(obj);
|
||||
// timer == (QObject *)obj
|
||||
|
||||
QAbstractButton *button = qobject_cast<QAbstractButton *>(obj);
|
||||
// button == 0
|
||||
// button == nullptr
|
||||
//! [3]
|
||||
|
||||
|
||||
@ -144,7 +144,7 @@ class MyObject : public QObject
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MyObject(QObject *parent = 0);
|
||||
MyObject(QObject *parent = nullptr);
|
||||
|
||||
protected:
|
||||
void timerEvent(QTimerEvent *event) override;
|
||||
@ -322,7 +322,7 @@ QObject::connect: Cannot queue arguments of type 'MyType'
|
||||
|
||||
|
||||
//! [26]
|
||||
disconnect(myObject, 0, 0, 0);
|
||||
disconnect(myObject, nullptr, nullptr, nullptr);
|
||||
//! [26]
|
||||
|
||||
|
||||
@ -332,7 +332,7 @@ myObject->disconnect();
|
||||
|
||||
|
||||
//! [28]
|
||||
disconnect(myObject, SIGNAL(mySignal()), 0, 0);
|
||||
disconnect(myObject, SIGNAL(mySignal()), nullptr, nullptr);
|
||||
//! [28]
|
||||
|
||||
|
||||
@ -342,7 +342,7 @@ myObject->disconnect(SIGNAL(mySignal()));
|
||||
|
||||
|
||||
//! [30]
|
||||
disconnect(myObject, 0, myReceiver, 0);
|
||||
disconnect(myObject, nullptr, myReceiver, nullptr);
|
||||
//! [30]
|
||||
|
||||
|
||||
@ -391,7 +391,7 @@ class MyClass : public QObject
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MyClass(QObject *parent = 0);
|
||||
MyClass(QObject *parent = nullptr);
|
||||
~MyClass();
|
||||
|
||||
enum Priority { High, Low, VeryHigh, VeryLow };
|
||||
@ -467,7 +467,7 @@ QObject::connect(socket, &QTcpSocket::connected, [=] () {
|
||||
//! [46]
|
||||
|
||||
//! [47]
|
||||
disconnect(myObject, &MyObject::mySignal(), 0, 0);
|
||||
disconnect(myObject, &MyObject::mySignal(), nullptr, nullptr);
|
||||
//! [47]
|
||||
|
||||
//! [48]
|
||||
@ -505,7 +505,7 @@ class MyClass : public QWidget
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MyClass(QWidget *parent = 0);
|
||||
MyClass(QWidget *parent = nullptr);
|
||||
~MyClass();
|
||||
|
||||
bool event(QEvent* ev) override
|
||||
|
@ -37,5 +37,5 @@
|
||||
QCborValueRef qfloat16 QDeferredDeleteEvent QSpecialInteger QLittleEndianStorageType
|
||||
QBigEndianStorageType QFactoryInterface QFutureWatcherBase QJsonValuePtr
|
||||
QJsonValueRefPtr QLinkedListNode QAbstractConcatenable QStringBuilderCommon
|
||||
QTextCodec::ConverterState QThreadStorageData)
|
||||
QTextCodec::ConverterState QThreadStorageData QTextStreamManipulator)
|
||||
*/
|
||||
|
@ -883,7 +883,6 @@
|
||||
# define Q_COMPILER_DEFAULT_MEMBERS
|
||||
# define Q_COMPILER_DELETE_MEMBERS
|
||||
/* C++11 features supported in GCC 4.6: */
|
||||
# define Q_COMPILER_CONSTEXPR
|
||||
# define Q_COMPILER_NULLPTR
|
||||
# define Q_COMPILER_UNRESTRICTED_UNIONS
|
||||
# define Q_COMPILER_RANGE_FOR
|
||||
@ -914,7 +913,11 @@
|
||||
# define Q_COMPILER_REF_QUALIFIERS
|
||||
# endif
|
||||
# endif
|
||||
/* C++11 features are complete as of GCC 4.8.1 */
|
||||
# if Q_CC_GNU >= 500
|
||||
/* GCC 4.6 introduces constexpr, but it's bugged (at least) in the whole
|
||||
* 4.x series, see e.g. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57694 */
|
||||
# define Q_COMPILER_CONSTEXPR
|
||||
# endif
|
||||
# endif
|
||||
# if __cplusplus > 201103L
|
||||
# if Q_CC_GNU >= 409
|
||||
|
@ -945,7 +945,7 @@ QT_WARNING_POP
|
||||
#endif
|
||||
|
||||
QT_WARNING_PUSH
|
||||
// warning: noexcept-expression evaluates to ‘false’ because of a call to ‘void swap(..., ...)'
|
||||
// warning: noexcept-expression evaluates to 'false' because of a call to 'void swap(..., ...)'
|
||||
QT_WARNING_DISABLE_GCC("-Wnoexcept")
|
||||
|
||||
namespace QtPrivate
|
||||
|
@ -249,7 +249,8 @@ QT_WARNING_POP
|
||||
// size_t. Implementations for 8- and 16-bit types will work but may not be as
|
||||
// efficient. Implementations for 64-bit may be missing on 32-bit platforms.
|
||||
|
||||
#if (defined(Q_CC_GNU) && (Q_CC_GNU >= 500) || (defined(Q_CC_INTEL) && !defined(Q_OS_WIN))) || __has_builtin(__builtin_add_overflow)
|
||||
#if ((defined(Q_CC_INTEL) ? (Q_CC_INTEL >= 1800 && !defined(Q_OS_WIN)) : defined(Q_CC_GNU)) \
|
||||
&& Q_CC_GNU >= 500) || __has_builtin(__builtin_add_overflow)
|
||||
// GCC 5, ICC 18, and Clang 3.8 have builtins to detect overflows
|
||||
|
||||
template <typename T> inline
|
||||
|
@ -403,6 +403,7 @@ QStringList QWindowsFileSystemWatcherEngine::addPaths(const QStringList &paths,
|
||||
const QString absolutePath = isDir ? fileInfo.absoluteFilePath() : fileInfo.absolutePath();
|
||||
const uint flags = isDir
|
||||
? (FILE_NOTIFY_CHANGE_DIR_NAME
|
||||
| FILE_NOTIFY_CHANGE_ATTRIBUTES
|
||||
| FILE_NOTIFY_CHANGE_FILE_NAME)
|
||||
: (FILE_NOTIFY_CHANGE_DIR_NAME
|
||||
| FILE_NOTIFY_CHANGE_FILE_NAME
|
||||
|
@ -1004,7 +1004,7 @@ QT_WARNING_POP
|
||||
|
||||
/*!
|
||||
\internal
|
||||
Returns true if we emitted readyRead().
|
||||
Returns \c true if we emitted readyRead().
|
||||
*/
|
||||
bool QProcessPrivate::tryReadFromChannel(Channel *channel)
|
||||
{
|
||||
@ -2187,6 +2187,8 @@ bool QProcess::startDetached(qint64 *pid)
|
||||
This method is an alias for start(), and exists only to fully implement
|
||||
the interface defined by QIODevice.
|
||||
|
||||
Returns \c true if the program has been started.
|
||||
|
||||
\sa start(), setProgram(), setArguments()
|
||||
*/
|
||||
bool QProcess::open(OpenMode mode)
|
||||
|
@ -212,6 +212,7 @@ Qt::ItemFlags QStringListModel::flags(const QModelIndex &index) const
|
||||
\a index in the model, to the provided \a value.
|
||||
|
||||
The dataChanged() signal is emitted if the item is changed.
|
||||
Returns \c true after emitting the dataChanged() signal.
|
||||
|
||||
\sa Qt::ItemDataRole, data()
|
||||
*/
|
||||
@ -249,6 +250,8 @@ bool QStringListModel::clearItemData(const QModelIndex &index)
|
||||
specified, indicating that the rows are inserted in the top level of
|
||||
the model.
|
||||
|
||||
Returns \c true if the insertion was successful.
|
||||
|
||||
\sa QAbstractItemModel::insertRows()
|
||||
*/
|
||||
|
||||
@ -275,6 +278,8 @@ bool QStringListModel::insertRows(int row, int count, const QModelIndex &parent)
|
||||
specified, indicating that the rows are removed in the top level of
|
||||
the model.
|
||||
|
||||
Returns \c true if the row removal was successful.
|
||||
|
||||
\sa QAbstractItemModel::removeRows()
|
||||
*/
|
||||
|
||||
|
@ -118,7 +118,7 @@ public:
|
||||
|
||||
int remainingTime(int timerId) final;
|
||||
|
||||
void wakeUp() final;
|
||||
void wakeUp() override;
|
||||
void interrupt() final;
|
||||
void flush() override;
|
||||
|
||||
|
@ -1185,8 +1185,8 @@ QObjectPrivate::Connection::~Connection()
|
||||
\relates QObject
|
||||
|
||||
Returns the given \a object cast to type T if the object is of type
|
||||
T (or of a subclass); otherwise returns 0. If \a object is 0 then
|
||||
it will also return 0.
|
||||
T (or of a subclass); otherwise returns \nullptr. If \a object is
|
||||
\nullptr then it will also return \nullptr.
|
||||
|
||||
The class T must inherit (directly or indirectly) QObject and be
|
||||
declared with the \l Q_OBJECT macro.
|
||||
@ -1538,7 +1538,7 @@ QThread *QObject::thread() const
|
||||
the thread affinity is changed. You can handle this event to
|
||||
perform any special processing. Note that any new events that are
|
||||
posted to this object will be handled in the \a targetThread,
|
||||
provided it is non-null: when it is \nullptr, no event processing
|
||||
provided it is not \nullptr: when it is \nullptr, no event processing
|
||||
for this object or its children can happen, as they are no longer
|
||||
associated with any thread.
|
||||
|
||||
@ -2335,7 +2335,7 @@ void QObject::deleteLater()
|
||||
|
||||
If the same \a sourceText is used in different roles within the
|
||||
same context, an additional identifying string may be passed in
|
||||
\a disambiguation (0 by default). In Qt 4.4 and earlier, this was
|
||||
\a disambiguation (\nullptr by default). In Qt 4.4 and earlier, this was
|
||||
the preferred way to pass comments to translators.
|
||||
|
||||
Example:
|
||||
@ -2521,7 +2521,7 @@ QObject *QObject::sender() const
|
||||
|
||||
For signals with default parameters, this function will always return
|
||||
the index with all parameters, regardless of which was used with
|
||||
connect(). For example, the signal \c {destroyed(QObject *obj = 0)}
|
||||
connect(). For example, the signal \c {destroyed(QObject *obj = \nullptr)}
|
||||
will have two different indexes (with and without the parameter), but
|
||||
this function will always return the index with a parameter. This does
|
||||
not apply when overloading signals with different parameters.
|
||||
@ -2662,7 +2662,7 @@ bool QObject::isSignalConnected(const QMetaMethod &signal) const
|
||||
member in the specified class.
|
||||
|
||||
\list
|
||||
\li If member.mobj is 0 then both signalIndex and methodIndex are set to -1.
|
||||
\li If member.mobj is \nullptr then both signalIndex and methodIndex are set to -1.
|
||||
|
||||
\li If specified member is not a member of obj instance class (or one of
|
||||
its parent classes) then both signalIndex and methodIndex are set to -1.
|
||||
@ -2799,12 +2799,12 @@ QMetaObject::Connection QObject::connect(const QObject *sender, const char *sign
|
||||
const QObject *receiver, const char *method,
|
||||
Qt::ConnectionType type)
|
||||
{
|
||||
if (sender == 0 || receiver == 0 || signal == 0 || method == 0) {
|
||||
if (sender == nullptr || receiver == nullptr || signal == nullptr || method == nullptr) {
|
||||
qWarning("QObject::connect: Cannot connect %s::%s to %s::%s",
|
||||
sender ? sender->metaObject()->className() : "(null)",
|
||||
(signal && *signal) ? signal+1 : "(null)",
|
||||
receiver ? receiver->metaObject()->className() : "(null)",
|
||||
(method && *method) ? method+1 : "(null)");
|
||||
sender ? sender->metaObject()->className() : "(nullptr)",
|
||||
(signal && *signal) ? signal+1 : "(nullptr)",
|
||||
receiver ? receiver->metaObject()->className() : "(nullptr)",
|
||||
(method && *method) ? method+1 : "(nullptr)");
|
||||
return QMetaObject::Connection(0);
|
||||
}
|
||||
QByteArray tmp_signal_name;
|
||||
@ -2937,14 +2937,14 @@ QMetaObject::Connection QObject::connect(const QObject *sender, const QMetaMetho
|
||||
const QObject *receiver, const QMetaMethod &method,
|
||||
Qt::ConnectionType type)
|
||||
{
|
||||
if (sender == 0
|
||||
|| receiver == 0
|
||||
if (sender == nullptr
|
||||
|| receiver == nullptr
|
||||
|| signal.methodType() != QMetaMethod::Signal
|
||||
|| method.methodType() == QMetaMethod::Constructor) {
|
||||
qWarning("QObject::connect: Cannot connect %s::%s to %s::%s",
|
||||
sender ? sender->metaObject()->className() : "(null)",
|
||||
sender ? sender->metaObject()->className() : "(nullptr)",
|
||||
signal.methodSignature().constData(),
|
||||
receiver ? receiver->metaObject()->className() : "(null)",
|
||||
receiver ? receiver->metaObject()->className() : "(nullptr)",
|
||||
method.methodSignature().constData() );
|
||||
return QMetaObject::Connection(0);
|
||||
}
|
||||
@ -3046,20 +3046,20 @@ QMetaObject::Connection QObject::connect(const QObject *sender, const QMetaMetho
|
||||
|
||||
\endlist
|
||||
|
||||
0 may be used as a wildcard, meaning "any signal", "any receiving
|
||||
\nullptr may be used as a wildcard, meaning "any signal", "any receiving
|
||||
object", or "any slot in the receiving object", respectively.
|
||||
|
||||
The \a sender may never be \nullptr. (You cannot disconnect signals
|
||||
from more than one object in a single call.)
|
||||
|
||||
If \a signal is 0, it disconnects \a receiver and \a method from
|
||||
If \a signal is \nullptr, it disconnects \a receiver and \a method from
|
||||
any signal. If not, only the specified signal is disconnected.
|
||||
|
||||
If \a receiver is 0, it disconnects anything connected to \a
|
||||
If \a receiver is \nullptr, it disconnects anything connected to \a
|
||||
signal. If not, slots in objects other than \a receiver are not
|
||||
disconnected.
|
||||
|
||||
If \a method is 0, it disconnects anything that is connected to \a
|
||||
If \a method is \nullptr, it disconnects anything that is connected to \a
|
||||
receiver. If not, only slots named \a method will be disconnected,
|
||||
and all other slots are left alone. The \a method must be \nullptr
|
||||
if \a receiver is left out, so you cannot disconnect a
|
||||
@ -3070,8 +3070,8 @@ QMetaObject::Connection QObject::connect(const QObject *sender, const QMetaMetho
|
||||
bool QObject::disconnect(const QObject *sender, const char *signal,
|
||||
const QObject *receiver, const char *method)
|
||||
{
|
||||
if (sender == 0 || (receiver == 0 && method != 0)) {
|
||||
qWarning("QObject::disconnect: Unexpected null parameter");
|
||||
if (sender == nullptr || (receiver == nullptr && method != nullptr)) {
|
||||
qWarning("QObject::disconnect: Unexpected nullptr parameter");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -3197,16 +3197,16 @@ bool QObject::disconnect(const QObject *sender, const char *signal,
|
||||
\endlist
|
||||
|
||||
QMetaMethod() may be used as wildcard in the meaning "any signal" or "any slot in receiving object".
|
||||
In the same way 0 can be used for \a receiver in the meaning "any receiving object". In this case
|
||||
method should also be QMetaMethod(). \a sender parameter should be never 0.
|
||||
In the same way \nullptr can be used for \a receiver in the meaning "any receiving object".
|
||||
In this case method should also be QMetaMethod(). \a sender parameter should be never \nullptr.
|
||||
|
||||
\sa disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *method)
|
||||
*/
|
||||
bool QObject::disconnect(const QObject *sender, const QMetaMethod &signal,
|
||||
const QObject *receiver, const QMetaMethod &method)
|
||||
{
|
||||
if (sender == 0 || (receiver == 0 && method.mobj != 0)) {
|
||||
qWarning("QObject::disconnect: Unexpected null parameter");
|
||||
if (sender == nullptr || (receiver == nullptr && method.mobj != nullptr)) {
|
||||
qWarning("QObject::disconnect: Unexpected nullptr parameter");
|
||||
return false;
|
||||
}
|
||||
if (signal.mobj) {
|
||||
@ -3240,7 +3240,7 @@ bool QObject::disconnect(const QObject *sender, const QMetaMethod &signal,
|
||||
QMetaObjectPrivate::memberIndexes(sender, signal, &signal_index, &dummy);
|
||||
QMetaObjectPrivate::memberIndexes(receiver, method, &dummy, &method_index);
|
||||
}
|
||||
// If we are here sender is not null. If signal is not null while signal_index
|
||||
// If we are here sender is not nullptr. If signal is not nullptr while signal_index
|
||||
// is -1 then this signal is not a member of sender.
|
||||
if (signal.mobj && signal_index == -1) {
|
||||
qWarning("QObject::disconect: signal %s not found on class %s",
|
||||
@ -3329,7 +3329,7 @@ void QObject::connectNotify(const QMetaMethod &signal)
|
||||
\a signal with a specific signal.
|
||||
|
||||
If all signals were disconnected from this object (e.g., the
|
||||
signal argument to disconnect() was 0), disconnectNotify()
|
||||
signal argument to disconnect() was \nullptr), disconnectNotify()
|
||||
is only called once, and the \a signal will be an invalid
|
||||
QMetaMethod (QMetaMethod::isValid() returns \c false).
|
||||
|
||||
@ -4929,7 +4929,7 @@ void qDeleteInEventHandler(QObject *o)
|
||||
|
||||
\a sender is the sender object
|
||||
\a signal is a pointer to a pointer to a member signal of the sender
|
||||
\a receiver is the receiver object, may not be null, will be equal to sender when
|
||||
\a receiver is the receiver object, may not be \nullptr, will be equal to sender when
|
||||
connecting to a static function or a functor
|
||||
\a slot a pointer only used when using Qt::UniqueConnection
|
||||
\a type the Qt::ConnctionType passed as argument to connect
|
||||
@ -4937,7 +4937,7 @@ void qDeleteInEventHandler(QObject *o)
|
||||
to be used with queued connection
|
||||
must stay valid at least for the whole time of the connection, this function
|
||||
do not take ownership. typically static data.
|
||||
If null, then the types will be computed when the signal is emit in a queued
|
||||
If \nullptr, then the types will be computed when the signal is emit in a queued
|
||||
connection from the types from the signature.
|
||||
\a senderMetaObject is the metaobject used to lookup the signal, the signal must be in
|
||||
this metaobject
|
||||
@ -4948,7 +4948,7 @@ QMetaObject::Connection QObject::connectImpl(const QObject *sender, void **signa
|
||||
const int *types, const QMetaObject *senderMetaObject)
|
||||
{
|
||||
if (!signal) {
|
||||
qWarning("QObject::connect: invalid null parameter");
|
||||
qWarning("QObject::connect: invalid nullptr parameter");
|
||||
if (slotObj)
|
||||
slotObj->destroyIfLastRef();
|
||||
return QMetaObject::Connection();
|
||||
@ -4988,7 +4988,7 @@ QMetaObject::Connection QObjectPrivate::connectImpl(const QObject *sender, int s
|
||||
: "Unknown";
|
||||
const char *receiverString = receiver ? receiver->metaObject()->className()
|
||||
: "Unknown";
|
||||
qWarning("QObject::connect(%s, %s): invalid null parameter", senderString, receiverString);
|
||||
qWarning("QObject::connect(%s, %s): invalid nullptr parameter", senderString, receiverString);
|
||||
if (slotObj)
|
||||
slotObj->destroyIfLastRef();
|
||||
return QMetaObject::Connection();
|
||||
@ -5121,20 +5121,20 @@ bool QObject::disconnect(const QMetaObject::Connection &connection)
|
||||
|
||||
\endlist
|
||||
|
||||
0 may be used as a wildcard, meaning "any signal", "any receiving
|
||||
\nullptr may be used as a wildcard, meaning "any signal", "any receiving
|
||||
object", or "any slot in the receiving object", respectively.
|
||||
|
||||
The \a sender may never be \nullptr. (You cannot disconnect signals
|
||||
from more than one object in a single call.)
|
||||
|
||||
If \a signal is 0, it disconnects \a receiver and \a method from
|
||||
If \a signal is \nullptr, it disconnects \a receiver and \a method from
|
||||
any signal. If not, only the specified signal is disconnected.
|
||||
|
||||
If \a receiver is 0, it disconnects anything connected to \a
|
||||
If \a receiver is \nullptr, it disconnects anything connected to \a
|
||||
signal. If not, slots in objects other than \a receiver are not
|
||||
disconnected.
|
||||
|
||||
If \a method is 0, it disconnects anything that is connected to \a
|
||||
If \a method is \nullptr, it disconnects anything that is connected to \a
|
||||
receiver. If not, only slots named \a method will be disconnected,
|
||||
and all other slots are left alone. The \a method must be \nullptr
|
||||
if \a receiver is left out, so you cannot disconnect a
|
||||
@ -5150,8 +5150,8 @@ bool QObject::disconnect(const QMetaObject::Connection &connection)
|
||||
|
||||
bool QObject::disconnectImpl(const QObject *sender, void **signal, const QObject *receiver, void **slot, const QMetaObject *senderMetaObject)
|
||||
{
|
||||
if (sender == 0 || (receiver == 0 && slot != 0)) {
|
||||
qWarning("QObject::disconnect: Unexpected null parameter");
|
||||
if (sender == nullptr || (receiver == nullptr && slot != nullptr)) {
|
||||
qWarning("QObject::disconnect: Unexpected nullptr parameter");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -5182,7 +5182,7 @@ bool QObject::disconnectImpl(const QObject *sender, void **signal, const QObject
|
||||
QMetaObject::Connection QObjectPrivate::connect(const QObject *sender, int signal_index, QtPrivate::QSlotObjectBase *slotObj, Qt::ConnectionType type)
|
||||
{
|
||||
if (!sender) {
|
||||
qWarning("QObject::connect: invalid null parameter");
|
||||
qWarning("QObject::connect: invalid nullptr parameter");
|
||||
if (slotObj)
|
||||
slotObj->destroyIfLastRef();
|
||||
return QMetaObject::Connection();
|
||||
|
@ -320,9 +320,9 @@ private:
|
||||
return Type(quint8(st) | SimpleType);
|
||||
}
|
||||
|
||||
Q_DECL_CONSTEXPR static bool isTag_helper(Type t)
|
||||
Q_DECL_CONSTEXPR static bool isTag_helper(Type tt)
|
||||
{
|
||||
return t == Tag || t >= 0x10000;
|
||||
return tt == Tag || tt >= 0x10000;
|
||||
}
|
||||
};
|
||||
Q_DECLARE_SHARED(QCborValue)
|
||||
|
@ -1,6 +1,6 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2019 The Qt Company Ltd.
|
||||
** Copyright (C) 2020 The Qt Company Ltd.
|
||||
** Copyright (C) 2019 Intel Corporation.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
@ -651,7 +651,6 @@ int qt_repeatCount(QStringView s)
|
||||
}
|
||||
|
||||
static const QLocaleData *default_data = nullptr;
|
||||
static QLocale::NumberOptions default_number_options = QLocale::DefaultNumberOptions;
|
||||
|
||||
static const QLocaleData *const c_data = locale_data;
|
||||
static QLocalePrivate *c_private()
|
||||
@ -834,7 +833,7 @@ QDataStream &operator>>(QDataStream &ds, QLocale &l)
|
||||
static const int locale_data_size = sizeof(locale_data)/sizeof(QLocaleData) - 1;
|
||||
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(QSharedDataPointer<QLocalePrivate>, defaultLocalePrivate,
|
||||
(QLocalePrivate::create(defaultData(), default_number_options)))
|
||||
(QLocalePrivate::create(defaultData())))
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(QExplicitlySharedDataPointer<QLocalePrivate>, systemLocalePrivate,
|
||||
(QLocalePrivate::create(systemData())))
|
||||
|
||||
@ -862,8 +861,9 @@ static QLocalePrivate *findLocalePrivate(QLocale::Language language, QLocale::Sc
|
||||
QLocale::NumberOptions numberOptions = QLocale::DefaultNumberOptions;
|
||||
|
||||
// If not found, should default to system
|
||||
if (data->m_language_id == QLocale::C && language != QLocale::C) {
|
||||
numberOptions = default_number_options;
|
||||
if (data->m_language_id == QLocale::C) {
|
||||
if (defaultLocalePrivate.exists())
|
||||
numberOptions = defaultLocalePrivate->data()->m_numberOptions;
|
||||
data = defaultData();
|
||||
}
|
||||
return QLocalePrivate::create(data, offset, numberOptions);
|
||||
@ -1048,6 +1048,8 @@ uint qHash(const QLocale &key, uint seed) noexcept
|
||||
|
||||
Sets the \a options related to number conversions for this
|
||||
QLocale instance.
|
||||
|
||||
\sa numberOptions()
|
||||
*/
|
||||
void QLocale::setNumberOptions(NumberOptions options)
|
||||
{
|
||||
@ -1060,7 +1062,10 @@ void QLocale::setNumberOptions(NumberOptions options)
|
||||
Returns the options related to number conversions for this
|
||||
QLocale instance.
|
||||
|
||||
By default, no options are set for the standard locales.
|
||||
By default, no options are set for the standard locales, except
|
||||
for the "C" locale, which has OmitGroupSeparator set by default.
|
||||
|
||||
\sa setNumberOptions(), toString(), groupSeparator()
|
||||
*/
|
||||
QLocale::NumberOptions QLocale::numberOptions() const
|
||||
{
|
||||
@ -1170,12 +1175,9 @@ QString QLocale::createSeparatedList(const QStringList &list) const
|
||||
void QLocale::setDefault(const QLocale &locale)
|
||||
{
|
||||
default_data = locale.d->m_data;
|
||||
default_number_options = locale.numberOptions();
|
||||
|
||||
if (defaultLocalePrivate.exists()) {
|
||||
// update the cached private
|
||||
if (defaultLocalePrivate.exists()) // update the cached private
|
||||
*defaultLocalePrivate = locale.d;
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -1962,7 +1964,7 @@ double QLocale::toDouble(QStringView s, bool *ok) const
|
||||
/*!
|
||||
Returns a localized string representation of \a i.
|
||||
|
||||
\sa toLongLong()
|
||||
\sa toLongLong(), numberOptions(), zeroDigit(), positiveSign()
|
||||
*/
|
||||
|
||||
QString QLocale::toString(qlonglong i) const
|
||||
@ -1978,7 +1980,7 @@ QString QLocale::toString(qlonglong i) const
|
||||
/*!
|
||||
\overload
|
||||
|
||||
\sa toULongLong()
|
||||
\sa toULongLong(), numberOptions(), zeroDigit(), positiveSign()
|
||||
*/
|
||||
|
||||
QString QLocale::toString(qulonglong i) const
|
||||
@ -2525,6 +2527,12 @@ QDateTime QLocale::toDateTime(const QString &string, const QString &format, QCal
|
||||
\since 4.1
|
||||
|
||||
Returns the decimal point character of this locale.
|
||||
|
||||
\note This function shall change to return a QString instead of QChar in
|
||||
Qt6. Callers are encouraged to exploit the QString(QChar) constructor to
|
||||
convert early in preparation for this.
|
||||
|
||||
\sa groupSeparator(), toString()
|
||||
*/
|
||||
QChar QLocale::decimalPoint() const
|
||||
{
|
||||
@ -2535,6 +2543,12 @@ QChar QLocale::decimalPoint() const
|
||||
\since 4.1
|
||||
|
||||
Returns the group separator character of this locale.
|
||||
|
||||
\note This function shall change to return a QString instead of QChar in
|
||||
Qt6. Callers are encouraged to exploit the QString(QChar) constructor to
|
||||
convert early in preparation for this.
|
||||
|
||||
\sa decimalPoint(), toString()
|
||||
*/
|
||||
QChar QLocale::groupSeparator() const
|
||||
{
|
||||
@ -2545,6 +2559,12 @@ QChar QLocale::groupSeparator() const
|
||||
\since 4.1
|
||||
|
||||
Returns the percent character of this locale.
|
||||
|
||||
\note This function shall change to return a QString instead of QChar in
|
||||
Qt6. Callers are encouraged to exploit the QString(QChar) constructor to
|
||||
convert early in preparation for this.
|
||||
|
||||
\sa toString()
|
||||
*/
|
||||
QChar QLocale::percent() const
|
||||
{
|
||||
@ -2555,6 +2575,12 @@ QChar QLocale::percent() const
|
||||
\since 4.1
|
||||
|
||||
Returns the zero digit character of this locale.
|
||||
|
||||
\note This function shall change to return a QString instead of QChar in
|
||||
Qt6. Callers are encouraged to exploit the QString(QChar) constructor to
|
||||
convert early in preparation for this.
|
||||
|
||||
\sa toString()
|
||||
*/
|
||||
QChar QLocale::zeroDigit() const
|
||||
{
|
||||
@ -2565,6 +2591,12 @@ QChar QLocale::zeroDigit() const
|
||||
\since 4.1
|
||||
|
||||
Returns the negative sign character of this locale.
|
||||
|
||||
\note This function shall change to return a QString instead of QChar in
|
||||
Qt6. Callers are encouraged to exploit the QString(QChar) constructor to
|
||||
convert early in preparation for this.
|
||||
|
||||
\sa positiveSign(), toString()
|
||||
*/
|
||||
QChar QLocale::negativeSign() const
|
||||
{
|
||||
@ -2575,6 +2607,12 @@ QChar QLocale::negativeSign() const
|
||||
\since 4.5
|
||||
|
||||
Returns the positive sign character of this locale.
|
||||
|
||||
\note This function shall change to return a QString instead of QChar in
|
||||
Qt6. Callers are encouraged to exploit the QString(QChar) constructor to
|
||||
convert early in preparation for this.
|
||||
|
||||
\sa negativeSign(), toString()
|
||||
*/
|
||||
QChar QLocale::positiveSign() const
|
||||
{
|
||||
@ -2584,7 +2622,14 @@ QChar QLocale::positiveSign() const
|
||||
/*!
|
||||
\since 4.1
|
||||
|
||||
Returns the exponential character of this locale.
|
||||
Returns the exponential character of this locale, used to separate exponent
|
||||
from mantissa in some floating-point numeric representations.
|
||||
|
||||
\note This function shall change to return a QString instead of QChar in
|
||||
Qt6. Callers are encouraged to exploit the QString(QChar) constructor to
|
||||
convert early in preparation for this.
|
||||
|
||||
\sa toString(double, char, int)
|
||||
*/
|
||||
QChar QLocale::exponential() const
|
||||
{
|
||||
@ -2609,7 +2654,7 @@ static char qToLower(char c)
|
||||
|
||||
\a f and \a prec have the same meaning as in QString::number(double, char, int).
|
||||
|
||||
\sa toDouble()
|
||||
\sa toDouble(), numberOptions(), exponential(), decimalPoint(), zeroDigit(), positiveSign(), percent()
|
||||
*/
|
||||
|
||||
QString QLocale::toString(double i, char f, int prec) const
|
||||
|
@ -1,6 +1,6 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2019 The Qt Company Ltd.
|
||||
** Copyright (C) 2020 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the QtCore module of the Qt Toolkit.
|
||||
@ -1044,8 +1044,8 @@ public:
|
||||
QDateTime toDateTime(const QString &string, const QString &format, QCalendar cal) const;
|
||||
#endif
|
||||
|
||||
// ### Qt 5: We need to return QString from these function since
|
||||
// unicode data contains several characters for these fields.
|
||||
// ### Qt 6: We need to return QString from these function since
|
||||
// UTF-16 may need surrogate pairs to represent these fields.
|
||||
QChar decimalPoint() const;
|
||||
QChar groupSeparator() const;
|
||||
QChar percent() const;
|
||||
|
@ -1,6 +1,6 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** Copyright (C) 2020 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the QtCore module of the Qt Toolkit.
|
||||
@ -67,16 +67,16 @@ static QByteArray envVarLocale()
|
||||
return lang;
|
||||
}
|
||||
|
||||
static QByteArray getMacLocaleName()
|
||||
static QString getMacLocaleName()
|
||||
{
|
||||
QByteArray result = envVarLocale();
|
||||
QString result = QString::fromLocal8Bit(envVarLocale());
|
||||
|
||||
QString lang, script, cntry;
|
||||
if (result.isEmpty()
|
||||
|| (result != "C" && !qt_splitLocaleName(QString::fromLocal8Bit(result), lang, script, cntry))) {
|
||||
|| (result != QLatin1String("C") && !qt_splitLocaleName(result, lang, script, cntry))) {
|
||||
QCFType<CFLocaleRef> l = CFLocaleCopyCurrent();
|
||||
CFStringRef locale = CFLocaleGetIdentifier(l);
|
||||
result = QString::fromCFString(locale).toUtf8();
|
||||
result = QString::fromCFString(locale);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -402,10 +402,10 @@ static QVariant macQuoteString(QSystemLocale::QueryType type, const QStringRef &
|
||||
|
||||
QLocale QSystemLocale::fallbackUiLocale() const
|
||||
{
|
||||
return QLocale(QString::fromUtf8(getMacLocaleName().constData()));
|
||||
return QLocale(getMacLocaleName());
|
||||
}
|
||||
|
||||
QVariant QSystemLocale::query(QueryType type, QVariant in = QVariant()) const
|
||||
QVariant QSystemLocale::query(QueryType type, QVariant in) const
|
||||
{
|
||||
QMacAutoReleasePool pool;
|
||||
switch(type) {
|
||||
|
@ -463,10 +463,10 @@ QT_BEGIN_NAMESPACE
|
||||
\c{\xHHHH} with more than 2 digits. A pattern like \c{\x2022} neeeds to
|
||||
be ported to \c{\x{2022}}, or it will match a space (\c{0x20}) followed
|
||||
by the string \c{"22"}. In general, it is highly recommended to always use
|
||||
curly braces with the \c{\\x} escape, no matter the amount of digits
|
||||
curly braces with the \c{\x} escape, no matter the amount of digits
|
||||
specified.
|
||||
|
||||
\li A 0-to-n quantification like \c{{,n}} needs to be ported to c{{0,n}} to
|
||||
\li A 0-to-n quantification like \c{{,n}} needs to be ported to \c{{0,n}} to
|
||||
preserve semantics. Otherwise, a pattern such as \c{\d{,3}} would
|
||||
actually match a digit followed by the exact string \c{"{,3}"}.
|
||||
|
||||
|
@ -915,7 +915,7 @@ static int ucstrncmp(const QChar *a, const QChar *b, size_t l)
|
||||
};
|
||||
|
||||
// we're going to read a[0..15] and b[0..15] (32 bytes)
|
||||
for ( ; a + offset + 16 <= end; offset += 16) {
|
||||
for ( ; end - a >= offset + 16; offset += 16) {
|
||||
#ifdef __AVX2__
|
||||
__m256i a_data = _mm256_loadu_si256(reinterpret_cast<const __m256i *>(a + offset));
|
||||
__m256i b_data = _mm256_loadu_si256(reinterpret_cast<const __m256i *>(b + offset));
|
||||
@ -939,7 +939,7 @@ static int ucstrncmp(const QChar *a, const QChar *b, size_t l)
|
||||
}
|
||||
|
||||
// we're going to read a[0..7] and b[0..7] (16 bytes)
|
||||
if (a + offset + 8 <= end) {
|
||||
if (end - a >= offset + 8) {
|
||||
__m128i a_data = _mm_loadu_si128(reinterpret_cast<const __m128i *>(a + offset));
|
||||
__m128i b_data = _mm_loadu_si128(reinterpret_cast<const __m128i *>(b + offset));
|
||||
if (isDifferent(a_data, b_data))
|
||||
@ -949,7 +949,7 @@ static int ucstrncmp(const QChar *a, const QChar *b, size_t l)
|
||||
}
|
||||
|
||||
// we're going to read a[0..3] and b[0..3] (8 bytes)
|
||||
if (a + offset + 4 <= end) {
|
||||
if (end - a >= offset + 4) {
|
||||
__m128i a_data = _mm_loadl_epi64(reinterpret_cast<const __m128i *>(a + offset));
|
||||
__m128i b_data = _mm_loadl_epi64(reinterpret_cast<const __m128i *>(b + offset));
|
||||
if (isDifferent(a_data, b_data))
|
||||
@ -970,7 +970,7 @@ static int ucstrncmp(const QChar *a, const QChar *b, size_t l)
|
||||
if (l >= 8) {
|
||||
const QChar *end = a + l;
|
||||
const uint16x8_t mask = { 1, 1 << 1, 1 << 2, 1 << 3, 1 << 4, 1 << 5, 1 << 6, 1 << 7 };
|
||||
while (a + 7 < end) {
|
||||
while (end - a > 7) {
|
||||
uint16x8_t da = vld1q_u16(reinterpret_cast<const uint16_t *>(a));
|
||||
uint16x8_t db = vld1q_u16(reinterpret_cast<const uint16_t *>(b));
|
||||
|
||||
@ -5109,21 +5109,25 @@ bool QString::endsWith(QChar c, Qt::CaseSensitivity cs) const
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns \c true if the string only contains uppercase letters,
|
||||
otherwise returns \c false.
|
||||
Returns \c true if the string is uppercase, that is, it's identical
|
||||
to its toUpper() folding.
|
||||
|
||||
Note that this does \e not mean that the string does not contain
|
||||
lowercase letters (some lowercase letters do not have a uppercase
|
||||
folding; they are left unchanged by toUpper()).
|
||||
For more information, refer to the Unicode standard, section 3.13.
|
||||
|
||||
\since 5.12
|
||||
|
||||
\sa QChar::isUpper(), isLower()
|
||||
\sa QChar::toUpper(), isLower()
|
||||
*/
|
||||
bool QString::isUpper() const
|
||||
{
|
||||
if (isEmpty())
|
||||
return false;
|
||||
QStringIterator it(*this);
|
||||
|
||||
const QChar *d = data();
|
||||
|
||||
for (int i = 0, max = size(); i < max; ++i) {
|
||||
if (!d[i].isUpper())
|
||||
while (it.hasNext()) {
|
||||
uint uc = it.nextUnchecked();
|
||||
if (qGetProp(uc)->cases[QUnicodeTables::UpperCase].diff)
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -5131,21 +5135,25 @@ bool QString::isUpper() const
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns \c true if the string only contains lowercase letters,
|
||||
otherwise returns \c false.
|
||||
Returns \c true if the string is lowercase, that is, it's identical
|
||||
to its toLower() folding.
|
||||
|
||||
Note that this does \e not mean that the string does not contain
|
||||
uppercase letters (some uppercase letters do not have a lowercase
|
||||
folding; they are left unchanged by toLower()).
|
||||
For more information, refer to the Unicode standard, section 3.13.
|
||||
|
||||
\since 5.12
|
||||
|
||||
\sa QChar::isLower(), isUpper()
|
||||
\sa QChar::toLower(), isUpper()
|
||||
*/
|
||||
bool QString::isLower() const
|
||||
{
|
||||
if (isEmpty())
|
||||
return false;
|
||||
QStringIterator it(*this);
|
||||
|
||||
const QChar *d = data();
|
||||
|
||||
for (int i = 0, max = size(); i < max; ++i) {
|
||||
if (!d[i].isLower())
|
||||
while (it.hasNext()) {
|
||||
uint uc = it.nextUnchecked();
|
||||
if (qGetProp(uc)->cases[QUnicodeTables::LowerCase].diff)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -137,13 +137,12 @@ bool QDateTimeParser::setDigit(QDateTime &v, int index, int newVal) const
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
const SectionNode &node = sectionNodes.at(index);
|
||||
|
||||
const QDate date = v.date();
|
||||
QCalendar::YearMonthDay date = calendar.partsFromDate(v.date());
|
||||
if (!date.isValid())
|
||||
return false;
|
||||
|
||||
const QTime time = v.time();
|
||||
int year = date.year(calendar);
|
||||
int month = date.month(calendar);
|
||||
int day = date.day(calendar);
|
||||
int hour = time.hour();
|
||||
int minute = time.minute();
|
||||
int second = time.second();
|
||||
@ -152,14 +151,15 @@ bool QDateTimeParser::setDigit(QDateTime &v, int index, int newVal) const
|
||||
// Only offset from UTC is amenable to setting an int value:
|
||||
int offset = tspec == Qt::OffsetFromUTC ? v.offsetFromUtc() : 0;
|
||||
|
||||
const SectionNode &node = sectionNodes.at(index);
|
||||
switch (node.type) {
|
||||
case Hour24Section: case Hour12Section: hour = newVal; break;
|
||||
case MinuteSection: minute = newVal; break;
|
||||
case SecondSection: second = newVal; break;
|
||||
case MSecSection: msec = newVal; break;
|
||||
case YearSection2Digits:
|
||||
case YearSection: year = newVal; break;
|
||||
case MonthSection: month = newVal; break;
|
||||
case YearSection: date.year = newVal; break;
|
||||
case MonthSection: date.month = newVal; break;
|
||||
case DaySection:
|
||||
case DayOfWeekSectionShort:
|
||||
case DayOfWeekSectionLong:
|
||||
@ -169,7 +169,7 @@ bool QDateTimeParser::setDigit(QDateTime &v, int index, int newVal) const
|
||||
// to 31 for february should return true
|
||||
return false;
|
||||
}
|
||||
day = newVal;
|
||||
date.day = newVal;
|
||||
break;
|
||||
case TimeZoneSection:
|
||||
if (newVal < absoluteMin(index) || newVal > absoluteMax(index))
|
||||
@ -185,15 +185,14 @@ bool QDateTimeParser::setDigit(QDateTime &v, int index, int newVal) const
|
||||
}
|
||||
|
||||
if (!(node.type & DaySectionMask)) {
|
||||
if (day < cachedDay)
|
||||
day = cachedDay;
|
||||
const int max = calendar.daysInMonth(month, year);
|
||||
if (day > max) {
|
||||
day = max;
|
||||
}
|
||||
if (date.day < cachedDay)
|
||||
date.day = cachedDay;
|
||||
const int max = calendar.daysInMonth(date.month, date.year);
|
||||
if (date.day > max)
|
||||
date.day = max;
|
||||
}
|
||||
|
||||
const QDate newDate(year, month, day, calendar);
|
||||
const QDate newDate = calendar.dateFromParts(date);
|
||||
const QTime newTime(hour, minute, second, msec);
|
||||
if (!newDate.isValid() || !newTime.isValid())
|
||||
return false;
|
||||
|
@ -374,7 +374,7 @@ QDataStream &operator>>(QDataStream &stream, QLine &line)
|
||||
*/
|
||||
|
||||
/*!
|
||||
\enum QLineF::IntersectionType
|
||||
\enum QLineF::IntersectType
|
||||
|
||||
Describes the intersection between two lines.
|
||||
|
||||
|
@ -51,10 +51,10 @@ QT_BEGIN_NAMESPACE
|
||||
of the scope.
|
||||
\ingroup misc
|
||||
|
||||
QScopeGuard<F> is a class which sole purpose is to run a function \e F in
|
||||
its destructor. This is useful for guaranteeing your cleanup code is
|
||||
executed, whether the function is exited normally, exited early by a return
|
||||
statement, or exited by an exception.
|
||||
QScopeGuard<F> is a class of which the sole purpose is to run the function
|
||||
\a f in its destructor. This is useful for guaranteeing
|
||||
your cleanup code is executed, whether the function is exited normally,
|
||||
exited early by a return statement, or exited by an exception.
|
||||
|
||||
If \e F is a lambda then you cannot instantiate the template directly,
|
||||
therefore the qScopeGuard() helper is provided and QScopeGuard<F> is made a
|
||||
|
@ -1285,6 +1285,8 @@
|
||||
\relates QSharedPointer
|
||||
\since 5.14
|
||||
|
||||
Returns a shared pointer to the pointer held by \a src.
|
||||
|
||||
Same as qSharedPointerObjectCast(). This function is provided for STL
|
||||
compatibility.
|
||||
*/
|
||||
|
@ -667,9 +667,9 @@ QHoverEvent::~QHoverEvent()
|
||||
if that widget does not handle the event they are sent to the
|
||||
focus widget. Wheel events are generated for both mouse wheels
|
||||
and trackpad scroll gestures. There are two ways to read the
|
||||
wheel event delta: angleDelta() returns the delta in wheel
|
||||
degrees. This value is always provided. pixelDelta() returns
|
||||
the delta in screen pixels and is available on platforms that
|
||||
wheel event delta: angleDelta() returns the deltas in wheel
|
||||
degrees. These values are always provided. pixelDelta() returns
|
||||
the deltas in screen pixels, and is available on platforms that
|
||||
have high-resolution trackpads, such as \macos. If that is the
|
||||
case, source() will return Qt::MouseEventSynthesizedBySystem.
|
||||
|
||||
@ -852,7 +852,7 @@ QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos,
|
||||
by \a globalPos.
|
||||
|
||||
\a pixelDelta contains the scrolling distance in pixels on screen, while
|
||||
\a angleDelta contains the wheel rotation distance. \a pixelDelta is
|
||||
\a angleDelta contains the wheel rotation angle. \a pixelDelta is
|
||||
optional and can be null.
|
||||
|
||||
The mouse and keyboard states at the time of the event are specified by
|
||||
@ -914,10 +914,16 @@ QWheelEvent::~QWheelEvent()
|
||||
/*!
|
||||
\fn QPoint QWheelEvent::angleDelta() const
|
||||
|
||||
Returns the distance that the wheel is rotated, in eighths of a
|
||||
degree. A positive value indicates that the wheel was rotated
|
||||
forwards away from the user; a negative value indicates that the
|
||||
wheel was rotated backwards toward the user.
|
||||
Returns the relative amount that the wheel was rotated, in eighths of a
|
||||
degree. A positive value indicates that the wheel was rotated forwards away
|
||||
from the user; a negative value indicates that the wheel was rotated
|
||||
backwards toward the user. \c angleDelta().y() provides the angle through
|
||||
which the common vertical mouse wheel was rotated since the previous event.
|
||||
\c angleDelta().x() provides the angle through which the horizontal mouse
|
||||
wheel was rotated, if the mouse has a horizontal wheel; otherwise it stays
|
||||
at zero. Some mice allow the user to tilt the wheel to perform horizontal
|
||||
scrolling, and some touchpads support a horizontal scrolling gesture; that
|
||||
will also appear in \c angleDelta().x().
|
||||
|
||||
Most mouse types work in steps of 15 degrees, in which case the
|
||||
delta value is a multiple of 120; i.e., 120 units * 1/8 = 15 degrees.
|
||||
@ -926,7 +932,9 @@ QWheelEvent::~QWheelEvent()
|
||||
that are less than 120 units (less than 15 degrees). To support this
|
||||
possibility, you can either cumulatively add the delta values from events
|
||||
until the value of 120 is reached, then scroll the widget, or you can
|
||||
partially scroll the widget in response to each wheel event.
|
||||
partially scroll the widget in response to each wheel event. But to
|
||||
provide a more native feel, you should prefer \l pixelDelta() on platforms
|
||||
where it's available.
|
||||
|
||||
Example:
|
||||
|
||||
@ -937,6 +945,8 @@ QWheelEvent::~QWheelEvent()
|
||||
\li scrolling is about to begin, but the distance did not yet change (Qt::ScrollBegin),
|
||||
\li or scrolling has ended and the distance did not change anymore (Qt::ScrollEnd).
|
||||
\endlist
|
||||
|
||||
\see pixelDelta()
|
||||
*/
|
||||
|
||||
/*!
|
||||
|
@ -605,8 +605,13 @@ static QWindowGeometrySpecification windowGeometrySpecification = Q_WINDOW_GEOME
|
||||
The following parameters are available for \c {-platform windows}:
|
||||
|
||||
\list
|
||||
\li \c {altgr}, detect the key \c {AltGr} found on some keyboards as
|
||||
Qt::GroupSwitchModifier (since Qt 5.12).
|
||||
\li \c {dialogs=[xp|none]}, \c xp uses XP-style native dialogs and
|
||||
\c none disables them.
|
||||
|
||||
\li \c {dpiawareness=[0|1|2} Sets the DPI awareness of the process
|
||||
(see \l{High DPI Displays}, since Qt 5.4).
|
||||
\li \c {fontengine=freetype}, uses the FreeType font engine.
|
||||
\li \c {menus=[native|none]}, controls the use of native menus.
|
||||
|
||||
@ -616,10 +621,23 @@ static QWindowGeometrySpecification windowGeometrySpecification = Q_WINDOW_GEOME
|
||||
provide hover signals. They are mainly intended for Qt Quick.
|
||||
By default, they will be used if the application is not an
|
||||
instance of QApplication or for Qt Quick Controls 2
|
||||
applications.
|
||||
applications (since Qt 5.10).
|
||||
|
||||
\li \c {altgr}, detect the key \c {AltGr} found on some keyboards as
|
||||
Qt::GroupSwitchModifier.
|
||||
\li \c {nocolorfonts} Turn off DirectWrite Color fonts
|
||||
(since Qt 5.8).
|
||||
|
||||
\li \c {nodirectwrite} Turn off DirectWrite fonts (since Qt 5.8).
|
||||
|
||||
\li \c {nomousefromtouch} Ignores mouse events synthesized
|
||||
from touch events by the operating system.
|
||||
|
||||
\li \c {nowmpointer} Switches from Pointer Input Messages handling
|
||||
to legacy mouse handling (since Qt 5.12).
|
||||
\li \c {reverse} Activates Right-to-left mode (experimental).
|
||||
Windows title bars will be shown accordingly in Right-to-left locales
|
||||
(since Qt 5.13).
|
||||
\li \c {tabletabsoluterange=<value>} Sets a value for mouse mode detection
|
||||
of WinTab tablets (Legacy, since Qt 5.3).
|
||||
\endlist
|
||||
|
||||
The following parameter is available for \c {-platform cocoa} (on macOS):
|
||||
@ -3293,12 +3311,8 @@ QPalette QGuiApplication::palette()
|
||||
*/
|
||||
void QGuiApplication::setPalette(const QPalette &pal)
|
||||
{
|
||||
if (QGuiApplicationPrivate::app_pal && pal.isCopyOf(*QGuiApplicationPrivate::app_pal))
|
||||
if (!QGuiApplicationPrivate::setPalette(pal))
|
||||
return;
|
||||
if (!QGuiApplicationPrivate::app_pal)
|
||||
QGuiApplicationPrivate::app_pal = new QPalette(pal);
|
||||
else
|
||||
*QGuiApplicationPrivate::app_pal = pal;
|
||||
|
||||
QCoreApplication::setAttribute(Qt::AA_SetPalette);
|
||||
|
||||
@ -3306,6 +3320,19 @@ void QGuiApplication::setPalette(const QPalette &pal)
|
||||
qGuiApp->d_func()->sendApplicationPaletteChange();
|
||||
}
|
||||
|
||||
bool QGuiApplicationPrivate::setPalette(const QPalette &palette)
|
||||
{
|
||||
if (app_pal && palette.isCopyOf(*app_pal))
|
||||
return false;
|
||||
|
||||
if (!app_pal)
|
||||
app_pal = new QPalette(palette);
|
||||
else
|
||||
*app_pal = palette;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void QGuiApplicationPrivate::applyWindowGeometrySpecificationTo(QWindow *window)
|
||||
{
|
||||
windowGeometrySpecification.applyTo(window);
|
||||
|
@ -323,6 +323,8 @@ public:
|
||||
|
||||
static void resetCachedDevicePixelRatio();
|
||||
|
||||
static bool setPalette(const QPalette &palette);
|
||||
|
||||
protected:
|
||||
virtual void notifyThemeChanged();
|
||||
virtual void sendApplicationPaletteChange(bool toAllWidgets = false, const char *className = nullptr);
|
||||
|
@ -69,7 +69,7 @@ public:
|
||||
int deviceCount(QInputDeviceManager::DeviceType type) const;
|
||||
void setDeviceCount(QInputDeviceManager::DeviceType type, int count);
|
||||
|
||||
std::array<int, QInputDeviceManager::NumDeviceTypes> m_deviceCount;
|
||||
std::array<int, QInputDeviceManager::NumDeviceTypes> m_deviceCount = {};
|
||||
|
||||
Qt::KeyboardModifiers keyboardModifiers;
|
||||
};
|
||||
|
@ -1330,6 +1330,7 @@ void QOpenGL2PaintEngineExPrivate::drawVertexArrays(const float *data, int *stop
|
||||
QOpenGL2PaintEngineEx::QOpenGL2PaintEngineEx()
|
||||
: QPaintEngineEx(*(new QOpenGL2PaintEngineExPrivate(this)))
|
||||
{
|
||||
gccaps &= ~QPaintEngine::RasterOpModes;
|
||||
}
|
||||
|
||||
QOpenGL2PaintEngineEx::~QOpenGL2PaintEngineEx()
|
||||
|
@ -207,7 +207,12 @@ int QTextMarkdownImporter::cbEnterBlock(int blockType, void *det)
|
||||
charFmt.setFontWeight(QFont::Bold);
|
||||
blockFmt.setHeadingLevel(int(detail->level));
|
||||
m_needsInsertBlock = false;
|
||||
m_cursor->insertBlock(blockFmt, charFmt);
|
||||
if (m_doc->isEmpty()) {
|
||||
m_cursor->setBlockFormat(blockFmt);
|
||||
m_cursor->setCharFormat(charFmt);
|
||||
} else {
|
||||
m_cursor->insertBlock(blockFmt, charFmt);
|
||||
}
|
||||
qCDebug(lcMD, "H%d", detail->level);
|
||||
} break;
|
||||
case MD_BLOCK_LI: {
|
||||
@ -592,7 +597,12 @@ void QTextMarkdownImporter::insertBlock()
|
||||
blockFormat.setMarker(m_markerType);
|
||||
if (!m_listStack.isEmpty())
|
||||
blockFormat.setIndent(m_listStack.count());
|
||||
m_cursor->insertBlock(blockFormat, charFormat);
|
||||
if (m_doc->isEmpty()) {
|
||||
m_cursor->setBlockFormat(blockFormat);
|
||||
m_cursor->setCharFormat(charFormat);
|
||||
} else {
|
||||
m_cursor->insertBlock(blockFormat, charFormat);
|
||||
}
|
||||
if (m_needsInsertList) {
|
||||
m_listStack.push(m_cursor->createList(m_listFormat));
|
||||
} else if (!m_listStack.isEmpty() && m_listItem) {
|
||||
|
@ -62,6 +62,9 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
// Clang does not consider __declspec(nothrow) as nothrow
|
||||
QT_WARNING_DISABLE_CLANG("-Wmicrosoft-exception-spec")
|
||||
|
||||
// Convert from design units to logical pixels
|
||||
#define DESIGN_TO_LOGICAL(DESIGN_UNIT_VALUE) \
|
||||
QFixed::fromReal((qreal(DESIGN_UNIT_VALUE) / qreal(m_unitsPerEm)) * fontDef.pixelSize)
|
||||
|
@ -38,6 +38,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include "qlibinputtouch_p.h"
|
||||
#include "qtouchoutputmapping_p.h"
|
||||
#include <libinput.h>
|
||||
#include <QtGui/QGuiApplication>
|
||||
#include <QtGui/QScreen>
|
||||
@ -45,6 +46,8 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
Q_DECLARE_LOGGING_CATEGORY(qLcLibInput)
|
||||
|
||||
QWindowSystemInterface::TouchPoint *QLibInputTouch::DeviceState::point(int32_t slot)
|
||||
{
|
||||
const int id = qMax(0, slot);
|
||||
@ -62,12 +65,23 @@ QLibInputTouch::DeviceState *QLibInputTouch::deviceState(libinput_event_touch *e
|
||||
return &m_devState[dev];
|
||||
}
|
||||
|
||||
static inline QPointF getPos(libinput_event_touch *e)
|
||||
QPointF QLibInputTouch::getPos(libinput_event_touch *e)
|
||||
{
|
||||
// TODO Map to correct screen using QTouchOutputMapping.
|
||||
// Perhaps investigate libinput_device_get_output_name as well.
|
||||
// For now just use the primary screen.
|
||||
DeviceState *state = deviceState(e);
|
||||
QScreen *screen = QGuiApplication::primaryScreen();
|
||||
if (!state->m_screenName.isEmpty()) {
|
||||
if (!m_screen) {
|
||||
const QList<QScreen *> screens = QGuiApplication::screens();
|
||||
for (QScreen *s : screens) {
|
||||
if (s->name() == state->m_screenName) {
|
||||
m_screen = s;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (m_screen)
|
||||
screen = m_screen;
|
||||
}
|
||||
const QRect geom = QHighDpi::toNativePixels(screen->geometry(), screen);
|
||||
const double x = libinput_event_touch_get_x_transformed(e, geom.width());
|
||||
const double y = libinput_event_touch_get_y_transformed(e, geom.height());
|
||||
@ -76,9 +90,25 @@ static inline QPointF getPos(libinput_event_touch *e)
|
||||
|
||||
void QLibInputTouch::registerDevice(libinput_device *dev)
|
||||
{
|
||||
struct udev_device *udev_device;
|
||||
udev_device = libinput_device_get_udev_device(dev);
|
||||
QString devNode = QString::fromUtf8(udev_device_get_devnode(udev_device));
|
||||
QString devName = QString::fromUtf8(libinput_device_get_name(dev));
|
||||
|
||||
qCDebug(qLcLibInput, "libinput: registerDevice %s - %s",
|
||||
qPrintable(devNode), qPrintable(devName));
|
||||
|
||||
QTouchOutputMapping mapping;
|
||||
if (mapping.load()) {
|
||||
m_devState[dev].m_screenName = mapping.screenNameForDeviceNode(devNode);
|
||||
if (!m_devState[dev].m_screenName.isEmpty())
|
||||
qCDebug(qLcLibInput, "libinput: Mapping device %s to screen %s",
|
||||
qPrintable(devNode), qPrintable(m_devState[dev].m_screenName));
|
||||
}
|
||||
|
||||
QTouchDevice *&td = m_devState[dev].m_touchDevice;
|
||||
td = new QTouchDevice;
|
||||
td->setName(QString::fromUtf8(libinput_device_get_name(dev)));
|
||||
td->setName(devName);
|
||||
td->setType(QTouchDevice::TouchScreen);
|
||||
td->setCapabilities(QTouchDevice::Position | QTouchDevice::Area);
|
||||
QWindowSystemInterface::registerTouchDevice(td);
|
||||
|
@ -42,6 +42,7 @@
|
||||
|
||||
#include <QtCore/QHash>
|
||||
#include <QtCore/QList>
|
||||
#include <QtCore/QPointer>
|
||||
#include <qpa/qwindowsysteminterface.h>
|
||||
|
||||
//
|
||||
@ -60,6 +61,7 @@ struct libinput_device;
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QScreen;
|
||||
class QLibInputTouch
|
||||
{
|
||||
public:
|
||||
@ -73,15 +75,18 @@ public:
|
||||
|
||||
private:
|
||||
struct DeviceState {
|
||||
DeviceState() : m_touchDevice(nullptr) { }
|
||||
DeviceState() : m_touchDevice(nullptr), m_screenName() { }
|
||||
QWindowSystemInterface::TouchPoint *point(int32_t slot);
|
||||
QList<QWindowSystemInterface::TouchPoint> m_points;
|
||||
QTouchDevice *m_touchDevice;
|
||||
QString m_screenName;
|
||||
};
|
||||
|
||||
DeviceState *deviceState(libinput_event_touch *e);
|
||||
QPointF getPos(libinput_event_touch *e);
|
||||
|
||||
QHash<libinput_device *, DeviceState> m_devState;
|
||||
mutable QPointer<QScreen> m_screen;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -25,7 +25,6 @@ SOURCES += main.mm \
|
||||
qcocoaclipboard.mm \
|
||||
qcocoadrag.mm \
|
||||
qmacclipboard.mm \
|
||||
qcocoasystemsettings.mm \
|
||||
qcocoainputcontext.mm \
|
||||
qcocoaservices.mm \
|
||||
qcocoasystemtrayicon.mm \
|
||||
@ -59,7 +58,6 @@ HEADERS += qcocoaintegration.h \
|
||||
qcocoaclipboard.h \
|
||||
qcocoadrag.h \
|
||||
qmacclipboard.h \
|
||||
qcocoasystemsettings.h \
|
||||
qcocoainputcontext.h \
|
||||
qcocoaservices.h \
|
||||
qcocoasystemtrayicon.h \
|
||||
|
@ -1,54 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the plugins of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and 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.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL3 included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 3 requirements
|
||||
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 2.0 or (at your option) the GNU General
|
||||
** Public license version 3 or any later version approved by the KDE Free
|
||||
** Qt Foundation. The licenses are as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
|
||||
** https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QCOCOASYSTEMSETTINGS_H
|
||||
#define QCOCOASYSTEMSETTINGS_H
|
||||
|
||||
#include <QtCore/qhash.h>
|
||||
#include <QtGui/qpalette.h>
|
||||
#include <qpa/qplatformtheme.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
QPalette * qt_mac_createSystemPalette();
|
||||
QHash<QPlatformTheme::Palette, QPalette*> qt_mac_createRolePalettes();
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif
|
@ -1,245 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2019 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the plugins of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and 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.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL3 included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 3 requirements
|
||||
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 2.0 or (at your option) the GNU General
|
||||
** Public license version 3 or any later version approved by the KDE Free
|
||||
** Qt Foundation. The licenses are as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
|
||||
** https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "qcocoasystemsettings.h"
|
||||
|
||||
#include "qcocoahelpers.h"
|
||||
|
||||
#include <QtCore/private/qcore_mac_p.h>
|
||||
#include <QtGui/qfont.h>
|
||||
#include <QtGui/private/qcoregraphics_p.h>
|
||||
|
||||
#if !QT_MACOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_14)
|
||||
@interface NSColor (MojaveForwardDeclarations)
|
||||
@property (class, strong, readonly) NSColor *selectedContentBackgroundColor NS_AVAILABLE_MAC(10_14);
|
||||
@property (class, strong, readonly) NSColor *unemphasizedSelectedTextBackgroundColor NS_AVAILABLE_MAC(10_14);
|
||||
@property (class, strong, readonly) NSColor *unemphasizedSelectedTextColor NS_AVAILABLE_MAC(10_14);
|
||||
@property (class, strong, readonly) NSColor *unemphasizedSelectedContentBackgroundColor NS_AVAILABLE_MAC(10_14);
|
||||
@property (class, strong, readonly) NSArray<NSColor *> *alternatingContentBackgroundColors NS_AVAILABLE_MAC(10_14);
|
||||
// Missing from non-Mojave SDKs, even if introduced in 10.10
|
||||
@property (class, strong, readonly) NSColor *linkColor NS_AVAILABLE_MAC(10_10);
|
||||
@end
|
||||
#endif
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
QPalette * qt_mac_createSystemPalette()
|
||||
{
|
||||
QColor qc;
|
||||
|
||||
// Standard palette initialization (copied from Qt 4 styles)
|
||||
QBrush backgroundBrush = qt_mac_toQBrush([NSColor windowBackgroundColor]);
|
||||
QColor background = backgroundBrush.color();
|
||||
QColor light(background.lighter(110));
|
||||
QColor dark(background.darker(160));
|
||||
QColor mid(background.darker(140));
|
||||
QPalette *palette = new QPalette(Qt::black, background, light, dark, mid, Qt::black, Qt::white);
|
||||
|
||||
palette->setBrush(QPalette::Window, backgroundBrush);
|
||||
|
||||
palette->setBrush(QPalette::Disabled, QPalette::WindowText, dark);
|
||||
palette->setBrush(QPalette::Disabled, QPalette::Text, dark);
|
||||
palette->setBrush(QPalette::Disabled, QPalette::ButtonText, dark);
|
||||
palette->setBrush(QPalette::Disabled, QPalette::Base, backgroundBrush);
|
||||
QBrush textBackgroundBrush = qt_mac_toQBrush([NSColor textBackgroundColor]);
|
||||
palette->setBrush(QPalette::Active, QPalette::Base, textBackgroundBrush);
|
||||
palette->setBrush(QPalette::Inactive, QPalette::Base, textBackgroundBrush);
|
||||
palette->setColor(QPalette::Disabled, QPalette::Dark, QColor(191, 191, 191));
|
||||
palette->setColor(QPalette::Active, QPalette::Dark, QColor(191, 191, 191));
|
||||
palette->setColor(QPalette::Inactive, QPalette::Dark, QColor(191, 191, 191));
|
||||
|
||||
// System palette initialization:
|
||||
QBrush br = qt_mac_toQBrush([NSColor selectedControlColor]);
|
||||
palette->setBrush(QPalette::Active, QPalette::Highlight, br);
|
||||
if (__builtin_available(macOS 10.14, *)) {
|
||||
const auto inactiveHighlight = qt_mac_toQBrush([NSColor unemphasizedSelectedContentBackgroundColor]);
|
||||
palette->setBrush(QPalette::Inactive, QPalette::Highlight, inactiveHighlight);
|
||||
palette->setBrush(QPalette::Disabled, QPalette::Highlight, inactiveHighlight);
|
||||
} else {
|
||||
palette->setBrush(QPalette::Inactive, QPalette::Highlight, br);
|
||||
palette->setBrush(QPalette::Disabled, QPalette::Highlight, br);
|
||||
}
|
||||
|
||||
palette->setBrush(QPalette::Shadow, qt_mac_toQColor([NSColor shadowColor]));
|
||||
|
||||
qc = qt_mac_toQColor([NSColor controlTextColor]);
|
||||
palette->setColor(QPalette::Active, QPalette::Text, qc);
|
||||
palette->setColor(QPalette::Active, QPalette::WindowText, qc);
|
||||
palette->setColor(QPalette::Active, QPalette::HighlightedText, qc);
|
||||
palette->setColor(QPalette::Inactive, QPalette::Text, qc);
|
||||
palette->setColor(QPalette::Inactive, QPalette::WindowText, qc);
|
||||
palette->setColor(QPalette::Inactive, QPalette::HighlightedText, qc);
|
||||
|
||||
qc = qt_mac_toQColor([NSColor disabledControlTextColor]);
|
||||
palette->setColor(QPalette::Disabled, QPalette::Text, qc);
|
||||
palette->setColor(QPalette::Disabled, QPalette::WindowText, qc);
|
||||
palette->setColor(QPalette::Disabled, QPalette::HighlightedText, qc);
|
||||
|
||||
palette->setBrush(QPalette::ToolTipBase, qt_mac_toQBrush([NSColor controlColor]));
|
||||
|
||||
palette->setColor(QPalette::Normal, QPalette::Link, qt_mac_toQColor([NSColor linkColor]));
|
||||
|
||||
return palette;
|
||||
}
|
||||
|
||||
struct QMacPaletteMap {
|
||||
inline QMacPaletteMap(QPlatformTheme::Palette p, NSColor *a, NSColor *i) :
|
||||
active(a), inactive(i), paletteRole(p) { }
|
||||
|
||||
NSColor *active;
|
||||
NSColor *inactive;
|
||||
QPlatformTheme::Palette paletteRole;
|
||||
};
|
||||
|
||||
#define MAC_PALETTE_ENTRY(pal, active, inactive) \
|
||||
QMacPaletteMap(pal, [NSColor active], [NSColor inactive])
|
||||
static QMacPaletteMap mac_widget_colors[] = {
|
||||
MAC_PALETTE_ENTRY(QPlatformTheme::ToolButtonPalette, controlTextColor, disabledControlTextColor),
|
||||
MAC_PALETTE_ENTRY(QPlatformTheme::ButtonPalette, controlTextColor, disabledControlTextColor),
|
||||
MAC_PALETTE_ENTRY(QPlatformTheme::HeaderPalette, headerTextColor, disabledControlTextColor),
|
||||
MAC_PALETTE_ENTRY(QPlatformTheme::ComboBoxPalette, controlTextColor, disabledControlTextColor),
|
||||
MAC_PALETTE_ENTRY(QPlatformTheme::ItemViewPalette, textColor, disabledControlTextColor),
|
||||
MAC_PALETTE_ENTRY(QPlatformTheme::MessageBoxLabelPalette, textColor, disabledControlTextColor),
|
||||
MAC_PALETTE_ENTRY(QPlatformTheme::TabBarPalette, controlTextColor, disabledControlTextColor),
|
||||
MAC_PALETTE_ENTRY(QPlatformTheme::LabelPalette, textColor, disabledControlTextColor),
|
||||
MAC_PALETTE_ENTRY(QPlatformTheme::GroupBoxPalette, textColor, disabledControlTextColor),
|
||||
MAC_PALETTE_ENTRY(QPlatformTheme::MenuPalette, controlTextColor, disabledControlTextColor),
|
||||
MAC_PALETTE_ENTRY(QPlatformTheme::MenuBarPalette, controlTextColor, disabledControlTextColor),
|
||||
MAC_PALETTE_ENTRY(QPlatformTheme::TextEditPalette, textColor, disabledControlTextColor),
|
||||
MAC_PALETTE_ENTRY(QPlatformTheme::TextLineEditPalette, textColor, disabledControlTextColor)
|
||||
};
|
||||
#undef MAC_PALETTE_ENTRY
|
||||
|
||||
static const int mac_widget_colors_count = sizeof(mac_widget_colors) / sizeof(mac_widget_colors[0]);
|
||||
|
||||
QHash<QPlatformTheme::Palette, QPalette*> qt_mac_createRolePalettes()
|
||||
{
|
||||
QHash<QPlatformTheme::Palette, QPalette*> palettes;
|
||||
QColor qc;
|
||||
for (int i = 0; i < mac_widget_colors_count; i++) {
|
||||
QPalette &pal = *qt_mac_createSystemPalette();
|
||||
if (mac_widget_colors[i].active) {
|
||||
qc = qt_mac_toQColor(mac_widget_colors[i].active);
|
||||
pal.setColor(QPalette::Active, QPalette::Text, qc);
|
||||
pal.setColor(QPalette::Inactive, QPalette::Text, qc);
|
||||
pal.setColor(QPalette::Active, QPalette::WindowText, qc);
|
||||
pal.setColor(QPalette::Inactive, QPalette::WindowText, qc);
|
||||
pal.setColor(QPalette::Active, QPalette::HighlightedText, qc);
|
||||
pal.setColor(QPalette::Inactive, QPalette::HighlightedText, qc);
|
||||
pal.setColor(QPalette::Active, QPalette::ButtonText, qc);
|
||||
pal.setColor(QPalette::Inactive, QPalette::ButtonText, qc);
|
||||
qc = qt_mac_toQColor(mac_widget_colors[i].inactive);
|
||||
pal.setColor(QPalette::Disabled, QPalette::Text, qc);
|
||||
pal.setColor(QPalette::Disabled, QPalette::WindowText, qc);
|
||||
pal.setColor(QPalette::Disabled, QPalette::HighlightedText, qc);
|
||||
pal.setColor(QPalette::Disabled, QPalette::ButtonText, qc);
|
||||
}
|
||||
if (mac_widget_colors[i].paletteRole == QPlatformTheme::MenuPalette
|
||||
|| mac_widget_colors[i].paletteRole == QPlatformTheme::MenuBarPalette) {
|
||||
NSColor *selectedMenuItemColor = nil;
|
||||
if (__builtin_available(macOS 10.14, *)) {
|
||||
// Cheap approximation for NSVisualEffectView (see deprecation note for selectedMenuItemTextColor)
|
||||
selectedMenuItemColor = [[NSColor selectedContentBackgroundColor] highlightWithLevel:0.4];
|
||||
} else {
|
||||
// selectedMenuItemColor would presumably be the correct color to use as the background
|
||||
// for selected menu items. But that color is always blue, and doesn't follow the
|
||||
// appearance color in system preferences. So we therefore deliberatly choose to use
|
||||
// keyboardFocusIndicatorColor instead, which appears to have the same color value.
|
||||
selectedMenuItemColor = [NSColor keyboardFocusIndicatorColor];
|
||||
}
|
||||
pal.setBrush(QPalette::Highlight, qt_mac_toQColor(selectedMenuItemColor));
|
||||
qc = qt_mac_toQColor([NSColor labelColor]);
|
||||
pal.setBrush(QPalette::ButtonText, qc);
|
||||
pal.setBrush(QPalette::Text, qc);
|
||||
qc = qt_mac_toQColor([NSColor selectedMenuItemTextColor]);
|
||||
pal.setBrush(QPalette::HighlightedText, qc);
|
||||
qc = qt_mac_toQColor([NSColor disabledControlTextColor]);
|
||||
pal.setBrush(QPalette::Disabled, QPalette::Text, qc);
|
||||
} else if ((mac_widget_colors[i].paletteRole == QPlatformTheme::ButtonPalette)
|
||||
|| (mac_widget_colors[i].paletteRole == QPlatformTheme::HeaderPalette)
|
||||
|| (mac_widget_colors[i].paletteRole == QPlatformTheme::TabBarPalette)) {
|
||||
pal.setColor(QPalette::Disabled, QPalette::ButtonText,
|
||||
pal.color(QPalette::Disabled, QPalette::Text));
|
||||
pal.setColor(QPalette::Inactive, QPalette::ButtonText,
|
||||
pal.color(QPalette::Inactive, QPalette::Text));
|
||||
pal.setColor(QPalette::Active, QPalette::ButtonText,
|
||||
pal.color(QPalette::Active, QPalette::Text));
|
||||
} else if (mac_widget_colors[i].paletteRole == QPlatformTheme::ItemViewPalette) {
|
||||
NSArray<NSColor *> *baseColors = nil;
|
||||
NSColor *activeHighlightColor = nil;
|
||||
if (__builtin_available(macOS 10.14, *)) {
|
||||
baseColors = [NSColor alternatingContentBackgroundColors];
|
||||
activeHighlightColor = [NSColor selectedContentBackgroundColor];
|
||||
pal.setBrush(QPalette::Inactive, QPalette::HighlightedText,
|
||||
qt_mac_toQBrush([NSColor unemphasizedSelectedTextColor]));
|
||||
} else {
|
||||
baseColors = [NSColor controlAlternatingRowBackgroundColors];
|
||||
activeHighlightColor = [NSColor alternateSelectedControlColor];
|
||||
pal.setBrush(QPalette::Inactive, QPalette::HighlightedText,
|
||||
pal.brush(QPalette::Active, QPalette::Text));
|
||||
}
|
||||
pal.setBrush(QPalette::Base, qt_mac_toQBrush(baseColors[0]));
|
||||
pal.setBrush(QPalette::AlternateBase, qt_mac_toQBrush(baseColors[1]));
|
||||
pal.setBrush(QPalette::Active, QPalette::Highlight,
|
||||
qt_mac_toQBrush(activeHighlightColor));
|
||||
pal.setBrush(QPalette::Active, QPalette::HighlightedText,
|
||||
qt_mac_toQBrush([NSColor alternateSelectedControlTextColor]));
|
||||
pal.setBrush(QPalette::Inactive, QPalette::Text,
|
||||
pal.brush(QPalette::Active, QPalette::Text));
|
||||
} else if (mac_widget_colors[i].paletteRole == QPlatformTheme::TextEditPalette) {
|
||||
pal.setBrush(QPalette::Active, QPalette::Base, qt_mac_toQColor([NSColor textBackgroundColor]));
|
||||
pal.setBrush(QPalette::Inactive, QPalette::Text,
|
||||
pal.brush(QPalette::Active, QPalette::Text));
|
||||
pal.setBrush(QPalette::Inactive, QPalette::HighlightedText,
|
||||
pal.brush(QPalette::Active, QPalette::Text));
|
||||
} else if (mac_widget_colors[i].paletteRole == QPlatformTheme::TextLineEditPalette
|
||||
|| mac_widget_colors[i].paletteRole == QPlatformTheme::ComboBoxPalette) {
|
||||
pal.setBrush(QPalette::Active, QPalette::Base, qt_mac_toQColor([NSColor textBackgroundColor]));
|
||||
pal.setBrush(QPalette::Disabled, QPalette::Base,
|
||||
pal.brush(QPalette::Active, QPalette::Base));
|
||||
} else if (mac_widget_colors[i].paletteRole == QPlatformTheme::LabelPalette) {
|
||||
qc = qt_mac_toQColor([NSColor labelColor]);
|
||||
pal.setBrush(QPalette::Inactive, QPalette::ToolTipText, qc);
|
||||
}
|
||||
palettes.insert(mac_widget_colors[i].paletteRole, &pal);
|
||||
}
|
||||
return palettes;
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
@ -45,7 +45,6 @@
|
||||
#include <QtCore/QOperatingSystemVersion>
|
||||
#include <QtCore/QVariant>
|
||||
|
||||
#include "qcocoasystemsettings.h"
|
||||
#include "qcocoasystemtrayicon.h"
|
||||
#include "qcocoamenuitem.h"
|
||||
#include "qcocoamenu.h"
|
||||
@ -80,8 +79,203 @@
|
||||
|
||||
#include <CoreServices/CoreServices.h>
|
||||
|
||||
#if !QT_MACOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_14)
|
||||
@interface NSColor (MojaveForwardDeclarations)
|
||||
@property (class, strong, readonly) NSColor *selectedContentBackgroundColor NS_AVAILABLE_MAC(10_14);
|
||||
@property (class, strong, readonly) NSColor *unemphasizedSelectedTextBackgroundColor NS_AVAILABLE_MAC(10_14);
|
||||
@property (class, strong, readonly) NSColor *unemphasizedSelectedTextColor NS_AVAILABLE_MAC(10_14);
|
||||
@property (class, strong, readonly) NSColor *unemphasizedSelectedContentBackgroundColor NS_AVAILABLE_MAC(10_14);
|
||||
@property (class, strong, readonly) NSArray<NSColor *> *alternatingContentBackgroundColors NS_AVAILABLE_MAC(10_14);
|
||||
// Missing from non-Mojave SDKs, even if introduced in 10.10
|
||||
@property (class, strong, readonly) NSColor *linkColor NS_AVAILABLE_MAC(10_10);
|
||||
@end
|
||||
#endif
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
static QPalette *qt_mac_createSystemPalette()
|
||||
{
|
||||
QColor qc;
|
||||
|
||||
// Standard palette initialization (copied from Qt 4 styles)
|
||||
QBrush backgroundBrush = qt_mac_toQBrush([NSColor windowBackgroundColor]);
|
||||
QColor background = backgroundBrush.color();
|
||||
QColor light(background.lighter(110));
|
||||
QColor dark(background.darker(160));
|
||||
QColor mid(background.darker(140));
|
||||
QPalette *palette = new QPalette(Qt::black, background, light, dark, mid, Qt::black, Qt::white);
|
||||
|
||||
palette->setBrush(QPalette::Window, backgroundBrush);
|
||||
|
||||
palette->setBrush(QPalette::Disabled, QPalette::WindowText, dark);
|
||||
palette->setBrush(QPalette::Disabled, QPalette::Text, dark);
|
||||
palette->setBrush(QPalette::Disabled, QPalette::ButtonText, dark);
|
||||
palette->setBrush(QPalette::Disabled, QPalette::Base, backgroundBrush);
|
||||
QBrush textBackgroundBrush = qt_mac_toQBrush([NSColor textBackgroundColor]);
|
||||
palette->setBrush(QPalette::Active, QPalette::Base, textBackgroundBrush);
|
||||
palette->setBrush(QPalette::Inactive, QPalette::Base, textBackgroundBrush);
|
||||
palette->setColor(QPalette::Disabled, QPalette::Dark, QColor(191, 191, 191));
|
||||
palette->setColor(QPalette::Active, QPalette::Dark, QColor(191, 191, 191));
|
||||
palette->setColor(QPalette::Inactive, QPalette::Dark, QColor(191, 191, 191));
|
||||
|
||||
// System palette initialization:
|
||||
QBrush br = qt_mac_toQBrush([NSColor selectedControlColor]);
|
||||
palette->setBrush(QPalette::Active, QPalette::Highlight, br);
|
||||
if (__builtin_available(macOS 10.14, *)) {
|
||||
const auto inactiveHighlight = qt_mac_toQBrush([NSColor unemphasizedSelectedContentBackgroundColor]);
|
||||
palette->setBrush(QPalette::Inactive, QPalette::Highlight, inactiveHighlight);
|
||||
palette->setBrush(QPalette::Disabled, QPalette::Highlight, inactiveHighlight);
|
||||
} else {
|
||||
palette->setBrush(QPalette::Inactive, QPalette::Highlight, br);
|
||||
palette->setBrush(QPalette::Disabled, QPalette::Highlight, br);
|
||||
}
|
||||
|
||||
palette->setBrush(QPalette::Shadow, qt_mac_toQColor([NSColor shadowColor]));
|
||||
|
||||
qc = qt_mac_toQColor([NSColor controlTextColor]);
|
||||
palette->setColor(QPalette::Active, QPalette::Text, qc);
|
||||
palette->setColor(QPalette::Active, QPalette::WindowText, qc);
|
||||
palette->setColor(QPalette::Active, QPalette::HighlightedText, qc);
|
||||
palette->setColor(QPalette::Inactive, QPalette::Text, qc);
|
||||
palette->setColor(QPalette::Inactive, QPalette::WindowText, qc);
|
||||
palette->setColor(QPalette::Inactive, QPalette::HighlightedText, qc);
|
||||
|
||||
qc = qt_mac_toQColor([NSColor disabledControlTextColor]);
|
||||
palette->setColor(QPalette::Disabled, QPalette::Text, qc);
|
||||
palette->setColor(QPalette::Disabled, QPalette::WindowText, qc);
|
||||
palette->setColor(QPalette::Disabled, QPalette::HighlightedText, qc);
|
||||
|
||||
palette->setBrush(QPalette::ToolTipBase, qt_mac_toQBrush([NSColor controlColor]));
|
||||
|
||||
palette->setColor(QPalette::Normal, QPalette::Link, qt_mac_toQColor([NSColor linkColor]));
|
||||
|
||||
return palette;
|
||||
}
|
||||
|
||||
struct QMacPaletteMap {
|
||||
inline QMacPaletteMap(QPlatformTheme::Palette p, NSColor *a, NSColor *i) :
|
||||
active(a), inactive(i), paletteRole(p) { }
|
||||
|
||||
NSColor *active;
|
||||
NSColor *inactive;
|
||||
QPlatformTheme::Palette paletteRole;
|
||||
};
|
||||
|
||||
#define MAC_PALETTE_ENTRY(pal, active, inactive) \
|
||||
QMacPaletteMap(pal, [NSColor active], [NSColor inactive])
|
||||
static QMacPaletteMap mac_widget_colors[] = {
|
||||
MAC_PALETTE_ENTRY(QPlatformTheme::ToolButtonPalette, controlTextColor, disabledControlTextColor),
|
||||
MAC_PALETTE_ENTRY(QPlatformTheme::ButtonPalette, controlTextColor, disabledControlTextColor),
|
||||
MAC_PALETTE_ENTRY(QPlatformTheme::HeaderPalette, headerTextColor, disabledControlTextColor),
|
||||
MAC_PALETTE_ENTRY(QPlatformTheme::ComboBoxPalette, controlTextColor, disabledControlTextColor),
|
||||
MAC_PALETTE_ENTRY(QPlatformTheme::ItemViewPalette, textColor, disabledControlTextColor),
|
||||
MAC_PALETTE_ENTRY(QPlatformTheme::MessageBoxLabelPalette, textColor, disabledControlTextColor),
|
||||
MAC_PALETTE_ENTRY(QPlatformTheme::TabBarPalette, controlTextColor, disabledControlTextColor),
|
||||
MAC_PALETTE_ENTRY(QPlatformTheme::LabelPalette, textColor, disabledControlTextColor),
|
||||
MAC_PALETTE_ENTRY(QPlatformTheme::GroupBoxPalette, textColor, disabledControlTextColor),
|
||||
MAC_PALETTE_ENTRY(QPlatformTheme::MenuPalette, controlTextColor, disabledControlTextColor),
|
||||
MAC_PALETTE_ENTRY(QPlatformTheme::MenuBarPalette, controlTextColor, disabledControlTextColor),
|
||||
MAC_PALETTE_ENTRY(QPlatformTheme::TextEditPalette, textColor, disabledControlTextColor),
|
||||
MAC_PALETTE_ENTRY(QPlatformTheme::TextLineEditPalette, textColor, disabledControlTextColor)
|
||||
};
|
||||
#undef MAC_PALETTE_ENTRY
|
||||
|
||||
static const int mac_widget_colors_count = sizeof(mac_widget_colors) / sizeof(mac_widget_colors[0]);
|
||||
|
||||
static QHash<QPlatformTheme::Palette, QPalette*> qt_mac_createRolePalettes()
|
||||
{
|
||||
QHash<QPlatformTheme::Palette, QPalette*> palettes;
|
||||
QColor qc;
|
||||
for (int i = 0; i < mac_widget_colors_count; i++) {
|
||||
QPalette &pal = *qt_mac_createSystemPalette();
|
||||
if (mac_widget_colors[i].active) {
|
||||
qc = qt_mac_toQColor(mac_widget_colors[i].active);
|
||||
pal.setColor(QPalette::Active, QPalette::Text, qc);
|
||||
pal.setColor(QPalette::Inactive, QPalette::Text, qc);
|
||||
pal.setColor(QPalette::Active, QPalette::WindowText, qc);
|
||||
pal.setColor(QPalette::Inactive, QPalette::WindowText, qc);
|
||||
pal.setColor(QPalette::Active, QPalette::HighlightedText, qc);
|
||||
pal.setColor(QPalette::Inactive, QPalette::HighlightedText, qc);
|
||||
pal.setColor(QPalette::Active, QPalette::ButtonText, qc);
|
||||
pal.setColor(QPalette::Inactive, QPalette::ButtonText, qc);
|
||||
qc = qt_mac_toQColor(mac_widget_colors[i].inactive);
|
||||
pal.setColor(QPalette::Disabled, QPalette::Text, qc);
|
||||
pal.setColor(QPalette::Disabled, QPalette::WindowText, qc);
|
||||
pal.setColor(QPalette::Disabled, QPalette::HighlightedText, qc);
|
||||
pal.setColor(QPalette::Disabled, QPalette::ButtonText, qc);
|
||||
}
|
||||
if (mac_widget_colors[i].paletteRole == QPlatformTheme::MenuPalette
|
||||
|| mac_widget_colors[i].paletteRole == QPlatformTheme::MenuBarPalette) {
|
||||
NSColor *selectedMenuItemColor = nil;
|
||||
if (__builtin_available(macOS 10.14, *)) {
|
||||
// Cheap approximation for NSVisualEffectView (see deprecation note for selectedMenuItemTextColor)
|
||||
selectedMenuItemColor = [[NSColor selectedContentBackgroundColor] highlightWithLevel:0.4];
|
||||
} else {
|
||||
// selectedMenuItemColor would presumably be the correct color to use as the background
|
||||
// for selected menu items. But that color is always blue, and doesn't follow the
|
||||
// appearance color in system preferences. So we therefore deliberatly choose to use
|
||||
// keyboardFocusIndicatorColor instead, which appears to have the same color value.
|
||||
selectedMenuItemColor = [NSColor keyboardFocusIndicatorColor];
|
||||
}
|
||||
pal.setBrush(QPalette::Highlight, qt_mac_toQColor(selectedMenuItemColor));
|
||||
qc = qt_mac_toQColor([NSColor labelColor]);
|
||||
pal.setBrush(QPalette::ButtonText, qc);
|
||||
pal.setBrush(QPalette::Text, qc);
|
||||
qc = qt_mac_toQColor([NSColor selectedMenuItemTextColor]);
|
||||
pal.setBrush(QPalette::HighlightedText, qc);
|
||||
qc = qt_mac_toQColor([NSColor disabledControlTextColor]);
|
||||
pal.setBrush(QPalette::Disabled, QPalette::Text, qc);
|
||||
} else if ((mac_widget_colors[i].paletteRole == QPlatformTheme::ButtonPalette)
|
||||
|| (mac_widget_colors[i].paletteRole == QPlatformTheme::HeaderPalette)
|
||||
|| (mac_widget_colors[i].paletteRole == QPlatformTheme::TabBarPalette)) {
|
||||
pal.setColor(QPalette::Disabled, QPalette::ButtonText,
|
||||
pal.color(QPalette::Disabled, QPalette::Text));
|
||||
pal.setColor(QPalette::Inactive, QPalette::ButtonText,
|
||||
pal.color(QPalette::Inactive, QPalette::Text));
|
||||
pal.setColor(QPalette::Active, QPalette::ButtonText,
|
||||
pal.color(QPalette::Active, QPalette::Text));
|
||||
} else if (mac_widget_colors[i].paletteRole == QPlatformTheme::ItemViewPalette) {
|
||||
NSArray<NSColor *> *baseColors = nil;
|
||||
NSColor *activeHighlightColor = nil;
|
||||
if (__builtin_available(macOS 10.14, *)) {
|
||||
baseColors = [NSColor alternatingContentBackgroundColors];
|
||||
activeHighlightColor = [NSColor selectedContentBackgroundColor];
|
||||
pal.setBrush(QPalette::Inactive, QPalette::HighlightedText,
|
||||
qt_mac_toQBrush([NSColor unemphasizedSelectedTextColor]));
|
||||
} else {
|
||||
baseColors = [NSColor controlAlternatingRowBackgroundColors];
|
||||
activeHighlightColor = [NSColor alternateSelectedControlColor];
|
||||
pal.setBrush(QPalette::Inactive, QPalette::HighlightedText,
|
||||
pal.brush(QPalette::Active, QPalette::Text));
|
||||
}
|
||||
pal.setBrush(QPalette::Base, qt_mac_toQBrush(baseColors[0]));
|
||||
pal.setBrush(QPalette::AlternateBase, qt_mac_toQBrush(baseColors[1]));
|
||||
pal.setBrush(QPalette::Active, QPalette::Highlight,
|
||||
qt_mac_toQBrush(activeHighlightColor));
|
||||
pal.setBrush(QPalette::Active, QPalette::HighlightedText,
|
||||
qt_mac_toQBrush([NSColor alternateSelectedControlTextColor]));
|
||||
pal.setBrush(QPalette::Inactive, QPalette::Text,
|
||||
pal.brush(QPalette::Active, QPalette::Text));
|
||||
} else if (mac_widget_colors[i].paletteRole == QPlatformTheme::TextEditPalette) {
|
||||
pal.setBrush(QPalette::Active, QPalette::Base, qt_mac_toQColor([NSColor textBackgroundColor]));
|
||||
pal.setBrush(QPalette::Inactive, QPalette::Text,
|
||||
pal.brush(QPalette::Active, QPalette::Text));
|
||||
pal.setBrush(QPalette::Inactive, QPalette::HighlightedText,
|
||||
pal.brush(QPalette::Active, QPalette::Text));
|
||||
} else if (mac_widget_colors[i].paletteRole == QPlatformTheme::TextLineEditPalette
|
||||
|| mac_widget_colors[i].paletteRole == QPlatformTheme::ComboBoxPalette) {
|
||||
pal.setBrush(QPalette::Active, QPalette::Base, qt_mac_toQColor([NSColor textBackgroundColor]));
|
||||
pal.setBrush(QPalette::Disabled, QPalette::Base,
|
||||
pal.brush(QPalette::Active, QPalette::Base));
|
||||
} else if (mac_widget_colors[i].paletteRole == QPlatformTheme::LabelPalette) {
|
||||
qc = qt_mac_toQColor([NSColor labelColor]);
|
||||
pal.setBrush(QPalette::Inactive, QPalette::ToolTipText, qc);
|
||||
}
|
||||
palettes.insert(mac_widget_colors[i].paletteRole, &pal);
|
||||
}
|
||||
return palettes;
|
||||
}
|
||||
|
||||
const char *QCocoaTheme::name = "cocoa";
|
||||
|
||||
QCocoaTheme::QCocoaTheme()
|
||||
|
@ -745,7 +745,11 @@
|
||||
- (UITextPosition *)positionFromPosition:(UITextPosition *)position offset:(NSInteger)offset
|
||||
{
|
||||
int p = static_cast<QUITextPosition *>(position).index;
|
||||
return [QUITextPosition positionWithIndex:p + offset];
|
||||
const int posWithIndex = p + offset;
|
||||
const int textLength = [self currentImeState:Qt::ImSurroundingText].toString().length();
|
||||
if (posWithIndex < 0 || posWithIndex > textLength)
|
||||
return nil;
|
||||
return [QUITextPosition positionWithIndex:posWithIndex];
|
||||
}
|
||||
|
||||
- (UITextPosition *)positionFromPosition:(UITextPosition *)position inDirection:(UITextLayoutDirection)direction offset:(NSInteger)offset
|
||||
|
@ -198,7 +198,9 @@ void QWasmClipboard::installEventHandlers(const QString &canvasId)
|
||||
return;
|
||||
|
||||
// Fallback path for browsers which do not support direct clipboard access
|
||||
val canvas = val::global(canvasId.toUtf8().constData());
|
||||
val document = val::global("document");
|
||||
val canvas = document.call<val>("getElementById", val(canvasId.toUtf8().constData()));
|
||||
|
||||
canvas.call<void>("addEventListener", std::string("cut"),
|
||||
val::module_property("qtClipboardCutTo"));
|
||||
canvas.call<void>("addEventListener", std::string("copy"),
|
||||
|
@ -36,6 +36,8 @@
|
||||
#include <emscripten/emscripten.h>
|
||||
#include <emscripten/bind.h>
|
||||
|
||||
using namespace emscripten;
|
||||
|
||||
void QWasmCursor::changeCursor(QCursor *windowCursor, QWindow *window)
|
||||
{
|
||||
if (!windowCursor || !window)
|
||||
@ -54,8 +56,10 @@ void QWasmCursor::changeCursor(QCursor *windowCursor, QWindow *window)
|
||||
htmlCursorName = "auto";
|
||||
|
||||
// Set cursor on the canvas
|
||||
QString canvasId = QWasmScreen::get(screen)->canvasId();
|
||||
emscripten::val canvasStyle = emscripten::val::global(canvasId.toUtf8().constData())["style"];
|
||||
QByteArray canvasId = QWasmScreen::get(screen)->canvasId().toUtf8();
|
||||
val document = val::global("document");
|
||||
val canvas = document.call<val>("getElementById", val(canvasId.constData()));
|
||||
val canvasStyle = canvas["style"];
|
||||
canvasStyle.set("cursor", emscripten::val(htmlCursorName.constData()));
|
||||
}
|
||||
|
||||
|
@ -33,6 +33,14 @@
|
||||
|
||||
#include <emscripten.h>
|
||||
|
||||
#if (__EMSCRIPTEN_major__ > 1 || __EMSCRIPTEN_minor__ > 38 || __EMSCRIPTEN_minor__ == 38 && __EMSCRIPTEN_tiny__ >= 22)
|
||||
# define EMSCRIPTEN_HAS_ASYNC_RUN_IN_MAIN_RUNTIME_THREAD
|
||||
#endif
|
||||
|
||||
#ifdef EMSCRIPTEN_HAS_ASYNC_RUN_IN_MAIN_RUNTIME_THREAD
|
||||
#include <emscripten/threading.h>
|
||||
#endif
|
||||
|
||||
class QWasmEventDispatcherPrivate : public QEventDispatcherUNIXPrivate
|
||||
{
|
||||
|
||||
@ -179,3 +187,18 @@ void QWasmEventDispatcher::doMaintainTimers()
|
||||
emscripten_async_call(callback, this, toWaitDuration);
|
||||
m_currentTargetTime = newTargetTime;
|
||||
}
|
||||
|
||||
void QWasmEventDispatcher::wakeUp()
|
||||
{
|
||||
#ifdef EMSCRIPTEN_HAS_ASYNC_RUN_IN_MAIN_RUNTIME_THREAD
|
||||
if (!emscripten_is_main_runtime_thread())
|
||||
emscripten_async_run_in_main_runtime_thread_(EM_FUNC_SIG_VI, (void*)(&QWasmEventDispatcher::mainThreadWakeUp), this);
|
||||
#endif
|
||||
QEventDispatcherUNIX::wakeUp();
|
||||
}
|
||||
|
||||
void QWasmEventDispatcher::mainThreadWakeUp(void *eventDispatcher)
|
||||
{
|
||||
emscripten_resume_main_loop(); // Service possible requestUpdate Calls
|
||||
static_cast<QWasmEventDispatcher *>(eventDispatcher)->processEvents(QEventLoop::AllEvents);
|
||||
}
|
||||
|
@ -51,6 +51,8 @@ public:
|
||||
protected:
|
||||
bool processEvents(QEventLoop::ProcessEventsFlags flags) override;
|
||||
void doMaintainTimers();
|
||||
void wakeUp() override;
|
||||
static void mainThreadWakeUp(void *eventDispatcher);
|
||||
|
||||
private:
|
||||
bool m_hasMainLoop = false;
|
||||
|
@ -47,9 +47,10 @@
|
||||
|
||||
#include <iostream>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
using namespace emscripten;
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
typedef struct emkb2qt {
|
||||
const char *em;
|
||||
unsigned int qt;
|
||||
@ -353,10 +354,11 @@ void QWasmEventTranslator::initEventHandlers()
|
||||
g_useNaturalScrolling = false; // make this !default on macOS
|
||||
|
||||
if (emscripten::val::global("window")["safari"].isUndefined()) {
|
||||
|
||||
emscripten::val::global(canvasId).call<void>("addEventListener",
|
||||
std::string("wheel"),
|
||||
val::module_property("qtMouseWheelEvent"));
|
||||
val document = val::global("document");
|
||||
val canvas = document.call<val>("getElementById", val(canvasId));
|
||||
canvas.call<void>("addEventListener",
|
||||
std::string("wheel"),
|
||||
val::module_property("qtMouseWheelEvent"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -106,7 +106,7 @@ EMSCRIPTEN_WEBGL_CONTEXT_HANDLE QWasmOpenGLContext::createEmscriptenContext(cons
|
||||
attributes.depth = useDepthStencil;
|
||||
attributes.stencil = useDepthStencil;
|
||||
|
||||
EMSCRIPTEN_WEBGL_CONTEXT_HANDLE context = emscripten_webgl_create_context(canvasId.toLocal8Bit().constData(), &attributes);
|
||||
EMSCRIPTEN_WEBGL_CONTEXT_HANDLE context = emscripten_webgl_create_context(canvasId.toUtf8().constData(), &attributes);
|
||||
|
||||
return context;
|
||||
}
|
||||
|
@ -44,6 +44,7 @@
|
||||
#include <QtGui/qguiapplication.h>
|
||||
#include <private/qhighdpiscaling_p.h>
|
||||
|
||||
using namespace emscripten;
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
@ -182,13 +183,15 @@ void QWasmScreen::updateQScreenAndCanvasRenderSize()
|
||||
QSizeF cssSize(css_width, css_height);
|
||||
|
||||
QSizeF canvasSize = cssSize * devicePixelRatio();
|
||||
emscripten::val canvas = emscripten::val::global(canvasId.constData());
|
||||
val document = val::global("document");
|
||||
val canvas = document.call<val>("getElementById", val(canvasId.constData()));
|
||||
|
||||
canvas.set("width", canvasSize.width());
|
||||
canvas.set("height", canvasSize.height());
|
||||
|
||||
QPoint offset;
|
||||
offset.setX(emscripten::val::global(canvasId.constData())["offsetTop"].as<int>());
|
||||
offset.setY(emscripten::val::global(canvasId.constData())["offsetLeft"].as<int>());
|
||||
offset.setX(canvas["offsetTop"].as<int>());
|
||||
offset.setY(canvas["offsetLeft"].as<int>());
|
||||
|
||||
emscripten::val rect = canvas.call<emscripten::val>("getBoundingClientRect");
|
||||
QPoint position(rect["left"].as<int>() - offset.x(), rect["top"].as<int>() - offset.y());
|
||||
|
@ -107,6 +107,9 @@ private:
|
||||
ULONG m_ref;
|
||||
};
|
||||
|
||||
// Clang does not consider __declspec(nothrow) as nothrow
|
||||
QT_WARNING_DISABLE_CLANG("-Wmicrosoft-exception-spec")
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QWINDOWSCOMBASE_H
|
||||
|
@ -604,15 +604,12 @@ QString QWindowsContext::registerWindowClass(QString cname,
|
||||
// each one has to have window class names with a unique name
|
||||
// The first instance gets the unmodified name; if the class
|
||||
// has already been registered by another instance of Qt then
|
||||
// add a UUID.
|
||||
static int classExists = -1;
|
||||
|
||||
// add a UUID. The check needs to be performed for each name
|
||||
// in case new message windows are added (QTBUG-81347).
|
||||
const auto appInstance = static_cast<HINSTANCE>(GetModuleHandle(nullptr));
|
||||
if (classExists == -1) {
|
||||
WNDCLASS wcinfo;
|
||||
classExists = GetClassInfo(appInstance, reinterpret_cast<LPCWSTR>(cname.utf16()), &wcinfo);
|
||||
classExists = classExists && wcinfo.lpfnWndProc != proc;
|
||||
}
|
||||
WNDCLASS wcinfo;
|
||||
const bool classExists = GetClassInfo(appInstance, reinterpret_cast<LPCWSTR>(cname.utf16()), &wcinfo) == TRUE
|
||||
&& wcinfo.lpfnWndProc != proc;
|
||||
|
||||
if (classExists)
|
||||
cname += QUuid::createUuid().toString();
|
||||
|
@ -52,6 +52,8 @@
|
||||
#include <qpa/qplatformintegration.h>
|
||||
#include <QtWindowsUIAutomationSupport/private/qwindowsuiawrapper_p.h>
|
||||
|
||||
#include <QtCore/private/qwinregistry_p.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace QWindowsUiAutomation;
|
||||
@ -85,12 +87,63 @@ bool QWindowsUiaAccessibility::handleWmGetObject(HWND hwnd, WPARAM wParam, LPARA
|
||||
return false;
|
||||
}
|
||||
|
||||
// Retrieve sound name by checking the icon property of a message box
|
||||
// should it be the event object.
|
||||
static QString alertSound(const QObject *object)
|
||||
{
|
||||
if (object->inherits("QMessageBox")) {
|
||||
enum MessageBoxIcon { // Keep in sync with QMessageBox::Icon
|
||||
Information = 1,
|
||||
Warning = 2,
|
||||
Critical = 3
|
||||
};
|
||||
switch (object->property("icon").toInt()) {
|
||||
case Information:
|
||||
return QStringLiteral("SystemAsterisk");
|
||||
case Warning:
|
||||
return QStringLiteral("SystemExclamation");
|
||||
case Critical:
|
||||
return QStringLiteral("SystemHand");
|
||||
}
|
||||
}
|
||||
return QStringLiteral("SystemAsterisk");
|
||||
}
|
||||
|
||||
static QString soundFileName(const QString &soundName)
|
||||
{
|
||||
const QString key = QStringLiteral("AppEvents\\Schemes\\Apps\\.Default\\")
|
||||
+ soundName + QStringLiteral("\\.Current");
|
||||
return QWinRegistryKey(HKEY_CURRENT_USER, key).stringValue(L"");
|
||||
}
|
||||
|
||||
static void playSystemSound(const QString &soundName)
|
||||
{
|
||||
if (!soundName.isEmpty() && !soundFileName(soundName).isEmpty()) {
|
||||
PlaySound(reinterpret_cast<const wchar_t *>(soundName.utf16()), nullptr,
|
||||
SND_ALIAS | SND_ASYNC | SND_NODEFAULT | SND_NOWAIT);
|
||||
}
|
||||
}
|
||||
|
||||
// Handles accessibility update notifications.
|
||||
void QWindowsUiaAccessibility::notifyAccessibilityUpdate(QAccessibleEvent *event)
|
||||
{
|
||||
if (!event)
|
||||
return;
|
||||
|
||||
switch (event->type()) {
|
||||
case QAccessible::PopupMenuStart:
|
||||
playSystemSound(QStringLiteral("MenuPopup"));
|
||||
break;
|
||||
case QAccessible::MenuCommand:
|
||||
playSystemSound(QStringLiteral("MenuCommand"));
|
||||
break;
|
||||
case QAccessible::Alert:
|
||||
playSystemSound(alertSound(event->object()));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
QAccessibleInterface *accessible = event->accessibleInterface();
|
||||
if (!isActive() || !accessible || !accessible->isValid())
|
||||
return;
|
||||
|
@ -270,7 +270,7 @@
|
||||
When side-effects are unavoidable, ensure that the prior state is restored
|
||||
at the end of the test function, even if the test fails. This commonly
|
||||
requires use of an RAII (resource acquisition is initialization) class
|
||||
that restores state when the function returns, or a \l cleanup() method.
|
||||
that restores state when the function returns, or a \c cleanup() method.
|
||||
Do not simply put the restoration code at the end of the test. If part of
|
||||
the test fails, such code will be skipped and the prior state will not be
|
||||
restored.
|
||||
|
@ -102,9 +102,9 @@
|
||||
\since 5.14
|
||||
|
||||
Constructs a new QSignalSpy that listens for emissions of the \a signal
|
||||
from the QObject \a object. If QSignalSpy is not able to listen for a
|
||||
valid signal (for example, because \a object is \nullptr or \a signal does
|
||||
not denote a valid signal of \a object), an explanatory warning message
|
||||
from the QObject \a obj. If QSignalSpy is not able to listen for a
|
||||
valid signal (for example, because \a obj is \nullptr or \a signal does
|
||||
not denote a valid signal of \a obj), an explanatory warning message
|
||||
will be output using qWarning() and subsequent calls to \c isValid() will
|
||||
return false.
|
||||
|
||||
|
@ -416,6 +416,7 @@ Options parseOptions()
|
||||
} else if (argument.compare(QLatin1String("--aab"), Qt::CaseInsensitive) == 0) {
|
||||
options.buildAAB = true;
|
||||
options.build = true;
|
||||
options.jarSigner = true;
|
||||
} else if (options.buildAAB && argument.compare(QLatin1String("--no-build"), Qt::CaseInsensitive) == 0) {
|
||||
options.build = false;
|
||||
} else if (argument.compare(QLatin1String("--install"), Qt::CaseInsensitive) == 0) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** Copyright (C) 2020 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the tools applications of the Qt Toolkit.
|
||||
@ -61,7 +61,7 @@ static const char docTypeHeader[] =
|
||||
|
||||
#define PROGRAMNAME "qdbuscpp2xml"
|
||||
#define PROGRAMVERSION "0.2"
|
||||
#define PROGRAMCOPYRIGHT "Copyright (C) 2019 The Qt Company Ltd."
|
||||
#define PROGRAMCOPYRIGHT "Copyright (C) 2020 The Qt Company Ltd."
|
||||
|
||||
static QString outputFile;
|
||||
static int flags;
|
||||
|
@ -1,6 +1,6 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** Copyright (C) 2020 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the tools applications of the Qt Toolkit.
|
||||
@ -46,7 +46,7 @@
|
||||
|
||||
#define PROGRAMNAME "qdbusxml2cpp"
|
||||
#define PROGRAMVERSION "0.8"
|
||||
#define PROGRAMCOPYRIGHT "Copyright (C) 2019 The Qt Company Ltd."
|
||||
#define PROGRAMCOPYRIGHT "Copyright (C) 2020 The Qt Company Ltd."
|
||||
|
||||
#define ANNOTATION_NO_WAIT "org.freedesktop.DBus.Method.NoReply"
|
||||
|
||||
|
@ -41,7 +41,7 @@ QT_BEGIN_NAMESPACE
|
||||
static const char *standardImports =
|
||||
R"I(from PySide2.QtCore import (QCoreApplication, QMetaObject, QObject, QPoint,
|
||||
QRect, QSize, QUrl, Qt)
|
||||
from PySide2.QtGui import (QBrush, QColor, QConicalGradient, QFont,
|
||||
from PySide2.QtGui import (QBrush, QColor, QConicalGradient, QCursor, QFont,
|
||||
QFontDatabase, QIcon, QLinearGradient, QPalette, QPainter, QPixmap,
|
||||
QRadialGradient)
|
||||
from PySide2.QtWidgets import *
|
||||
@ -114,11 +114,29 @@ void WriteImports::acceptCustomWidget(DomCustomWidget *node)
|
||||
const auto &className = node->elementClass();
|
||||
if (className.contains(QLatin1String("::")))
|
||||
return; // Exclude namespaced names (just to make tests pass).
|
||||
const QString &qtModule = qtModuleOf(node);
|
||||
const QString &importModule = qtModuleOf(node);
|
||||
auto &output = m_uic->output();
|
||||
if (!qtModule.isEmpty())
|
||||
output << "from PySide2." << qtModule << ' ';
|
||||
output << "import " << className << '\n';
|
||||
// For starting importing PySide2 modules
|
||||
if (!importModule.isEmpty()) {
|
||||
output << "from ";
|
||||
if (importModule.startsWith(QLatin1String("Qt")))
|
||||
output << "PySide2.";
|
||||
output << importModule;
|
||||
if (!className.isEmpty())
|
||||
output << " import " << className << "\n\n";
|
||||
} else {
|
||||
// When the elementHeader is not set, we know it's the continuation
|
||||
// of a PySide2 import or a normal import of another module.
|
||||
if (!node->elementHeader() || node->elementHeader()->text().isEmpty()) {
|
||||
output << "import " << className << '\n';
|
||||
} else { // When we do have elementHeader, we know it's a relative import.
|
||||
QString modulePath = node->elementHeader()->text();
|
||||
// '.h' is added by default on headers for <customwidget>
|
||||
if (modulePath.endsWith(QLatin1String(".h")))
|
||||
modulePath.chop(2);
|
||||
output << "from " << modulePath << " import " << className << '\n';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Python
|
||||
|
@ -2374,7 +2374,8 @@ QList<QUrl> QFileDialog::getOpenFileUrls(QWidget *parent,
|
||||
|
||||
This function is used to access local files on Qt for WebAssembly, where the web
|
||||
sandbox places restrictions on how such access may happen. Its implementation will
|
||||
make the browser display a native file dialog, where the user makes the file selection.
|
||||
make the browser display a native file dialog, where the user makes the file selection
|
||||
based on the parameter \a nameFilter.
|
||||
|
||||
It can also be used on other platforms, where it will fall back to using QFileDialog.
|
||||
|
||||
|
@ -1214,7 +1214,8 @@ QMimeData *QFileSystemModel::mimeData(const QModelIndexList &indexes) const
|
||||
/*!
|
||||
Handles the \a data supplied by a drag and drop operation that ended with
|
||||
the given \a action over the row in the model specified by the \a row and
|
||||
\a column and by the \a parent index.
|
||||
\a column and by the \a parent index. Returns true if the operation was
|
||||
successful.
|
||||
|
||||
\sa supportedDropActions()
|
||||
*/
|
||||
|
@ -1,6 +1,6 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2018 The Qt Company Ltd.
|
||||
** Copyright (C) 2020 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the QtWidgets module of the Qt Toolkit.
|
||||
@ -1890,7 +1890,7 @@ void QMessageBox::aboutQt(QWidget *parent, const QString &title)
|
||||
"<p>Qt and the Qt logo are trademarks of The Qt Company Ltd.</p>"
|
||||
"<p>Qt is The Qt Company Ltd product developed as an open source "
|
||||
"project. See <a href=\"http://%3/\">%3</a> for more information.</p>"
|
||||
).arg(QStringLiteral("2019"),
|
||||
).arg(QStringLiteral("2020"),
|
||||
QStringLiteral("qt.io/licensing"),
|
||||
QStringLiteral("qt.io"));
|
||||
QMessageBox *msgBox = new QMessageBox(parent);
|
||||
|
@ -414,11 +414,9 @@ bool Q_WIDGETS_EXPORT qt_tab_all_widgets()
|
||||
}
|
||||
|
||||
// ######## move to QApplicationPrivate
|
||||
// Default application palettes and fonts (per widget type)
|
||||
Q_GLOBAL_STATIC(PaletteHash, app_palettes)
|
||||
// Default fonts (per widget type)
|
||||
Q_GLOBAL_STATIC(FontHash, app_fonts)
|
||||
// Exported accessors for use outside of this file
|
||||
PaletteHash *qt_app_palettes_hash() { return app_palettes(); }
|
||||
// Exported accessor for use outside of this file
|
||||
FontHash *qt_app_fonts_hash() { return app_fonts(); }
|
||||
|
||||
QWidgetList *QApplicationPrivate::popupWidgets = 0; // has keyboard input focus
|
||||
@ -635,7 +633,7 @@ static void setPossiblePalette(const QPalette *palette, const char *className)
|
||||
{
|
||||
if (palette == 0)
|
||||
return;
|
||||
QApplicationPrivate::setPalette_helper(*palette, className, false);
|
||||
QApplicationPrivate::setPalette_helper(*palette, className);
|
||||
}
|
||||
|
||||
void QApplicationPrivate::initializeWidgetPaletteHash()
|
||||
@ -643,7 +641,8 @@ void QApplicationPrivate::initializeWidgetPaletteHash()
|
||||
QPlatformTheme *platformTheme = QGuiApplicationPrivate::platformTheme();
|
||||
if (!platformTheme)
|
||||
return;
|
||||
app_palettes()->clear();
|
||||
|
||||
widgetPalettes.clear();
|
||||
|
||||
setPossiblePalette(platformTheme->palette(QPlatformTheme::ToolButtonPalette), "QToolButton");
|
||||
setPossiblePalette(platformTheme->palette(QPlatformTheme::ButtonPalette), "QAbstractButton");
|
||||
@ -802,7 +801,7 @@ QApplication::~QApplication()
|
||||
delete QApplicationPrivate::app_pal;
|
||||
QApplicationPrivate::app_pal = 0;
|
||||
clearSystemPalette();
|
||||
app_palettes()->clear();
|
||||
QApplicationPrivate::widgetPalettes.clear();
|
||||
|
||||
delete QApplicationPrivate::sys_font;
|
||||
QApplicationPrivate::sys_font = 0;
|
||||
@ -1315,6 +1314,8 @@ void QApplication::setGlobalStrut(const QSize& strut)
|
||||
QApplicationPrivate::app_strut = strut;
|
||||
}
|
||||
|
||||
// Widget specific palettes
|
||||
QApplicationPrivate::PaletteHash QApplicationPrivate::widgetPalettes;
|
||||
|
||||
/*!
|
||||
\fn QPalette QApplication::palette(const QWidget* widget)
|
||||
@ -1329,15 +1330,13 @@ void QApplication::setGlobalStrut(const QSize& strut)
|
||||
*/
|
||||
QPalette QApplication::palette(const QWidget* w)
|
||||
{
|
||||
typedef PaletteHash::const_iterator PaletteHashConstIt;
|
||||
|
||||
PaletteHash *hash = app_palettes();
|
||||
if (w && hash && hash->size()) {
|
||||
PaletteHashConstIt it = hash->constFind(w->metaObject()->className());
|
||||
const PaletteHashConstIt cend = hash->constEnd();
|
||||
auto &widgetPalettes = QApplicationPrivate::widgetPalettes;
|
||||
if (w && !widgetPalettes.isEmpty()) {
|
||||
auto it = widgetPalettes.constFind(w->metaObject()->className());
|
||||
const auto cend = widgetPalettes.constEnd();
|
||||
if (it != cend)
|
||||
return *it;
|
||||
for (it = hash->constBegin(); it != cend; ++it) {
|
||||
for (it = widgetPalettes.constBegin(); it != cend; ++it) {
|
||||
if (w->inherits(it.key()))
|
||||
return it.value();
|
||||
}
|
||||
@ -1354,17 +1353,17 @@ QPalette QApplication::palette(const QWidget* w)
|
||||
*/
|
||||
QPalette QApplication::palette(const char *className)
|
||||
{
|
||||
PaletteHash *hash = app_palettes();
|
||||
if (className && hash && hash->size()) {
|
||||
QHash<QByteArray, QPalette>::ConstIterator it = hash->constFind(className);
|
||||
if (it != hash->constEnd())
|
||||
auto &widgetPalettes = QApplicationPrivate::widgetPalettes;
|
||||
if (className && !widgetPalettes.isEmpty()) {
|
||||
auto it = widgetPalettes.constFind(className);
|
||||
if (it != widgetPalettes.constEnd())
|
||||
return *it;
|
||||
}
|
||||
|
||||
return QGuiApplication::palette();
|
||||
}
|
||||
|
||||
void QApplicationPrivate::setPalette_helper(const QPalette &palette, const char* className, bool clearWidgetPaletteHash)
|
||||
void QApplicationPrivate::setPalette_helper(const QPalette &palette, const char* className)
|
||||
{
|
||||
QPalette pal = palette;
|
||||
|
||||
@ -1372,25 +1371,19 @@ void QApplicationPrivate::setPalette_helper(const QPalette &palette, const char*
|
||||
QApplicationPrivate::app_style->polish(pal); // NB: non-const reference
|
||||
|
||||
bool all = false;
|
||||
PaletteHash *hash = app_palettes();
|
||||
if (!className) {
|
||||
if (QApplicationPrivate::app_pal && pal.isCopyOf(*QApplicationPrivate::app_pal))
|
||||
if (!QGuiApplicationPrivate::setPalette(pal))
|
||||
return;
|
||||
if (!QApplicationPrivate::app_pal)
|
||||
QApplicationPrivate::app_pal = new QPalette(pal);
|
||||
else
|
||||
*QApplicationPrivate::app_pal = pal;
|
||||
|
||||
if (!QApplicationPrivate::sys_pal || !palette.isCopyOf(*QApplicationPrivate::sys_pal))
|
||||
QCoreApplication::setAttribute(Qt::AA_SetPalette);
|
||||
|
||||
if (hash && hash->size()) {
|
||||
if (!widgetPalettes.isEmpty()) {
|
||||
all = true;
|
||||
if (clearWidgetPaletteHash)
|
||||
hash->clear();
|
||||
widgetPalettes.clear();
|
||||
}
|
||||
} else if (hash) {
|
||||
hash->insert(className, pal);
|
||||
} else {
|
||||
widgetPalettes.insert(className, pal);
|
||||
}
|
||||
|
||||
if (qApp)
|
||||
@ -1422,7 +1415,7 @@ void QApplicationPrivate::setPalette_helper(const QPalette &palette, const char*
|
||||
|
||||
void QApplication::setPalette(const QPalette &palette, const char* className)
|
||||
{
|
||||
QApplicationPrivate::setPalette_helper(palette, className, /*clearWidgetPaletteHash=*/ true);
|
||||
QApplicationPrivate::setPalette_helper(palette, className);
|
||||
}
|
||||
|
||||
|
||||
|
@ -94,9 +94,6 @@ extern QClipboard *qt_clipboard;
|
||||
typedef QHash<QByteArray, QFont> FontHash;
|
||||
Q_WIDGETS_EXPORT FontHash *qt_app_fonts_hash();
|
||||
|
||||
typedef QHash<QByteArray, QPalette> PaletteHash;
|
||||
PaletteHash *qt_app_palettes_hash();
|
||||
|
||||
#define QApplicationPrivateBase QGuiApplicationPrivate
|
||||
|
||||
class Q_WIDGETS_EXPORT QApplicationPrivate : public QApplicationPrivateBase
|
||||
@ -188,11 +185,14 @@ public:
|
||||
static bool widgetCount; // Coupled with -widgetcount switch
|
||||
|
||||
static void setSystemPalette(const QPalette &pal);
|
||||
static void setPalette_helper(const QPalette &palette, const char* className, bool clearWidgetPaletteHash);
|
||||
static void setPalette_helper(const QPalette &palette, const char* className);
|
||||
static void initializeWidgetPaletteHash();
|
||||
static void initializeWidgetFontHash();
|
||||
static void setSystemFont(const QFont &font);
|
||||
|
||||
using PaletteHash = QHash<QByteArray, QPalette>;
|
||||
static PaletteHash widgetPalettes;
|
||||
|
||||
static QApplicationPrivate *instance() { return self; }
|
||||
|
||||
#ifdef QT_KEYPAD_NAVIGATION
|
||||
|
@ -475,7 +475,7 @@ QShortcut::QShortcut(QWidget *parent)
|
||||
match the \a key sequence. Depending on the ambiguity of the
|
||||
event, the shortcut will call the \a member function, or the \a
|
||||
ambiguousMember function, if the key press was in the shortcut's
|
||||
\a shortcutContext.
|
||||
\a context.
|
||||
*/
|
||||
QShortcut::QShortcut(const QKeySequence &key, QWidget *parent,
|
||||
const char *member, const char *ambiguousMember,
|
||||
|
@ -5955,7 +5955,11 @@ void QWidget::setWindowTitle(const QString &title)
|
||||
has been set, windowIcon() returns the application icon
|
||||
(QApplication::windowIcon()).
|
||||
|
||||
\sa windowTitle
|
||||
\note On \macos, window icons represent the active document,
|
||||
and will not be displayed unless a file path has also been
|
||||
set using setFilePath.
|
||||
|
||||
\sa windowTitle, setFilePath
|
||||
*/
|
||||
QIcon QWidget::windowIcon() const
|
||||
{
|
||||
|
@ -216,7 +216,7 @@ QDateTimeEdit::~QDateTimeEdit()
|
||||
|
||||
/*!
|
||||
\property QDateTimeEdit::dateTime
|
||||
\brief the QDateTime that is set in the QDateTimeEdit
|
||||
\brief The QDateTime that is set in the QDateTimeEdit.
|
||||
|
||||
When setting this property the timespec of the QDateTimeEdit remains the same
|
||||
and the timespec of the new QDateTime is ignored.
|
||||
@ -253,7 +253,7 @@ void QDateTimeEdit::setDateTime(const QDateTime &datetime)
|
||||
|
||||
/*!
|
||||
\property QDateTimeEdit::date
|
||||
\brief the QDate that is set in the widget
|
||||
\brief The QDate that is set in the widget.
|
||||
|
||||
By default, this property contains a date that refers to January 1, 2000.
|
||||
|
||||
@ -290,7 +290,7 @@ void QDateTimeEdit::setDate(const QDate &date)
|
||||
|
||||
/*!
|
||||
\property QDateTimeEdit::time
|
||||
\brief the QTime that is set in the widget
|
||||
\brief The QTime that is set in the widget.
|
||||
|
||||
By default, this property contains a time of 00:00:00 and 0 milliseconds.
|
||||
|
||||
@ -335,7 +335,8 @@ void QDateTimeEdit::setCalendar(QCalendar calendar)
|
||||
/*!
|
||||
\since 4.4
|
||||
\property QDateTimeEdit::minimumDateTime
|
||||
\brief the minimum datetime of the date time edit
|
||||
|
||||
\brief The minimum datetime of the date time edit.
|
||||
|
||||
Changing this property implicitly updates the \l minimumDate and \l
|
||||
minimumTime properties to the date and time parts of this property,
|
||||
@ -376,7 +377,7 @@ void QDateTimeEdit::setMinimumDateTime(const QDateTime &dt)
|
||||
\since 4.4
|
||||
\property QDateTimeEdit::maximumDateTime
|
||||
|
||||
\brief the maximum datetime of the date time edit
|
||||
\brief The maximum datetime of the date time edit.
|
||||
|
||||
Changing this property implicitly updates the \l maximumDate and \l
|
||||
maximumTime properties to the date and time parts of this property,
|
||||
@ -444,7 +445,7 @@ void QDateTimeEdit::setDateTimeRange(const QDateTime &min, const QDateTime &max)
|
||||
/*!
|
||||
\property QDateTimeEdit::minimumDate
|
||||
|
||||
\brief the minimum date of the date time edit
|
||||
\brief The minimum date of the date time edit.
|
||||
|
||||
Changing this property updates the date of the \l minimumDateTime property
|
||||
while preserving the \l minimumTime property. When setting this property,
|
||||
@ -484,7 +485,7 @@ void QDateTimeEdit::clearMinimumDate()
|
||||
/*!
|
||||
\property QDateTimeEdit::maximumDate
|
||||
|
||||
\brief the maximum date of the date time edit
|
||||
\brief The maximum date of the date time edit.
|
||||
|
||||
Changing this property updates the date of the \l maximumDateTime property
|
||||
while preserving the \l maximumTime property. When setting this property, the
|
||||
@ -523,7 +524,7 @@ void QDateTimeEdit::clearMaximumDate()
|
||||
/*!
|
||||
\property QDateTimeEdit::minimumTime
|
||||
|
||||
\brief the minimum time of the date time edit
|
||||
\brief The minimum time of the date time edit.
|
||||
|
||||
Changing this property updates the time of the \l minimumDateTime property
|
||||
while preserving the \l minimumDate and \l maximumDate properties. If those
|
||||
@ -562,7 +563,7 @@ void QDateTimeEdit::clearMinimumTime()
|
||||
/*!
|
||||
\property QDateTimeEdit::maximumTime
|
||||
|
||||
\brief the maximum time of the date time edit
|
||||
\brief The maximum time of the date time edit.
|
||||
|
||||
Changing this property updates the time of the \l maximumDateTime property
|
||||
while preserving the \l minimumDate and \l maximumDate properties. If those
|
||||
@ -665,7 +666,7 @@ void QDateTimeEdit::setTimeRange(const QTime &min, const QTime &max)
|
||||
/*!
|
||||
\property QDateTimeEdit::displayedSections
|
||||
|
||||
\brief the currently displayed fields of the date time edit
|
||||
\brief The currently displayed fields of the date time edit.
|
||||
|
||||
Returns a bit set of the displayed sections for this format.
|
||||
\a setDisplayFormat(), displayFormat()
|
||||
@ -680,7 +681,7 @@ QDateTimeEdit::Sections QDateTimeEdit::displayedSections() const
|
||||
/*!
|
||||
\property QDateTimeEdit::currentSection
|
||||
|
||||
\brief the current section of the spinbox
|
||||
\brief The current section of the spinbox.
|
||||
\a setCurrentSection()
|
||||
*/
|
||||
|
||||
@ -739,7 +740,7 @@ QDateTimeEdit::Section QDateTimeEdit::sectionAt(int index) const
|
||||
|
||||
\property QDateTimeEdit::sectionCount
|
||||
|
||||
\brief the number of sections displayed.
|
||||
\brief The number of sections displayed.
|
||||
If the format is 'yyyy/yy/yyyy', sectionCount returns 3
|
||||
*/
|
||||
|
||||
@ -755,7 +756,7 @@ int QDateTimeEdit::sectionCount() const
|
||||
|
||||
\property QDateTimeEdit::currentSectionIndex
|
||||
|
||||
\brief the current section index of the spinbox
|
||||
\brief The current section index of the spinbox.
|
||||
|
||||
If the format is 'yyyy/MM/dd', the displayText is '2001/05/21', and
|
||||
the cursorPosition is 5, currentSectionIndex returns 1. If the
|
||||
@ -879,7 +880,7 @@ QString QDateTimeEdit::sectionText(Section section) const
|
||||
/*!
|
||||
\property QDateTimeEdit::displayFormat
|
||||
|
||||
\brief the format used to display the time/date of the date time edit
|
||||
\brief The format used to display the time/date of the date time edit.
|
||||
|
||||
This format is described in QDateTime::toString() and QDateTime::fromString()
|
||||
|
||||
@ -951,7 +952,7 @@ void QDateTimeEdit::setDisplayFormat(const QString &format)
|
||||
|
||||
/*!
|
||||
\property QDateTimeEdit::calendarPopup
|
||||
\brief the current calendar pop-up show mode.
|
||||
\brief The current calendar pop-up show mode.
|
||||
\since 4.2
|
||||
|
||||
The calendar pop-up will be shown upon clicking the arrow button.
|
||||
@ -983,7 +984,7 @@ void QDateTimeEdit::setCalendarPopup(bool enable)
|
||||
|
||||
/*!
|
||||
\property QDateTimeEdit::timeSpec
|
||||
\brief the current timespec used by the date time edit.
|
||||
\brief The current timespec used by the date time edit.
|
||||
\since 4.4
|
||||
*/
|
||||
|
||||
|
@ -497,14 +497,20 @@ bool QScrollBar::event(QEvent *event)
|
||||
void QScrollBar::wheelEvent(QWheelEvent *event)
|
||||
{
|
||||
event->ignore();
|
||||
bool horizontal = qAbs(event->angleDelta().x()) > qAbs(event->angleDelta().y());
|
||||
// The vertical wheel can be used to scroll a horizontal scrollbar, but only if
|
||||
// there is no simultaneous horizontal wheel movement. This is to avoid chaotic
|
||||
// scrolling on touchpads.
|
||||
if (!horizontal && event->angleDelta().x() != 0 && orientation() == Qt::Horizontal)
|
||||
return;
|
||||
// scrollbar is a special case - in vertical mode it reaches minimum
|
||||
// value in the upper position, however QSlider's minimum value is on
|
||||
// the bottom. So we need to invert the value, but since the scrollbar is
|
||||
// inverted by default, we need to invert the delta value only for the
|
||||
// horizontal orientation.
|
||||
int delta = (orientation() == Qt::Horizontal ? -event->angleDelta().x() : event->angleDelta().y());
|
||||
int delta = horizontal ? -event->angleDelta().x() : event->angleDelta().y();
|
||||
Q_D(QScrollBar);
|
||||
if (d->scrollByDelta(orientation(), event->modifiers(), delta))
|
||||
if (d->scrollByDelta(horizontal ? Qt::Horizontal : Qt::Vertical, event->modifiers(), delta))
|
||||
event->accept();
|
||||
|
||||
if (event->phase() == Qt::ScrollBegin)
|
||||
|
@ -823,7 +823,7 @@ void QTextBrowser::setSource(const QUrl &url)
|
||||
/*!
|
||||
Attempts to load the document at the given \a url with the specified \a type.
|
||||
|
||||
If \a type is \l {QTextDocument::ResourceType::UnknownResource}{UnknownResource}
|
||||
If \a type is \l {QTextDocument::UnknownResource}{UnknownResource}
|
||||
(the default), the document type will be detected: that is, if the url ends
|
||||
with an extension of \c{.md}, \c{.mkd} or \c{.markdown}, the document will be
|
||||
loaded via \l QTextDocument::setMarkdown(); otherwise it will be loaded via
|
||||
|
@ -1,6 +1,6 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** Copyright (C) 2020 The Qt Company Ltd.
|
||||
** Copyright (C) 2014 Olivier Goffart <ogoffart@woboq.com>
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
@ -767,18 +767,18 @@ void tst_qmessagehandler::qMessagePattern_data()
|
||||
QTest::qWait(10000);
|
||||
QTest::newRow("time") << "/%{time yyyy - MM - d}/%{message}"
|
||||
<< true << (QList<QByteArray>()
|
||||
<< ('/' + QDateTime::currentDateTime().toString("yyyy - MM - d").toUtf8() + "/qDebug"));
|
||||
<< ('/' + QDateTime::currentDateTime().toString("yyyy - MM - d").toLocal8Bit() + "/qDebug"));
|
||||
|
||||
QTest::newRow("time-time") << "/%{time yyyy - MM - d}/%{time dd-MM-yy}/%{message}"
|
||||
<< true << (QList<QByteArray>()
|
||||
<< ('/' + QDateTime::currentDateTime().toString("yyyy - MM - d").toUtf8()
|
||||
+ '/' + QDateTime::currentDateTime().toString("dd-MM-yy").toUtf8()
|
||||
<< ('/' + QDateTime::currentDateTime().toString("yyyy - MM - d").toLocal8Bit()
|
||||
+ '/' + QDateTime::currentDateTime().toString("dd-MM-yy").toLocal8Bit()
|
||||
+ "/qDebug"));
|
||||
|
||||
QTest::newRow("skipped-time-shown-time")
|
||||
<< "/%{if-warning}%{time yyyy - MM - d}%{endif}%{if-debug}%{time dd-MM-yy}%{endif}/%{message}"
|
||||
<< true << (QList<QByteArray>()
|
||||
<< ('/' + QDateTime::currentDateTime().toString("dd-MM-yy").toUtf8() + "/qDebug"));
|
||||
<< ('/' + QDateTime::currentDateTime().toString("dd-MM-yy").toLocal8Bit() + "/qDebug"));
|
||||
|
||||
// %{time} should have a padding of 6 so if it takes less than 10 seconds to show
|
||||
// the first message, there should be 5 spaces
|
||||
|
@ -34,6 +34,9 @@
|
||||
#include <QElapsedTimer>
|
||||
#include <QTextStream>
|
||||
#include <QDir>
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
/* All tests need to run in temporary directories not used
|
||||
* by the application to avoid non-deterministic failures on Windows
|
||||
@ -79,6 +82,9 @@ private slots:
|
||||
void signalsEmittedAfterFileMoved();
|
||||
|
||||
void watchUnicodeCharacters();
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
|
||||
void watchDirectoryAttributeChanges();
|
||||
#endif
|
||||
|
||||
private:
|
||||
QString m_tempDirPattern;
|
||||
@ -813,5 +819,27 @@ void tst_QFileSystemWatcher::watchUnicodeCharacters()
|
||||
QTRY_COMPARE(changedSpy.count(), 1);
|
||||
}
|
||||
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
|
||||
void tst_QFileSystemWatcher::watchDirectoryAttributeChanges()
|
||||
{
|
||||
QTemporaryDir temporaryDirectory(m_tempDirPattern);
|
||||
QVERIFY2(temporaryDirectory.isValid(), qPrintable(temporaryDirectory.errorString()));
|
||||
|
||||
QDir testDir(temporaryDirectory.path());
|
||||
const QString subDir(QString::fromLatin1("attrib_test"));
|
||||
QVERIFY(testDir.mkdir(subDir));
|
||||
testDir = QDir(temporaryDirectory.path() + QDir::separator() + subDir);
|
||||
|
||||
QFileSystemWatcher watcher;
|
||||
QVERIFY(watcher.addPath(temporaryDirectory.path()));
|
||||
FileSystemWatcherSpy changedSpy(&watcher, FileSystemWatcherSpy::SpyOnDirectoryChanged);
|
||||
QCOMPARE(changedSpy.count(), 0);
|
||||
QVERIFY(SetFileAttributes(reinterpret_cast<LPCWSTR>(testDir.absolutePath().utf16()), FILE_ATTRIBUTE_HIDDEN) != 0);
|
||||
QTRY_COMPARE(changedSpy.count(), 1);
|
||||
QVERIFY(SetFileAttributes(reinterpret_cast<LPCWSTR>(testDir.absolutePath().utf16()), FILE_ATTRIBUTE_NORMAL) != 0);
|
||||
QTRY_COMPARE(changedSpy.count(), 2);
|
||||
}
|
||||
#endif
|
||||
|
||||
QTEST_MAIN(tst_QFileSystemWatcher)
|
||||
#include "tst_qfilesystemwatcher.moc"
|
||||
|
@ -1,6 +1,6 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** Copyright (C) 2020 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the test suite of the Qt Toolkit.
|
||||
@ -65,7 +65,7 @@ void tst_QNoDebug::noDebugOutput() const
|
||||
void tst_QNoDebug::streaming() const
|
||||
{
|
||||
QDateTime dt(QDate(1,2,3),QTime(4,5,6));
|
||||
const QByteArray debugString = dt.toString(u"yyyy-MM-dd HH:mm:ss.zzz t").toLatin1();
|
||||
const QByteArray debugString = dt.toString(u"yyyy-MM-dd HH:mm:ss.zzz t").toLocal8Bit();
|
||||
const QByteArray message = "QDateTime(" + debugString + " Qt::LocalTime)";
|
||||
QTest::ignoreMessage(QtWarningMsg, message.constData());
|
||||
qWarning() << dt;
|
||||
|
@ -6719,16 +6719,16 @@ void tst_QObject::connectWarnings()
|
||||
ReceiverObject r1;
|
||||
r1.reset();
|
||||
|
||||
QTest::ignoreMessage(QtWarningMsg, "QObject::connect(SenderObject, ReceiverObject): invalid null parameter");
|
||||
QTest::ignoreMessage(QtWarningMsg, "QObject::connect(SenderObject, ReceiverObject): invalid nullptr parameter");
|
||||
connect(static_cast<const SenderObject *>(nullptr), &SubSender::signal1, &r1, &ReceiverObject::slot1);
|
||||
|
||||
QTest::ignoreMessage(QtWarningMsg, "QObject::connect(SubSender, Unknown): invalid null parameter");
|
||||
QTest::ignoreMessage(QtWarningMsg, "QObject::connect(SubSender, Unknown): invalid nullptr parameter");
|
||||
connect(&sub, &SubSender::signal1, static_cast<ReceiverObject *>(nullptr), &ReceiverObject::slot1);
|
||||
|
||||
QTest::ignoreMessage(QtWarningMsg, "QObject::connect(SenderObject, ReceiverObject): invalid null parameter");
|
||||
QTest::ignoreMessage(QtWarningMsg, "QObject::connect(SenderObject, ReceiverObject): invalid nullptr parameter");
|
||||
connect(static_cast<const SenderObject *>(nullptr), &SenderObject::signal1, &r1, &ReceiverObject::slot1);
|
||||
|
||||
QTest::ignoreMessage(QtWarningMsg, "QObject::connect(SenderObject, Unknown): invalid null parameter");
|
||||
QTest::ignoreMessage(QtWarningMsg, "QObject::connect(SenderObject, Unknown): invalid nullptr parameter");
|
||||
connect(&obj, &SenderObject::signal1, static_cast<ReceiverObject *>(nullptr), &ReceiverObject::slot1);
|
||||
}
|
||||
|
||||
|
@ -459,8 +459,8 @@ private slots:
|
||||
void trimmed();
|
||||
void toUpper();
|
||||
void toLower();
|
||||
void isUpper();
|
||||
void isLower();
|
||||
void isLower_isUpper_data();
|
||||
void isLower_isUpper();
|
||||
void toCaseFolded();
|
||||
void rightJustified();
|
||||
void leftJustified();
|
||||
@ -2311,44 +2311,83 @@ void tst_QString::toLower()
|
||||
#endif // icu
|
||||
}
|
||||
|
||||
void tst_QString::isUpper()
|
||||
void tst_QString::isLower_isUpper_data()
|
||||
{
|
||||
QVERIFY(!QString().isUpper());
|
||||
QVERIFY(!QString("").isUpper());
|
||||
QVERIFY(QString("TEXT").isUpper());
|
||||
QVERIFY(!QString("text").isUpper());
|
||||
QVERIFY(!QString("Text").isUpper());
|
||||
QVERIFY(!QString("tExt").isUpper());
|
||||
QVERIFY(!QString("teXt").isUpper());
|
||||
QVERIFY(!QString("texT").isUpper());
|
||||
QVERIFY(!QString("TExt").isUpper());
|
||||
QVERIFY(!QString("teXT").isUpper());
|
||||
QVERIFY(!QString("tEXt").isUpper());
|
||||
QVERIFY(!QString("tExT").isUpper());
|
||||
QVERIFY(!QString("@ABYZ[").isUpper());
|
||||
QVERIFY(!QString("@abyz[").isUpper());
|
||||
QVERIFY(!QString("`ABYZ{").isUpper());
|
||||
QVERIFY(!QString("`abyz{").isUpper());
|
||||
QTest::addColumn<QString>("string");
|
||||
QTest::addColumn<bool>("isLower");
|
||||
QTest::addColumn<bool>("isUpper");
|
||||
|
||||
int row = 0;
|
||||
QTest::addRow("lower-and-upper-%02d", row++) << QString() << true << true;
|
||||
QTest::addRow("lower-and-upper-%02d", row++) << QString("") << true << true;
|
||||
QTest::addRow("lower-and-upper-%02d", row++) << QString(" ") << true << true;
|
||||
QTest::addRow("lower-and-upper-%02d", row++) << QString("123") << true << true;
|
||||
QTest::addRow("lower-and-upper-%02d", row++) << QString("@123$#") << true << true;
|
||||
QTest::addRow("lower-and-upper-%02d", row++) << QString("𝄞𝄴𝆏♫") << true << true; // Unicode Block 'Musical Symbols'
|
||||
// not foldable
|
||||
QTest::addRow("lower-and-upper-%02d", row++) << QString("𝚊𝚋𝚌𝚍𝚎") << true << true; // MATHEMATICAL MONOSPACE SMALL A, ... E
|
||||
QTest::addRow("lower-and-upper-%02d", row++) << QString("𝙖,𝙗,𝙘,𝙙,𝙚") << true << true; // MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL A, ... E
|
||||
QTest::addRow("lower-and-upper-%02d", row++) << QString("𝗔𝗕𝗖𝗗𝗘") << true << true; // MATHEMATICAL SANS-SERIF BOLD CAPITAL A, ... E
|
||||
QTest::addRow("lower-and-upper-%02d", row++) << QString("𝐀,𝐁,𝐂,𝐃,𝐄") << true << true; // MATHEMATICAL BOLD CAPITAL A, ... E
|
||||
|
||||
row = 0;
|
||||
QTest::addRow("only-lower-%02d", row++) << QString("text") << true << false;
|
||||
QTest::addRow("only-lower-%02d", row++) << QString("àaa") << true << false;
|
||||
QTest::addRow("only-lower-%02d", row++) << QString("øæß") << true << false;
|
||||
QTest::addRow("only-lower-%02d", row++) << QString("text ") << true << false;
|
||||
QTest::addRow("only-lower-%02d", row++) << QString(" text") << true << false;
|
||||
QTest::addRow("only-lower-%02d", row++) << QString("hello, world!") << true << false;
|
||||
QTest::addRow("only-lower-%02d", row++) << QString("123@abyz[") << true << false;
|
||||
QTest::addRow("only-lower-%02d", row++) << QString("`abyz{") << true << false;
|
||||
QTest::addRow("only-lower-%02d", row++) << QString("a𝙖a|b𝙗b|c𝙘c|d𝙙d|e𝙚e") << true << false; // MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL A, ... E
|
||||
QTest::addRow("only-lower-%02d", row++) << QString("𐐨") << true << false; // DESERET SMALL LETTER LONG I
|
||||
// uppercase letters, not foldable
|
||||
QTest::addRow("only-lower-%02d", row++) << QString("text𝗔text") << true << false; // MATHEMATICAL SANS-SERIF BOLD CAPITAL A
|
||||
|
||||
row = 0;
|
||||
QTest::addRow("only-upper-%02d", row++) << QString("TEXT") << false << true;
|
||||
QTest::addRow("only-upper-%02d", row++) << QString("ÀAA") << false << true;
|
||||
QTest::addRow("only-upper-%02d", row++) << QString("ØÆẞ") << false << true;
|
||||
QTest::addRow("only-upper-%02d", row++) << QString("TEXT ") << false << true;
|
||||
QTest::addRow("only-upper-%02d", row++) << QString(" TEXT") << false << true;
|
||||
QTest::addRow("only-upper-%02d", row++) << QString("HELLO, WORLD!") << false << true;
|
||||
QTest::addRow("only-upper-%02d", row++) << QString("123@ABYZ[") << false << true;
|
||||
QTest::addRow("only-upper-%02d", row++) << QString("`ABYZ{") << false << true;
|
||||
QTest::addRow("only-upper-%02d", row++) << QString("A𝐀A|B𝐁B|C𝐂C|D𝐃D|E𝐄E") << false << true; // MATHEMATICAL BOLD CAPITAL A, ... E
|
||||
QTest::addRow("only-upper-%02d", row++) << QString("𐐀") << false << true; // DESERET CAPITAL LETTER LONG I
|
||||
// lowercase letters, not foldable
|
||||
QTest::addRow("only-upper-%02d", row++) << QString("TEXT𝚊TEXT") << false << true; // MATHEMATICAL MONOSPACE SMALL A
|
||||
|
||||
row = 0;
|
||||
QTest::addRow("not-lower-nor-upper-%02d", row++) << QString("Text") << false << false;
|
||||
QTest::addRow("not-lower-nor-upper-%02d", row++) << QString("tExt") << false << false;
|
||||
QTest::addRow("not-lower-nor-upper-%02d", row++) << QString("teXt") << false << false;
|
||||
QTest::addRow("not-lower-nor-upper-%02d", row++) << QString("texT") << false << false;
|
||||
QTest::addRow("not-lower-nor-upper-%02d", row++) << QString("TExt") << false << false;
|
||||
QTest::addRow("not-lower-nor-upper-%02d", row++) << QString("teXT") << false << false;
|
||||
QTest::addRow("not-lower-nor-upper-%02d", row++) << QString("tEXt") << false << false;
|
||||
QTest::addRow("not-lower-nor-upper-%02d", row++) << QString("tExT") << false << false;
|
||||
// not foldable
|
||||
QTest::addRow("not-lower-nor-upper-%02d", row++) << QString("TEXT𝚊text") << false << false; // MATHEMATICAL MONOSPACE SMALL A
|
||||
QTest::addRow("not-lower-nor-upper-%02d", row++) << QString("text𝗔TEXT") << false << false; // MATHEMATICAL SANS-SERIF BOLD CAPITAL A
|
||||
// titlecase, foldable
|
||||
QTest::addRow("not-lower-nor-upper-%02d", row++) << QString("abcLjdef") << false << false; // LATIN CAPITAL LETTER L WITH SMALL LETTER J
|
||||
QTest::addRow("not-lower-nor-upper-%02d", row++) << QString("ABCLjDEF") << false << false; // LATIN CAPITAL LETTER L WITH SMALL LETTER J
|
||||
}
|
||||
|
||||
void tst_QString::isLower()
|
||||
void tst_QString::isLower_isUpper()
|
||||
{
|
||||
QVERIFY(!QString().isLower());
|
||||
QVERIFY(!QString("").isLower());
|
||||
QVERIFY(QString("text").isLower());
|
||||
QVERIFY(!QString("Text").isLower());
|
||||
QVERIFY(!QString("tExt").isLower());
|
||||
QVERIFY(!QString("teXt").isLower());
|
||||
QVERIFY(!QString("texT").isLower());
|
||||
QVERIFY(!QString("TExt").isLower());
|
||||
QVERIFY(!QString("teXT").isLower());
|
||||
QVERIFY(!QString("tEXt").isLower());
|
||||
QVERIFY(!QString("tExT").isLower());
|
||||
QVERIFY(!QString("TEXT").isLower());
|
||||
QVERIFY(!QString("@ABYZ[").isLower());
|
||||
QVERIFY(!QString("@abyz[").isLower());
|
||||
QVERIFY(!QString("`ABYZ{").isLower());
|
||||
QVERIFY(!QString("`abyz{").isLower());
|
||||
QFETCH(QString, string);
|
||||
QFETCH(bool, isLower);
|
||||
QFETCH(bool, isUpper);
|
||||
|
||||
QCOMPARE(string.isLower(), isLower);
|
||||
QCOMPARE(string.toLower() == string, isLower);
|
||||
QVERIFY(string.toLower().isLower());
|
||||
|
||||
QCOMPARE(string.isUpper(), isUpper);
|
||||
QCOMPARE(string.toUpper() == string, isUpper);
|
||||
QVERIFY(string.toUpper().isUpper());
|
||||
}
|
||||
|
||||
void tst_QString::toCaseFolded()
|
||||
|
@ -88,7 +88,7 @@ private slots:
|
||||
void toStringDateFormat();
|
||||
void isLeapYear();
|
||||
void yearsZeroToNinetyNine();
|
||||
void negativeYear() const;
|
||||
void printNegativeYear_data() const;
|
||||
void printNegativeYear() const;
|
||||
void roundtripGermanLocale() const;
|
||||
#if QT_CONFIG(textdate) && QT_DEPRECATED_SINCE(5, 10)
|
||||
@ -1458,33 +1458,28 @@ void tst_QDate::yearsZeroToNinetyNine()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void tst_QDate::negativeYear() const
|
||||
void tst_QDate::printNegativeYear_data() const
|
||||
{
|
||||
QDate y(-20, 3, 4);
|
||||
QVERIFY(y.isValid());
|
||||
QCOMPARE(y.year(), -20);
|
||||
QTest::addColumn<int>("year");
|
||||
QTest::addColumn<QString>("expect");
|
||||
QTest::newRow("millennium") << -1000 << QStringLiteral("-1000");
|
||||
QTest::newRow("century") << -500 << QStringLiteral("-0500");
|
||||
QTest::newRow("decade") << -20 << QStringLiteral("-0020");
|
||||
QTest::newRow("year") << -7 << QStringLiteral("-0007");
|
||||
}
|
||||
|
||||
void tst_QDate::printNegativeYear() const
|
||||
{
|
||||
{
|
||||
QDate date(-500, 3, 4);
|
||||
QVERIFY(date.isValid());
|
||||
QCOMPARE(date.toString(QLatin1String("yyyy")), QString::fromLatin1("-0500"));
|
||||
}
|
||||
QFETCH(int, year);
|
||||
QFETCH(QString, expect);
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
expect.replace(QLatin1Char('-'), QLocale().negativeSign());
|
||||
#endif
|
||||
|
||||
{
|
||||
QDate date(-10, 3, 4);
|
||||
QVERIFY(date.isValid());
|
||||
QCOMPARE(date.toString(QLatin1String("yyyy")), QString::fromLatin1("-0010"));
|
||||
}
|
||||
|
||||
{
|
||||
QDate date(-2, 3, 4);
|
||||
QVERIFY(date.isValid());
|
||||
QCOMPARE(date.toString(QLatin1String("yyyy")), QString::fromLatin1("-0002"));
|
||||
}
|
||||
QDate date(year, 3, 4);
|
||||
QVERIFY(date.isValid());
|
||||
QCOMPARE(date.year(), year);
|
||||
QCOMPARE(date.toString(QLatin1String("yyyy")), expect);
|
||||
}
|
||||
|
||||
void tst_QDate::roundtripGermanLocale() const
|
||||
|
@ -55,12 +55,13 @@ private slots:
|
||||
void thematicBreaks();
|
||||
void lists_data();
|
||||
void lists();
|
||||
void avoidBlankLineAtBeginning_data();
|
||||
void avoidBlankLineAtBeginning();
|
||||
};
|
||||
|
||||
void tst_QTextMarkdownImporter::headingBulletsContinuations()
|
||||
{
|
||||
const QStringList expectedBlocks = QStringList() <<
|
||||
"" << // we could do without this blank line before the heading, but currently it happens
|
||||
"heading" <<
|
||||
"bullet 1 continuation line 1, indented via tab" <<
|
||||
"bullet 2 continuation line 2, indented via 4 spaces" <<
|
||||
@ -222,5 +223,38 @@ void tst_QTextMarkdownImporter::lists()
|
||||
QCOMPARE(doc.toMarkdown(), rewrite);
|
||||
}
|
||||
|
||||
void tst_QTextMarkdownImporter::avoidBlankLineAtBeginning_data()
|
||||
{
|
||||
QTest::addColumn<QString>("input");
|
||||
QTest::addColumn<int>("expectedNumberOfParagraphs");
|
||||
|
||||
QTest::newRow("Text block") << QString("Markdown text") << 1;
|
||||
QTest::newRow("Headline") << QString("Markdown text\n============") << 1;
|
||||
QTest::newRow("Code block") << QString(" Markdown text") << 2;
|
||||
QTest::newRow("Unordered list") << QString("* Markdown text") << 1;
|
||||
QTest::newRow("Ordered list") << QString("1. Markdown text") << 1;
|
||||
QTest::newRow("Blockquote") << QString("> Markdown text") << 1;
|
||||
}
|
||||
|
||||
void tst_QTextMarkdownImporter::avoidBlankLineAtBeginning() // QTBUG-81060
|
||||
{
|
||||
QFETCH(QString, input);
|
||||
QFETCH(int, expectedNumberOfParagraphs);
|
||||
|
||||
QTextDocument doc;
|
||||
QTextMarkdownImporter(QTextMarkdownImporter::DialectGitHub).import(&doc, input);
|
||||
QTextFrame::iterator iterator = doc.rootFrame()->begin();
|
||||
int i = 0;
|
||||
while (!iterator.atEnd()) {
|
||||
QTextBlock block = iterator.currentBlock();
|
||||
// Make sure there is no empty paragraph at the beginning of the document
|
||||
if (i == 0)
|
||||
QVERIFY(!block.text().isEmpty());
|
||||
++iterator;
|
||||
++i;
|
||||
}
|
||||
QCOMPARE(i, expectedNumberOfParagraphs);
|
||||
}
|
||||
|
||||
QTEST_MAIN(tst_QTextMarkdownImporter)
|
||||
#include "tst_qtextmarkdownimporter.moc"
|
||||
|
@ -215,7 +215,8 @@ void tst_QFtp::initTestCase()
|
||||
QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::socksProxyServerName(), 1080));
|
||||
QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::httpProxyServerName(), 3128));
|
||||
#else
|
||||
QVERIFY(QtNetworkSettings::verifyTestNetworkSettings());
|
||||
if (!QtNetworkSettings::verifyTestNetworkSettings())
|
||||
QSKIP("No network test server available");
|
||||
#endif
|
||||
#ifndef QT_NO_BEARERMANAGEMENT
|
||||
QNetworkConfigurationManager manager;
|
||||
|
@ -105,7 +105,8 @@ void tst_QHttpNetworkConnection::initTestCase()
|
||||
#if defined(QT_TEST_SERVER)
|
||||
QVERIFY(QtNetworkSettings::verifyConnection(httpServerName(), 80));
|
||||
#else
|
||||
QVERIFY(QtNetworkSettings::verifyTestNetworkSettings());
|
||||
if (!QtNetworkSettings::verifyTestNetworkSettings())
|
||||
QSKIP("No network test server available");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -100,7 +100,8 @@ tst_Spdy::~tst_Spdy()
|
||||
void tst_Spdy::initTestCase()
|
||||
{
|
||||
QVERIFY(!m_rfc3252FilePath.isEmpty());
|
||||
QVERIFY(QtNetworkSettings::verifyTestNetworkSettings());
|
||||
if (!QtNetworkSettings::verifyTestNetworkSettings())
|
||||
QSKIP("No network test server available");
|
||||
}
|
||||
|
||||
void tst_Spdy::settingsAndNegotiation_data()
|
||||
|
@ -1,5 +1,6 @@
|
||||
TEMPLATE=subdirs
|
||||
SUBDIRS=\
|
||||
selftest \
|
||||
access \
|
||||
bearer \
|
||||
kernel \
|
||||
|
6
tests/auto/network/selftest/selftest.pro
Normal file
6
tests/auto/network/selftest/selftest.pro
Normal file
@ -0,0 +1,6 @@
|
||||
CONFIG += testcase
|
||||
TARGET = tst_networkselftest
|
||||
SOURCES += tst_networkselftest.cpp
|
||||
|
||||
requires(qtConfig(private_tests))
|
||||
QT = core network network-private testlib
|
55
tests/auto/network/selftest/tst_networkselftest.cpp
Normal file
55
tests/auto/network/selftest/tst_networkselftest.cpp
Normal file
@ -0,0 +1,55 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2020 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the test suite of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:GPL-EXCEPT$
|
||||
** 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.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
|
||||
#include <QtTest/QtTest>
|
||||
|
||||
#include "../../network-settings.h"
|
||||
|
||||
class tst_NetworkSelftest : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private slots:
|
||||
void testServerIsAvailableInCI();
|
||||
};
|
||||
|
||||
void tst_NetworkSelftest::testServerIsAvailableInCI()
|
||||
{
|
||||
if (!qEnvironmentVariable("QTEST_ENVIRONMENT").split(' ').contains("ci"))
|
||||
QSKIP("Not running in the CI");
|
||||
|
||||
#if !defined(QT_TEST_SERVER)
|
||||
QVERIFY2(QtNetworkSettings::verifyTestNetworkSettings(),
|
||||
"Test server must be available when running in the CI");
|
||||
#endif
|
||||
}
|
||||
|
||||
QTEST_MAIN(tst_NetworkSelftest)
|
||||
|
||||
#include "tst_networkselftest.moc"
|
@ -87,7 +87,8 @@ private slots:
|
||||
|
||||
void tst_PlatformSocketEngine::initTestCase()
|
||||
{
|
||||
QVERIFY(QtNetworkSettings::verifyTestNetworkSettings());
|
||||
if (!QtNetworkSettings::verifyTestNetworkSettings())
|
||||
QSKIP("No network test server available");
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -129,7 +129,8 @@ void tst_QHttpSocketEngine::initTestCase()
|
||||
QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::httpServerName(), 80));
|
||||
QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::imapServerName(), 143));
|
||||
#else
|
||||
QVERIFY(QtNetworkSettings::verifyTestNetworkSettings());
|
||||
if (!QtNetworkSettings::verifyTestNetworkSettings())
|
||||
QSKIP("No network test server available");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -142,7 +142,8 @@ void tst_QSocks5SocketEngine::initTestCase()
|
||||
QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::httpServerName(), 80));
|
||||
QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::imapServerName(), 143));
|
||||
#else
|
||||
QVERIFY(QtNetworkSettings::verifyTestNetworkSettings());
|
||||
if (!QtNetworkSettings::verifyTestNetworkSettings())
|
||||
QSKIP("No network test server available");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -358,7 +358,8 @@ void tst_QTcpSocket::initTestCase()
|
||||
QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::ftpServerName(), 21));
|
||||
QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::ftpProxyServerName(), 2121));
|
||||
#else
|
||||
QVERIFY(QtNetworkSettings::verifyTestNetworkSettings());
|
||||
if (!QtNetworkSettings::verifyTestNetworkSettings())
|
||||
QSKIP("No network test server available");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -391,7 +391,8 @@ void tst_QSslSocket::initTestCase()
|
||||
QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::imapServerName(), 993));
|
||||
QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::echoServerName(), 13));
|
||||
#else
|
||||
QVERIFY(QtNetworkSettings::verifyTestNetworkSettings());
|
||||
if (!QtNetworkSettings::verifyTestNetworkSettings())
|
||||
QSKIP("No network test server available");
|
||||
#endif // QT_TEST_SERVER
|
||||
#endif // QT_NO_SSL
|
||||
}
|
||||
|
@ -109,7 +109,8 @@ void tst_QSslSocket_onDemandCertificates_member::initTestCase()
|
||||
QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::httpProxyServerName(), 3129));
|
||||
QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::httpProxyServerName(), 3130));
|
||||
#else
|
||||
QVERIFY(QtNetworkSettings::verifyTestNetworkSettings());
|
||||
if (!QtNetworkSettings::verifyTestNetworkSettings())
|
||||
QSKIP("No network test server available");
|
||||
#endif // QT_TEST_SERVER
|
||||
}
|
||||
|
||||
|
@ -105,7 +105,8 @@ void tst_QSslSocket_onDemandCertificates_static::initTestCase()
|
||||
QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::httpProxyServerName(), 3129));
|
||||
QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::httpProxyServerName(), 3130));
|
||||
#else
|
||||
QVERIFY(QtNetworkSettings::verifyTestNetworkSettings());
|
||||
if (!QtNetworkSettings::verifyTestNetworkSettings())
|
||||
QSKIP("No network test server available");
|
||||
#endif // QT_TEST_SERVER
|
||||
}
|
||||
|
||||
|
@ -38,12 +38,12 @@
|
||||
|
||||
from PySide2.QtCore import (QCoreApplication, QMetaObject, QObject, QPoint,
|
||||
QRect, QSize, QUrl, Qt)
|
||||
from PySide2.QtGui import (QBrush, QColor, QConicalGradient, QFont,
|
||||
from PySide2.QtGui import (QBrush, QColor, QConicalGradient, QCursor, QFont,
|
||||
QFontDatabase, QIcon, QLinearGradient, QPalette, QPainter, QPixmap,
|
||||
QRadialGradient)
|
||||
from PySide2.QtWidgets import *
|
||||
|
||||
import GammaView
|
||||
from gammaview import GammaView
|
||||
|
||||
|
||||
class Ui_Config(object):
|
||||
|
@ -1,3 +1,5 @@
|
||||
[moveCursorBiggerJump]
|
||||
osx
|
||||
[mouseWheel:scroll down per pixel]
|
||||
macos
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user