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

Conflicts:
	.qmake.conf
	examples/widgets/widgets/imageviewer/imageviewer.cpp
	src/corelib/text/qchar.cpp
	src/corelib/time/qdatetime.cpp

Change-Id: I9762f5c4ff650799219729d6aee79ac07ce9024a
This commit is contained in:
Qt Forward Merge Bot 2020-02-04 01:00:59 +01:00 committed by Edward Welbourne
commit 97417e8f28
86 changed files with 573 additions and 271 deletions

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 demonstration applications of the Qt Toolkit. ** This file is part of the demonstration applications of the Qt Toolkit.
@ -198,7 +198,7 @@ private slots:
public slots: public slots:
void request(const QString &flightCode, const QDate &date) { void request(const QString &flightCode, QDate date) {
setWindowTitle("Loading..."); setWindowTitle("Loading...");

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 demonstration applications of the Qt Toolkit. ** This file is part of the demonstration applications of the Qt Toolkit.
@ -71,7 +71,7 @@ QVariant addGenre(QSqlQuery &q, const QString &name)
return q.lastInsertId(); return q.lastInsertId();
} }
QVariant addAuthor(QSqlQuery &q, const QString &name, const QDate &birthdate) QVariant addAuthor(QSqlQuery &q, const QString &name, QDate birthdate)
{ {
q.addBindValue(name); q.addBindValue(name);
q.addBindValue(birthdate); q.addBindValue(birthdate);

View File

@ -27,6 +27,7 @@
/*! /*!
\example hellovulkancubes \example hellovulkancubes
\meta installpath vulkan
\title Hello Vulkan Cubes Example \title Hello Vulkan Cubes Example
\ingroup examples-vulkan \ingroup examples-vulkan
\brief Shows the basics of using QVulkanWindow. \brief Shows the basics of using QVulkanWindow.

View File

@ -27,6 +27,7 @@
/*! /*!
\example hellovulkantexture \example hellovulkantexture
\meta installpath vulkan
\ingroup examples-vulkan \ingroup examples-vulkan
\title Hello Vulkan Texture Vulkan Example \title Hello Vulkan Texture Vulkan Example
\brief Shows the basics of rendering with textures in a QVulkanWindow. \brief Shows the basics of rendering with textures in a QVulkanWindow.

View File

@ -27,6 +27,7 @@
/*! /*!
\example hellovulkantriangle \example hellovulkantriangle
\meta installpath vulkan
\ingroup examples-vulkan \ingroup examples-vulkan
\title Hello Vulkan Triangle Example \title Hello Vulkan Triangle Example
\brief Shows the basics of rendering with QVulkanWindow and the Vulkan API. \brief Shows the basics of rendering with QVulkanWindow and the Vulkan API.

View File

@ -27,6 +27,7 @@
/*! /*!
\example hellovulkanwidget \example hellovulkanwidget
\meta installpath vulkan
\ingroup examples-vulkan \ingroup examples-vulkan
\title Hello Vulkan Widget Example \title Hello Vulkan Widget Example
\brief Shows the usage of QVulkanWindow in QWidget applications. \brief Shows the usage of QVulkanWindow in QWidget applications.

View File

@ -27,6 +27,7 @@
/*! /*!
\example hellovulkanwindow \example hellovulkanwindow
\meta installpath vulkan
\title Hello Vulkan Window Example \title Hello Vulkan Window Example
\ingroup examples-vulkan \ingroup examples-vulkan
\brief Shows the basics of using QVulkanWindow. \brief Shows the basics of using QVulkanWindow.

View File

@ -369,7 +369,7 @@ void ConclusionPage::setVisible(bool visible)
void ConclusionPage::printButtonClicked() void ConclusionPage::printButtonClicked()
{ {
#if QT_CONFIG(printdialog) #if defined(QT_PRINTSUPPORT_LIB) && QT_CONFIG(printdialog)
QPrinter printer; QPrinter printer;
QPrintDialog dialog(&printer, this); QPrintDialog dialog(&printer, this);
if (dialog.exec()) if (dialog.exec())

View File

@ -264,7 +264,7 @@ void View::toggleAntialiasing()
void View::print() void View::print()
{ {
#if QT_CONFIG(printdialog) #if defined(QT_PRINTSUPPORT_LIB) && QT_CONFIG(printdialog)
QPrinter printer; QPrinter printer;
QPrintDialog dialog(&printer, this); QPrintDialog dialog(&printer, this);
if (dialog.exec() == QDialog::Accepted) { if (dialog.exec() == QDialog::Accepted) {

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 examples of the Qt Toolkit. ** This file is part of the examples of the Qt Toolkit.
@ -60,7 +60,7 @@ MySortFilterProxyModel::MySortFilterProxyModel(QObject *parent)
//! [0] //! [0]
//! [1] //! [1]
void MySortFilterProxyModel::setFilterMinimumDate(const QDate &date) void MySortFilterProxyModel::setFilterMinimumDate(QDate date)
{ {
minDate = date; minDate = date;
invalidateFilter(); invalidateFilter();
@ -68,7 +68,7 @@ void MySortFilterProxyModel::setFilterMinimumDate(const QDate &date)
//! [1] //! [1]
//! [2] //! [2]
void MySortFilterProxyModel::setFilterMaximumDate(const QDate &date) void MySortFilterProxyModel::setFilterMaximumDate(QDate date)
{ {
maxDate = date; maxDate = date;
invalidateFilter(); invalidateFilter();
@ -122,7 +122,7 @@ bool MySortFilterProxyModel::lessThan(const QModelIndex &left,
//! [5] //! [6] //! [5] //! [6]
//! [7] //! [7]
bool MySortFilterProxyModel::dateInRange(const QDate &date) const bool MySortFilterProxyModel::dateInRange(QDate date) const
{ {
return (!minDate.isValid() || date > minDate) return (!minDate.isValid() || date > minDate)
&& (!maxDate.isValid() || date < maxDate); && (!maxDate.isValid() || date < maxDate);

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 examples of the Qt Toolkit. ** This file is part of the examples of the Qt Toolkit.
@ -63,17 +63,17 @@ public:
MySortFilterProxyModel(QObject *parent = 0); MySortFilterProxyModel(QObject *parent = 0);
QDate filterMinimumDate() const { return minDate; } QDate filterMinimumDate() const { return minDate; }
void setFilterMinimumDate(const QDate &date); void setFilterMinimumDate(QDate date);
QDate filterMaximumDate() const { return maxDate; } QDate filterMaximumDate() const { return maxDate; }
void setFilterMaximumDate(const QDate &date); void setFilterMaximumDate(QDate date);
protected: protected:
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override; bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override;
bool lessThan(const QModelIndex &left, const QModelIndex &right) const override; bool lessThan(const QModelIndex &left, const QModelIndex &right) const override;
private: private:
bool dateInRange(const QDate &date) const; bool dateInRange(QDate date) const;
QDate minDate; QDate minDate;
QDate maxDate; QDate maxDate;

View File

@ -167,7 +167,7 @@ void MainWindow::openImage(const QString &fileName)
void MainWindow::printImage() void MainWindow::printImage()
{ {
#if QT_CONFIG(printdialog) #if defined(QT_PRINTSUPPORT_LIB) && QT_CONFIG(printdialog)
if (model->rowCount(QModelIndex())*model->columnCount(QModelIndex()) > 90000) { if (model->rowCount(QModelIndex())*model->columnCount(QModelIndex()) > 90000) {
QMessageBox::StandardButton answer; QMessageBox::StandardButton answer;
answer = QMessageBox::question(this, tr("Large Image Size"), answer = QMessageBox::question(this, tr("Large Image Size"),

View File

@ -128,7 +128,7 @@ void MainWindow::newLetter()
//! [3] //! [3]
void MainWindow::print() void MainWindow::print()
{ {
#if QT_CONFIG(printdialog) #if defined(QT_PRINTSUPPORT_LIB) && QT_CONFIG(printdialog)
QTextDocument *document = textEdit->document(); QTextDocument *document = textEdit->document();
QPrinter printer; QPrinter printer;

View File

@ -248,7 +248,7 @@ void MainWindow::openDialog()
//! [17] //! [17]
void MainWindow::printFile() void MainWindow::printFile()
{ {
#if QT_CONFIG(printdialog) #if defined(QT_PRINTSUPPORT_LIB) && QT_CONFIG(printdialog)
QTextEdit *editor = static_cast<QTextEdit*>(letters->currentWidget()); QTextEdit *editor = static_cast<QTextEdit*>(letters->currentWidget());
//! [18] //! [18]
QPrinter printer; QPrinter printer;

View File

@ -419,18 +419,18 @@ bool TextEdit::load(const QString &f)
QByteArray data = file.readAll(); QByteArray data = file.readAll();
QTextCodec *codec = Qt::codecForHtml(data); QTextCodec *codec = Qt::codecForHtml(data);
QString str = codec->toUnicode(data); QString str = codec->toUnicode(data);
if (Qt::mightBeRichText(str)) {
QUrl baseUrl = (f.front() == QLatin1Char(':') ? QUrl(f) : QUrl::fromLocalFile(f)).adjusted(QUrl::RemoveFilename); QUrl baseUrl = (f.front() == QLatin1Char(':') ? QUrl(f) : QUrl::fromLocalFile(f)).adjusted(QUrl::RemoveFilename);
textEdit->document()->setBaseUrl(baseUrl); textEdit->document()->setBaseUrl(baseUrl);
if (Qt::mightBeRichText(str)) {
textEdit->setHtml(str); textEdit->setHtml(str);
} else { } else {
#if QT_CONFIG(textmarkdownreader) #if QT_CONFIG(textmarkdownreader)
QMimeDatabase db; QMimeDatabase db;
if (db.mimeTypeForFileNameAndData(f, data).name() == QLatin1String("text/markdown")) if (db.mimeTypeForFileNameAndData(f, data).name() == QLatin1String("text/markdown"))
textEdit->setMarkdown(str); textEdit->setMarkdown(QString::fromUtf8(data));
else else
#endif #endif
textEdit->setPlainText(QString::fromLocal8Bit(data)); textEdit->setPlainText(QString::fromUtf8(data));
} }
setCurrentFileName(f); setCurrentFileName(f);
@ -545,7 +545,7 @@ bool TextEdit::fileSaveAs()
void TextEdit::filePrint() void TextEdit::filePrint()
{ {
#if QT_CONFIG(printdialog) #if defined(QT_PRINTSUPPORT_LIB) && QT_CONFIG(printdialog)
QPrinter printer(QPrinter::HighResolution); QPrinter printer(QPrinter::HighResolution);
QPrintDialog *dlg = new QPrintDialog(&printer, this); QPrintDialog *dlg = new QPrintDialog(&printer, this);
if (textEdit->textCursor().hasSelection()) if (textEdit->textCursor().hasSelection())

View File

@ -170,7 +170,7 @@ void ScribbleArea::resizeImage(QImage *image, const QSize &newSize)
//! [21] //! [21]
void ScribbleArea::print() void ScribbleArea::print()
{ {
#if QT_CONFIG(printdialog) #if defined(QT_PRINTSUPPORT_LIB) && QT_CONFIG(printdialog)
QPrinter printer(QPrinter::HighResolution); QPrinter printer(QPrinter::HighResolution);
QPrintDialog printDialog(&printer, this); QPrintDialog printDialog(&printer, this);

View File

@ -92,7 +92,7 @@ Notepad::Notepad(QWidget *parent) :
connect(ui->actionAbout, &QAction::triggered, this, &Notepad::about); connect(ui->actionAbout, &QAction::triggered, this, &Notepad::about);
// Disable menu actions for unavailable features // Disable menu actions for unavailable features
#if !QT_CONFIG(printer) #if !defined(QT_PRINTSUPPORT_LIB) || !QT_CONFIG(printer)
ui->actionPrint->setEnabled(false); ui->actionPrint->setEnabled(false);
#endif #endif
@ -171,7 +171,7 @@ void Notepad::saveAs()
void Notepad::print() void Notepad::print()
{ {
#if QT_CONFIG(printer) #if defined(QT_PRINTSUPPORT_LIB) && QT_CONFIG(printer)
QPrinter printDev; QPrinter printDev;
#if QT_CONFIG(printdialog) #if QT_CONFIG(printdialog)
QPrintDialog dialog(&printDev, this); QPrintDialog dialog(&printDev, this);

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 examples of the Qt Toolkit. ** This file is part of the examples of the Qt Toolkit.
@ -126,7 +126,7 @@ void Window::selectedDateChanged()
//! [2] //! [2]
//! [3] //! [3]
void Window::minimumDateChanged(const QDate &date) void Window::minimumDateChanged(QDate date)
{ {
calendar->setMinimumDate(date); calendar->setMinimumDate(date);
maximumDateEdit->setDate(calendar->maximumDate()); maximumDateEdit->setDate(calendar->maximumDate());
@ -134,7 +134,7 @@ void Window::minimumDateChanged(const QDate &date)
//! [3] //! [3]
//! [4] //! [4]
void Window::maximumDateChanged(const QDate &date) void Window::maximumDateChanged(QDate date)
{ {
calendar->setMaximumDate(date); calendar->setMaximumDate(date);
minimumDateEdit->setDate(calendar->minimumDate()); minimumDateEdit->setDate(calendar->minimumDate());

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 examples of the Qt Toolkit. ** This file is part of the examples of the Qt Toolkit.
@ -52,6 +52,7 @@
#define WINDOW_H #define WINDOW_H
#include <QWidget> #include <QWidget>
#include <QDateTime>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QCalendarWidget; class QCalendarWidget;
@ -79,8 +80,8 @@ private slots:
void horizontalHeaderChanged(int index); void horizontalHeaderChanged(int index);
void verticalHeaderChanged(int index); void verticalHeaderChanged(int index);
void selectedDateChanged(); void selectedDateChanged();
void minimumDateChanged(const QDate &date); void minimumDateChanged(QDate date);
void maximumDateChanged(const QDate &date); void maximumDateChanged(QDate date);
void weekdayFormatChanged(); void weekdayFormatChanged();
void weekendFormatChanged(); void weekendFormatChanged();
void reformatHeaders(); void reformatHeaders();

View File

@ -201,7 +201,7 @@ void ImageViewer::print()
//! [5] //! [6] //! [5] //! [6]
{ {
Q_ASSERT(!imageLabel->pixmap(Qt::ReturnByValue).isNull()); Q_ASSERT(!imageLabel->pixmap(Qt::ReturnByValue).isNull());
#if QT_CONFIG(printdialog) #if defined(QT_PRINTSUPPORT_LIB) && QT_CONFIG(printdialog)
//! [6] //! [7] //! [6] //! [7]
QPrintDialog dialog(&printer, this); QPrintDialog dialog(&printer, this);
//! [7] //! [8] //! [7] //! [8]

View File

@ -210,7 +210,7 @@ void ScribbleArea::resizeImage(QImage *image, const QSize &newSize)
//! [21] //! [21]
void ScribbleArea::print() void ScribbleArea::print()
{ {
#if QT_CONFIG(printdialog) #if defined(QT_PRINTSUPPORT_LIB) && QT_CONFIG(printdialog)
QPrinter printer(QPrinter::HighResolution); QPrinter printer(QPrinter::HighResolution);
QPrintDialog printDialog(&printer, this); QPrintDialog printDialog(&printer, this);

View File

@ -1,6 +1,5 @@
qtPrepareTool(QMAKE_RCC, rcc, _DEP) qtPrepareTool(QMAKE_RCC, rcc, _DEP)
isEmpty(RCC_DIR):RCC_DIR = .
isEmpty(QMAKE_MOD_RCC):QMAKE_MOD_RCC = qrc isEmpty(QMAKE_MOD_RCC):QMAKE_MOD_RCC = qrc
!contains(QMAKE_RESOURCE_FLAGS, -root):!isEmpty(QMAKE_RESOURCE_ROOT):QMAKE_RESOURCE_FLAGS += -root $$QMAKE_RESOURCE_ROOT !contains(QMAKE_RESOURCE_FLAGS, -root):!isEmpty(QMAKE_RESOURCE_ROOT):QMAKE_RESOURCE_FLAGS += -root $$QMAKE_RESOURCE_ROOT
@ -8,39 +7,7 @@ isEmpty(QMAKE_MOD_RCC):QMAKE_MOD_RCC = qrc
load(resources_functions) load(resources_functions)
qtFlattenResources() qtFlattenResources()
qtEnsurePluginResourcesCpp()
!isEmpty(RESOURCES):contains(TEMPLATE, .*lib):plugin:static {
pluginBaseName = $$basename(TARGET)
pluginName = $$lower($$replace(pluginBaseName, [-], _))
resource_init_function = $${pluginName}_plugin_resource_init
DEFINES += "QT_PLUGIN_RESOURCE_INIT_FUNCTION=$$resource_init_function"
RESOURCE_INIT_CPP = $$OUT_PWD/$${pluginName}_plugin_resources.cpp
GENERATED_SOURCES += $$RESOURCE_INIT_CPP
QMAKE_DISTCLEAN += $$RESOURCE_INIT_CPP
isEmpty(BUILDS)|build_pass {
RESOURCE_INIT_CONT = \
"// This file is autogenerated by qmake. It contains a function that" \
"// references all resources the plugin includes and the function is" \
"// referenced by Qt_(MOC_)EXPORT_PLUGIN to ensure the inclusion in" \
"// the statically linked plugin." \
"$${LITERAL_HASH}include <QtCore/qglobal.h>" \
"void $${resource_init_function}() " \
"{" \
for (resource, RESOURCES) {
resource_name = $$replace($$list($$basename(resource)),\.qrc$, )
resource_name = $$replace(resource_name, [^a-zA-Z0-9_], _)
RESOURCE_INIT_CONT += " Q_INIT_RESOURCE($$resource_name);"
}
RESOURCE_INIT_CONT += \
"}"
write_file($$RESOURCE_INIT_CPP, RESOURCE_INIT_CONT)|error()
}
}
rcc.input = RESOURCES rcc.input = RESOURCES
rcc.name = RCC ${QMAKE_FILE_IN} rcc.name = RCC ${QMAKE_FILE_IN}

View File

@ -9,6 +9,7 @@ defineReplace(xml_escape) {
} }
defineTest(qtFlattenResources) { defineTest(qtFlattenResources) {
isEmpty(RCC_DIR):RCC_DIR = .
immediate = qmake_immediate$$QMAKE_RESOURCES_IMMEDIATE_NR immediate = qmake_immediate$$QMAKE_RESOURCES_IMMEDIATE_NR
defined(QMAKE_RESOURCES_IMMEDIATE_NR, var): \ defined(QMAKE_RESOURCES_IMMEDIATE_NR, var): \
QMAKE_RESOURCES_IMMEDIATE_NR = $$num_add($$QMAKE_RESOURCES_IMMEDIATE_NR, 1) QMAKE_RESOURCES_IMMEDIATE_NR = $$num_add($$QMAKE_RESOURCES_IMMEDIATE_NR, 1)
@ -72,9 +73,53 @@ defineTest(qtFlattenResources) {
RESOURCES -= $$resource RESOURCES -= $$resource
RESOURCES += $$resource_file RESOURCES += $$resource_file
} }
export(RCC_DIR)
export(QMAKE_RESOURCES_IMMEDIATE_NR) export(QMAKE_RESOURCES_IMMEDIATE_NR)
export(RESOURCES) export(RESOURCES)
export(OTHER_FILES) export(OTHER_FILES)
export($${immediate}.files) export($${immediate}.files)
return(true) return(true)
} }
defineTest(qtEnsurePluginResourcesCpp) {
contains(DEFINES, QT_PLUGIN_RESOURCE_INIT_FUNCTION=.*): \
return(true)
!isEmpty(RESOURCES):contains(TEMPLATE, .*lib):plugin:static {
pluginBaseName = $$basename(TARGET)
pluginName = $$lower($$replace(pluginBaseName, [-], _))
resource_init_function = $${pluginName}_plugin_resource_init
DEFINES += "QT_PLUGIN_RESOURCE_INIT_FUNCTION=$$resource_init_function"
RESOURCE_INIT_CPP = $$OUT_PWD/$${pluginName}_plugin_resources.cpp
GENERATED_SOURCES += $$RESOURCE_INIT_CPP
QMAKE_DISTCLEAN += $$RESOURCE_INIT_CPP
isEmpty(BUILDS)|build_pass {
RESOURCE_INIT_CONT = \
"// This file is autogenerated by qmake. It contains a function that" \
"// references all resources the plugin includes and the function is" \
"// referenced by Qt_(MOC_)EXPORT_PLUGIN to ensure the inclusion in" \
"// the statically linked plugin." \
"$${LITERAL_HASH}include <QtCore/qglobal.h>" \
"void $${resource_init_function}() " \
"{" \
for (resource, RESOURCES) {
resource_name = $$replace($$list($$basename(resource)),\.qrc$, )
resource_name = $$replace(resource_name, [^a-zA-Z0-9_], _)
RESOURCE_INIT_CONT += " Q_INIT_RESOURCE($$resource_name);"
}
RESOURCE_INIT_CONT += \
"}"
write_file($$RESOURCE_INIT_CPP, RESOURCE_INIT_CONT)|error()
}
export(DEFINES)
export(GENERATED_SOURCES)
export(QMAKE_DISTCLEAN)
}
return(true)
}

View File

@ -310,7 +310,7 @@ static QString commandLinesForOutput(QStringList commands)
if (!commands.at(i).startsWith("rem", Qt::CaseInsensitive)) if (!commands.at(i).startsWith("rem", Qt::CaseInsensitive))
commands.insert(i + 1, errchk); commands.insert(i + 1, errchk);
} }
return commands.join('\n'); return commands.join("\r\n");
} }
static QString unquote(const QString &value) static QString unquote(const QString &value)

View File

@ -1,3 +1,4 @@
INCLUDEPATH += $$PWD/md4c INCLUDEPATH += $$PWD/md4c
HEADERS += $$PWD/md4c/md4c.h HEADERS += $$PWD/md4c/md4c.h
SOURCES += $$PWD/md4c/md4c.c SOURCES += $$PWD/md4c/md4c.c
DEFINES += MD4C_USE_UTF8

View File

@ -740,28 +740,37 @@ public class QtNative
public static boolean hasClipboardText() public static boolean hasClipboardText()
{ {
try {
if (m_clipboardManager != null && m_clipboardManager.hasPrimaryClip()) { if (m_clipboardManager != null && m_clipboardManager.hasPrimaryClip()) {
ClipData primaryClip = m_clipboardManager.getPrimaryClip(); ClipData primaryClip = m_clipboardManager.getPrimaryClip();
for (int i = 0; i < primaryClip.getItemCount(); ++i) for (int i = 0; i < primaryClip.getItemCount(); ++i)
if (primaryClip.getItemAt(i).getText() != null) if (primaryClip.getItemAt(i).getText() != null)
return true; return true;
} }
} catch (Exception e) {
Log.e(QtTAG, "Failed to get clipboard data", e);
}
return false; return false;
} }
private static String getClipboardText() private static String getClipboardText()
{ {
try {
if (m_clipboardManager != null && m_clipboardManager.hasPrimaryClip()) { if (m_clipboardManager != null && m_clipboardManager.hasPrimaryClip()) {
ClipData primaryClip = m_clipboardManager.getPrimaryClip(); ClipData primaryClip = m_clipboardManager.getPrimaryClip();
for (int i = 0; i < primaryClip.getItemCount(); ++i) for (int i = 0; i < primaryClip.getItemCount(); ++i)
if (primaryClip.getItemAt(i).getText() != null) if (primaryClip.getItemAt(i).getText() != null)
return primaryClip.getItemAt(i).getText().toString(); return primaryClip.getItemAt(i).getText().toString();
} }
} catch (Exception e) {
Log.e(QtTAG, "Failed to get clipboard data", e);
}
return ""; return "";
} }
private static void updatePrimaryClip(ClipData clipData) private static void updatePrimaryClip(ClipData clipData)
{ {
try {
if (m_usePrimaryClip) { if (m_usePrimaryClip) {
ClipData clip = m_clipboardManager.getPrimaryClip(); ClipData clip = m_clipboardManager.getPrimaryClip();
if (Build.VERSION.SDK_INT >= 26) { if (Build.VERSION.SDK_INT >= 26) {
@ -789,6 +798,9 @@ public class QtNative
m_clipboardManager.setPrimaryClip(clipData); m_clipboardManager.setPrimaryClip(clipData);
m_usePrimaryClip = true; m_usePrimaryClip = true;
} }
} catch (Exception e) {
Log.e(QtTAG, "Failed to set clipboard data", e);
}
} }
private static void setClipboardHtml(String text, String html) private static void setClipboardHtml(String text, String html)
@ -801,23 +813,31 @@ public class QtNative
public static boolean hasClipboardHtml() public static boolean hasClipboardHtml()
{ {
try {
if (m_clipboardManager != null && m_clipboardManager.hasPrimaryClip()) { if (m_clipboardManager != null && m_clipboardManager.hasPrimaryClip()) {
ClipData primaryClip = m_clipboardManager.getPrimaryClip(); ClipData primaryClip = m_clipboardManager.getPrimaryClip();
for (int i = 0; i < primaryClip.getItemCount(); ++i) for (int i = 0; i < primaryClip.getItemCount(); ++i)
if (primaryClip.getItemAt(i).getHtmlText() != null) if (primaryClip.getItemAt(i).getHtmlText() != null)
return true; return true;
} }
} catch (Exception e) {
Log.e(QtTAG, "Failed to get clipboard data", e);
}
return false; return false;
} }
private static String getClipboardHtml() private static String getClipboardHtml()
{ {
try {
if (m_clipboardManager != null && m_clipboardManager.hasPrimaryClip()) { if (m_clipboardManager != null && m_clipboardManager.hasPrimaryClip()) {
ClipData primaryClip = m_clipboardManager.getPrimaryClip(); ClipData primaryClip = m_clipboardManager.getPrimaryClip();
for (int i = 0; i < primaryClip.getItemCount(); ++i) for (int i = 0; i < primaryClip.getItemCount(); ++i)
if (primaryClip.getItemAt(i).getHtmlText() != null) if (primaryClip.getItemAt(i).getHtmlText() != null)
return primaryClip.getItemAt(i).getHtmlText().toString(); return primaryClip.getItemAt(i).getHtmlText().toString();
} }
} catch (Exception e) {
Log.e(QtTAG, "Failed to get clipboard data", e);
}
return ""; return "";
} }
@ -832,24 +852,32 @@ public class QtNative
public static boolean hasClipboardUri() public static boolean hasClipboardUri()
{ {
try {
if (m_clipboardManager != null && m_clipboardManager.hasPrimaryClip()) { if (m_clipboardManager != null && m_clipboardManager.hasPrimaryClip()) {
ClipData primaryClip = m_clipboardManager.getPrimaryClip(); ClipData primaryClip = m_clipboardManager.getPrimaryClip();
for (int i = 0; i < primaryClip.getItemCount(); ++i) for (int i = 0; i < primaryClip.getItemCount(); ++i)
if (primaryClip.getItemAt(i).getUri() != null) if (primaryClip.getItemAt(i).getUri() != null)
return true; return true;
} }
} catch (Exception e) {
Log.e(QtTAG, "Failed to get clipboard data", e);
}
return false; return false;
} }
private static String[] getClipboardUris() private static String[] getClipboardUris()
{ {
ArrayList<String> uris = new ArrayList<String>(); ArrayList<String> uris = new ArrayList<String>();
try {
if (m_clipboardManager != null && m_clipboardManager.hasPrimaryClip()) { if (m_clipboardManager != null && m_clipboardManager.hasPrimaryClip()) {
ClipData primaryClip = m_clipboardManager.getPrimaryClip(); ClipData primaryClip = m_clipboardManager.getPrimaryClip();
for (int i = 0; i < primaryClip.getItemCount(); ++i) for (int i = 0; i < primaryClip.getItemCount(); ++i)
if (primaryClip.getItemAt(i).getUri() != null) if (primaryClip.getItemAt(i).getUri() != null)
uris.add(primaryClip.getItemAt(i).getUri().toString()); uris.add(primaryClip.getItemAt(i).getUri().toString());
} }
} catch (Exception e) {
Log.e(QtTAG, "Failed to get clipboard data", e);
}
String[] strings = new String[uris.size()]; String[] strings = new String[uris.size()];
strings = uris.toArray(strings); strings = uris.toArray(strings);
return strings; return strings;

View File

@ -62,7 +62,7 @@ public class QtActivityLoader extends QtLoader {
protected void downloadUpgradeMinistro(String msg) { protected void downloadUpgradeMinistro(String msg) {
AlertDialog.Builder downloadDialog = new AlertDialog.Builder(m_activity); AlertDialog.Builder downloadDialog = new AlertDialog.Builder(m_activity);
downloadDialog.setMessage(msg); downloadDialog.setMessage(msg);
downloadDialog.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() { downloadDialog.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialogInterface, int i) { public void onClick(DialogInterface dialogInterface, int i) {
try { try {
@ -76,7 +76,7 @@ public class QtActivityLoader extends QtLoader {
} }
}); });
downloadDialog.setNegativeButton(android.R.string.no, new DialogInterface.OnClickListener() { downloadDialog.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialogInterface, int i) { public void onClick(DialogInterface dialogInterface, int i) {
m_activity.finish(); m_activity.finish();

View File

@ -59,7 +59,14 @@ macro(qt5_make_output_file infile prefix ext outfile )
set(_outfile "${CMAKE_CURRENT_BINARY_DIR}/${rel}") set(_outfile "${CMAKE_CURRENT_BINARY_DIR}/${rel}")
string(REPLACE ".." "__" _outfile ${_outfile}) string(REPLACE ".." "__" _outfile ${_outfile})
get_filename_component(outpath ${_outfile} PATH) get_filename_component(outpath ${_outfile} PATH)
if(CMAKE_VERSION VERSION_LESS "3.14")
get_filename_component(_outfile_ext ${_outfile} EXT)
get_filename_component(_outfile_ext ${_outfile_ext} NAME_WE)
get_filename_component(_outfile ${_outfile} NAME_WE) get_filename_component(_outfile ${_outfile} NAME_WE)
string(APPEND _outfile ${_outfile_ext})
else()
get_filename_component(_outfile ${_outfile} NAME_WLE)
endif()
file(MAKE_DIRECTORY ${outpath}) file(MAKE_DIRECTORY ${outpath})
set(${outfile} ${outpath}/${prefix}${_outfile}.${ext}) set(${outfile} ${outpath}/${prefix}${_outfile}.${ext})
endmacro() endmacro()

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 documentation of the Qt Toolkit. ** This file is part of the documentation of the Qt Toolkit.
@ -135,7 +135,7 @@ class Employee
{ {
public: public:
Employee() {} Employee() {}
Employee(const QString &name, const QDate &dateOfBirth); Employee(const QString &name, QDate dateOfBirth);
... ...
private: private:

View File

@ -151,7 +151,7 @@ class Employee
{ {
public: public:
Employee() {} Employee() {}
Employee(const QString &name, const QDate &dateOfBirth); Employee(const QString &name, QDate dateOfBirth);
... ...
private: private:

View File

@ -213,7 +213,7 @@ f16cextern void qFloatFromFloat16_fast(float *out, const quint16 *in, qsizetype
#undef f16cextern #undef f16cextern
} }
#elif defined(__ARM_FP16_FORMAT_IEEE) && defined(__ARM_NEON__) #elif defined(__ARM_FP16_FORMAT_IEEE) && defined(__ARM_NEON__) && (__ARM_FP & 2)
static inline bool hasFastF16() static inline bool hasFastF16()
{ {
return true; return true;

View File

@ -44,7 +44,7 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
#if !defined(__F16C__) && !defined(__ARM_FP16_FORMAT_IEEE) #if !defined(__ARM_FP16_FORMAT_IEEE)
const quint32 qfloat16::mantissatable[2048] = { const quint32 qfloat16::mantissatable[2048] = {
0, 0,

View File

@ -1669,14 +1669,34 @@ static bool android_default_message_handler(QtMsgType type,
#endif //Q_OS_ANDROID #endif //Q_OS_ANDROID
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
static void win_outputDebugString_helper(QStringView message)
{
const int maxOutputStringLength = 32766;
static QBasicMutex m;
auto locker = qt_unique_lock(m);
// fast path: Avoid string copies if one output is enough
if (message.length() <= maxOutputStringLength) {
OutputDebugString(reinterpret_cast<const wchar_t *>(message.utf16()));
} else {
wchar_t *messagePart = new wchar_t[maxOutputStringLength + 1];
for (int i = 0; i < message.length(); i += maxOutputStringLength ) {
const int length = std::min(message.length() - i, maxOutputStringLength );
const int len = message.mid(i, length).toWCharArray(messagePart);
Q_ASSERT(len == length);
messagePart[len] = 0;
OutputDebugString(messagePart);
}
delete[] messagePart;
}
}
static bool win_message_handler(QtMsgType type, const QMessageLogContext &context, const QString &message) static bool win_message_handler(QtMsgType type, const QMessageLogContext &context, const QString &message)
{ {
if (shouldLogToStderr()) if (shouldLogToStderr())
return false; // Leave logging up to stderr handler return false; // Leave logging up to stderr handler
QString formattedMessage = qFormatLogMessage(type, context, message); const QString formattedMessage = qFormatLogMessage(type, context, message).append('\n');
formattedMessage.append(QLatin1Char('\n')); win_outputDebugString_helper(formattedMessage);
OutputDebugString(reinterpret_cast<const wchar_t *>(formattedMessage.utf16()));
return true; // Prevent further output to stderr return true; // Prevent further output to stderr
} }
@ -1832,11 +1852,11 @@ static void qt_message_print(QtMsgType msgType, const QMessageLogContext &contex
static void qt_message_print(const QString &message) static void qt_message_print(const QString &message)
{ {
#if defined(Q_OS_WINRT) #if defined(Q_OS_WINRT)
OutputDebugString(reinterpret_cast<const wchar_t*>(message.utf16())); win_outputDebugString_helper(message);
return; return;
#elif defined(Q_OS_WIN) && !defined(QT_BOOTSTRAPPED) #elif defined(Q_OS_WIN) && !defined(QT_BOOTSTRAPPED)
if (!shouldLogToStderr()) { if (!shouldLogToStderr()) {
OutputDebugString(reinterpret_cast<const wchar_t*>(message.utf16())); win_outputDebugString_helper(message);
return; return;
} }
#endif #endif

View File

@ -1199,6 +1199,7 @@
\value WA_StyleSheetTarget Indicates that the widget appearance was modified \value WA_StyleSheetTarget Indicates that the widget appearance was modified
by a \l{Qt Style Sheets}{style sheet}. WA_StyleSheet will also be set. by a \l{Qt Style Sheets}{style sheet}. WA_StyleSheet will also be set.
This value was introduced in Qt 5.12.
\value WA_TabletTracking Indicates that the widget has tablet \value WA_TabletTracking Indicates that the widget has tablet
tracking enabled. See QWidget::tabletTracking. tracking enabled. See QWidget::tabletTracking.

View File

@ -714,7 +714,7 @@ void QIODevicePrivate::setReadChannelCount(int count)
/*! /*!
\since 5.7 \since 5.7
Returns the the index of the current write channel. Returns the index of the current write channel.
\sa setCurrentWriteChannel(), writeChannelCount() \sa setCurrentWriteChannel(), writeChannelCount()
*/ */

View File

@ -58,7 +58,8 @@
#include <sys/file.h> // flock #include <sys/file.h> // flock
#endif #endif
#if defined(Q_OS_RTEMS) #if defined(Q_OS_RTEMS) || defined(Q_OS_QNX)
// flock() does not work in these OSes and produce warnings when we try to use
# undef LOCK_EX # undef LOCK_EX
# undef LOCK_NB # undef LOCK_NB
#endif #endif

View File

@ -247,7 +247,7 @@ AppleApplication *qt_apple_sharedApplication()
qWarning() << "accessing the shared" << [AppleApplication class] qWarning() << "accessing the shared" << [AppleApplication class]
<< "is not allowed in application extensions"; << "is not allowed in application extensions";
// In practice the application is actually available, but the the App // In practice the application is actually available, but the App
// review process will likely catch uses of it, so we return nil just // review process will likely catch uses of it, so we return nil just
// in case, unless we don't care about being App Store compliant. // in case, unless we don't care about being App Store compliant.
#if QT_CONFIG(appstore_compliant) #if QT_CONFIG(appstore_compliant)

View File

@ -660,6 +660,11 @@ static QLocalePrivate *c_private()
return &c_locale; return &c_locale;
} }
static const QLocaleData *systemData();
static QLocale::NumberOptions system_number_options = QLocale::DefaultNumberOptions;
Q_GLOBAL_STATIC_WITH_ARGS(QExplicitlySharedDataPointer<QLocalePrivate>, systemLocalePrivate,
(QLocalePrivate::create(systemData(), system_number_options)))
#ifndef QT_NO_SYSTEMLOCALE #ifndef QT_NO_SYSTEMLOCALE
/****************************************************************************** /******************************************************************************
** Default system locale behavior ** Default system locale behavior
@ -711,6 +716,7 @@ static void updateSystemPrivate()
{ {
// This function is NOT thread-safe! // This function is NOT thread-safe!
// It *should not* be called by anything but systemData() // It *should not* be called by anything but systemData()
// It *is* called before {system,default}LocalePrivate exist.
const QSystemLocale *sys_locale = systemLocale(); const QSystemLocale *sys_locale = systemLocale();
// tell the object that the system locale has changed. // tell the object that the system locale has changed.
@ -718,11 +724,14 @@ static void updateSystemPrivate()
// Populate global with fallback as basis: // Populate global with fallback as basis:
globalLocaleData = *sys_locale->fallbackUiLocaleData(); globalLocaleData = *sys_locale->fallbackUiLocaleData();
system_number_options = QLocale::DefaultNumberOptions;
QVariant res = sys_locale->query(QSystemLocale::LanguageId, QVariant()); QVariant res = sys_locale->query(QSystemLocale::LanguageId, QVariant());
if (!res.isNull()) { if (!res.isNull()) {
globalLocaleData.m_language_id = res.toInt(); globalLocaleData.m_language_id = res.toInt();
globalLocaleData.m_script_id = QLocale::AnyScript; // default for compatibility globalLocaleData.m_script_id = QLocale::AnyScript; // default for compatibility
if (globalLocaleData.m_language_id == QLocale::C)
system_number_options = QLocale::OmitGroupSeparator;
} }
res = sys_locale->query(QSystemLocale::CountryId, QVariant()); res = sys_locale->query(QSystemLocale::CountryId, QVariant());
if (!res.isNull()) { if (!res.isNull()) {
@ -737,9 +746,26 @@ static void updateSystemPrivate()
if (!res.isNull() && !res.toString().isEmpty()) if (!res.isNull() && !res.toString().isEmpty())
globalLocaleData.m_decimal = res.toString().at(0).unicode(); globalLocaleData.m_decimal = res.toString().at(0).unicode();
// System may supply empty group separator to say we should omit grouping;
// and it makes no sense to use the same separator for decimal and grouping
// (which might happen by system supplying, as decimal, what CLDR has given
// us for grouping; or the other way round). Assume, at least, that each of
// system and CLDR has decimal != group, all the same.
res = sys_locale->query(QSystemLocale::GroupSeparator, QVariant()); res = sys_locale->query(QSystemLocale::GroupSeparator, QVariant());
if (!res.isNull() && !res.toString().isEmpty()) if (res.isNull()) {
globalLocaleData.m_group = res.toString().at(0).unicode(); // The case where system over-rides decimal but not group, and its
// decimal clashes with CLDR's group.
if (globalLocaleData.m_group == globalLocaleData.m_decimal)
system_number_options |= QLocale::OmitGroupSeparator;
} else if (res.toString().isEmpty()) {
system_number_options |= QLocale::OmitGroupSeparator;
} else {
const ushort group = res.toString().at(0).unicode();
if (group != globalLocaleData.m_decimal)
globalLocaleData.m_group = group;
else if (group == globalLocaleData.m_group)
qWarning("System-supplied decimal and grouping character are both 0x%hx", group);
}
res = sys_locale->query(QSystemLocale::ZeroDigit, QVariant()); res = sys_locale->query(QSystemLocale::ZeroDigit, QVariant());
if (!res.isNull() && !res.toString().isEmpty()) if (!res.isNull() && !res.toString().isEmpty())
@ -752,6 +778,10 @@ static void updateSystemPrivate()
res = sys_locale->query(QSystemLocale::PositiveSign, QVariant()); res = sys_locale->query(QSystemLocale::PositiveSign, QVariant());
if (!res.isNull() && !res.toString().isEmpty()) if (!res.isNull() && !res.toString().isEmpty())
globalLocaleData.m_plus = res.toString().at(0).unicode(); globalLocaleData.m_plus = res.toString().at(0).unicode();
if (systemLocalePrivate.exists())
systemLocalePrivate->data()->m_numberOptions = system_number_options;
// else: system_number_options will be passed to create() when constructing.
} }
#endif // !QT_NO_SYSTEMLOCALE #endif // !QT_NO_SYSTEMLOCALE
@ -834,8 +864,6 @@ static const int locale_data_size = sizeof(locale_data)/sizeof(QLocaleData) - 1;
Q_GLOBAL_STATIC_WITH_ARGS(QSharedDataPointer<QLocalePrivate>, defaultLocalePrivate, Q_GLOBAL_STATIC_WITH_ARGS(QSharedDataPointer<QLocalePrivate>, defaultLocalePrivate,
(QLocalePrivate::create(defaultData()))) (QLocalePrivate::create(defaultData())))
Q_GLOBAL_STATIC_WITH_ARGS(QExplicitlySharedDataPointer<QLocalePrivate>, systemLocalePrivate,
(QLocalePrivate::create(systemData())))
static QLocalePrivate *localePrivateByName(const QString &name) static QLocalePrivate *localePrivateByName(const QString &name)
{ {

View File

@ -119,7 +119,7 @@ static QString macDayName(int day, bool short_format)
return QString(); return QString();
} }
static QString macDateToString(const QDate &date, bool short_format) static QString macDateToString(QDate date, bool short_format)
{ {
QCFType<CFDateRef> myDate = QDateTime(date, QTime()).toCFDate(); QCFType<CFDateRef> myDate = QDateTime(date, QTime()).toCFDate();
QCFType<CFLocaleRef> mylocale = CFLocaleCopyCurrent(); QCFType<CFLocaleRef> mylocale = CFLocaleCopyCurrent();
@ -131,7 +131,7 @@ static QString macDateToString(const QDate &date, bool short_format)
return QCFString(CFDateFormatterCreateStringWithDate(0, myFormatter, myDate)); return QCFString(CFDateFormatterCreateStringWithDate(0, myFormatter, myDate));
} }
static QString macTimeToString(const QTime &time, bool short_format) static QString macTimeToString(QTime time, bool short_format)
{ {
QCFType<CFDateRef> myDate = QDateTime(QDate::currentDate(), time).toCFDate(); QCFType<CFDateRef> myDate = QDateTime(QDate::currentDate(), time).toCFDate();
QCFType<CFLocaleRef> mylocale = CFLocaleCopyCurrent(); QCFType<CFLocaleRef> mylocale = CFLocaleCopyCurrent();
@ -283,10 +283,12 @@ static QString getMacTimeFormat(CFDateFormatterStyle style)
return macToQtFormat(QString::fromCFString(CFDateFormatterGetFormat(formatter))); return macToQtFormat(QString::fromCFString(CFDateFormatterGetFormat(formatter)));
} }
static QString getCFLocaleValue(CFStringRef key) static QVariant getCFLocaleValue(CFStringRef key)
{ {
QCFType<CFLocaleRef> locale = CFLocaleCopyCurrent(); QCFType<CFLocaleRef> locale = CFLocaleCopyCurrent();
CFTypeRef value = CFLocaleGetValue(locale, key); CFTypeRef value = CFLocaleGetValue(locale, key);
if (!value)
return QVariant();
return QString::fromCFString(CFStringRef(static_cast<CFTypeRef>(value))); return QString::fromCFString(CFStringRef(static_cast<CFTypeRef>(value)));
} }
@ -411,14 +413,10 @@ QVariant QSystemLocale::query(QueryType type, QVariant in) const
switch(type) { switch(type) {
// case Name: // case Name:
// return getMacLocaleName(); // return getMacLocaleName();
case DecimalPoint: { case DecimalPoint:
QString value = getCFLocaleValue(kCFLocaleDecimalSeparator); return getCFLocaleValue(kCFLocaleDecimalSeparator);
return value.isEmpty() ? QVariant() : value; case GroupSeparator:
} return getCFLocaleValue(kCFLocaleGroupingSeparator);
case GroupSeparator: {
QString value = getCFLocaleValue(kCFLocaleGroupingSeparator);
return value.isEmpty() ? QVariant() : value;
}
case DateFormatLong: case DateFormatLong:
case DateFormatShort: case DateFormatShort:
return getMacDateFormat(type == DateFormatShort return getMacDateFormat(type == DateFormatShort

View File

@ -1,6 +1,6 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2019 The Qt Company Ltd. ** Copyright (C) 2020 The Qt Company Ltd.
** Copyright (C) 2016 Intel Corporation. ** Copyright (C) 2016 Intel Corporation.
** Contact: https://www.qt.io/licensing/ ** Contact: https://www.qt.io/licensing/
** **
@ -87,7 +87,7 @@ public:
LanguageId, // uint LanguageId, // uint
CountryId, // uint CountryId, // uint
DecimalPoint, // QString DecimalPoint, // QString
GroupSeparator, // QString GroupSeparator, // QString (empty QString means: don't group digits)
ZeroDigit, // QString ZeroDigit, // QString
NegativeSign, // QString NegativeSign, // QString
DateFormatLong, // QString DateFormatLong, // QString

View File

@ -106,11 +106,11 @@ struct QSystemLocalePrivate
{ {
QSystemLocalePrivate(); QSystemLocalePrivate();
QString zeroDigit(); QVariant zeroDigit();
QString decimalPoint(); QVariant decimalPoint();
QString groupSeparator(); QVariant groupSeparator();
QString negativeSign(); QVariant negativeSign();
QString positiveSign(); QVariant positiveSign();
QVariant dateFormat(QLocale::FormatType); QVariant dateFormat(QLocale::FormatType);
QVariant timeFormat(QLocale::FormatType); QVariant timeFormat(QLocale::FormatType);
QVariant dateTimeFormat(QLocale::FormatType); QVariant dateTimeFormat(QLocale::FormatType);
@ -150,7 +150,9 @@ private:
QString zero; // cached value for zeroDigit() QString zero; // cached value for zeroDigit()
int getLocaleInfo(LCTYPE type, LPWSTR data, int size); int getLocaleInfo(LCTYPE type, LPWSTR data, int size);
QString getLocaleInfo(LCTYPE type, int maxlen = 0); // Need to distinguish empty QString packaged as (non-null) QVariant from null QVariant:
template <typename T = QString>
T getLocaleInfo(LCTYPE type, int maxlen = 0);
int getLocaleInfo_int(LCTYPE type, int maxlen = 0); int getLocaleInfo_int(LCTYPE type, int maxlen = 0);
int getCurrencyFormat(DWORD flags, LPCWSTR value, const CURRENCYFMTW *format, LPWSTR data, int size); int getCurrencyFormat(DWORD flags, LPCWSTR value, const CURRENCYFMTW *format, LPWSTR data, int size);
@ -211,19 +213,30 @@ inline int QSystemLocalePrivate::getLocaleInfo(LCTYPE type, LPWSTR data, int siz
#endif #endif
} }
QString QSystemLocalePrivate::getLocaleInfo(LCTYPE type, int maxlen) template<typename T>
T QSystemLocalePrivate::getLocaleInfo(LCTYPE type, int maxlen)
{ {
// https://docs.microsoft.com/en-us/windows/win32/intl/locale-spositivesign
// says empty for LOCALE_SPOSITIVESIGN means "+", although GetLocaleInfo()
// is documented to return 0 only on failure, so it's not clear how it
// returns empty to mean this; hence the two checks for it below.
const QString plus = QStringLiteral("+");
QVarLengthArray<wchar_t, 64> buf(maxlen ? maxlen : 64); QVarLengthArray<wchar_t, 64> buf(maxlen ? maxlen : 64);
if (!getLocaleInfo(type, buf.data(), buf.size())) if (!getLocaleInfo(type, buf.data(), buf.size())) {
return QString(); const auto lastError = GetLastError();
if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) { if (type == LOCALE_SPOSITIVESIGN && lastError == ERROR_SUCCESS)
return plus;
if (lastError != ERROR_INSUFFICIENT_BUFFER)
return {};
int cnt = getLocaleInfo(type, 0, 0); int cnt = getLocaleInfo(type, 0, 0);
if (cnt == 0) if (cnt == 0)
return QString(); return {};
buf.resize(cnt); buf.resize(cnt);
if (!getLocaleInfo(type, buf.data(), buf.size())) if (!getLocaleInfo(type, buf.data(), buf.size()))
return QString(); return {};
} }
if (type == LOCALE_SPOSITIVESIGN && !buf[0])
return plus;
return QString::fromWCharArray(buf.data()); return QString::fromWCharArray(buf.data());
} }
@ -298,7 +311,7 @@ QString &QSystemLocalePrivate::substituteDigits(QString &string)
return string; return string;
} }
QString QSystemLocalePrivate::zeroDigit() QVariant QSystemLocalePrivate::zeroDigit()
{ {
if (zero.isEmpty()) { if (zero.isEmpty()) {
/* Ten digits plus a terminator. /* Ten digits plus a terminator.
@ -317,24 +330,24 @@ QString QSystemLocalePrivate::zeroDigit()
return zero; return zero;
} }
QString QSystemLocalePrivate::decimalPoint() QVariant QSystemLocalePrivate::decimalPoint()
{ {
return getLocaleInfo(LOCALE_SDECIMAL); return getLocaleInfo<QVariant>(LOCALE_SDECIMAL);
} }
QString QSystemLocalePrivate::groupSeparator() QVariant QSystemLocalePrivate::groupSeparator()
{ {
return getLocaleInfo(LOCALE_STHOUSAND); return getLocaleInfo<QVariant>(LOCALE_STHOUSAND);
} }
QString QSystemLocalePrivate::negativeSign() QVariant QSystemLocalePrivate::negativeSign()
{ {
return getLocaleInfo(LOCALE_SNEGATIVESIGN); return getLocaleInfo<QVariant>(LOCALE_SNEGATIVESIGN);
} }
QString QSystemLocalePrivate::positiveSign() QVariant QSystemLocalePrivate::positiveSign()
{ {
return getLocaleInfo(LOCALE_SPOSITIVESIGN); return getLocaleInfo<QVariant>(LOCALE_SPOSITIVESIGN);
} }
QVariant QSystemLocalePrivate::dateFormat(QLocale::FormatType type) QVariant QSystemLocalePrivate::dateFormat(QLocale::FormatType type)
@ -392,10 +405,10 @@ QVariant QSystemLocalePrivate::dayName(int day, QLocale::FormatType type)
day -= 1; day -= 1;
if (type == QLocale::LongFormat) if (type == QLocale::LongFormat)
return getLocaleInfo(long_day_map[day]); return getLocaleInfo<QVariant>(long_day_map[day]);
if (type == QLocale::NarrowFormat) if (type == QLocale::NarrowFormat)
return getLocaleInfo(narrow_day_map[day]); return getLocaleInfo<QVariant>(narrow_day_map[day]);
return getLocaleInfo(short_day_map[day]); return getLocaleInfo<QVariant>(short_day_map[day]);
} }
QVariant QSystemLocalePrivate::monthName(int month, QLocale::FormatType type) QVariant QSystemLocalePrivate::monthName(int month, QLocale::FormatType type)
@ -418,7 +431,7 @@ QVariant QSystemLocalePrivate::monthName(int month, QLocale::FormatType type)
LCTYPE lctype = (type == QLocale::ShortFormat || type == QLocale::NarrowFormat) LCTYPE lctype = (type == QLocale::ShortFormat || type == QLocale::NarrowFormat)
? short_month_map[month] : long_month_map[month]; ? short_month_map[month] : long_month_map[month];
return getLocaleInfo(lctype); return getLocaleInfo<QVariant>(lctype);
} }
QVariant QSystemLocalePrivate::toString(QDate date, QLocale::FormatType type) QVariant QSystemLocalePrivate::toString(QDate date, QLocale::FormatType type)
@ -485,7 +498,7 @@ QVariant QSystemLocalePrivate::measurementSystem()
QVariant QSystemLocalePrivate::collation() QVariant QSystemLocalePrivate::collation()
{ {
return getLocaleInfo(LOCALE_SSORTLOCALE); return getLocaleInfo<QVariant>(LOCALE_SSORTLOCALE);
} }
QVariant QSystemLocalePrivate::amText() QVariant QSystemLocalePrivate::amText()
@ -687,12 +700,12 @@ QVariant QSystemLocalePrivate::uiLanguages()
QVariant QSystemLocalePrivate::nativeLanguageName() QVariant QSystemLocalePrivate::nativeLanguageName()
{ {
return getLocaleInfo(LOCALE_SNATIVELANGUAGENAME); return getLocaleInfo<QVariant>(LOCALE_SNATIVELANGUAGENAME);
} }
QVariant QSystemLocalePrivate::nativeCountryName() QVariant QSystemLocalePrivate::nativeCountryName()
{ {
return getLocaleInfo(LOCALE_SNATIVECOUNTRYNAME); return getLocaleInfo<QVariant>(LOCALE_SNATIVECOUNTRYNAME);
} }

View File

@ -682,7 +682,7 @@ static bool inDateTimeRange(qint64 jd, bool start)
return jd >= minDay && jd < maxDay; return jd >= minDay && jd < maxDay;
} }
static QDateTime toEarliest(const QDate &day, const QDateTime &form) static QDateTime toEarliest(QDate day, const QDateTime &form)
{ {
const Qt::TimeSpec spec = form.timeSpec(); const Qt::TimeSpec spec = form.timeSpec();
const int offset = (spec == Qt::OffsetFromUTC) ? form.offsetFromUtc() : 0; const int offset = (spec == Qt::OffsetFromUTC) ? form.offsetFromUtc() : 0;
@ -806,7 +806,7 @@ QDateTime QDate::startOfDay(const QTimeZone &zone) const
} }
#endif // timezone #endif // timezone
static QDateTime toLatest(const QDate &day, const QDateTime &form) static QDateTime toLatest(QDate day, const QDateTime &form)
{ {
const Qt::TimeSpec spec = form.timeSpec(); const Qt::TimeSpec spec = form.timeSpec();
const int offset = (spec == Qt::OffsetFromUTC) ? form.offsetFromUtc() : 0; const int offset = (spec == Qt::OffsetFromUTC) ? form.offsetFromUtc() : 0;
@ -1098,9 +1098,8 @@ QString QDate::longDayName(int weekday, MonthNameType type)
} }
#endif // textdate && deprecated #endif // textdate && deprecated
#if QT_CONFIG(datestring) #if QT_CONFIG(datestring) // depends on, so implies, textdate
#if QT_CONFIG(textdate)
static QString toStringTextDate(QDate date, QCalendar cal) static QString toStringTextDate(QDate date, QCalendar cal)
{ {
if (date.isValid()) { if (date.isValid()) {
@ -1114,9 +1113,8 @@ static QString toStringTextDate(QDate date, QCalendar cal)
} }
return QString(); return QString();
} }
#endif // textdate
static QString toStringIsoDate(const QDate &date) static QString toStringIsoDate(QDate date)
{ {
const auto parts = QCalendar().partsFromDate(date); const auto parts = QCalendar().partsFromDate(date);
if (parts.isValid() && parts.year >= 0 && parts.year <= 9999) if (parts.isValid() && parts.year >= 0 && parts.year <= 9999)
@ -1194,10 +1192,8 @@ QString QDate::toString(Qt::DateFormat format, QCalendar cal) const
case Qt::RFC2822Date: case Qt::RFC2822Date:
return QLocale::c().toString(*this, QStringView(u"dd MMM yyyy"), cal); return QLocale::c().toString(*this, QStringView(u"dd MMM yyyy"), cal);
default: default:
#ifndef QT_NO_TEXTDATE
case Qt::TextDate: case Qt::TextDate:
return toStringTextDate(*this, cal); return toStringTextDate(*this, cal);
#endif
case Qt::ISODate: case Qt::ISODate:
case Qt::ISODateWithMs: case Qt::ISODateWithMs:
// No calendar dependence // No calendar dependence
@ -1599,7 +1595,7 @@ qint64 QDate::daysTo(const QDate &d) const
\sa QTime::currentTime(), QDateTime::currentDateTime() \sa QTime::currentTime(), QDateTime::currentDateTime()
*/ */
#if QT_CONFIG(datestring) #if QT_CONFIG(datestring) // depends on, so implies, textdate
namespace { namespace {
struct ParsedInt { int value = 0; bool ok = false; }; struct ParsedInt { int value = 0; bool ok = false; };
@ -1661,7 +1657,6 @@ QDate QDate::fromString(const QString &string, Qt::DateFormat format)
case Qt::RFC2822Date: case Qt::RFC2822Date:
return rfcDateImpl(string).date; return rfcDateImpl(string).date;
default: default:
#if QT_CONFIG(textdate)
case Qt::TextDate: { case Qt::TextDate: {
QVector<QStringRef> parts = string.splitRef(QLatin1Char(' '), QString::SkipEmptyParts); QVector<QStringRef> parts = string.splitRef(QLatin1Char(' '), QString::SkipEmptyParts);
@ -1680,7 +1675,6 @@ QDate QDate::fromString(const QString &string, Qt::DateFormat format)
return QDate(year, month, day); return QDate(year, month, day);
} }
#endif // textdate
case Qt::ISODate: case Qt::ISODate:
// Semi-strict parsing, must be long enough and have punctuators as separators // Semi-strict parsing, must be long enough and have punctuators as separators
if (string.size() >= 10 && string.at(4).isPunct() && string.at(7).isPunct() if (string.size() >= 10 && string.at(4).isPunct() && string.at(7).isPunct()
@ -1995,7 +1989,7 @@ int QTime::msec() const
return ds() % 1000; return ds() % 1000;
} }
#if QT_CONFIG(datestring) #if QT_CONFIG(datestring) // depends on, so implies, textdate
/*! /*!
\overload \overload
@ -2327,7 +2321,7 @@ int QTime::msecsTo(const QTime &t) const
\sa QDateTime::currentDateTime(), QDateTime::currentDateTimeUtc() \sa QDateTime::currentDateTime(), QDateTime::currentDateTimeUtc()
*/ */
#if QT_CONFIG(datestring) #if QT_CONFIG(datestring) // depends on, so implies, textdate
static QTime fromIsoTimeString(QStringView string, Qt::DateFormat format, bool *isMidnight24) static QTime fromIsoTimeString(QStringView string, Qt::DateFormat format, bool *isMidnight24)
{ {
@ -2865,7 +2859,7 @@ static void msecsToTime(qint64 msecs, QDate *date, QTime *time)
} }
// Converts a date/time value into msecs // Converts a date/time value into msecs
static qint64 timeToMSecs(const QDate &date, const QTime &time) static qint64 timeToMSecs(QDate date, QTime time)
{ {
return ((date.toJulianDay() - JULIAN_DAY_FOR_EPOCH) * MSECS_PER_DAY) return ((date.toJulianDay() - JULIAN_DAY_FOR_EPOCH) * MSECS_PER_DAY)
+ time.msecsSinceStartOfDay(); + time.msecsSinceStartOfDay();
@ -3210,7 +3204,7 @@ static void setTimeSpec(QDateTimeData &d, Qt::TimeSpec spec, int offsetSeconds)
} }
} }
static void setDateTime(QDateTimeData &d, const QDate &date, const QTime &time) static void setDateTime(QDateTimeData &d, QDate date, QTime time)
{ {
// If the date is valid and the time is not we set time to 00:00:00 // If the date is valid and the time is not we set time to 00:00:00
QTime useTime = time; QTime useTime = time;
@ -4283,7 +4277,7 @@ void QDateTime::setTime_t(uint secsSince1Jan1970UTC)
} }
#endif #endif
#if QT_CONFIG(datestring) #if QT_CONFIG(datestring) // depends on, so implies, textdate
/*! /*!
\fn QString QDateTime::toString(Qt::DateFormat format) const \fn QString QDateTime::toString(Qt::DateFormat format) const
\fn QString QDateTime::toString(Qt::DateFormat format, QCalendar cal) const \fn QString QDateTime::toString(Qt::DateFormat format, QCalendar cal) const
@ -4363,7 +4357,6 @@ QString QDateTime::toString(Qt::DateFormat format, QCalendar cal) const
return buf; return buf;
} }
default: default:
#if QT_CONFIG(textdate)
case Qt::TextDate: { case Qt::TextDate: {
const QPair<QDate, QTime> p = getDateTime(d); const QPair<QDate, QTime> p = getDateTime(d);
buf = toStringTextDate(p.first, cal); buf = toStringTextDate(p.first, cal);
@ -4374,11 +4367,11 @@ QString QDateTime::toString(Qt::DateFormat format, QCalendar cal) const
switch (timeSpec()) { switch (timeSpec()) {
case Qt::LocalTime: case Qt::LocalTime:
break; break;
# if QT_CONFIG(timezone) #if QT_CONFIG(timezone)
case Qt::TimeZone: case Qt::TimeZone:
buf += QLatin1Char(' ') + d->m_timeZone.abbreviation(*this); buf += QLatin1Char(' ') + d->m_timeZone.abbreviation(*this);
break; break;
# endif #endif
default: default:
buf += QLatin1String(" GMT"); buf += QLatin1String(" GMT");
if (getSpec(d) == Qt::OffsetFromUTC) if (getSpec(d) == Qt::OffsetFromUTC)
@ -4386,7 +4379,6 @@ QString QDateTime::toString(Qt::DateFormat format, QCalendar cal) const
} }
return buf; return buf;
} }
#endif
case Qt::ISODate: case Qt::ISODate:
case Qt::ISODateWithMs: { case Qt::ISODateWithMs: {
// No calendar dependence // No calendar dependence
@ -5212,7 +5204,7 @@ int QDateTime::utcOffset() const
} }
#endif // QT_DEPRECATED_SINCE #endif // QT_DEPRECATED_SINCE
#if QT_CONFIG(datestring) #if QT_CONFIG(datestring) // depends on, so implies, textdate
/*! /*!
Returns the QDateTime represented by the \a string, using the Returns the QDateTime represented by the \a string, using the
@ -5323,7 +5315,6 @@ QDateTime QDateTime::fromString(const QString &string, Qt::DateFormat format)
date = date.addDays(1); date = date.addDays(1);
return QDateTime(date, time, spec, offset); return QDateTime(date, time, spec, offset);
} }
#if QT_CONFIG(textdate)
case Qt::TextDate: { case Qt::TextDate: {
QVector<QStringRef> parts = string.splitRef(QLatin1Char(' '), QString::SkipEmptyParts); QVector<QStringRef> parts = string.splitRef(QLatin1Char(' '), QString::SkipEmptyParts);
@ -5429,7 +5420,6 @@ QDateTime QDateTime::fromString(const QString &string, Qt::DateFormat format)
return QDateTime(date, time, Qt::UTC); return QDateTime(date, time, Qt::UTC);
} }
} }
#endif // textdate
} }
return QDateTime(); return QDateTime();

View File

@ -903,7 +903,7 @@ QDateTimeParser::parseSection(const QDateTime &currentValue, int sectionIndex,
by \a weekDay. by \a weekDay.
*/ */
static int weekDayWithinMonth(const QCalendar &calendar, const QDate &rough, int weekDay) static int weekDayWithinMonth(QCalendar calendar, QDate rough, int weekDay)
{ {
// TODO: can we adapt this to cope gracefully with intercallary days (day of // TODO: can we adapt this to cope gracefully with intercallary days (day of
// week > 7) without making it slower for more widely-used calendars ? // week > 7) without making it slower for more widely-used calendars ?

View File

@ -363,7 +363,7 @@ QDate calculateTransitionLocalDate(const SYSTEMTIME &rule, int year)
} }
// Converts a date/time value into msecs // Converts a date/time value into msecs
inline qint64 timeToMSecs(const QDate &date, const QTime &time) inline qint64 timeToMSecs(QDate date, QTime time)
{ {
return ((date.toJulianDay() - JULIAN_DAY_FOR_EPOCH) * MSECS_PER_DAY) return ((date.toJulianDay() - JULIAN_DAY_FOR_EPOCH) * MSECS_PER_DAY)
+ time.msecsSinceStartOfDay(); + time.msecsSinceStartOfDay();

View File

@ -305,7 +305,7 @@ void QBitArray::fill(bool value, int begin, int end)
\since 5.11 \since 5.11
Returns a pointer to a dense bit array for this QBitArray. Bits are counted Returns a pointer to a dense bit array for this QBitArray. Bits are counted
upwards from the least significant bit in each byte. The the number of bits upwards from the least significant bit in each byte. The number of bits
relevant in the last byte is given by \c{size() % 8}. relevant in the last byte is given by \c{size() % 8}.
\sa fromBits(), size() \sa fromBits(), size()

View File

@ -97,7 +97,7 @@ qtConfig(png) {
MIPS_DSPR2_ASM += image/qimage_mips_dspr2_asm.S MIPS_DSPR2_ASM += image/qimage_mips_dspr2_asm.S
} else { } else {
# see https://developer.android.com/ndk/guides/abis # see https://developer.android.com/ndk/guides/abis
arm64-v8a { arm64-v8a | armeabi-v7a {
SOURCES += image/qimage_neon.cpp SOURCES += image/qimage_neon.cpp
} }
x86 | x86_64 { x86 | x86_64 {

View File

@ -1527,7 +1527,7 @@ QDebug operator<<(QDebug dbg, const QIcon &i)
\internal \internal
\since 5.6 \since 5.6
Attempts to find a suitable @Nx file for the given \a targetDevicePixelRatio Attempts to find a suitable @Nx file for the given \a targetDevicePixelRatio
Returns the the \a baseFileName if no such file was found. Returns the \a baseFileName if no such file was found.
Given base foo.png and a target dpr of 2.5, this function will look for Given base foo.png and a target dpr of 2.5, this function will look for
foo@3x.png, then foo@2x, then fall back to foo.png if not found. foo@3x.png, then foo@2x, then fall back to foo.png if not found.

View File

@ -1621,7 +1621,9 @@ const uchar *QImage::scanLine(int i) const
Returns a pointer to the pixel data at the scanline with index \a Returns a pointer to the pixel data at the scanline with index \a
i. The first scanline is at index 0. i. The first scanline is at index 0.
The scanline data is aligned on a 32-bit boundary. The scanline data is as minimum 32-bit aligned. For 64-bit formats
it follows the native alignment of 64-bit integers (64-bit for most
platforms, but notably 32-bit on i386).
Note that QImage uses \l{Implicit Data Sharing} {implicit data Note that QImage uses \l{Implicit Data Sharing} {implicit data
sharing}, but this function does \e not perform a deep copy of the sharing}, but this function does \e not perform a deep copy of the

View File

@ -606,7 +606,7 @@ bool QPngHandlerPrivate::readPngHeader()
#endif #endif
png_uint_32 profLen; png_uint_32 profLen;
png_get_iCCP(png_ptr, info_ptr, &name, &compressionType, &profileData, &profLen); png_get_iCCP(png_ptr, info_ptr, &name, &compressionType, &profileData, &profLen);
colorSpace = QColorSpace::fromIccProfile(QByteArray::fromRawData((const char *)profileData, profLen)); colorSpace = QColorSpace::fromIccProfile(QByteArray((const char *)profileData, profLen));
if (!colorSpace.isValid()) { if (!colorSpace.isValid()) {
qWarning() << "QPngHandler: Failed to parse ICC profile"; qWarning() << "QPngHandler: Failed to parse ICC profile";
} else { } else {

View File

@ -485,7 +485,7 @@ QT_BEGIN_NAMESPACE
/*! /*!
\fn ByteOrder QPixelFormat::byteOrder() const \fn ByteOrder QPixelFormat::byteOrder() const
The byte order is almost always set the the byte order of the current The byte order is almost always set the byte order of the current
system. However, it can be useful to describe some YUV formats. This system. However, it can be useful to describe some YUV formats. This
function should never return QPixelFormat::CurrentSystemEndian as this function should never return QPixelFormat::CurrentSystemEndian as this
value is translated to a endian value in the constructor. value is translated to a endian value in the constructor.

View File

@ -740,7 +740,7 @@ QRect QPlatformWindow::initialGeometry(const QWindow *w, const QRect &initialGeo
QPlatformWindow subclasses can re-implement this function to QPlatformWindow subclasses can re-implement this function to
provide display refresh synchronized updates. The event provide display refresh synchronized updates. The event
should be delivered using QPlatformWindow::deliverUpdateRequest() should be delivered using QPlatformWindow::deliverUpdateRequest()
to not get out of sync with the the internal state of QWindow. to not get out of sync with the internal state of QWindow.
The default implementation posts an UpdateRequest event to the The default implementation posts an UpdateRequest event to the
window after 5 ms. The additional time is there to give the event window after 5 ms. The additional time is there to give the event

View File

@ -149,6 +149,8 @@ QScreen::~QScreen()
/*! /*!
Get the platform screen handle. Get the platform screen handle.
\sa {Qt Platform Abstraction}{Qt Platform Abstraction (QPA)}
*/ */
QPlatformScreen *QScreen::handle() const QPlatformScreen *QScreen::handle() const
{ {

View File

@ -161,7 +161,7 @@ gcc:equals(QT_GCC_MAJOR_VERSION, 5) {
DEFINES += QT_COMPILER_SUPPORTS_SSE4_1 QT_COMPILER_SUPPORTS_SSE4_2 DEFINES += QT_COMPILER_SUPPORTS_SSE4_1 QT_COMPILER_SUPPORTS_SSE4_2
SOURCES += painting/qdrawhelper_sse4.cpp painting/qimagescale_sse4.cpp SOURCES += painting/qdrawhelper_sse4.cpp painting/qimagescale_sse4.cpp
} }
arm64-v8a { arm64-v8a | armeabi-v7a {
SOURCES += painting/qdrawhelper_neon.cpp painting/qimagescale_neon.cpp SOURCES += painting/qdrawhelper_neon.cpp painting/qimagescale_neon.cpp
HEADERS += painting/qdrawhelper_neon_p.h HEADERS += painting/qdrawhelper_neon_p.h
} }

View File

@ -281,7 +281,7 @@ QSize QBackingStore::size() const
bool QBackingStore::scroll(const QRegion &area, int dx, int dy) bool QBackingStore::scroll(const QRegion &area, int dx, int dy)
{ {
// Disable scrolling for non-integer scroll deltas. For this case // Disable scrolling for non-integer scroll deltas. For this case
// the the existing rendered pixels can't be re-used, and we return // the existing rendered pixels can't be re-used, and we return
// false to signal that a repaint is needed. // false to signal that a repaint is needed.
const qreal nativeDx = QHighDpi::toNativePixels(qreal(dx), d_ptr->window); const qreal nativeDx = QHighDpi::toNativePixels(qreal(dx), d_ptr->window);
const qreal nativeDy = QHighDpi::toNativePixels(qreal(dy), d_ptr->window); const qreal nativeDy = QHighDpi::toNativePixels(qreal(dy), d_ptr->window);

View File

@ -1652,7 +1652,7 @@ QRhiTextureUploadDescription::QRhiTextureUploadDescription(const QRhiTextureUplo
Constructs a texture upload description with the specified \a list of entries. Constructs a texture upload description with the specified \a list of entries.
\note \a list can also contain multiple QRhiTextureUploadEntry elements \note \a list can also contain multiple QRhiTextureUploadEntry elements
with the the same layer and level. This makes sense when those uploads are with the same layer and level. This makes sense when those uploads are
partial, meaning their subresource description has a source size or image partial, meaning their subresource description has a source size or image
smaller than the subresource dimensions, and can be more efficient than smaller than the subresource dimensions, and can be more efficient than
issuing separate uploadTexture()'s. issuing separate uploadTexture()'s.
@ -3505,7 +3505,7 @@ QRhiResource::Type QRhiGraphicsPipeline::resourceType() const
\l{QSurfaceFormat::sRGBColorSpace}{sRGBColorSpace} on the QSurfaceFormat of \l{QSurfaceFormat::sRGBColorSpace}{sRGBColorSpace} on the QSurfaceFormat of
the QWindow in addition. the QWindow in addition.
\value UsedAsTransferSource Indicates the the swapchain will be used as the \value UsedAsTransferSource Indicates the swapchain will be used as the
source of a readback in QRhiResourceUpdateBatch::readBackTexture(). source of a readback in QRhiResourceUpdateBatch::readBackTexture().
\value NoVSync Requests disabling waiting for vertical sync, also avoiding \value NoVSync Requests disabling waiting for vertical sync, also avoiding
@ -3622,7 +3622,7 @@ QRhiResource::Type QRhiSwapChain::resourceType() const
\fn QRhiRenderTarget *QRhiSwapChain::currentFrameRenderTarget() \fn QRhiRenderTarget *QRhiSwapChain::currentFrameRenderTarget()
\return a render target that can used with beginPass() in order to render \return a render target that can used with beginPass() in order to render
the the swapchain's current backbuffer. Only valid within a the swapchain's current backbuffer. Only valid within a
QRhi::beginFrame() - QRhi::endFrame() block where beginFrame() was called QRhi::beginFrame() - QRhi::endFrame() block where beginFrame() was called
with this swapchain. with this swapchain.
@ -4448,7 +4448,7 @@ void QRhiResourceUpdateBatch::generateMips(QRhiTexture *tex, int layer)
recorded. recorded.
\note the return value is not owned by the caller and must never be \note the return value is not owned by the caller and must never be
destroyed. Instead, the batch is returned the the pool for reuse by passing destroyed. Instead, the batch is returned the pool for reuse by passing
it to QRhiCommandBuffer::beginPass(), QRhiCommandBuffer::endPass(), or it to QRhiCommandBuffer::beginPass(), QRhiCommandBuffer::endPass(), or
QRhiCommandBuffer::resourceUpdate(), or by calling QRhiCommandBuffer::resourceUpdate(), or by calling
QRhiResourceUpdateBatch::release() on it. QRhiResourceUpdateBatch::release() on it.

View File

@ -397,10 +397,12 @@ int QTextMarkdownImporter::cbEnterSpan(int spanType, void *det)
break; break;
case MD_SPAN_A: { case MD_SPAN_A: {
MD_SPAN_A_DETAIL *detail = static_cast<MD_SPAN_A_DETAIL *>(det); MD_SPAN_A_DETAIL *detail = static_cast<MD_SPAN_A_DETAIL *>(det);
QString url = QString::fromLatin1(detail->href.text, int(detail->href.size)); QString url = QString::fromUtf8(detail->href.text, int(detail->href.size));
QString title = QString::fromLatin1(detail->title.text, int(detail->title.size)); QString title = QString::fromUtf8(detail->title.text, int(detail->title.size));
charFmt.setAnchor(true);
charFmt.setAnchorHref(url); charFmt.setAnchorHref(url);
charFmt.setAnchorNames(QStringList(title)); if (!title.isEmpty())
charFmt.setToolTip(title);
charFmt.setForeground(m_palette.link()); charFmt.setForeground(m_palette.link());
qCDebug(lcMD) << "anchor" << url << title; qCDebug(lcMD) << "anchor" << url << title;
} break; } break;

View File

@ -56,10 +56,13 @@ QT_BEGIN_NAMESPACE
Q_LOGGING_CATEGORY(lcMDW, "qt.text.markdown.writer") Q_LOGGING_CATEGORY(lcMDW, "qt.text.markdown.writer")
static const QChar Space = QLatin1Char(' '); static const QChar Space = QLatin1Char(' ');
static const QChar Tab = QLatin1Char('\t');
static const QChar Newline = QLatin1Char('\n'); static const QChar Newline = QLatin1Char('\n');
static const QChar CarriageReturn = QLatin1Char('\r');
static const QChar LineBreak = QChar(0x2028); static const QChar LineBreak = QChar(0x2028);
static const QChar DoubleQuote = QLatin1Char('"'); static const QChar DoubleQuote = QLatin1Char('"');
static const QChar Backtick = QLatin1Char('`'); static const QChar Backtick = QLatin1Char('`');
static const QChar Backslash = QLatin1Char('\\');
static const QChar Period = QLatin1Char('.'); static const QChar Period = QLatin1Char('.');
QTextMarkdownWriter::QTextMarkdownWriter(QTextStream &stream, QTextDocument::MarkdownFeatures features) QTextMarkdownWriter::QTextMarkdownWriter(QTextStream &stream, QTextDocument::MarkdownFeatures features)
@ -291,6 +294,72 @@ static void maybeEscapeFirstChar(QString &s)
} }
} }
struct LineEndPositions {
const QChar *lineEnd;
const QChar *nextLineBegin;
};
static LineEndPositions findLineEnd(const QChar *begin, const QChar *end)
{
LineEndPositions result{ end, end };
while (begin < end) {
if (*begin == Newline) {
result.lineEnd = begin;
result.nextLineBegin = begin + 1;
break;
} else if (*begin == CarriageReturn) {
result.lineEnd = begin;
result.nextLineBegin = begin + 1;
if (((begin + 1) < end) && begin[1] == Newline)
++result.nextLineBegin;
break;
}
++begin;
}
return result;
}
static bool isBlankLine(const QChar *begin, const QChar *end)
{
while (begin < end) {
if (*begin != Space && *begin != Tab)
return false;
++begin;
}
return true;
}
static QString createLinkTitle(const QString &title)
{
QString result;
result.reserve(title.size() + 2);
result += DoubleQuote;
const QChar *data = title.data();
const QChar *end = data + title.size();
while (data < end) {
const auto lineEndPositions = findLineEnd(data, end);
if (!isBlankLine(data, lineEndPositions.lineEnd)) {
while (data < lineEndPositions.nextLineBegin) {
if (*data == DoubleQuote)
result += Backslash;
result += *data;
++data;
}
}
data = lineEndPositions.nextLineBegin;
}
result += DoubleQuote;
return result;
}
int QTextMarkdownWriter::writeBlock(const QTextBlock &block, bool wrap, bool ignoreFormat, bool ignoreEmpty) int QTextMarkdownWriter::writeBlock(const QTextBlock &block, bool wrap, bool ignoreFormat, bool ignoreEmpty)
{ {
if (block.text().isEmpty() && ignoreEmpty) if (block.text().isEmpty() && ignoreEmpty)
@ -445,7 +514,12 @@ int QTextMarkdownWriter::writeBlock(const QTextBlock &block, bool wrap, bool ign
col += s.length(); col += s.length();
} else if (fmt.hasProperty(QTextFormat::AnchorHref)) { } else if (fmt.hasProperty(QTextFormat::AnchorHref)) {
QString s = QLatin1Char('[') + fragmentText + QLatin1String("](") + QString s = QLatin1Char('[') + fragmentText + QLatin1String("](") +
fmt.property(QTextFormat::AnchorHref).toString() + QLatin1Char(')'); fmt.property(QTextFormat::AnchorHref).toString();
if (fmt.hasProperty(QTextFormat::TextToolTip)) {
s += Space;
s += createLinkTitle(fmt.property(QTextFormat::TextToolTip).toString());
}
s += QLatin1Char(')');
if (wrap && col + s.length() > ColumnLimit) { if (wrap && col + s.length() > ColumnLimit) {
m_stream << Newline << wrapIndentString; m_stream << Newline << wrapIndentString;
col = m_wrappedLineIndent; col = m_wrappedLineIndent;

View File

@ -141,7 +141,7 @@ QSslPreSharedKeyAuthenticator &QSslPreSharedKeyAuthenticator::operator=(const QS
/*! /*!
\fn QSslPreSharedKeyAuthenticator &QSslPreSharedKeyAuthenticator::operator=(QSslPreSharedKeyAuthenticator &&authenticator) \fn QSslPreSharedKeyAuthenticator &QSslPreSharedKeyAuthenticator::operator=(QSslPreSharedKeyAuthenticator &&authenticator)
Move-assigns the the QSslPreSharedKeyAuthenticator object \a authenticator to this Move-assigns the QSslPreSharedKeyAuthenticator object \a authenticator to this
object, and returns a reference to the moved instance. object, and returns a reference to the moved instance.
*/ */

View File

@ -511,7 +511,7 @@ static void executeBlockWithoutAnimation(Block block)
- (void)createLoupe - (void)createLoupe
{ {
// We magnify the the desktop view. But the loupe itself will be added as a child // We magnify the desktop view. But the loupe itself will be added as a child
// of the desktop view's parent, so it doesn't become a part of what we magnify. // of the desktop view's parent, so it doesn't become a part of what we magnify.
_loupeLayer = [[self createLoupeLayer] retain]; _loupeLayer = [[self createLoupeLayer] retain];
_loupeLayer.targetView = _desktopView; _loupeLayer.targetView = _desktopView;

View File

@ -452,7 +452,7 @@
if (!focusWindow->screen() || focusWindow->screen()->handle() != self.platformScreen) if (!focusWindow->screen() || focusWindow->screen()->handle() != self.platformScreen)
return; return;
// All decisions are based on the the top level window // All decisions are based on the top level window
focusWindow = qt_window_private(focusWindow)->topLevelWindow(); focusWindow = qt_window_private(focusWindow)->topLevelWindow();
#ifndef Q_OS_TVOS #ifndef Q_OS_TVOS

View File

@ -133,7 +133,7 @@ QWasmIntegration::QWasmIntegration()
Q_UNUSED(userData); Q_UNUSED(userData);
// This resize event is called when the HTML window is resized. Depending // This resize event is called when the HTML window is resized. Depending
// on the page layout the the canvas(es) might also have been resized, so we // on the page layout the canvas(es) might also have been resized, so we
// update the Qt screen sizes (and canvas render sizes). // update the Qt screen sizes (and canvas render sizes).
if (QWasmIntegration *integration = QWasmIntegration::get()) if (QWasmIntegration *integration = QWasmIntegration::get())
integration->resizeAllScreens(); integration->resizeAllScreens();

View File

@ -52,9 +52,10 @@ QString QWasmString::toQString(const val &v)
val::global("Module")["stringToUTF16"]); val::global("Module")["stringToUTF16"]);
static const val length("length"); static const val length("length");
result.resize(v[length].as<int>()); int len = v[length].as<int>();
result.resize(len);
auto ptr = quintptr(result.utf16()); auto ptr = quintptr(result.utf16());
stringToUTF16(v, val(ptr)); stringToUTF16(v, val(ptr), val((len + 1) * 2));
return result; return result;
} }

View File

@ -250,7 +250,7 @@ static QDateTime fromTimeStamp(char *buffer)
return QDateTime(d, t); return QDateTime(d, t);
} }
static ISC_TIME toTime(const QTime &t) static ISC_TIME toTime(QTime t)
{ {
static const QTime midnight(0, 0, 0, 0); static const QTime midnight(0, 0, 0, 0);
return (ISC_TIME)midnight.msecsTo(t) * 10; return (ISC_TIME)midnight.msecsTo(t) * 10;
@ -266,7 +266,7 @@ static QTime fromTime(char *buffer)
return t; return t;
} }
static ISC_DATE toDate(const QDate &t) static ISC_DATE toDate(QDate t)
{ {
static const QDate basedate(1858, 11, 17); static const QDate basedate(1858, 11, 17);
ISC_DATE date; ISC_DATE date;

View File

@ -48,7 +48,11 @@
** **
****************************************************************************/ ****************************************************************************/
#include <QtGui> #include <QtWidgets>
#include <QtPrintSupport/qtprintsupportglobal.h>
#if QT_CONFIG(printdialog)
#include <QPrinter>
#endif
int main(int argc, char **argv) int main(int argc, char **argv)
{ {

View File

@ -48,9 +48,14 @@
** **
****************************************************************************/ ****************************************************************************/
#include <QtGui>
#include "object.h" #include "object.h"
#include <QtWidgets>
#include <QtPrintSupport/qtprintsupportglobal.h>
#if QT_CONFIG(printdialog)
#include <QPrinter>
#endif
Object::Object(QObject *parent) Object::Object(QObject *parent)
: QObject(parent) : QObject(parent)
{ {

View File

@ -48,7 +48,6 @@
** **
****************************************************************************/ ****************************************************************************/
#include <QtGui>
#include <QtWidgets> #include <QtWidgets>
#include <QtPrintSupport/qtprintsupportglobal.h> #include <QtPrintSupport/qtprintsupportglobal.h>
#if QT_CONFIG(printdialog) #if QT_CONFIG(printdialog)
@ -61,11 +60,12 @@ class Window : public QWidget
Q_OBJECT Q_OBJECT
public: public:
Window() { Window()
{
myWidget = new QPushButton("Print Me"); myWidget = new QPushButton("Print Me");
connect(myWidget, SIGNAL(clicked()), this, SLOT(print())); connect(myWidget, &QPushButton::clicked, this, &Window::print);
myWidget2 = new QPushButton("Print Document"); myWidget2 = new QPushButton("Print Document");
connect(myWidget2, SIGNAL(clicked()), this, SLOT(printFile())); connect(myWidget2, &QPushButton::clicked, this, &Window::printFile);
editor = new QTextEdit(this); editor = new QTextEdit(this);
QVBoxLayout *layout = new QVBoxLayout; QVBoxLayout *layout = new QVBoxLayout;
@ -76,8 +76,9 @@ public:
} }
private slots: private slots:
void print() { void print()
#if !defined(QT_NO_PRINTER) {
#if defined(QT_PRINTSUPPORT_LIB) && QT_CONFIG(printer)
QPrinter printer(QPrinter::HighResolution); QPrinter printer(QPrinter::HighResolution);
printer.setOutputFileName("test.pdf"); printer.setOutputFileName("test.pdf");
@ -85,8 +86,8 @@ private slots:
//! [0] //! [0]
QPainter painter; QPainter painter;
painter.begin(&printer); painter.begin(&printer);
double xscale = printer.pageRect().width()/double(myWidget->width()); double xscale = printer.pageRect().width() / double(myWidget->width());
double yscale = printer.pageRect().height()/double(myWidget->height()); double yscale = printer.pageRect().height() / double(myWidget->height());
double scale = qMin(xscale, yscale); double scale = qMin(xscale, yscale);
painter.translate(printer.paperRect().x() + printer.pageRect().width()/2, painter.translate(printer.paperRect().x() + printer.pageRect().width()/2,
printer.paperRect().y() + printer.pageRect().height()/2); printer.paperRect().y() + printer.pageRect().height()/2);
@ -98,8 +99,9 @@ private slots:
#endif #endif
} }
void printFile() { void printFile()
#if QT_CONFIG(printdialog) {
#if defined(QT_PRINTSUPPORT_LIB) && QT_CONFIG(printdialog)
//! [1] //! [1]
QPrinter printer; QPrinter printer;

View File

@ -208,8 +208,8 @@
When you distribute your application, remember to include libmysql.dll / libmariadb.dll When you distribute your application, remember to include libmysql.dll / libmariadb.dll
in your installation package. It must be placed in the same folder in your installation package. It must be placed in the same folder
as the application executable. \e libmysql.dll additionally needs the as the application executable. \e libmysql.dll additionally needs the
MSVC runtime libraries which can be installed with vcredist.exe MSVC runtime libraries which can be installed with
(\l {https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads}{vcredist.exe} \l {https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads}{vcredist.exe}
\target QOCI \target QOCI
\section2 QOCI for the Oracle Call Interface (OCI) \section2 QOCI for the Oracle Call Interface (OCI)

View File

@ -1337,7 +1337,7 @@ char *toPrettyCString(const char *p, int length)
// 3 bytes: "" and a character // 3 bytes: "" and a character
// 4 bytes: an hex escape sequence (\xHH) // 4 bytes: an hex escape sequence (\xHH)
if (dst - buffer.data() > 246) { if (dst - buffer.data() > 246) {
// plus the the quote, the three dots and NUL, it's 255 in the worst case // plus the quote, the three dots and NUL, it's 255 in the worst case
trimmed = true; trimmed = true;
break; break;
} }
@ -1430,7 +1430,7 @@ char *toPrettyUnicode(QStringView string)
*dst++ = '"'; *dst++ = '"';
for ( ; p != end; ++p) { for ( ; p != end; ++p) {
if (dst - buffer.data() > 245) { if (dst - buffer.data() > 245) {
// plus the the quote, the three dots and NUL, it's 250, 251 or 255 // plus the quote, the three dots and NUL, it's 250, 251 or 255
trimmed = true; trimmed = true;
break; break;
} }

View File

@ -797,7 +797,7 @@ QString QFileSystemModelPrivate::time(const QModelIndex &index) const
if (!index.isValid()) if (!index.isValid())
return QString(); return QString();
#if QT_CONFIG(datestring) #if QT_CONFIG(datestring)
return node(index)->lastModified().toString(Qt::SystemLocaleDate); return QLocale::system().toString(node(index)->lastModified(), QLocale::ShortFormat);
#else #else
Q_UNUSED(index); Q_UNUSED(index);
return QString(); return QString();

View File

@ -1321,7 +1321,7 @@ QString QDirModelPrivate::type(const QModelIndex &index) const
QString QDirModelPrivate::time(const QModelIndex &index) const QString QDirModelPrivate::time(const QModelIndex &index) const
{ {
#if QT_CONFIG(datestring) #if QT_CONFIG(datestring)
return node(index)->info.lastModified().toString(Qt::LocalDate); return QLocale::system().toString(node(index)->info.lastModified(), QLocale::ShortFormat);
#else #else
Q_UNUSED(index); Q_UNUSED(index);
return QString(); return QString();

View File

@ -379,7 +379,7 @@ QT_BEGIN_NAMESPACE
This is naturally not the only possible solution. One alternative is to use This is naturally not the only possible solution. One alternative is to use
the \l{QOpenGLContext::aboutToBeDestroyed()}{aboutToBeDestroyed()} signal of the \l{QOpenGLContext::aboutToBeDestroyed()}{aboutToBeDestroyed()} signal of
QOpenGLContext. By connecting a slot, using direct connection, to this signal, QOpenGLContext. By connecting a slot, using direct connection, to this signal,
it is possible to perform cleanup whenever the the underlying native context it is possible to perform cleanup whenever the underlying native context
handle, or the entire QOpenGLContext instance, is going to be released. The handle, or the entire QOpenGLContext instance, is going to be released. The
following snippet is in principle equivalent to the previous one: following snippet is in principle equivalent to the previous one:

View File

@ -6309,7 +6309,7 @@ void QWidget::setFocus(Qt::FocusReason reason)
previousProxyFocus = topData->proxyWidget->widget()->focusWidget(); previousProxyFocus = topData->proxyWidget->widget()->focusWidget();
if (previousProxyFocus && previousProxyFocus->focusProxy()) if (previousProxyFocus && previousProxyFocus->focusProxy())
previousProxyFocus = previousProxyFocus->focusProxy(); previousProxyFocus = previousProxyFocus->focusProxy();
if (previousProxyFocus == this && !topData->proxyWidget->d_func()->proxyIsGivingFocus) if (previousProxyFocus == f && !topData->proxyWidget->d_func()->proxyIsGivingFocus)
return; return;
} }
} }

View File

@ -2416,7 +2416,7 @@ void QFusionStyle::drawComplexControl(ComplexControl control, const QStyleOption
QStyle::State oldState = static_cast<QStyle::State>(qvariant_cast<QStyle::State::Int>(styleObject->property("_q_stylestate"))); QStyle::State oldState = static_cast<QStyle::State>(qvariant_cast<QStyle::State::Int>(styleObject->property("_q_stylestate")));
uint oldActiveControls = styleObject->property("_q_stylecontrols").toUInt(); uint oldActiveControls = styleObject->property("_q_stylecontrols").toUInt();
// a scrollbar is transient when the the scrollbar itself and // a scrollbar is transient when the scrollbar itself and
// its sibling are both inactive (ie. not pressed/hovered/moved) // its sibling are both inactive (ie. not pressed/hovered/moved)
bool transient = !option->activeSubControls && !(option->state & State_On); bool transient = !option->activeSubControls && !(option->state & State_On);

View File

@ -1646,7 +1646,7 @@ QStyleOptionProgressBar::QStyleOptionProgressBar(int version)
the default orentation is Qt::Horizontal the default orentation is Qt::Horizontal
\deprecated \deprecated
Use the QStyle::State_Horizontal flag instead (in the the QStyleOption::state member). Use the QStyle::State_Horizontal flag instead (in the QStyleOption::state member).
\sa QProgressBar::orientation \sa QProgressBar::orientation
*/ */

View File

@ -2136,7 +2136,7 @@ void QWindowsStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComp
#if QT_CONFIG(combobox) #if QT_CONFIG(combobox)
case CC_ComboBox: case CC_ComboBox:
if (const QStyleOptionComboBox *cmb = qstyleoption_cast<const QStyleOptionComboBox *>(opt)) { if (const QStyleOptionComboBox *cmb = qstyleoption_cast<const QStyleOptionComboBox *>(opt)) {
QBrush editBrush = cmb->palette.brush(QPalette::Base); QBrush editBrush = cmb->palette.brush(QPalette::Button);
if ((cmb->subControls & SC_ComboBoxFrame)) { if ((cmb->subControls & SC_ComboBoxFrame)) {
if (cmb->frame) { if (cmb->frame) {
QPalette shadePal = opt->palette; QPalette shadePal = opt->palette;

View File

@ -1272,6 +1272,7 @@ QString QTextEdit::toHtml() const
The default is \c MarkdownDialectGitHub. The default is \c MarkdownDialectGitHub.
\sa plainText, html, QTextDocument::toMarkdown(), QTextDocument::setMarkdown() \sa plainText, html, QTextDocument::toMarkdown(), QTextDocument::setMarkdown()
\since 5.14
*/ */
#endif #endif

View File

@ -1,6 +1,6 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2019 The Qt Company Ltd. ** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/ ** Contact: https://www.qt.io/licensing/
** **
** This file is part of the test suite of the Qt Toolkit. ** This file is part of the test suite of the Qt Toolkit.
@ -1869,14 +1869,16 @@ void tst_QLocale::toDateTime()
// Format number string according to system locale settings. // Format number string according to system locale settings.
// Expected in format is US "1,234.56". // Expected in format is US "1,234.56".
QString systemLocaleFormatNumber(const QString &numberString) QString systemLocaleFormatNumber(QString &&numberString)
{ {
QLocale locale = QLocale::system(); QLocale locale = QLocale::system();
QString numberStringCopy = numberString; QString numberStringMunged =
return numberStringCopy.replace(QChar(','), QChar('G')) numberString.replace(QChar(','), QChar('G')).replace(QChar('.'), QChar('D'));
.replace(QChar('.'), QChar('D')) if (locale.numberOptions() & QLocale::OmitGroupSeparator)
.replace(QChar('G'), locale.groupSeparator()) numberStringMunged.remove(QLatin1Char('G'));
.replace(QChar('D'), locale.decimalPoint()); else
numberStringMunged.replace(QChar('G'), locale.groupSeparator());
return numberStringMunged.replace(QChar('D'), locale.decimalPoint());
} }
void tst_QLocale::macDefaultLocale() void tst_QLocale::macDefaultLocale()
@ -1899,12 +1901,14 @@ void tst_QLocale::macDefaultLocale()
// independently of the locale. Verify that they have one of the // independently of the locale. Verify that they have one of the
// allowed values and are not the same. // allowed values and are not the same.
QVERIFY(locale.decimalPoint() == QChar('.') || locale.decimalPoint() == QChar(',')); QVERIFY(locale.decimalPoint() == QChar('.') || locale.decimalPoint() == QChar(','));
if (!(locale.numberOptions() & QLocale::OmitGroupSeparator)) {
QVERIFY(locale.groupSeparator() == QChar(',') QVERIFY(locale.groupSeparator() == QChar(',')
|| locale.groupSeparator() == QChar('.') || locale.groupSeparator() == QChar('.')
|| locale.groupSeparator() == QChar('\xA0') // no-breaking space || locale.groupSeparator() == QChar('\xA0') // no-breaking space
|| locale.groupSeparator() == QChar('\'') || locale.groupSeparator() == QChar('\'')
|| locale.groupSeparator() == QChar()); || locale.groupSeparator() == QChar());
QVERIFY(locale.decimalPoint() != locale.groupSeparator()); QVERIFY(locale.decimalPoint() != locale.groupSeparator());
}
// make sure we are using the system to parse them // make sure we are using the system to parse them
QCOMPARE(locale.toString(1234.56), systemLocaleFormatNumber(QString("1,234.56"))); QCOMPARE(locale.toString(1234.56), systemLocaleFormatNumber(QString("1,234.56")));

View File

@ -0,0 +1,25 @@
A series of links.
[link](/uri)
[link]()
[link](/uri "title")
[link](/uri "àbcdè")
[link](/uri "title title \" title title")
[link](/url "title \"&quot;")
[link](/url "title
title
title title
\"title\" title \"
title")
* [link](/url "title")
* [link](/url)
* [link](/url "title
title title")
* nonlink

View File

@ -368,6 +368,7 @@ void tst_QTextMarkdownWriter::rewriteDocument_data()
QTest::newRow("example") << "example.md"; QTest::newRow("example") << "example.md";
QTest::newRow("list items after headings") << "headingsAndLists.md"; QTest::newRow("list items after headings") << "headingsAndLists.md";
QTest::newRow("word wrap") << "wordWrap.md"; QTest::newRow("word wrap") << "wordWrap.md";
QTest::newRow("links") << "links.md";
} }
void tst_QTextMarkdownWriter::rewriteDocument() void tst_QTextMarkdownWriter::rewriteDocument()

View File

@ -1,3 +1,4 @@
# QTBUG-74760 # QTBUG-74760
[sorting] [sorting]
opensuse-42.3 opensuse-42.3
osx

View File

@ -89,6 +89,7 @@ private slots:
void focusNextPrevChild(); void focusNextPrevChild();
void focusOutEvent_data(); void focusOutEvent_data();
void focusOutEvent(); void focusOutEvent();
void focusProxy_QTBUG_51856();
void hoverEnterLeaveEvent_data(); void hoverEnterLeaveEvent_data();
void hoverEnterLeaveEvent(); void hoverEnterLeaveEvent();
void hoverMoveEvent_data(); void hoverMoveEvent_data();
@ -864,6 +865,75 @@ void tst_QGraphicsProxyWidget::focusOutEvent()
} }
} }
void tst_QGraphicsProxyWidget::focusProxy_QTBUG_51856()
{
// QSpinBox has an internal QLineEdit; this QLineEdit has the spinbox
// as its focus proxy.
struct FocusedSpinBox : QSpinBox
{
int focusCount = 0;
bool event(QEvent *event) override
{
switch (event->type()) {
case QEvent::FocusIn:
++focusCount;
break;
case QEvent::FocusOut:
--focusCount;
break;
default:
break;
}
return QSpinBox::event(event);
}
};
QGraphicsScene scene;
QGraphicsView view(&scene);
SubQGraphicsProxyWidget *proxy = new SubQGraphicsProxyWidget;
scene.addItem(proxy);
view.show();
view.raise();
view.activateWindow();
QVERIFY(QTest::qWaitForWindowActive(&view));
FocusedSpinBox *spinBox = new FocusedSpinBox;
proxy->setWidget(spinBox);
proxy->show();
proxy->setFocus();
QVERIFY(proxy->hasFocus());
QEXPECT_FAIL("", "Widget should have focus but doesn't", Continue);
QVERIFY(spinBox->hasFocus());
QEXPECT_FAIL("", "Widget should have focus but doesn't", Continue);
QCOMPARE(spinBox->focusCount, 1);
enum { Count = 10 };
for (int i = 0; i < Count; ++i) {
for (int clickCount = 0; clickCount < Count; ++clickCount) {
auto proxyCenter = proxy->boundingRect().center();
auto proxyCenterInScene = proxy->mapToScene(proxyCenter);
auto proxyCenterInView = view.mapFromScene(proxyCenterInScene);
QTest::mouseClick(view.viewport(), Qt::LeftButton, {}, proxyCenterInView);
QTRY_COMPARE(spinBox->focusCount, 1);
}
QLineEdit *edit = new QLineEdit(&view);
edit->show();
QTRY_VERIFY(edit->isVisible());
edit->setFocus();
QTRY_VERIFY(edit->hasFocus());
QTRY_VERIFY(!proxy->hasFocus());
QTRY_COMPARE(proxy->focusOut, i + 1);
QTRY_VERIFY(!spinBox->hasFocus());
QTRY_COMPARE(spinBox->focusCount, 0);
delete edit;
}
}
class EventLogger : public QWidget class EventLogger : public QWidget
{ {
public: public:

View File

@ -16,3 +16,5 @@ opensuse-42.3
[itemsInRect_cosmeticAdjust] [itemsInRect_cosmeticAdjust]
# QTBUG-66815 # QTBUG-66815
ubuntu-16.04 ubuntu-16.04
[fitInView]
osx

View File

@ -94,13 +94,13 @@ void CalendarWidget::selectedDateChanged()
currentDateEdit->setDate(calendar->selectedDate()); currentDateEdit->setDate(calendar->selectedDate());
} }
void CalendarWidget::minimumDateChanged(const QDate &date) void CalendarWidget::minimumDateChanged(QDate date)
{ {
calendar->setMinimumDate(date); calendar->setMinimumDate(date);
maximumDateEdit->setDate(calendar->maximumDate()); maximumDateEdit->setDate(calendar->maximumDate());
} }
void CalendarWidget::maximumDateChanged(const QDate &date) void CalendarWidget::maximumDateChanged(QDate date)
{ {
calendar->setMaximumDate(date); calendar->setMaximumDate(date);
minimumDateEdit->setDate(calendar->minimumDate()); minimumDateEdit->setDate(calendar->minimumDate());

View File

@ -55,8 +55,8 @@ private slots:
void horizontalHeaderChanged(int index); void horizontalHeaderChanged(int index);
void verticalHeaderChanged(int index); void verticalHeaderChanged(int index);
void selectedDateChanged(); void selectedDateChanged();
void minimumDateChanged(const QDate &date); void minimumDateChanged(QDate date);
void maximumDateChanged(const QDate &date); void maximumDateChanged(QDate date);
void updateWeekendDays(); void updateWeekendDays();
void weekdayFormatChanged(); void weekdayFormatChanged();
void weekendFormatChanged(); void weekendFormatChanged();

View File

@ -184,7 +184,7 @@ void CodeGenerator::writeCoreFactoryImplementation(const QString &fileName) cons
// Get the set of version functions classes we need to create // Get the set of version functions classes we need to create
QList<Version> versions = m_parser->versions(); QList<Version> versions = m_parser->versions();
std::sort(m_versions.begin(), m_versions.end(), std::greater<Version>()); std::sort(versions.begin(), versions.end(), std::greater<Version>());
// Outout the #include statements // Outout the #include statements
stream << QStringLiteral("#if !defined(QT_OPENGL_ES_2)") << endl; stream << QStringLiteral("#if !defined(QT_OPENGL_ES_2)") << endl;

View File

@ -305,6 +305,7 @@ def _generateLocaleInfo(path, language_code, script_code, country_code, variant_
result['decimal'] = get_number_in_system(path, "numbers/symbols/decimal", numbering_system) result['decimal'] = get_number_in_system(path, "numbers/symbols/decimal", numbering_system)
result['group'] = get_number_in_system(path, "numbers/symbols/group", numbering_system) result['group'] = get_number_in_system(path, "numbers/symbols/group", numbering_system)
assert result['decimal'] != result['group']
result['list'] = get_number_in_system(path, "numbers/symbols/list", numbering_system) result['list'] = get_number_in_system(path, "numbers/symbols/list", numbering_system)
result['percent'] = get_number_in_system(path, "numbers/symbols/percentSign", numbering_system) result['percent'] = get_number_in_system(path, "numbers/symbols/percentSign", numbering_system)
try: try: