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

Conflicts:
	src/corelib/kernel/qmetatype.cpp

Change-Id: I88eb0d3e9c9a38abf7241a51e370c655ae74e38a
This commit is contained in:
Simon Hausmann 2020-03-16 18:41:27 +01:00
commit ff922e7b87
140 changed files with 26533 additions and 24212 deletions

View File

@ -187,6 +187,10 @@
generate more and more precise (and computationally expensive)
approximations of the fractal.
We create a high resolution pixmap by applying the device
pixel ratio to the target size (see
\l{Drawing High Resolution Versions of Pixmaps and Images}).
If we discover inside the loop that \c restart has been set to \c
true (by \c render()), we break out of the loop immediately, so
that the control quickly returns to the very top of the outer
@ -273,12 +277,21 @@
\snippet threads/mandelbrot/mandelbrotwidget.cpp 8
If the pixmap has the right scale factor, we draw the pixmap directly onto
the widget. Otherwise, we scale and translate the \l{Coordinate
System}{coordinate system} before we draw the pixmap. By reverse mapping
the widget's rectangle using the scaled painter matrix, we also make sure
that only the exposed areas of the pixmap are drawn. The calls to
QPainter::save() and QPainter::restore() make sure that any painting
performed afterwards uses the standard coordinate system.
the widget.
Otherwise, we create a preview pixmap to be shown until the calculation
finishes and translate the \l{Coordinate System}{coordinate system}
accordingly.
Since we are going to use transformations on the painter
and use an overload of QPainter::drawPixmap() that does not support
high resolution pixmaps in that case, we create a pixmap with device pixel
ratio 1.
By reverse mapping the widget's rectangle using the scaled painter matrix,
we also make sure that only the exposed areas of the pixmap are drawn.
The calls to QPainter::save() and QPainter::restore() make sure that any
painting performed afterwards uses the standard coordinate system.
\snippet threads/mandelbrot/mandelbrotwidget.cpp 9

View File

@ -55,6 +55,8 @@
//! [0]
int main(int argc, char *argv[])
{
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
QApplication app(argc, argv);
MandelbrotWidget widget;
widget.show();

View File

@ -107,18 +107,22 @@ void MandelbrotWidget::paintEvent(QPaintEvent * /* event */)
//! [6] //! [7]
} else {
//! [7] //! [8]
auto previewPixmap = qFuzzyCompare(pixmap.devicePixelRatioF(), qreal(1))
? pixmap
: pixmap.scaled(pixmap.size() / pixmap.devicePixelRatioF(), Qt::KeepAspectRatio,
Qt::SmoothTransformation);
double scaleFactor = pixmapScale / curScale;
int newWidth = int(pixmap.width() * scaleFactor);
int newHeight = int(pixmap.height() * scaleFactor);
int newX = pixmapOffset.x() + (pixmap.width() - newWidth) / 2;
int newY = pixmapOffset.y() + (pixmap.height() - newHeight) / 2;
int newWidth = int(previewPixmap.width() * scaleFactor);
int newHeight = int(previewPixmap.height() * scaleFactor);
int newX = pixmapOffset.x() + (previewPixmap.width() - newWidth) / 2;
int newY = pixmapOffset.y() + (previewPixmap.height() - newHeight) / 2;
painter.save();
painter.translate(newX, newY);
painter.scale(scaleFactor, scaleFactor);
QRectF exposed = painter.transform().inverted().mapRect(rect()).adjusted(-1, -1, 1, 1);
painter.drawPixmap(exposed, pixmap, exposed);
painter.drawPixmap(exposed, previewPixmap, exposed);
painter.restore();
}
//! [8] //! [9]
@ -139,7 +143,7 @@ void MandelbrotWidget::paintEvent(QPaintEvent * /* event */)
//! [10]
void MandelbrotWidget::resizeEvent(QResizeEvent * /* event */)
{
thread.render(centerX, centerY, curScale, size());
thread.render(centerX, centerY, curScale, size(), devicePixelRatioF());
}
//! [10]
@ -208,8 +212,9 @@ void MandelbrotWidget::mouseReleaseEvent(QMouseEvent *event)
pixmapOffset += event->pos() - lastDragPos;
lastDragPos = QPoint();
int deltaX = (width() - pixmap.width()) / 2 - pixmapOffset.x();
int deltaY = (height() - pixmap.height()) / 2 - pixmapOffset.y();
const auto pixmapSize = pixmap.size() / pixmap.devicePixelRatioF();
int deltaX = (width() - pixmapSize.width()) / 2 - pixmapOffset.x();
int deltaY = (height() - pixmapSize.height()) / 2 - pixmapOffset.y();
scroll(deltaX, deltaY);
}
}
@ -234,7 +239,7 @@ void MandelbrotWidget::zoom(double zoomFactor)
{
curScale *= zoomFactor;
update();
thread.render(centerX, centerY, curScale, size());
thread.render(centerX, centerY, curScale, size(), devicePixelRatioF());
}
//! [17]
@ -244,6 +249,6 @@ void MandelbrotWidget::scroll(int deltaX, int deltaY)
centerX += deltaX * curScale;
centerY += deltaY * curScale;
update();
thread.render(centerX, centerY, curScale, size());
thread.render(centerX, centerY, curScale, size(), devicePixelRatioF());
}
//! [18]

View File

@ -76,13 +76,14 @@ RenderThread::~RenderThread()
//! [2]
void RenderThread::render(double centerX, double centerY, double scaleFactor,
QSize resultSize)
QSize resultSize, double devicePixelRatio)
{
QMutexLocker locker(&mutex);
this->centerX = centerX;
this->centerY = centerY;
this->scaleFactor = scaleFactor;
this->devicePixelRatio = devicePixelRatio;
this->resultSize = resultSize;
if (!isRunning()) {
@ -99,8 +100,10 @@ void RenderThread::run()
{
forever {
mutex.lock();
const QSize resultSize = this->resultSize;
const double scaleFactor = this->scaleFactor;
const double devicePixelRatio = this->devicePixelRatio;
const QSize resultSize = this->resultSize * devicePixelRatio;
const double requestedScaleFactor = this->scaleFactor;
const double scaleFactor = requestedScaleFactor / devicePixelRatio;
const double centerX = this->centerX;
const double centerY = this->centerY;
mutex.unlock();
@ -111,6 +114,7 @@ void RenderThread::run()
//! [4] //! [5]
int halfHeight = resultSize.height() / 2;
QImage image(resultSize, QImage::Format_RGB32);
image.setDevicePixelRatio(devicePixelRatio);
const int NumPasses = 8;
int pass = 0;
@ -162,7 +166,7 @@ void RenderThread::run()
pass = 4;
} else {
if (!restart)
emit renderedImage(image, scaleFactor);
emit renderedImage(image, requestedScaleFactor);
//! [5] //! [6]
++pass;
}

View File

@ -69,7 +69,8 @@ public:
RenderThread(QObject *parent = nullptr);
~RenderThread();
void render(double centerX, double centerY, double scaleFactor, QSize resultSize);
void render(double centerX, double centerY, double scaleFactor, QSize resultSize,
double devicePixelRatio);
signals:
void renderedImage(const QImage &image, double scaleFactor);
@ -85,6 +86,7 @@ private:
double centerX;
double centerY;
double scaleFactor;
double devicePixelRatio;
QSize resultSize;
bool restart = false;
bool abort = false;

View File

@ -50,8 +50,12 @@
#include "printview.h"
#ifndef QT_NO_PRINTER
#include <QPrinter>
#if defined(QT_PRINTSUPPORT_LIB)
# include <QtPrintSupport/qtprintsupportglobal.h>
# if QT_CONFIG(printer)
# include <QPrinter>
# endif
#endif
PrintView::PrintView()
@ -62,9 +66,11 @@ PrintView::PrintView()
void PrintView::print(QPrinter *printer)
{
#ifndef QT_NO_PRINTER
#if defined(QT_PRINTSUPPORT_LIB) && QT_CONFIG(printer)
resize(printer->width(), printer->height());
render(printer);
#else
Q_UNUSED(printer)
#endif
}

View File

@ -638,7 +638,7 @@ QString encode_pos(int row, int col)
void SpreadSheet::print()
{
#if QT_CONFIG(printpreviewdialog)
#if defined(QT_PRINTSUPPORT_LIB) && QT_CONFIG(printpreviewdialog)
QPrinter printer(QPrinter::ScreenResolution);
QPrintPreviewDialog dlg(&printer);
PrintView view;

View File

@ -197,7 +197,7 @@ void TextEdit::setupFileActions()
a->setPriority(QAction::LowPriority);
menu->addSeparator();
#ifndef QT_NO_PRINTER
#if defined(QT_PRINTSUPPORT_LIB) && QT_CONFIG(printer)
const QIcon printIcon = QIcon::fromTheme("document-print", QIcon(rsrcPath + "/fileprint.png"));
a = menu->addAction(printIcon, tr("&Print..."), this, &TextEdit::filePrint);
a->setPriority(QAction::LowPriority);
@ -559,7 +559,7 @@ void TextEdit::filePrint()
void TextEdit::filePrintPreview()
{
#if QT_CONFIG(printpreviewdialog)
#if defined(QT_PRINTSUPPORT_LIB) && QT_CONFIG(printpreviewdialog)
QPrinter printer(QPrinter::HighResolution);
QPrintPreviewDialog preview(&printer, this);
connect(&preview, &QPrintPreviewDialog::paintRequested, this, &TextEdit::printPreview);
@ -569,17 +569,17 @@ void TextEdit::filePrintPreview()
void TextEdit::printPreview(QPrinter *printer)
{
#ifdef QT_NO_PRINTER
Q_UNUSED(printer);
#else
#if defined(QT_PRINTSUPPORT_LIB) && QT_CONFIG(printer)
textEdit->print(printer);
#else
Q_UNUSED(printer)
#endif
}
void TextEdit::filePrintPdf()
{
#ifndef QT_NO_PRINTER
#if defined(QT_PRINTSUPPORT_LIB) && QT_CONFIG(printer)
//! [0]
QFileDialog fileDialog(this, tr("Export PDF"));
fileDialog.setAcceptMode(QFileDialog::AcceptSave);

View File

@ -1,6 +1,8 @@
TEMPLATE = app
TARGET = notepad
QT += widgets
qtHaveModule(printsupport): QT += printsupport
requires(qtConfig(fontdialog))

View File

@ -69,10 +69,11 @@
#include <QStatusBar>
#if defined(QT_PRINTSUPPORT_LIB)
#include <QtPrintSupport/qtprintsupportglobal.h>
#if QT_CONFIG(printdialog)
#include <QPrintDialog>
#endif
# include <QtPrintSupport/qtprintsupportglobal.h>
# if QT_CONFIG(printdialog)
# include <QPrintDialog>
# endif
#endif
//! [0]

View File

@ -53,8 +53,12 @@
#include <QMainWindow>
#include <QImage>
#ifndef QT_NO_PRINTER
#include <QPrinter>
#if defined(QT_PRINTSUPPORT_LIB)
# include <QtPrintSupport/qtprintsupportglobal.h>
# if QT_CONFIG(printer)
# include <QPrinter>
# endif
#endif
QT_BEGIN_NAMESPACE
@ -100,7 +104,7 @@ private:
QScrollArea *scrollArea;
double scaleFactor = 1;
#ifndef QT_NO_PRINTER
#if defined(QT_PRINTSUPPORT_LIB) && QT_CONFIG(printer)
QPrinter printer;
#endif

View File

@ -37,7 +37,6 @@ QOBJS = \
$(QTOBJS) $(QTOBJS2)
# QTOBJS and QTOBJS2 are populated by Makefile.unix.* as for QTSRC (see below).
# Note: qlibraryinfo.o omitted deliberately - see below.
# Note: qcore_mac_objc.o is in SOURCES (see qmake.pri) but not QOBJS.
#all sources, used for the depend target (please keep alphabetic in each block)
DEPEND_SRC = \
@ -92,7 +91,6 @@ DEPEND_SRC = \
$(SOURCE_PATH)/src/corelib/io/qiodevice.cpp \
$(SOURCE_PATH)/src/corelib/io/qsettings.cpp \
$(SOURCE_PATH)/src/corelib/io/qtemporaryfile.cpp \
$(SOURCE_PATH)/src/corelib/kernel/qcore_mac_objc.mm \
$(SOURCE_PATH)/src/corelib/kernel/qmetatype.cpp \
$(SOURCE_PATH)/src/corelib/kernel/qsystemerror.cpp \
$(SOURCE_PATH)/src/corelib/kernel/qvariant.cpp \
@ -325,7 +323,7 @@ qbytearraymatcher.o: $(SOURCE_PATH)/src/corelib/text/qbytearraymatcher.cpp
qmetatype.o: $(SOURCE_PATH)/src/corelib/kernel/qmetatype.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $<
qcore_mac.o: $(SOURCE_PATH)/src/corelib/kernel/qcore_mac.cpp
qcore_mac.o: $(SOURCE_PATH)/src/corelib/kernel/qcore_mac.mm
$(CXX) -c -o $@ $(CXXFLAGS) $<
qcore_unix.o: $(SOURCE_PATH)/src/corelib/kernel/qcore_unix.cpp
@ -340,9 +338,6 @@ qoperatingsystemversion_win.o: $(SOURCE_PATH)/src/corelib/global/qoperatingsyste
qoperatingsystemversion_darwin.o: $(SOURCE_PATH)/src/corelib/global/qoperatingsystemversion_darwin.mm
$(CXX) -c -o $@ $(CXXFLAGS) $<
qcore_mac_objc.o: $(SOURCE_PATH)/src/corelib/kernel/qcore_mac_objc.mm
$(CXX) -c -o $@ $(CXXFLAGS) $<
qcore_foundation.o: $(SOURCE_PATH)/src/corelib/kernel/qcore_foundation.mm
$(CXX) -c -o $@ $(CXXFLAGS) $<

View File

@ -12,6 +12,6 @@ QTOBJS2 = \
qcore_foundation.o
QTSRCS2 = \
$(SOURCE_PATH)/src/corelib/io/qsettings_mac.cpp \
$(SOURCE_PATH)/src/corelib/kernel/qcore_mac.cpp \
$(SOURCE_PATH)/src/corelib/kernel/qcore_mac.mm \
$(SOURCE_PATH)/src/corelib/global/qoperatingsystemversion_darwin.mm \
$(SOURCE_PATH)/src/corelib/kernel/qcore_foundation.mm

View File

@ -84,7 +84,6 @@
/*!
\page qmake-overview.html
\title Overview
\contentspage {qmake Manual}{Contents}
\previouspage qmake Manual
\nextpage Getting Started
@ -158,7 +157,6 @@
/*!
\page qmake-project-files.html
\title Creating Project Files
\contentspage {qmake Manual}{Contents}
\previouspage Getting Started
\nextpage Building Common Project Types
@ -477,7 +475,6 @@
/*!
\page qmake-running.html
\title Running qmake
\contentspage {qmake Manual}{Contents}
\previouspage Building Common Project Types
\nextpage Platform Notes
@ -647,7 +644,6 @@
/*!
\page qmake-platform-notes.html
\title Platform Notes
\contentspage {qmake Manual}{Contents}
\previouspage Running qmake
\nextpage qmake Language
@ -863,7 +859,6 @@
/*!
\page qmake-reference.html
\title Reference
\contentspage {qmake Manual}{Contents}
\previouspage Configuring qmake
\nextpage Variables
@ -894,7 +889,6 @@
/*!
\page qmake-variable-reference.html
\title Variables
\contentspage {qmake Manual}{Contents}
\previouspage Reference
\nextpage Replace Functions
\keyword qmake Variable Reference
@ -3189,7 +3183,6 @@
/*!
\page qmake-function-reference.html
\title Replace Functions
\contentspage {qmake Manual}{Contents}
\previouspage Variables
\nextpage Test Functions
\keyword qmake Function Reference - Replace Functions
@ -3723,7 +3716,6 @@
/*!
\page qmake-test-function-reference.html
\title Test Functions
\contentspage {qmake Manual}{Contents}
\previouspage Replace Functions
\keyword qmake Function Reference - Test Functions
@ -4145,7 +4137,6 @@
/*!
\page qmake-environment-reference.html
\contentspage {qmake Manual}{Contents}
\previouspage Using Precompiled Headers
\nextpage Reference
@ -4297,7 +4288,6 @@
/*!
\page qmake-language.html
\title qmake Language
\contentspage {qmake Manual}{Contents}
\previouspage Platform Notes
\nextpage Advanced Usage
@ -4624,7 +4614,6 @@
/*!
\page qmake-advanced-usage.html
\title Advanced Usage
\contentspage {qmake Manual}{Contents}
\previouspage qmake Language
\nextpage Using Precompiled Headers
@ -4973,7 +4962,6 @@
/*!
\page qmake-precompiledheaders.html
\title Using Precompiled Headers
\contentspage {qmake Manual}{Contents}
\previouspage Advanced Usage
\nextpage Configuring qmake
@ -5191,7 +5179,6 @@
\keyword qmake-getting-started
\page qmake-tutorial.html
\title Getting Started
\contentspage {qmake Manual}{Contents}
\previouspage Overview
\nextpage Creating Project Files
@ -5360,7 +5347,6 @@
/*!
\page qmake-common-projects.html
\title Building Common Project Types
\contentspage {qmake Manual}{Contents}
\previouspage Creating Project Files
\nextpage Running qmake

View File

@ -231,7 +231,7 @@ unix {
macos {
SOURCES += \
qcore_foundation.mm \
qcore_mac.cpp \
qcore_mac.mm \
qoperatingsystemversion_darwin.mm \
qsettings_mac.cpp
LIBS += \

View File

@ -20,7 +20,7 @@ supported by Qt (by the QNetworkCookieJar class).",
"Homepage": "Consult https://github.com/publicsuffix/list for the sha1 but download from ...",
"Homepage": "http://publicsuffix.org/",
"Version": "3bd641472776a5df4a8c6407da4a4846282cba94, fetched on 2019-10-23",
"Version": "b880425f09bca902da412bdece4f68e942f3a23b, fetched on 2020-03-13",
"License": "Mozilla Public License 2.0",
"LicenseFile": "PSL-LICENSE.txt",
"LicenseId": "MPL-2.0",

View File

@ -1950,8 +1950,9 @@ void QSortFilterProxyModelPrivate::_q_sourceColumnsMoved(
example.)
If you are working with large amounts of filtering and have to invoke
invalidateFilter() repeatedly, using reset() may be more efficient,
depending on the implementation of your model. However, reset() returns the
invalidateFilter() repeatedly, using beginResetModel() / endResetModel() may
be more efficient, depending on the implementation of your model. However,
beginResetModel() / endResetModel() returns the
proxy model to its original state, losing selection information, and will
cause the proxy model to be repopulated.

View File

@ -114,14 +114,12 @@ mac {
SOURCES += \
kernel/qcfsocketnotifier.cpp \
kernel/qcoreapplication_mac.cpp \
kernel/qcore_mac.cpp \
kernel/qcore_foundation.mm
!nacl: SOURCES += kernel/qelapsedtimer_mac.cpp
OBJECTIVE_SOURCES += \
kernel/qcore_mac_objc.mm \
kernel/qcore_foundation.mm \
kernel/qcore_mac.mm \
kernel/qeventdispatcher_cf.mm
!nacl: SOURCES += kernel/qelapsedtimer_mac.cpp
LIBS_PRIVATE += -framework Foundation
osx: LIBS_PRIVATE += -framework CoreServices -framework AppKit -framework Security

View File

@ -1,163 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtCore module 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 <private/qcore_mac_p.h>
#include <new>
#include "qhash.h"
#include "qpair.h"
#include "qmutex.h"
#include "qvarlengtharray.h"
#include "private/qlocking_p.h"
QT_BEGIN_NAMESPACE
QCFString::operator QString() const
{
if (string.isEmpty() && value)
const_cast<QCFString*>(this)->string = QString::fromCFString(value);
return string;
}
QCFString::operator CFStringRef() const
{
if (!value)
const_cast<QCFString*>(this)->value = string.toCFString();
return value;
}
// --------------------------------------------------------------------------
#if defined(QT_USE_APPLE_UNIFIED_LOGGING)
bool AppleUnifiedLogger::willMirrorToStderr()
{
// When running under Xcode or LLDB, one or more of these variables will
// be set, which triggers libsystem_trace.dyld to log messages to stderr
// as well, via_os_log_impl_mirror_to_stderr. Un-setting these variables
// is not an option, as that would silence normal NSLog or os_log calls,
// so instead we skip our own stderr output. See rdar://36919139.
static bool willMirror = qEnvironmentVariableIsSet("OS_ACTIVITY_DT_MODE")
|| qEnvironmentVariableIsSet("ACTIVITY_LOG_STDERR")
|| qEnvironmentVariableIsSet("CFLOG_FORCE_STDERR");
return willMirror;
}
QT_MAC_WEAK_IMPORT(_os_log_default);
bool AppleUnifiedLogger::messageHandler(QtMsgType msgType, const QMessageLogContext &context,
const QString &message, const QString &optionalSubsystem)
{
QString subsystem = optionalSubsystem;
if (subsystem.isNull()) {
static QString bundleIdentifier = []() {
if (CFBundleRef bundle = CFBundleGetMainBundle()) {
if (CFStringRef identifier = CFBundleGetIdentifier(bundle))
return QString::fromCFString(identifier);
}
return QString();
}();
subsystem = bundleIdentifier;
}
const bool isDefault = !context.category || !strcmp(context.category, "default");
os_log_t log = isDefault ? OS_LOG_DEFAULT :
cachedLog(subsystem, QString::fromLatin1(context.category));
os_log_type_t logType = logTypeForMessageType(msgType);
if (!os_log_type_enabled(log, logType))
return false;
// Logging best practices says we should not include symbolication
// information or source file line numbers in messages, as the system
// will automatically captures this information. In our case, what
// the system captures is the call to os_log_with_type below, which
// isn't really useful, but we still don't want to include the context's
// info, as that would clutter the logging output. See rdar://35958308.
// The format must be a string constant, so we can't pass on the
// message. This means we won't be able to take advantage of the
// unified logging's custom format specifiers such as %{BOOL}d.
// We use the 'public' format specifier to prevent the logging
// system from redacting our log message.
os_log_with_type(log, logType, "%{public}s", qPrintable(message));
return willMirrorToStderr();
}
os_log_type_t AppleUnifiedLogger::logTypeForMessageType(QtMsgType msgType)
{
switch (msgType) {
case QtDebugMsg: return OS_LOG_TYPE_DEBUG;
case QtInfoMsg: return OS_LOG_TYPE_INFO;
case QtWarningMsg: return OS_LOG_TYPE_DEFAULT;
case QtCriticalMsg: return OS_LOG_TYPE_ERROR;
case QtFatalMsg: return OS_LOG_TYPE_FAULT;
}
return OS_LOG_TYPE_DEFAULT;
}
os_log_t AppleUnifiedLogger::cachedLog(const QString &subsystem, const QString &category)
{
static QBasicMutex mutex;
const auto locker = qt_scoped_lock(mutex);
static QHash<QPair<QString, QString>, os_log_t> logs;
const auto cacheKey = qMakePair(subsystem, category);
os_log_t log = logs.value(cacheKey);
if (!log) {
log = os_log_create(subsystem.toLatin1().constData(),
category.toLatin1().constData());
logs.insert(cacheKey, log);
// Technically we should release the os_log_t resource when done
// with it, but since we don't know when a category is disabled
// we keep all cached os_log_t instances until shutdown, where
// the OS will clean them up for us.
}
return log;
}
#endif // QT_USE_APPLE_UNIFIED_LOGGING
// --------------------------------------------------------------------------
QT_END_NAMESPACE

View File

@ -48,6 +48,7 @@
#include <UIKit/UIKit.h>
#endif
#include <new>
#include <execinfo.h>
#include <dlfcn.h>
#include <cxxabi.h>
@ -55,8 +56,126 @@
#include <qdebug.h>
#include "qhash.h"
#include "qpair.h"
#include "qmutex.h"
#include "qvarlengtharray.h"
#include "private/qlocking_p.h"
QT_BEGIN_NAMESPACE
// --------------------------------------------------------------------------
QCFString::operator QString() const
{
if (string.isEmpty() && value)
const_cast<QCFString*>(this)->string = QString::fromCFString(value);
return string;
}
QCFString::operator CFStringRef() const
{
if (!value)
const_cast<QCFString*>(this)->value = string.toCFString();
return value;
}
// --------------------------------------------------------------------------
#if defined(QT_USE_APPLE_UNIFIED_LOGGING)
bool AppleUnifiedLogger::willMirrorToStderr()
{
// When running under Xcode or LLDB, one or more of these variables will
// be set, which triggers libsystem_trace.dyld to log messages to stderr
// as well, via_os_log_impl_mirror_to_stderr. Un-setting these variables
// is not an option, as that would silence normal NSLog or os_log calls,
// so instead we skip our own stderr output. See rdar://36919139.
static bool willMirror = qEnvironmentVariableIsSet("OS_ACTIVITY_DT_MODE")
|| qEnvironmentVariableIsSet("ACTIVITY_LOG_STDERR")
|| qEnvironmentVariableIsSet("CFLOG_FORCE_STDERR");
return willMirror;
}
QT_MAC_WEAK_IMPORT(_os_log_default);
bool AppleUnifiedLogger::messageHandler(QtMsgType msgType, const QMessageLogContext &context,
const QString &message, const QString &optionalSubsystem)
{
QString subsystem = optionalSubsystem;
if (subsystem.isNull()) {
static QString bundleIdentifier = []() {
if (CFBundleRef bundle = CFBundleGetMainBundle()) {
if (CFStringRef identifier = CFBundleGetIdentifier(bundle))
return QString::fromCFString(identifier);
}
return QString();
}();
subsystem = bundleIdentifier;
}
const bool isDefault = !context.category || !strcmp(context.category, "default");
os_log_t log = isDefault ? OS_LOG_DEFAULT :
cachedLog(subsystem, QString::fromLatin1(context.category));
os_log_type_t logType = logTypeForMessageType(msgType);
if (!os_log_type_enabled(log, logType))
return false;
// Logging best practices says we should not include symbolication
// information or source file line numbers in messages, as the system
// will automatically captures this information. In our case, what
// the system captures is the call to os_log_with_type below, which
// isn't really useful, but we still don't want to include the context's
// info, as that would clutter the logging output. See rdar://35958308.
// The format must be a string constant, so we can't pass on the
// message. This means we won't be able to take advantage of the
// unified logging's custom format specifiers such as %{BOOL}d.
// We use the 'public' format specifier to prevent the logging
// system from redacting our log message.
os_log_with_type(log, logType, "%{public}s", qPrintable(message));
return willMirrorToStderr();
}
os_log_type_t AppleUnifiedLogger::logTypeForMessageType(QtMsgType msgType)
{
switch (msgType) {
case QtDebugMsg: return OS_LOG_TYPE_DEBUG;
case QtInfoMsg: return OS_LOG_TYPE_INFO;
case QtWarningMsg: return OS_LOG_TYPE_DEFAULT;
case QtCriticalMsg: return OS_LOG_TYPE_ERROR;
case QtFatalMsg: return OS_LOG_TYPE_FAULT;
}
return OS_LOG_TYPE_DEFAULT;
}
os_log_t AppleUnifiedLogger::cachedLog(const QString &subsystem, const QString &category)
{
static QBasicMutex mutex;
const auto locker = qt_scoped_lock(mutex);
static QHash<QPair<QString, QString>, os_log_t> logs;
const auto cacheKey = qMakePair(subsystem, category);
os_log_t log = logs.value(cacheKey);
if (!log) {
log = os_log_create(subsystem.toLatin1().constData(),
category.toLatin1().constData());
logs.insert(cacheKey, log);
// Technically we should release the os_log_t resource when done
// with it, but since we don't know when a category is disabled
// we keep all cached os_log_t instances until shutdown, where
// the OS will clean them up for us.
}
return log;
}
#endif // QT_USE_APPLE_UNIFIED_LOGGING
// -------------------------------------------------------------------------
QDebug operator<<(QDebug dbg, const NSObject *nsObject)

View File

@ -438,8 +438,8 @@ inline bool TimeReference::toNanoseconds(qint64 *result) const
For such objects, remainingTime() will return -1, deadline() will return the
maximum value, and isForever() will return true.
The timer type \a timerType may be ignored, since the timer is already
expired.
The timer type \a timerType may be ignored, since the timer will never
expire.
\sa ForeverConstant, hasExpired(), isForever(), remainingTime(), timerType()
*/
@ -449,9 +449,9 @@ inline bool TimeReference::toNanoseconds(qint64 *result) const
from the moment of the creation of this object, if msecs is positive. If \a
msecs is zero, this QDeadlineTimer will be marked as expired, causing
remainingTime() to return zero and deadline() to return an indeterminate
time point in the past. If \a msecs is -1, the timer will be set it to
never expire, causing remainingTime() to return -1 and deadline() to return
the maximum value.
time point in the past. If \a msecs is -1, the timer will be set to never
expire, causing remainingTime() to return -1 and deadline() to return the
maximum value.
The QDeadlineTimer object will be constructed with the specified timer \a type.

View File

@ -389,15 +389,10 @@ QObject *QFactoryLoader::instance(int index) const
QMutexLocker lock(&d->mutex);
if (index < d->libraryList.size()) {
QLibraryPrivate *library = d->libraryList.at(index);
if (library->instance || library->loadPlugin()) {
if (!library->inst)
library->inst = library->instance();
QObject *obj = library->inst.data();
if (obj) {
if (!obj->parent())
obj->moveToThread(QCoreApplicationPrivate::mainThread());
return obj;
}
if (QObject *obj = library->pluginInstance()) {
if (!obj->parent())
obj->moveToThread(QCoreApplicationPrivate::mainThread());
return obj;
}
return nullptr;
}

View File

@ -407,7 +407,7 @@ inline void QLibraryStore::cleanup()
QLibraryPrivate *lib = it.value();
if (lib->libraryRefCount.loadRelaxed() == 1) {
if (lib->libraryUnloadCount.loadRelaxed() > 0) {
Q_ASSERT(lib->pHnd);
Q_ASSERT(lib->pHnd.loadRelaxed());
lib->libraryUnloadCount.storeRelaxed(1);
#ifdef __GLIBC__
// glibc has a bug in unloading from global destructors
@ -498,8 +498,7 @@ inline void QLibraryStore::releaseLibrary(QLibraryPrivate *lib)
}
QLibraryPrivate::QLibraryPrivate(const QString &canonicalFileName, const QString &version, QLibrary::LoadHints loadHints)
: pHnd(nullptr), fileName(canonicalFileName), fullVersion(version), instance(nullptr),
libraryRefCount(0), libraryUnloadCount(0), pluginState(MightBeAPlugin)
: fileName(canonicalFileName), fullVersion(version), pluginState(MightBeAPlugin)
{
loadHintsInt.storeRelaxed(loadHints);
if (canonicalFileName.isEmpty())
@ -519,7 +518,7 @@ QLibraryPrivate::~QLibraryPrivate()
void QLibraryPrivate::mergeLoadHints(QLibrary::LoadHints lh)
{
// if the library is already loaded, we can't change the load hints
if (pHnd)
if (pHnd.loadRelaxed())
return;
loadHintsInt.storeRelaxed(lh);
@ -527,7 +526,7 @@ void QLibraryPrivate::mergeLoadHints(QLibrary::LoadHints lh)
QFunctionPointer QLibraryPrivate::resolve(const char *symbol)
{
if (!pHnd)
if (!pHnd.loadRelaxed())
return nullptr;
return resolve_sys(symbol);
}
@ -539,9 +538,36 @@ void QLibraryPrivate::setLoadHints(QLibrary::LoadHints lh)
mergeLoadHints(lh);
}
QObject *QLibraryPrivate::pluginInstance()
{
// first, check if the instance is cached and hasn't been deleted
QObject *obj = (QMutexLocker(&mutex), inst.data());
if (obj)
return obj;
// We need to call the plugin's factory function. Is that cached?
// skip increasing the reference count (why? -Thiago)
QtPluginInstanceFunction factory = instanceFactory.loadAcquire();
if (!factory)
factory = loadPlugin();
if (!factory)
return nullptr;
obj = factory();
// cache again
QMutexLocker locker(&mutex);
if (inst)
obj = inst;
else
inst = obj;
return obj;
}
bool QLibraryPrivate::load()
{
if (pHnd) {
if (pHnd.loadRelaxed()) {
libraryUnloadCount.ref();
return true;
}
@ -550,7 +576,9 @@ bool QLibraryPrivate::load()
Q_TRACE(QLibraryPrivate_load_entry, fileName);
mutex.lock();
bool ret = load_sys();
mutex.unlock();
if (qt_debug_component()) {
if (ret) {
qDebug() << "loaded library" << fileName;
@ -573,9 +601,10 @@ bool QLibraryPrivate::load()
bool QLibraryPrivate::unload(UnloadFlag flag)
{
if (!pHnd)
if (!pHnd.loadRelaxed())
return false;
if (libraryUnloadCount.loadRelaxed() > 0 && !libraryUnloadCount.deref()) { // only unload if ALL QLibrary instance wanted to
QMutexLocker locker(&mutex);
delete inst.data();
if (flag == NoUnloadSys || unload_sys()) {
if (qt_debug_component())
@ -584,12 +613,13 @@ bool QLibraryPrivate::unload(UnloadFlag flag)
//when the library is unloaded, we release the reference on it so that 'this'
//can get deleted
libraryRefCount.deref();
pHnd = nullptr;
instance = nullptr;
pHnd.storeRelaxed(nullptr);
instanceFactory.storeRelaxed(nullptr);
return true;
}
}
return (pHnd == nullptr);
return false;
}
void QLibraryPrivate::release()
@ -597,22 +627,23 @@ void QLibraryPrivate::release()
QLibraryStore::releaseLibrary(this);
}
bool QLibraryPrivate::loadPlugin()
QtPluginInstanceFunction QLibraryPrivate::loadPlugin()
{
if (instance) {
if (auto ptr = instanceFactory.loadAcquire()) {
libraryUnloadCount.ref();
return true;
return ptr;
}
if (pluginState == IsNotAPlugin)
return false;
return nullptr;
if (load()) {
instance = (QtPluginInstanceFunction)resolve("qt_plugin_instance");
return instance;
auto ptr = reinterpret_cast<QtPluginInstanceFunction>(resolve("qt_plugin_instance"));
instanceFactory.storeRelease(ptr); // two threads may store the same value
return ptr;
}
if (qt_debug_component())
qWarning() << "QLibraryPrivate::loadPlugin failed on" << fileName << ":" << errorString;
pluginState = IsNotAPlugin;
return false;
return nullptr;
}
/*!
@ -719,6 +750,7 @@ bool QLibraryPrivate::isPlugin()
void QLibraryPrivate::updatePluginState()
{
QMutexLocker locker(&mutex);
errorString.clear();
if (pluginState != MightBeAPlugin)
return;
@ -739,7 +771,7 @@ void QLibraryPrivate::updatePluginState()
}
#endif
if (!pHnd) {
if (!pHnd.loadRelaxed()) {
// scan for the plugin metadata without loading
success = findPatternUnloaded(fileName, this);
} else {
@ -803,7 +835,7 @@ bool QLibrary::load()
if (!d)
return false;
if (did_load)
return d->pHnd;
return d->pHnd.loadRelaxed();
did_load = true;
return d->load();
}
@ -839,7 +871,7 @@ bool QLibrary::unload()
*/
bool QLibrary::isLoaded() const
{
return d && d->pHnd;
return d && d->pHnd.loadRelaxed();
}
@ -950,8 +982,10 @@ void QLibrary::setFileName(const QString &fileName)
QString QLibrary::fileName() const
{
if (d)
if (d) {
QMutexLocker locker(&d->mutex);
return d->qualifiedFileName.isEmpty() ? d->fileName : d->qualifiedFileName;
}
return QString();
}
@ -1092,7 +1126,12 @@ QFunctionPointer QLibrary::resolve(const QString &fileName, const QString &versi
*/
QString QLibrary::errorString() const
{
return (!d || d->errorString.isEmpty()) ? tr("Unknown error") : d->errorString;
QString str;
if (d) {
QMutexLocker locker(&d->mutex);
str = d->errorString;
}
return str.isEmpty() ? tr("Unknown error") : str;
}
/*!

View File

@ -54,10 +54,10 @@
#include <QtCore/private/qglobal_p.h>
#include "QtCore/qlibrary.h"
#include "QtCore/qmutex.h"
#include "QtCore/qpointer.h"
#include "QtCore/qstringlist.h"
#include "QtCore/qplugin.h"
#include "QtCore/qsharedpointer.h"
#ifdef Q_OS_WIN
# include "QtCore/qt_windows.h"
#endif
@ -72,21 +72,18 @@ class QLibraryStore;
class QLibraryPrivate
{
public:
#ifdef Q_OS_WIN
HINSTANCE
using Handle = HINSTANCE;
#else
void *
using Handle = void *;
#endif
pHnd;
enum UnloadFlag { UnloadSys, NoUnloadSys };
QString fileName, qualifiedFileName;
QString fullVersion;
const QString fileName;
const QString fullVersion;
bool load();
bool loadPlugin(); // loads and resolves instance
QtPluginInstanceFunction loadPlugin(); // loads and resolves instance
bool unload(UnloadFlag flag = UnloadSys);
void release();
QFunctionPointer resolve(const char *);
@ -94,17 +91,22 @@ public:
QLibrary::LoadHints loadHints() const
{ return QLibrary::LoadHints(loadHintsInt.loadRelaxed()); }
void setLoadHints(QLibrary::LoadHints lh);
QObject *pluginInstance();
static QLibraryPrivate *findOrCreate(const QString &fileName, const QString &version = QString(),
QLibrary::LoadHints loadHints = { });
static QStringList suffixes_sys(const QString &fullVersion);
static QStringList prefixes_sys();
QPointer<QObject> inst;
QtPluginInstanceFunction instance;
QJsonObject metaData;
QAtomicPointer<std::remove_pointer<QtPluginInstanceFunction>::type> instanceFactory;
QAtomicPointer<std::remove_pointer<Handle>::type> pHnd;
// the mutex protects the fields below
QMutex mutex;
QPointer<QObject> inst; // used by QFactoryLoader
QJsonObject metaData;
QString errorString;
QString qualifiedFileName;
void updatePluginState();
bool isPlugin();

View File

@ -214,8 +214,9 @@ bool QLibraryPrivate::load_sys()
#endif
bool retry = true;
for(int prefix = 0; retry && !pHnd && prefix < prefixes.size(); prefix++) {
for(int suffix = 0; retry && !pHnd && suffix < suffixes.size(); suffix++) {
Handle hnd = nullptr;
for (int prefix = 0; retry && !hnd && prefix < prefixes.size(); prefix++) {
for (int suffix = 0; retry && !hnd && suffix < suffixes.size(); suffix++) {
if (!prefixes.at(prefix).isEmpty() && name.startsWith(prefixes.at(prefix)))
continue;
if (path.isEmpty() && prefixes.at(prefix).contains(QLatin1Char('/')))
@ -232,7 +233,7 @@ bool QLibraryPrivate::load_sys()
attempt = path + prefixes.at(prefix) + name + suffixes.at(suffix);
}
pHnd = dlopen(QFile::encodeName(attempt), dlFlags);
hnd = dlopen(QFile::encodeName(attempt), dlFlags);
#ifdef Q_OS_ANDROID
if (!pHnd) {
auto attemptFromBundle = attempt;
@ -248,7 +249,7 @@ bool QLibraryPrivate::load_sys()
}
#endif
if (!pHnd && fileName.startsWith(QLatin1Char('/')) && QFile::exists(attempt)) {
if (!hnd && fileName.startsWith(QLatin1Char('/')) && QFile::exists(attempt)) {
// We only want to continue if dlopen failed due to that the shared library did not exist.
// However, we are only able to apply this check for absolute filenames (since they are
// not influenced by the content of LD_LIBRARY_PATH, /etc/ld.so.cache, DT_RPATH etc...)
@ -259,7 +260,7 @@ bool QLibraryPrivate::load_sys()
}
#ifdef Q_OS_MAC
if (!pHnd) {
if (!hnd) {
QByteArray utf8Bundle = fileName.toUtf8();
QCFType<CFURLRef> bundleUrl = CFURLCreateFromFileSystemRepresentation(NULL, reinterpret_cast<const UInt8*>(utf8Bundle.data()), utf8Bundle.length(), true);
QCFType<CFBundleRef> bundle = CFBundleCreate(NULL, bundleUrl);
@ -268,23 +269,24 @@ bool QLibraryPrivate::load_sys()
char executableFile[FILENAME_MAX];
CFURLGetFileSystemRepresentation(url, true, reinterpret_cast<UInt8*>(executableFile), FILENAME_MAX);
attempt = QString::fromUtf8(executableFile);
pHnd = dlopen(QFile::encodeName(attempt), dlFlags);
hnd = dlopen(QFile::encodeName(attempt), dlFlags);
}
}
#endif
if (!pHnd) {
if (!hnd) {
errorString = QLibrary::tr("Cannot load library %1: %2").arg(fileName, qdlerror());
}
if (pHnd) {
if (hnd) {
qualifiedFileName = attempt;
errorString.clear();
}
return (pHnd != nullptr);
pHnd.storeRelaxed(hnd);
return (hnd != nullptr);
}
bool QLibraryPrivate::unload_sys()
{
if (dlclose(pHnd)) {
if (dlclose(pHnd.loadAcquire())) {
#if defined (Q_OS_QNX) // Workaround until fixed in QNX; fixes crash in
char *error = dlerror(); // QtDeclarative auto test "qqmlenginecleanup" for instance
if (!qstrcmp(error, "Shared objects still referenced")) // On QNX that's only "informative"
@ -316,13 +318,7 @@ Q_CORE_EXPORT QFunctionPointer qt_mac_resolve_sys(void *handle, const char *symb
QFunctionPointer QLibraryPrivate::resolve_sys(const char* symbol)
{
QFunctionPointer address = QFunctionPointer(dlsym(pHnd, symbol));
if (!address) {
errorString = QLibrary::tr("Cannot resolve symbol \"%1\" in %2: %3").arg(
QString::fromLatin1(symbol), fileName, qdlerror());
} else {
errorString.clear();
}
QFunctionPointer address = QFunctionPointer(dlsym(pHnd.loadAcquire(), symbol));
return address;
}

View File

@ -95,26 +95,27 @@ bool QLibraryPrivate::load_sys()
attempts.prepend(QDir::rootPath() + fileName);
#endif
Handle hnd = nullptr;
for (const QString &attempt : qAsConst(attempts)) {
#ifndef Q_OS_WINRT
pHnd = LoadLibrary(reinterpret_cast<const wchar_t*>(QDir::toNativeSeparators(attempt).utf16()));
hnd = LoadLibrary(reinterpret_cast<const wchar_t*>(QDir::toNativeSeparators(attempt).utf16()));
#else // Q_OS_WINRT
QString path = QDir::toNativeSeparators(QDir::current().relativeFilePath(attempt));
pHnd = LoadPackagedLibrary(reinterpret_cast<LPCWSTR>(path.utf16()), 0);
if (pHnd)
hnd = LoadPackagedLibrary(reinterpret_cast<LPCWSTR>(path.utf16()), 0);
if (hnd)
qualifiedFileName = attempt;
#endif // !Q_OS_WINRT
// If we have a handle or the last error is something other than "unable
// to find the module", then bail out
if (pHnd || ::GetLastError() != ERROR_MOD_NOT_FOUND)
if (hnd || ::GetLastError() != ERROR_MOD_NOT_FOUND)
break;
}
#ifndef Q_OS_WINRT
SetErrorMode(oldmode);
#endif
if (!pHnd) {
if (!hnd) {
errorString = QLibrary::tr("Cannot load library %1: %2").arg(
QDir::toNativeSeparators(fileName), qt_error_string());
} else {
@ -123,7 +124,7 @@ bool QLibraryPrivate::load_sys()
#ifndef Q_OS_WINRT
wchar_t buffer[MAX_PATH];
::GetModuleFileName(pHnd, buffer, MAX_PATH);
::GetModuleFileName(hnd, buffer, MAX_PATH);
QString moduleFileName = QString::fromWCharArray(buffer);
moduleFileName.remove(0, 1 + moduleFileName.lastIndexOf(QLatin1Char('\\')));
@ -138,19 +139,20 @@ bool QLibraryPrivate::load_sys()
HMODULE hmod;
bool ok = GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_PIN |
GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS,
reinterpret_cast<const wchar_t *>(pHnd),
reinterpret_cast<const wchar_t *>(hnd),
&hmod);
Q_ASSERT(!ok || hmod == pHnd);
Q_ASSERT(!ok || hmod == hnd);
Q_UNUSED(ok);
}
#endif // !Q_OS_WINRT
}
return (pHnd != 0);
pHnd.storeRelaxed(hnd);
return (pHnd != nullptr);
}
bool QLibraryPrivate::unload_sys()
{
if (!FreeLibrary(pHnd)) {
if (!FreeLibrary(pHnd.loadAcquire())) {
errorString = QLibrary::tr("Cannot unload library %1: %2").arg(
QDir::toNativeSeparators(fileName), qt_error_string());
return false;
@ -161,13 +163,7 @@ bool QLibraryPrivate::unload_sys()
QFunctionPointer QLibraryPrivate::resolve_sys(const char* symbol)
{
FARPROC address = GetProcAddress(pHnd, symbol);
if (!address) {
errorString = QLibrary::tr("Cannot resolve symbol \"%1\" in %2: %3").arg(
QString::fromLatin1(symbol), QDir::toNativeSeparators(fileName), qt_error_string());
} else {
errorString.clear();
}
FARPROC address = GetProcAddress(pHnd.loadAcquire(), symbol);
return QFunctionPointer(address);
}
QT_END_NAMESPACE

View File

@ -196,9 +196,7 @@ QObject *QPluginLoader::instance()
{
if (!isLoaded() && !load())
return nullptr;
if (!d->inst && d->instance)
d->inst = d->instance();
return d->inst.data();
return d->pluginInstance();
}
/*!
@ -233,7 +231,7 @@ bool QPluginLoader::load()
if (!d || d->fileName.isEmpty())
return false;
if (did_load)
return d->pHnd && d->instance;
return d->pHnd && d->instanceFactory.loadAcquire();
if (!d->isPlugin())
return false;
did_load = true;
@ -275,7 +273,7 @@ bool QPluginLoader::unload()
*/
bool QPluginLoader::isLoaded() const
{
return d && d->pHnd && d->instance;
return d && d->pHnd && d->instanceFactory.loadRelaxed();
}
#if defined(QT_SHARED)

View File

@ -115,7 +115,8 @@ struct ByteData
QStringView asStringView() const{ return QStringView(utf16(), len / 2); }
QString asQStringRaw() const { return QString::fromRawData(utf16(), len / 2); }
};
Q_STATIC_ASSERT(std::is_pod<ByteData>::value);
Q_STATIC_ASSERT(std::is_trivial<ByteData>::value);
Q_STATIC_ASSERT(std::is_standard_layout<ByteData>::value);
} // namespace QtCbor
Q_DECLARE_TYPEINFO(QtCbor::Element, Q_PRIMITIVE_TYPE);

View File

@ -192,6 +192,7 @@ QT_BEGIN_NAMESPACE
\value Unicode_11_0 Version 11.0 Since Qt 5.15
\value Unicode_12_0 Version 12.0 Since Qt 5.15
\value Unicode_12_1 Version 12.1 Since Qt 5.15
\value Unicode_13_0 Version 13.0 Since Qt 5.15
\value Unicode_Unassigned The value is not assigned to any character
in version 8.0 of Unicode.
@ -314,12 +315,14 @@ QT_BEGIN_NAMESPACE
\value Script_Chakma
\value Script_Cham
\value Script_Cherokee
\value Script_Chorasmian Since Qt 5.15
\value Script_Coptic
\value Script_Cuneiform
\value Script_Cypriot
\value Script_Cyrillic
\value Script_Deseret
\value Script_Devanagari
\value Script_DivesAkuru Since Qt 5.15
\value Script_Dogra Since Qt 5.15
\value Script_Duployan Since Qt 5.5
\value Script_EgyptianHieroglyphs
@ -350,6 +353,7 @@ QT_BEGIN_NAMESPACE
\value Script_Katakana
\value Script_KayahLi
\value Script_Kharoshthi
\value Script_KhitanSmallScript Since Qt 5.15
\value Script_Khmer
\value Script_Khojki Since Qt 5.5
\value Script_Khudawadi Since Qt 5.5
@ -439,6 +443,7 @@ QT_BEGIN_NAMESPACE
\value Script_Vai
\value Script_Wancho Since Qt 5.15
\value Script_WarangCiti Since Qt 5.5
\value Script_Yezidi Since Qt 5.15
\value Script_Yi
\value Script_ZanabazarSquare Since Qt 5.11

View File

@ -341,6 +341,12 @@ public:
Script_NyiakengPuachueHmong,
Script_Wancho,
// Unicode 13.0 additions
Script_Chorasmian,
Script_DivesAkuru,
Script_KhitanSmallScript,
Script_Yezidi,
ScriptCount
};
@ -437,7 +443,8 @@ public:
Unicode_10_0,
Unicode_11_0,
Unicode_12_0,
Unicode_12_1
Unicode_12_1,
Unicode_13_0
};
inline Category category() const noexcept { return QChar::category(ucs); }

View File

@ -126,8 +126,8 @@ private:
}
typedef QConcatenable<QStringBuilder<A, B> > Concatenable;
typedef typename Concatenable::ConvertTo ConvertTo;
public:
typedef typename Concatenable::ConvertTo ConvertTo;
operator ConvertTo() const { return convertTo<ConvertTo>(); }
int size() const { return Concatenable::size(*this); }

View File

@ -211,7 +211,7 @@ public:
#endif
template <typename StdBasicString, if_compatible_string<StdBasicString> = true>
QStringView(const StdBasicString &str) noexcept
Q_DECL_CONSTEXPR QStringView(const StdBasicString &str) noexcept
: QStringView(str.data(), qsizetype(str.size())) {}
Q_REQUIRED_RESULT inline QString toString() const; // defined in qstring.h

View File

@ -10,8 +10,9 @@
"Description": "The Unicode Character Database (UCD) is a set of files that
define the Unicode character properties and internal mappings.",
"Homepage": "https://www.unicode.org/ucd/",
"Version": "Don't use the Unicode standard version; UCD has its own 'Revision' numbers",
"Version": "24",
"Version": "Don't use the Unicode standard version;
UCD has its own 'Revision' numbers, see the 'UAX #44, UCD' page",
"Version": "26",
"License": "Unicode License Agreement - Data Files and Software (2016)",
"LicenseId": "Unicode-DFS-2016",
"LicenseFile": "UNICODE_LICENSE.txt",

File diff suppressed because it is too large Load Diff

View File

@ -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.
@ -37,7 +37,7 @@
**
****************************************************************************/
/* This file is autogenerated from the Unicode 12.1 database. Do not edit */
/* This file is autogenerated from the Unicode 13.0 database. Do not edit */
//
// W A R N I N G
@ -59,7 +59,7 @@
QT_BEGIN_NAMESPACE
#define UNICODE_DATA_VERSION QChar::Unicode_12_1
#define UNICODE_DATA_VERSION QChar::Unicode_13_0
namespace QUnicodeTables {

View File

@ -79,7 +79,6 @@
\page qdbusdeclaringslots.html
\title Declaring Slots in D-Bus Adaptors
\contentspage Using Qt D-Bus Adaptors
\nextpage Declaring Signals in D-Bus Adaptors
Slots in D-Bus adaptors are declared just like normal, public slots, but their
@ -208,7 +207,6 @@
\title Declaring Signals in D-Bus Adaptors
\previouspage Declaring Slots in D-Bus Adaptors
\contentspage Using Qt D-Bus Adaptors
\nextpage The Qt D-Bus Type System
Any signal in a class derived from QDBusAbstractAdaptor will be automatically
@ -237,7 +235,6 @@
\title The Qt D-Bus Type System
\previouspage Declaring Signals in D-Bus Adaptors
\contentspage Using Qt D-Bus Adaptors
D-Bus has an extensible type system based on a few primitives and
composition of the primitives in arrays and structures. Qt D-Bus

View File

@ -7,7 +7,7 @@
"Description": "D-Bus is a message bus system, a simple way for applications to talk to one another.",
"Homepage": "https://www.freedesktop.org/wiki/Software/dbus/",
"Version": "Minimal supported is 1.2, compatible up to ...",
"Version": "dbus-1.12.12",
"Version": "dbus-1.13.12",
"LicenseId": "AFL-2.1 OR GPL-2.0-or-later",
"License": "Academic Free License v2.1, or GNU General Public License v2.0 or later",
"LicenseFile": "LIBDBUS-1-LICENSE.txt",

View File

@ -1302,7 +1302,7 @@
"label": "VNC",
"section": "Platform plugins",
"condition": [
"config.unix && !config.android && !config.darwin",
"config.unix && !config.android && !config.darwin && !config.wasm",
"features.regularexpression && features.network"
],
"output": [ "privateFeature" ]

View File

@ -93,7 +93,6 @@
\page paintsystem-devices.html
\title Paint Devices and Backends
\contentspage The Paint System
\nextpage Drawing and Filling
\section1 Creating a Paint Device
@ -185,7 +184,6 @@
\title Drawing and Filling
\previouspage Paint Devices and Backends
\contentspage The Paint System
\nextpage Coordinate System
\section1 Drawing
@ -303,7 +301,6 @@
\title Reading and Writing Image Files
\previouspage Coordinate System
\contentspage The Paint System
The most common way to read images is through QImage and QPixmap's
constructors, or by calling the QImage::load() and QPixmap::load()

View File

@ -83,7 +83,6 @@
/*!
\page richtext-structure.html
\contentspage richtext.html Contents
\previouspage Rich Text Processing
\nextpage The QTextCursor Interface
@ -349,7 +348,6 @@
/*!
\page richtext-cursor.html
\contentspage richtext.html Contents
\previouspage Rich Text Document Structure
\nextpage Document Layouts
@ -656,7 +654,6 @@
/*!
\page richtext-layouts.html
\contentspage richtext.html Contents
\previouspage The QTextCursor Interface
\nextpage Common Rich Text Editing Tasks
@ -707,7 +704,6 @@
/*!
\page richtext-common-tasks.html
\contentspage richtext.html Contents
\previouspage Document Layouts
\nextpage Advanced Rich Text Processing
@ -800,7 +796,6 @@
/*!
\page richtext-advanced-processing.html
\contentspage richtext.html Contents
\previouspage Common Rich Text Editing Tasks
\nextpage Supported HTML Subset
@ -849,7 +844,6 @@
\title Supported HTML Subset
\brief Describes the support for HTML markup in text widgets.
\contentspage richtext.html Contents
\previouspage Common Rich Text Editing Tasks
Qt's text widgets are able to display rich text, specified using a subset of \l {http://www.w3.org/TR/html401/}{HTML 4}

File diff suppressed because it is too large Load Diff

View File

@ -279,7 +279,7 @@ inline QRegion fromNativeLocalExposedRegion(const QRegion &pixelRegion, const QW
const qreal scaleFactor = QHighDpiScaling::factor(window);
QRegion pointRegion;
for (const QRectF &rect : pixelRegion) {
for (const QRectF rect: pixelRegion) {
const QPointF topLeftP = rect.topLeft() / scaleFactor;
const QSizeF sizeP = rect.size() / scaleFactor;
pointRegion += QRect(QPoint(qFloor(topLeftP.x()), qFloor(topLeftP.y())),

View File

@ -368,41 +368,41 @@ QT_DEFINE_QPA_EVENT_HANDLER(bool, handleCloseEvent, QWindow *window)
*/
#if QT_DEPRECATED_SINCE(5, 11)
QT_DEFINE_QPA_EVENT_HANDLER(void, handleMouseEvent, QWindow *window, const QPointF &local, const QPointF &global, Qt::MouseButtons b,
QT_DEFINE_QPA_EVENT_HANDLER(bool, handleMouseEvent, QWindow *window, const QPointF &local, const QPointF &global, Qt::MouseButtons b,
Qt::KeyboardModifiers mods, Qt::MouseEventSource source)
{
handleMouseEvent<Delivery>(window, local, global, b, Qt::NoButton, QEvent::None, mods, source);
return handleMouseEvent<Delivery>(window, local, global, b, Qt::NoButton, QEvent::None, mods, source);
}
QT_DEFINE_QPA_EVENT_HANDLER(void, handleMouseEvent, QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global, Qt::MouseButtons b,
QT_DEFINE_QPA_EVENT_HANDLER(bool, handleMouseEvent, QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global, Qt::MouseButtons b,
Qt::KeyboardModifiers mods, Qt::MouseEventSource source)
{
handleMouseEvent<Delivery>(window, timestamp, local, global, b, Qt::NoButton, QEvent::None, mods, source);
return handleMouseEvent<Delivery>(window, timestamp, local, global, b, Qt::NoButton, QEvent::None, mods, source);
}
void QWindowSystemInterface::handleFrameStrutMouseEvent(QWindow *window, const QPointF &local, const QPointF &global, Qt::MouseButtons b,
bool QWindowSystemInterface::handleFrameStrutMouseEvent(QWindow *window, const QPointF &local, const QPointF &global, Qt::MouseButtons b,
Qt::KeyboardModifiers mods, Qt::MouseEventSource source)
{
handleFrameStrutMouseEvent(window, local, global, b, Qt::NoButton, QEvent::None, mods, source);
return handleFrameStrutMouseEvent(window, local, global, b, Qt::NoButton, QEvent::None, mods, source);
}
void QWindowSystemInterface::handleFrameStrutMouseEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global, Qt::MouseButtons b,
bool QWindowSystemInterface::handleFrameStrutMouseEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global, Qt::MouseButtons b,
Qt::KeyboardModifiers mods, Qt::MouseEventSource source)
{
handleFrameStrutMouseEvent(window, timestamp, local, global, b, Qt::NoButton, QEvent::None, mods, source);
return handleFrameStrutMouseEvent(window, timestamp, local, global, b, Qt::NoButton, QEvent::None, mods, source);
}
#endif // QT_DEPRECATED_SINCE(5, 11)
QT_DEFINE_QPA_EVENT_HANDLER(void, handleMouseEvent, QWindow *window,
QT_DEFINE_QPA_EVENT_HANDLER(bool, handleMouseEvent, QWindow *window,
const QPointF &local, const QPointF &global, Qt::MouseButtons state,
Qt::MouseButton button, QEvent::Type type, Qt::KeyboardModifiers mods,
Qt::MouseEventSource source)
{
unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed();
handleMouseEvent<Delivery>(window, time, local, global, state, button, type, mods, source);
return handleMouseEvent<Delivery>(window, time, local, global, state, button, type, mods, source);
}
QT_DEFINE_QPA_EVENT_HANDLER(void, handleMouseEvent, QWindow *window, ulong timestamp,
QT_DEFINE_QPA_EVENT_HANDLER(bool, handleMouseEvent, QWindow *window, ulong timestamp,
const QPointF &local, const QPointF &global, Qt::MouseButtons state,
Qt::MouseButton button, QEvent::Type type, Qt::KeyboardModifiers mods,
Qt::MouseEventSource source)
@ -416,10 +416,10 @@ QT_DEFINE_QPA_EVENT_HANDLER(void, handleMouseEvent, QWindow *window, ulong times
QWindowSystemInterfacePrivate::MouseEvent *e =
new QWindowSystemInterfacePrivate::MouseEvent(window, timestamp, localPos, globalPos,
state, mods, button, type, source);
QWindowSystemInterfacePrivate::handleWindowSystemEvent<Delivery>(e);
return QWindowSystemInterfacePrivate::handleWindowSystemEvent<Delivery>(e);
}
void QWindowSystemInterface::handleFrameStrutMouseEvent(QWindow *window,
bool QWindowSystemInterface::handleFrameStrutMouseEvent(QWindow *window,
const QPointF &local, const QPointF &global,
Qt::MouseButtons state,
Qt::MouseButton button, QEvent::Type type,
@ -427,10 +427,10 @@ void QWindowSystemInterface::handleFrameStrutMouseEvent(QWindow *window,
Qt::MouseEventSource source)
{
const unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed();
handleFrameStrutMouseEvent(window, time, local, global, state, button, type, mods, source);
return handleFrameStrutMouseEvent(window, time, local, global, state, button, type, mods, source);
}
void QWindowSystemInterface::handleFrameStrutMouseEvent(QWindow *window, ulong timestamp,
bool QWindowSystemInterface::handleFrameStrutMouseEvent(QWindow *window, ulong timestamp,
const QPointF &local, const QPointF &global,
Qt::MouseButtons state,
Qt::MouseButton button, QEvent::Type type,
@ -443,7 +443,7 @@ void QWindowSystemInterface::handleFrameStrutMouseEvent(QWindow *window, ulong t
QWindowSystemInterfacePrivate::MouseEvent *e =
new QWindowSystemInterfacePrivate::MouseEvent(window, timestamp, localPos, globalPos,
state, mods, button, type, source, true);
QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
return QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
}
bool QWindowSystemInterface::handleShortcutEvent(QWindow *window, ulong timestamp, int keyCode, Qt::KeyboardModifiers modifiers, quint32 nativeScanCode,
@ -549,28 +549,28 @@ QWindowSystemInterfacePrivate::WheelEvent::WheelEvent(QWindow *window, ulong tim
}
#if QT_DEPRECATED_SINCE(5, 10)
void QWindowSystemInterface::handleWheelEvent(QWindow *window, const QPointF &local, const QPointF &global, int d, Qt::Orientation o, Qt::KeyboardModifiers mods) {
bool QWindowSystemInterface::handleWheelEvent(QWindow *window, const QPointF &local, const QPointF &global, int d, Qt::Orientation o, Qt::KeyboardModifiers mods) {
unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed();
QT_WARNING_PUSH
QT_WARNING_DISABLE_DEPRECATED
handleWheelEvent(window, time, local, global, d, o, mods);
return handleWheelEvent(window, time, local, global, d, o, mods);
QT_WARNING_POP
}
void QWindowSystemInterface::handleWheelEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global, int d, Qt::Orientation o, Qt::KeyboardModifiers mods)
bool QWindowSystemInterface::handleWheelEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global, int d, Qt::Orientation o, Qt::KeyboardModifiers mods)
{
QPoint point = (o == Qt::Vertical) ? QPoint(0, d) : QPoint(d, 0);
handleWheelEvent(window, timestamp, local, global, QPoint(), point, mods);
return handleWheelEvent(window, timestamp, local, global, QPoint(), point, mods);
}
#endif // QT_DEPRECATED_SINCE(5, 10)
void QWindowSystemInterface::handleWheelEvent(QWindow *window, const QPointF &local, const QPointF &global, QPoint pixelDelta, QPoint angleDelta, Qt::KeyboardModifiers mods, Qt::ScrollPhase phase, Qt::MouseEventSource source)
bool QWindowSystemInterface::handleWheelEvent(QWindow *window, const QPointF &local, const QPointF &global, QPoint pixelDelta, QPoint angleDelta, Qt::KeyboardModifiers mods, Qt::ScrollPhase phase, Qt::MouseEventSource source)
{
unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed();
handleWheelEvent(window, time, local, global, pixelDelta, angleDelta, mods, phase, source);
return handleWheelEvent(window, time, local, global, pixelDelta, angleDelta, mods, phase, source);
}
void QWindowSystemInterface::handleWheelEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global, QPoint pixelDelta, QPoint angleDelta, Qt::KeyboardModifiers mods, Qt::ScrollPhase phase,
bool QWindowSystemInterface::handleWheelEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global, QPoint pixelDelta, QPoint angleDelta, Qt::KeyboardModifiers mods, Qt::ScrollPhase phase,
Qt::MouseEventSource source, bool invertedScrolling)
{
// Qt 4 sends two separate wheel events for horizontal and vertical
@ -585,33 +585,35 @@ void QWindowSystemInterface::handleWheelEvent(QWindow *window, ulong timestamp,
// Pass Qt::ScrollBegin and Qt::ScrollEnd through
// even if the wheel delta is null.
if (angleDelta.isNull() && phase == Qt::ScrollUpdate)
return;
return false;
// Simple case: vertical deltas only:
if (angleDelta.y() != 0 && angleDelta.x() == 0) {
e = new QWindowSystemInterfacePrivate::WheelEvent(window, timestamp, QHighDpi::fromNativeLocalPosition(local, window), QHighDpi::fromNativePixels(global, window), pixelDelta, angleDelta, angleDelta.y(), Qt::Vertical,
mods, phase, source, invertedScrolling);
QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
return;
return QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
}
// Simple case: horizontal deltas only:
if (angleDelta.y() == 0 && angleDelta.x() != 0) {
e = new QWindowSystemInterfacePrivate::WheelEvent(window, timestamp, QHighDpi::fromNativeLocalPosition(local, window), QHighDpi::fromNativePixels(global, window), pixelDelta, angleDelta, angleDelta.x(), Qt::Horizontal, mods, phase, source, invertedScrolling);
QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
return;
return QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
}
bool acceptVert;
bool acceptHorz;
// Both horizontal and vertical deltas: Send two wheel events.
// The first event contains the Qt 5 pixel and angle delta as points,
// and in addition the Qt 4 compatibility vertical angle delta.
e = new QWindowSystemInterfacePrivate::WheelEvent(window, timestamp, QHighDpi::fromNativeLocalPosition(local, window), QHighDpi::fromNativePixels(global, window), pixelDelta, angleDelta, angleDelta.y(), Qt::Vertical, mods, phase, source, invertedScrolling);
QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
acceptVert = QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
// The second event contains null pixel and angle points and the
// Qt 4 compatibility horizontal angle delta.
e = new QWindowSystemInterfacePrivate::WheelEvent(window, timestamp, QHighDpi::fromNativeLocalPosition(local, window), QHighDpi::fromNativePixels(global, window), QPoint(), QPoint(), angleDelta.x(), Qt::Horizontal, mods, phase, source, invertedScrolling);
QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
acceptHorz = QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
return acceptVert || acceptHorz;
}
void QWindowSystemInterface::registerTouchDevice(const QTouchDevice *device)
@ -758,21 +760,21 @@ QList<QWindowSystemInterface::TouchPoint>
return newList;
}
QT_DEFINE_QPA_EVENT_HANDLER(void, handleTouchEvent, QWindow *window, QTouchDevice *device,
QT_DEFINE_QPA_EVENT_HANDLER(bool, handleTouchEvent, QWindow *window, QTouchDevice *device,
const QList<TouchPoint> &points, Qt::KeyboardModifiers mods)
{
unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed();
handleTouchEvent<Delivery>(window, time, device, points, mods);
return handleTouchEvent<Delivery>(window, time, device, points, mods);
}
QT_DEFINE_QPA_EVENT_HANDLER(void, handleTouchEvent, QWindow *window, ulong timestamp, QTouchDevice *device,
QT_DEFINE_QPA_EVENT_HANDLER(bool, handleTouchEvent, QWindow *window, ulong timestamp, QTouchDevice *device,
const QList<TouchPoint> &points, Qt::KeyboardModifiers mods)
{
if (!points.size()) // Touch events must have at least one point
return;
return false;
if (!QTouchDevicePrivate::isRegistered(device)) // Disallow passing bogus, non-registered devices.
return;
return false;
QEvent::Type type;
QList<QTouchEvent::TouchPoint> touchPoints =
@ -780,23 +782,23 @@ QT_DEFINE_QPA_EVENT_HANDLER(void, handleTouchEvent, QWindow *window, ulong times
QWindowSystemInterfacePrivate::TouchEvent *e =
new QWindowSystemInterfacePrivate::TouchEvent(window, timestamp, type, device, touchPoints, mods);
QWindowSystemInterfacePrivate::handleWindowSystemEvent<Delivery>(e);
return QWindowSystemInterfacePrivate::handleWindowSystemEvent<Delivery>(e);
}
QT_DEFINE_QPA_EVENT_HANDLER(void, handleTouchCancelEvent, QWindow *window, QTouchDevice *device,
QT_DEFINE_QPA_EVENT_HANDLER(bool, handleTouchCancelEvent, QWindow *window, QTouchDevice *device,
Qt::KeyboardModifiers mods)
{
unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed();
handleTouchCancelEvent<Delivery>(window, time, device, mods);
return handleTouchCancelEvent<Delivery>(window, time, device, mods);
}
QT_DEFINE_QPA_EVENT_HANDLER(void, handleTouchCancelEvent, QWindow *window, ulong timestamp, QTouchDevice *device,
QT_DEFINE_QPA_EVENT_HANDLER(bool, handleTouchCancelEvent, QWindow *window, ulong timestamp, QTouchDevice *device,
Qt::KeyboardModifiers mods)
{
QWindowSystemInterfacePrivate::TouchEvent *e =
new QWindowSystemInterfacePrivate::TouchEvent(window, timestamp, QEvent::TouchCancel, device,
QList<QTouchEvent::TouchPoint>(), mods);
QWindowSystemInterfacePrivate::handleWindowSystemEvent<Delivery>(e);
return QWindowSystemInterfacePrivate::handleWindowSystemEvent<Delivery>(e);
}
/*!
@ -970,7 +972,7 @@ void QWindowSystemInterfacePrivate::TabletEvent::setPlatformSynthesizesMouse(boo
platformSynthesizesMouse = v;
}
void QWindowSystemInterface::handleTabletEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global,
bool QWindowSystemInterface::handleTabletEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global,
int device, int pointerType, Qt::MouseButtons buttons, qreal pressure, int xTilt, int yTilt,
qreal tangentialPressure, qreal rotation, int z, qint64 uid,
Qt::KeyboardModifiers modifiers)
@ -981,16 +983,16 @@ void QWindowSystemInterface::handleTabletEvent(QWindow *window, ulong timestamp,
QHighDpi::fromNativePixels(global, window),
device, pointerType, buttons, pressure,
xTilt, yTilt, tangentialPressure, rotation, z, uid, modifiers);
QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
return QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
}
void QWindowSystemInterface::handleTabletEvent(QWindow *window, const QPointF &local, const QPointF &global,
bool QWindowSystemInterface::handleTabletEvent(QWindow *window, const QPointF &local, const QPointF &global,
int device, int pointerType, Qt::MouseButtons buttons, qreal pressure, int xTilt, int yTilt,
qreal tangentialPressure, qreal rotation, int z, qint64 uid,
Qt::KeyboardModifiers modifiers)
{
ulong time = QWindowSystemInterfacePrivate::eventTime.elapsed();
handleTabletEvent(window, time, local, global, device, pointerType, buttons, pressure,
return handleTabletEvent(window, time, local, global, device, pointerType, buttons, pressure,
xTilt, yTilt, tangentialPressure, rotation, z, uid, modifiers);
}
@ -1014,11 +1016,11 @@ void QWindowSystemInterface::handleTabletEvent(QWindow *window, bool down, const
}
#endif // QT_DEPRECATED_SINCE(5, 10)
void QWindowSystemInterface::handleTabletEnterProximityEvent(ulong timestamp, int device, int pointerType, qint64 uid)
bool QWindowSystemInterface::handleTabletEnterProximityEvent(ulong timestamp, int device, int pointerType, qint64 uid)
{
QWindowSystemInterfacePrivate::TabletEnterProximityEvent *e =
new QWindowSystemInterfacePrivate::TabletEnterProximityEvent(timestamp, device, pointerType, uid);
QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
return QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
}
void QWindowSystemInterface::handleTabletEnterProximityEvent(int device, int pointerType, qint64 uid)
@ -1027,11 +1029,11 @@ void QWindowSystemInterface::handleTabletEnterProximityEvent(int device, int poi
handleTabletEnterProximityEvent(time, device, pointerType, uid);
}
void QWindowSystemInterface::handleTabletLeaveProximityEvent(ulong timestamp, int device, int pointerType, qint64 uid)
bool QWindowSystemInterface::handleTabletLeaveProximityEvent(ulong timestamp, int device, int pointerType, qint64 uid)
{
QWindowSystemInterfacePrivate::TabletLeaveProximityEvent *e =
new QWindowSystemInterfacePrivate::TabletLeaveProximityEvent(timestamp, device, pointerType, uid);
QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
return QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
}
void QWindowSystemInterface::handleTabletLeaveProximityEvent(int device, int pointerType, qint64 uid)
@ -1041,31 +1043,31 @@ void QWindowSystemInterface::handleTabletLeaveProximityEvent(int device, int poi
}
#ifndef QT_NO_GESTURES
void QWindowSystemInterface::handleGestureEvent(QWindow *window, QTouchDevice *device, ulong timestamp, Qt::NativeGestureType type,
bool QWindowSystemInterface::handleGestureEvent(QWindow *window, QTouchDevice *device, ulong timestamp, Qt::NativeGestureType type,
QPointF &local, QPointF &global)
{
QWindowSystemInterfacePrivate::GestureEvent *e =
new QWindowSystemInterfacePrivate::GestureEvent(window, timestamp, type, device, local, global);
QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
return QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
}
void QWindowSystemInterface::handleGestureEventWithRealValue(QWindow *window, QTouchDevice *device, ulong timestamp, Qt::NativeGestureType type,
bool QWindowSystemInterface::handleGestureEventWithRealValue(QWindow *window, QTouchDevice *device, ulong timestamp, Qt::NativeGestureType type,
qreal value, QPointF &local, QPointF &global)
{
QWindowSystemInterfacePrivate::GestureEvent *e =
new QWindowSystemInterfacePrivate::GestureEvent(window, timestamp, type, device, local, global);
e->realValue = value;
QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
return QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
}
void QWindowSystemInterface::handleGestureEventWithSequenceIdAndValue(QWindow *window, QTouchDevice *device, ulong timestamp, Qt::NativeGestureType type,
bool QWindowSystemInterface::handleGestureEventWithSequenceIdAndValue(QWindow *window, QTouchDevice *device, ulong timestamp, Qt::NativeGestureType type,
ulong sequenceId, quint64 value, QPointF &local, QPointF &global)
{
QWindowSystemInterfacePrivate::GestureEvent *e =
new QWindowSystemInterfacePrivate::GestureEvent(window, timestamp, type, device, local, global);
e->sequenceId = sequenceId;
e->intValue = value;
QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
return QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
}
#endif // QT_NO_GESTURES

View File

@ -78,40 +78,40 @@ public:
#if QT_DEPRECATED_SINCE(5, 11)
template<typename Delivery = QWindowSystemInterface::DefaultDelivery>
QT_DEPRECATED static void handleMouseEvent(QWindow *window, const QPointF &local, const QPointF &global, Qt::MouseButtons b,
QT_DEPRECATED static bool handleMouseEvent(QWindow *window, const QPointF &local, const QPointF &global, Qt::MouseButtons b,
Qt::KeyboardModifiers mods = Qt::NoModifier,
Qt::MouseEventSource source = Qt::MouseEventNotSynthesized);
template<typename Delivery = QWindowSystemInterface::DefaultDelivery>
QT_DEPRECATED static void handleMouseEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global, Qt::MouseButtons b,
QT_DEPRECATED static bool handleMouseEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global, Qt::MouseButtons b,
Qt::KeyboardModifiers mods = Qt::NoModifier,
Qt::MouseEventSource source = Qt::MouseEventNotSynthesized);
QT_DEPRECATED static void handleFrameStrutMouseEvent(QWindow *window, const QPointF &local, const QPointF &global, Qt::MouseButtons b,
QT_DEPRECATED static bool handleFrameStrutMouseEvent(QWindow *window, const QPointF &local, const QPointF &global, Qt::MouseButtons b,
Qt::KeyboardModifiers mods = Qt::NoModifier,
Qt::MouseEventSource source = Qt::MouseEventNotSynthesized);
QT_DEPRECATED static void handleFrameStrutMouseEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global, Qt::MouseButtons b,
QT_DEPRECATED static bool handleFrameStrutMouseEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global, Qt::MouseButtons b,
Qt::KeyboardModifiers mods = Qt::NoModifier,
Qt::MouseEventSource source = Qt::MouseEventNotSynthesized);
#endif
template<typename Delivery = QWindowSystemInterface::DefaultDelivery>
static void handleMouseEvent(QWindow *window, const QPointF &local, const QPointF &global,
static bool handleMouseEvent(QWindow *window, const QPointF &local, const QPointF &global,
Qt::MouseButtons state, Qt::MouseButton button, QEvent::Type type,
Qt::KeyboardModifiers mods = Qt::NoModifier,
Qt::MouseEventSource source = Qt::MouseEventNotSynthesized);
template<typename Delivery = QWindowSystemInterface::DefaultDelivery>
static void handleMouseEvent(QWindow *window, ulong timestamp, const QPointF &local,
static bool handleMouseEvent(QWindow *window, ulong timestamp, const QPointF &local,
const QPointF &global, Qt::MouseButtons state,
Qt::MouseButton button, QEvent::Type type,
Qt::KeyboardModifiers mods = Qt::NoModifier,
Qt::MouseEventSource source = Qt::MouseEventNotSynthesized);
static void handleFrameStrutMouseEvent(QWindow *window, const QPointF &local,
static bool handleFrameStrutMouseEvent(QWindow *window, const QPointF &local,
const QPointF &global, Qt::MouseButtons state,
Qt::MouseButton button, QEvent::Type type,
Qt::KeyboardModifiers mods = Qt::NoModifier,
Qt::MouseEventSource source =
Qt::MouseEventNotSynthesized);
static void handleFrameStrutMouseEvent(QWindow *window, ulong timestamp, const QPointF &local,
static bool handleFrameStrutMouseEvent(QWindow *window, ulong timestamp, const QPointF &local,
const QPointF &global, Qt::MouseButtons state,
Qt::MouseButton button, QEvent::Type type,
Qt::KeyboardModifiers mods = Qt::NoModifier,
@ -136,12 +136,12 @@ public:
quint32 nativeModifiers,
const QString& text = QString(), bool autorep = false,
ushort count = 1, bool tryShortcutOverride = true);
static void handleWheelEvent(QWindow *window, const QPointF &local, const QPointF &global,
static bool handleWheelEvent(QWindow *window, const QPointF &local, const QPointF &global,
QPoint pixelDelta, QPoint angleDelta,
Qt::KeyboardModifiers mods = Qt::NoModifier,
Qt::ScrollPhase phase = Qt::NoScrollPhase,
Qt::MouseEventSource source = Qt::MouseEventNotSynthesized);
static void handleWheelEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global,
static bool handleWheelEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global,
QPoint pixelDelta, QPoint angleDelta,
Qt::KeyboardModifiers mods = Qt::NoModifier,
Qt::ScrollPhase phase = Qt::NoScrollPhase,
@ -149,8 +149,8 @@ public:
bool inverted = false);
#if QT_DEPRECATED_SINCE(5, 10)
QT_DEPRECATED static void handleWheelEvent(QWindow *window, const QPointF &local, const QPointF &global, int d, Qt::Orientation o, Qt::KeyboardModifiers mods = Qt::NoModifier);
QT_DEPRECATED static void handleWheelEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global, int d, Qt::Orientation o, Qt::KeyboardModifiers mods = Qt::NoModifier);
QT_DEPRECATED static bool handleWheelEvent(QWindow *window, const QPointF &local, const QPointF &global, int d, Qt::Orientation o, Qt::KeyboardModifiers mods = Qt::NoModifier);
QT_DEPRECATED static bool handleWheelEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global, int d, Qt::Orientation o, Qt::KeyboardModifiers mods = Qt::NoModifier);
#endif
struct TouchPoint {
@ -175,15 +175,15 @@ public:
static bool isTouchDeviceRegistered(const QTouchDevice *device);
template<typename Delivery = QWindowSystemInterface::DefaultDelivery>
static void handleTouchEvent(QWindow *window, QTouchDevice *device,
static bool handleTouchEvent(QWindow *window, QTouchDevice *device,
const QList<struct TouchPoint> &points, Qt::KeyboardModifiers mods = Qt::NoModifier);
template<typename Delivery = QWindowSystemInterface::DefaultDelivery>
static void handleTouchEvent(QWindow *window, ulong timestamp, QTouchDevice *device,
static bool handleTouchEvent(QWindow *window, ulong timestamp, QTouchDevice *device,
const QList<struct TouchPoint> &points, Qt::KeyboardModifiers mods = Qt::NoModifier);
template<typename Delivery = QWindowSystemInterface::DefaultDelivery>
static void handleTouchCancelEvent(QWindow *window, QTouchDevice *device, Qt::KeyboardModifiers mods = Qt::NoModifier);
static bool handleTouchCancelEvent(QWindow *window, QTouchDevice *device, Qt::KeyboardModifiers mods = Qt::NoModifier);
template<typename Delivery = QWindowSystemInterface::DefaultDelivery>
static void handleTouchCancelEvent(QWindow *window, ulong timestamp, QTouchDevice *device, Qt::KeyboardModifiers mods = Qt::NoModifier);
static bool handleTouchCancelEvent(QWindow *window, ulong timestamp, QTouchDevice *device, Qt::KeyboardModifiers mods = Qt::NoModifier);
// rect is relative to parent
template<typename Delivery = QWindowSystemInterface::DefaultDelivery>
@ -255,11 +255,11 @@ public:
static void handleFileOpenEvent(const QString& fileName);
static void handleFileOpenEvent(const QUrl &url);
static void handleTabletEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global,
static bool handleTabletEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global,
int device, int pointerType, Qt::MouseButtons buttons, qreal pressure, int xTilt, int yTilt,
qreal tangentialPressure, qreal rotation, int z, qint64 uid,
Qt::KeyboardModifiers modifiers = Qt::NoModifier);
static void handleTabletEvent(QWindow *window, const QPointF &local, const QPointF &global,
static bool handleTabletEvent(QWindow *window, const QPointF &local, const QPointF &global,
int device, int pointerType, Qt::MouseButtons buttons, qreal pressure, int xTilt, int yTilt,
qreal tangentialPressure, qreal rotation, int z, qint64 uid,
Qt::KeyboardModifiers modifiers = Qt::NoModifier);
@ -273,17 +273,17 @@ public:
qreal tangentialPressure, qreal rotation, int z, qint64 uid,
Qt::KeyboardModifiers modifiers = Qt::NoModifier);
#endif
static void handleTabletEnterProximityEvent(ulong timestamp, int device, int pointerType, qint64 uid);
static bool handleTabletEnterProximityEvent(ulong timestamp, int device, int pointerType, qint64 uid);
static void handleTabletEnterProximityEvent(int device, int pointerType, qint64 uid);
static void handleTabletLeaveProximityEvent(ulong timestamp, int device, int pointerType, qint64 uid);
static bool handleTabletLeaveProximityEvent(ulong timestamp, int device, int pointerType, qint64 uid);
static void handleTabletLeaveProximityEvent(int device, int pointerType, qint64 uid);
#ifndef QT_NO_GESTURES
static void handleGestureEvent(QWindow *window, QTouchDevice *device, ulong timestamp, Qt::NativeGestureType type,
static bool handleGestureEvent(QWindow *window, QTouchDevice *device, ulong timestamp, Qt::NativeGestureType type,
QPointF &local, QPointF &global);
static void handleGestureEventWithRealValue(QWindow *window, QTouchDevice *device, ulong timestamp, Qt::NativeGestureType type,
static bool handleGestureEventWithRealValue(QWindow *window, QTouchDevice *device, ulong timestamp, Qt::NativeGestureType type,
qreal value, QPointF &local, QPointF &global);
static void handleGestureEventWithSequenceIdAndValue(QWindow *window, QTouchDevice *device, ulong timestamp,Qt::NativeGestureType type,
static bool handleGestureEventWithSequenceIdAndValue(QWindow *window, QTouchDevice *device, ulong timestamp,Qt::NativeGestureType type,
ulong sequenceId, quint64 value, QPointF &local, QPointF &global);
#endif // QT_NO_GESTURES

View File

@ -47,6 +47,8 @@
#include <QtCore/qcoreapplication.h>
#include <QtCore/qoperatingsystemversion.h>
QT_USE_NAMESPACE
QT_BEGIN_NAMESPACE
// ---------------------- Images ----------------------
@ -124,46 +126,72 @@ QImage qt_mac_toQImage(CGImageRef image)
#ifdef Q_OS_MACOS
static NSImage *qt_mac_cgimage_to_nsimage(CGImageRef image)
QT_END_NAMESPACE
@implementation NSImage (QtExtras)
+ (instancetype)imageFromQImage:(const QImage &)image
{
NSImage *newImage = [[NSImage alloc] initWithCGImage:image size:NSZeroSize];
return newImage;
if (image.isNull())
return nil;
QCFType<CGImageRef> cgImage = image.toCGImage();
if (!cgImage)
return nil;
// We set up the NSImage using an explicit NSBitmapImageRep, instead of
// [NSImage initWithCGImage:size:], as the former allows us to correctly
// set the size of the representation to account for the device pixel
// ratio of the original image, which in turn will be reflected by the
// NSImage.
auto nsImage = [[NSImage alloc] initWithSize:NSZeroSize];
auto *imageRep = [[NSBitmapImageRep alloc] initWithCGImage:cgImage];
imageRep.size = (image.size() / image.devicePixelRatioF()).toCGSize();
[nsImage addRepresentation:[imageRep autorelease]];
Q_ASSERT(CGSizeEqualToSize(nsImage.size, imageRep.size));
return [nsImage autorelease];
}
NSImage *qt_mac_create_nsimage(const QPixmap &pm)
+ (instancetype)imageFromQIcon:(const QIcon &)icon
{
if (pm.isNull())
return 0;
QImage image = pm.toImage();
CGImageRef cgImage = qt_mac_toCGImage(image);
NSImage *nsImage = qt_mac_cgimage_to_nsimage(cgImage);
nsImage.size = (pm.size() / pm.devicePixelRatioF()).toCGSize();
CGImageRelease(cgImage);
return nsImage;
return [NSImage imageFromQIcon:icon withSize:0];
}
NSImage *qt_mac_create_nsimage(const QIcon &icon, int defaultSize)
+ (instancetype)imageFromQIcon:(const QIcon &)icon withSize:(int)size
{
if (icon.isNull())
return nil;
NSImage *nsImage = [[NSImage alloc] init];
QList<QSize> availableSizes = icon.availableSizes();
if (availableSizes.isEmpty() && defaultSize > 0)
availableSizes << QSize(defaultSize, defaultSize);
auto nsImage = [[NSImage alloc] initWithSize:NSZeroSize];
auto availableSizes = icon.availableSizes();
if (availableSizes.isEmpty() && size > 0)
availableSizes << QSize(size, size);
for (QSize size : qAsConst(availableSizes)) {
QPixmap pm = icon.pixmap(size);
if (pm.isNull())
QImage image = icon.pixmap(size).toImage();
if (image.isNull())
continue;
QImage image = pm.toImage();
CGImageRef cgImage = qt_mac_toCGImage(image);
NSBitmapImageRep *imageRep = [[NSBitmapImageRep alloc] initWithCGImage:cgImage];
[nsImage addRepresentation:imageRep];
[imageRep release];
CGImageRelease(cgImage);
QCFType<CGImageRef> cgImage = image.toCGImage();
if (!cgImage)
continue;
auto *imageRep = [[NSBitmapImageRep alloc] initWithCGImage:cgImage];
imageRep.size = (image.size() / image.devicePixelRatioF()).toCGSize();
[nsImage addRepresentation:[imageRep autorelease]];
}
return nsImage;
[nsImage setTemplate:icon.isMask()];
if (size)
nsImage.size = CGSizeMake(size, size);
return [nsImage autorelease];
}
@end
QT_BEGIN_NAMESPACE
QPixmap qt_mac_toQPixmap(const NSImage *image, const QSizeF &size)
{

View File

@ -69,9 +69,16 @@ QT_BEGIN_NAMESPACE
Q_GUI_EXPORT CGBitmapInfo qt_mac_bitmapInfoForImage(const QImage &image);
#ifdef HAVE_APPKIT
Q_GUI_EXPORT NSImage *qt_mac_create_nsimage(const QPixmap &pm);
Q_GUI_EXPORT NSImage *qt_mac_create_nsimage(const QIcon &icon, int defaultSize = 0);
Q_GUI_EXPORT QPixmap qt_mac_toQPixmap(const NSImage *image, const QSizeF &size);
QT_END_NAMESPACE
@interface NSImage (QtExtras)
+ (instancetype)imageFromQImage:(const QT_PREPEND_NAMESPACE(QImage) &)image;
+ (instancetype)imageFromQIcon:(const QT_PREPEND_NAMESPACE(QIcon) &)icon;
+ (instancetype)imageFromQIcon:(const QT_PREPEND_NAMESPACE(QIcon) &)icon withSize:(int)size;
@end
QT_BEGIN_NAMESPACE
#endif
Q_GUI_EXPORT CGImageRef qt_mac_toCGImage(const QImage &qImage);
Q_GUI_EXPORT CGImageRef qt_mac_toCGImageMask(const QImage &qImage);

View File

@ -230,6 +230,12 @@ static const hb_script_t _qtscript_to_hbscript[] = {
hb_script_t(HB_TAG('N', 'a', 'n', 'd')), // Script_Nandinagari
hb_script_t(HB_TAG('H', 'm', 'n', 'p')), // Script_NyiakengPuachueHmong
hb_script_t(HB_TAG('W', 'c', 'h', 'o')), // Script_Wancho
// Unicode 13.0 additions (as above)
hb_script_t(HB_TAG('C', 'h', 'o', 'r')), // Script_Chorasmian
hb_script_t(HB_TAG('D', 'i', 'v', 'e')), // Script_DivesAkuru
hb_script_t(HB_TAG('K', 'h', 'i', 't')), // Script_KhitanSmallScript
hb_script_t(HB_TAG('Y', 'e', 'z', 'i')), // Script_Yezidi
};
Q_STATIC_ASSERT(QChar::ScriptCount == sizeof(_qtscript_to_hbscript) / sizeof(_qtscript_to_hbscript[0]));

View File

@ -1358,6 +1358,37 @@ void QTextEngine::shapeLine(const QScriptLine &line)
extern bool qt_useHarfbuzzNG(); // defined in qfontengine.cpp
#endif
static void applyVisibilityRules(ushort ucs, QGlyphLayout *glyphs, uint glyphPosition, QFontEngine *fontEngine)
{
// hide characters that should normally be invisible
switch (ucs) {
case QChar::LineFeed:
case 0x000c: // FormFeed
case QChar::CarriageReturn:
case QChar::LineSeparator:
case QChar::ParagraphSeparator:
glyphs->attributes[glyphPosition].dontPrint = true;
break;
case QChar::SoftHyphen:
if (!fontEngine->symbol) {
// U+00AD [SOFT HYPHEN] is a default ignorable codepoint,
// so we replace its glyph and metrics with ones for
// U+002D [HYPHEN-MINUS] and make it visible if it appears at line-break
const uint engineIndex = glyphs->glyphs[glyphPosition] & 0xff000000;
glyphs->glyphs[glyphPosition] = fontEngine->glyphIndex('-');
if (Q_LIKELY(glyphs->glyphs[glyphPosition] != 0)) {
glyphs->glyphs[glyphPosition] |= engineIndex;
QGlyphLayout tmp = glyphs->mid(glyphPosition, 1);
fontEngine->recalcAdvances(&tmp, { });
}
glyphs->attributes[glyphPosition].dontPrint = true;
}
break;
default:
break;
}
}
void QTextEngine::shapeText(int item) const
{
Q_ASSERT(item < layoutData->items.size());
@ -1491,6 +1522,20 @@ void QTextEngine::shapeText(int item) const
&& QChar::isLowSurrogate(string[i + 1])) {
++i;
log_clusters[i] = glyph_pos;
initialGlyphs.attributes[glyph_pos].dontPrint = !QChar::isPrint(QChar::surrogateToUcs4(string[i], string[i + 1]));
} else {
initialGlyphs.attributes[glyph_pos].dontPrint = !QChar::isPrint(string[i]);
}
if (Q_UNLIKELY(!initialGlyphs.attributes[glyph_pos].dontPrint)) {
QFontEngine *actualFontEngine = fontEngine;
if (actualFontEngine->type() == QFontEngine::Multi) {
const uint engineIdx = initialGlyphs.glyphs[glyph_pos] >> 24;
actualFontEngine = static_cast<QFontEngineMulti *>(fontEngine)->engine(engineIdx);
}
applyVisibilityRules(string[i], &initialGlyphs, glyph_pos, actualFontEngine);
}
}
@ -1702,31 +1747,7 @@ int QTextEngine::shapeTextWithHarfbuzzNG(const QScriptItem &si,
last_glyph_pos = i + glyphs_shaped;
last_cluster = cluster;
// hide characters that should normally be invisible
switch (string[item_pos + str_pos]) {
case QChar::LineFeed:
case 0x000c: // FormFeed
case QChar::CarriageReturn:
case QChar::LineSeparator:
case QChar::ParagraphSeparator:
g.attributes[i].dontPrint = true;
break;
case QChar::SoftHyphen:
if (!actualFontEngine->symbol) {
// U+00AD [SOFT HYPHEN] is a default ignorable codepoint,
// so we replace its glyph and metrics with ones for
// U+002D [HYPHEN-MINUS] and make it visible if it appears at line-break
g.glyphs[i] = actualFontEngine->glyphIndex('-');
if (Q_LIKELY(g.glyphs[i] != 0)) {
QGlyphLayout tmp = g.mid(i, 1);
actualFontEngine->recalcAdvances(&tmp, { });
}
g.attributes[i].dontPrint = true;
}
break;
default:
break;
}
applyVisibilityRules(string[item_pos + str_pos], &g, i, actualFontEngine);
}
}
while (str_pos < item_length)

View File

@ -1667,7 +1667,8 @@ namespace {
QFontEngine *previousGlyphFontEngine;
QFixed minw;
QFixed softHyphenWidth;
QFixed currentSoftHyphenWidth;
QFixed commitedSoftHyphenWidth;
QFixed rightBearing;
QFixed minimumRightBearing;
@ -1681,7 +1682,7 @@ namespace {
QFixed calculateNewWidth(const QScriptLine &line) const {
return line.textWidth + tmpData.textWidth + spaceData.textWidth
+ softHyphenWidth + negativeRightBearing();
+ (line.textWidth > 0 ? currentSoftHyphenWidth : QFixed()) + negativeRightBearing();
}
inline glyph_t currentGlyph() const
@ -1755,6 +1756,7 @@ inline bool LineBreakHelper::checkFullOtherwiseExtend(QScriptLine &line)
if (line.length && !manualWrap && (newWidth > line.width || glyphCount > maxGlyphs))
return true;
const QFixed oldTextWidth = line.textWidth;
minw = qMax(minw, tmpData.textWidth);
line += tmpData;
line.textWidth += spaceData.textWidth;
@ -1765,6 +1767,11 @@ inline bool LineBreakHelper::checkFullOtherwiseExtend(QScriptLine &line)
spaceData.textWidth = 0;
spaceData.length = 0;
if (oldTextWidth != line.textWidth || currentSoftHyphenWidth > 0) {
commitedSoftHyphenWidth = currentSoftHyphenWidth;
currentSoftHyphenWidth = 0;
}
return false;
}
@ -1837,7 +1844,6 @@ void QTextLine::layout_helper(int maxGlyphs)
while (newItem < eng->layoutData->items.size()) {
lbh.resetRightBearing();
lbh.softHyphenWidth = 0;
if (newItem != item) {
item = newItem;
const QScriptItem &current = eng->layoutData->items.at(item);
@ -1975,9 +1981,9 @@ void QTextLine::layout_helper(int maxGlyphs)
} while (lbh.currentPosition < end);
lbh.minw = qMax(lbh.tmpData.textWidth, lbh.minw);
if (lbh.currentPosition > 0 && lbh.currentPosition < end
&& attributes[lbh.currentPosition].lineBreak
&& eng->layoutData->string.at(lbh.currentPosition - 1).unicode() == QChar::SoftHyphen) {
if (lbh.currentPosition > 0 && lbh.currentPosition <= end
&& (lbh.currentPosition == end || attributes[lbh.currentPosition].lineBreak)
&& eng->layoutData->string.at(lbh.currentPosition - 1) == QChar::SoftHyphen) {
// if we are splitting up a word because of
// a soft hyphen then we ...
//
@ -1994,10 +2000,7 @@ void QTextLine::layout_helper(int maxGlyphs)
// want the soft-hyphen to slip into the next line
// and thus become invisible again.
//
if (line.length)
lbh.softHyphenWidth = lbh.glyphs.advances[lbh.logClusters[lbh.currentPosition - 1]];
else if (breakany)
lbh.tmpData.textWidth += lbh.glyphs.advances[lbh.logClusters[lbh.currentPosition - 1]];
lbh.currentSoftHyphenWidth = lbh.glyphs.advances[lbh.logClusters[lbh.currentPosition - 1]];
}
if (sb_or_ws|breakany) {
@ -2023,6 +2026,7 @@ void QTextLine::layout_helper(int maxGlyphs)
lbh.calculateRightBearing();
if (lbh.checkFullOtherwiseExtend(line)) {
// We are too wide to accept the next glyph with its bearing, so we restore the
// right bearing to that of the previous glyph (the one that was already accepted),
// so that the bearing can be be applied to the final width of the text below.
@ -2031,9 +2035,7 @@ void QTextLine::layout_helper(int maxGlyphs)
else
lbh.calculateRightBearingForPreviousGlyph();
if (!breakany) {
line.textWidth += lbh.softHyphenWidth;
}
line.textWidth += lbh.commitedSoftHyphenWidth;
goto found;
}
@ -2045,6 +2047,7 @@ void QTextLine::layout_helper(int maxGlyphs)
}
LB_DEBUG("reached end of line");
lbh.checkFullOtherwiseExtend(line);
line.textWidth += lbh.commitedSoftHyphenWidth;
found:
line.textAdvance = line.textWidth;

View File

@ -66,7 +66,8 @@ public:
OpenGLNoProfile,
OpenGLCoreProfile,
OpenGLCompatibilityProfile,
OpenGLES
OpenGLES,
VulkanFlavoredGLSL
};
enum ShaderType : int {

View File

@ -217,9 +217,10 @@ void QShaderNodesLoader::load(const QJsonObject &prototypesObject)
: api == QStringLiteral("OpenGLNoProfile") ? QShaderFormat::OpenGLNoProfile
: api == QStringLiteral("OpenGLCoreProfile") ? QShaderFormat::OpenGLCoreProfile
: api == QStringLiteral("OpenGLCompatibilityProfile") ? QShaderFormat::OpenGLCompatibilityProfile
: api == QStringLiteral("VulkanFlavoredGLSL") ? QShaderFormat::VulkanFlavoredGLSL
: QShaderFormat::NoApi);
if (format.api() == QShaderFormat::NoApi) {
qWarning() << "Format API must be one of: OpenGLES, OpenGLNoProfile, OpenGLCoreProfile or OpenGLCompatibilityProfile";
qWarning() << "Format API must be one of: OpenGLES, OpenGLNoProfile, OpenGLCoreProfile or OpenGLCompatibilityProfile, VulkanFlavoredGLSL";
hasError = true;
break;
}

View File

@ -37,6 +37,8 @@
**
****************************************************************************/
#include <QtNetwork/private/qtnetworkglobal_p.h>
#include "qnetworkaccessmanager.h"
#include "qnetworkaccessmanager_p.h"
#include "qnetworkrequest.h"

View File

@ -91,7 +91,7 @@ public:
};
#ifndef QT_NO_BEARERMANAGEMENT // ### Qt6: Remove section
enum QT_DEPRECATED_VERSION_5_15 NetworkAccessibility {
enum QT_DEPRECATED_NETWORK_API_5_15 NetworkAccessibility {
UnknownAccessibility = -1,
NotAccessible = 0,
Accessible = 1

View File

@ -37,6 +37,8 @@
**
****************************************************************************/
#include <QtNetwork/private/qtnetworkglobal_p.h>
#include "qnetworkreply.h"
#include "qnetworkreply_p.h"
#include <QtNetwork/qsslconfiguration.h>

View File

@ -157,7 +157,7 @@ Q_SIGNALS:
void metaDataChanged();
void finished();
#if QT_DEPRECATED_SINCE(5,15)
QT_DEPRECATED_X("Use QNetworkReply::errorOccurred(QNetworkReply::NetworkError) instead")
QT_DEPRECATED_NETWORK_API_5_15_X("Use QNetworkReply::errorOccurred(QNetworkReply::NetworkError) instead")
void error(QNetworkReply::NetworkError);
#endif
void errorOccurred(QNetworkReply::NetworkError);

View File

@ -37,6 +37,8 @@
**
****************************************************************************/
#include <QtNetwork/private/qtnetworkglobal_p.h>
#include "qnetworkconfigmanager.h"
#include "qnetworkconfigmanager_p.h"

View File

@ -56,15 +56,7 @@ QT_WARNING_DISABLE_DEPRECATED
QT_BEGIN_NAMESPACE
class QNetworkConfigurationManagerPrivate;
// We work around an issue in ICC where it errors out during compilation of Qt by not marking it
// deprecated if ICC is used
#ifdef Q_CC_INTEL
#define QT_DEPRECATED_VERSION_5_15_BUT_NOT_FOR_ICC
#else
#define QT_DEPRECATED_VERSION_5_15_BUT_NOT_FOR_ICC QT_DEPRECATED_VERSION_5_15
#endif
class QT_DEPRECATED_VERSION_5_15_BUT_NOT_FOR_ICC Q_NETWORK_EXPORT QNetworkConfigurationManager : public QObject
#undef QT_DEPRECATED_VERSION_5_15_BUT_NOT_FOR_ICC
class QT_DEPRECATED_BEARER_MANAGEMENT Q_NETWORK_EXPORT QNetworkConfigurationManager : public QObject
{
Q_OBJECT

View File

@ -37,6 +37,8 @@
**
****************************************************************************/
#include <QtNetwork/private/qtnetworkglobal_p.h>
#include "qnetworkconfiguration.h"
#include "qnetworkconfiguration_p.h"
#include <QDebug>

View File

@ -57,15 +57,7 @@ QT_WARNING_DISABLE_DEPRECATED
QT_BEGIN_NAMESPACE
class QNetworkConfigurationPrivate;
// We work around an issue in ICC where it errors out during compilation of Qt by not marking it
// deprecated if ICC is used
#ifdef Q_CC_INTEL
#define QT_DEPRECATED_VERSION_5_15_BUT_NOT_FOR_ICC
#else
#define QT_DEPRECATED_VERSION_5_15_BUT_NOT_FOR_ICC QT_DEPRECATED_VERSION_5_15
#endif
class QT_DEPRECATED_VERSION_5_15_BUT_NOT_FOR_ICC Q_NETWORK_EXPORT QNetworkConfiguration
#undef QT_DEPRECATED_VERSION_5_15_BUT_NOT_FOR_ICC
class QT_DEPRECATED_BEARER_MANAGEMENT Q_NETWORK_EXPORT QNetworkConfiguration
{
public:
QNetworkConfiguration();

View File

@ -37,6 +37,8 @@
**
****************************************************************************/
#include <QtNetwork/private/qtnetworkglobal_p.h>
#include "qnetworksession.h"
#include "qnetworksession_p.h"
#include "qbearerengine_p.h"

View File

@ -64,15 +64,7 @@ QT_WARNING_DISABLE_DEPRECATED
QT_BEGIN_NAMESPACE
class QNetworkSessionPrivate;
// We work around an issue in ICC where it errors out during compilation of Qt by not marking it
// deprecated if ICC is used
#ifdef Q_CC_INTEL
#define QT_DEPRECATED_VERSION_5_15_BUT_NOT_FOR_ICC
#else
#define QT_DEPRECATED_VERSION_5_15_BUT_NOT_FOR_ICC QT_DEPRECATED_VERSION_5_15
#endif
class QT_DEPRECATED_VERSION_5_15_BUT_NOT_FOR_ICC Q_NETWORK_EXPORT QNetworkSession : public QObject
#undef QT_DEPRECATED_VERSION_5_15_BUT_NOT_FOR_ICC
class QT_DEPRECATED_BEARER_MANAGEMENT Q_NETWORK_EXPORT QNetworkSession : public QObject
{
Q_OBJECT

View File

@ -55,6 +55,19 @@ QT_BEGIN_NAMESPACE
# define Q_NETWORK_EXPORT
#endif
// ### Qt6: Remove
// We work around an issue in ICC where it errors out during compilation of Qt by not marking it
// deprecated if ICC is used
#ifdef Q_CC_INTEL
#define QT_DEPRECATED_BEARER_MANAGEMENT
#else
#define QT_DEPRECATED_BEARER_MANAGEMENT QT_DEPRECATED_VERSION_5_15
#endif
// ### Qt6: Remove
#define QT_DEPRECATED_NETWORK_API_5_15 QT_DEPRECATED_VERSION_5_15
#define QT_DEPRECATED_NETWORK_API_5_15_X QT_DEPRECATED_VERSION_X_5_15
QT_END_NAMESPACE
#endif

View File

@ -55,4 +55,21 @@
#include <QtCore/private/qglobal_p.h>
#include <QtNetwork/private/qtnetwork-config_p.h>
// ### Qt6: Remove
#ifdef QT_DEPRECATED_BEARER_MANAGEMENT
#undef QT_DEPRECATED_BEARER_MANAGEMENT
#endif
#define QT_DEPRECATED_BEARER_MANAGEMENT
// ### Qt6: Remove
#ifdef QT_DEPRECATED_NETWORK_API_5_15
#undef QT_DEPRECATED_NETWORK_API_5_15
#endif
#define QT_DEPRECATED_NETWORK_API_5_15
#ifdef QT_DEPRECATED_NETWORK_API_5_15_X
#undef QT_DEPRECATED_NETWORK_API_5_15_X
#endif
#define QT_DEPRECATED_NETWORK_API_5_15_X(x)
#endif // QTNETWORKGLOBAL_P_H

File diff suppressed because it is too large Load Diff

View File

@ -469,6 +469,8 @@
SSL error notification. I.E. QSslSocket::sslErrors().
*/
#include <QtNetwork/private/qtnetworkglobal_p.h>
#include "qabstractsocket.h"
#include "qabstractsocket_p.h"

View File

@ -207,7 +207,7 @@ Q_SIGNALS:
void disconnected();
void stateChanged(QAbstractSocket::SocketState);
#if QT_DEPRECATED_SINCE(5,15)
QT_DEPRECATED_X("Use QAbstractSocket::errorOccurred(QAbstractSocket::SocketError) instead")
QT_DEPRECATED_NETWORK_API_5_15_X("Use QAbstractSocket::errorOccurred(QAbstractSocket::SocketError) instead")
void error(QAbstractSocket::SocketError);
#endif
void errorOccurred(QAbstractSocket::SocketError);

View File

@ -37,6 +37,8 @@
**
****************************************************************************/
#include <QtNetwork/private/qtnetworkglobal_p.h>
#include "qlocalsocket.h"
#include "qlocalsocket_p.h"

View File

@ -118,7 +118,7 @@ Q_SIGNALS:
void connected();
void disconnected();
#if QT_DEPRECATED_SINCE(5,15)
QT_DEPRECATED_X("Use QLocalSocket::errorOccurred(QLocalSocket::LocalSocketError) instead")
QT_DEPRECATED_NETWORK_API_5_15_X("Use QLocalSocket::errorOccurred(QLocalSocket::LocalSocketError) instead")
void error(QLocalSocket::LocalSocketError socketError);
#endif
void errorOccurred(QLocalSocket::LocalSocketError socketError);

View File

@ -46,7 +46,11 @@
#include <QSocketNotifier>
#include <QLoggingCategory>
#ifdef Q_OS_FREEBSD
#include <dev/evdev/input.h>
#else
#include <linux/input.h>
#endif
QT_BEGIN_NAMESPACE

View File

@ -273,7 +273,11 @@ static const char specialLanguages[][6] = {
"", // Elymaic
"", // Nandinagari
"", // NyiakengPuachueHmong
"" // Wancho
"", // Wancho
"", // Chorasmian
"", // DivesAkuru
"", // KhitanSmallScript
"" // Yezidi
};
Q_STATIC_ASSERT(sizeof specialLanguages / sizeof *specialLanguages == QChar::ScriptCount);

View File

@ -335,24 +335,8 @@ NSCursor *QCocoaCursor::createCursorFromBitmap(const QBitmap *bitmap, const QBit
NSCursor *QCocoaCursor::createCursorFromPixmap(const QPixmap pixmap, const QPoint hotspot)
{
NSPoint hotSpot = NSMakePoint(hotspot.x(), hotspot.y());
NSImage *nsimage;
if (pixmap.devicePixelRatio() > 1.0) {
QSize layoutSize = pixmap.size() / pixmap.devicePixelRatio();
QPixmap scaledPixmap = pixmap.scaled(layoutSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
scaledPixmap.setDevicePixelRatio(1.0);
nsimage = static_cast<NSImage *>(qt_mac_create_nsimage(scaledPixmap));
CGImageRef cgImage = qt_mac_toCGImage(pixmap.toImage());
NSBitmapImageRep *imageRep = [[NSBitmapImageRep alloc] initWithCGImage:cgImage];
[nsimage addRepresentation:imageRep];
[imageRep release];
CGImageRelease(cgImage);
} else {
nsimage = static_cast<NSImage *>(qt_mac_create_nsimage(pixmap));
}
NSCursor *nsCursor = [[NSCursor alloc] initWithImage:nsimage hotSpot: hotSpot];
[nsimage release];
return nsCursor;
auto *image = [NSImage imageFromQImage:pixmap.toImage()];
return [[NSCursor alloc] initWithImage:image hotSpot:hotSpot];
}
QT_END_NAMESPACE

View File

@ -130,9 +130,8 @@ Qt::DropAction QCocoaDrag::drag(QDrag *o)
QPoint hotSpot = m_drag->hotSpot();
QPixmap pm = dragPixmap(m_drag, hotSpot);
QSize pmDeviceIndependentSize = pm.size() / pm.devicePixelRatio();
NSImage *nsimage = qt_mac_create_nsimage(pm);
[nsimage setSize:NSSizeFromCGSize(pmDeviceIndependentSize.toCGSize())];
NSImage *dragImage = [NSImage imageFromQImage:pm.toImage()];
Q_ASSERT(dragImage);
QMacPasteboard dragBoard(CFStringRef(NSPasteboardNameDrag), QMacInternalPasteboardMime::MIME_DND);
m_drag->mimeData()->setData(QLatin1String("application/x-qt-mime-type-name"), QByteArray("dummy"));
@ -142,12 +141,12 @@ Qt::DropAction QCocoaDrag::drag(QDrag *o)
NSWindow *theWindow = [m_lastEvent window];
Q_ASSERT(theWindow);
event_location.x -= hotSpot.x();
CGFloat flippedY = pmDeviceIndependentSize.height() - hotSpot.y();
CGFloat flippedY = dragImage.size.height - hotSpot.y();
event_location.y -= flippedY;
NSSize mouseOffset_unused = NSMakeSize(0.0, 0.0);
NSPasteboard *pboard = [NSPasteboard pasteboardWithName:NSPasteboardNameDrag];
[theWindow dragImage:nsimage
[theWindow dragImage:dragImage
at:event_location
offset:mouseOffset_unused
event:m_lastEvent
@ -155,8 +154,6 @@ Qt::DropAction QCocoaDrag::drag(QDrag *o)
source:m_lastView
slideBack:YES];
[nsimage release];
m_drag = nullptr;
return m_executed_drop_action;
}

View File

@ -554,7 +554,7 @@ NSOpenGLContext *QCocoaGLContext::nativeContext() const
QFunctionPointer QCocoaGLContext::getProcAddress(const char *procName)
{
return (QFunctionPointer)dlsym(RTLD_DEFAULT, procName);
return (QFunctionPointer)dlsym(RTLD_NEXT, procName);
}
#ifndef QT_NO_DEBUG_STREAM

View File

@ -482,14 +482,7 @@ QList<QCocoaWindow *> *QCocoaIntegration::popupWindowStack()
void QCocoaIntegration::setApplicationIcon(const QIcon &icon) const
{
NSImage *image = nil;
if (!icon.isNull()) {
NSSize size = [[[NSApplication sharedApplication] dockTile] size];
QPixmap pixmap = icon.pixmap(size.width, size.height);
image = static_cast<NSImage *>(qt_mac_create_nsimage(pixmap));
}
[[NSApplication sharedApplication] setApplicationIconImage:image];
[image release];
NSApp.applicationIconImage = [NSImage imageFromQIcon:icon];
}
void QCocoaIntegration::beep() const

View File

@ -340,13 +340,7 @@ NSMenuItem *QCocoaMenuItem::sync()
m_native.keyEquivalentModifierMask = NSEventModifierFlagCommand;
}
NSImage *img = nil;
if (!m_icon.isNull()) {
img = qt_mac_create_nsimage(m_icon, m_iconSize);
img.size = CGSizeMake(m_iconSize, m_iconSize);
}
m_native.image = img;
[img release];
m_native.image = [NSImage imageFromQIcon:m_icon withSize:m_iconSize];
m_native.state = m_checked ? NSOnState : NSOffState;
return m_native;

View File

@ -49,14 +49,23 @@
#include "QtCore/qstring.h"
#include "QtGui/qpa/qplatformsystemtrayicon.h"
QT_BEGIN_NAMESPACE
#include "qcocoamenu.h"
class QSystemTrayIconSys;
QT_FORWARD_DECLARE_CLASS(QCocoaSystemTrayIcon);
@interface QT_MANGLE_NAMESPACE(QStatusItemDelegate) : NSObject <NSUserNotificationCenterDelegate>
- (instancetype)initWithSysTray:(QCocoaSystemTrayIcon *)platformSystemTray;
@property (nonatomic, assign) QCocoaSystemTrayIcon *platformSystemTray;
@end
QT_NAMESPACE_ALIAS_OBJC_CLASS(QStatusItemDelegate);
QT_BEGIN_NAMESPACE
class Q_GUI_EXPORT QCocoaSystemTrayIcon : public QPlatformSystemTrayIcon
{
public:
QCocoaSystemTrayIcon() : m_sys(nullptr) {}
QCocoaSystemTrayIcon() {}
void init() override;
void cleanup() override;
@ -70,8 +79,12 @@ public:
bool isSystemTrayAvailable() const override;
bool supportsMessages() const override;
void statusItemClicked();
private:
QSystemTrayIconSys *m_sys;
NSStatusItem *m_statusItem = nullptr;
QStatusItemDelegate *m_delegate = nullptr;
QCocoaMenu *m_menu = nullptr;
};
QT_END_NAMESPACE

View File

@ -92,67 +92,46 @@
#import <AppKit/AppKit.h>
QT_USE_NAMESPACE
@interface QT_MANGLE_NAMESPACE(QNSStatusItem) : NSObject <NSUserNotificationCenterDelegate>
@property (nonatomic, assign) QCocoaMenu *menu;
@property (nonatomic, assign) QIcon icon;
@property (nonatomic, readonly) NSStatusItem *item;
@property (nonatomic, readonly) QRectF geometry;
- (instancetype)initWithSysTray:(QCocoaSystemTrayIcon *)systray;
- (void)triggerSelector:(id)sender button:(Qt::MouseButton)mouseButton;
- (void)doubleClickSelector:(id)sender;
@end
QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSStatusItem);
@interface QT_MANGLE_NAMESPACE(QNSImageView) : NSImageView
@property (nonatomic, assign) BOOL down;
@property (nonatomic, assign) QNSStatusItem *parent;
@end
QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSImageView);
QT_BEGIN_NAMESPACE
class QSystemTrayIconSys
{
public:
QSystemTrayIconSys(QCocoaSystemTrayIcon *sys) {
item = [[QNSStatusItem alloc] initWithSysTray:sys];
NSUserNotificationCenter.defaultUserNotificationCenter.delegate = item;
}
~QSystemTrayIconSys() {
[[[item item] view] setHidden: YES];
NSUserNotificationCenter *center = NSUserNotificationCenter.defaultUserNotificationCenter;
if (center.delegate == item)
center.delegate = nil;
[item release];
}
QNSStatusItem *item;
};
void QCocoaSystemTrayIcon::init()
{
if (!m_sys)
m_sys = new QSystemTrayIconSys(this);
}
m_statusItem = [[NSStatusBar.systemStatusBar statusItemWithLength:NSSquareStatusItemLength] retain];
QRect QCocoaSystemTrayIcon::geometry() const
{
if (!m_sys)
return QRect();
m_delegate = [[QStatusItemDelegate alloc] initWithSysTray:this];
const QRectF geom = [m_sys->item geometry];
if (!geom.isNull())
return geom.toRect();
else
return QRect();
m_statusItem.button.target = m_delegate;
m_statusItem.button.action = @selector(statusItemClicked);
[m_statusItem.button sendActionOn:NSEventMaskLeftMouseUp | NSEventMaskRightMouseUp | NSEventMaskOtherMouseUp];
}
void QCocoaSystemTrayIcon::cleanup()
{
delete m_sys;
m_sys = nullptr;
NSUserNotificationCenter *center = NSUserNotificationCenter.defaultUserNotificationCenter;
if (center.delegate == m_delegate)
center.delegate = nil;
[NSStatusBar.systemStatusBar removeStatusItem:m_statusItem];
[m_statusItem release];
m_statusItem = nil;
[m_delegate release];
m_delegate = nil;
m_menu = nullptr;
}
QRect QCocoaSystemTrayIcon::geometry() const
{
if (!m_statusItem)
return QRect();
if (NSWindow *window = m_statusItem.button.window) {
if (QCocoaScreen *screen = QCocoaScreen::get(window.screen))
return screen->mapFromNative(window.frame).toRect();
}
return QRect();
}
static bool heightCompareFunction (QSize a, QSize b) { return (a.height() < b.height()); }
@ -165,17 +144,15 @@ static QList<QSize> sortByHeight(const QList<QSize> &sizes)
void QCocoaSystemTrayIcon::updateIcon(const QIcon &icon)
{
if (!m_sys)
if (!m_statusItem)
return;
m_sys->item.icon = icon;
// The reccomended maximum title bar icon height is 18 points
// The recommended maximum title bar icon height is 18 points
// (device independent pixels). The menu height on past and
// current OS X versions is 22 points. Provide some future-proofing
// by deriving the icon height from the menu height.
const int padding = 4;
const int menuHeight = [[NSStatusBar systemStatusBar] thickness];
const int menuHeight = NSStatusBar.systemStatusBar.thickness;
const int maxImageHeight = menuHeight - padding;
// Select pixmap based on the device pixel height. Ideally we would use
@ -228,30 +205,28 @@ void QCocoaSystemTrayIcon::updateIcon(const QIcon &icon)
p.drawPixmap(r, pixmap);
}
NSImage *nsimage = static_cast<NSImage *>(qt_mac_create_nsimage(fullHeightPixmap));
auto *nsimage = [NSImage imageFromQImage:fullHeightPixmap.toImage()];
[nsimage setTemplate:icon.isMask()];
[(NSImageView*)[[m_sys->item item] view] setImage: nsimage];
[nsimage release];
m_statusItem.button.image = nsimage;
m_statusItem.button.imageScaling = NSImageScaleProportionallyDown;
}
void QCocoaSystemTrayIcon::updateMenu(QPlatformMenu *menu)
{
if (!m_sys)
return;
m_sys->item.menu = static_cast<QCocoaMenu *>(menu);
if (menu && [m_sys->item.menu->nsMenu() numberOfItems] > 0) {
[[m_sys->item item] setHighlightMode:YES];
} else {
[[m_sys->item item] setHighlightMode:NO];
}
// We don't set the menu property of the NSStatusItem here,
// as that would prevent us from receiving the action for the
// click, and we wouldn't be able to emit the activated signal.
// Instead we show the menu manually when the status item is
// clicked.
m_menu = static_cast<QCocoaMenu *>(menu);
}
void QCocoaSystemTrayIcon::updateToolTip(const QString &toolTip)
{
if (!m_sys)
if (!m_statusItem)
return;
[[[m_sys->item item] view] setToolTip:toolTip.toNSString()];
m_statusItem.button.toolTip = toolTip.toNSString();
}
bool QCocoaSystemTrayIcon::isSystemTrayAvailable() const
@ -267,180 +242,83 @@ bool QCocoaSystemTrayIcon::supportsMessages() const
void QCocoaSystemTrayIcon::showMessage(const QString &title, const QString &message,
const QIcon& icon, MessageIcon, int msecs)
{
if (!m_sys)
if (!m_statusItem)
return;
NSUserNotification *notification = [[NSUserNotification alloc] init];
notification.title = [NSString stringWithUTF8String:title.toUtf8().data()];
notification.informativeText = [NSString stringWithUTF8String:message.toUtf8().data()];
if (!icon.isNull()) {
auto *nsimage = qt_mac_create_nsimage(icon);
[nsimage setTemplate:icon.isMask()];
notification.contentImage = [nsimage autorelease];
}
auto *notification = [[NSUserNotification alloc] init];
notification.title = title.toNSString();
notification.informativeText = message.toNSString();
notification.contentImage = [NSImage imageFromQIcon:icon];
NSUserNotificationCenter *center = NSUserNotificationCenter.defaultUserNotificationCenter;
center.delegate = m_sys->item;
[center deliverNotification:notification];
center.delegate = m_delegate;
[center deliverNotification:[notification autorelease]];
if (msecs) {
NSTimeInterval timeout = msecs / 1000.0;
[center performSelector:@selector(removeDeliveredNotification:) withObject:notification afterDelay:timeout];
}
[notification release];
}
void QCocoaSystemTrayIcon::statusItemClicked()
{
auto *mouseEvent = NSApp.currentEvent;
auto activationReason = QPlatformSystemTrayIcon::Unknown;
if (mouseEvent.clickCount == 2) {
activationReason = QPlatformSystemTrayIcon::DoubleClick;
} else {
auto mouseButton = cocoaButton2QtButton(mouseEvent);
if (mouseButton == Qt::MidButton)
activationReason = QPlatformSystemTrayIcon::MiddleClick;
else if (mouseButton == Qt::RightButton)
activationReason = QPlatformSystemTrayIcon::Context;
else
activationReason = QPlatformSystemTrayIcon::Trigger;
}
emit activated(activationReason);
if (NSMenu *menu = m_menu ? m_menu->nsMenu() : nil)
[m_statusItem popUpStatusItemMenu:menu];
}
QT_END_NAMESPACE
@implementation NSStatusItem (Qt)
@end
@implementation QStatusItemDelegate
- (instancetype)initWithSysTray:(QCocoaSystemTrayIcon *)platformSystemTray
{
if ((self = [super init]))
self.platformSystemTray = platformSystemTray;
@implementation QNSImageView
- (instancetype)initWithParent:(QNSStatusItem *)myParent {
self = [super init];
self.parent = myParent;
self.down = NO;
return self;
}
- (void)menuTrackingDone:(NSNotification *)__unused notification
- (void)dealloc
{
self.down = NO;
[self setNeedsDisplay:YES];
}
- (void)mousePressed:(NSEvent *)mouseEvent
{
self.down = YES;
int clickCount = [mouseEvent clickCount];
[self setNeedsDisplay:YES];
if (clickCount == 2) {
[self menuTrackingDone:nil];
[self.parent doubleClickSelector:self];
} else {
[self.parent triggerSelector:self button:cocoaButton2QtButton(mouseEvent)];
}
}
- (void)mouseDown:(NSEvent *)mouseEvent
{
[self mousePressed:mouseEvent];
}
- (void)mouseUp:(NSEvent *)mouseEvent
{
Q_UNUSED(mouseEvent);
[self menuTrackingDone:nil];
}
- (void)rightMouseDown:(NSEvent *)mouseEvent
{
[self mousePressed:mouseEvent];
}
- (void)rightMouseUp:(NSEvent *)mouseEvent
{
Q_UNUSED(mouseEvent);
[self menuTrackingDone:nil];
}
- (void)otherMouseDown:(NSEvent *)mouseEvent
{
[self mousePressed:mouseEvent];
}
- (void)otherMouseUp:(NSEvent *)mouseEvent
{
Q_UNUSED(mouseEvent);
[self menuTrackingDone:nil];
}
- (void)drawRect:(NSRect)rect {
[[self.parent item] drawStatusBarBackgroundInRect:rect withHighlight:self.down];
[super drawRect:rect];
}
@end
@implementation QNSStatusItem {
QCocoaSystemTrayIcon *systray;
NSStatusItem *item;
QNSImageView *imageCell;
}
@synthesize menu = menu;
@synthesize icon = icon;
- (instancetype)initWithSysTray:(QCocoaSystemTrayIcon *)sys
{
self = [super init];
if (self) {
item = [[[NSStatusBar systemStatusBar] statusItemWithLength:NSSquareStatusItemLength] retain];
menu = nullptr;
systray = sys;
imageCell = [[QNSImageView alloc] initWithParent:self];
[item setView: imageCell];
}
return self;
}
- (void)dealloc {
[[NSStatusBar systemStatusBar] removeStatusItem:item];
[[NSNotificationCenter defaultCenter] removeObserver:imageCell];
imageCell.parent = nil;
[imageCell release];
[item release];
self.platformSystemTray = nullptr;
[super dealloc];
}
- (NSStatusItem *)item {
return item;
- (void)statusItemClicked
{
self.platformSystemTray->statusItemClicked();
}
- (QRectF)geometry {
if (NSWindow *window = item.view.window) {
if (QCocoaScreen *screen = QCocoaScreen::get(window.screen))
return screen->mapFromNative(window.frame);
}
return QRectF();
}
- (void)triggerSelector:(id)sender button:(Qt::MouseButton)mouseButton {
Q_UNUSED(sender);
if (!systray)
return;
if (mouseButton == Qt::MidButton)
emit systray->activated(QPlatformSystemTrayIcon::MiddleClick);
else
emit systray->activated(QPlatformSystemTrayIcon::Trigger);
if (menu) {
NSMenu *m = menu->nsMenu();
[[NSNotificationCenter defaultCenter] addObserver:imageCell
selector:@selector(menuTrackingDone:)
name:NSMenuDidEndTrackingNotification
object:m];
[item popUpStatusItemMenu: m];
}
}
- (void)doubleClickSelector:(id)sender {
Q_UNUSED(sender);
if (!systray)
return;
emit systray->activated(QPlatformSystemTrayIcon::DoubleClick);
}
- (BOOL)userNotificationCenter:(NSUserNotificationCenter *)center shouldPresentNotification:(NSUserNotification *)notification {
- (BOOL)userNotificationCenter:(NSUserNotificationCenter *)center shouldPresentNotification:(NSUserNotification *)notification
{
Q_UNUSED(center);
Q_UNUSED(notification);
return YES;
}
- (void)userNotificationCenter:(NSUserNotificationCenter *)center didActivateNotification:(NSUserNotification *)notification {
- (void)userNotificationCenter:(NSUserNotificationCenter *)center didActivateNotification:(NSUserNotification *)notification
{
[center removeDeliveredNotification:notification];
emit systray->messageClicked();
emit self.platformSystemTray->messageClicked();
}
@end

View File

@ -891,14 +891,10 @@ void QCocoaWindow::setWindowIcon(const QIcon &icon)
QMacAutoReleasePool pool;
if (icon.isNull()) {
NSWorkspace *workspace = [NSWorkspace sharedWorkspace];
[iconButton setImage:[workspace iconForFile:m_view.window.representedFilename]];
} else {
QPixmap pixmap = icon.pixmap(QSize(22, 22));
NSImage *image = static_cast<NSImage *>(qt_mac_create_nsimage(pixmap));
[iconButton setImage:[image autorelease]];
}
if (icon.isNull())
iconButton.image = [NSWorkspace.sharedWorkspace iconForFile:m_view.window.representedFilename];
else
iconButton.image = [NSImage imageFromQIcon:icon];
}
void QCocoaWindow::setAlertState(bool enabled)
@ -1237,7 +1233,9 @@ void QCocoaWindow::windowDidOrderOffScreen()
void QCocoaWindow::windowDidChangeOcclusionState()
{
if (m_view.window.occlusionState & NSWindowOcclusionStateVisible)
bool visible = m_view.window.occlusionState & NSWindowOcclusionStateVisible;
qCDebug(lcQpaWindow) << "QCocoaWindow::windowDidChangeOcclusionState" << window() << "is now" << (visible ? "visible" : "occluded");
if (visible)
[m_view setNeedsDisplay:YES];
else
handleExposeEvent(QRegion());

View File

@ -150,10 +150,8 @@ static QPoint mapWindowCoordinates(QWindow *source, QWindow *target, QPoint poin
break;
}
} else {
NSImage *nsimage = qt_mac_create_nsimage(pixmapCursor);
nsimage.size = NSSizeFromCGSize((pixmapCursor.size() / pixmapCursor.devicePixelRatioF()).toCGSize());
auto *nsimage = [NSImage imageFromQImage:pixmapCursor.toImage()];
nativeCursor = [[NSCursor alloc] initWithImage:nsimage hotSpot:NSZeroPoint];
[nsimage release];
}
// Change the cursor

View File

@ -185,7 +185,9 @@ void QEglFSDeviceIntegration::platformDestroy()
EGLNativeDisplayType QEglFSDeviceIntegration::platformDisplay() const
{
return EGL_DEFAULT_DISPLAY;
bool displayOk;
const int defaultDisplay = qEnvironmentVariableIntValue("QT_QPA_EGLFS_DEFAULT_DISPLAY", &displayOk);
return displayOk ? EGLNativeDisplayType(quintptr(defaultDisplay)) : EGL_DEFAULT_DISPLAY;
}
EGLDisplay QEglFSDeviceIntegration::createDisplay(EGLNativeDisplayType nativeDisplay)

View File

@ -59,13 +59,15 @@ HEADERS = \
qiosmenu.mm \
qiosfiledialog.mm \
qiosmessagedialog.mm \
qiostextinputoverlay.mm
qiostextinputoverlay.mm \
qiosdocumentpickercontroller.mm
HEADERS += \
qiosclipboard.h \
qiosmenu.h \
qiosfiledialog.h \
qiosmessagedialog.h \
qiostextinputoverlay.h
qiostextinputoverlay.h \
qiosdocumentpickercontroller.h
}
OTHER_FILES = \

View File

@ -0,0 +1,46 @@
/****************************************************************************
**
** Copyright (C) 2020 Harald Meyer.
** 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$
**
****************************************************************************/
#import <UIKit/UIKit.h>
#include "qiosfiledialog.h"
@interface QIOSDocumentPickerController : UIDocumentPickerViewController <UIDocumentPickerDelegate, UINavigationControllerDelegate>
- (instancetype)initWithQIOSFileDialog:(QIOSFileDialog *)fileDialog;
@end

View File

@ -0,0 +1,103 @@
/****************************************************************************
**
** Copyright (C) 2020 Harald Meyer.
** 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$
**
****************************************************************************/
#import <UIKit/UIKit.h>
#import <MobileCoreServices/MobileCoreServices.h>
#include "qiosdocumentpickercontroller.h"
@implementation QIOSDocumentPickerController {
QIOSFileDialog *m_fileDialog;
}
- (instancetype)initWithQIOSFileDialog:(QIOSFileDialog *)fileDialog
{
NSMutableArray <NSString *> *docTypes = [[[NSMutableArray alloc] init] autorelease];
UIDocumentPickerMode importMode;
switch (fileDialog->options()->fileMode()) {
case QFileDialogOptions::AnyFile:
case QFileDialogOptions::ExistingFile:
case QFileDialogOptions::ExistingFiles:
[docTypes addObject:(__bridge NSString *)kUTTypeContent];
[docTypes addObject:(__bridge NSString *)kUTTypeItem];
[docTypes addObject:(__bridge NSString *)kUTTypeData];
importMode = UIDocumentPickerModeImport;
break;
case QFileDialogOptions::Directory:
case QFileDialogOptions::DirectoryOnly:
// Directory picking is not supported because it requires
// special handling not possible with the current QFilePicker
// implementation.
Q_UNREACHABLE();
}
if (self = [super initWithDocumentTypes:docTypes inMode:importMode]) {
m_fileDialog = fileDialog;
self.modalPresentationStyle = UIModalPresentationFormSheet;
self.delegate = self;
if (m_fileDialog->options()->fileMode() == QFileDialogOptions::ExistingFiles)
self.allowsMultipleSelection = YES;
if (@available(ios 13.0, *))
self.directoryURL = m_fileDialog->options()->initialDirectory().toNSURL();
}
return self;
}
- (void)documentPicker:(UIDocumentPickerViewController *)controller didPickDocumentsAtURLs:(NSArray <NSURL *>*)urls
{
Q_UNUSED(controller);
QList<QUrl> files;
for (NSURL* url in urls)
files.append(QUrl::fromNSURL(url));
m_fileDialog->selectedFilesChanged(files);
emit m_fileDialog->accept();
}
- (void)documentPickerWasCancelled:(UIDocumentPickerViewController *)controller
{
Q_UNUSED(controller)
emit m_fileDialog->reject();
}
@end

View File

@ -65,7 +65,7 @@ public:
void selectNameFilter(const QString &) override {}
QString selectedNameFilter() const override { return QString(); }
void selectedFilesChanged(QList<QUrl> selection);
void selectedFilesChanged(const QList<QUrl> &selection);
private:
QUrl m_directory;
@ -74,6 +74,7 @@ private:
UIViewController *m_viewController;
bool showImagePickerDialog(QWindow *parent);
bool showNativeDocumentPickerDialog(QWindow *parent);
};
QT_END_NAMESPACE

View File

@ -48,6 +48,7 @@
#include "qiosfiledialog.h"
#include "qiosintegration.h"
#include "qiosoptionalplugininterface.h"
#include "qiosdocumentpickercontroller.h"
QIOSFileDialog::QIOSFileDialog()
: m_viewController(nullptr)
@ -72,8 +73,12 @@ bool QIOSFileDialog::show(Qt::WindowFlags windowFlags, Qt::WindowModality window
bool acceptOpen = options()->acceptMode() == QFileDialogOptions::AcceptOpen;
QString directory = options()->initialDirectory().toLocalFile();
if (acceptOpen && directory.startsWith(QLatin1String("assets-library:")))
return showImagePickerDialog(parent);
if (acceptOpen) {
if (directory.startsWith(QLatin1String("assets-library:")))
return showImagePickerDialog(parent);
else
return showNativeDocumentPickerDialog(parent);
}
return false;
}
@ -102,6 +107,25 @@ bool QIOSFileDialog::showImagePickerDialog(QWindow *parent)
return true;
}
bool QIOSFileDialog::showNativeDocumentPickerDialog(QWindow *parent)
{
#ifndef Q_OS_TVOS
if (options()->fileMode() == QFileDialogOptions::Directory ||
options()->fileMode() == QFileDialogOptions::DirectoryOnly)
return false;
m_viewController = [[QIOSDocumentPickerController alloc] initWithQIOSFileDialog:this];
UIWindow *window = parent ? reinterpret_cast<UIView *>(parent->winId()).window
: qt_apple_sharedApplication().keyWindow;
[window.rootViewController presentViewController:m_viewController animated:YES completion:nil];
return true;
#else
return false;
#endif
}
void QIOSFileDialog::hide()
{
// QFileDialog will remember the last directory set, and open subsequent dialogs in the same
@ -123,7 +147,7 @@ QList<QUrl> QIOSFileDialog::selectedFiles() const
return m_selection;
}
void QIOSFileDialog::selectedFilesChanged(QList<QUrl> selection)
void QIOSFileDialog::selectedFilesChanged(const QList<QUrl> &selection)
{
m_selection = selection;
emit filesSelected(m_selection);

View File

@ -3,9 +3,9 @@ QT_FOR_CONFIG += gui-private
android:!android-embedded: SUBDIRS += android
!android: SUBDIRS += minimal
!wasm:!android: SUBDIRS += minimal
!android:qtConfig(freetype): SUBDIRS += offscreen
!wasm:!android:qtConfig(freetype): SUBDIRS += offscreen
qtConfig(xcb) {
SUBDIRS += xcb

View File

@ -88,7 +88,7 @@ EMSCRIPTEN_WEBGL_CONTEXT_HANDLE QWasmOpenGLContext::createEmscriptenContext(cons
EmscriptenWebGLContextAttributes attributes;
emscripten_webgl_init_context_attributes(&attributes); // Populate with default attributes
attributes.preferLowPowerToHighPerformance = false;
attributes.powerPreference = EM_WEBGL_POWER_PREFERENCE_HIGH_PERFORMANCE;
attributes.failIfMajorPerformanceCaveat = false;
attributes.antialias = true;
attributes.enableExtensionsByDefault = true;

View File

@ -265,6 +265,8 @@ bool QWasmWindow::isPointOnTitle(QPoint point) const
bool QWasmWindow::isPointOnResizeRegion(QPoint point) const
{
if (window()->flags().testFlag(Qt::Popup))
return false;
return resizeRegion().contains(point);
}
@ -402,7 +404,8 @@ void QWasmWindow::requestUpdate()
bool QWasmWindow::hasTitleBar() const
{
return !(m_windowState & Qt::WindowFullScreen) && (window()->flags().testFlag(Qt::WindowTitleHint) && m_needsCompositor);
return !(m_windowState & Qt::WindowFullScreen) && (window()->flags().testFlag(Qt::WindowTitleHint) && m_needsCompositor)
&& !window()->flags().testFlag(Qt::Popup);
}
QT_END_NAMESPACE

View File

@ -122,6 +122,7 @@ static const char *xcb_atomnames = {
"_NET_WM_STATE_MODAL\0"
"_NET_WM_STATE_STAYS_ON_TOP\0"
"_NET_WM_STATE_DEMANDS_ATTENTION\0"
"_NET_WM_STATE_HIDDEN\0"
"_NET_WM_USER_TIME\0"
"_NET_WM_USER_TIME_WINDOW\0"

View File

@ -123,6 +123,7 @@ public:
_NET_WM_STATE_MODAL,
_NET_WM_STATE_STAYS_ON_TOP,
_NET_WM_STATE_DEMANDS_ATTENTION,
_NET_WM_STATE_HIDDEN,
_NET_WM_USER_TIME,
_NET_WM_USER_TIME_WINDOW,

View File

@ -903,6 +903,8 @@ QXcbWindow::NetWmStates QXcbWindow::netWmStates()
result |= NetWmStateStaysOnTop;
if (statesEnd != std::find(states, statesEnd, atom(QXcbAtom::_NET_WM_STATE_DEMANDS_ATTENTION)))
result |= NetWmStateDemandsAttention;
if (statesEnd != std::find(states, statesEnd, atom(QXcbAtom::_NET_WM_STATE_HIDDEN)))
result |= NetWmStateHidden;
} else {
qCDebug(lcQpaXcb, "getting net wm state (%x), empty\n", m_window);
}
@ -1074,6 +1076,9 @@ void QXcbWindow::setNetWmStateOnUnmappedWindow()
states |= NetWmStateBelow;
}
if (window()->windowStates() & Qt::WindowMinimized)
states |= NetWmStateHidden;
if (window()->windowStates() & Qt::WindowFullScreen)
states |= NetWmStateFullScreen;
@ -1107,6 +1112,8 @@ void QXcbWindow::setNetWmStateOnUnmappedWindow()
atoms.push_back(atom(QXcbAtom::_NET_WM_STATE_ABOVE));
if (states & NetWmStateBelow && !atoms.contains(atom(QXcbAtom::_NET_WM_STATE_BELOW)))
atoms.push_back(atom(QXcbAtom::_NET_WM_STATE_BELOW));
if (states & NetWmStateHidden && !atoms.contains(atom(QXcbAtom::_NET_WM_STATE_HIDDEN)))
atoms.push_back(atom(QXcbAtom::_NET_WM_STATE_HIDDEN));
if (states & NetWmStateFullScreen && !atoms.contains(atom(QXcbAtom::_NET_WM_STATE_FULLSCREEN)))
atoms.push_back(atom(QXcbAtom::_NET_WM_STATE_FULLSCREEN));
if (states & NetWmStateMaximizedHorz && !atoms.contains(atom(QXcbAtom::_NET_WM_STATE_MAXIMIZED_HORZ)))
@ -2204,10 +2211,16 @@ void QXcbWindow::handlePropertyNotifyEvent(const xcb_property_notify_event_t *ev
|| (data[0] == XCB_ICCCM_WM_STATE_WITHDRAWN && m_minimized));
}
}
if (m_minimized)
newState = Qt::WindowMinimized;
const NetWmStates states = netWmStates();
// _NET_WM_STATE_HIDDEN should be set by the Window Manager to indicate that a window would
// not be visible on the screen if its desktop/viewport were active and its coordinates were
// within the screen bounds. The canonical example is that minimized windows should be in
// the _NET_WM_STATE_HIDDEN state.
if (m_minimized && (!connection()->wmSupport()->isSupportedByWM(NetWmStateHidden)
|| states.testFlag(NetWmStateHidden)))
newState = Qt::WindowMinimized;
if (states & NetWmStateFullScreen)
newState |= Qt::WindowFullScreen;
if ((states & NetWmStateMaximizedHorz) && (states & NetWmStateMaximizedVert))

View File

@ -68,7 +68,8 @@ public:
NetWmStateMaximizedVert = 0x10,
NetWmStateModal = 0x20,
NetWmStateStaysOnTop = 0x40,
NetWmStateDemandsAttention = 0x80
NetWmStateDemandsAttention = 0x80,
NetWmStateHidden = 0x100
};
Q_DECLARE_FLAGS(NetWmStates, NetWmState)

View File

@ -294,6 +294,7 @@ static QMetaType::Type qDecodeMYSQLType(int mysqltype, uint flags)
case FIELD_TYPE_TINY_BLOB :
case FIELD_TYPE_MEDIUM_BLOB :
case FIELD_TYPE_LONG_BLOB :
case FIELD_TYPE_GEOMETRY :
type = (flags & BINARY_FLAG) ? QMetaType::QByteArray : QMetaType::QString;
break;
default:

View File

@ -105,7 +105,6 @@
\page sql-connecting.html
\title Connecting to Databases
\contentspage SQL Programming
\previouspage SQL Programming
\nextpage Executing SQL Statements
@ -175,7 +174,6 @@
\title Executing SQL Statements
\previouspage Connecting to Databases
\contentspage SQL Programming
\nextpage Using the SQL Model Classes
@ -325,7 +323,6 @@
\title Using the SQL Model Classes
\previouspage Executing SQL Statements
\contentspage SQL Programming
\nextpage Presenting Data in a Table View
In addition to QSqlQuery, Qt offers three higher-level classes
@ -471,7 +468,6 @@
\title Presenting Data in a Table View
\previouspage Using the SQL Model Classes
\contentspage SQL Programming
\nextpage Creating Data-Aware Forms
The QSqlQueryModel, QSqlTableModel, and QSqlRelationalTableModel
@ -575,7 +571,6 @@
\title Creating Data-Aware Forms
\previouspage Presenting Data in a Table View
\contentspage SQL Programming
Using the SQL models described above, the contents of a database can
be presented to other model/view components. For some applications,

View File

@ -481,7 +481,6 @@
/*!
\page qtest-tutorial.html
\brief A short introduction to testing with Qt Test.
\contentspage Qt Test Overview
\nextpage {Chapter 1: Writing a Unit Test}{Chapter 1}
\ingroup best-practices
@ -506,7 +505,6 @@
/*!
\example tutorial1
\contentspage {Qt Test Tutorial}{Contents}
\nextpage {Chapter 2: Data Driven Testing}{Chapter 2}
\title Chapter 1: Writing a Unit Test
@ -582,7 +580,6 @@
\example tutorial2
\previouspage {Chapter 1: Writing a Unit Test}{Chapter 1}
\contentspage {Qt Test Tutorial}{Contents}
\nextpage {Chapter 3: Simulating Gui Events}{Chapter 3}
\title Chapter 2: Data Driven Testing
@ -691,7 +688,6 @@
\example tutorial3
\previouspage {Chapter 2: Data Driven Testing}{Chapter 2}
\contentspage {Qt Test Tutorial}{Contents}
\nextpage {Chapter 4: Replaying GUI Events}{Chapter 4}
\title Chapter 3: Simulating GUI Events
@ -752,7 +748,6 @@
\example tutorial4
\previouspage {Chapter 3: Simulating GUI Events}{Chapter 3}
\contentspage {Qt Test Tutorial}{Contents}
\nextpage {Chapter 5: Writing a Benchmark}{Chapter 5}
\title Chapter 4: Replaying GUI Events
@ -833,7 +828,6 @@
\example tutorial5
\previouspage {Chapter 4: Replaying GUI Events}{Chapter 4}
\contentspage {Qt Test Tutorial}{Contents}
\nextpage {Chapter 6: Skipping Tests with QSKIP}{Chapter 6}
\title Chapter 5: Writing a Benchmark
@ -889,7 +883,6 @@
\page qttestlib-tutorial6.html
\previouspage {Chapter 5: Writing a Benchmark}{Chapter 5}
\contentspage {Qt Test Tutorial}{Contents}
\title Chapter 6: Skipping Tests with QSKIP
\brief How to skip tests in certain cases.

View File

@ -137,11 +137,8 @@ win32:SOURCES += ../../corelib/global/qoperatingsystemversion_win.cpp \
mac {
SOURCES += \
../../corelib/kernel/qcoreapplication_mac.cpp \
../../corelib/kernel/qcore_mac.cpp
OBJECTIVE_SOURCES += \
../../corelib/kernel/qcore_mac.mm \
../../corelib/global/qoperatingsystemversion_darwin.mm \
../../corelib/kernel/qcore_mac_objc.mm \
../../corelib/kernel/qcore_foundation.mm
LIBS += -framework Foundation

View File

@ -53,7 +53,6 @@
\page qlalr-files.html
\title qlalr - Writing Grammars
\contentspage qlalr
\previouspage qlalr
\nextpage qlalr - Generating Code from Grammar Specifications
@ -63,7 +62,6 @@
\page qlalr-generating.html
\title qlalr - Generating Code from Grammar Specifications
\contentspage qlalr
\previouspage qlalr - Writing Grammars
\nextpage qlalr - qlalr Grammar Specification
*/
@ -72,7 +70,6 @@
\page qlalr-grammar-specification.html
\title qlalr - qlalr Grammar Specification
\contentspage qlalr
\previouspage qlalr - Generating Code from Grammar Specifications
\nextpage qlalr - Handling Conflicts
@ -82,7 +79,6 @@
\page qlalr-handling-conflicts.html
\title qlalr - Handling Conflicts
\contentspage qlalr
\previouspage qlalr - qlalr Grammar Specification
\nextpage qlalr - Error Handling and Recovery
*/
@ -91,7 +87,6 @@
\page qlalr-handling-errors.html
\title qlalr - Error Handling and Recovery
\contentspage qlalr
\previouspage qlalr - Handling Conflicts
\nextpage qlalr - References to External Information
*/
@ -100,7 +95,6 @@
\page qlalr-external-references.html
\title qlalr - References to External Information
\contentspage qlalr
\previouspage qlalr - Error Handling and Recovery
*/

View File

@ -546,12 +546,19 @@ void WriteInitialization::acceptUI(DomUI *node)
m_output << m_option.indent << language::endFunctionDefinition("setupUi");
if (!m_mainFormUsedInRetranslateUi && language::language() == Language::Cpp) {
// Mark varName as unused to avoid compiler warnings.
m_refreshInitialization += m_indent;
m_refreshInitialization += QLatin1String("(void)");
m_refreshInitialization += varName ;
m_refreshInitialization += language::eol;
if (!m_mainFormUsedInRetranslateUi) {
if (language::language() == Language::Cpp) {
// Mark varName as unused to avoid compiler warnings.
m_refreshInitialization += m_indent;
m_refreshInitialization += QLatin1String("(void)");
m_refreshInitialization += varName ;
m_refreshInitialization += language::eol;
} else if (language::language() == Language::Python) {
// output a 'pass' to have an empty function
m_refreshInitialization += m_indent;
m_refreshInitialization += QLatin1String("pass");
m_refreshInitialization += language::eol;
}
}
m_output << m_option.indent

View File

@ -2445,14 +2445,15 @@ void QFileDialog::getOpenFileContent(const QString &nameFilter, const std::funct
(*openFileImpl)();
#else
QFileDialog *dialog = new QFileDialog();
dialog->setFileMode(QFileDialog::ExistingFile);
dialog->selectNameFilter(nameFilter);
auto fileSelected = [=](const QString &fileName) {
QByteArray fileContent;
if (!fileName.isNull()) {
QFile selectedFile(fileName);
selectedFile.open(QIODevice::ReadOnly);
fileContent = selectedFile.readAll();
if (selectedFile.open(QIODevice::ReadOnly))
fileContent = selectedFile.readAll();
}
fileOpenCompleted(fileName, fileContent);
};

View File

@ -33,7 +33,6 @@
layouts.
\previouspage Qt Widgets
\contentspage Qt Widgets
\nextpage {Styles and Style Aware Widgets}{Styles}
\ingroup frameworks-technologies

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