Merge remote-tracking branch 'origin/5.12' into 5.13
Conflicts: configure.pri Also required s/solid\.color/solidColor/ in a couple of places in: src/gui/painting/qpaintengine_raster.cpp Change-Id: I29937f63e9779deb6dac7ae77e2948d06ebc0319
This commit is contained in:
commit
77d126ccb5
@ -1,2 +1 @@
|
|||||||
TARGET = arch
|
|
||||||
SOURCES = arch.cpp
|
SOURCES = arch.cpp
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
option(host_build)
|
option(host_build)
|
||||||
include(arch.pro)
|
SOURCES = arch.cpp
|
||||||
|
@ -251,12 +251,14 @@
|
|||||||
"label": "target architecture",
|
"label": "target architecture",
|
||||||
"type": "architecture",
|
"type": "architecture",
|
||||||
"test": "arch",
|
"test": "arch",
|
||||||
|
"output": "arch",
|
||||||
"log": "arch"
|
"log": "arch"
|
||||||
},
|
},
|
||||||
"host_architecture": {
|
"host_architecture": {
|
||||||
"label": "host architecture",
|
"label": "host architecture",
|
||||||
"type": "architecture",
|
"type": "architecture",
|
||||||
"test": "arch",
|
"test": "arch",
|
||||||
|
"output": "arch_host",
|
||||||
"host": true,
|
"host": true,
|
||||||
"pro": "arch_host.pro",
|
"pro": "arch_host.pro",
|
||||||
"log": "arch"
|
"log": "arch"
|
||||||
@ -1316,7 +1318,7 @@
|
|||||||
"ccache": {
|
"ccache": {
|
||||||
"label": "Using ccache",
|
"label": "Using ccache",
|
||||||
"autoDetect": false,
|
"autoDetect": false,
|
||||||
"condition": "config.unix && tests.ccache",
|
"condition": "tests.ccache",
|
||||||
"output": [ "privateConfig" ]
|
"output": [ "privateConfig" ]
|
||||||
},
|
},
|
||||||
"msvc_mp": {
|
"msvc_mp": {
|
||||||
|
@ -286,20 +286,39 @@ defineTest(qtConfTest_architecture) {
|
|||||||
!qtConfTest_compile($${1}): \
|
!qtConfTest_compile($${1}): \
|
||||||
error("Could not determine $$eval($${1}.label). See config.log for details.")
|
error("Could not determine $$eval($${1}.label). See config.log for details.")
|
||||||
|
|
||||||
|
host = $$eval($${1}.host)
|
||||||
|
isEmpty(host): host = false
|
||||||
|
file_prefix =
|
||||||
|
exts = -
|
||||||
|
$$host {
|
||||||
|
equals(QMAKE_HOST.os, Windows): \
|
||||||
|
exts = .exe
|
||||||
|
} else {
|
||||||
|
win32 {
|
||||||
|
exts = .exe
|
||||||
|
} else:android {
|
||||||
|
file_prefix = lib
|
||||||
|
exts = .so
|
||||||
|
} else:wasm {
|
||||||
|
exts = .wasm .o
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
test = $$eval($${1}.test)
|
test = $$eval($${1}.test)
|
||||||
|
output = $$eval($${1}.output)
|
||||||
test_out_dir = $$OUT_PWD/$$basename(QMAKE_CONFIG_TESTS_DIR)/$$test
|
test_out_dir = $$OUT_PWD/$$basename(QMAKE_CONFIG_TESTS_DIR)/$$test
|
||||||
unix:exists($$test_out_dir/arch): \
|
test_out_file =
|
||||||
content = $$cat($$test_out_dir/arch, blob)
|
for(ext, exts) {
|
||||||
else: win32:exists($$test_out_dir/arch.exe): \
|
equals(ext, -): ext =
|
||||||
content = $$cat($$test_out_dir/arch.exe, blob)
|
f = $$test_out_dir/$$file_prefix$$output$$ext
|
||||||
else: android:exists($$test_out_dir/libarch.so): \
|
exists($$f) {
|
||||||
content = $$cat($$test_out_dir/libarch.so, blob)
|
test_out_file = $$f
|
||||||
else: wasm:exists($$test_out_dir/arch.wasm): \
|
break()
|
||||||
content = $$cat($$test_out_dir/arch.wasm, blob)
|
}
|
||||||
else: wasm:exists($$test_out_dir/arch.o): \
|
}
|
||||||
content = $$cat($$test_out_dir/arch.o, blob)
|
isEmpty(test_out_file): \
|
||||||
else: \
|
|
||||||
error("$$eval($${1}.label) detection binary not found.")
|
error("$$eval($${1}.label) detection binary not found.")
|
||||||
|
content = $$cat($$test_out_file, blob)
|
||||||
|
|
||||||
arch_magic = ".*==Qt=magic=Qt== Architecture:([^\\0]*).*"
|
arch_magic = ".*==Qt=magic=Qt== Architecture:([^\\0]*).*"
|
||||||
subarch_magic = ".*==Qt=magic=Qt== Sub-architecture:([^\\0]*).*"
|
subarch_magic = ".*==Qt=magic=Qt== Sub-architecture:([^\\0]*).*"
|
||||||
|
@ -160,9 +160,10 @@ void Window::iconActivated(QSystemTrayIcon::ActivationReason reason)
|
|||||||
void Window::showMessage()
|
void Window::showMessage()
|
||||||
{
|
{
|
||||||
showIconCheckBox->setChecked(true);
|
showIconCheckBox->setChecked(true);
|
||||||
QSystemTrayIcon::MessageIcon msgIcon = QSystemTrayIcon::MessageIcon(
|
int selectedIcon = typeComboBox->itemData(typeComboBox->currentIndex()).toInt();
|
||||||
typeComboBox->itemData(typeComboBox->currentIndex()).toInt());
|
QSystemTrayIcon::MessageIcon msgIcon = QSystemTrayIcon::MessageIcon(selectedIcon);
|
||||||
if (msgIcon == QSystemTrayIcon::NoIcon) {
|
|
||||||
|
if (selectedIcon == -1) { // custom icon
|
||||||
QIcon icon(iconComboBox->itemIcon(iconComboBox->currentIndex()));
|
QIcon icon(iconComboBox->itemIcon(iconComboBox->currentIndex()));
|
||||||
trayIcon->showMessage(titleEdit->text(), bodyEdit->toPlainText(), icon,
|
trayIcon->showMessage(titleEdit->text(), bodyEdit->toPlainText(), icon,
|
||||||
durationSpinBox->value() * 1000);
|
durationSpinBox->value() * 1000);
|
||||||
@ -222,7 +223,7 @@ void Window::createMessageGroupBox()
|
|||||||
QStyle::SP_MessageBoxCritical), tr("Critical"),
|
QStyle::SP_MessageBoxCritical), tr("Critical"),
|
||||||
QSystemTrayIcon::Critical);
|
QSystemTrayIcon::Critical);
|
||||||
typeComboBox->addItem(QIcon(), tr("Custom icon"),
|
typeComboBox->addItem(QIcon(), tr("Custom icon"),
|
||||||
QSystemTrayIcon::NoIcon);
|
-1);
|
||||||
typeComboBox->setCurrentIndex(1);
|
typeComboBox->setCurrentIndex(1);
|
||||||
|
|
||||||
durationLabel = new QLabel(tr("Duration:"));
|
durationLabel = new QLabel(tr("Duration:"));
|
||||||
|
@ -304,7 +304,6 @@ headersclean:!internal_module {
|
|||||||
header_check.variable_out = PRE_TARGETDEPS
|
header_check.variable_out = PRE_TARGETDEPS
|
||||||
header_check.name = headercheck ${QMAKE_FILE_IN}
|
header_check.name = headercheck ${QMAKE_FILE_IN}
|
||||||
header_check.commands = $$hcleanCOMMAND
|
header_check.commands = $$hcleanCOMMAND
|
||||||
silent:header_check.commands = @echo compiling[header] ${QMAKE_FILE_IN} && $$hcleanCOMMAND
|
|
||||||
QMAKE_EXTRA_COMPILERS += header_check
|
QMAKE_EXTRA_COMPILERS += header_check
|
||||||
}
|
}
|
||||||
unset(hcleanCOMMAND)
|
unset(hcleanCOMMAND)
|
||||||
|
@ -1128,48 +1128,35 @@ bool QMakeEvaluator::prepareProject(const QString &inDir)
|
|||||||
}
|
}
|
||||||
superdir = qdfi.path();
|
superdir = qdfi.path();
|
||||||
}
|
}
|
||||||
|
QString sdir = inDir;
|
||||||
QString dir = m_outputDir;
|
QString dir = m_outputDir;
|
||||||
forever {
|
forever {
|
||||||
|
conffile = sdir + QLatin1String("/.qmake.conf");
|
||||||
|
if (!m_vfs->exists(conffile, flags))
|
||||||
|
conffile.clear();
|
||||||
cachefile = dir + QLatin1String("/.qmake.cache");
|
cachefile = dir + QLatin1String("/.qmake.cache");
|
||||||
if (!m_vfs->exists(cachefile, flags))
|
if (!m_vfs->exists(cachefile, flags))
|
||||||
cachefile.clear();
|
cachefile.clear();
|
||||||
if (!cachefile.isEmpty()) {
|
if (!conffile.isEmpty() || !cachefile.isEmpty()) {
|
||||||
|
if (dir != sdir)
|
||||||
|
m_sourceRoot = sdir;
|
||||||
m_buildRoot = dir;
|
m_buildRoot = dir;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (dir == superdir)
|
if (dir == superdir)
|
||||||
goto no_cache;
|
goto no_cache;
|
||||||
QFileInfo qdfi(dir);
|
|
||||||
if (qdfi.isRoot()) {
|
|
||||||
cachefile.clear();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
dir = qdfi.path();
|
|
||||||
}
|
|
||||||
QString sdir = inDir;
|
|
||||||
forever {
|
|
||||||
conffile = sdir + QLatin1String("/.qmake.conf");
|
|
||||||
if (!m_vfs->exists(conffile, flags))
|
|
||||||
conffile.clear();
|
|
||||||
if (!conffile.isEmpty()) {
|
|
||||||
if (sdir != m_buildRoot)
|
|
||||||
m_sourceRoot = sdir;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
QFileInfo qsdfi(sdir);
|
QFileInfo qsdfi(sdir);
|
||||||
if (qsdfi.isRoot()) {
|
QFileInfo qdfi(dir);
|
||||||
conffile.clear();
|
if (qsdfi.isRoot() || qdfi.isRoot())
|
||||||
break;
|
goto no_cache;
|
||||||
}
|
|
||||||
sdir = qsdfi.path();
|
sdir = qsdfi.path();
|
||||||
|
dir = qdfi.path();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
m_buildRoot = QFileInfo(cachefile).path();
|
m_buildRoot = QFileInfo(cachefile).path();
|
||||||
}
|
}
|
||||||
if (!conffile.isEmpty())
|
m_conffile = QDir::cleanPath(conffile);
|
||||||
m_conffile = QDir::cleanPath(conffile);
|
m_cachefile = QDir::cleanPath(cachefile);
|
||||||
if (!cachefile.isEmpty())
|
|
||||||
m_cachefile = QDir::cleanPath(cachefile);
|
|
||||||
}
|
}
|
||||||
no_cache:
|
no_cache:
|
||||||
|
|
||||||
|
@ -610,7 +610,7 @@ QSimpleTextCodec::QSimpleTextCodec(int i) : forwardIndex(i), reverseMap(0)
|
|||||||
|
|
||||||
QSimpleTextCodec::~QSimpleTextCodec()
|
QSimpleTextCodec::~QSimpleTextCodec()
|
||||||
{
|
{
|
||||||
delete reverseMap.load();
|
delete reverseMap.loadAcquire();
|
||||||
}
|
}
|
||||||
|
|
||||||
static QByteArray *buildReverseMap(int forwardIndex)
|
static QByteArray *buildReverseMap(int forwardIndex)
|
||||||
@ -662,12 +662,12 @@ QByteArray QSimpleTextCodec::convertFromUnicode(const QChar *in, int length, Con
|
|||||||
const char replacement = (state && state->flags & ConvertInvalidToNull) ? 0 : '?';
|
const char replacement = (state && state->flags & ConvertInvalidToNull) ? 0 : '?';
|
||||||
int invalid = 0;
|
int invalid = 0;
|
||||||
|
|
||||||
QByteArray *rmap = reverseMap.load();
|
QByteArray *rmap = reverseMap.loadAcquire();
|
||||||
if (!rmap){
|
if (!rmap){
|
||||||
rmap = buildReverseMap(this->forwardIndex);
|
rmap = buildReverseMap(this->forwardIndex);
|
||||||
if (!reverseMap.testAndSetRelease(0, rmap)) {
|
if (!reverseMap.testAndSetRelease(0, rmap)) {
|
||||||
delete rmap;
|
delete rmap;
|
||||||
rmap = reverseMap.load();
|
rmap = reverseMap.loadAcquire();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -218,7 +218,7 @@ template <typename T, typename ConstantsType>
|
|||||||
inline QFreeList<T, ConstantsType>::~QFreeList()
|
inline QFreeList<T, ConstantsType>::~QFreeList()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < ConstantsType::BlockCount; ++i)
|
for (int i = 0; i < ConstantsType::BlockCount; ++i)
|
||||||
delete [] _v[i].load();
|
delete [] _v[i].loadAcquire();
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, typename ConstantsType>
|
template <typename T, typename ConstantsType>
|
||||||
|
@ -1074,7 +1074,7 @@ QList<QByteArray> QImageReader::supportedSubTypes() const
|
|||||||
\since 5.5
|
\since 5.5
|
||||||
|
|
||||||
Returns the transformation metadata of the image, including image orientation. If the format
|
Returns the transformation metadata of the image, including image orientation. If the format
|
||||||
does not support transformation metadata \c QImageIOHandler::Transformation_None is returned.
|
does not support transformation metadata, QImageIOHandler::TransformationNone is returned.
|
||||||
|
|
||||||
\sa setAutoTransform(), autoTransform()
|
\sa setAutoTransform(), autoTransform()
|
||||||
*/
|
*/
|
||||||
|
@ -42,6 +42,8 @@
|
|||||||
#include "qobject.h"
|
#include "qobject.h"
|
||||||
#include "qdebug.h"
|
#include "qdebug.h"
|
||||||
#include "qpixmapcache_p.h"
|
#include "qpixmapcache_p.h"
|
||||||
|
#include "qthread.h"
|
||||||
|
#include "qcoreapplication.h"
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
@ -83,6 +85,9 @@ QT_BEGIN_NAMESPACE
|
|||||||
with QPixmapCache} explains how to use QPixmapCache to speed up
|
with QPixmapCache} explains how to use QPixmapCache to speed up
|
||||||
applications by caching the results of painting.
|
applications by caching the results of painting.
|
||||||
|
|
||||||
|
\note QPixmapCache is only usable from the application's main thread.
|
||||||
|
Access from other threads will be ignored and return failure.
|
||||||
|
|
||||||
\sa QCache, QPixmap
|
\sa QCache, QPixmap
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -98,6 +103,14 @@ static inline int cost(const QPixmap &pixmap)
|
|||||||
return static_cast<int>(qBound(1LL, costKb, costMax));
|
return static_cast<int>(qBound(1LL, costKb, costMax));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline bool qt_pixmapcache_thread_test()
|
||||||
|
{
|
||||||
|
if (Q_LIKELY(QCoreApplication::instance() && QThread::currentThread() == QCoreApplication::instance()->thread()))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\class QPixmapCache::Key
|
\class QPixmapCache::Key
|
||||||
\brief The QPixmapCache::Key class can be used for efficient access
|
\brief The QPixmapCache::Key class can be used for efficient access
|
||||||
@ -490,6 +503,8 @@ QPixmapCacheEntry::~QPixmapCacheEntry()
|
|||||||
|
|
||||||
QPixmap *QPixmapCache::find(const QString &key)
|
QPixmap *QPixmapCache::find(const QString &key)
|
||||||
{
|
{
|
||||||
|
if (!qt_pixmapcache_thread_test())
|
||||||
|
return nullptr;
|
||||||
return pm_cache()->object(key);
|
return pm_cache()->object(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -519,6 +534,8 @@ bool QPixmapCache::find(const QString &key, QPixmap &pixmap)
|
|||||||
|
|
||||||
bool QPixmapCache::find(const QString &key, QPixmap *pixmap)
|
bool QPixmapCache::find(const QString &key, QPixmap *pixmap)
|
||||||
{
|
{
|
||||||
|
if (!qt_pixmapcache_thread_test())
|
||||||
|
return false;
|
||||||
QPixmap *ptr = pm_cache()->object(key);
|
QPixmap *ptr = pm_cache()->object(key);
|
||||||
if (ptr && pixmap)
|
if (ptr && pixmap)
|
||||||
*pixmap = *ptr;
|
*pixmap = *ptr;
|
||||||
@ -536,6 +553,8 @@ bool QPixmapCache::find(const QString &key, QPixmap *pixmap)
|
|||||||
*/
|
*/
|
||||||
bool QPixmapCache::find(const Key &key, QPixmap *pixmap)
|
bool QPixmapCache::find(const Key &key, QPixmap *pixmap)
|
||||||
{
|
{
|
||||||
|
if (!qt_pixmapcache_thread_test())
|
||||||
|
return false;
|
||||||
//The key is not valid anymore, a flush happened before probably
|
//The key is not valid anymore, a flush happened before probably
|
||||||
if (!key.d || !key.d->isValid)
|
if (!key.d || !key.d->isValid)
|
||||||
return false;
|
return false;
|
||||||
@ -567,6 +586,8 @@ bool QPixmapCache::find(const Key &key, QPixmap *pixmap)
|
|||||||
|
|
||||||
bool QPixmapCache::insert(const QString &key, const QPixmap &pixmap)
|
bool QPixmapCache::insert(const QString &key, const QPixmap &pixmap)
|
||||||
{
|
{
|
||||||
|
if (!qt_pixmapcache_thread_test())
|
||||||
|
return false;
|
||||||
return pm_cache()->insert(key, pixmap, cost(pixmap));
|
return pm_cache()->insert(key, pixmap, cost(pixmap));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -587,6 +608,8 @@ bool QPixmapCache::insert(const QString &key, const QPixmap &pixmap)
|
|||||||
*/
|
*/
|
||||||
QPixmapCache::Key QPixmapCache::insert(const QPixmap &pixmap)
|
QPixmapCache::Key QPixmapCache::insert(const QPixmap &pixmap)
|
||||||
{
|
{
|
||||||
|
if (!qt_pixmapcache_thread_test())
|
||||||
|
return QPixmapCache::Key();
|
||||||
return pm_cache()->insert(pixmap, cost(pixmap));
|
return pm_cache()->insert(pixmap, cost(pixmap));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -601,6 +624,8 @@ QPixmapCache::Key QPixmapCache::insert(const QPixmap &pixmap)
|
|||||||
*/
|
*/
|
||||||
bool QPixmapCache::replace(const Key &key, const QPixmap &pixmap)
|
bool QPixmapCache::replace(const Key &key, const QPixmap &pixmap)
|
||||||
{
|
{
|
||||||
|
if (!qt_pixmapcache_thread_test())
|
||||||
|
return false;
|
||||||
//The key is not valid anymore, a flush happened before probably
|
//The key is not valid anymore, a flush happened before probably
|
||||||
if (!key.d || !key.d->isValid)
|
if (!key.d || !key.d->isValid)
|
||||||
return false;
|
return false;
|
||||||
@ -630,6 +655,8 @@ int QPixmapCache::cacheLimit()
|
|||||||
|
|
||||||
void QPixmapCache::setCacheLimit(int n)
|
void QPixmapCache::setCacheLimit(int n)
|
||||||
{
|
{
|
||||||
|
if (!qt_pixmapcache_thread_test())
|
||||||
|
return;
|
||||||
pm_cache()->setMaxCost(n);
|
pm_cache()->setMaxCost(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -638,6 +665,8 @@ void QPixmapCache::setCacheLimit(int n)
|
|||||||
*/
|
*/
|
||||||
void QPixmapCache::remove(const QString &key)
|
void QPixmapCache::remove(const QString &key)
|
||||||
{
|
{
|
||||||
|
if (!qt_pixmapcache_thread_test())
|
||||||
|
return;
|
||||||
pm_cache()->remove(key);
|
pm_cache()->remove(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -649,6 +678,8 @@ void QPixmapCache::remove(const QString &key)
|
|||||||
*/
|
*/
|
||||||
void QPixmapCache::remove(const Key &key)
|
void QPixmapCache::remove(const Key &key)
|
||||||
{
|
{
|
||||||
|
if (!qt_pixmapcache_thread_test())
|
||||||
|
return;
|
||||||
//The key is not valid anymore, a flush happened before probably
|
//The key is not valid anymore, a flush happened before probably
|
||||||
if (!key.d || !key.d->isValid)
|
if (!key.d || !key.d->isValid)
|
||||||
return;
|
return;
|
||||||
@ -661,6 +692,8 @@ void QPixmapCache::remove(const Key &key)
|
|||||||
|
|
||||||
void QPixmapCache::clear()
|
void QPixmapCache::clear()
|
||||||
{
|
{
|
||||||
|
if (!QCoreApplication::closingDown() && !qt_pixmapcache_thread_test())
|
||||||
|
return;
|
||||||
QT_TRY {
|
QT_TRY {
|
||||||
if (pm_cache.exists())
|
if (pm_cache.exists())
|
||||||
pm_cache->clear();
|
pm_cache->clear();
|
||||||
|
@ -53,8 +53,8 @@ static int next_qopengltextureglyphcache_serial_number()
|
|||||||
return 1 + serial.fetchAndAddRelaxed(1);
|
return 1 + serial.fetchAndAddRelaxed(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
QOpenGLTextureGlyphCache::QOpenGLTextureGlyphCache(QFontEngine::GlyphFormat format, const QTransform &matrix)
|
QOpenGLTextureGlyphCache::QOpenGLTextureGlyphCache(QFontEngine::GlyphFormat format, const QTransform &matrix, const QColor &color)
|
||||||
: QImageTextureGlyphCache(format, matrix)
|
: QImageTextureGlyphCache(format, matrix, color)
|
||||||
, m_textureResource(0)
|
, m_textureResource(0)
|
||||||
, pex(0)
|
, pex(0)
|
||||||
, m_blitProgram(0)
|
, m_blitProgram(0)
|
||||||
|
@ -110,7 +110,7 @@ public:
|
|||||||
class Q_GUI_EXPORT QOpenGLTextureGlyphCache : public QImageTextureGlyphCache
|
class Q_GUI_EXPORT QOpenGLTextureGlyphCache : public QImageTextureGlyphCache
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QOpenGLTextureGlyphCache(QFontEngine::GlyphFormat glyphFormat, const QTransform &matrix);
|
QOpenGLTextureGlyphCache(QFontEngine::GlyphFormat glyphFormat, const QTransform &matrix, const QColor &color = QColor());
|
||||||
~QOpenGLTextureGlyphCache();
|
~QOpenGLTextureGlyphCache();
|
||||||
|
|
||||||
virtual void createTextureData(int width, int height) override;
|
virtual void createTextureData(int width, int height) override;
|
||||||
|
@ -2927,9 +2927,9 @@ bool QRasterPaintEngine::drawCachedGlyphs(int numGlyphs, const glyph_t *glyphs,
|
|||||||
QFontEngine::GlyphFormat glyphFormat = fontEngine->glyphFormat != QFontEngine::Format_None ? fontEngine->glyphFormat : d->glyphCacheFormat;
|
QFontEngine::GlyphFormat glyphFormat = fontEngine->glyphFormat != QFontEngine::Format_None ? fontEngine->glyphFormat : d->glyphCacheFormat;
|
||||||
|
|
||||||
QImageTextureGlyphCache *cache =
|
QImageTextureGlyphCache *cache =
|
||||||
static_cast<QImageTextureGlyphCache *>(fontEngine->glyphCache(0, glyphFormat, s->matrix));
|
static_cast<QImageTextureGlyphCache *>(fontEngine->glyphCache(0, glyphFormat, s->matrix, QColor(s->penData.solidColor)));
|
||||||
if (!cache) {
|
if (!cache) {
|
||||||
cache = new QImageTextureGlyphCache(glyphFormat, s->matrix);
|
cache = new QImageTextureGlyphCache(glyphFormat, s->matrix, QColor(s->penData.solidColor));
|
||||||
fontEngine->setGlyphCache(0, cache);
|
fontEngine->setGlyphCache(0, cache);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -267,7 +267,7 @@ QImage QTextureGlyphCache::textureMapForGlyph(glyph_t g, QFixed subPixelPosition
|
|||||||
case QFontEngine::Format_A32:
|
case QFontEngine::Format_A32:
|
||||||
return m_current_fontengine->alphaRGBMapForGlyph(g, subPixelPosition, m_transform);
|
return m_current_fontengine->alphaRGBMapForGlyph(g, subPixelPosition, m_transform);
|
||||||
case QFontEngine::Format_ARGB:
|
case QFontEngine::Format_ARGB:
|
||||||
return m_current_fontengine->bitmapForGlyph(g, subPixelPosition, m_transform);
|
return m_current_fontengine->bitmapForGlyph(g, subPixelPosition, m_transform, color());
|
||||||
default:
|
default:
|
||||||
return m_current_fontengine->alphaMapForGlyph(g, subPixelPosition, m_transform);
|
return m_current_fontengine->alphaMapForGlyph(g, subPixelPosition, m_transform);
|
||||||
}
|
}
|
||||||
|
@ -74,8 +74,8 @@ class QTextItemInt;
|
|||||||
class Q_GUI_EXPORT QTextureGlyphCache : public QFontEngineGlyphCache
|
class Q_GUI_EXPORT QTextureGlyphCache : public QFontEngineGlyphCache
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QTextureGlyphCache(QFontEngine::GlyphFormat format, const QTransform &matrix)
|
QTextureGlyphCache(QFontEngine::GlyphFormat format, const QTransform &matrix, const QColor &color = QColor())
|
||||||
: QFontEngineGlyphCache(format, matrix), m_current_fontengine(0),
|
: QFontEngineGlyphCache(format, matrix, color), m_current_fontengine(0),
|
||||||
m_w(0), m_h(0), m_cx(0), m_cy(0), m_currentRowHeight(0)
|
m_w(0), m_h(0), m_cx(0), m_cy(0), m_currentRowHeight(0)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
@ -165,8 +165,8 @@ inline uint qHash(const QTextureGlyphCache::GlyphAndSubPixelPosition &g)
|
|||||||
class Q_GUI_EXPORT QImageTextureGlyphCache : public QTextureGlyphCache
|
class Q_GUI_EXPORT QImageTextureGlyphCache : public QTextureGlyphCache
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QImageTextureGlyphCache(QFontEngine::GlyphFormat format, const QTransform &matrix)
|
QImageTextureGlyphCache(QFontEngine::GlyphFormat format, const QTransform &matrix, const QColor &color = QColor())
|
||||||
: QTextureGlyphCache(format, matrix) { }
|
: QTextureGlyphCache(format, matrix, color) { }
|
||||||
~QImageTextureGlyphCache();
|
~QImageTextureGlyphCache();
|
||||||
|
|
||||||
virtual void createTextureData(int width, int height) override;
|
virtual void createTextureData(int width, int height) override;
|
||||||
|
@ -899,7 +899,7 @@ QImage QFontEngine::alphaRGBMapForGlyph(glyph_t glyph, QFixed /*subPixelPosition
|
|||||||
return rgbMask;
|
return rgbMask;
|
||||||
}
|
}
|
||||||
|
|
||||||
QImage QFontEngine::bitmapForGlyph(glyph_t, QFixed subPixelPosition, const QTransform&)
|
QImage QFontEngine::bitmapForGlyph(glyph_t, QFixed subPixelPosition, const QTransform&, const QColor &)
|
||||||
{
|
{
|
||||||
Q_UNUSED(subPixelPosition);
|
Q_UNUSED(subPixelPosition);
|
||||||
|
|
||||||
@ -1075,7 +1075,10 @@ void QFontEngine::setGlyphCache(const void *context, QFontEngineGlyphCache *cach
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QFontEngineGlyphCache *QFontEngine::glyphCache(const void *context, GlyphFormat format, const QTransform &transform) const
|
QFontEngineGlyphCache *QFontEngine::glyphCache(const void *context,
|
||||||
|
GlyphFormat format,
|
||||||
|
const QTransform &transform,
|
||||||
|
const QColor &color) const
|
||||||
{
|
{
|
||||||
const QHash<const void*, GlyphCaches>::const_iterator caches = m_glyphCaches.constFind(context);
|
const QHash<const void*, GlyphCaches>::const_iterator caches = m_glyphCaches.constFind(context);
|
||||||
if (caches == m_glyphCaches.cend())
|
if (caches == m_glyphCaches.cend())
|
||||||
@ -1083,8 +1086,11 @@ QFontEngineGlyphCache *QFontEngine::glyphCache(const void *context, GlyphFormat
|
|||||||
|
|
||||||
for (GlyphCaches::const_iterator it = caches->begin(), end = caches->end(); it != end; ++it) {
|
for (GlyphCaches::const_iterator it = caches->begin(), end = caches->end(); it != end; ++it) {
|
||||||
QFontEngineGlyphCache *cache = it->cache.data();
|
QFontEngineGlyphCache *cache = it->cache.data();
|
||||||
if (format == cache->glyphFormat() && qtransform_equals_no_translate(cache->m_transform, transform))
|
if (format == cache->glyphFormat()
|
||||||
|
&& (format != Format_ARGB || color == cache->color())
|
||||||
|
&& qtransform_equals_no_translate(cache->m_transform, transform)) {
|
||||||
return cache;
|
return cache;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -190,7 +190,7 @@ public:
|
|||||||
virtual QImage alphaMapForGlyph(glyph_t, const QTransform &t);
|
virtual QImage alphaMapForGlyph(glyph_t, const QTransform &t);
|
||||||
virtual QImage alphaMapForGlyph(glyph_t, QFixed subPixelPosition, const QTransform &t);
|
virtual QImage alphaMapForGlyph(glyph_t, QFixed subPixelPosition, const QTransform &t);
|
||||||
virtual QImage alphaRGBMapForGlyph(glyph_t, QFixed subPixelPosition, const QTransform &t);
|
virtual QImage alphaRGBMapForGlyph(glyph_t, QFixed subPixelPosition, const QTransform &t);
|
||||||
virtual QImage bitmapForGlyph(glyph_t, QFixed subPixelPosition, const QTransform &t);
|
virtual QImage bitmapForGlyph(glyph_t, QFixed subPixelPosition, const QTransform &t, const QColor &color = QColor());
|
||||||
virtual QImage *lockedAlphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition,
|
virtual QImage *lockedAlphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition,
|
||||||
GlyphFormat neededFormat,
|
GlyphFormat neededFormat,
|
||||||
const QTransform &t = QTransform(),
|
const QTransform &t = QTransform(),
|
||||||
@ -252,7 +252,7 @@ public:
|
|||||||
|
|
||||||
void clearGlyphCache(const void *key);
|
void clearGlyphCache(const void *key);
|
||||||
void setGlyphCache(const void *key, QFontEngineGlyphCache *data);
|
void setGlyphCache(const void *key, QFontEngineGlyphCache *data);
|
||||||
QFontEngineGlyphCache *glyphCache(const void *key, GlyphFormat format, const QTransform &transform) const;
|
QFontEngineGlyphCache *glyphCache(const void *key, GlyphFormat format, const QTransform &transform, const QColor &color = QColor()) const;
|
||||||
|
|
||||||
static const uchar *getCMap(const uchar *table, uint tableSize, bool *isSymbolFont, int *cmapSize);
|
static const uchar *getCMap(const uchar *table, uint tableSize, bool *isSymbolFont, int *cmapSize);
|
||||||
static quint32 getTrueTypeGlyphIndex(const uchar *cmap, int cmapSize, uint unicode);
|
static quint32 getTrueTypeGlyphIndex(const uchar *cmap, int cmapSize, uint unicode);
|
||||||
|
@ -65,7 +65,10 @@ QT_BEGIN_NAMESPACE
|
|||||||
class Q_GUI_EXPORT QFontEngineGlyphCache: public QSharedData
|
class Q_GUI_EXPORT QFontEngineGlyphCache: public QSharedData
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QFontEngineGlyphCache(QFontEngine::GlyphFormat format, const QTransform &matrix) : m_format(format), m_transform(matrix)
|
QFontEngineGlyphCache(QFontEngine::GlyphFormat format, const QTransform &matrix, const QColor &color = QColor())
|
||||||
|
: m_format(format)
|
||||||
|
, m_transform(matrix)
|
||||||
|
, m_color(color)
|
||||||
{
|
{
|
||||||
Q_ASSERT(m_format != QFontEngine::Format_None);
|
Q_ASSERT(m_format != QFontEngine::Format_None);
|
||||||
}
|
}
|
||||||
@ -74,9 +77,11 @@ public:
|
|||||||
|
|
||||||
QFontEngine::GlyphFormat glyphFormat() const { return m_format; }
|
QFontEngine::GlyphFormat glyphFormat() const { return m_format; }
|
||||||
const QTransform &transform() const { return m_transform; }
|
const QTransform &transform() const { return m_transform; }
|
||||||
|
const QColor &color() const { return m_color; }
|
||||||
|
|
||||||
QFontEngine::GlyphFormat m_format;
|
QFontEngine::GlyphFormat m_format;
|
||||||
QTransform m_transform;
|
QTransform m_transform;
|
||||||
|
QColor m_color;
|
||||||
};
|
};
|
||||||
typedef QHash<void *, QList<QFontEngineGlyphCache *> > GlyphPointerHash;
|
typedef QHash<void *, QList<QFontEngineGlyphCache *> > GlyphPointerHash;
|
||||||
typedef QHash<int, QList<QFontEngineGlyphCache *> > GlyphIntHash;
|
typedef QHash<int, QList<QFontEngineGlyphCache *> > GlyphIntHash;
|
||||||
|
@ -734,7 +734,9 @@ QHostInfoLookupManager::QHostInfoLookupManager() : mutex(QMutex::Recursive), was
|
|||||||
|
|
||||||
QHostInfoLookupManager::~QHostInfoLookupManager()
|
QHostInfoLookupManager::~QHostInfoLookupManager()
|
||||||
{
|
{
|
||||||
|
QMutexLocker locker(&mutex);
|
||||||
wasDeleted = true;
|
wasDeleted = true;
|
||||||
|
locker.unlock();
|
||||||
|
|
||||||
// don't qDeleteAll currentLookups, the QThreadPool has ownership
|
// don't qDeleteAll currentLookups, the QThreadPool has ownership
|
||||||
clear();
|
clear();
|
||||||
@ -762,6 +764,8 @@ void QHostInfoLookupManager::clear()
|
|||||||
|
|
||||||
void QHostInfoLookupManager::work()
|
void QHostInfoLookupManager::work()
|
||||||
{
|
{
|
||||||
|
QMutexLocker locker(&mutex);
|
||||||
|
|
||||||
if (wasDeleted)
|
if (wasDeleted)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -769,8 +773,6 @@ void QHostInfoLookupManager::work()
|
|||||||
// - launch new lookups via the thread pool
|
// - launch new lookups via the thread pool
|
||||||
// - make sure only one lookup per host/IP is in progress
|
// - make sure only one lookup per host/IP is in progress
|
||||||
|
|
||||||
QMutexLocker locker(&mutex);
|
|
||||||
|
|
||||||
if (!finishedLookups.isEmpty()) {
|
if (!finishedLookups.isEmpty()) {
|
||||||
// remove ID from aborted if it is in there
|
// remove ID from aborted if it is in there
|
||||||
for (int i = 0; i < finishedLookups.length(); i++) {
|
for (int i = 0; i < finishedLookups.length(); i++) {
|
||||||
@ -822,10 +824,11 @@ void QHostInfoLookupManager::work()
|
|||||||
// called by QHostInfo
|
// called by QHostInfo
|
||||||
void QHostInfoLookupManager::scheduleLookup(QHostInfoRunnable *r)
|
void QHostInfoLookupManager::scheduleLookup(QHostInfoRunnable *r)
|
||||||
{
|
{
|
||||||
|
QMutexLocker locker(&this->mutex);
|
||||||
|
|
||||||
if (wasDeleted)
|
if (wasDeleted)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QMutexLocker locker(&this->mutex);
|
|
||||||
scheduledLookups.enqueue(r);
|
scheduledLookups.enqueue(r);
|
||||||
work();
|
work();
|
||||||
}
|
}
|
||||||
@ -833,11 +836,11 @@ void QHostInfoLookupManager::scheduleLookup(QHostInfoRunnable *r)
|
|||||||
// called by QHostInfo
|
// called by QHostInfo
|
||||||
void QHostInfoLookupManager::abortLookup(int id)
|
void QHostInfoLookupManager::abortLookup(int id)
|
||||||
{
|
{
|
||||||
|
QMutexLocker locker(&this->mutex);
|
||||||
|
|
||||||
if (wasDeleted)
|
if (wasDeleted)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QMutexLocker locker(&this->mutex);
|
|
||||||
|
|
||||||
#if QT_CONFIG(thread)
|
#if QT_CONFIG(thread)
|
||||||
// is postponed? delete and return
|
// is postponed? delete and return
|
||||||
for (int i = 0; i < postponedLookups.length(); i++) {
|
for (int i = 0; i < postponedLookups.length(); i++) {
|
||||||
@ -863,20 +866,22 @@ void QHostInfoLookupManager::abortLookup(int id)
|
|||||||
// called from QHostInfoRunnable
|
// called from QHostInfoRunnable
|
||||||
bool QHostInfoLookupManager::wasAborted(int id)
|
bool QHostInfoLookupManager::wasAborted(int id)
|
||||||
{
|
{
|
||||||
|
QMutexLocker locker(&this->mutex);
|
||||||
|
|
||||||
if (wasDeleted)
|
if (wasDeleted)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
QMutexLocker locker(&this->mutex);
|
|
||||||
return abortedLookups.contains(id);
|
return abortedLookups.contains(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
// called from QHostInfoRunnable
|
// called from QHostInfoRunnable
|
||||||
void QHostInfoLookupManager::lookupFinished(QHostInfoRunnable *r)
|
void QHostInfoLookupManager::lookupFinished(QHostInfoRunnable *r)
|
||||||
{
|
{
|
||||||
|
QMutexLocker locker(&this->mutex);
|
||||||
|
|
||||||
if (wasDeleted)
|
if (wasDeleted)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QMutexLocker locker(&this->mutex);
|
|
||||||
#if QT_CONFIG(thread)
|
#if QT_CONFIG(thread)
|
||||||
currentLookups.removeOne(r);
|
currentLookups.removeOne(r);
|
||||||
#endif
|
#endif
|
||||||
@ -938,23 +943,10 @@ void qt_qhostinfo_cache_inject(const QString &hostname, const QHostInfo &resolut
|
|||||||
QHostInfoCache::QHostInfoCache() : max_age(60), enabled(true), cache(128)
|
QHostInfoCache::QHostInfoCache() : max_age(60), enabled(true), cache(128)
|
||||||
{
|
{
|
||||||
#ifdef QT_QHOSTINFO_CACHE_DISABLED_BY_DEFAULT
|
#ifdef QT_QHOSTINFO_CACHE_DISABLED_BY_DEFAULT
|
||||||
enabled = false;
|
enabled.store(false, std::memory_order_relaxed);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QHostInfoCache::isEnabled()
|
|
||||||
{
|
|
||||||
return enabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
// this function is currently only used for the auto tests
|
|
||||||
// and not usable by public API
|
|
||||||
void QHostInfoCache::setEnabled(bool e)
|
|
||||||
{
|
|
||||||
enabled = e;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QHostInfo QHostInfoCache::get(const QString &name, bool *valid)
|
QHostInfo QHostInfoCache::get(const QString &name, bool *valid)
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&this->mutex);
|
QMutexLocker locker(&this->mutex);
|
||||||
|
@ -73,6 +73,7 @@
|
|||||||
#include <QNetworkSession>
|
#include <QNetworkSession>
|
||||||
#include <QSharedPointer>
|
#include <QSharedPointer>
|
||||||
|
|
||||||
|
#include <atomic>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
@ -176,10 +177,12 @@ public:
|
|||||||
void put(const QString &name, const QHostInfo &info);
|
void put(const QString &name, const QHostInfo &info);
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
bool isEnabled();
|
bool isEnabled() { return enabled.load(std::memory_order_relaxed); }
|
||||||
void setEnabled(bool e);
|
// this function is currently only used for the auto tests
|
||||||
|
// and not usable by public API
|
||||||
|
void setEnabled(bool e) { enabled.store(e, std::memory_order_relaxed); }
|
||||||
private:
|
private:
|
||||||
bool enabled;
|
std::atomic<bool> enabled;
|
||||||
struct QHostInfoCacheElement {
|
struct QHostInfoCacheElement {
|
||||||
QHostInfo info;
|
QHostInfo info;
|
||||||
QElapsedTimer age;
|
QElapsedTimer age;
|
||||||
|
@ -623,6 +623,53 @@ bool QNativeSocketEnginePrivate::fetchConnectionParameters()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void setErrorFromWSAError(int error, QNativeSocketEnginePrivate *d)
|
||||||
|
{
|
||||||
|
Q_ASSERT(d);
|
||||||
|
switch (error) {
|
||||||
|
case WSAEISCONN:
|
||||||
|
d->socketState = QAbstractSocket::ConnectedState;
|
||||||
|
break;
|
||||||
|
case WSAEHOSTUNREACH:
|
||||||
|
d->setError(QAbstractSocket::NetworkError, QNativeSocketEnginePrivate::HostUnreachableErrorString);
|
||||||
|
d->socketState = QAbstractSocket::UnconnectedState;
|
||||||
|
break;
|
||||||
|
case WSAEADDRNOTAVAIL:
|
||||||
|
d->setError(QAbstractSocket::NetworkError, QNativeSocketEnginePrivate::AddressNotAvailableErrorString);
|
||||||
|
d->socketState = QAbstractSocket::UnconnectedState;
|
||||||
|
break;
|
||||||
|
case WSAEINPROGRESS:
|
||||||
|
d->setError(QAbstractSocket::UnfinishedSocketOperationError, QNativeSocketEnginePrivate::InvalidSocketErrorString);
|
||||||
|
d->socketState = QAbstractSocket::ConnectingState;
|
||||||
|
break;
|
||||||
|
case WSAEADDRINUSE:
|
||||||
|
d->setError(QAbstractSocket::NetworkError, QNativeSocketEnginePrivate::AddressInuseErrorString);
|
||||||
|
break;
|
||||||
|
case WSAECONNREFUSED:
|
||||||
|
d->setError(QAbstractSocket::ConnectionRefusedError, QNativeSocketEnginePrivate::ConnectionRefusedErrorString);
|
||||||
|
d->socketState = QAbstractSocket::UnconnectedState;
|
||||||
|
break;
|
||||||
|
case WSAETIMEDOUT:
|
||||||
|
d->setError(QAbstractSocket::NetworkError, QNativeSocketEnginePrivate::ConnectionTimeOutErrorString);
|
||||||
|
d->socketState = QAbstractSocket::UnconnectedState;
|
||||||
|
break;
|
||||||
|
case WSAEACCES:
|
||||||
|
d->setError(QAbstractSocket::SocketAccessError, QNativeSocketEnginePrivate::AccessErrorString);
|
||||||
|
d->socketState = QAbstractSocket::UnconnectedState;
|
||||||
|
break;
|
||||||
|
case WSAENETUNREACH:
|
||||||
|
d->setError(QAbstractSocket::NetworkError, QNativeSocketEnginePrivate::NetworkUnreachableErrorString);
|
||||||
|
d->socketState = QAbstractSocket::UnconnectedState;
|
||||||
|
break;
|
||||||
|
case WSAEINVAL:
|
||||||
|
case WSAEALREADY:
|
||||||
|
d->setError(QAbstractSocket::UnfinishedSocketOperationError, QNativeSocketEnginePrivate::InvalidSocketErrorString);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool QNativeSocketEnginePrivate::nativeConnect(const QHostAddress &address, quint16 port)
|
bool QNativeSocketEnginePrivate::nativeConnect(const QHostAddress &address, quint16 port)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -651,9 +698,6 @@ bool QNativeSocketEnginePrivate::nativeConnect(const QHostAddress &address, quin
|
|||||||
case WSANOTINITIALISED:
|
case WSANOTINITIALISED:
|
||||||
//###
|
//###
|
||||||
break;
|
break;
|
||||||
case WSAEISCONN:
|
|
||||||
socketState = QAbstractSocket::ConnectedState;
|
|
||||||
break;
|
|
||||||
case WSAEWOULDBLOCK: {
|
case WSAEWOULDBLOCK: {
|
||||||
// If WSAConnect returns WSAEWOULDBLOCK on the second
|
// If WSAConnect returns WSAEWOULDBLOCK on the second
|
||||||
// connection attempt, we have to check SO_ERROR's
|
// connection attempt, we have to check SO_ERROR's
|
||||||
@ -668,82 +712,33 @@ bool QNativeSocketEnginePrivate::nativeConnect(const QHostAddress &address, quin
|
|||||||
do {
|
do {
|
||||||
if (::getsockopt(socketDescriptor, SOL_SOCKET, SO_ERROR, (char *) &value, &valueSize) == 0) {
|
if (::getsockopt(socketDescriptor, SOL_SOCKET, SO_ERROR, (char *) &value, &valueSize) == 0) {
|
||||||
if (value != NOERROR) {
|
if (value != NOERROR) {
|
||||||
|
WS_ERROR_DEBUG(value);
|
||||||
|
errorDetected = true;
|
||||||
// MSDN says getsockopt with SO_ERROR clears the error, but it's not actually cleared
|
// MSDN says getsockopt with SO_ERROR clears the error, but it's not actually cleared
|
||||||
// and this can affect all subsequent WSAConnect attempts, so clear it now.
|
// and this can affect all subsequent WSAConnect attempts, so clear it now.
|
||||||
const int val = NO_ERROR;
|
const int val = NO_ERROR;
|
||||||
::setsockopt(socketDescriptor, SOL_SOCKET, SO_ERROR, reinterpret_cast<const char*>(&val), sizeof val);
|
::setsockopt(socketDescriptor, SOL_SOCKET, SO_ERROR, reinterpret_cast<const char*>(&val), sizeof val);
|
||||||
}
|
} else {
|
||||||
|
|
||||||
if (value == WSAECONNREFUSED) {
|
|
||||||
setError(QAbstractSocket::ConnectionRefusedError, ConnectionRefusedErrorString);
|
|
||||||
socketState = QAbstractSocket::UnconnectedState;
|
|
||||||
errorDetected = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (value == WSAETIMEDOUT) {
|
|
||||||
setError(QAbstractSocket::NetworkError, ConnectionTimeOutErrorString);
|
|
||||||
socketState = QAbstractSocket::UnconnectedState;
|
|
||||||
errorDetected = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (value == WSAEHOSTUNREACH) {
|
|
||||||
setError(QAbstractSocket::NetworkError, HostUnreachableErrorString);
|
|
||||||
socketState = QAbstractSocket::UnconnectedState;
|
|
||||||
errorDetected = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (value == WSAEADDRNOTAVAIL) {
|
|
||||||
setError(QAbstractSocket::NetworkError, AddressNotAvailableErrorString);
|
|
||||||
socketState = QAbstractSocket::UnconnectedState;
|
|
||||||
errorDetected = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (value == NOERROR) {
|
|
||||||
// When we get WSAEWOULDBLOCK the outcome was not known, so a
|
// When we get WSAEWOULDBLOCK the outcome was not known, so a
|
||||||
// NOERROR might indicate that the result of the operation
|
// NOERROR might indicate that the result of the operation
|
||||||
// is still unknown. We try again to increase the chance that we did
|
// is still unknown. We try again to increase the chance that we did
|
||||||
// get the correct result.
|
// get the correct result.
|
||||||
tryAgain = !tryAgain;
|
tryAgain = !tryAgain;
|
||||||
}
|
}
|
||||||
|
setErrorFromWSAError(value, this);
|
||||||
}
|
}
|
||||||
tries++;
|
tries++;
|
||||||
} while (tryAgain && (tries < 2));
|
} while (tryAgain && (tries < 2));
|
||||||
|
|
||||||
if (errorDetected)
|
if (errorDetected)
|
||||||
break;
|
break;
|
||||||
|
// fall through to unfinished operation error handling
|
||||||
|
err = WSAEINPROGRESS;
|
||||||
Q_FALLTHROUGH();
|
Q_FALLTHROUGH();
|
||||||
}
|
}
|
||||||
case WSAEINPROGRESS:
|
|
||||||
setError(QAbstractSocket::UnfinishedSocketOperationError, InvalidSocketErrorString);
|
|
||||||
socketState = QAbstractSocket::ConnectingState;
|
|
||||||
break;
|
|
||||||
case WSAEADDRINUSE:
|
|
||||||
setError(QAbstractSocket::NetworkError, AddressInuseErrorString);
|
|
||||||
break;
|
|
||||||
case WSAECONNREFUSED:
|
|
||||||
setError(QAbstractSocket::ConnectionRefusedError, ConnectionRefusedErrorString);
|
|
||||||
socketState = QAbstractSocket::UnconnectedState;
|
|
||||||
break;
|
|
||||||
case WSAETIMEDOUT:
|
|
||||||
setError(QAbstractSocket::NetworkError, ConnectionTimeOutErrorString);
|
|
||||||
break;
|
|
||||||
case WSAEACCES:
|
|
||||||
setError(QAbstractSocket::SocketAccessError, AccessErrorString);
|
|
||||||
socketState = QAbstractSocket::UnconnectedState;
|
|
||||||
break;
|
|
||||||
case WSAEHOSTUNREACH:
|
|
||||||
setError(QAbstractSocket::NetworkError, HostUnreachableErrorString);
|
|
||||||
socketState = QAbstractSocket::UnconnectedState;
|
|
||||||
break;
|
|
||||||
case WSAENETUNREACH:
|
|
||||||
setError(QAbstractSocket::NetworkError, NetworkUnreachableErrorString);
|
|
||||||
socketState = QAbstractSocket::UnconnectedState;
|
|
||||||
break;
|
|
||||||
case WSAEINVAL:
|
|
||||||
case WSAEALREADY:
|
|
||||||
setError(QAbstractSocket::UnfinishedSocketOperationError, InvalidSocketErrorString);
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
|
setErrorFromWSAError(err, this);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (socketState != QAbstractSocket::ConnectedState) {
|
if (socketState != QAbstractSocket::ConnectedState) {
|
||||||
|
@ -2105,8 +2105,10 @@ QImage QFontEngineFT::alphaRGBMapForGlyph(glyph_t g, QFixed subPixelPosition, co
|
|||||||
return QFontEngine::alphaRGBMapForGlyph(g, subPixelPosition, t);
|
return QFontEngine::alphaRGBMapForGlyph(g, subPixelPosition, t);
|
||||||
}
|
}
|
||||||
|
|
||||||
QImage QFontEngineFT::bitmapForGlyph(glyph_t g, QFixed subPixelPosition, const QTransform &t)
|
QImage QFontEngineFT::bitmapForGlyph(glyph_t g, QFixed subPixelPosition, const QTransform &t, const QColor &color)
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(color);
|
||||||
|
|
||||||
Glyph *glyph = loadGlyphFor(g, subPixelPosition, defaultFormat, t);
|
Glyph *glyph = loadGlyphFor(g, subPixelPosition, defaultFormat, t);
|
||||||
if (glyph == nullptr)
|
if (glyph == nullptr)
|
||||||
return QImage();
|
return QImage();
|
||||||
|
@ -236,7 +236,7 @@ private:
|
|||||||
QImage alphaMapForGlyph(glyph_t, QFixed) override;
|
QImage alphaMapForGlyph(glyph_t, QFixed) override;
|
||||||
QImage alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition, const QTransform &t) override;
|
QImage alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition, const QTransform &t) override;
|
||||||
QImage alphaRGBMapForGlyph(glyph_t, QFixed subPixelPosition, const QTransform &t) override;
|
QImage alphaRGBMapForGlyph(glyph_t, QFixed subPixelPosition, const QTransform &t) override;
|
||||||
QImage bitmapForGlyph(glyph_t, QFixed subPixelPosition, const QTransform &t) override;
|
QImage bitmapForGlyph(glyph_t, QFixed subPixelPosition, const QTransform &t, const QColor &color) override;
|
||||||
glyph_metrics_t alphaMapBoundingBox(glyph_t glyph,
|
glyph_metrics_t alphaMapBoundingBox(glyph_t glyph,
|
||||||
QFixed subPixelPosition,
|
QFixed subPixelPosition,
|
||||||
const QTransform &matrix,
|
const QTransform &matrix,
|
||||||
|
@ -747,7 +747,7 @@ qreal QCoreTextFontEngine::fontSmoothingGamma()
|
|||||||
return 2.0;
|
return 2.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
QImage QCoreTextFontEngine::imageForGlyph(glyph_t glyph, QFixed subPixelPosition, const QTransform &matrix)
|
QImage QCoreTextFontEngine::imageForGlyph(glyph_t glyph, QFixed subPixelPosition, const QTransform &matrix, const QColor &color)
|
||||||
{
|
{
|
||||||
glyph_metrics_t br = alphaMapBoundingBox(glyph, subPixelPosition, matrix, glyphFormat);
|
glyph_metrics_t br = alphaMapBoundingBox(glyph, subPixelPosition, matrix, glyphFormat);
|
||||||
|
|
||||||
@ -827,6 +827,8 @@ QImage QCoreTextFontEngine::imageForGlyph(glyph_t glyph, QFixed subPixelPosition
|
|||||||
CTFontDrawGlyphs(ctfont, &cgGlyph, &CGPointZero, 1, ctx);
|
CTFontDrawGlyphs(ctfont, &cgGlyph, &CGPointZero, 1, ctx);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
CGContextSetRGBFillColor(ctx, color.redF(), color.greenF(), color.blueF(), color.alphaF());
|
||||||
|
|
||||||
// CGContextSetTextMatrix does not work with color glyphs, so we use
|
// CGContextSetTextMatrix does not work with color glyphs, so we use
|
||||||
// the CTM instead. This means we must translate the CTM as well, to
|
// the CTM instead. This means we must translate the CTM as well, to
|
||||||
// set the glyph position, instead of using CGContextSetTextPosition.
|
// set the glyph position, instead of using CGContextSetTextPosition.
|
||||||
@ -884,12 +886,12 @@ QImage QCoreTextFontEngine::alphaRGBMapForGlyph(glyph_t glyph, QFixed subPixelPo
|
|||||||
return imageForGlyph(glyph, subPixelPosition, x);
|
return imageForGlyph(glyph, subPixelPosition, x);
|
||||||
}
|
}
|
||||||
|
|
||||||
QImage QCoreTextFontEngine::bitmapForGlyph(glyph_t glyph, QFixed subPixelPosition, const QTransform &t)
|
QImage QCoreTextFontEngine::bitmapForGlyph(glyph_t glyph, QFixed subPixelPosition, const QTransform &t, const QColor &color)
|
||||||
{
|
{
|
||||||
if (t.type() > QTransform::TxScale)
|
if (t.type() > QTransform::TxScale)
|
||||||
return QFontEngine::bitmapForGlyph(glyph, subPixelPosition, t);
|
return QFontEngine::bitmapForGlyph(glyph, subPixelPosition, t, color);
|
||||||
|
|
||||||
return imageForGlyph(glyph, subPixelPosition, t);
|
return imageForGlyph(glyph, subPixelPosition, t, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QCoreTextFontEngine::recalcAdvances(QGlyphLayout *glyphs, QFontEngine::ShaperFlags flags) const
|
void QCoreTextFontEngine::recalcAdvances(QGlyphLayout *glyphs, QFontEngine::ShaperFlags flags) const
|
||||||
|
@ -110,7 +110,7 @@ public:
|
|||||||
QImage alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition, const QTransform &t) override;
|
QImage alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition, const QTransform &t) override;
|
||||||
QImage alphaRGBMapForGlyph(glyph_t, QFixed subPixelPosition, const QTransform &t) override;
|
QImage alphaRGBMapForGlyph(glyph_t, QFixed subPixelPosition, const QTransform &t) override;
|
||||||
glyph_metrics_t alphaMapBoundingBox(glyph_t glyph, QFixed, const QTransform &matrix, GlyphFormat) override;
|
glyph_metrics_t alphaMapBoundingBox(glyph_t glyph, QFixed, const QTransform &matrix, GlyphFormat) override;
|
||||||
QImage bitmapForGlyph(glyph_t, QFixed subPixelPosition, const QTransform &t) override;
|
QImage bitmapForGlyph(glyph_t, QFixed subPixelPosition, const QTransform &t, const QColor &color) override;
|
||||||
QFixed emSquareSize() const override;
|
QFixed emSquareSize() const override;
|
||||||
void doKerning(QGlyphLayout *g, ShaperFlags flags) const override;
|
void doKerning(QGlyphLayout *g, ShaperFlags flags) const override;
|
||||||
|
|
||||||
@ -137,7 +137,7 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
QCoreTextFontEngine(const QFontDef &def);
|
QCoreTextFontEngine(const QFontDef &def);
|
||||||
void init();
|
void init();
|
||||||
QImage imageForGlyph(glyph_t glyph, QFixed subPixelPosition, const QTransform &m);
|
QImage imageForGlyph(glyph_t glyph, QFixed subPixelPosition, const QTransform &m, const QColor &color = QColor());
|
||||||
void loadAdvancesForGlyphs(QVarLengthArray<CGGlyph> &cgGlyphs, QGlyphLayout *glyphs) const;
|
void loadAdvancesForGlyphs(QVarLengthArray<CGGlyph> &cgGlyphs, QGlyphLayout *glyphs) const;
|
||||||
bool hasColorGlyphs() const;
|
bool hasColorGlyphs() const;
|
||||||
bool shouldAntialias() const;
|
bool shouldAntialias() const;
|
||||||
|
@ -650,7 +650,8 @@ bool QWindowsFontEngineDirectWrite::supportsSubPixelPositions() const
|
|||||||
QImage QWindowsFontEngineDirectWrite::imageForGlyph(glyph_t t,
|
QImage QWindowsFontEngineDirectWrite::imageForGlyph(glyph_t t,
|
||||||
QFixed subPixelPosition,
|
QFixed subPixelPosition,
|
||||||
int margin,
|
int margin,
|
||||||
const QTransform &originalTransform)
|
const QTransform &originalTransform,
|
||||||
|
const QColor &color)
|
||||||
{
|
{
|
||||||
UINT16 glyphIndex = t;
|
UINT16 glyphIndex = t;
|
||||||
FLOAT glyphAdvance = 0;
|
FLOAT glyphAdvance = 0;
|
||||||
@ -735,6 +736,7 @@ QImage QWindowsFontEngineDirectWrite::imageForGlyph(glyph_t t,
|
|||||||
|
|
||||||
#if defined(QT_USE_DIRECTWRITE2)
|
#if defined(QT_USE_DIRECTWRITE2)
|
||||||
BOOL ok = true;
|
BOOL ok = true;
|
||||||
|
|
||||||
if (SUCCEEDED(hr)) {
|
if (SUCCEEDED(hr)) {
|
||||||
while (SUCCEEDED(hr) && ok) {
|
while (SUCCEEDED(hr) && ok) {
|
||||||
const DWRITE_COLOR_GLYPH_RUN *colorGlyphRun = 0;
|
const DWRITE_COLOR_GLYPH_RUN *colorGlyphRun = 0;
|
||||||
@ -759,10 +761,18 @@ QImage QWindowsFontEngineDirectWrite::imageForGlyph(glyph_t t,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
float r = qBound(0.0f, colorGlyphRun->runColor.r, 1.0f);
|
float r, g, b, a;
|
||||||
float g = qBound(0.0f, colorGlyphRun->runColor.g, 1.0f);
|
if (colorGlyphRun->paletteIndex == 0xFFFF) {
|
||||||
float b = qBound(0.0f, colorGlyphRun->runColor.b, 1.0f);
|
r = float(color.redF());
|
||||||
float a = qBound(0.0f, colorGlyphRun->runColor.a, 1.0f);
|
g = float(color.greenF());
|
||||||
|
b = float(color.blueF());
|
||||||
|
a = float(color.alphaF());
|
||||||
|
} else {
|
||||||
|
r = qBound(0.0f, colorGlyphRun->runColor.r, 1.0f);
|
||||||
|
g = qBound(0.0f, colorGlyphRun->runColor.g, 1.0f);
|
||||||
|
b = qBound(0.0f, colorGlyphRun->runColor.b, 1.0f);
|
||||||
|
a = qBound(0.0f, colorGlyphRun->runColor.a, 1.0f);
|
||||||
|
}
|
||||||
|
|
||||||
if (!qFuzzyIsNull(a)) {
|
if (!qFuzzyIsNull(a)) {
|
||||||
renderGlyphRun(&image,
|
renderGlyphRun(&image,
|
||||||
@ -784,11 +794,21 @@ QImage QWindowsFontEngineDirectWrite::imageForGlyph(glyph_t t,
|
|||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
float r, g, b, a;
|
||||||
|
if (glyphFormat == QFontEngine::Format_ARGB) {
|
||||||
|
r = float(color.redF());
|
||||||
|
g = float(color.greenF());
|
||||||
|
b = float(color.blueF());
|
||||||
|
a = float(color.alphaF());
|
||||||
|
} else {
|
||||||
|
r = g = b = a = 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
renderGlyphRun(&image,
|
renderGlyphRun(&image,
|
||||||
0.0,
|
r,
|
||||||
0.0,
|
g,
|
||||||
0.0,
|
b,
|
||||||
1.0,
|
a,
|
||||||
glyphAnalysis,
|
glyphAnalysis,
|
||||||
boundingRect);
|
boundingRect);
|
||||||
}
|
}
|
||||||
@ -1001,9 +1021,9 @@ glyph_metrics_t QWindowsFontEngineDirectWrite::alphaMapBoundingBox(glyph_t glyph
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QImage QWindowsFontEngineDirectWrite::bitmapForGlyph(glyph_t glyph, QFixed subPixelPosition, const QTransform &t)
|
QImage QWindowsFontEngineDirectWrite::bitmapForGlyph(glyph_t glyph, QFixed subPixelPosition, const QTransform &t, const QColor &color)
|
||||||
{
|
{
|
||||||
return imageForGlyph(glyph, subPixelPosition, glyphMargin(QFontEngine::Format_A32), t);
|
return imageForGlyph(glyph, subPixelPosition, glyphMargin(QFontEngine::Format_A32), t, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
@ -112,7 +112,7 @@ public:
|
|||||||
QImage alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition) override;
|
QImage alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition) override;
|
||||||
QImage alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition, const QTransform &t) override;
|
QImage alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition, const QTransform &t) override;
|
||||||
QImage alphaRGBMapForGlyph(glyph_t t, QFixed subPixelPosition, const QTransform &xform) override;
|
QImage alphaRGBMapForGlyph(glyph_t t, QFixed subPixelPosition, const QTransform &xform) override;
|
||||||
QImage bitmapForGlyph(glyph_t, QFixed subPixelPosition, const QTransform &t) override;
|
QImage bitmapForGlyph(glyph_t, QFixed subPixelPosition, const QTransform &t, const QColor &color) override;
|
||||||
|
|
||||||
QFontEngine *cloneWithSize(qreal pixelSize) const override;
|
QFontEngine *cloneWithSize(qreal pixelSize) const override;
|
||||||
Qt::HANDLE handle() const override;
|
Qt::HANDLE handle() const override;
|
||||||
@ -126,7 +126,7 @@ public:
|
|||||||
void setUniqueFamilyName(const QString &newName) { m_uniqueFamilyName = newName; }
|
void setUniqueFamilyName(const QString &newName) { m_uniqueFamilyName = newName; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QImage imageForGlyph(glyph_t t, QFixed subPixelPosition, int margin, const QTransform &xform);
|
QImage imageForGlyph(glyph_t t, QFixed subPixelPosition, int margin, const QTransform &xform, const QColor &color = QColor());
|
||||||
void collectMetrics();
|
void collectMetrics();
|
||||||
void renderGlyphRun(QImage *destination, float r, float g, float b, float a, IDWriteGlyphRunAnalysis *glyphAnalysis, const QRect &boundingRect);
|
void renderGlyphRun(QImage *destination, float r, float g, float b, float a, IDWriteGlyphRunAnalysis *glyphAnalysis, const QRect &boundingRect);
|
||||||
static QString filenameFromFontFile(IDWriteFontFile *fontFile);
|
static QString filenameFromFontFile(IDWriteFontFile *fontFile);
|
||||||
|
@ -102,7 +102,7 @@ QEvdevMouseManager::QEvdevMouseManager(const QString &key, const QString &specif
|
|||||||
}
|
}
|
||||||
|
|
||||||
QInputDeviceManager *manager = QGuiApplicationPrivate::inputDeviceManager();
|
QInputDeviceManager *manager = QGuiApplicationPrivate::inputDeviceManager();
|
||||||
connect(manager, &QInputDeviceManager::cursorPositionChangeRequested, [=](const QPoint &pos) {
|
connect(manager, &QInputDeviceManager::cursorPositionChangeRequested, [this](const QPoint &pos) {
|
||||||
m_x = pos.x();
|
m_x = pos.x();
|
||||||
m_y = pos.y();
|
m_y = pos.y();
|
||||||
clampPosition();
|
clampPosition();
|
||||||
|
@ -115,7 +115,7 @@ QLibInputHandler::QLibInputHandler(const QString &key, const QString &spec)
|
|||||||
m_touch.reset(new QLibInputTouch);
|
m_touch.reset(new QLibInputTouch);
|
||||||
|
|
||||||
QInputDeviceManager *manager = QGuiApplicationPrivate::inputDeviceManager();
|
QInputDeviceManager *manager = QGuiApplicationPrivate::inputDeviceManager();
|
||||||
connect(manager, &QInputDeviceManager::cursorPositionChangeRequested, [=](const QPoint &pos) {
|
connect(manager, &QInputDeviceManager::cursorPositionChangeRequested, [this](const QPoint &pos) {
|
||||||
m_pointer->setPos(pos);
|
m_pointer->setPos(pos);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -47,6 +47,7 @@
|
|||||||
#include <QtCore/qobject.h>
|
#include <QtCore/qobject.h>
|
||||||
#include <QtCore/qrect.h>
|
#include <QtCore/qrect.h>
|
||||||
#include <QtCore/qtextboundaryfinder.h>
|
#include <QtCore/qtextboundaryfinder.h>
|
||||||
|
#include <QtCore/qoperatingsystemversion.h>
|
||||||
|
|
||||||
#include <QtGui/qevent.h>
|
#include <QtGui/qevent.h>
|
||||||
#include <QtGui/qtextformat.h>
|
#include <QtGui/qtextformat.h>
|
||||||
@ -279,7 +280,13 @@ void QWindowsInputContext::showInputPanel()
|
|||||||
// with Windows 10 if the Windows IME is (re)enabled _after_ the caret is shown.
|
// with Windows 10 if the Windows IME is (re)enabled _after_ the caret is shown.
|
||||||
if (m_caretCreated) {
|
if (m_caretCreated) {
|
||||||
cursorRectChanged();
|
cursorRectChanged();
|
||||||
ShowCaret(platformWindow->handle());
|
// We only call ShowCaret() on Windows 10 as in earlier versions the caret
|
||||||
|
// would actually be visible (QTBUG-74492) and the workaround for the
|
||||||
|
// Surface seems unnecessary there anyway. But leave it hidden for IME.
|
||||||
|
if (QOperatingSystemVersion::current() >= QOperatingSystemVersion::Windows10)
|
||||||
|
ShowCaret(platformWindow->handle());
|
||||||
|
else
|
||||||
|
HideCaret(platformWindow->handle());
|
||||||
setWindowsImeEnabled(platformWindow, false);
|
setWindowsImeEnabled(platformWindow, false);
|
||||||
setWindowsImeEnabled(platformWindow, true);
|
setWindowsImeEnabled(platformWindow, true);
|
||||||
}
|
}
|
||||||
|
@ -80,13 +80,12 @@ bool QWindowsPointerHandler::translatePointerEvent(QWindow *window, HWND hwnd, Q
|
|||||||
*result = 0;
|
*result = 0;
|
||||||
const quint32 pointerId = GET_POINTERID_WPARAM(msg.wParam);
|
const quint32 pointerId = GET_POINTERID_WPARAM(msg.wParam);
|
||||||
|
|
||||||
POINTER_INPUT_TYPE pointerType;
|
if (!QWindowsContext::user32dll.getPointerType(pointerId, &m_pointerType)) {
|
||||||
if (!QWindowsContext::user32dll.getPointerType(pointerId, &pointerType)) {
|
|
||||||
qWarning() << "GetPointerType() failed:" << qt_error_string();
|
qWarning() << "GetPointerType() failed:" << qt_error_string();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (pointerType) {
|
switch (m_pointerType) {
|
||||||
case QT_PT_POINTER:
|
case QT_PT_POINTER:
|
||||||
case QT_PT_MOUSE:
|
case QT_PT_MOUSE:
|
||||||
case QT_PT_TOUCHPAD: {
|
case QT_PT_TOUCHPAD: {
|
||||||
@ -684,7 +683,7 @@ bool QWindowsPointerHandler::translateMouseWheelEvent(QWindow *window,
|
|||||||
|
|
||||||
QPoint localPos = QWindowsGeometryHint::mapFromGlobal(receiver, globalPos);
|
QPoint localPos = QWindowsGeometryHint::mapFromGlobal(receiver, globalPos);
|
||||||
|
|
||||||
QWindowSystemInterface::handleWheelEvent(window, localPos, globalPos, QPoint(), angleDelta, keyModifiers);
|
QWindowSystemInterface::handleWheelEvent(receiver, localPos, globalPos, QPoint(), angleDelta, keyModifiers);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -728,7 +727,11 @@ bool QWindowsPointerHandler::translateMouseEvent(QWindow *window,
|
|||||||
}
|
}
|
||||||
|
|
||||||
Qt::MouseEventSource source = Qt::MouseEventNotSynthesized;
|
Qt::MouseEventSource source = Qt::MouseEventNotSynthesized;
|
||||||
if (isMouseEventSynthesizedFromPenOrTouch()) {
|
// Following the logic of the old mouse handler, only events synthesized
|
||||||
|
// for touch screen are marked as such. On some systems, using the bit 7 of
|
||||||
|
// the extra msg info for checking if synthesized for touch does not work,
|
||||||
|
// so we use the pointer type of the last pointer message.
|
||||||
|
if (isMouseEventSynthesizedFromPenOrTouch() && m_pointerType == QT_PT_TOUCH) {
|
||||||
if (QWindowsIntegration::instance()->options() & QWindowsIntegration::DontPassOsMouseEventsSynthesizedFromTouch)
|
if (QWindowsIntegration::instance()->options() & QWindowsIntegration::DontPassOsMouseEventsSynthesizedFromTouch)
|
||||||
return false;
|
return false;
|
||||||
source = Qt::MouseEventSynthesizedBySystem;
|
source = Qt::MouseEventSynthesizedBySystem;
|
||||||
|
@ -82,6 +82,7 @@ private:
|
|||||||
bool m_needsEnterOnPointerUpdate = false;
|
bool m_needsEnterOnPointerUpdate = false;
|
||||||
QEvent::Type m_lastEventType = QEvent::None;
|
QEvent::Type m_lastEventType = QEvent::None;
|
||||||
Qt::MouseButton m_lastEventButton = Qt::NoButton;
|
Qt::MouseButton m_lastEventButton = Qt::NoButton;
|
||||||
|
DWORD m_pointerType = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
@ -226,11 +226,13 @@ void QXcbEventQueue::run()
|
|||||||
};
|
};
|
||||||
|
|
||||||
while (!m_closeConnectionDetected && (event = xcb_wait_for_event(connection))) {
|
while (!m_closeConnectionDetected && (event = xcb_wait_for_event(connection))) {
|
||||||
|
m_newEventsMutex.lock();
|
||||||
enqueueEvent(event);
|
enqueueEvent(event);
|
||||||
while (!m_closeConnectionDetected && (event = xcb_poll_for_queued_event(connection)))
|
while (!m_closeConnectionDetected && (event = xcb_poll_for_queued_event(connection)))
|
||||||
enqueueEvent(event);
|
enqueueEvent(event);
|
||||||
|
|
||||||
m_newEventsCondition.wakeOne();
|
m_newEventsCondition.wakeOne();
|
||||||
|
m_newEventsMutex.unlock();
|
||||||
wakeUpDispatcher();
|
wakeUpDispatcher();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -350,9 +352,12 @@ bool QXcbEventQueue::peekEventQueue(PeekerCallback peeker, void *peekerData,
|
|||||||
|
|
||||||
void QXcbEventQueue::waitForNewEvents(unsigned long time)
|
void QXcbEventQueue::waitForNewEvents(unsigned long time)
|
||||||
{
|
{
|
||||||
m_newEventsMutex.lock();
|
QMutexLocker locker(&m_newEventsMutex);
|
||||||
|
QXcbEventNode *tailBeforeFlush = m_flushedTail;
|
||||||
|
flushBufferedEvents();
|
||||||
|
if (tailBeforeFlush != m_flushedTail)
|
||||||
|
return;
|
||||||
m_newEventsCondition.wait(&m_newEventsMutex, time);
|
m_newEventsCondition.wait(&m_newEventsMutex, time);
|
||||||
m_newEventsMutex.unlock();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QXcbEventQueue::sendCloseConnectionEvent() const
|
void QXcbEventQueue::sendCloseConnectionEvent() const
|
||||||
|
10
src/src.pro
10
src/src.pro
@ -1,8 +1,10 @@
|
|||||||
TEMPLATE = subdirs
|
TEMPLATE = subdirs
|
||||||
|
|
||||||
QT_FOR_CONFIG += core-private gui-private
|
QT_FOR_CONFIG += core-private gui-private printsupport
|
||||||
|
|
||||||
include($$OUT_PWD/corelib/qtcore-config.pri)
|
include($$OUT_PWD/corelib/qtcore-config.pri)
|
||||||
include($$OUT_PWD/gui/qtgui-config.pri)
|
include($$OUT_PWD/gui/qtgui-config.pri)
|
||||||
|
include($$OUT_PWD/printsupport/qtprintsupport-config.pri)
|
||||||
|
|
||||||
force_bootstrap|!qtConfig(commandlineparser): \
|
force_bootstrap|!qtConfig(commandlineparser): \
|
||||||
CONFIG += force_dbus_bootstrap
|
CONFIG += force_dbus_bootstrap
|
||||||
@ -221,11 +223,13 @@ qtConfig(gui) {
|
|||||||
src_testlib.depends += src_gui # if QtGui is enabled, QtTest requires QtGui's headers
|
src_testlib.depends += src_gui # if QtGui is enabled, QtTest requires QtGui's headers
|
||||||
qtConfig(widgets) {
|
qtConfig(widgets) {
|
||||||
SUBDIRS += src_tools_uic src_widgets
|
SUBDIRS += src_tools_uic src_widgets
|
||||||
!android-embedded: SUBDIRS += src_printsupport
|
|
||||||
TOOLS += src_tools_uic
|
TOOLS += src_tools_uic
|
||||||
src_plugins.depends += src_widgets
|
src_plugins.depends += src_widgets
|
||||||
!android-embedded: src_plugins.depends += src_printsupport
|
|
||||||
src_testlib.depends += src_widgets # if QtWidgets is enabled, QtTest requires QtWidgets's headers
|
src_testlib.depends += src_widgets # if QtWidgets is enabled, QtTest requires QtWidgets's headers
|
||||||
|
qtConfig(printer) {
|
||||||
|
SUBDIRS += src_printsupport
|
||||||
|
src_plugins.depends += src_printsupport
|
||||||
|
}
|
||||||
qtConfig(opengl) {
|
qtConfig(opengl) {
|
||||||
SUBDIRS += src_opengl
|
SUBDIRS += src_opengl
|
||||||
src_plugins.depends += src_opengl
|
src_plugins.depends += src_opengl
|
||||||
|
@ -1740,7 +1740,7 @@ void QColorDialogPrivate::initWidgets()
|
|||||||
q->connect(custom, SIGNAL(selected(int,int)), SLOT(_q_newCustom(int,int)));
|
q->connect(custom, SIGNAL(selected(int,int)), SLOT(_q_newCustom(int,int)));
|
||||||
q->connect(custom, SIGNAL(currentChanged(int,int)), SLOT(_q_nextCustom(int,int)));
|
q->connect(custom, SIGNAL(currentChanged(int,int)), SLOT(_q_nextCustom(int,int)));
|
||||||
|
|
||||||
q->connect(custom, &QWellArray::colorChanged, [=] (int index, QRgb color) {
|
q->connect(custom, &QWellArray::colorChanged, [this] (int index, QRgb color) {
|
||||||
QColorDialogOptions::setCustomColor(index, color);
|
QColorDialogOptions::setCustomColor(index, color);
|
||||||
if (custom)
|
if (custom)
|
||||||
custom->update();
|
custom->update();
|
||||||
|
@ -691,7 +691,7 @@ void QGraphicsViewPrivate::mouseMoveEventHandler(QMouseEvent *event)
|
|||||||
}
|
}
|
||||||
// Find the topmost item under the mouse with a cursor.
|
// Find the topmost item under the mouse with a cursor.
|
||||||
foreach (QGraphicsItem *item, scene->d_func()->cachedItemsUnderMouse) {
|
foreach (QGraphicsItem *item, scene->d_func()->cachedItemsUnderMouse) {
|
||||||
if (item->hasCursor()) {
|
if (item->isEnabled() && item->hasCursor()) {
|
||||||
_q_setViewportCursor(item->cursor());
|
_q_setViewportCursor(item->cursor());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -808,7 +808,7 @@ void QGraphicsViewPrivate::_q_unsetViewportCursor()
|
|||||||
Q_Q(QGraphicsView);
|
Q_Q(QGraphicsView);
|
||||||
const auto items = q->items(lastMouseEvent.pos());
|
const auto items = q->items(lastMouseEvent.pos());
|
||||||
for (QGraphicsItem *item : items) {
|
for (QGraphicsItem *item : items) {
|
||||||
if (item->hasCursor()) {
|
if (item->isEnabled() && item->hasCursor()) {
|
||||||
_q_setViewportCursor(item->cursor());
|
_q_setViewportCursor(item->cursor());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1895,7 +1895,7 @@ bool QListViewPrivate::dropOn(QDropEvent *event, int *dropRow, int *dropCol, QMo
|
|||||||
|
|
||||||
void QListViewPrivate::removeCurrentAndDisabled(QVector<QModelIndex> *indexes, const QModelIndex ¤t) const
|
void QListViewPrivate::removeCurrentAndDisabled(QVector<QModelIndex> *indexes, const QModelIndex ¤t) const
|
||||||
{
|
{
|
||||||
auto isCurrentOrDisabled = [=](const QModelIndex &index) {
|
auto isCurrentOrDisabled = [this, current](const QModelIndex &index) {
|
||||||
return !isIndexEnabled(index) || index == current;
|
return !isIndexEnabled(index) || index == current;
|
||||||
};
|
};
|
||||||
indexes->erase(std::remove_if(indexes->begin(), indexes->end(),
|
indexes->erase(std::remove_if(indexes->begin(), indexes->end(),
|
||||||
|
@ -7453,6 +7453,17 @@ QByteArray QWidget::saveGeometry() const
|
|||||||
return array;
|
return array;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void checkRestoredGeometry(const QRect &availableGeometry, QRect *restoredGeometry,
|
||||||
|
int frameHeight)
|
||||||
|
{
|
||||||
|
if (!restoredGeometry->intersects(availableGeometry)) {
|
||||||
|
restoredGeometry->moveBottom(qMin(restoredGeometry->bottom(), availableGeometry.bottom()));
|
||||||
|
restoredGeometry->moveLeft(qMax(restoredGeometry->left(), availableGeometry.left()));
|
||||||
|
restoredGeometry->moveRight(qMin(restoredGeometry->right(), availableGeometry.right()));
|
||||||
|
}
|
||||||
|
restoredGeometry->moveTop(qMax(restoredGeometry->top(), availableGeometry.top() + frameHeight));
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\since 4.2
|
\since 4.2
|
||||||
|
|
||||||
@ -7507,7 +7518,7 @@ bool QWidget::restoreGeometry(const QByteArray &geometry)
|
|||||||
quint8 fullScreen;
|
quint8 fullScreen;
|
||||||
qint32 restoredScreenWidth = 0;
|
qint32 restoredScreenWidth = 0;
|
||||||
|
|
||||||
stream >> restoredFrameGeometry
|
stream >> restoredFrameGeometry // Only used for sanity checks in version 0
|
||||||
>> restoredNormalGeometry
|
>> restoredNormalGeometry
|
||||||
>> restoredScreenNumber
|
>> restoredScreenNumber
|
||||||
>> maximized
|
>> maximized
|
||||||
@ -7537,8 +7548,6 @@ bool QWidget::restoreGeometry(const QByteArray &geometry)
|
|||||||
}
|
}
|
||||||
|
|
||||||
const int frameHeight = 20;
|
const int frameHeight = 20;
|
||||||
if (!restoredFrameGeometry.isValid())
|
|
||||||
restoredFrameGeometry = QRect(QPoint(0,0), sizeHint());
|
|
||||||
|
|
||||||
if (!restoredNormalGeometry.isValid())
|
if (!restoredNormalGeometry.isValid())
|
||||||
restoredNormalGeometry = QRect(QPoint(0, frameHeight), sizeHint());
|
restoredNormalGeometry = QRect(QPoint(0, frameHeight), sizeHint());
|
||||||
@ -7558,23 +7567,11 @@ bool QWidget::restoreGeometry(const QByteArray &geometry)
|
|||||||
// - (Mac only) The window is higher than the available geometry. It must
|
// - (Mac only) The window is higher than the available geometry. It must
|
||||||
// be possible to bring the size grip on screen by moving the window.
|
// be possible to bring the size grip on screen by moving the window.
|
||||||
#if 0 // Used to be included in Qt4 for Q_WS_MAC
|
#if 0 // Used to be included in Qt4 for Q_WS_MAC
|
||||||
restoredFrameGeometry.setHeight(qMin(restoredFrameGeometry.height(), availableGeometry.height()));
|
|
||||||
restoredNormalGeometry.setHeight(qMin(restoredNormalGeometry.height(), availableGeometry.height() - frameHeight));
|
restoredNormalGeometry.setHeight(qMin(restoredNormalGeometry.height(), availableGeometry.height() - frameHeight));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!restoredFrameGeometry.intersects(availableGeometry)) {
|
checkRestoredGeometry(availableGeometry, &restoredGeometry, frameHeight);
|
||||||
restoredFrameGeometry.moveBottom(qMin(restoredFrameGeometry.bottom(), availableGeometry.bottom()));
|
checkRestoredGeometry(availableGeometry, &restoredNormalGeometry, frameHeight);
|
||||||
restoredFrameGeometry.moveLeft(qMax(restoredFrameGeometry.left(), availableGeometry.left()));
|
|
||||||
restoredFrameGeometry.moveRight(qMin(restoredFrameGeometry.right(), availableGeometry.right()));
|
|
||||||
}
|
|
||||||
restoredFrameGeometry.moveTop(qMax(restoredFrameGeometry.top(), availableGeometry.top()));
|
|
||||||
|
|
||||||
if (!restoredNormalGeometry.intersects(availableGeometry)) {
|
|
||||||
restoredNormalGeometry.moveBottom(qMin(restoredNormalGeometry.bottom(), availableGeometry.bottom()));
|
|
||||||
restoredNormalGeometry.moveLeft(qMax(restoredNormalGeometry.left(), availableGeometry.left()));
|
|
||||||
restoredNormalGeometry.moveRight(qMin(restoredNormalGeometry.right(), availableGeometry.right()));
|
|
||||||
}
|
|
||||||
restoredNormalGeometry.moveTop(qMax(restoredNormalGeometry.top(), availableGeometry.top() + frameHeight));
|
|
||||||
|
|
||||||
if (maximized || fullScreen) {
|
if (maximized || fullScreen) {
|
||||||
// set geometry before setting the window state to make
|
// set geometry before setting the window state to make
|
||||||
|
@ -684,7 +684,7 @@ QSize QLineEdit::sizeHint() const
|
|||||||
ensurePolished();
|
ensurePolished();
|
||||||
QFontMetrics fm(font());
|
QFontMetrics fm(font());
|
||||||
const int iconSize = style()->pixelMetric(QStyle::PM_SmallIconSize, 0, this);
|
const int iconSize = style()->pixelMetric(QStyle::PM_SmallIconSize, 0, this);
|
||||||
int h = qMax(fm.height(), iconSize - 2) + 2*d->verticalMargin
|
int h = qMax(fm.height(), qMax(14, iconSize - 2)) + 2*d->verticalMargin
|
||||||
+ d->topTextMargin + d->bottomTextMargin
|
+ d->topTextMargin + d->bottomTextMargin
|
||||||
+ d->topmargin + d->bottommargin;
|
+ d->topmargin + d->bottommargin;
|
||||||
int w = fm.horizontalAdvance(QLatin1Char('x')) * 17 + 2*d->horizontalMargin
|
int w = fm.horizontalAdvance(QLatin1Char('x')) * 17 + 2*d->horizontalMargin
|
||||||
|
@ -200,7 +200,7 @@ void QMenuPrivate::init()
|
|||||||
q->setAttribute(Qt::WA_X11NetWmWindowTypePopupMenu);
|
q->setAttribute(Qt::WA_X11NetWmWindowTypePopupMenu);
|
||||||
defaultMenuAction = menuAction = new QAction(q);
|
defaultMenuAction = menuAction = new QAction(q);
|
||||||
menuAction->d_func()->menu = q;
|
menuAction->d_func()->menu = q;
|
||||||
QObject::connect(menuAction, &QAction::changed, [=] {
|
QObject::connect(menuAction, &QAction::changed, [this] {
|
||||||
if (!tornPopup.isNull())
|
if (!tornPopup.isNull())
|
||||||
tornPopup->updateWindowTitle();
|
tornPopup->updateWindowTitle();
|
||||||
});
|
});
|
||||||
|
@ -164,9 +164,8 @@ private slots:
|
|||||||
void waitForReadyReadInASlot();
|
void waitForReadyReadInASlot();
|
||||||
void remoteCloseError();
|
void remoteCloseError();
|
||||||
void nestedEventLoopInErrorSlot();
|
void nestedEventLoopInErrorSlot();
|
||||||
#ifndef Q_OS_WIN
|
void connectToHostError_data();
|
||||||
void connectToLocalHostNoService();
|
void connectToHostError();
|
||||||
#endif
|
|
||||||
void waitForConnectedInHostLookupSlot();
|
void waitForConnectedInHostLookupSlot();
|
||||||
void waitForConnectedInHostLookupSlot2();
|
void waitForConnectedInHostLookupSlot2();
|
||||||
void readyReadSignalsAfterWaitForReadyRead();
|
void readyReadSignalsAfterWaitForReadyRead();
|
||||||
@ -2040,18 +2039,38 @@ void tst_QTcpSocket::nestedEventLoopInErrorSlot()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
#ifndef Q_OS_WIN
|
|
||||||
void tst_QTcpSocket::connectToLocalHostNoService()
|
void tst_QTcpSocket::connectToHostError_data()
|
||||||
|
{
|
||||||
|
QTest::addColumn<QString>("host");
|
||||||
|
QTest::addColumn<int>("port");
|
||||||
|
QTest::addColumn<QAbstractSocket::SocketError>("expectedError");
|
||||||
|
|
||||||
|
QTest::newRow("localhost no service") << QStringLiteral("localhost") << 31415 << QAbstractSocket::ConnectionRefusedError;
|
||||||
|
QTest::newRow("unreachable") << QStringLiteral("0.0.0.1") << 65000 << QAbstractSocket::NetworkError;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void tst_QTcpSocket::connectToHostError()
|
||||||
{
|
{
|
||||||
// This test was created after we received a report that claimed
|
|
||||||
// QTcpSocket would crash if trying to connect to "localhost" on a random
|
|
||||||
// port with no service listening.
|
|
||||||
QTcpSocket *socket = newSocket();
|
QTcpSocket *socket = newSocket();
|
||||||
socket->connectToHost("localhost", 31415); // no service running here, one suspects
|
|
||||||
|
QAbstractSocket::SocketError error = QAbstractSocket::UnknownSocketError;
|
||||||
|
|
||||||
|
QFETCH(QString, host);
|
||||||
|
QFETCH(int, port);
|
||||||
|
QFETCH(QAbstractSocket::SocketError, expectedError);
|
||||||
|
|
||||||
|
connect(socket, QOverload<QAbstractSocket::SocketError>::of(&QAbstractSocket::error),[&](QAbstractSocket::SocketError socketError){
|
||||||
|
error = socketError;
|
||||||
|
});
|
||||||
|
socket->connectToHost(host, port); // no service running here, one suspects
|
||||||
QTRY_COMPARE(socket->state(), QTcpSocket::UnconnectedState);
|
QTRY_COMPARE(socket->state(), QTcpSocket::UnconnectedState);
|
||||||
|
if (error != expectedError && error == QAbstractSocket::ConnectionRefusedError)
|
||||||
|
QEXPECT_FAIL("unreachable", "CI firewall interfers with this test", Continue);
|
||||||
|
QCOMPARE(error, expectedError);
|
||||||
delete socket;
|
delete socket;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
void tst_QTcpSocket::waitForConnectedInHostLookupSlot()
|
void tst_QTcpSocket::waitForConnectedInHostLookupSlot()
|
||||||
|
@ -2711,7 +2711,6 @@ void tst_QSslSocket::encryptWithoutConnecting()
|
|||||||
|
|
||||||
void tst_QSslSocket::resume_data()
|
void tst_QSslSocket::resume_data()
|
||||||
{
|
{
|
||||||
QSKIP("Temporary skip while updating certificates");
|
|
||||||
QTest::addColumn<bool>("ignoreErrorsAfterPause");
|
QTest::addColumn<bool>("ignoreErrorsAfterPause");
|
||||||
QTest::addColumn<QList<QSslError> >("errorsToIgnore");
|
QTest::addColumn<QList<QSslError> >("errorsToIgnore");
|
||||||
QTest::addColumn<bool>("expectSuccess");
|
QTest::addColumn<bool>("expectSuccess");
|
||||||
|
@ -1811,7 +1811,8 @@ void tst_QGraphicsItem::selected_multi()
|
|||||||
|
|
||||||
{
|
{
|
||||||
// Ctrl-move on item1
|
// Ctrl-move on item1
|
||||||
QMouseEvent event(QEvent::MouseMove, view.mapFromScene(item1->scenePos()) + QPoint(1, 0), Qt::LeftButton, Qt::LeftButton, Qt::ControlModifier);
|
const QPoint item1Point = view.mapFromScene(item1->scenePos()) + QPoint(1, 0);
|
||||||
|
QMouseEvent event(QEvent::MouseMove, item1Point, view.viewport()->mapToGlobal(item1Point), Qt::LeftButton, Qt::LeftButton, Qt::ControlModifier);
|
||||||
QApplication::sendEvent(view.viewport(), &event);
|
QApplication::sendEvent(view.viewport(), &event);
|
||||||
QVERIFY(!item1->isSelected());
|
QVERIFY(!item1->isSelected());
|
||||||
QVERIFY(!item2->isSelected());
|
QVERIFY(!item2->isSelected());
|
||||||
@ -1832,7 +1833,8 @@ void tst_QGraphicsItem::selected_multi()
|
|||||||
|
|
||||||
{
|
{
|
||||||
// Ctrl-move on item1
|
// Ctrl-move on item1
|
||||||
QMouseEvent event(QEvent::MouseMove, view.mapFromScene(item1->scenePos()) + QPoint(1, 0), Qt::LeftButton, Qt::LeftButton, Qt::ControlModifier);
|
const QPoint item1Point = view.mapFromScene(item1->scenePos()) + QPoint(1, 0);
|
||||||
|
QMouseEvent event(QEvent::MouseMove, item1Point, view.viewport()->mapToGlobal(item1Point), Qt::LeftButton, Qt::LeftButton, Qt::ControlModifier);
|
||||||
QApplication::sendEvent(view.viewport(), &event);
|
QApplication::sendEvent(view.viewport(), &event);
|
||||||
QVERIFY(item1->isSelected());
|
QVERIFY(item1->isSelected());
|
||||||
QVERIFY(!item2->isSelected());
|
QVERIFY(!item2->isSelected());
|
||||||
@ -4151,6 +4153,8 @@ void tst_QGraphicsItem::cursor()
|
|||||||
QGraphicsView view(&scene);
|
QGraphicsView view(&scene);
|
||||||
view.showFullScreen();
|
view.showFullScreen();
|
||||||
QVERIFY(QTest::qWaitForWindowExposed(&view));
|
QVERIFY(QTest::qWaitForWindowExposed(&view));
|
||||||
|
const Qt::CursorShape viewportShape = view.viewport()->cursor().shape();
|
||||||
|
|
||||||
QGraphicsRectItem *item1 = scene.addRect(QRectF(-100, 0, 50, 50));
|
QGraphicsRectItem *item1 = scene.addRect(QRectF(-100, 0, 50, 50));
|
||||||
QGraphicsRectItem *item2 = scene.addRect(QRectF(50, 0, 50, 50));
|
QGraphicsRectItem *item2 = scene.addRect(QRectF(50, 0, 50, 50));
|
||||||
|
|
||||||
@ -4178,41 +4182,45 @@ void tst_QGraphicsItem::cursor()
|
|||||||
item1->setCursor(Qt::IBeamCursor);
|
item1->setCursor(Qt::IBeamCursor);
|
||||||
item2->setCursor(Qt::PointingHandCursor);
|
item2->setCursor(Qt::PointingHandCursor);
|
||||||
|
|
||||||
QTest::mouseMove(&view, view.rect().center());
|
QPoint viewCenter = view.rect().center();
|
||||||
|
QPoint item1Center = view.mapFromScene(item1->sceneBoundingRect().center());
|
||||||
const Qt::CursorShape viewportShape = view.viewport()->cursor().shape();
|
QPoint item2Center = view.mapFromScene(item2->sceneBoundingRect().center());
|
||||||
|
|
||||||
{
|
{
|
||||||
QTest::mouseMove(view.viewport(), QPoint(100, 50));
|
QMouseEvent event(QEvent::MouseMove, viewCenter, view.viewport()->mapToGlobal(viewCenter), Qt::NoButton, 0, 0);
|
||||||
QMouseEvent event(QEvent::MouseMove, QPoint(100, 50), Qt::NoButton, 0, 0);
|
|
||||||
QApplication::sendEvent(view.viewport(), &event);
|
QApplication::sendEvent(view.viewport(), &event);
|
||||||
}
|
}
|
||||||
|
|
||||||
QTRY_COMPARE(view.viewport()->cursor().shape(), viewportShape);
|
QCOMPARE(view.viewport()->cursor().shape(), viewportShape);
|
||||||
|
|
||||||
{
|
{
|
||||||
QTest::mouseMove(view.viewport(), view.mapFromScene(item1->sceneBoundingRect().center()));
|
QMouseEvent event(QEvent::MouseMove, item1Center, view.viewport()->mapToGlobal(item1Center), Qt::NoButton, 0, 0);
|
||||||
QMouseEvent event(QEvent::MouseMove, view.mapFromScene(item1->sceneBoundingRect().center()), Qt::NoButton, 0, 0);
|
|
||||||
QApplication::sendEvent(view.viewport(), &event);
|
QApplication::sendEvent(view.viewport(), &event);
|
||||||
}
|
}
|
||||||
|
|
||||||
QTRY_COMPARE(view.viewport()->cursor().shape(), item1->cursor().shape());
|
QCOMPARE(view.viewport()->cursor().shape(), item1->cursor().shape());
|
||||||
|
|
||||||
{
|
{
|
||||||
QTest::mouseMove(view.viewport(), view.mapFromScene(item2->sceneBoundingRect().center()));
|
QMouseEvent event(QEvent::MouseMove, item2Center, view.viewport()->mapToGlobal(item2Center), Qt::NoButton, 0, 0);
|
||||||
QMouseEvent event(QEvent::MouseMove, view.mapFromScene(item2->sceneBoundingRect().center()), Qt::NoButton, 0, 0);
|
|
||||||
QApplication::sendEvent(view.viewport(), &event);
|
QApplication::sendEvent(view.viewport(), &event);
|
||||||
}
|
}
|
||||||
|
|
||||||
QTRY_COMPARE(view.viewport()->cursor().shape(), item2->cursor().shape());
|
QCOMPARE(view.viewport()->cursor().shape(), item2->cursor().shape());
|
||||||
|
|
||||||
{
|
{
|
||||||
QTest::mouseMove(view.viewport(), view.rect().center());
|
QMouseEvent event(QEvent::MouseMove, viewCenter, view.viewport()->mapToGlobal(viewCenter), Qt::NoButton, 0, 0);
|
||||||
QMouseEvent event(QEvent::MouseMove, QPoint(100, 25), Qt::NoButton, 0, 0);
|
|
||||||
QApplication::sendEvent(view.viewport(), &event);
|
QApplication::sendEvent(view.viewport(), &event);
|
||||||
}
|
}
|
||||||
|
|
||||||
QTRY_COMPARE(view.viewport()->cursor().shape(), viewportShape);
|
QCOMPARE(view.viewport()->cursor().shape(), viewportShape);
|
||||||
|
|
||||||
|
item1->setEnabled(false);
|
||||||
|
{
|
||||||
|
QMouseEvent event(QEvent::MouseMove, item1Center, view.viewport()->mapToGlobal(item1Center), Qt::NoButton, 0, 0);
|
||||||
|
QApplication::sendEvent(view.viewport(), &event);
|
||||||
|
}
|
||||||
|
|
||||||
|
QCOMPARE(view.viewport()->cursor().shape(), viewportShape);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
/*
|
/*
|
||||||
@ -5055,12 +5063,6 @@ public:
|
|||||||
|
|
||||||
void tst_QGraphicsItem::paint()
|
void tst_QGraphicsItem::paint()
|
||||||
{
|
{
|
||||||
#if defined(Q_OS_MACOS)
|
|
||||||
if (QSysInfo::productVersion() == QLatin1String("10.12")) {
|
|
||||||
QSKIP("Test is very flaky on MacOS_10_12, see QTBUG-76566");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
QGraphicsScene scene;
|
QGraphicsScene scene;
|
||||||
|
|
||||||
PaintTester paintTester;
|
PaintTester paintTester;
|
||||||
@ -5090,22 +5092,25 @@ void tst_QGraphicsItem::paint()
|
|||||||
PaintTester tester2;
|
PaintTester tester2;
|
||||||
scene2.addItem(&tester2);
|
scene2.addItem(&tester2);
|
||||||
|
|
||||||
//First show one paint
|
//First show at least one paint
|
||||||
QTRY_COMPARE(tester2.painted, 1);
|
QCOMPARE(tester2.painted, 0);
|
||||||
|
QTRY_VERIFY(tester2.painted > 0);
|
||||||
|
int painted = tester2.painted;
|
||||||
|
|
||||||
//nominal case, update call paint
|
//nominal case, update call paint
|
||||||
tester2.update();
|
tester2.update();
|
||||||
QTRY_COMPARE(tester2.painted, 2);
|
QTRY_COMPARE(tester2.painted, painted + 1);
|
||||||
|
painted = tester2.painted;
|
||||||
|
|
||||||
//we remove the item from the scene, number of updates is still the same
|
//we remove the item from the scene, number of updates is still the same
|
||||||
tester2.update();
|
tester2.update();
|
||||||
scene2.removeItem(&tester2);
|
scene2.removeItem(&tester2);
|
||||||
QTRY_COMPARE(tester2.painted, 2);
|
QTRY_COMPARE(tester2.painted, painted);
|
||||||
|
|
||||||
//We re-add the item, the number of paint should increase
|
//We re-add the item, the number of paint should increase
|
||||||
scene2.addItem(&tester2);
|
scene2.addItem(&tester2);
|
||||||
tester2.update();
|
tester2.update();
|
||||||
QTRY_COMPARE(tester2.painted, 3);
|
QTRY_COMPARE(tester2.painted, painted + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
class HarakiriItem : public QGraphicsRectItem
|
class HarakiriItem : public QGraphicsRectItem
|
||||||
@ -11375,7 +11380,7 @@ void tst_QGraphicsItem::QTBUG_7714_fullUpdateDiscardingOpacityUpdate2()
|
|||||||
origView.reset();
|
origView.reset();
|
||||||
childYellow->setOpacity(0.0);
|
childYellow->setOpacity(0.0);
|
||||||
|
|
||||||
QTRY_COMPARE(origView.repaints, 1);
|
QTRY_VERIFY(origView.repaints > 0);
|
||||||
|
|
||||||
view.show();
|
view.show();
|
||||||
qApp->setActiveWindow(&view);
|
qApp->setActiveWindow(&view);
|
||||||
@ -11390,8 +11395,8 @@ void tst_QGraphicsItem::QTBUG_7714_fullUpdateDiscardingOpacityUpdate2()
|
|||||||
QEXPECT_FAIL("", "Fails on WinRT. Figure out why - QTBUG-68297", Abort);
|
QEXPECT_FAIL("", "Fails on WinRT. Figure out why - QTBUG-68297", Abort);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
QTRY_COMPARE(origView.repaints, 1);
|
QTRY_VERIFY(origView.repaints > 0);
|
||||||
QTRY_COMPARE(view.repaints, 1);
|
QTRY_VERIFY(view.repaints > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void tst_QGraphicsItem::QT_2649_focusScope()
|
void tst_QGraphicsItem::QT_2649_focusScope()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user