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

Change-Id: Ia5727ce68001bcaab467f5fae3a4933d1217015f
This commit is contained in:
Simon Hausmann 2020-01-28 18:27:28 +01:00
commit a4ea0d9eac
119 changed files with 9756 additions and 340 deletions

View File

@ -67,7 +67,7 @@ Window::Window(QWidget *parent)
connect(m_ui.easingCurvePicker, &QListWidget::currentRowChanged, connect(m_ui.easingCurvePicker, &QListWidget::currentRowChanged,
this, &Window::curveChanged); this, &Window::curveChanged);
connect(m_ui.buttonGroup, QOverload<int>::of(&QButtonGroup::buttonClicked), connect(m_ui.buttonGroup, QOverload<QAbstractButton *>::of(&QButtonGroup::buttonClicked),
this, &Window::pathChanged); this, &Window::pathChanged);
connect(m_ui.periodSpinBox, QOverload<double>::of(&QDoubleSpinBox::valueChanged), connect(m_ui.periodSpinBox, QOverload<double>::of(&QDoubleSpinBox::valueChanged),
this, &Window::periodChanged); this, &Window::periodChanged);
@ -180,9 +180,10 @@ void Window::curveChanged(int row)
m_ui.overshootSpinBox->setEnabled(curveType >= QEasingCurve::InBack && curveType <= QEasingCurve::OutInBack); m_ui.overshootSpinBox->setEnabled(curveType >= QEasingCurve::InBack && curveType <= QEasingCurve::OutInBack);
} }
void Window::pathChanged(int index) void Window::pathChanged(QAbstractButton *button)
{ {
m_anim->setPathType((Animation::PathType)index); const int index = m_ui.buttonGroup->id(button);
m_anim->setPathType(Animation::PathType(index));
} }
void Window::periodChanged(double value) void Window::periodChanged(double value)

View File

@ -69,7 +69,7 @@ public:
Window(QWidget *parent = nullptr); Window(QWidget *parent = nullptr);
private slots: private slots:
void curveChanged(int row); void curveChanged(int row);
void pathChanged(int index); void pathChanged(QAbstractButton *button);
void periodChanged(double); void periodChanged(double);
void amplitudeChanged(double); void amplitudeChanged(double);
void overshootChanged(double); void overshootChanged(double);

View File

@ -220,11 +220,11 @@ void View::setupMatrix()
{ {
qreal scale = qPow(qreal(2), (zoomSlider->value() - 250) / qreal(50)); qreal scale = qPow(qreal(2), (zoomSlider->value() - 250) / qreal(50));
QMatrix matrix; QTransform matrix;
matrix.scale(scale, scale); matrix.scale(scale, scale);
matrix.rotate(rotateSlider->value()); matrix.rotate(rotateSlider->value());
graphicsView->setMatrix(matrix); graphicsView->setTransform(matrix);
setResetButtonEnabled(); setResetButtonEnabled();
} }

View File

@ -113,13 +113,14 @@ void MainWindow::backgroundButtonGroupClicked(QAbstractButton *button)
//! [1] //! [1]
//! [2] //! [2]
void MainWindow::buttonGroupClicked(int id) void MainWindow::buttonGroupClicked(QAbstractButton *button)
{ {
const QList<QAbstractButton *> buttons = buttonGroup->buttons(); const QList<QAbstractButton *> buttons = buttonGroup->buttons();
for (QAbstractButton *button : buttons) { for (QAbstractButton *myButton : buttons) {
if (buttonGroup->button(id) != button) if (myButton != button)
button->setChecked(false); button->setChecked(false);
} }
const int id = buttonGroup->id(button);
if (id == InsertTextButton) { if (id == InsertTextButton) {
scene->setMode(DiagramScene::InsertText); scene->setMode(DiagramScene::InsertText);
} else { } else {
@ -154,7 +155,7 @@ void MainWindow::deleteItem()
//! [3] //! [3]
//! [4] //! [4]
void MainWindow::pointerGroupClicked(int) void MainWindow::pointerGroupClicked()
{ {
scene->setMode(DiagramScene::Mode(pointerTypeGroup->checkedId())); scene->setMode(DiagramScene::Mode(pointerTypeGroup->checkedId()));
} }
@ -231,8 +232,8 @@ void MainWindow::fontSizeChanged(const QString &)
void MainWindow::sceneScaleChanged(const QString &scale) void MainWindow::sceneScaleChanged(const QString &scale)
{ {
double newScale = scale.left(scale.indexOf(tr("%"))).toDouble() / 100.0; double newScale = scale.left(scale.indexOf(tr("%"))).toDouble() / 100.0;
QMatrix oldMatrix = view->matrix(); QTransform oldMatrix = view->transform();
view->resetMatrix(); view->resetTransform();
view->translate(oldMatrix.dx(), oldMatrix.dy()); view->translate(oldMatrix.dx(), oldMatrix.dy());
view->scale(newScale, newScale); view->scale(newScale, newScale);
} }
@ -334,7 +335,7 @@ void MainWindow::createToolBox()
{ {
buttonGroup = new QButtonGroup(this); buttonGroup = new QButtonGroup(this);
buttonGroup->setExclusive(false); buttonGroup->setExclusive(false);
connect(buttonGroup, QOverload<int>::of(&QButtonGroup::buttonClicked), connect(buttonGroup, QOverload<QAbstractButton *>::of(&QButtonGroup::buttonClicked),
this, &MainWindow::buttonGroupClicked); this, &MainWindow::buttonGroupClicked);
QGridLayout *layout = new QGridLayout; QGridLayout *layout = new QGridLayout;
layout->addWidget(createCellWidget(tr("Conditional"), DiagramItem::Conditional), 0, 0); layout->addWidget(createCellWidget(tr("Conditional"), DiagramItem::Conditional), 0, 0);
@ -528,7 +529,7 @@ void MainWindow::createToolbars()
pointerTypeGroup = new QButtonGroup(this); pointerTypeGroup = new QButtonGroup(this);
pointerTypeGroup->addButton(pointerButton, int(DiagramScene::MoveItem)); pointerTypeGroup->addButton(pointerButton, int(DiagramScene::MoveItem));
pointerTypeGroup->addButton(linePointerButton, int(DiagramScene::InsertLine)); pointerTypeGroup->addButton(linePointerButton, int(DiagramScene::InsertLine));
connect(pointerTypeGroup, QOverload<int>::of(&QButtonGroup::buttonClicked), connect(pointerTypeGroup, QOverload<QAbstractButton *>::of(&QButtonGroup::buttonClicked),
this, &MainWindow::pointerGroupClicked); this, &MainWindow::pointerGroupClicked);
sceneScaleCombo = new QComboBox; sceneScaleCombo = new QComboBox;

View File

@ -82,9 +82,9 @@ public:
private slots: private slots:
void backgroundButtonGroupClicked(QAbstractButton *button); void backgroundButtonGroupClicked(QAbstractButton *button);
void buttonGroupClicked(int id); void buttonGroupClicked(QAbstractButton *button);
void deleteItem(); void deleteItem();
void pointerGroupClicked(int id); void pointerGroupClicked();
void bringToFront(); void bringToFront();
void sendToBack(); void sendToBack();
void itemInserted(DiagramItem *item); void itemInserted(DiagramItem *item);

View File

@ -223,7 +223,7 @@ void XFormView::setRotation(qreal r)
m_rotation = r; m_rotation = r;
QPointF center(pts->points().at(0)); QPointF center(pts->points().at(0));
QMatrix m; QTransform m;
m.translate(center.x(), center.y()); m.translate(center.x(), center.y());
m.rotate(m_rotation - old_rot); m.rotate(m_rotation - old_rot);
m.translate(-center.x(), -center.y()); m.translate(-center.x(), -center.y());
@ -236,7 +236,7 @@ void XFormView::timerEvent(QTimerEvent *e)
{ {
if (e->timerId() == timer.timerId()) { if (e->timerId() == timer.timerId()) {
QPointF center(pts->points().at(0)); QPointF center(pts->points().at(0));
QMatrix m; QTransform m;
m.translate(center.x(), center.y()); m.translate(center.x(), center.y());
m.rotate(0.2); m.rotate(0.2);
m.translate(-center.x(), -center.y()); m.translate(-center.x(), -center.y());

View File

@ -374,7 +374,7 @@ void PathDeformRenderer::setText(const QString &text)
} }
for (int i=0; i<m_paths.size(); ++i) for (int i=0; i<m_paths.size(); ++i)
m_paths[i] = m_paths[i] * QMatrix(1, 0, 0, 1, -m_pathBounds.x(), -m_pathBounds.y()); m_paths[i] = m_paths[i] * QTransform(1, 0, 0, 1, -m_pathBounds.x(), -m_pathBounds.y());
update(); update();
} }

View File

@ -511,10 +511,10 @@ void PathStrokeRenderer::initializePoints()
m_points.clear(); m_points.clear();
m_vectors.clear(); m_vectors.clear();
QMatrix m; QTransform m;
qreal rot = 360.0 / count; qreal rot = 360.0 / count;
QPointF center(width() / 2, height() / 2); QPointF center(width() / 2, height() / 2);
QMatrix vm; QTransform vm;
vm.shear(2, -1); vm.shear(2, -1);
vm.scale(3, 3); vm.scale(3, 3);

View File

@ -212,21 +212,17 @@ contains(CONFIG, plugin) {
CMAKE_PLUGIN_TYPE_ESCAPED = $$replace(PLUGIN_TYPE, [-/], _) CMAKE_PLUGIN_TYPE_ESCAPED = $$replace(PLUGIN_TYPE, [-/], _)
win32 { win32 {
CMAKE_PRL_FILE_LOCATION_RELEASE = $$PLUGIN_TYPE/$${CMAKE_QT_STEM}.prl
CMAKE_PRL_FILE_LOCATION_DEBUG = $$PLUGIN_TYPE/$${CMAKE_QT_STEM}d.prl
isEmpty(CMAKE_STATIC_TYPE) { isEmpty(CMAKE_STATIC_TYPE) {
CMAKE_PLUGIN_LOCATION_RELEASE = $$PLUGIN_TYPE/$${CMAKE_QT_STEM}.dll CMAKE_PLUGIN_LOCATION_RELEASE = $$PLUGIN_TYPE/$${CMAKE_QT_STEM}.dll
CMAKE_PLUGIN_LOCATION_DEBUG = $$PLUGIN_TYPE/$${CMAKE_QT_STEM}d.dll CMAKE_PLUGIN_LOCATION_DEBUG = $$PLUGIN_TYPE/$${CMAKE_QT_STEM}d.dll
CMAKE_PRL_FILE_LOCATION_RELEASE = $$PLUGIN_TYPE/$${CMAKE_QT_STEM}.prl
CMAKE_PRL_FILE_LOCATION_DEBUG = $$PLUGIN_TYPE/$${CMAKE_QT_STEM}d.prl
} else:mingw { } else:mingw {
CMAKE_PLUGIN_LOCATION_RELEASE = $$PLUGIN_TYPE/lib$${CMAKE_QT_STEM}.a CMAKE_PLUGIN_LOCATION_RELEASE = $$PLUGIN_TYPE/lib$${CMAKE_QT_STEM}.a
CMAKE_PLUGIN_LOCATION_DEBUG = $$PLUGIN_TYPE/lib$${CMAKE_QT_STEM}d.a CMAKE_PLUGIN_LOCATION_DEBUG = $$PLUGIN_TYPE/lib$${CMAKE_QT_STEM}d.a
CMAKE_PRL_FILE_LOCATION_RELEASE = $$PLUGIN_TYPE/lib$${CMAKE_QT_STEM}.prl
CMAKE_PRL_FILE_LOCATION_DEBUG = $$PLUGIN_TYPE/lib$${CMAKE_QT_STEM}d.prl
} else { # MSVC static } else { # MSVC static
CMAKE_PLUGIN_LOCATION_RELEASE = $$PLUGIN_TYPE/$${CMAKE_QT_STEM}.lib CMAKE_PLUGIN_LOCATION_RELEASE = $$PLUGIN_TYPE/$${CMAKE_QT_STEM}.lib
CMAKE_PLUGIN_LOCATION_DEBUG = $$PLUGIN_TYPE/$${CMAKE_QT_STEM}d.lib CMAKE_PLUGIN_LOCATION_DEBUG = $$PLUGIN_TYPE/$${CMAKE_QT_STEM}d.lib
CMAKE_PRL_FILE_LOCATION_RELEASE = $$PLUGIN_TYPE/$${CMAKE_QT_STEM}.prl
CMAKE_PRL_FILE_LOCATION_DEBUG = $$PLUGIN_TYPE/$${CMAKE_QT_STEM}d.prl
} }
} else { } else {
mac { mac {
@ -320,36 +316,25 @@ mac {
CMAKE_LIB_FILE_LOCATION_DEBUG = $${CMAKE_QT_STEM}d.dll CMAKE_LIB_FILE_LOCATION_DEBUG = $${CMAKE_QT_STEM}d.dll
CMAKE_LIB_FILE_LOCATION_RELEASE = $${CMAKE_QT_STEM}.dll CMAKE_LIB_FILE_LOCATION_RELEASE = $${CMAKE_QT_STEM}.dll
!isEmpty(CMAKE_STATIC_TYPE) {
CMAKE_STATIC_WINDOWS_BUILD = "true"
CMAKE_PRL_FILE_LOCATION_DEBUG = $${CMAKE_QT_STEM}d.prl
CMAKE_PRL_FILE_LOCATION_RELEASE = $${CMAKE_QT_STEM}.prl
}
mingw { mingw {
CMAKE_WINMAIN_FILE_LOCATION_DEBUG = libqtmain$${QT_LIBINFIX}d.a CMAKE_WINMAIN_FILE_LOCATION_DEBUG = libqtmain$${QT_LIBINFIX}d.a
CMAKE_WINMAIN_FILE_LOCATION_RELEASE = libqtmain$${QT_LIBINFIX}.a CMAKE_WINMAIN_FILE_LOCATION_RELEASE = libqtmain$${QT_LIBINFIX}.a
!isEmpty(CMAKE_STATIC_TYPE) {
CMAKE_STATIC_WINDOWS_BUILD = "true"
CMAKE_IMPLIB_FILE_LOCATION_DEBUG = lib$${CMAKE_QT_STEM}d.a CMAKE_IMPLIB_FILE_LOCATION_DEBUG = lib$${CMAKE_QT_STEM}d.a
CMAKE_IMPLIB_FILE_LOCATION_RELEASE = lib$${CMAKE_QT_STEM}.a CMAKE_IMPLIB_FILE_LOCATION_RELEASE = lib$${CMAKE_QT_STEM}.a
CMAKE_PRL_FILE_LOCATION_DEBUG = lib$${CMAKE_QT_STEM}d.prl
CMAKE_PRL_FILE_LOCATION_RELEASE = lib$${CMAKE_QT_STEM}.prl
} else {
CMAKE_IMPLIB_FILE_LOCATION_DEBUG = lib$${CMAKE_QT_STEM}d.a
CMAKE_IMPLIB_FILE_LOCATION_RELEASE = lib$${CMAKE_QT_STEM}.a
}
} else { } else {
CMAKE_WINMAIN_FILE_LOCATION_DEBUG = qtmain$${QT_LIBINFIX}d.lib CMAKE_WINMAIN_FILE_LOCATION_DEBUG = qtmain$${QT_LIBINFIX}d.lib
CMAKE_WINMAIN_FILE_LOCATION_RELEASE = qtmain$${QT_LIBINFIX}.lib CMAKE_WINMAIN_FILE_LOCATION_RELEASE = qtmain$${QT_LIBINFIX}.lib
!isEmpty(CMAKE_STATIC_TYPE) {
CMAKE_STATIC_WINDOWS_BUILD = "true"
CMAKE_IMPLIB_FILE_LOCATION_DEBUG = $${CMAKE_QT_STEM}d.lib CMAKE_IMPLIB_FILE_LOCATION_DEBUG = $${CMAKE_QT_STEM}d.lib
CMAKE_IMPLIB_FILE_LOCATION_RELEASE = $${CMAKE_QT_STEM}.lib CMAKE_IMPLIB_FILE_LOCATION_RELEASE = $${CMAKE_QT_STEM}.lib
CMAKE_PRL_FILE_LOCATION_DEBUG = $${CMAKE_QT_STEM}d.prl
CMAKE_PRL_FILE_LOCATION_RELEASE = $${CMAKE_QT_STEM}.prl
} else {
CMAKE_IMPLIB_FILE_LOCATION_DEBUG = $${CMAKE_QT_STEM}d.lib
CMAKE_IMPLIB_FILE_LOCATION_RELEASE = $${CMAKE_QT_STEM}.lib
}
} }
} else { } else {
!isEmpty(CMAKE_STATIC_TYPE) { !isEmpty(CMAKE_STATIC_TYPE) {

View File

@ -64,11 +64,13 @@ debug {
QMAKE_CXXFLAGS += $$QMAKE_CXXFLAGS_DEBUG QMAKE_CXXFLAGS += $$QMAKE_CXXFLAGS_DEBUG
QMAKE_LFLAGS += $$QMAKE_LFLAGS_DEBUG QMAKE_LFLAGS += $$QMAKE_LFLAGS_DEBUG
QMAKE_LIBFLAGS += $$QMAKE_LIBFLAGS_DEBUG QMAKE_LIBFLAGS += $$QMAKE_LIBFLAGS_DEBUG
DEFINES += $$DEFINES_DEBUG
} else { } else {
QMAKE_CFLAGS += $$QMAKE_CFLAGS_RELEASE QMAKE_CFLAGS += $$QMAKE_CFLAGS_RELEASE
QMAKE_CXXFLAGS += $$QMAKE_CXXFLAGS_RELEASE QMAKE_CXXFLAGS += $$QMAKE_CXXFLAGS_RELEASE
QMAKE_LFLAGS += $$QMAKE_LFLAGS_RELEASE QMAKE_LFLAGS += $$QMAKE_LFLAGS_RELEASE
QMAKE_LIBFLAGS += $$QMAKE_LIBFLAGS_RELEASE QMAKE_LIBFLAGS += $$QMAKE_LIBFLAGS_RELEASE
DEFINES += $$DEFINES_RELEASE
} }
stack_protector_strong { stack_protector_strong {

View File

@ -26,10 +26,4 @@ CONFIG = \
unset(today) unset(today)
} }
CONFIG(debug, debug|release) {
DEFINES += $$DEFINES_DEBUG
} else {
DEFINES += $$DEFINES_RELEASE
}
load(toolchain) load(toolchain)

View File

@ -23,7 +23,6 @@ qtConfig(c11): CONFIG += c11
qtConfig(stack-protector-strong): CONFIG += stack_protector_strong qtConfig(stack-protector-strong): CONFIG += stack_protector_strong
contains(TEMPLATE, .*lib) { contains(TEMPLATE, .*lib) {
# module and plugins # module and plugins
if(!host_build|!cross_compile):qtConfig(reduce_exports): CONFIG += hide_symbols
unix:qtConfig(reduce_relocations): CONFIG += bsymbolic_functions unix:qtConfig(reduce_relocations): CONFIG += bsymbolic_functions
qtConfig(separate_debug_info): CONFIG += separate_debug_info qtConfig(separate_debug_info): CONFIG += separate_debug_info
@ -58,6 +57,9 @@ contains(TEMPLATE, .*lib) {
QMAKE_PRL_INSTALL_REPLACE += qtlibdir_replace QMAKE_PRL_INSTALL_REPLACE += qtlibdir_replace
} }
} }
contains(TEMPLATE, .*lib)|darwin {
if(!host_build|!cross_compile):qtConfig(reduce_exports): CONFIG += hide_symbols
}
# The remainder of this file must not apply to host tools/libraries, # The remainder of this file must not apply to host tools/libraries,
# as the host compiler's version and capabilities are not checked. # as the host compiler's version and capabilities are not checked.

View File

@ -36,6 +36,7 @@ EMCC_COMMON_LFLAGS += \
-s USE_WEBGL2=1 \ -s USE_WEBGL2=1 \
-s NO_EXIT_RUNTIME=0 \ -s NO_EXIT_RUNTIME=0 \
-s ERROR_ON_UNDEFINED_SYMBOLS=1 \ -s ERROR_ON_UNDEFINED_SYMBOLS=1 \
-s EXTRA_EXPORTED_RUNTIME_METHODS=[\"UTF16ToString\",\"stringToUTF16\"] \
--bind --bind
# The -s arguments can also be used with release builds, # The -s arguments can also be used with release builds,

View File

@ -1168,7 +1168,7 @@
\section1 DEFINES_DEBUG \section1 DEFINES_DEBUG
Specifies preprocessor defines for the debug configuration. The values of Specifies preprocessor defines for the debug configuration. The values of
this variable get added to \l{DEFINES} before the project is loaded. This this variable get added to \l{DEFINES} after the project is loaded. This
variable is typically set in \l{#QMAKESPEC}{qmake.conf} and rarely needs variable is typically set in \l{#QMAKESPEC}{qmake.conf} and rarely needs
to be modified. to be modified.
@ -1178,10 +1178,13 @@
\section1 DEFINES_RELEASE \section1 DEFINES_RELEASE
Specifies preprocessor defines for the release configuration. The values of Specifies preprocessor defines for the release configuration. The values of
this variable get added to \l{DEFINES} before the project is loaded. This this variable get added to \l{DEFINES} after the project is loaded. This
variable is typically set in \l{#QMAKESPEC}{qmake.conf} and rarely needs variable is typically set in \l{#QMAKESPEC}{qmake.conf} and rarely needs
to be modified. to be modified.
\note For MSVC mkspecs, this variable contains the value \c NDEBUG by
default.
This variable was introduced in Qt 5.13.2. This variable was introduced in Qt 5.13.2.
\target DEF_FILE \target DEF_FILE

View File

@ -534,8 +534,25 @@ static QString getRelocatablePrefix()
#if defined(QT_STATIC) #if defined(QT_STATIC)
prefixPath = prefixFromAppDirHelper(); prefixPath = prefixFromAppDirHelper();
#elif defined(Q_OS_DARWIN) && QT_CONFIG(framework) #elif defined(Q_OS_DARWIN) && QT_CONFIG(framework)
CFBundleRef qtCoreBundle = CFBundleGetBundleWithIdentifier( auto qtCoreBundle = CFBundleGetBundleWithIdentifier(CFSTR("org.qt-project.QtCore"));
CFSTR("org.qt-project.QtCore")); if (!qtCoreBundle) {
// When running Qt apps over Samba shares, CoreFoundation will fail to find
// the Resources directory inside the bundle, This directory is a symlink,
// and CF relies on readdir() and dtent.dt_type to detect symlinks, which
// does not work reliably for Samba shares. We work around it by manually
// looking for the QtCore bundle.
auto allBundles = CFBundleGetAllBundles();
auto bundleCount = CFArrayGetCount(allBundles);
for (int i = 0; i < bundleCount; ++i) {
auto bundle = CFBundleRef(CFArrayGetValueAtIndex(allBundles, i));
auto url = QCFType<CFURLRef>(CFBundleCopyBundleURL(bundle));
auto path = QCFType<CFStringRef>(CFURLCopyFileSystemPath(url, kCFURLPOSIXPathStyle));
if (CFStringHasSuffix(path, CFSTR("/QtCore.framework"))) {
qtCoreBundle = bundle;
break;
}
}
}
Q_ASSERT(qtCoreBundle); Q_ASSERT(qtCoreBundle);
QCFType<CFURLRef> qtCorePath = CFBundleCopyBundleURL(qtCoreBundle); QCFType<CFURLRef> qtCorePath = CFBundleCopyBundleURL(qtCoreBundle);

View File

@ -1023,7 +1023,7 @@
\value WA_MacNoClickThrough This value is obsolete and has no effect. \value WA_MacNoClickThrough This value is obsolete and has no effect.
\value WA_MacOpaqueSizeGrip Indicates that the native Carbon size grip \value WA_MacOpaqueSizeGrip Indicates that the native size grip
should be opaque instead of transparent (the default). This attribute should be opaque instead of transparent (the default). This attribute
is only applicable to \macos and is set by the widget's author. is only applicable to \macos and is set by the widget's author.

View File

@ -50,6 +50,7 @@
#endif #endif
#include <qstack.h> #include <qstack.h>
#include <qbuffer.h> #include <qbuffer.h>
#include <qscopeguard.h>
#ifndef QT_BOOTSTRAPPED #ifndef QT_BOOTSTRAPPED
#include <qcoreapplication.h> #include <qcoreapplication.h>
#else #else
@ -68,6 +69,8 @@ public: \
{ return QString::fromLatin1(sourceText); } \ { return QString::fromLatin1(sourceText); } \
private: private:
#endif #endif
#include <private/qmemory_p.h>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
#include "qxmlstream_p.h" #include "qxmlstream_p.h"
@ -847,7 +850,7 @@ void QXmlStreamReaderPrivate::init()
#endif #endif
attributeStack.clear(); attributeStack.clear();
attributeStack.reserve(16); attributeStack.reserve(16);
entityParser = nullptr; entityParser.reset();
hasCheckedStartDocument = false; hasCheckedStartDocument = false;
normalizeLiterals = false; normalizeLiterals = false;
hasSeenTag = false; hasSeenTag = false;
@ -880,7 +883,7 @@ void QXmlStreamReaderPrivate::parseEntity(const QString &value)
if (!entityParser) if (!entityParser)
entityParser = new QXmlStreamReaderPrivate(q); entityParser = qt_make_unique<QXmlStreamReaderPrivate>(q);
else else
entityParser->init(); entityParser->init();
entityParser->inParseEntity = true; entityParser->inParseEntity = true;
@ -910,7 +913,6 @@ QXmlStreamReaderPrivate::~QXmlStreamReaderPrivate()
#endif #endif
free(sym_stack); free(sym_stack);
free(state_stack); free(state_stack);
delete entityParser;
} }
@ -1582,6 +1584,7 @@ QStringRef QXmlStreamReaderPrivate::namespaceForPrefix(const QStringRef &prefix)
*/ */
void QXmlStreamReaderPrivate::resolveTag() void QXmlStreamReaderPrivate::resolveTag()
{ {
const auto attributeStackCleaner = qScopeGuard([this](){ attributeStack.clear(); });
int n = attributeStack.size(); int n = attributeStack.size();
if (namespaceProcessing) { if (namespaceProcessing) {
@ -1649,7 +1652,10 @@ void QXmlStreamReaderPrivate::resolveTag()
if (attributes[j].name() == attribute.name() if (attributes[j].name() == attribute.name()
&& attributes[j].namespaceUri() == attribute.namespaceUri() && attributes[j].namespaceUri() == attribute.namespaceUri()
&& (namespaceProcessing || attributes[j].qualifiedName() == attribute.qualifiedName())) && (namespaceProcessing || attributes[j].qualifiedName() == attribute.qualifiedName()))
{
raiseWellFormedError(QXmlStream::tr("Attribute '%1' redefined.").arg(attribute.qualifiedName())); raiseWellFormedError(QXmlStream::tr("Attribute '%1' redefined.").arg(attribute.qualifiedName()));
return;
}
} }
} }
@ -1680,8 +1686,6 @@ void QXmlStreamReaderPrivate::resolveTag()
attribute.m_isDefault = true; attribute.m_isDefault = true;
attributes.append(attribute); attributes.append(attribute);
} }
attributeStack.clear();
} }
void QXmlStreamReaderPrivate::resolvePublicNamespaces() void QXmlStreamReaderPrivate::resolvePublicNamespaces()

View File

@ -981,7 +981,7 @@ public:
QString resolveUndeclaredEntity(const QString &name); QString resolveUndeclaredEntity(const QString &name);
void parseEntity(const QString &value); void parseEntity(const QString &value);
QXmlStreamReaderPrivate *entityParser; std::unique_ptr<QXmlStreamReaderPrivate> entityParser;
bool scanAfterLangleBang(); bool scanAfterLangleBang();
bool scanPublicOrSystem(); bool scanPublicOrSystem();

View File

@ -734,23 +734,23 @@ static void updateSystemPrivate()
globalLocaleData.m_script_id = res.toInt(); globalLocaleData.m_script_id = res.toInt();
res = sys_locale->query(QSystemLocale::DecimalPoint, QVariant()); res = sys_locale->query(QSystemLocale::DecimalPoint, QVariant());
if (!res.isNull()) if (!res.isNull() && !res.toString().isEmpty())
globalLocaleData.m_decimal = res.toString().at(0).unicode(); globalLocaleData.m_decimal = res.toString().at(0).unicode();
res = sys_locale->query(QSystemLocale::GroupSeparator, QVariant()); res = sys_locale->query(QSystemLocale::GroupSeparator, QVariant());
if (!res.isNull()) if (!res.isNull() && !res.toString().isEmpty())
globalLocaleData.m_group = res.toString().at(0).unicode(); globalLocaleData.m_group = res.toString().at(0).unicode();
res = sys_locale->query(QSystemLocale::ZeroDigit, QVariant()); res = sys_locale->query(QSystemLocale::ZeroDigit, QVariant());
if (!res.isNull()) if (!res.isNull() && !res.toString().isEmpty())
globalLocaleData.m_zero = res.toString().at(0).unicode(); globalLocaleData.m_zero = res.toString().at(0).unicode();
res = sys_locale->query(QSystemLocale::NegativeSign, QVariant()); res = sys_locale->query(QSystemLocale::NegativeSign, QVariant());
if (!res.isNull()) if (!res.isNull() && !res.toString().isEmpty())
globalLocaleData.m_minus = res.toString().at(0).unicode(); globalLocaleData.m_minus = res.toString().at(0).unicode();
res = sys_locale->query(QSystemLocale::PositiveSign, QVariant()); res = sys_locale->query(QSystemLocale::PositiveSign, QVariant());
if (!res.isNull()) if (!res.isNull() && !res.toString().isEmpty())
globalLocaleData.m_plus = res.toString().at(0).unicode(); globalLocaleData.m_plus = res.toString().at(0).unicode();
} }
#endif // !QT_NO_SYSTEMLOCALE #endif // !QT_NO_SYSTEMLOCALE
@ -4463,6 +4463,8 @@ QStringList QLocale::uiLanguages() const
for (const auto entry : qAsConst(uiLanguages)) for (const auto entry : qAsConst(uiLanguages))
locales.append(QLocale(entry)); locales.append(QLocale(entry));
} }
if (locales.isEmpty())
locales.append(systemLocale()->fallbackUiLocale());
} else } else
#endif #endif
{ {

View File

@ -48,7 +48,7 @@ SOURCES += \
NO_PCH_SOURCES += text/qstring_compat.cpp NO_PCH_SOURCES += text/qstring_compat.cpp
false: SOURCES += $$NO_PCH_SOURCES # Hack for QtCreator false: SOURCES += $$NO_PCH_SOURCES # Hack for QtCreator
!nacl:macos: { !nacl:darwin: {
SOURCES += text/qlocale_mac.mm SOURCES += text/qlocale_mac.mm
} }
else:unix { else:unix {

View File

@ -93,9 +93,9 @@ painter2->begin(myWidget); // impossible - only one painter at a time
//! [4] //! [4]
void QPainter::rotate(qreal angle) void QPainter::rotate(qreal angle)
{ {
QMatrix matrix; QTransform matrix;
matrix.rotate(angle); matrix.rotate(angle);
setWorldMatrix(matrix, true); setWorldTransform(matrix, true);
} }
//! [4] //! [4]

View File

@ -1269,6 +1269,55 @@
\row \li \c word-spacing \row \li \c word-spacing
\li <width>px \li <width>px
\li Specifies an alternate spacing between each word. \li Specifies an alternate spacing between each word.
\row \li \c line-height
\li <number>[% | px | pt | cm]
\li Specifies the height of a line. It can be one of the
following:
\list
\li fixed line height in pixels, points, or centimeters.
\li a percentage of the current font size.
\endlist
\endtable
\section1 Qt-specific CSS properties
Besides the standard CSS properties listed earlier, the following
Qt-specific properties can also be used to style a text block:
\table
\header \li Property
\li Values
\li Description
\row
\li \c -qt-block-indent
\li \c <number>
\li Indents the text block by the specified no. spaces.
\row
\li \c -qt-list-indent
\li \c <number>
\li Indents the list items by the specified no. of spaces.
\row
\li \c -qt-list-number-prefix
\li \c <string>
\li Prefixes the given string to list number in an HTML ordered list.
\row
\li \c -qt-list-number-suffix
\li <string>
\li Suffixes the given string to list number in an HTML ordered list.
\row
\li \c -qt-paragraph-type
\li \c empty
\li Hides the text block.
\row
\li \c -qt-table-type
\li \c{root | frame}
\li \c root renders the text blocks inline without borders and
indentation, whereas \c frame renders them on a new line
with a frame around.
\row
\li \c -qt-user-state
\li \c <number>
\li Adds it as user data for the text block.
\endtable \endtable
\section1 Supported CSS Selectors \section1 Supported CSS Selectors

View File

@ -2847,7 +2847,13 @@ QImage QImage::scaledToHeight(int h, Qt::TransformationMode mode) const
} }
#if QT_DEPRECATED_SINCE(5, 15)
/*! /*!
\obsolete
Use trueMatrix(const QTransform &matrix, int w, int h) instead.
\fn QMatrix QImage::trueMatrix(const QMatrix &matrix, int width, int height) \fn QMatrix QImage::trueMatrix(const QMatrix &matrix, int width, int height)
Returns the actual matrix used for transforming an image with the Returns the actual matrix used for transforming an image with the
@ -2869,6 +2875,10 @@ QMatrix QImage::trueMatrix(const QMatrix &matrix, int w, int h)
} }
/*! /*!
\obsolete
Use transformed(const QTransform &matrix, Qt::TransformationMode mode) instead.
Returns a copy of the image that is transformed using the given Returns a copy of the image that is transformed using the given
transformation \a matrix and transformation \a mode. transformation \a matrix and transformation \a mode.
@ -2893,6 +2903,8 @@ QImage QImage::transformed(const QMatrix &matrix, Qt::TransformationMode mode) c
return transformed(QTransform(matrix), mode); return transformed(QTransform(matrix), mode);
} }
#endif // QT_DEPRECATED_SINCE(5, 15)
/*! /*!
Builds and returns a 1-bpp mask from the alpha buffer in this Builds and returns a 1-bpp mask from the alpha buffer in this
image. Returns a null image if the image's format is image. Returns a null image if the image's format is

View File

@ -241,8 +241,12 @@ public:
Qt::TransformationMode mode = Qt::FastTransformation) const; Qt::TransformationMode mode = Qt::FastTransformation) const;
QImage scaledToWidth(int w, Qt::TransformationMode mode = Qt::FastTransformation) const; QImage scaledToWidth(int w, Qt::TransformationMode mode = Qt::FastTransformation) const;
QImage scaledToHeight(int h, Qt::TransformationMode mode = Qt::FastTransformation) const; QImage scaledToHeight(int h, Qt::TransformationMode mode = Qt::FastTransformation) const;
#if QT_DEPRECATED_SINCE(5, 15)
QT_DEPRECATED_X("Use transformed(const QTransform &matrix, Qt::TransformationMode mode)")
QImage transformed(const QMatrix &matrix, Qt::TransformationMode mode = Qt::FastTransformation) const; QImage transformed(const QMatrix &matrix, Qt::TransformationMode mode = Qt::FastTransformation) const;
QT_DEPRECATED_X("trueMatrix(const QTransform &, int w, int h)")
static QMatrix trueMatrix(const QMatrix &, int w, int h); static QMatrix trueMatrix(const QMatrix &, int w, int h);
#endif // QT_DEPRECATED_SINCE(5, 15)
QImage transformed(const QTransform &matrix, Qt::TransformationMode mode = Qt::FastTransformation) const; QImage transformed(const QTransform &matrix, Qt::TransformationMode mode = Qt::FastTransformation) const;
static QTransform trueMatrix(const QTransform &, int w, int h); static QTransform trueMatrix(const QTransform &, int w, int h);
QImage mirrored(bool horizontally = false, bool vertically = true) const & QImage mirrored(bool horizontally = false, bool vertically = true) const &

View File

@ -438,7 +438,7 @@ QImage QPixmap::toImage() const
} }
/*! /*!
\fn QMatrix QPixmap::trueMatrix(const QTransform &matrix, int width, int height) \fn QTransform QPixmap::trueMatrix(const QTransform &matrix, int width, int height)
Returns the actual matrix used for transforming a pixmap with the Returns the actual matrix used for transforming a pixmap with the
given \a width, \a height and \a matrix. given \a width, \a height and \a matrix.
@ -458,8 +458,12 @@ QTransform QPixmap::trueMatrix(const QTransform &m, int w, int h)
return QImage::trueMatrix(m, w, h); return QImage::trueMatrix(m, w, h);
} }
#if QT_DEPRECATED_SINCE(5, 15)
/*! /*!
\overload \overload
\obsolete
Use trueMatrix(const QTransform &m, int w, int h) instead.
This convenience function loads the matrix \a m into a This convenience function loads the matrix \a m into a
QTransform and calls the overloaded function with the QTransform and calls the overloaded function with the
@ -469,6 +473,7 @@ QMatrix QPixmap::trueMatrix(const QMatrix &m, int w, int h)
{ {
return trueMatrix(QTransform(m), w, h).toAffine(); return trueMatrix(QTransform(m), w, h).toAffine();
} }
#endif // QT_DEPRECATED_SINCE(5, 15)
/*! /*!
@ -1233,8 +1238,12 @@ QPixmap QPixmap::transformed(const QTransform &transform,
return data->transformed(transform, mode); return data->transformed(transform, mode);
} }
#if QT_DEPRECATED_SINCE(5, 15)
/*! /*!
\overload \overload
\obsolete
Use transformed(const QTransform &transform, Qt::TransformationMode mode)() instead.
This convenience function loads the \a matrix into a This convenience function loads the \a matrix into a
QTransform and calls the overloaded function. QTransform and calls the overloaded function.
@ -1243,6 +1252,7 @@ QPixmap QPixmap::transformed(const QMatrix &matrix, Qt::TransformationMode mode)
{ {
return transformed(QTransform(matrix), mode); return transformed(QTransform(matrix), mode);
} }
#endif // QT_DEPRECATED_SINCE(5, 15)

View File

@ -129,8 +129,12 @@ public:
Qt::TransformationMode mode = Qt::FastTransformation) const; Qt::TransformationMode mode = Qt::FastTransformation) const;
QPixmap scaledToWidth(int w, Qt::TransformationMode mode = Qt::FastTransformation) const; QPixmap scaledToWidth(int w, Qt::TransformationMode mode = Qt::FastTransformation) const;
QPixmap scaledToHeight(int h, Qt::TransformationMode mode = Qt::FastTransformation) const; QPixmap scaledToHeight(int h, Qt::TransformationMode mode = Qt::FastTransformation) const;
#if QT_DEPRECATED_SINCE(5, 15)
QT_DEPRECATED_X("Use transformed(const QTransform &, Qt::TransformationMode mode)")
QPixmap transformed(const QMatrix &, Qt::TransformationMode mode = Qt::FastTransformation) const; QPixmap transformed(const QMatrix &, Qt::TransformationMode mode = Qt::FastTransformation) const;
QT_DEPRECATED_X("Use trueMatrix(const QTransform &m, int w, int h)")
static QMatrix trueMatrix(const QMatrix &m, int w, int h); static QMatrix trueMatrix(const QMatrix &m, int w, int h);
#endif // QT_DEPRECATED_SINCE(5, 15)
QPixmap transformed(const QTransform &, Qt::TransformationMode mode = Qt::FastTransformation) const; QPixmap transformed(const QTransform &, Qt::TransformationMode mode = Qt::FastTransformation) const;
static QTransform trueMatrix(const QTransform &m, int w, int h); static QTransform trueMatrix(const QTransform &m, int w, int h);

View File

@ -916,6 +916,9 @@ bool QPNGImageWriter::writeImage(const QImage& image, int compression_in, const
} }
png_set_error_fn(png_ptr, nullptr, nullptr, qt_png_warning); png_set_error_fn(png_ptr, nullptr, nullptr, qt_png_warning);
#ifdef PNG_BENIGN_ERRORS_SUPPORTED
png_set_benign_errors(png_ptr, 1);
#endif
info_ptr = png_create_info_struct(png_ptr); info_ptr = png_create_info_struct(png_ptr);
if (!info_ptr) { if (!info_ptr) {

View File

@ -1150,8 +1150,8 @@ QKeyEvent::~QKeyEvent()
Note: The native scan code may be 0, even if the key event contains Note: The native scan code may be 0, even if the key event contains
extended information. extended information.
Note: On Mac OS/X, this function is not useful, because there is no Note: On \macos, this function is not useful, because there is no
way to get the scan code from Carbon or Cocoa. The function always way to get the scan code from the system APIs. The function always
returns 1 (or 0 in the case explained above). returns 1 (or 0 in the case explained above).
*/ */

View File

@ -49,7 +49,6 @@
# include "qkeysequence.h" # include "qkeysequence.h"
#endif #endif
#include "qtransform.h" #include "qtransform.h"
#include "qmatrix.h"
#include "qpalette.h" #include "qpalette.h"
#include "qpen.h" #include "qpen.h"
#include "qpixmap.h" #include "qpixmap.h"

View File

@ -187,7 +187,10 @@ QMatrix4x4::QMatrix4x4(const float *values, int cols, int rows)
flagBits = General; flagBits = General;
} }
#if QT_DEPRECATED_SINCE(5, 15)
/*! /*!
\obsolete
Constructs a 4x4 matrix from a conventional Qt 2D affine Constructs a 4x4 matrix from a conventional Qt 2D affine
transformation \a matrix. transformation \a matrix.
@ -218,6 +221,7 @@ QMatrix4x4::QMatrix4x4(const QMatrix& matrix)
m[3][3] = 1.0f; m[3][3] = 1.0f;
flagBits = Translation | Scale | Rotation2D; flagBits = Translation | Scale | Rotation2D;
} }
#endif // QT_DEPRECATED_SINCE(5, 15)
/*! /*!
Constructs a 4x4 matrix from the conventional Qt 2D Constructs a 4x4 matrix from the conventional Qt 2D
@ -1659,7 +1663,12 @@ void QMatrix4x4::copyDataTo(float *values) const
values[row * 4 + col] = float(m[col][row]); values[row * 4 + col] = float(m[col][row]);
} }
#if QT_DEPRECATED_SINCE(5, 15)
/*! /*!
\obsolete
Use toTransform() instead.
Returns the conventional Qt 2D affine transformation matrix that Returns the conventional Qt 2D affine transformation matrix that
corresponds to this matrix. It is assumed that this matrix corresponds to this matrix. It is assumed that this matrix
only contains 2D affine transformation elements. only contains 2D affine transformation elements.
@ -1672,6 +1681,7 @@ QMatrix QMatrix4x4::toAffine() const
m[1][0], m[1][1], m[1][0], m[1][1],
m[3][0], m[3][1]); m[3][0], m[3][1]);
} }
#endif // QT_DEPRECATED_SINCE(5, 15)
/*! /*!
Returns the conventional Qt 2D transformation matrix that Returns the conventional Qt 2D transformation matrix that

View File

@ -72,7 +72,9 @@ public:
QMatrix4x4(const float *values, int cols, int rows); QMatrix4x4(const float *values, int cols, int rows);
QMatrix4x4(const QTransform& transform); QMatrix4x4(const QTransform& transform);
#if QT_DEPRECATED_SINCE(5, 15)
QMatrix4x4(const QMatrix& matrix); QMatrix4x4(const QMatrix& matrix);
#endif // QT_DEPRECATED_SINCE(5, 15)
inline const float& operator()(int row, int column) const; inline const float& operator()(int row, int column) const;
inline float& operator()(int row, int column); inline float& operator()(int row, int column);
@ -156,7 +158,9 @@ public:
void copyDataTo(float *values) const; void copyDataTo(float *values) const;
QMatrix toAffine() const; #if QT_DEPRECATED_SINCE(5, 15)
QT_DEPRECATED_X("Use toTransform()") QMatrix toAffine() const;
#endif // QT_DEPRECATED_SINCE(5, 15)
QTransform toTransform() const; QTransform toTransform() const;
QTransform toTransform(float distanceToPlane) const; QTransform toTransform(float distanceToPlane) const;

View File

@ -893,8 +893,12 @@ bool QBrush::isOpaque() const
} }
#if QT_DEPRECATED_SINCE(5, 15)
/*! /*!
\since 4.2 \since 4.2
\obsolete
Use setTransform() instead.
Sets \a matrix as an explicit transformation matrix on the Sets \a matrix as an explicit transformation matrix on the
current brush. The brush transformation matrix is merged with current brush. The brush transformation matrix is merged with
@ -906,6 +910,7 @@ void QBrush::setMatrix(const QMatrix &matrix)
{ {
setTransform(QTransform(matrix)); setTransform(QTransform(matrix));
} }
#endif // QT_DEPRECATED_SINCE(5, 15)
/*! /*!
\since 4.3 \since 4.3
@ -923,14 +928,19 @@ void QBrush::setTransform(const QTransform &matrix)
} }
#if QT_DEPRECATED_SINCE(5, 15)
/*! /*!
\fn void QBrush::matrix() const \fn void QBrush::matrix() const
\since 4.2 \since 4.2
\obsolete
Use transform() instead.
Returns the current transformation matrix for the brush. Returns the current transformation matrix for the brush.
\sa setMatrix() \sa setMatrix()
*/ */
#endif // QT_DEPRECATED_SINCE(5, 15)
/*! /*!
\fn bool QBrush::operator!=(const QBrush &brush) const \fn bool QBrush::operator!=(const QBrush &brush) const

View File

@ -89,8 +89,10 @@ public:
inline Qt::BrushStyle style() const; inline Qt::BrushStyle style() const;
void setStyle(Qt::BrushStyle); void setStyle(Qt::BrushStyle);
inline const QMatrix &matrix() const; #if QT_DEPRECATED_SINCE(5, 15)
void setMatrix(const QMatrix &mat); QT_DEPRECATED_X("Use transform()") inline const QMatrix &matrix() const;
QT_DEPRECATED_X("Use setTransform()") void setMatrix(const QMatrix &mat);
#endif // QT_DEPRECATED_SINCE(5, 15)
inline QTransform transform() const; inline QTransform transform() const;
void setTransform(const QTransform &); void setTransform(const QTransform &);
@ -157,7 +159,10 @@ struct QBrushData
inline Qt::BrushStyle QBrush::style() const { return d->style; } inline Qt::BrushStyle QBrush::style() const { return d->style; }
inline const QColor &QBrush::color() const { return d->color; } inline const QColor &QBrush::color() const { return d->color; }
#if QT_DEPRECATED_SINCE(5, 15)
QT_DEPRECATED_X("Use transform()")
inline const QMatrix &QBrush::matrix() const { return d->transform.toAffine(); } inline const QMatrix &QBrush::matrix() const { return d->transform.toAffine(); }
#endif // QT_DEPRECATED_SINCE(5, 15)
inline QTransform QBrush::transform() const { return d->transform; } inline QTransform QBrush::transform() const { return d->transform; }
inline bool QBrush::isDetached() const { return d->ref.loadRelaxed() == 1; } inline bool QBrush::isDetached() const { return d->ref.loadRelaxed() == 1; }

View File

@ -45,6 +45,7 @@
#include "qregion.h" #include "qregion.h"
#include "qpainterpath.h" #include "qpainterpath.h"
#include "qpainterpath_p.h" #include "qpainterpath_p.h"
#include "qtransform.h"
#include "qvariant.h" #include "qvariant.h"
#include <qmath.h> #include <qmath.h>
@ -680,7 +681,7 @@ QRegion QMatrix::map(const QRegion &r) const
} }
QPainterPath p = map(qt_regionToPath(r)); QPainterPath p = map(qt_regionToPath(r));
return p.toFillPolygon().toPolygon(); return p.toFillPolygon(QTransform()).toPolygon();
} }
/*! /*!

View File

@ -508,7 +508,7 @@ void QPaintEngine::drawEllipse(const QRectF &rect)
if (hasFeature(PainterPaths)) { if (hasFeature(PainterPaths)) {
drawPath(path); drawPath(path);
} else { } else {
QPolygonF polygon = path.toFillPolygon(); QPolygonF polygon = path.toFillPolygon(QTransform());
drawPolygon(polygon.data(), polygon.size(), ConvexMode); drawPolygon(polygon.data(), polygon.size(), ConvexMode);
} }
} }

View File

@ -273,7 +273,9 @@ public:
QBrush backgroundBrush() const; QBrush backgroundBrush() const;
Qt::BGMode backgroundMode() const; Qt::BGMode backgroundMode() const;
QFont font() const; QFont font() const;
QMatrix matrix() const; #if QT_DEPRECATED_SINCE(5, 15)
QT_DEPRECATED_X("Use transform()") QMatrix matrix() const;
#endif // QT_DEPRECATED_SINCE(5, 15)
QTransform transform() const; QTransform transform() const;
Qt::ClipOperation clipOperation() const; Qt::ClipOperation clipOperation() const;

View File

@ -2555,19 +2555,19 @@ QRegion QPainter::clipRegion() const
case QPainterClipInfo::PathClip: { case QPainterClipInfo::PathClip: {
QTransform matrix = (info.matrix * d->invMatrix); QTransform matrix = (info.matrix * d->invMatrix);
if (lastWasNothing) { if (lastWasNothing) {
region = QRegion((info.path * matrix).toFillPolygon().toPolygon(), region = QRegion((info.path * matrix).toFillPolygon(QTransform()).toPolygon(),
info.path.fillRule()); info.path.fillRule());
lastWasNothing = false; lastWasNothing = false;
continue; continue;
} }
if (info.operation == Qt::IntersectClip) { if (info.operation == Qt::IntersectClip) {
region &= QRegion((info.path * matrix).toFillPolygon().toPolygon(), region &= QRegion((info.path * matrix).toFillPolygon(QTransform()).toPolygon(),
info.path.fillRule()); info.path.fillRule());
} else if (info.operation == Qt::NoClip) { } else if (info.operation == Qt::NoClip) {
lastWasNothing = true; lastWasNothing = true;
region = QRegion(); region = QRegion();
} else { } else {
region = QRegion((info.path * matrix).toFillPolygon().toPolygon(), region = QRegion((info.path * matrix).toFillPolygon(QTransform()).toPolygon(),
info.path.fillRule()); info.path.fillRule());
} }
break; break;
@ -8089,6 +8089,8 @@ QFont QPaintEngineState::font() const
\since 4.2 \since 4.2
\obsolete \obsolete
Use transform() instead.
Returns the matrix in the current paint engine Returns the matrix in the current paint engine
state. state.

View File

@ -72,7 +72,6 @@ class QPen;
class QPolygon; class QPolygon;
class QTextItem; class QTextItem;
class QTextEngine; class QTextEngine;
class QMatrix;
class QTransform; class QTransform;
class QStaticText; class QStaticText;
class QGlyphRun; class QGlyphRun;

View File

@ -59,7 +59,6 @@
#include "QtGui/qfont.h" #include "QtGui/qfont.h"
#include "QtGui/qpen.h" #include "QtGui/qpen.h"
#include "QtGui/qregion.h" #include "QtGui/qregion.h"
#include "QtGui/qmatrix.h"
#include "QtGui/qpainter.h" #include "QtGui/qpainter.h"
#include "QtGui/qpainterpath.h" #include "QtGui/qpainterpath.h"
#include "QtGui/qpaintengine.h" #include "QtGui/qpaintengine.h"

View File

@ -1660,13 +1660,18 @@ QList<QPolygonF> QPainterPath::toSubpathPolygons(const QTransform &matrix) const
return flatCurves; return flatCurves;
} }
#if QT_DEPRECATED_SINCE(5, 15)
/*! /*!
\overload \overload
\obsolete
Use toSubpathPolygons(const QTransform &matrix) instead.
*/ */
QList<QPolygonF> QPainterPath::toSubpathPolygons(const QMatrix &matrix) const QList<QPolygonF> QPainterPath::toSubpathPolygons(const QMatrix &matrix) const
{ {
return toSubpathPolygons(QTransform(matrix)); return toSubpathPolygons(QTransform(matrix));
} }
#endif // QT_DEPRECATED_SINCE(5, 15)
/*! /*!
Converts the path into a list of polygons using the Converts the path into a list of polygons using the
@ -1787,13 +1792,18 @@ QList<QPolygonF> QPainterPath::toFillPolygons(const QTransform &matrix) const
return polys; return polys;
} }
#if QT_DEPRECATED_SINCE(5, 15)
/*! /*!
\overload \overload
\obsolete
Use toFillPolygons(const QTransform &matrix) instead.
*/ */
QList<QPolygonF> QPainterPath::toFillPolygons(const QMatrix &matrix) const QList<QPolygonF> QPainterPath::toFillPolygons(const QMatrix &matrix) const
{ {
return toFillPolygons(QTransform(matrix)); return toFillPolygons(QTransform(matrix));
} }
#endif // QT_DEPRECATED_SINCE(5, 15)
//same as qt_polygon_isect_line in qpolygon.cpp //same as qt_polygon_isect_line in qpolygon.cpp
static void qt_painterpath_isect_line(const QPointF &p1, static void qt_painterpath_isect_line(const QPointF &p1,
@ -2904,14 +2914,18 @@ QPolygonF QPainterPath::toFillPolygon(const QTransform &matrix) const
return polygon; return polygon;
} }
#if QT_DEPRECATED_SINCE(5, 15)
/*! /*!
\overload \overload
\obsolete
Use toFillPolygon(const QTransform &matrix) instead.
*/ */
QPolygonF QPainterPath::toFillPolygon(const QMatrix &matrix) const QPolygonF QPainterPath::toFillPolygon(const QMatrix &matrix) const
{ {
return toFillPolygon(QTransform(matrix)); return toFillPolygon(QTransform(matrix));
} }
#endif // QT_DEPRECATED_SINCE(5, 15)
//derivative of the equation //derivative of the equation
static inline qreal slopeAt(qreal t, qreal a, qreal b, qreal c, qreal d) static inline qreal slopeAt(qreal t, qreal a, qreal b, qreal c, qreal d)

View File

@ -175,9 +175,15 @@ public:
bool isEmpty() const; bool isEmpty() const;
Q_REQUIRED_RESULT QPainterPath toReversed() const; Q_REQUIRED_RESULT QPainterPath toReversed() const;
#if QT_DEPRECATED_SINCE(5, 15)
QT_DEPRECATED_X("Use toSubpathPolygons(const QTransform &)")
QList<QPolygonF> toSubpathPolygons(const QMatrix &matrix = QMatrix()) const; QList<QPolygonF> toSubpathPolygons(const QMatrix &matrix = QMatrix()) const;
QT_DEPRECATED_X("Use toFillPolygons(const QTransform &")
QList<QPolygonF> toFillPolygons(const QMatrix &matrix = QMatrix()) const; QList<QPolygonF> toFillPolygons(const QMatrix &matrix = QMatrix()) const;
QT_DEPRECATED_X("Use toFillPolygon(const QTransform &)")
QPolygonF toFillPolygon(const QMatrix &matrix = QMatrix()) const; QPolygonF toFillPolygon(const QMatrix &matrix = QMatrix()) const;
#endif // QT_DEPRECATED_SINCE(5, 15)
QList<QPolygonF> toSubpathPolygons(const QTransform &matrix) const; QList<QPolygonF> toSubpathPolygons(const QTransform &matrix) const;
QList<QPolygonF> toFillPolygons(const QTransform &matrix) const; QList<QPolygonF> toFillPolygons(const QTransform &matrix) const;
QPolygonF toFillPolygon(const QTransform &matrix) const; QPolygonF toFillPolygon(const QTransform &matrix) const;

View File

@ -55,7 +55,6 @@
#ifndef QT_NO_PDF #ifndef QT_NO_PDF
#include "QtGui/qmatrix.h"
#include "QtCore/qstring.h" #include "QtCore/qstring.h"
#include "QtCore/qvector.h" #include "QtCore/qvector.h"
#include "private/qstroker_p.h" #include "private/qstroker_p.h"

View File

@ -40,9 +40,9 @@
#include "qpolygon.h" #include "qpolygon.h"
#include "qrect.h" #include "qrect.h"
#include "qdatastream.h" #include "qdatastream.h"
#include "qmatrix.h"
#include "qdebug.h" #include "qdebug.h"
#include "qpainterpath.h" #include "qpainterpath.h"
#include "qtransform.h"
#include "qvariant.h" #include "qvariant.h"
#include "qpainterpath_p.h" #include "qpainterpath_p.h"
#include "qbezier_p.h" #include "qbezier_p.h"
@ -111,7 +111,7 @@ static void qt_polygon_isect_line(const QPointF &p1, const QPointF &p2, const QP
from a specified index (resizing the polygon if necessary). from a specified index (resizing the polygon if necessary).
QPolygon provides the boundingRect() and translate() functions for QPolygon provides the boundingRect() and translate() functions for
geometry functions. Use the QMatrix::map() function for more geometry functions. Use the QTransform::map() function for more
general transformations of QPolygons. general transformations of QPolygons.
The QPolygon class is \l {Implicit Data Sharing}{implicitly The QPolygon class is \l {Implicit Data Sharing}{implicitly
@ -495,7 +495,7 @@ QDebug operator<<(QDebug dbg, const QPolygon &a)
In addition to the functions provided by QVector, QPolygonF In addition to the functions provided by QVector, QPolygonF
provides the boundingRect() and translate() functions for geometry provides the boundingRect() and translate() functions for geometry
operations. Use the QMatrix::map() function for more general operations. Use the QTransform::map() function for more general
transformations of QPolygonFs. transformations of QPolygonFs.
QPolygonF also provides the isClosed() function to determine QPolygonF also provides the isClosed() function to determine
@ -899,7 +899,7 @@ QPolygon QPolygon::united(const QPolygon &r) const
QPainterPath subject; subject.addPolygon(*this); QPainterPath subject; subject.addPolygon(*this);
QPainterPath clip; clip.addPolygon(r); QPainterPath clip; clip.addPolygon(r);
return subject.united(clip).toFillPolygon().toPolygon(); return subject.united(clip).toFillPolygon(QTransform()).toPolygon();
} }
/*! /*!
@ -918,7 +918,7 @@ QPolygon QPolygon::intersected(const QPolygon &r) const
QPainterPath subject; subject.addPolygon(*this); QPainterPath subject; subject.addPolygon(*this);
QPainterPath clip; clip.addPolygon(r); QPainterPath clip; clip.addPolygon(r);
return subject.intersected(clip).toFillPolygon().toPolygon(); return subject.intersected(clip).toFillPolygon(QTransform()).toPolygon();
} }
/*! /*!
@ -936,7 +936,7 @@ QPolygon QPolygon::subtracted(const QPolygon &r) const
QPainterPath subject; subject.addPolygon(*this); QPainterPath subject; subject.addPolygon(*this);
QPainterPath clip; clip.addPolygon(r); QPainterPath clip; clip.addPolygon(r);
return subject.subtracted(clip).toFillPolygon().toPolygon(); return subject.subtracted(clip).toFillPolygon(QTransform()).toPolygon();
} }
/*! /*!
@ -975,7 +975,7 @@ QPolygonF QPolygonF::united(const QPolygonF &r) const
QPainterPath subject; subject.addPolygon(*this); QPainterPath subject; subject.addPolygon(*this);
QPainterPath clip; clip.addPolygon(r); QPainterPath clip; clip.addPolygon(r);
return subject.united(clip).toFillPolygon(); return subject.united(clip).toFillPolygon(QTransform());
} }
/*! /*!
@ -994,7 +994,7 @@ QPolygonF QPolygonF::intersected(const QPolygonF &r) const
QPainterPath subject; subject.addPolygon(*this); QPainterPath subject; subject.addPolygon(*this);
QPainterPath clip; clip.addPolygon(r); QPainterPath clip; clip.addPolygon(r);
return subject.intersected(clip).toFillPolygon(); return subject.intersected(clip).toFillPolygon(QTransform());
} }
/*! /*!
@ -1011,7 +1011,7 @@ QPolygonF QPolygonF::subtracted(const QPolygonF &r) const
{ {
QPainterPath subject; subject.addPolygon(*this); QPainterPath subject; subject.addPolygon(*this);
QPainterPath clip; clip.addPolygon(r); QPainterPath clip; clip.addPolygon(r);
return subject.subtracted(clip).toFillPolygon(); return subject.subtracted(clip).toFillPolygon(QTransform());
} }
/*! /*!

View File

@ -46,6 +46,7 @@
#include "qvarlengtharray.h" #include "qvarlengtharray.h"
#include "qimage.h" #include "qimage.h"
#include "qbitmap.h" #include "qbitmap.h"
#include "qtransform.h"
#include <private/qdebug_p.h> #include <private/qdebug_p.h>
@ -3916,7 +3917,7 @@ QRegion::QRegion(const QRect &r, RegionType t)
} else if (t == Ellipse) { } else if (t == Ellipse) {
QPainterPath path; QPainterPath path;
path.addEllipse(r.x(), r.y(), r.width(), r.height()); path.addEllipse(r.x(), r.y(), r.width(), r.height());
QPolygon a = path.toSubpathPolygons().at(0).toPolygon(); QPolygon a = path.toSubpathPolygons(QTransform()).at(0).toPolygon();
d->qt_rgn = PolygonRegion(a.constData(), a.size(), EvenOddRule); d->qt_rgn = PolygonRegion(a.constData(), a.size(), EvenOddRule);
} }
} }

View File

@ -311,8 +311,10 @@ QTransform::QTransform(qreal h11, qreal h12, qreal h21,
{ {
} }
#if QT_DEPRECATED_SINCE(5, 15)
/*! /*!
\fn QTransform::QTransform(const QMatrix &matrix) \fn QTransform::QTransform(const QMatrix &matrix)
\obsolete
Constructs a matrix that is a copy of the given \a matrix. Constructs a matrix that is a copy of the given \a matrix.
Note that the \c m13, \c m23, and \c m33 elements are set to 0, 0, Note that the \c m13, \c m23, and \c m33 elements are set to 0, 0,
@ -328,6 +330,7 @@ QTransform::QTransform(const QMatrix &mtx)
#endif #endif
{ {
} }
#endif // QT_DEPRECATED_SINCE(5, 15)
/*! /*!
Returns the adjoint of this matrix. Returns the adjoint of this matrix.
@ -2082,7 +2085,9 @@ void QTransform::map(int x, int y, int *tx, int *ty) const
*ty = qRound(fy); *ty = qRound(fy);
} }
#if QT_DEPRECATED_SINCE(5, 15)
/*! /*!
\obsolete
Returns the QTransform as an affine matrix. Returns the QTransform as an affine matrix.
\warning If a perspective transformation has been specified, \warning If a perspective transformation has been specified,
@ -2092,6 +2097,7 @@ const QMatrix &QTransform::toAffine() const
{ {
return affine; return affine;
} }
#endif // QT_DEPRECATED_SINCE(5, 15)
/*! /*!
Returns the transformation type of this matrix. Returns the transformation type of this matrix.

View File

@ -73,7 +73,9 @@ public:
qreal h31, qreal h32, qreal h33 = 1.0); qreal h31, qreal h32, qreal h33 = 1.0);
QTransform(qreal h11, qreal h12, qreal h21, QTransform(qreal h11, qreal h12, qreal h21,
qreal h22, qreal dx, qreal dy); qreal h22, qreal dx, qreal dy);
#if QT_DEPRECATED_SINCE(5, 15)
explicit QTransform(const QMatrix &mtx); explicit QTransform(const QMatrix &mtx);
#endif // QT_DEPRECATED_SINCE(5, 15)
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
// ### Qt 6: remove; the compiler-generated ones are fine! // ### Qt 6: remove; the compiler-generated ones are fine!
@ -158,7 +160,9 @@ public:
void map(int x, int y, int *tx, int *ty) const; void map(int x, int y, int *tx, int *ty) const;
void map(qreal x, qreal y, qreal *tx, qreal *ty) const; void map(qreal x, qreal y, qreal *tx, qreal *ty) const;
#if QT_DEPRECATED_SINCE(5, 15)
const QMatrix &toAffine() const; const QMatrix &toAffine() const;
#endif // QT_DEPRECATED_SINCE(5, 15)
QTransform &operator*=(qreal div); QTransform &operator*=(qreal div);
QTransform &operator/=(qreal div); QTransform &operator/=(qreal div);

View File

@ -900,7 +900,7 @@ Q_DECL_EXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void */*reserved*/)
uenv.venv = nullptr; uenv.venv = nullptr;
m_javaVM = nullptr; m_javaVM = nullptr;
if (vm->GetEnv(&uenv.venv, JNI_VERSION_1_4) != JNI_OK) { if (vm->GetEnv(&uenv.venv, JNI_VERSION_1_6) != JNI_OK) {
__android_log_print(ANDROID_LOG_FATAL, "Qt", "GetEnv failed"); __android_log_print(ANDROID_LOG_FATAL, "Qt", "GetEnv failed");
return -1; return -1;
} }
@ -922,5 +922,5 @@ Q_DECL_EXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void */*reserved*/)
if (threadSetter.thread()) if (threadSetter.thread())
threadSetter.thread()->setObjectName("QtMainLoopThread"); threadSetter.thread()->setObjectName("QtMainLoopThread");
__android_log_print(ANDROID_LOG_INFO, "Qt", "qt started"); __android_log_print(ANDROID_LOG_INFO, "Qt", "qt started");
return JNI_VERSION_1_4; return JNI_VERSION_1_6;
} }

View File

@ -29,6 +29,7 @@
#include "qwasmclipboard.h" #include "qwasmclipboard.h"
#include "qwasmwindow.h" #include "qwasmwindow.h"
#include "qwasmstring.h"
#include <emscripten.h> #include <emscripten.h>
#include <emscripten/html5.h> #include <emscripten/html5.h>
@ -40,22 +41,22 @@
using namespace emscripten; using namespace emscripten;
// there has got to be a better way... // there has got to be a better way...
static QByteArray g_clipboardArray; static QString g_clipboardText;
static QByteArray g_clipboardFormat; static QString g_clipboardFormat;
static val getClipboardData() static val getClipboardData()
{ {
return val(g_clipboardArray.constData()); return QWasmString::fromQString(g_clipboardText);
} }
static val getClipboardFormat() static val getClipboardFormat()
{ {
return val(g_clipboardFormat.constData()); return QWasmString::fromQString(g_clipboardFormat);
} }
static void pasteClipboardData(emscripten::val format, emscripten::val dataPtr) static void pasteClipboardData(emscripten::val format, emscripten::val dataPtr)
{ {
QString formatString = QString::fromStdString(format.as<std::string>()); QString formatString = QWasmString::toQString(format);
QByteArray dataArray = QByteArray::fromStdString(dataPtr.as<std::string>()); QByteArray dataArray = QByteArray::fromStdString(dataPtr.as<std::string>());
QMimeData *mMimeData = new QMimeData; QMimeData *mMimeData = new QMimeData;
mMimeData->setData(formatString, dataArray); mMimeData->setData(formatString, dataArray);
@ -102,11 +103,10 @@ static void qClipboardPasteTo(val event)
bool hasClipboardApi = QWasmIntegration::get()->getWasmClipboard()->hasClipboardApi; bool hasClipboardApi = QWasmIntegration::get()->getWasmClipboard()->hasClipboardApi;
val clipdata = hasClipboardApi ? val clipdata = hasClipboardApi ?
val::global("Module").call<val>("qtGetClipboardData") : val::global("Module").call<val>("qtGetClipboardData") :
event["clipboardData"].call<val>("getData", std::string("text")); event["clipboardData"].call<val>("getData", val("text"));
const std::string data = clipdata.as<std::string>(); const QString qstr = QWasmString::toQString(clipdata);
if (data.length() > 0) { if (qstr.length() > 0) {
QString qstr = QString::fromStdString(data);
QMimeData *mMimeData = new QMimeData; QMimeData *mMimeData = new QMimeData;
mMimeData->setText(qstr); mMimeData->setText(qstr);
QWasmClipboard::qWasmClipboardPaste(mMimeData); QWasmClipboard::qWasmClipboardPaste(mMimeData);
@ -133,7 +133,7 @@ QWasmClipboard::QWasmClipboard()
QWasmClipboard::~QWasmClipboard() QWasmClipboard::~QWasmClipboard()
{ {
g_clipboardArray.clear(); g_clipboardText.clear();
g_clipboardFormat.clear(); g_clipboardFormat.clear();
} }
@ -148,11 +148,11 @@ QMimeData* QWasmClipboard::mimeData(QClipboard::Mode mode)
void QWasmClipboard::setMimeData(QMimeData* mimeData, QClipboard::Mode mode) void QWasmClipboard::setMimeData(QMimeData* mimeData, QClipboard::Mode mode)
{ {
if (mimeData->hasText()) { if (mimeData->hasText()) {
g_clipboardFormat = mimeData->formats().at(0).toUtf8(); g_clipboardFormat = mimeData->formats().at(0);
g_clipboardArray = mimeData->text().toUtf8(); g_clipboardText = mimeData->text();
} else if (mimeData->hasHtml()) { } else if (mimeData->hasHtml()) {
g_clipboardFormat =mimeData->formats().at(0).toUtf8(); g_clipboardFormat = mimeData->formats().at(0);
g_clipboardArray = mimeData->html().toUtf8(); g_clipboardText = mimeData->html();
} }
QPlatformClipboard::setMimeData(mimeData, mode); QPlatformClipboard::setMimeData(mimeData, mode);
@ -199,13 +199,13 @@ void QWasmClipboard::installEventHandlers(const QString &canvasId)
// Fallback path for browsers which do not support direct clipboard access // Fallback path for browsers which do not support direct clipboard access
val document = val::global("document"); val document = val::global("document");
val canvas = document.call<val>("getElementById", val(canvasId.toUtf8().constData())); val canvas = document.call<val>("getElementById", QWasmString::fromQString(canvasId));
canvas.call<void>("addEventListener", std::string("cut"), canvas.call<void>("addEventListener", val("cut"),
val::module_property("qtClipboardCutTo")); val::module_property("qtClipboardCutTo"));
canvas.call<void>("addEventListener", std::string("copy"), canvas.call<void>("addEventListener", val("copy"),
val::module_property("qtClipboardCopyTo")); val::module_property("qtClipboardCopyTo"));
canvas.call<void>("addEventListener", std::string("paste"), canvas.call<void>("addEventListener", val("paste"),
val::module_property("qtClipboardPasteTo")); val::module_property("qtClipboardPasteTo"));
} }
@ -226,6 +226,6 @@ void QWasmClipboard::writeTextToClipboard()
val txt = module.call<val>("qtGetClipboardData"); val txt = module.call<val>("qtGetClipboardData");
val format = module.call<val>("qtGetClipboardFormat"); val format = module.call<val>("qtGetClipboardFormat");
val navigator = val::global("navigator"); val navigator = val::global("navigator");
navigator["clipboard"].call<void>("writeText", txt.as<std::string>()); navigator["clipboard"].call<void>("writeText", txt);
} }
} }

View File

@ -29,6 +29,7 @@
#include "qwasmcursor.h" #include "qwasmcursor.h"
#include "qwasmscreen.h" #include "qwasmscreen.h"
#include "qwasmstring.h"
#include <QtCore/qdebug.h> #include <QtCore/qdebug.h>
#include <QtGui/qwindow.h> #include <QtGui/qwindow.h>
@ -56,11 +57,11 @@ void QWasmCursor::changeCursor(QCursor *windowCursor, QWindow *window)
htmlCursorName = "auto"; htmlCursorName = "auto";
// Set cursor on the canvas // Set cursor on the canvas
QByteArray canvasId = QWasmScreen::get(screen)->canvasId().toUtf8(); val jsCanvasId = QWasmString::fromQString(QWasmScreen::get(screen)->canvasId());
val document = val::global("document"); val document = val::global("document");
val canvas = document.call<val>("getElementById", val(canvasId.constData())); val canvas = document.call<val>("getElementById", jsCanvasId);
val canvasStyle = canvas["style"]; val canvasStyle = canvas["style"];
canvasStyle.set("cursor", emscripten::val(htmlCursorName.constData())); canvasStyle.set("cursor", val(htmlCursorName.constData()));
} }
QByteArray QWasmCursor::cursorShapeToHtml(Qt::CursorShape shape) QByteArray QWasmCursor::cursorShapeToHtml(Qt::CursorShape shape)

View File

@ -32,6 +32,7 @@
#include "qwasmcompositor.h" #include "qwasmcompositor.h"
#include "qwasmintegration.h" #include "qwasmintegration.h"
#include "qwasmclipboard.h" #include "qwasmclipboard.h"
#include "qwasmstring.h"
#include <QtGui/qevent.h> #include <QtGui/qevent.h>
#include <qpa/qwindowsysteminterface.h> #include <qpa/qwindowsysteminterface.h>
@ -355,9 +356,10 @@ void QWasmEventTranslator::initEventHandlers()
if (emscripten::val::global("window")["safari"].isUndefined()) { if (emscripten::val::global("window")["safari"].isUndefined()) {
val document = val::global("document"); val document = val::global("document");
val canvas = document.call<val>("getElementById", val(canvasId)); val jsCanvasId = QWasmString::fromQString(screen()->canvasId());
val canvas = document.call<val>("getElementById", jsCanvasId);
canvas.call<void>("addEventListener", canvas.call<void>("addEventListener",
std::string("wheel"), val("wheel"),
val::module_property("qtMouseWheelEvent")); val::module_property("qtMouseWheelEvent"));
} }
} }

View File

@ -36,6 +36,7 @@
#include "qwasmclipboard.h" #include "qwasmclipboard.h"
#include "qwasmservices.h" #include "qwasmservices.h"
#include "qwasmoffscreensurface.h" #include "qwasmoffscreensurface.h"
#include "qwasmstring.h"
#include "qwasmwindow.h" #include "qwasmwindow.h"
#ifndef QT_NO_OPENGL #ifndef QT_NO_OPENGL
@ -67,19 +68,19 @@ static void browserBeforeUnload(emscripten::val)
static void addCanvasElement(emscripten::val canvas) static void addCanvasElement(emscripten::val canvas)
{ {
QString canvasId = QString::fromStdString(canvas["id"].as<std::string>()); QString canvasId = QWasmString::toQString(canvas["id"]);
QWasmIntegration::get()->addScreen(canvasId); QWasmIntegration::get()->addScreen(canvasId);
} }
static void removeCanvasElement(emscripten::val canvas) static void removeCanvasElement(emscripten::val canvas)
{ {
QString canvasId = QString::fromStdString(canvas["id"].as<std::string>()); QString canvasId = QWasmString::toQString(canvas["id"]);
QWasmIntegration::get()->removeScreen(canvasId); QWasmIntegration::get()->removeScreen(canvasId);
} }
static void resizeCanvasElement(emscripten::val canvas) static void resizeCanvasElement(emscripten::val canvas)
{ {
QString canvasId = QString::fromStdString(canvas["id"].as<std::string>()); QString canvasId = QWasmString::toQString(canvas["id"]);
QWasmIntegration::get()->resizeScreen(canvasId); QWasmIntegration::get()->resizeScreen(canvasId);
} }
@ -115,11 +116,11 @@ QWasmIntegration::QWasmIntegration()
int screenCount = qtCanvaseElements["length"].as<int>(); int screenCount = qtCanvaseElements["length"].as<int>();
for (int i = 0; i < screenCount; ++i) { for (int i = 0; i < screenCount; ++i) {
emscripten::val canvas = qtCanvaseElements[i].as<emscripten::val>(); emscripten::val canvas = qtCanvaseElements[i].as<emscripten::val>();
QString canvasId = QString::fromStdString(canvas["id"].as<std::string>()); QString canvasId = QWasmString::toQString(canvas["id"]);
addScreen(canvasId); addScreen(canvasId);
} }
} else if (!canvas.isUndefined()){ } else if (!canvas.isUndefined()){
QString canvasId = QString::fromStdString(canvas["id"].as<std::string>()); QString canvasId = QWasmString::toQString(canvas["id"]);
addScreen(canvasId); addScreen(canvasId);
} }

View File

@ -32,6 +32,8 @@
#include "qwasmeventtranslator.h" #include "qwasmeventtranslator.h"
#include "qwasmcompositor.h" #include "qwasmcompositor.h"
#include "qwasmintegration.h" #include "qwasmintegration.h"
#include "qwasmstring.h"
#include <emscripten/bind.h> #include <emscripten/bind.h>
#include <emscripten/val.h> #include <emscripten/val.h>
@ -186,7 +188,7 @@ void QWasmScreen::updateQScreenAndCanvasRenderSize()
QSizeF canvasSize = cssSize * devicePixelRatio(); QSizeF canvasSize = cssSize * devicePixelRatio();
val document = val::global("document"); val document = val::global("document");
val canvas = document.call<val>("getElementById", val(canvasId.constData())); val canvas = document.call<val>("getElementById", QWasmString::fromQString(m_canvasId));
canvas.set("width", canvasSize.width()); canvas.set("width", canvasSize.width());
canvas.set("height", canvasSize.height()); canvas.set("height", canvasSize.height());

View File

@ -28,6 +28,8 @@
****************************************************************************/ ****************************************************************************/
#include "qwasmservices.h" #include "qwasmservices.h"
#include "qwasmstring.h"
#include <QtCore/QUrl> #include <QtCore/QUrl>
#include <QtCore/QDebug> #include <QtCore/QDebug>
@ -37,8 +39,8 @@ QT_BEGIN_NAMESPACE
bool QWasmServices::openUrl(const QUrl &url) bool QWasmServices::openUrl(const QUrl &url)
{ {
QByteArray utf8Url = url.toString().toUtf8(); emscripten::val jsUrl = QWasmString::fromQString(url.toString());
emscripten::val::global("window").call<void>("open", emscripten::val(utf8Url.constData()), emscripten::val("_blank")); emscripten::val::global("window").call<void>("open", jsUrl, emscripten::val("_blank"));
return true; return true;
} }

View File

@ -0,0 +1,61 @@
/****************************************************************************
**
** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the plugins of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:GPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 or (at your option) 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.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-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qwasmstring.h"
QT_BEGIN_NAMESPACE
using namespace emscripten;
val QWasmString::fromQString(const QString &str)
{
static const val UTF16ToString(
val::global("Module")["UTF16ToString"]);
auto ptr = quintptr(str.utf16());
return UTF16ToString(val(ptr));
}
QString QWasmString::toQString(const val &v)
{
QString result;
if (!v.isString())
return result;
static const val stringToUTF16(
val::global("Module")["stringToUTF16"]);
static const val length("length");
result.resize(v[length].as<int>());
auto ptr = quintptr(result.utf16());
stringToUTF16(v, val(ptr));
return result;
}
QT_END_NAMESPACE

View File

@ -0,0 +1,45 @@
/****************************************************************************
**
** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the plugins of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:GPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 or (at your option) 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.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-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#pragma once
#include <qstring.h>
#include <emscripten/val.h>
QT_BEGIN_NAMESPACE
class QWasmString
{
public:
static emscripten::val fromQString(const QString &str);
static QString toQString(const emscripten::val &v);
};
QT_END_NAMESPACE

View File

@ -23,7 +23,8 @@ SOURCES = \
qwasmtheme.cpp \ qwasmtheme.cpp \
qwasmclipboard.cpp \ qwasmclipboard.cpp \
qwasmservices.cpp \ qwasmservices.cpp \
qwasmoffscreensurface.cpp qwasmoffscreensurface.cpp \
qwasmstring.cpp
HEADERS = \ HEADERS = \
qwasmintegration.h \ qwasmintegration.h \
@ -39,7 +40,8 @@ HEADERS = \
qwasmtheme.h \ qwasmtheme.h \
qwasmclipboard.h \ qwasmclipboard.h \
qwasmservices.h \ qwasmservices.h \
qwasmoffscreensurface.h qwasmoffscreensurface.h \
qwasmstring.h
wasmfonts.files = \ wasmfonts.files = \
../../../3rdparty/wasm/Vera.ttf \ ../../../3rdparty/wasm/Vera.ttf \

View File

@ -1025,7 +1025,7 @@ bool QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(XPThemeData &themeDa
imgCopy = cachedPixmap.toImage(); imgCopy = cachedPixmap.toImage();
if (themeData.rotate) { if (themeData.rotate) {
QMatrix rotMatrix; QTransform rotMatrix;
rotMatrix.rotate(themeData.rotate); rotMatrix.rotate(themeData.rotate);
imgCopy = imgCopy.transformed(rotMatrix); imgCopy = imgCopy.transformed(rotMatrix);
} }

View File

@ -55,7 +55,6 @@
#ifndef QT_NO_PRINTER #ifndef QT_NO_PRINTER
#include "QtCore/qmap.h" #include "QtCore/qmap.h"
#include "QtGui/qmatrix.h"
#include "QtCore/qstring.h" #include "QtCore/qstring.h"
#include "QtCore/qvector.h" #include "QtCore/qvector.h"
#include "QtGui/qpaintengine.h" #include "QtGui/qpaintengine.h"

View File

@ -264,7 +264,7 @@ void QPrintPreviewWidgetPrivate::_q_fit(bool doFitting)
} else { } else {
graphicsView->fitInView(target, Qt::KeepAspectRatio); graphicsView->fitInView(target, Qt::KeepAspectRatio);
if (zoomMode == QPrintPreviewWidget::FitInView) { if (zoomMode == QPrintPreviewWidget::FitInView) {
int step = qRound(graphicsView->matrix().mapRect(target).height()); const int step = qRound(graphicsView->transform().mapRect(target).height());
graphicsView->verticalScrollBar()->setSingleStep(step); graphicsView->verticalScrollBar()->setSingleStep(step);
graphicsView->verticalScrollBar()->setPageStep(step); graphicsView->verticalScrollBar()->setPageStep(step);
} }

View File

@ -249,16 +249,15 @@ void QSqlQueryModel_snippets()
} }
//! [21] //! [21]
QSqlTableModel model; QSqlQueryModel model;
model.setTable("employee"); model.setQuery("SELECT name, salary FROM employee");
model.select();
int salary = model.record(4).value("salary").toInt(); int salary = model.record(4).value("salary").toInt();
//! [21] //! [21]
Q_UNUSED(salary); Q_UNUSED(salary);
{ {
//! [22] //! [22]
int salary = model.data(model.index(4, 2)).toInt(); int salary = model.data(model.index(4, 1)).toInt();
//! [22] //! [22]
Q_UNUSED(salary); Q_UNUSED(salary);
} }
@ -308,7 +307,8 @@ void QSqlTableModel_snippets()
//! [25] //! [25]
QSqlTableModel model; QSqlTableModel model;
model.setTable("employee"); model.setTable("employee");
QString name = model.record(4).value("name").toString(); model.select();
int salary = model.record(4).value("salary").toInt();
//! [25] //! [25]
} }
} }

View File

@ -124,8 +124,8 @@ int QSqlQueryModelPrivate::columnInQuery(int modelColumn) const
\snippet sqldatabase/sqldatabase.cpp 21 \snippet sqldatabase/sqldatabase.cpp 21
The code snippet above extracts the \c salary field from record 4 in The code snippet above extracts the \c salary field from record 4 in
the result set of the query \c{SELECT * from employee}. Assuming the result set of the \c SELECT query. Since \c salary is the 2nd
that \c salary is column 2, we can rewrite the last line as follows: column (or column index 1), we can rewrite the last line as follows:
\snippet sqldatabase/sqldatabase.cpp 22 \snippet sqldatabase/sqldatabase.cpp 22

View File

@ -222,7 +222,7 @@ bool QSqlTableModelPrivate::exec(const QString &stmt, bool prepStatement,
QSqlTableModel can also be used to access a database QSqlTableModel can also be used to access a database
programmatically, without binding it to a view: programmatically, without binding it to a view:
\snippet sqldatabase/sqldatabase.cpp 21 \snippet sqldatabase/sqldatabase.cpp 25
The code snippet above extracts the \c salary field from record 4 in The code snippet above extracts the \c salary field from record 4 in
the result set of the query \c{SELECT * from employee}. the result set of the query \c{SELECT * from employee}.

View File

@ -380,10 +380,10 @@ void JavaStyle::drawControl(ControlElement control, const QStyleOption *option,
QRect rect = bar->rect; QRect rect = bar->rect;
if (bar->orientation == Qt::Vertical) { if (bar->orientation == Qt::Vertical) {
rect = QRect(rect.left(), rect.top(), rect.height(), rect.width()); rect = QRect(rect.left(), rect.top(), rect.height(), rect.width());
QMatrix m; QTransform m;
m.translate(rect.height()-1, 0); m.translate(rect.height()-1, 0);
m.rotate(90.0); m.rotate(90.0);
painter->setMatrix(m); painter->setTransform(m);
} }
painter->setPen(bar->palette.color(QPalette::Mid)); painter->setPen(bar->palette.color(QPalette::Mid));

View File

@ -2543,6 +2543,18 @@
See also \l{#height-prop}{height}. See also \l{#height-prop}{height}.
\row
\li \b -qt-background-role
\li \l{#paletterole}{PaletteRole}
\li The \c{background-color} for the subcontrol or widget based on the
chosen role.
\row
\li \b -qt-style-features
\li \c list
\li The list of CSS properties that you want to apply Qt-specific styles on.
\note The \c list can only include properties that are not pixmap-based.
\endtable \endtable
\target list of icons \target list of icons

View File

@ -231,7 +231,6 @@
#include <QtWidgets/qgraphicslayout.h> #include <QtWidgets/qgraphicslayout.h>
#include <QtWidgets/qgraphicsproxywidget.h> #include <QtWidgets/qgraphicsproxywidget.h>
#include <QtWidgets/qgraphicswidget.h> #include <QtWidgets/qgraphicswidget.h>
#include <QtGui/qmatrix.h>
#include <QtGui/qpaintengine.h> #include <QtGui/qpaintengine.h>
#include <QtGui/qpainter.h> #include <QtGui/qpainter.h>
#include <QtGui/qpixmapcache.h> #include <QtGui/qpixmapcache.h>

View File

@ -47,7 +47,6 @@
#include <QtGui/qbrush.h> #include <QtGui/qbrush.h>
#include <QtGui/qfont.h> #include <QtGui/qfont.h>
#include <QtGui/qtransform.h> #include <QtGui/qtransform.h>
#include <QtGui/qmatrix.h>
#include <QtGui/qpen.h> #include <QtGui/qpen.h>
QT_REQUIRE_CONFIG(graphicsview); QT_REQUIRE_CONFIG(graphicsview);

View File

@ -1795,7 +1795,13 @@ void QGraphicsView::setSceneRect(const QRectF &rect)
d->recalculateContentSize(); d->recalculateContentSize();
} }
#if QT_DEPRECATED_SINCE(5, 15)
/*! /*!
\obsolete
Use transform() instead.
Returns the current transformation matrix for the view. If no current Returns the current transformation matrix for the view. If no current
transformation is set, the identity matrix is returned. transformation is set, the identity matrix is returned.
@ -1808,6 +1814,10 @@ QMatrix QGraphicsView::matrix() const
} }
/*! /*!
\obsolete
Use setTransform() instead.
Sets the view's current transformation matrix to \a matrix. Sets the view's current transformation matrix to \a matrix.
If \a combine is true, then \a matrix is combined with the current matrix; If \a combine is true, then \a matrix is combined with the current matrix;
@ -1839,6 +1849,10 @@ void QGraphicsView::setMatrix(const QMatrix &matrix, bool combine)
} }
/*! /*!
\obsolete
Use resetTransform() instead.
Resets the view transformation matrix to the identity matrix. Resets the view transformation matrix to the identity matrix.
\sa resetTransform() \sa resetTransform()
@ -1848,6 +1862,8 @@ void QGraphicsView::resetMatrix()
resetTransform(); resetTransform();
} }
#endif // QT_DEPRECATED_SINCE(5, 15)
/*! /*!
Rotates the current view transformation \a angle degrees clockwise. Rotates the current view transformation \a angle degrees clockwise.

View File

@ -165,9 +165,11 @@ public:
void setSceneRect(const QRectF &rect); void setSceneRect(const QRectF &rect);
inline void setSceneRect(qreal x, qreal y, qreal w, qreal h); inline void setSceneRect(qreal x, qreal y, qreal w, qreal h);
QMatrix matrix() const; #if QT_DEPRECATED_SINCE(5, 15)
void setMatrix(const QMatrix &matrix, bool combine = false); QT_DEPRECATED_X("Use transform()") QMatrix matrix() const;
void resetMatrix(); QT_DEPRECATED_X("Use setTransform()") void setMatrix(const QMatrix &matrix, bool combine = false);
QT_DEPRECATED_X("Use resetTransform()") void resetMatrix();
#endif // QT_DEPRECATED_SINCE(5, 15)
QTransform transform() const; QTransform transform() const;
QTransform viewportTransform() const; QTransform viewportTransform() const;
bool isTransformed() const; bool isTransformed() const;

View File

@ -2124,7 +2124,8 @@ QWidget *QApplicationPrivate::focusNextPrevChild_helper(QWidget *toplevel, bool
&& !(!next && focusProxy && test->isAncestorOf(focusProxy)) && !(!next && focusProxy && test->isAncestorOf(focusProxy))
&& test->isVisibleTo(toplevel) && test->isEnabled() && test->isVisibleTo(toplevel) && test->isEnabled()
&& !(w->windowType() == Qt::SubWindow && !w->isAncestorOf(test)) && !(w->windowType() == Qt::SubWindow && !w->isAncestorOf(test))
&& (toplevel->windowType() != Qt::SubWindow || toplevel->isAncestorOf(test))) { && (toplevel->windowType() != Qt::SubWindow || toplevel->isAncestorOf(test))
&& f != focusProxy) {
w = test; w = test;
if (seenWindow) if (seenWindow)
focusWidgetAfterWindow = true; focusWidgetAfterWindow = true;

View File

@ -1556,7 +1556,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
qint64 maximum = qint64(pb->maximum); qint64 maximum = qint64(pb->maximum);
qint64 progress = qint64(pb->progress); qint64 progress = qint64(pb->progress);
QMatrix m; QTransform m;
if (vertical) { if (vertical) {
rect = QRect(rect.y(), rect.x(), rect.height(), rect.width()); // flip width and height rect = QRect(rect.y(), rect.x(), rect.height(), rect.width()); // flip width and height

View File

@ -1692,7 +1692,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai
const bool vertical = pb->orientation == Qt::Vertical; const bool vertical = pb->orientation == Qt::Vertical;
const bool inverted = pb->invertedAppearance; const bool inverted = pb->invertedAppearance;
QMatrix m; QTransform m;
if (vertical) { if (vertical) {
rect = QRect(rect.y(), rect.x(), rect.height(), rect.width()); // flip width and height rect = QRect(rect.y(), rect.x(), rect.height(), rect.width()); // flip width and height
m.rotate(90); m.rotate(90);

View File

@ -414,8 +414,13 @@ void QAbstractButtonPrivate::emitClicked()
emit q->clicked(checked); emit q->clicked(checked);
#if QT_CONFIG(buttongroup) #if QT_CONFIG(buttongroup)
if (guard && group) { if (guard && group) {
#if QT_DEPRECATED_SINCE(5, 15)
QT_WARNING_PUSH
QT_WARNING_DISABLE_DEPRECATED
emit group->buttonClicked(group->id(q)); emit group->buttonClicked(group->id(q));
if (guard && group) if (guard && group)
QT_WARNING_POP
#endif
emit group->buttonClicked(q); emit group->buttonClicked(q);
} }
#endif #endif
@ -428,8 +433,13 @@ void QAbstractButtonPrivate::emitPressed()
emit q->pressed(); emit q->pressed();
#if QT_CONFIG(buttongroup) #if QT_CONFIG(buttongroup)
if (guard && group) { if (guard && group) {
#if QT_DEPRECATED_SINCE(5, 15)
QT_WARNING_PUSH
QT_WARNING_DISABLE_DEPRECATED
emit group->buttonPressed(group->id(q)); emit group->buttonPressed(group->id(q));
if (guard && group) if (guard && group)
QT_WARNING_POP
#endif
emit group->buttonPressed(q); emit group->buttonPressed(q);
} }
#endif #endif
@ -442,8 +452,13 @@ void QAbstractButtonPrivate::emitReleased()
emit q->released(); emit q->released();
#if QT_CONFIG(buttongroup) #if QT_CONFIG(buttongroup)
if (guard && group) { if (guard && group) {
#if QT_DEPRECATED_SINCE(5, 15)
QT_WARNING_PUSH
QT_WARNING_DISABLE_DEPRECATED
emit group->buttonReleased(group->id(q)); emit group->buttonReleased(group->id(q));
if (guard && group) if (guard && group)
QT_WARNING_POP
#endif
emit group->buttonReleased(q); emit group->buttonReleased(q);
} }
#endif #endif
@ -456,8 +471,13 @@ void QAbstractButtonPrivate::emitToggled(bool checked)
emit q->toggled(checked); emit q->toggled(checked);
#if QT_CONFIG(buttongroup) #if QT_CONFIG(buttongroup)
if (guard && group) { if (guard && group) {
#if QT_DEPRECATED_SINCE(5, 15)
QT_WARNING_PUSH
QT_WARNING_DISABLE_DEPRECATED
emit group->buttonToggled(group->id(q), checked); emit group->buttonToggled(group->id(q), checked);
if (guard && group) if (guard && group)
QT_WARNING_POP
#endif
emit group->buttonToggled(q, checked); emit group->buttonToggled(q, checked);
} }
#endif #endif

View File

@ -164,6 +164,7 @@ void QButtonGroup::setExclusive(bool exclusive)
/*! /*!
\fn void QButtonGroup::buttonClicked(int id) \fn void QButtonGroup::buttonClicked(int id)
\obsolete
This signal is emitted when a button with the given \a id is This signal is emitted when a button with the given \a id is
clicked. clicked.
@ -183,6 +184,7 @@ void QButtonGroup::setExclusive(bool exclusive)
/*! /*!
\fn void QButtonGroup::buttonPressed(int id) \fn void QButtonGroup::buttonPressed(int id)
\since 4.2 \since 4.2
\obsolete
This signal is emitted when a button with the given \a id is This signal is emitted when a button with the given \a id is
pressed down. pressed down.
@ -202,6 +204,7 @@ void QButtonGroup::setExclusive(bool exclusive)
/*! /*!
\fn void QButtonGroup::buttonReleased(int id) \fn void QButtonGroup::buttonReleased(int id)
\since 4.2 \since 4.2
\obsolete
This signal is emitted when a button with the given \a id is This signal is emitted when a button with the given \a id is
released. released.
@ -222,6 +225,7 @@ void QButtonGroup::setExclusive(bool exclusive)
/*! /*!
\fn void QButtonGroup::buttonToggled(int id, bool checked) \fn void QButtonGroup::buttonToggled(int id, bool checked)
\since 5.2 \since 5.2
\obsolete
This signal is emitted when a button with the given \a id is toggled. This signal is emitted when a button with the given \a id is toggled.
\a checked is true if the button is checked, or false if the button is unchecked. \a checked is true if the button is checked, or false if the button is unchecked.

View File

@ -78,13 +78,19 @@ public:
Q_SIGNALS: Q_SIGNALS:
void buttonClicked(QAbstractButton *); void buttonClicked(QAbstractButton *);
void buttonClicked(int);
void buttonPressed(QAbstractButton *); void buttonPressed(QAbstractButton *);
void buttonPressed(int);
void buttonReleased(QAbstractButton *); void buttonReleased(QAbstractButton *);
void buttonReleased(int);
void buttonToggled(QAbstractButton *, bool); void buttonToggled(QAbstractButton *, bool);
#if QT_DEPRECATED_SINCE(5, 15)
QT_DEPRECATED_VERSION_X_5_15("Use QButtonGroup::buttonClicked(QAbstractButton *) instead")
void buttonClicked(int);
QT_DEPRECATED_VERSION_X_5_15("Use QButtonGroup::buttonPressed(QAbstractButton *) instead")
void buttonPressed(int);
QT_DEPRECATED_VERSION_X_5_15("Use QButtonGroup::buttonReleased(QAbstractButton *) instead")
void buttonReleased(int);
QT_DEPRECATED_VERSION_X_5_15("Use QButtonGroup::buttonToggled(QAbstractButton *, bool) instead")
void buttonToggled(int, bool); void buttonToggled(int, bool);
#endif
private: private:
Q_DISABLE_COPY(QButtonGroup) Q_DISABLE_COPY(QButtonGroup)

View File

@ -293,8 +293,7 @@ void QComboBoxPrivate::_q_modelReset()
lineEdit->setText(QString()); lineEdit->setText(QString());
updateLineEditGeometry(); updateLineEditGeometry();
} }
if (currentIndex.row() != indexBeforeChange) trySetValidIndex();
_q_emitCurrentIndexChanged(currentIndex);
modelChanged(); modelChanged();
q->update(); q->update();
} }
@ -304,6 +303,25 @@ void QComboBoxPrivate::_q_modelDestroyed()
model = QAbstractItemModelPrivate::staticEmptyModel(); model = QAbstractItemModelPrivate::staticEmptyModel();
} }
void QComboBoxPrivate::trySetValidIndex()
{
Q_Q(QComboBox);
bool currentReset = false;
const int rowCount = q->count();
for (int pos = 0; pos < rowCount; ++pos) {
const QModelIndex idx(model->index(pos, modelColumn, root));
if (idx.flags() & Qt::ItemIsEnabled) {
setCurrentIndex(idx);
currentReset = true;
break;
}
}
if (!currentReset)
setCurrentIndex(QModelIndex());
}
QRect QComboBoxPrivate::popupGeometry(int screen) const QRect QComboBoxPrivate::popupGeometry(int screen) const
{ {
return QStylePrivate::useFullScreenForPopup() return QStylePrivate::useFullScreenForPopup()
@ -2202,20 +2220,7 @@ void QComboBox::setModel(QAbstractItemModel *model)
setRootModelIndex(QModelIndex()); setRootModelIndex(QModelIndex());
bool currentReset = false; d->trySetValidIndex();
const int rowCount = count();
for (int pos=0; pos < rowCount; pos++) {
if (d->model->index(pos, d->modelColumn, d->root).flags() & Qt::ItemIsEnabled) {
setCurrentIndex(pos);
currentReset = true;
break;
}
}
if (!currentReset)
setCurrentIndex(-1);
d->modelChanged(); d->modelChanged();
} }

View File

@ -371,6 +371,7 @@ public:
void _q_rowsRemoved(const QModelIndex &parent, int start, int end); void _q_rowsRemoved(const QModelIndex &parent, int start, int end);
void updateArrow(QStyle::StateFlag state); void updateArrow(QStyle::StateFlag state);
bool updateHoverControl(const QPoint &pos); bool updateHoverControl(const QPoint &pos);
void trySetValidIndex();
QRect popupGeometry(int screen = -1) const; QRect popupGeometry(int screen = -1) const;
QStyle::SubControl newHoverControl(const QPoint &pos); QStyle::SubControl newHoverControl(const QPoint &pos);
int computeWidthHint() const; int computeWidthHint() const;

View File

@ -490,14 +490,14 @@ void QScrollArea::ensureWidgetVisible(QWidget *childWidget, int xmargin, int yma
if (focusRect.width() > visibleRect.width()) if (focusRect.width() > visibleRect.width())
d->hbar->setValue(focusRect.center().x() - d->viewport->width() / 2); d->hbar->setValue(focusRect.center().x() - d->viewport->width() / 2);
else if (focusRect.right() > visibleRect.right()) else if (focusRect.right() > visibleRect.right())
d->hbar->setValue(focusRect.right() - d->viewport->width()); d->hbar->setValue(focusRect.right() - d->viewport->width() + 1);
else if (focusRect.left() < visibleRect.left()) else if (focusRect.left() < visibleRect.left())
d->hbar->setValue(focusRect.left()); d->hbar->setValue(focusRect.left());
if (focusRect.height() > visibleRect.height()) if (focusRect.height() > visibleRect.height())
d->vbar->setValue(focusRect.center().y() - d->viewport->height() / 2); d->vbar->setValue(focusRect.center().y() - d->viewport->height() / 2);
else if (focusRect.bottom() > visibleRect.bottom()) else if (focusRect.bottom() > visibleRect.bottom())
d->vbar->setValue(focusRect.bottom() - d->viewport->height()); d->vbar->setValue(focusRect.bottom() - d->viewport->height() + 1);
else if (focusRect.top() < visibleRect.top()) else if (focusRect.top() < visibleRect.top())
d->vbar->setValue(focusRect.top()); d->vbar->setValue(focusRect.top());
} }

View File

@ -1,6 +1,6 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2016 The Qt Company Ltd. ** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/ ** Contact: https://www.qt.io/licensing/
** **
** This file is part of the QtWidgets module of the Qt Toolkit. ** This file is part of the QtWidgets module of the Qt Toolkit.
@ -1168,11 +1168,11 @@ QVariant QSpinBoxPrivate::validateAndInterpret(QString &input, int &pos,
} else { } else {
num = locale.toInt(copy, &ok); num = locale.toInt(copy, &ok);
if (!ok && (max >= 1000 || min <= -1000)) { if (!ok && (max >= 1000 || min <= -1000)) {
const QChar sep = locale.groupSeparator(); const QString sep(locale.groupSeparator());
const QChar doubleSep[2] = {sep, sep}; const QString doubleSep = sep + sep;
if (copy.contains(sep) && !copy.contains(QString(doubleSep, 2))) { if (copy.contains(sep) && !copy.contains(doubleSep)) {
QString copy2 = copy; QString copy2 = copy;
copy2.remove(locale.groupSeparator()); copy2.remove(sep);
num = locale.toInt(copy2, &ok); num = locale.toInt(copy2, &ok);
} }
} }
@ -1314,6 +1314,10 @@ QVariant QDoubleSpinBoxPrivate::validateAndInterpret(QString &input, int &pos,
const bool plus = max >= 0; const bool plus = max >= 0;
const bool minus = min <= 0; const bool minus = min <= 0;
const QString group(locale.groupSeparator());
const uint groupUcs = (group.size() > 1 && group.at(0).isHighSurrogate()
? QChar::surrogateToUcs4(group.at(0), group.at(1))
: group.at(0).unicode());
switch (len) { switch (len) {
case 0: case 0:
state = max != min ? QValidator::Intermediate : QValidator::Invalid; state = max != min ? QValidator::Intermediate : QValidator::Invalid;
@ -1360,14 +1364,15 @@ QVariant QDoubleSpinBoxPrivate::validateAndInterpret(QString &input, int &pos,
} }
} }
} else { } else {
const QChar last = copy.at(len - 1); const QChar last = copy.back();
const QChar secondLast = copy.at(len - 2); const bool groupEnd = copy.endsWith(group);
if ((last == locale.groupSeparator() || last.isSpace()) const QStringView head(copy.constData(), groupEnd ? len - group.size() : len - 1);
&& (secondLast == locale.groupSeparator() || secondLast.isSpace())) { const QChar secondLast = head.back();
if ((groupEnd || last.isSpace()) && (head.endsWith(group) || secondLast.isSpace())) {
state = QValidator::Invalid; state = QValidator::Invalid;
QSBDEBUG() << __FILE__ << __LINE__<< "state is set to Invalid"; QSBDEBUG() << __FILE__ << __LINE__<< "state is set to Invalid";
goto end; goto end;
} else if (last.isSpace() && (!locale.groupSeparator().isSpace() || secondLast.isSpace())) { } else if (last.isSpace() && (!QChar::isSpace(groupUcs) || secondLast.isSpace())) {
state = QValidator::Invalid; state = QValidator::Invalid;
QSBDEBUG() << __FILE__ << __LINE__<< "state is set to Invalid"; QSBDEBUG() << __FILE__ << __LINE__<< "state is set to Invalid";
goto end; goto end;
@ -1381,26 +1386,31 @@ QVariant QDoubleSpinBoxPrivate::validateAndInterpret(QString &input, int &pos,
QSBDEBUG() << __FILE__ << __LINE__ << locale << copy << num << ok; QSBDEBUG() << __FILE__ << __LINE__ << locale << copy << num << ok;
if (!ok) { if (!ok) {
if (locale.groupSeparator().isPrint()) { if (QChar::isPrint(groupUcs)) {
if (max < 1000 && min > -1000 && copy.contains(locale.groupSeparator())) { if (max < 1000 && min > -1000 && copy.contains(group)) {
state = QValidator::Invalid; state = QValidator::Invalid;
QSBDEBUG() << __FILE__ << __LINE__<< "state is set to Invalid"; QSBDEBUG() << __FILE__ << __LINE__<< "state is set to Invalid";
goto end; goto end;
} }
const int len = copy.size(); const int len = copy.size();
for (int i=0; i<len- 1; ++i) { for (int i = 0; i < len - 1;) {
if (copy.at(i) == locale.groupSeparator() && copy.at(i + 1) == locale.groupSeparator()) { if (QStringView(copy).mid(i).startsWith(group)) {
if (QStringView(copy).mid(i + group.size()).startsWith(group)) {
QSBDEBUG() << __FILE__ << __LINE__<< "state is set to Invalid"; QSBDEBUG() << __FILE__ << __LINE__<< "state is set to Invalid";
state = QValidator::Invalid; state = QValidator::Invalid;
goto end; goto end;
} }
i += group.size();
} else {
i++;
}
} }
QString copy2 = copy; QString copy2 = copy;
copy2.remove(locale.groupSeparator()); copy2.remove(group);
num = locale.toDouble(copy2, &ok); num = locale.toDouble(copy2, &ok);
QSBDEBUG() << locale.groupSeparator() << num << copy2 << ok; QSBDEBUG() << group << num << copy2 << ok;
if (!ok) { if (!ok) {
state = QValidator::Invalid; state = QValidator::Invalid;

View File

@ -992,12 +992,12 @@ void QWidgetTextControl::selectAll()
void QWidgetTextControl::processEvent(QEvent *e, const QPointF &coordinateOffset, QWidget *contextWidget) void QWidgetTextControl::processEvent(QEvent *e, const QPointF &coordinateOffset, QWidget *contextWidget)
{ {
QMatrix m; QTransform t;
m.translate(coordinateOffset.x(), coordinateOffset.y()); t.translate(coordinateOffset.x(), coordinateOffset.y());
processEvent(e, m, contextWidget); processEvent(e, t, contextWidget);
} }
void QWidgetTextControl::processEvent(QEvent *e, const QMatrix &matrix, QWidget *contextWidget) void QWidgetTextControl::processEvent(QEvent *e, const QTransform &transform, QWidget *contextWidget)
{ {
Q_D(QWidgetTextControl); Q_D(QWidgetTextControl);
if (d->interactionFlags == Qt::NoTextInteraction) { if (d->interactionFlags == Qt::NoTextInteraction) {
@ -1038,22 +1038,22 @@ void QWidgetTextControl::processEvent(QEvent *e, const QMatrix &matrix, QWidget
break; break;
case QEvent::MouseButtonPress: { case QEvent::MouseButtonPress: {
QMouseEvent *ev = static_cast<QMouseEvent *>(e); QMouseEvent *ev = static_cast<QMouseEvent *>(e);
d->mousePressEvent(ev, ev->button(), matrix.map(ev->pos()), ev->modifiers(), d->mousePressEvent(ev, ev->button(), transform.map(ev->pos()), ev->modifiers(),
ev->buttons(), ev->globalPos()); ev->buttons(), ev->globalPos());
break; } break; }
case QEvent::MouseMove: { case QEvent::MouseMove: {
QMouseEvent *ev = static_cast<QMouseEvent *>(e); QMouseEvent *ev = static_cast<QMouseEvent *>(e);
d->mouseMoveEvent(ev, ev->button(), matrix.map(ev->pos()), ev->modifiers(), d->mouseMoveEvent(ev, ev->button(), transform.map(ev->pos()), ev->modifiers(),
ev->buttons(), ev->globalPos()); ev->buttons(), ev->globalPos());
break; } break; }
case QEvent::MouseButtonRelease: { case QEvent::MouseButtonRelease: {
QMouseEvent *ev = static_cast<QMouseEvent *>(e); QMouseEvent *ev = static_cast<QMouseEvent *>(e);
d->mouseReleaseEvent(ev, ev->button(), matrix.map(ev->pos()), ev->modifiers(), d->mouseReleaseEvent(ev, ev->button(), transform.map(ev->pos()), ev->modifiers(),
ev->buttons(), ev->globalPos()); ev->buttons(), ev->globalPos());
break; } break; }
case QEvent::MouseButtonDblClick: { case QEvent::MouseButtonDblClick: {
QMouseEvent *ev = static_cast<QMouseEvent *>(e); QMouseEvent *ev = static_cast<QMouseEvent *>(e);
d->mouseDoubleClickEvent(ev, ev->button(), matrix.map(ev->pos()), ev->modifiers(), d->mouseDoubleClickEvent(ev, ev->button(), transform.map(ev->pos()), ev->modifiers(),
ev->buttons(), ev->globalPos()); ev->buttons(), ev->globalPos());
break; } break; }
case QEvent::InputMethod: case QEvent::InputMethod:
@ -1062,7 +1062,7 @@ void QWidgetTextControl::processEvent(QEvent *e, const QMatrix &matrix, QWidget
#ifndef QT_NO_CONTEXTMENU #ifndef QT_NO_CONTEXTMENU
case QEvent::ContextMenu: { case QEvent::ContextMenu: {
QContextMenuEvent *ev = static_cast<QContextMenuEvent *>(e); QContextMenuEvent *ev = static_cast<QContextMenuEvent *>(e);
d->contextMenuEvent(ev->globalPos(), matrix.map(ev->pos()), contextWidget); d->contextMenuEvent(ev->globalPos(), transform.map(ev->pos()), contextWidget);
break; } break; }
#endif // QT_NO_CONTEXTMENU #endif // QT_NO_CONTEXTMENU
case QEvent::FocusIn: case QEvent::FocusIn:
@ -1077,7 +1077,7 @@ void QWidgetTextControl::processEvent(QEvent *e, const QMatrix &matrix, QWidget
#ifndef QT_NO_TOOLTIP #ifndef QT_NO_TOOLTIP
case QEvent::ToolTip: { case QEvent::ToolTip: {
QHelpEvent *ev = static_cast<QHelpEvent *>(e); QHelpEvent *ev = static_cast<QHelpEvent *>(e);
d->showToolTip(ev->globalPos(), matrix.map(ev->pos()), contextWidget); d->showToolTip(ev->globalPos(), transform.map(ev->pos()), contextWidget);
break; break;
} }
#endif // QT_NO_TOOLTIP #endif // QT_NO_TOOLTIP
@ -1094,13 +1094,13 @@ void QWidgetTextControl::processEvent(QEvent *e, const QMatrix &matrix, QWidget
break; break;
case QEvent::DragMove: { case QEvent::DragMove: {
QDragMoveEvent *ev = static_cast<QDragMoveEvent *>(e); QDragMoveEvent *ev = static_cast<QDragMoveEvent *>(e);
if (d->dragMoveEvent(e, ev->mimeData(), matrix.map(ev->pos()))) if (d->dragMoveEvent(e, ev->mimeData(), transform.map(ev->pos())))
ev->acceptProposedAction(); ev->acceptProposedAction();
break; break;
} }
case QEvent::Drop: { case QEvent::Drop: {
QDropEvent *ev = static_cast<QDropEvent *>(e); QDropEvent *ev = static_cast<QDropEvent *>(e);
if (d->dropEvent(ev->mimeData(), matrix.map(ev->pos()), ev->dropAction(), ev->source())) if (d->dropEvent(ev->mimeData(), transform.map(ev->pos()), ev->dropAction(), ev->source()))
ev->acceptProposedAction(); ev->acceptProposedAction();
break; break;
} }
@ -1109,32 +1109,32 @@ void QWidgetTextControl::processEvent(QEvent *e, const QMatrix &matrix, QWidget
#if QT_CONFIG(graphicsview) #if QT_CONFIG(graphicsview)
case QEvent::GraphicsSceneMousePress: { case QEvent::GraphicsSceneMousePress: {
QGraphicsSceneMouseEvent *ev = static_cast<QGraphicsSceneMouseEvent *>(e); QGraphicsSceneMouseEvent *ev = static_cast<QGraphicsSceneMouseEvent *>(e);
d->mousePressEvent(ev, ev->button(), matrix.map(ev->pos()), ev->modifiers(), ev->buttons(), d->mousePressEvent(ev, ev->button(), transform.map(ev->pos()), ev->modifiers(), ev->buttons(),
ev->screenPos()); ev->screenPos());
break; } break; }
case QEvent::GraphicsSceneMouseMove: { case QEvent::GraphicsSceneMouseMove: {
QGraphicsSceneMouseEvent *ev = static_cast<QGraphicsSceneMouseEvent *>(e); QGraphicsSceneMouseEvent *ev = static_cast<QGraphicsSceneMouseEvent *>(e);
d->mouseMoveEvent(ev, ev->button(), matrix.map(ev->pos()), ev->modifiers(), ev->buttons(), d->mouseMoveEvent(ev, ev->button(), transform.map(ev->pos()), ev->modifiers(), ev->buttons(),
ev->screenPos()); ev->screenPos());
break; } break; }
case QEvent::GraphicsSceneMouseRelease: { case QEvent::GraphicsSceneMouseRelease: {
QGraphicsSceneMouseEvent *ev = static_cast<QGraphicsSceneMouseEvent *>(e); QGraphicsSceneMouseEvent *ev = static_cast<QGraphicsSceneMouseEvent *>(e);
d->mouseReleaseEvent(ev, ev->button(), matrix.map(ev->pos()), ev->modifiers(), ev->buttons(), d->mouseReleaseEvent(ev, ev->button(), transform.map(ev->pos()), ev->modifiers(), ev->buttons(),
ev->screenPos()); ev->screenPos());
break; } break; }
case QEvent::GraphicsSceneMouseDoubleClick: { case QEvent::GraphicsSceneMouseDoubleClick: {
QGraphicsSceneMouseEvent *ev = static_cast<QGraphicsSceneMouseEvent *>(e); QGraphicsSceneMouseEvent *ev = static_cast<QGraphicsSceneMouseEvent *>(e);
d->mouseDoubleClickEvent(ev, ev->button(), matrix.map(ev->pos()), ev->modifiers(), ev->buttons(), d->mouseDoubleClickEvent(ev, ev->button(), transform.map(ev->pos()), ev->modifiers(), ev->buttons(),
ev->screenPos()); ev->screenPos());
break; } break; }
case QEvent::GraphicsSceneContextMenu: { case QEvent::GraphicsSceneContextMenu: {
QGraphicsSceneContextMenuEvent *ev = static_cast<QGraphicsSceneContextMenuEvent *>(e); QGraphicsSceneContextMenuEvent *ev = static_cast<QGraphicsSceneContextMenuEvent *>(e);
d->contextMenuEvent(ev->screenPos(), matrix.map(ev->pos()), contextWidget); d->contextMenuEvent(ev->screenPos(), transform.map(ev->pos()), contextWidget);
break; } break; }
case QEvent::GraphicsSceneHoverMove: { case QEvent::GraphicsSceneHoverMove: {
QGraphicsSceneHoverEvent *ev = static_cast<QGraphicsSceneHoverEvent *>(e); QGraphicsSceneHoverEvent *ev = static_cast<QGraphicsSceneHoverEvent *>(e);
d->mouseMoveEvent(ev, Qt::NoButton, matrix.map(ev->pos()), ev->modifiers(),Qt::NoButton, d->mouseMoveEvent(ev, Qt::NoButton, transform.map(ev->pos()), ev->modifiers(),Qt::NoButton,
ev->screenPos()); ev->screenPos());
break; } break; }
@ -1148,12 +1148,12 @@ void QWidgetTextControl::processEvent(QEvent *e, const QMatrix &matrix, QWidget
break; break;
case QEvent::GraphicsSceneDragMove: { case QEvent::GraphicsSceneDragMove: {
QGraphicsSceneDragDropEvent *ev = static_cast<QGraphicsSceneDragDropEvent *>(e); QGraphicsSceneDragDropEvent *ev = static_cast<QGraphicsSceneDragDropEvent *>(e);
if (d->dragMoveEvent(e, ev->mimeData(), matrix.map(ev->pos()))) if (d->dragMoveEvent(e, ev->mimeData(), transform.map(ev->pos())))
ev->acceptProposedAction(); ev->acceptProposedAction();
break; } break; }
case QEvent::GraphicsSceneDrop: { case QEvent::GraphicsSceneDrop: {
QGraphicsSceneDragDropEvent *ev = static_cast<QGraphicsSceneDragDropEvent *>(e); QGraphicsSceneDragDropEvent *ev = static_cast<QGraphicsSceneDragDropEvent *>(e);
if (d->dropEvent(ev->mimeData(), matrix.map(ev->pos()), ev->dropAction(), ev->source())) if (d->dropEvent(ev->mimeData(), transform.map(ev->pos()), ev->dropAction(), ev->source()))
ev->accept(); ev->accept();
break; } break; }
#endif // QT_CONFIG(graphicsview) #endif // QT_CONFIG(graphicsview)

View File

@ -252,7 +252,7 @@ public:
QPalette palette() const; QPalette palette() const;
void setPalette(const QPalette &pal); void setPalette(const QPalette &pal);
virtual void processEvent(QEvent *e, const QMatrix &matrix, QWidget *contextWidget = nullptr); virtual void processEvent(QEvent *e, const QTransform &transform, QWidget *contextWidget = nullptr);
void processEvent(QEvent *e, const QPointF &coordinateOffset = QPointF(), QWidget *contextWidget = nullptr); void processEvent(QEvent *e, const QPointF &coordinateOffset = QPointF(), QWidget *contextWidget = nullptr);
// control methods // control methods

View File

@ -1,2 +1,2 @@
[deleteChildrenWithRunningGroup] [deleteChildrenWithRunningGroup]
osx-10.13 macos

View File

@ -1,5 +1,6 @@
[pauseAndPropertyAnimations] [pauseAndPropertyAnimations]
osx macos
[multipleSequentialGroups] [multipleSequentialGroups]
osx macos
[noTimerUpdates]
macos

View File

@ -1,6 +1,6 @@
[finishWithUncontrolledAnimation] [finishWithUncontrolledAnimation]
windows-10 msvc-2015 windows-10 msvc-2015
osx-10.13 macos
[groupWithZeroDurationAnimations] [groupWithZeroDurationAnimations]
osx-10.13 macos

View File

@ -1,3 +1,3 @@
[elapsed] [elapsed]
osx-10.13 macos
windows-10 windows-10

View File

@ -3298,7 +3298,10 @@ void tst_QDataStream::streamRealDataTypes()
QCOMPARE(col, color); QCOMPARE(col, color);
stream >> rGrad; stream >> rGrad;
QCOMPARE(rGrad.style(), radialBrush.style()); QCOMPARE(rGrad.style(), radialBrush.style());
QT_WARNING_PUSH
QT_WARNING_DISABLE_DEPRECATED
QCOMPARE(rGrad.matrix(), radialBrush.matrix()); QCOMPARE(rGrad.matrix(), radialBrush.matrix());
QT_WARNING_POP
QCOMPARE(rGrad.gradient()->type(), radialBrush.gradient()->type()); QCOMPARE(rGrad.gradient()->type(), radialBrush.gradient()->type());
QCOMPARE(rGrad.gradient()->stops(), radialBrush.gradient()->stops()); QCOMPARE(rGrad.gradient()->stops(), radialBrush.gradient()->stops());
QCOMPARE(rGrad.gradient()->spread(), radialBrush.gradient()->spread()); QCOMPARE(rGrad.gradient()->spread(), radialBrush.gradient()->spread());
@ -3307,7 +3310,10 @@ void tst_QDataStream::streamRealDataTypes()
QCOMPARE(((QRadialGradient *)rGrad.gradient())->radius(), ((QRadialGradient *)radialBrush.gradient())->radius()); QCOMPARE(((QRadialGradient *)rGrad.gradient())->radius(), ((QRadialGradient *)radialBrush.gradient())->radius());
stream >> cGrad; stream >> cGrad;
QCOMPARE(cGrad.style(), conicalBrush.style()); QCOMPARE(cGrad.style(), conicalBrush.style());
QT_WARNING_PUSH
QT_WARNING_DISABLE_DEPRECATED
QCOMPARE(cGrad.matrix(), conicalBrush.matrix()); QCOMPARE(cGrad.matrix(), conicalBrush.matrix());
QT_WARNING_POP
QCOMPARE(cGrad.gradient()->type(), conicalBrush.gradient()->type()); QCOMPARE(cGrad.gradient()->type(), conicalBrush.gradient()->type());
QCOMPARE(cGrad.gradient()->stops(), conicalBrush.gradient()->stops()); QCOMPARE(cGrad.gradient()->stops(), conicalBrush.gradient()->stops());
QCOMPARE(cGrad.gradient()->spread(), conicalBrush.gradient()->spread()); QCOMPARE(cGrad.gradient()->spread(), conicalBrush.gradient()->spread());

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -2,9 +2,7 @@
osx osx
[tryAcquireWithTimeout:0.2s] [tryAcquireWithTimeout:0.2s]
windows windows
osx-10.12 macos
osx-10.13
[tryAcquireWithTimeout:2s] [tryAcquireWithTimeout:2s]
windows windows
osx-10.12 macos
osx-10.13

View File

@ -2,6 +2,5 @@
windows-10 msvc-2015 windows-10 msvc-2015
osx osx
[frameRate] [frameRate]
osx-10.12 macos
osx-10.13

View File

@ -32,7 +32,7 @@
#include <qimage.h> #include <qimage.h>
#include <qimagereader.h> #include <qimagereader.h>
#include <qlist.h> #include <qlist.h>
#include <qmatrix.h> #include <qtransform.h>
#include <qrandom.h> #include <qrandom.h>
#include <stdio.h> #include <stdio.h>
@ -1204,7 +1204,7 @@ void tst_QImage::rotate()
// original.save("rotated90_original.png", "png"); // original.save("rotated90_original.png", "png");
// Initialize the matrix manually (do not use rotate) to avoid rounding errors // Initialize the matrix manually (do not use rotate) to avoid rounding errors
QMatrix matRotate90; QTransform matRotate90;
matRotate90.rotate(degrees); matRotate90.rotate(degrees);
QImage dest = original; QImage dest = original;
// And rotate it 4 times, then the image should be identical to the original // And rotate it 4 times, then the image should be identical to the original
@ -1218,7 +1218,7 @@ void tst_QImage::rotate()
// dest.save("rotated90_result.png","png"); // dest.save("rotated90_result.png","png");
QCOMPARE(original, dest); QCOMPARE(original, dest);
// Test with QMatrix::rotate 90 also, since we trust that now // Test with QTransform::rotate 90 also, since we trust that now
matRotate90.rotate(degrees); matRotate90.rotate(degrees);
dest = original; dest = original;
// And rotate it 4 times, then the image should be identical to the original // And rotate it 4 times, then the image should be identical to the original

View File

@ -32,7 +32,6 @@
#include <qbitmap.h> #include <qbitmap.h>
#include <qimage.h> #include <qimage.h>
#include <qimagereader.h> #include <qimagereader.h>
#include <qmatrix.h>
#ifndef QT_NO_WIDGETS #ifndef QT_NO_WIDGETS
#include <qdesktopwidget.h> #include <qdesktopwidget.h>
#include <qsplashscreen.h> #include <qsplashscreen.h>

View File

@ -197,9 +197,14 @@ template<> struct TestValueFactory<QMetaType::QTextLength> {
template<> struct TestValueFactory<QMetaType::QTextFormat> { template<> struct TestValueFactory<QMetaType::QTextFormat> {
static QTextFormat *create() { return new QTextFormat(QTextFormat::FrameFormat); } static QTextFormat *create() { return new QTextFormat(QTextFormat::FrameFormat); }
}; };
#if QT_DEPRECATED_SINCE(5, 15)
QT_WARNING_PUSH
QT_WARNING_DISABLE_DEPRECATED
template<> struct TestValueFactory<QMetaType::QMatrix> { template<> struct TestValueFactory<QMetaType::QMatrix> {
static QMatrix *create() { return new QMatrix(10, 20, 30, 40, 50, 60); } static QMatrix *create() { return new QMatrix(10, 20, 30, 40, 50, 60); }
}; };
QT_WARNING_POP
#endif
template<> struct TestValueFactory<QMetaType::QTransform> { template<> struct TestValueFactory<QMetaType::QTransform> {
static QTransform *create() { return new QTransform(10, 20, 30, 40, 50, 60); } static QTransform *create() { return new QTransform(10, 20, 30, 40, 50, 60); }
}; };

View File

@ -402,6 +402,9 @@ void tst_QGuiVariant::toString()
QCOMPARE( str, result ); QCOMPARE( str, result );
} }
#if QT_DEPRECATED_SINCE(5, 15)
QT_WARNING_PUSH
QT_WARNING_DISABLE_DEPRECATED
void tst_QGuiVariant::matrix() void tst_QGuiVariant::matrix()
{ {
QVariant variant; QVariant variant;
@ -414,6 +417,8 @@ void tst_QGuiVariant::matrix()
QVERIFY(mmatrix); QVERIFY(mmatrix);
QMetaType::destroy(QVariant::Matrix, mmatrix); QMetaType::destroy(QVariant::Matrix, mmatrix);
} }
QT_WARNING_POP
#endif
void tst_QGuiVariant::matrix4x4() void tst_QGuiVariant::matrix4x4()
{ {

View File

@ -2,10 +2,10 @@
opensuse-leap opensuse-leap
[positioning:default] [positioning:default]
linux linux
osx-10.12 ci macos ci
winrt winrt
[positioning:fake] [positioning:fake]
osx-10.12 ci macos ci
[modalWithChildWindow] [modalWithChildWindow]
# QTBUG-66851 # QTBUG-66851
# QTBUG-69160 # QTBUG-69160

View File

@ -3061,6 +3061,9 @@ void tst_QMatrixNxN::columnsAndRows()
QVERIFY(m1.row(3) == QVector4D(4, 8, 12, 16)); QVERIFY(m1.row(3) == QVector4D(4, 8, 12, 16));
} }
#if QT_DEPRECATED_SINCE(5, 15)
QT_WARNING_PUSH
QT_WARNING_DISABLE_DEPRECATED
// Test converting QMatrix objects into QMatrix4x4 and then // Test converting QMatrix objects into QMatrix4x4 and then
// checking that transformations in the original perform the // checking that transformations in the original perform the
// equivalent transformations in the new matrix. // equivalent transformations in the new matrix.
@ -3107,6 +3110,8 @@ void tst_QMatrixNxN::convertQMatrix()
QVERIFY(qFuzzyCompare(float(m5.dx()), float(m7.dx()))); QVERIFY(qFuzzyCompare(float(m5.dx()), float(m7.dx())));
QVERIFY(qFuzzyCompare(float(m5.dy()), float(m7.dy()))); QVERIFY(qFuzzyCompare(float(m5.dy()), float(m7.dy())));
} }
QT_WARNING_POP
#endif
// Test converting QTransform objects into QMatrix4x4 and then // Test converting QTransform objects into QMatrix4x4 and then
// checking that transformations in the original perform the // checking that transformations in the original perform the

View File

@ -1704,8 +1704,11 @@ void tst_QPainter::combinedMatrix()
QTransform ct = p.combinedTransform(); QTransform ct = p.combinedTransform();
#if QT_DEPRECATED_SINCE(5, 13) #if QT_DEPRECATED_SINCE(5, 13)
QT_WARNING_PUSH
QT_WARNING_DISABLE_DEPRECATED
QMatrix cm = p.combinedMatrix(); QMatrix cm = p.combinedMatrix();
QCOMPARE(cm, ct.toAffine()); QCOMPARE(cm, ct.toAffine());
QT_WARNING_POP
#endif #endif
QPointF pt = QPointF(0, 0) * ct.toAffine(); QPointF pt = QPointF(0, 0) * ct.toAffine();
@ -2245,7 +2248,7 @@ void tst_QPainter::clippedPolygon()
{ {
QFETCH(QSize, imageSize); QFETCH(QSize, imageSize);
QFETCH(QPainterPath, path); QFETCH(QPainterPath, path);
QPolygonF polygon = path.toFillPolygon(); QPolygonF polygon = path.toFillPolygon(QTransform());
QFETCH(QRect, clipRect); QFETCH(QRect, clipRect);
QPainterPath clipPath; QPainterPath clipPath;
clipPath.addRect(clipRect); clipPath.addRect(clipRect);
@ -3066,7 +3069,7 @@ void tst_QPainter::fpe_steepSlopes_data()
const qreal dsin = 0.000014946676875461832484392500630665523431162000633776187896728515625; const qreal dsin = 0.000014946676875461832484392500630665523431162000633776187896728515625;
const qreal dcos = 0.9999999998882984630910186751862056553363800048828125; const qreal dcos = 0.9999999998882984630910186751862056553363800048828125;
const QTransform transform = QTransform(QMatrix(dcos, dsin, -dsin, dcos, 64, 64)); const QTransform transform = QTransform(dcos, dsin, -dsin, dcos, 64, 64);
const QLineF line(2, 2, 2, 6); const QLineF line(2, 2, 2, 6);
QTest::newRow("task 207147 aa") << transform << line << true; QTest::newRow("task 207147 aa") << transform << line << true;
@ -4064,7 +4067,7 @@ void tst_QPainter::drawPolygon()
path.moveTo(2, 34); path.moveTo(2, 34);
path.lineTo(34, 2); path.lineTo(34, 2);
QPolygonF poly = stroker.createStroke(path).toFillPolygon(); QPolygonF poly = stroker.createStroke(path).toFillPolygon(QTransform());
img.fill(0xffffffff); img.fill(0xffffffff);
QPainter p(&img); QPainter p(&img);
@ -4133,7 +4136,10 @@ void tst_QPainter::inactivePainter()
p.setClipping(true); p.setClipping(true);
#if QT_DEPRECATED_SINCE(5, 13) #if QT_DEPRECATED_SINCE(5, 13)
QT_WARNING_PUSH
QT_WARNING_DISABLE_DEPRECATED
p.combinedMatrix(); p.combinedMatrix();
QT_WARNING_POP
#endif #endif
p.combinedTransform(); p.combinedTransform();
@ -4142,7 +4148,10 @@ void tst_QPainter::inactivePainter()
p.device(); p.device();
#if QT_DEPRECATED_SINCE(5, 13) #if QT_DEPRECATED_SINCE(5, 13)
QT_WARNING_PUSH
QT_WARNING_DISABLE_DEPRECATED
p.deviceMatrix(); p.deviceMatrix();
QT_WARNING_POP
#endif #endif
p.deviceTransform(); p.deviceTransform();
@ -4168,7 +4177,10 @@ void tst_QPainter::inactivePainter()
p.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform, false); p.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform, false);
#if QT_DEPRECATED_SINCE(5, 13) #if QT_DEPRECATED_SINCE(5, 13)
QT_WARNING_PUSH
QT_WARNING_DISABLE_DEPRECATED
p.resetMatrix(); p.resetMatrix();
QT_WARNING_POP
#endif #endif
p.resetTransform(); p.resetTransform();
p.rotate(1); p.rotate(1);
@ -4186,8 +4198,11 @@ void tst_QPainter::inactivePainter()
p.setWindow(QRect(10, 10, 620, 460)); p.setWindow(QRect(10, 10, 620, 460));
#if QT_DEPRECATED_SINCE(5, 13) #if QT_DEPRECATED_SINCE(5, 13)
QT_WARNING_PUSH
QT_WARNING_DISABLE_DEPRECATED
p.worldMatrix(); p.worldMatrix();
p.setWorldMatrix(QMatrix().translate(43, 21), true); p.setWorldMatrix(QMatrix().translate(43, 21), true);
QT_WARNING_POP
#endif #endif
p.setWorldMatrixEnabled(true); p.setWorldMatrixEnabled(true);

View File

@ -713,9 +713,5 @@ QPainterPath Paths::bezierQuadrant()
path.closeSubpath(); path.closeSubpath();
} }
QMatrix m(2, 0,
0, 2,
0, 0);
return path; return path;
} }

View File

@ -152,7 +152,7 @@ void tst_QPathClipper::initTestCase()
for (int i = 0; i < paths.size(); ++i) { for (int i = 0; i < paths.size(); ++i) {
QRectF bounds = paths[i].boundingRect(); QRectF bounds = paths[i].boundingRect();
QMatrix m(1, 0, QTransform m(1, 0,
0, 1, 0, 1,
-bounds.center().x(), -bounds.center().y()); -bounds.center().x(), -bounds.center().y());

View File

@ -331,17 +331,13 @@ void tst_QTransform::mapToPolygon()
void tst_QTransform::qhash() void tst_QTransform::qhash()
{ {
QMatrix m1; QTransform t1;
m1.shear(3.0, 2.0); t1.shear(3.0, 2.0);
m1.rotate(44); t1.rotate(44);
QMatrix m2 = m1; QTransform t2 = t1;
QTransform t1(m1);
QTransform t2(m2);
// not really much to test here, so just the bare minimum: // not really much to test here, so just the bare minimum:
QCOMPARE(qHash(m1), qHash(m2));
QCOMPARE(qHash(t1), qHash(t2)); QCOMPARE(qHash(t1), qHash(t2));
} }
@ -376,6 +372,9 @@ void tst_QTransform::scale()
QVERIFY( QTransform::fromScale( 1, 1 ) == QTransform()); QVERIFY( QTransform::fromScale( 1, 1 ) == QTransform());
} }
#if QT_DEPRECATED_SINCE(5, 15)
QT_WARNING_PUSH
QT_WARNING_DISABLE_DEPRECATED
void tst_QTransform::matrix() void tst_QTransform::matrix()
{ {
QMatrix mat1; QMatrix mat1;
@ -414,7 +413,7 @@ void tst_QTransform::matrix()
QRect rect(43, 70, 200, 200); QRect rect(43, 70, 200, 200);
QPoint pt(43, 66); QPoint pt(43, 66);
QCOMPARE(tranInv.map(pt), matInv.map(pt)); QCOMPARE(tranInv.mapRect(rect), matInv.mapRect(rect));
QCOMPARE(tranInv.map(pt), matInv.map(pt)); QCOMPARE(tranInv.map(pt), matInv.map(pt));
QPainterPath path; QPainterPath path;
@ -431,6 +430,8 @@ void tst_QTransform::testOffset()
const QMatrix &aff = trans.toAffine(); const QMatrix &aff = trans.toAffine();
QCOMPARE((void*)(&aff), (void*)(&trans)); QCOMPARE((void*)(&aff), (void*)(&trans));
} }
QT_WARNING_POP
#endif
void tst_QTransform::types() void tst_QTransform::types()
{ {

View File

@ -32,6 +32,9 @@
#include <qmath.h> #include <qmath.h>
#include <qpolygon.h> #include <qpolygon.h>
#if QT_DEPRECATED_SINCE(5, 15)
QT_WARNING_PUSH
QT_WARNING_DISABLE_DEPRECATED
class tst_QWMatrix : public QObject class tst_QWMatrix : public QObject
{ {
@ -324,5 +327,8 @@ void tst_QWMatrix::mapPolygon()
} }
} }
QT_WARNING_POP
#endif
QTEST_APPLESS_MAIN(tst_QWMatrix) QTEST_APPLESS_MAIN(tst_QWMatrix)
#include "tst_qwmatrix.moc" #include "tst_qwmatrix.moc"

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