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

Conflicts:
	src/plugins/platforms/ios/qiosmessagedialog.mm

Change-Id: Icfbf55c3215ec088e552d0b42a5c94d04b17c65f
This commit is contained in:
Liang Qi 2016-09-26 21:43:25 +02:00
commit 06bd93c4ac
140 changed files with 2032 additions and 718 deletions

View File

@ -43,9 +43,10 @@ extern "C" {
#include <jpeglib.h>
}
j_compress_ptr cinfo;
int main(int, char **)
{
j_compress_ptr cinfo;
jpeg_create_compress(cinfo);
return 0;
}

339
dist/changes-5.6.2 vendored Normal file
View File

@ -0,0 +1,339 @@
Qt 5.6.2 is a bug-fix release. It maintains both forward and backward
compatibility (source and binary) with Qt 5.6.0.
For more details, refer to the online documentation included in this
distribution. The documentation is also available online:
http://doc.qt.io/qt-5/index.html
The Qt version 5.6 series is binary compatible with the 5.5.x series.
Applications compiled for 5.5 will continue to run with 5.6.
Some of the changes listed in this file include issue tracking numbers
corresponding to tasks in the Qt Bug Tracker:
https://bugreports.qt.io/
Each of these identifiers can be entered in the bug tracker to obtain more
information about a particular change.
******************************************************************************
* Important Behavior Changes *
******************************************************************************
- [QTBUG-45031] The NSURLConnection backend of QNetworkAccessManager has
been removed, since SecureTransport is the default SSL backend on iOS
and is enabled by default. This means that building with -no-openssl
-no-securetransport will no longer provide SSL capabilities on iOS.
- QUrl::resolved() no longer treats a URL with a scheme as a relative URL
if it matches this URL's scheme. For now it still treats "file:name.txt"
as relative for compatibility, but be warned that in Qt 5.8 it will no
longer consider those to be relative. Both isRelative() and RFC 3986 say
that such URLs are not relative, so starting from Qt 5.8, resolved() will
return them as is.
- [QTBUG-47815] QDateTime now uses QLocale to get the "AM" and "PM" strings
when parsing times, instead of strings obtained from the loaded
translations.
******************************************************************************
* Library *
******************************************************************************
QtCore
------
- Optimized toLatin1()/toUtf8() called on a QStringBuilder expression.
- [QTBUG-18729][QTBUG-32457] Fixed a bug that caused Windows to show
dialogs prompting the user to insert media when certain operations were
made with Qt I/O classes, particularly QStorageInfo::mountedVolumes().
- QCommandLineParser:
* The methods that exit() the application will now call cleanup routines
registered with qAddPostRoutine.
- QDataStream:
* Fixed compatibility of QTime serialization with Qt 3.
- QDebug:
* Fixed streaming of QChars.
- QJsonObject:
* Optimized equality operator.
- QJsonValue:
* Fixed use-after-free in assignment operator.
- QLockFile:
* Fixed permissions on lock files on Unix to allow for adjustments via
umask.
* [QTBUG-53392] Improved the robustness of detecting stale lock files on
Windows.
- QMutex:
* [QTBUG-54831] Fixed a bug that caused some applications to crash on
exit, depending on the order of creation of certain statics inside Qt.
- QObject:
* Fixed a crash when connecting a signal to a lambda or functor while
using Qt::UniqueConnection (note: the connection is still not unique).
- QStringListModel:
* Fixed dataChanged()'s 'roles' parameter to always contain both
Qt::EditRole and Qt::DisplayRole.
- QTemporaryFile:
* [QTBUG-54810] Fixed a bug that caused QTemporaryFile to fail when the
file name contained non-ASCII characters, on Windows.
- QTimeZone:
* [QTBUG-53071] Fixed a bug that caused QTimeZone to mis-parse time zones
whose names were not simple letter and digit combinations.
- QUrl:
* Made QUrl stricter in what it accepts for schemes, to comply with the
relevant standards. QUrl will no longer accept schemes starting with a
plus (+), a dash (-) or a dot (.).
- QVariant:
* [QTBUG-53384] Fixed QVariant::canConvert and conversion from integer
types to enumeration types.
* [QTBUG-54893] Fixed a bug that caused QVariants not to compare properly
if they contained QStringLists.
- QVector:
* [QTBUG-51758] Fixed a bug that would cause QVector to crash if one
called reserve(0).
- QXmlStreamReader:
* Fixed a bug in the XML parser that prevented to load XML that
contained invalid characters for XML 1.0.
- QXmlStreamWriter:
* Fixed a bug that prevented the generation of valid XML files when
using encoding with 8 bit per character but not ASCII compatible.
QXMLStreamWriter generated XML markup using always ASCII in this case.
QtGui
-----
- Fixed UBSan errors in
* QColor
* QGrayRaster
* QRasterizer
- Removed a total of 1610 relocations from the library.
- QGuiApplication:
* [QTBUG-51703] Fixed a bug that would cause QGuiApplication::sync() to
be left undefined for Qt builds without session management support.
- QIconLoaderEngine:
* Fixed theme lookup for scalable entries.
- Text:
* [QTBUG-42033] Fixed bug where a QTextLayout with
ShowLineAndParagraphSeparators would modify the layout's input string.
* [QTBUG-49452] Fixed a performance regression in Freetype engine that
was introduced in Qt 5.5.
* [QTBUG-54180] Fixed performance regression when rapidly switching
between a large set of fonts.
- Windows:
* [QTBUG-54494] Fixed stretch when combined with either no or vertical
hinting preference or a device pixel ratio different from 1.
* [QTBUG-51024] Fixed height of text bounding box when using no or
vertical hinting preference, or when the device pixel ratio is
different from 1.
QtNetwork
---------
- QAuthenticator:
* [QTBUG-53338] Fixed crash when comparing an initialized QAuthenticator
with an uninitialized QAuthenticator.
QtSql
-----
- [QTBUG-53969][QTBUG-53237] Fixed QSqlQuery::prepare value truncation
error when using UNSIGNED values in a MySQL database.
QtWidgets
---------
- Fixed UBSan/Coverity errors in:
* QAbstractItemView
* QDataWidgetMapper
* QTreeWidget
* QWidgetLineControl
- Removed a total of 167 relocations from the library.
- QAbstractItemDelegate:
* [QTBUG-16469] Show localized detailed tooltips and "What's this?"
texts.
- QAbstractItemView:
* [QTBUG-53541] Fixed a bug involving drawing the drop indicator
where it shouldn't be drawn.
* Fixed a bug in setSelectionModel() which could lead to model indexes
from a different model be reused on a new model.
- QAbstractSpinBox:
* [QTBUG-55249] Fixed a bug related to first key press.
- QColorDialog:
* Fixed ignored alpha channel in getRgb().
- QComboBox:
* [QTBUG-54191] Fixed a crash on setEditable(false) called from
editTextChanged().
- QCompleter:
* [QTBUG-54642] Fixed wrong completion role after a QFileSystemModel
has been used.
- QDesktopWidget:
* [QTBUG-52101] Fixed tracking of QScreens.
* [QTBUG-52606] Fixed a bug related to DPI-scaling in screenNumber().
- QDialog:
* [QTBUG-52735] Fixed a bug involving moves between screens with
different DPI-scaling factors.
- QDockWidget:
* [QTBUG-52107][QTBUG-53754] Fixed bugs related to floating group tab
window title.
* [QTBUG-52108] A QDockWidgetGroupWindow can now be dragged into one of
its QDockWidgets.
* [QTBUG-53808] Fixed a bug that caused an undocked dock widget to lose
its decoration.
* [QTBUG-54185] Unbroke drag-and-drop.
- QGraphicsProxyWidget:
* [QTBUG-55112] Fixed a bug that caused the widget to receive events
during construction.
- QLineEdit:
* [QTBUG-49374] Fixed icons being too small on a High DPI screen
without scaling.
* [QTBUG-52796] Fixed QKeySequence::MoveToStartOfLine shortcut
being ignored.
* [QTBUG-54425] Fixed missing clear button on macOS.
- QMainWindow:
* [QTBUG-50491] Fixed a bug related to restoring dock widgets with
GroupedDragging.
* [QTBUG-52108] Fixed a bug related to context menus in the presence of
floating tabs.
- QMenu:
* [QTBUG-53054] Submenus can now be opened on left mouse button
press, too.
- QMenuBar:
* [QTBUG-53205] Fixed bugs (incl. crashes) involving reparented
menu bars.
- QOpenGLWidget:
* [QTBUG-50818][QTBUG-51815][QTBUG-54241][QTBUG-52419] Fixed several
repainting bugs and other drawing artifacts.
- QSideBar:
* Fixed a nullptr dereference on platforms that do not support
QFileSystemWatcher.
- QSystemTrayIcon:
* [QTBUG-53591] Use large icon for balloon message on Windows systems.
- QTabBar:
* Fixed a performance problem involving font metrics.
- QTreeView:
* [QTBUG-52793] Fixed a key navigation bug when the columns were
reordered.
- QTreeWidget:
* [QTBUG-50207] Now handles device pixel ratio in animations correctly.
- QWidget:
* [QTBUG-39887] Restored documented behavior for the
WA_X11NetWmWindowType* attributes.
* [QTBUG-41135][QTBUG-50030][QTBUG-50136][QTBUG-52507] Fixed
mapTo/FromGlobal() in case of widget hierarchies embedded into
QGraphicsView with transformations.
* [QTBUG-45484] Fixed setWindowRole().
* [QTBUG-50796] Reduced paint-events when resizing native widgets.
* [QTBUG-52123] Fixed a bug by which opaque texture-based widgets
were not always shown.
* [QTBUG-53515] Added a workaround for render-to-texture widgets in
fullscreen windows.
* [QTBUG-54734] Worked around an issue with translucent GL windows
on Windows.
* [QTBUG-54906] Fixed a bug relaed to fullscreen handling on Windows.
- Styles:
* Fixed several cases of QStyleOptions being created with null
version.
* [QTBUG-51266] Fixed painting of small progress bars on Vista+.
* [QTBUG-54630] Fixed a crash in QMacStyle::styleHint().
* [QTBUG-49374] The Windows style now takes the monitor's differing
logical DPI into account when calculating native metrics.
******************************************************************************
* Platform-specific Changes *
******************************************************************************
Android
-------
- [QTBUG-50724] Added support for clang compiler.
- [QTBUG-53511] Fixed CJK font resolution on Android 7.
BSDs
----
- The freebsd-g++ mkspec was moved back and no longer requires the
"unsupported/" prefix, matching the FreeBSD ports tree, as FreeBSD 9.3
still defaults to using GCC. Users of GCC that did not previously use
the ports patch will need to adapt their build scripts and drop the
"unsupported/" prefix.
- Fixed a number of compilation issues on FreeBSD, NetBSD and OpenBSD. Qt
should now build out-of-the-box (no patches needed) on those systems.
Linux
-----
- [QTBUG-54733] It is now possible to opt out from installing signal
handlers when running with eglfs and linuxfb by setting the
QT_QPA_NO_SIGNAL_HANDLER environment variable to a non-zero value.
- Fixed the value of the 'defined' field in ATSPI GetAttributeValue
results.
macOS
-----
- [QTBUG-48953] Pasting text from Qt applications to Apple Mail now works.
- [QTBUG-48953] “text/vcard” is now required as the mime type when
placing vCards on the clipboard.
- OS X => macOS rename in Q_OS_ macros/docs, qmake scopes,
file selectors, etc.
- Add new QSysInfo values and MAC_OS_X / __MAC_ / __IPHONE_ values for
macOS 10.12 and iOS 9.1 through 10.0.
- Update prettyProductName with new macOS "Sierra" codename.
Windows
-------
- Fixed a new[]/delete mismatch in Windows tablet support.
****************************************************************************
* Tools *
****************************************************************************
moc
---
- [QTBUG-53441] Fixed crash on file ending with a backslash followed by
carriage return

View File

@ -34,6 +34,9 @@
\image openglwindow-example.png Screenshot of the OpenGLWindow example
\note This is a low level example of how to use QWindow with OpenGL.
In practice you should consider using the higher level QOpenGLWindow class.
\section1 OpenGLWindow Super Class
Our OpenGLWindow class acts as an API which is then subclassed to do the
@ -70,9 +73,8 @@
\snippet openglwindow/openglwindow.cpp 2
The renderLater() function simply puts an update request event on
the event loop, which leads to renderNow() being called once the event
gets processed.
The renderLater() function simply calls QWindow::requestUpdate() to schedule
an update for when the system is ready to repaint.
We also call renderNow() when we get an expose event. The exposeEvent() is
the notification to the window that its exposure, meaning visibility, on
@ -109,11 +111,11 @@
\l {http://www.khronos.org/registry/gles/}{Khronos OpenGL ES API Registry}.
If animation has been enabled with OpenGLWindow::setAnimating(true), we
call renderLater() to put another update request on the event loop.
call renderLater() to schedule another update request.
\snippet openglwindow/openglwindow.cpp 4
Enabling animation also triggers an update request as shown in the
Enabling animation also schedules an update request as shown in the
following code snippet.
\snippet openglwindow/openglwindow.cpp 5

View File

@ -143,19 +143,16 @@
\snippet rasterwindow/rasterwindow.cpp 6
We went through a few places where the window needed to repainted
immediately. There are some cases where this is not desierable,
immediately. There are some cases where this is not desirable,
but rather let the application return to the event loop and
later. We acheive this by posting an even to ourself which will
then be delivered when the application returns to the \l
QGuiApplication event loop. To avoid posting new requests when one
is already pending, we store this state in the \c m_update_pending
variable.
schedule the repaint for later. We achieve this by requesting
an update, using QWindow::requestUpdate(), which will then be
delivered when the system is ready to repaint.
\snippet rasterwindow/rasterwindow.cpp 7
We reimplement the virtual \l QObject::event() function to handle
the update event we posted to ourselves. When the event comes in
we reset the pending update flag and call renderNow() to render
the window right away.
the update event. When the event comes in we call renderNow() to
render the window right away.
*/

View File

@ -59,7 +59,6 @@
//! [1]
OpenGLWindow::OpenGLWindow(QWindow *parent)
: QWindow(parent)
, m_update_pending(false)
, m_animating(false)
, m_context(0)
, m_device(0)
@ -99,17 +98,13 @@ void OpenGLWindow::render()
//! [3]
void OpenGLWindow::renderLater()
{
if (!m_update_pending) {
m_update_pending = true;
QCoreApplication::postEvent(this, new QEvent(QEvent::UpdateRequest));
}
requestUpdate();
}
bool OpenGLWindow::event(QEvent *event)
{
switch (event->type()) {
case QEvent::UpdateRequest:
m_update_pending = false;
renderNow();
return true;
default:

View File

@ -82,7 +82,6 @@ protected:
void exposeEvent(QExposeEvent *event) override;
private:
bool m_update_pending;
bool m_animating;
QOpenGLContext *m_context;

View File

@ -53,7 +53,6 @@
//! [1]
RasterWindow::RasterWindow(QWindow *parent)
: QWindow(parent)
, m_update_pending(false)
{
create();
m_backingStore = new QBackingStore(this);
@ -68,7 +67,6 @@ RasterWindow::RasterWindow(QWindow *parent)
bool RasterWindow::event(QEvent *event)
{
if (event->type() == QEvent::UpdateRequest) {
m_update_pending = false;
renderNow();
return true;
}
@ -79,10 +77,7 @@ bool RasterWindow::event(QEvent *event)
//! [6]
void RasterWindow::renderLater()
{
if (!m_update_pending) {
m_update_pending = true;
QCoreApplication::postEvent(this, new QEvent(QEvent::UpdateRequest));
}
requestUpdate();
}
//! [6]
@ -99,9 +94,8 @@ void RasterWindow::resizeEvent(QResizeEvent *resizeEvent)
//! [2]
void RasterWindow::exposeEvent(QExposeEvent *)
{
if (isExposed()) {
if (isExposed())
renderNow();
}
}
//! [2]

View File

@ -74,7 +74,6 @@ protected:
private:
QBackingStore *m_backingStore;
bool m_update_pending;
};
//! [1]
#endif // RASTERWINDOW_H

View File

@ -304,15 +304,19 @@ void Window::contextMenu(const QPoint &pos)
if (!item)
return;
QMenu menu;
#ifndef QT_NO_CLIPBOARD
QAction *copyAction = menu.addAction("Copy Name");
#endif
QAction *openAction = menu.addAction("Open");
QAction *action = menu.exec(filesTable->mapToGlobal(pos));
if (!action)
return;
const QString fileName = fileNameOfItem(item);
if (action == copyAction)
QGuiApplication::clipboard()->setText(QDir::toNativeSeparators(fileName));
else if (action == openAction)
if (action == openAction)
openFile(fileName);
#ifndef QT_NO_CLIPBOARD
else if (action == copyAction)
QGuiApplication::clipboard()->setText(QDir::toNativeSeparators(fileName));
#endif
}
//! [16]

View File

@ -203,10 +203,10 @@ contains(qt_module_deps, qml): \
# run qmlimportscanner
qtPrepareTool(QMLIMPORTSCANNER, qmlimportscanner, , system)
for (QMLPATH, QMLPATHS): \
IMPORTPATHS += -importPath $$QMLPATH
IMPORTPATHS += -importPath $$system_quote($$QMLPATH)
#message(run $$QMLIMPORTSCANNER $$_PRO_FILE_PWD_ $$IMPORTPATHS)
JSON = $$system($$QMLIMPORTSCANNER $$_PRO_FILE_PWD_ $$IMPORTPATHS)
JSON = $$system($$QMLIMPORTSCANNER $$system_quote($$_PRO_FILE_PWD_) $$IMPORTPATHS)
parseJson(JSON, IMPORTS)| error("Failed to parse qmlimportscanner output.")
@ -267,13 +267,13 @@ contains(qt_module_deps, qml): \
# But strip away archives and other files that are not needed:
!isEmpty(QMAKE_POST_LINK): QMAKE_POST_LINK += ";"
QMAKE_POST_LINK += \
"cp $$OUT_PWD/qt.conf $$qtconfTargetPath; " \
"test -d $$qmlTargetPath && rm -r $$qmlTargetPath; " \
"mkdir -p $$qmlTargetPath && " \
"cp $$shell_quote($$OUT_PWD/qt.conf) \"$$qtconfTargetPath\"; " \
"test -d \"$$qmlTargetPath\" && rm -r \"$$qmlTargetPath\"; " \
"mkdir -p \"$$qmlTargetPath\" && " \
"for p in $$QMLPATHS; do" \
"rsync -r --exclude='*.a' --exclude='*.prl' --exclude='*.qmltypes' "
macx-xcode: QMAKE_POST_LINK += "$p/ $$qmlTargetPath; done"
else: QMAKE_POST_LINK += "\$\$p/ $$qmlTargetPath; done"
macx-xcode: QMAKE_POST_LINK += "$p/ \"$$qmlTargetPath\"; done"
else: QMAKE_POST_LINK += "\$\$p/ \"$$qmlTargetPath\"; done"
}
}
}

View File

@ -33,6 +33,7 @@
#include <qregexp.h>
#include <qcryptographichash.h>
#include <qdebug.h>
#include <qsettings.h>
#include <qstring.h>
#include <stdlib.h>
#include <time.h>
@ -1449,6 +1450,28 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
QString configName = (as_release ? "Release" : "Debug");
QMap<QString, QString> settings;
if (!project->isActiveConfig("no_xcode_development_team")) {
const QSettings xcodeSettings(
QDir::homePath() + QLatin1String("/Library/Preferences/com.apple.dt.Xcode.plist"),
QSettings::NativeFormat);
const QVariantMap teams = xcodeSettings.value(QLatin1String("IDEProvisioningTeams")).toMap();
if (!teams.isEmpty()) {
for (QVariantMap::const_iterator it = teams.begin(), end = teams.end(); it != end; ++it) {
const QVariantMap team = it.value().toMap();
const QString teamType = team.value(QLatin1String("teamType")).toString();
// Skip Company teams because signing permissions may not be available under all
// circumstances for users who are not the Team Agent
if (teamType != QLatin1String("Company")) {
const QString teamId = team.value(QLatin1String("teamID")).toString();
settings.insert("DEVELOPMENT_TEAM", teamId);
// first suitable team we found is the one we'll use by default
break;
}
}
}
}
settings.insert("COPY_PHASE_STRIP", (as_release ? "YES" : "NO"));
// required for tvOS (and watchos), optional on iOS (deployment target >= iOS 6.0)
settings.insert("ENABLE_BITCODE", project->isActiveConfig("bitcode") ? "YES" : "NO");

View File

@ -969,7 +969,7 @@ void VcprojGenerator::initProject()
vcProject.Keyword = project->first("VCPROJ_KEYWORD").toQString();
if (!project->isEmpty("VCPROJ_ARCH")) {
vcProject.PlatformName = project->first("VCPROJ_ARCH").toQString();
} else if (project->isHostBuild()) {
} else {
vcProject.PlatformName = (is64Bit ? "x64" : "Win32");
}
vcProject.SdkVersion = project->first("WINSDK_VER").toQString();
@ -1051,7 +1051,7 @@ void VcprojGenerator::initConfiguration()
conf.ConfigurationName = conf.Name;
if (!project->isEmpty("VCPROJ_ARCH")) {
conf.Name += "|" + project->first("VCPROJ_ARCH");
} else if (project->isHostBuild()) {
} else {
conf.Name += (is64Bit ? "|x64" : "|Win32");
}
conf.ATLMinimizesCRunTimeLibraryUsage = (project->first("ATLMinimizesCRunTimeLibraryUsage").isEmpty() ? _False : _True);

View File

@ -1,5 +1,5 @@
# static builds should still link ANGLE dynamically when dynamic GL is enabled
include(../../../gui/qtgui-config.pri)
include($$OUT_PWD/../../../gui/qtgui-config.pri)
static:qtConfig(dynamicgl) {
CONFIG -= static
CONFIG += shared

View File

@ -0,0 +1,49 @@
/****************************************************************************
**
** Copyright (C) 2016 Samuel Gaist <samuel.gaist@edeltech.ch>
** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** You may use this file under the terms of the BSD license as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
** * Neither the name of The Qt Company Ltd nor the names of its
** contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
****************************************************************************/
//! [0]
#include <QAbstractNativeEventFilter>
class MyCocoaEventFilter : public QAbstractNativeEventFilter
{
public:
bool nativeEventFilter(const QByteArray &eventType, void *message, long *) Q_DECL_OVERRIDE;
};
//! [0]

View File

@ -0,0 +1,57 @@
/****************************************************************************
**
** Copyright (C) 2016 Samuel Gaist <samuel.gaist@edeltech.ch>
** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** You may use this file under the terms of the BSD license as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
** * Neither the name of The Qt Company Ltd nor the names of its
** contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
****************************************************************************/
//! [0]
#include "mycocoaeventfilter.h"
#import <AppKit/AppKit.h>
bool CocoaNativeEventFilter::nativeEventFilter(const QByteArray &eventType, void *message, long *)
{
if (eventType == "mac_generic_NSEvent") {
NSEvent *event = static_cast<NSEvent *>(message);
if ([event type] == NSKeyDown) {
// Handle key event
qDebug() << QString::fromNSString([event characters]);
}
}
return false;
}
//! [0]

View File

@ -0,0 +1,5 @@
#! [0]
HEADERS += mycocoaeventfilter.h
OBJECTIVE_SOURCES += mycocoaeventfilter.mm
LIBS += -framework AppKit
#! [0]

View File

@ -1199,7 +1199,8 @@ void QMessagePattern::setPattern(const QString &pattern)
#if defined(QLOGGING_HAVE_BACKTRACE) && !defined(QT_BOOTSTRAPPED)
// make sure the function has "Message" in the name so the function is removed
#if (defined(Q_CC_GNU) && defined(QT_COMPILER_SUPPORTS_SIMD_ALWAYS)) || QT_HAS_ATTRIBUTE(optimize)
#if ((defined(Q_CC_GNU) && defined(QT_COMPILER_SUPPORTS_SIMD_ALWAYS)) || QT_HAS_ATTRIBUTE(optimize)) \
&& !defined(Q_CC_INTEL)
// force skipping the frame pointer, to save the backtrace() function some work
__attribute__((optimize("omit-frame-pointer")))
#endif

View File

@ -83,7 +83,7 @@ QT_BEGIN_NAMESPACE
/*!
\property QAbstractProxyModel::sourceModel
\brief the source model this proxy model.
\brief the source model of this proxy model.
*/
//detects the deletion of the source model

View File

@ -96,14 +96,25 @@ QAbstractNativeEventFilter::~QAbstractNativeEventFilter()
In both cases, the \a message can be casted to a MSG pointer.
The \a result pointer is only used on Windows, and corresponds to the LRESULT pointer.
On Mac, \a eventType is set to "mac_generic_NSEvent", and the \a message can be casted to an EventRef.
On macOS, \a eventType is set to "mac_generic_NSEvent", and the \a message can be casted to an NSEvent pointer.
In your reimplementation of this function, if you want to filter
the \a message out, i.e. stop it being handled further, return
true; otherwise return false.
Example:
\b {Linux example}
\snippet code/src_corelib_kernel_qabstractnativeeventfilter.cpp 0
\b {macOS example}
mycocoaeventfilter.h:
\snippet code/src_corelib_kernel_qabstractnativeeventfilter.h 0
mycocoaeventfilter.mm:
\snippet code/src_corelib_kernel_qabstractnativeeventfilter.mm 0
myapp.pro:
\snippet code/src_corelib_kernel_qabstractnativeeventfilter.pro 0
*/
QT_END_NAMESPACE

View File

@ -222,7 +222,7 @@ QObjectPrivate::QObjectPrivate(int version)
blockSig = false; // not blocking signals
wasDeleted = false; // double-delete catcher
isDeletingChildren = false; // set by deleteChildren()
sendChildEvents = true; // if we should send ChildInsert and ChildRemove events to parent
sendChildEvents = true; // if we should send ChildAdded and ChildRemoved events to parent
receiveChildEvents = true;
postedEvents = 0;
extraData = 0;

View File

@ -185,7 +185,7 @@ inline void qYouForgotTheQ_OBJECT_Macro(T1, T2) {}
#if defined(Q_CC_CLANG) && Q_CC_CLANG >= 306
# define Q_OBJECT_NO_OVERRIDE_WARNING QT_WARNING_DISABLE_CLANG("-Winconsistent-missing-override")
#elif defined(Q_CC_GNU) && !defined(Q_CC_INTEL) && Q_CC_GNU >= 510
#elif defined(Q_CC_GNU) && !defined(Q_CC_INTEL) && Q_CC_GNU >= 501
# define Q_OBJECT_NO_OVERRIDE_WARNING QT_WARNING_DISABLE_GCC("-Wsuggest-override")
#else
# define Q_OBJECT_NO_OVERRIDE_WARNING

View File

@ -845,7 +845,7 @@ static QString toStringIsoDate(qint64 jd)
range 0 to 9999. This restriction may apply to locale-aware
formats as well, depending on the locale settings.
\sa shortDayName(), shortMonthName()
\sa fromString(), shortDayName(), shortMonthName(), QLocale::toString()
*/
QString QDate::toString(Qt::DateFormat format) const
{
@ -921,7 +921,7 @@ QString QDate::toString(Qt::DateFormat format) const
If the datetime is invalid, an empty string will be returned.
\sa QDateTime::toString(), QTime::toString(), QLocale::toString()
\sa fromString(), QDateTime::toString(), QTime::toString(), QLocale::toString()
*/
QString QDate::toString(const QString& format) const
@ -1201,6 +1201,8 @@ qint64 QDate::daysTo(const QDate &d) const
Note for Qt::TextDate: It is recommended that you use the
English short month names (e.g. "Jan"). Although localized month
names can also be used, they depend on the user's locale settings.
\sa toString(), QLocale::toDate()
*/
QDate QDate::fromString(const QString& string, Qt::DateFormat format)
{
@ -1319,8 +1321,8 @@ QDate QDate::fromString(const QString& string, Qt::DateFormat format)
\snippet code/src_corelib_tools_qdatetime.cpp 3
\sa QDateTime::fromString(), QTime::fromString(), QDate::toString(),
QDateTime::toString(), QTime::toString()
\sa toString(), QDateTime::fromString(), QTime::fromString(),
QLocale::toDate()
*/
QDate QDate::fromString(const QString &string, const QString &format)
@ -1588,7 +1590,7 @@ int QTime::msec() const
If the time is invalid, an empty string will be returned.
\sa QDate::toString(), QDateTime::toString()
\sa fromString(), QDate::toString(), QDateTime::toString(), QLocale::toString()
*/
QString QTime::toString(Qt::DateFormat format) const
@ -1661,7 +1663,7 @@ QString QTime::toString(Qt::DateFormat format) const
If the time is invalid, an empty string will be returned.
If \a format is empty, the default format "hh:mm:ss" is used.
\sa QDate::toString(), QDateTime::toString(), QLocale::toString()
\sa fromString(), QDate::toString(), QDateTime::toString(), QLocale::toString()
*/
QString QTime::toString(const QString& format) const
{
@ -1933,6 +1935,8 @@ static QTime fromIsoTimeString(const QStringRef &string, Qt::DateFormat format,
this may result in two conversion attempts (if the conversion
fails for the default locale). This should be considered an
implementation detail.
\sa toString(), QLocale::toTime()
*/
QTime QTime::fromString(const QString& string, Qt::DateFormat format)
{
@ -2006,8 +2010,8 @@ QTime QTime::fromString(const QString& string, Qt::DateFormat format)
\snippet code/src_corelib_tools_qdatetime.cpp 8
\sa QDateTime::fromString(), QDate::fromString(), QDate::toString(),
QDateTime::toString(), QTime::toString()
\sa toString(), QDateTime::fromString(), QDate::fromString(),
QLocale::toTime()
*/
QTime QTime::fromString(const QString &string, const QString &format)
@ -3734,7 +3738,8 @@ void QDateTime::setTime_t(uint secsSince1Jan1970UTC)
range 0 to 9999. This restriction may apply to locale-aware
formats as well, depending on the locale settings.
\sa QDate::toString(), QTime::toString(), Qt::DateFormat
\sa fromString(), QDate::toString(), QTime::toString(),
QLocale::toString()
*/
QString QDateTime::toString(Qt::DateFormat format) const
@ -3874,7 +3879,7 @@ QString QDateTime::toString(Qt::DateFormat format) const
If the datetime is invalid, an empty string will be returned.
\sa QDate::toString(), QTime::toString(), QLocale::toString()
\sa fromString(), QDate::toString(), QTime::toString(), QLocale::toString()
*/
QString QDateTime::toString(const QString& format) const
{
@ -4617,6 +4622,8 @@ int QDateTime::utcOffset() const
Note for Qt::TextDate: It is recommended that you use the
English short month names (e.g. "Jan"). Although localized month
names can also be used, they depend on the user's locale settings.
\sa toString(), QLocale::toDateTime()
*/
QDateTime QDateTime::fromString(const QString& string, Qt::DateFormat format)
{
@ -4918,8 +4925,8 @@ QDateTime QDateTime::fromString(const QString& string, Qt::DateFormat format)
\snippet code/src_corelib_tools_qdatetime.cpp 14
\sa QDate::fromString(), QTime::fromString(), QDate::toString(),
QDateTime::toString(), QTime::toString()
\sa toString(), QDate::fromString(), QTime::fromString(),
QLocale::toDateTime()
*/
QDateTime QDateTime::fromString(const QString &string, const QString &format)

View File

@ -976,6 +976,7 @@ inline QString QString::section(QChar asep, int astart, int aend, SectionFlags a
QT_WARNING_PUSH
QT_WARNING_DISABLE_MSVC(4127) // "conditional expression is constant"
QT_WARNING_DISABLE_INTEL(111) // "statement is unreachable"
inline int QString::toWCharArray(wchar_t *array) const
{
@ -1157,21 +1158,21 @@ inline bool operator!=(QString::Null, const QString &s) { return !s.isNull(); }
inline bool operator!=(const QString &s, QString::Null) { return !s.isNull(); }
inline bool operator==(QLatin1String s1, QLatin1String s2) Q_DECL_NOTHROW
{ return (s1.size() == s2.size() && !memcmp(s1.latin1(), s2.latin1(), s1.size())); }
{ return s1.size() == s2.size() && (!s1.size() || !memcmp(s1.latin1(), s2.latin1(), s1.size())); }
inline bool operator!=(QLatin1String s1, QLatin1String s2) Q_DECL_NOTHROW
{ return (s1.size() != s2.size() || memcmp(s1.latin1(), s2.latin1(), s1.size())); }
{ return !operator==(s1, s2); }
inline bool operator<(QLatin1String s1, QLatin1String s2) Q_DECL_NOTHROW
{ int r = memcmp(s1.latin1(), s2.latin1(), qMin(s1.size(), s2.size()));
return (r < 0) || (r == 0 && s1.size() < s2.size()); }
inline bool operator<=(QLatin1String s1, QLatin1String s2) Q_DECL_NOTHROW
{ int r = memcmp(s1.latin1(), s2.latin1(), qMin(s1.size(), s2.size()));
return (r < 0) || (r == 0 && s1.size() <= s2.size()); }
{
const int len = qMin(s1.size(), s2.size());
const int r = len ? memcmp(s1.latin1(), s2.latin1(), len) : 0;
return r < 0 || (r == 0 && s1.size() < s2.size());
}
inline bool operator>(QLatin1String s1, QLatin1String s2) Q_DECL_NOTHROW
{ int r = memcmp(s1.latin1(), s2.latin1(), qMin(s1.size(), s2.size()));
return (r > 0) || (r == 0 && s1.size() > s2.size()); }
{ return operator<(s2, s1); }
inline bool operator<=(QLatin1String s1, QLatin1String s2) Q_DECL_NOTHROW
{ return !operator>(s1, s2); }
inline bool operator>=(QLatin1String s1, QLatin1String s2) Q_DECL_NOTHROW
{ int r = memcmp(s1.latin1(), s2.latin1(), qMin(s1.size(), s2.size()));
return (r > 0) || (r == 0 && s1.size() >= s2.size()); }
{ return !operator<(s1, s2); }
inline bool QLatin1String::operator==(const QString &s) const Q_DECL_NOTHROW
{ return s == *this; }

View File

@ -71,24 +71,6 @@ QT_BEGIN_NAMESPACE
Q_GLOBAL_STATIC(QDBusConnectionManager, _q_manager)
// can be replaced with a lambda in Qt 5.7
class QDBusConnectionDispatchEnabler : public QObject
{
Q_OBJECT
QDBusConnectionPrivate *con;
public:
QDBusConnectionDispatchEnabler(QDBusConnectionPrivate *con) : con(con) {}
public slots:
void execute()
{
con->setDispatchEnabled(true);
if (!con->ref.deref())
con->deleteLater();
deleteLater();
}
};
struct QDBusConnectionManager::ConnectionRequestData
{
enum RequestType {
@ -1280,6 +1262,4 @@ QByteArray QDBusConnection::localMachineId()
QT_END_NAMESPACE
#include "qdbusconnection.moc"
#endif // QT_NO_DBUS

View File

@ -381,6 +381,25 @@ extern QDBusMessage qDBusPropertySet(const QDBusConnectionPrivate::ObjectTreeNod
const QDBusMessage &msg);
extern QDBusMessage qDBusPropertyGetAll(const QDBusConnectionPrivate::ObjectTreeNode &node,
const QDBusMessage &msg);
// can be replaced with a lambda in Qt 5.7
class QDBusConnectionDispatchEnabler : public QObject
{
Q_OBJECT
QDBusConnectionPrivate *con;
public:
QDBusConnectionDispatchEnabler(QDBusConnectionPrivate *con) : con(con) {}
public slots:
void execute()
{
con->setDispatchEnabled(true);
if (!con->ref.deref())
con->deleteLater();
deleteLater();
}
};
#endif // QT_BOOTSTRAPPED
QT_END_NAMESPACE

View File

@ -100,8 +100,8 @@ public:
QDBusError(const QDBusError &other);
#ifdef Q_COMPILER_RVALUE_REFS
QDBusError(QDBusError &&other) Q_DECL_NOTHROW
: code(other.code), msg(std::move(other.msg)), nm(std::move(other.nm)), unused(other.unused)
{ other.unused = Q_NULLPTR; }
: code(other.code), msg(std::move(other.msg)), nm(std::move(other.nm))
{}
QDBusError &operator=(QDBusError &&other) Q_DECL_NOTHROW { swap(other); return *this; }
#endif
QDBusError &operator=(const QDBusError &other);
@ -114,7 +114,6 @@ public:
qSwap(code, other.code);
qSwap(msg, other.msg);
qSwap(nm, other.nm);
qSwap(unused, other.unused);
}
ErrorType type() const;
@ -128,6 +127,8 @@ private:
ErrorType code;
QString msg;
QString nm;
// ### This class has an implicit (therefore inline) destructor
// so the following field cannot be used:
void *unused;
};
Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6(QDBusError)

View File

@ -315,9 +315,21 @@ static void qDBusNewConnection(DBusServer *server, DBusConnection *connection, v
// setPeer does the error handling for us
QDBusErrorInternal error;
newConnection->setPeer(connection, error);
newConnection->setDispatchEnabled(false);
// this is a queued connection and will resume in the QDBusServer's thread
emit serverConnection->newServerConnection(newConnection);
// we've disabled dispatching of events, so now we post an event to the
// QDBusServer's thread in order to enable it after the
// QDBusServer::newConnection() signal has been received by the
// application's code
newConnection->ref.ref();
QReadLocker serverLock(&serverConnection->lock);
QDBusConnectionDispatchEnabler *o = new QDBusConnectionDispatchEnabler(newConnection);
QTimer::singleShot(0, o, SLOT(execute()));
if (serverConnection->serverObject)
o->moveToThread(serverConnection->serverObject->thread());
}
void QDBusConnectionPrivate::_q_newConnection(QDBusConnectionPrivate *newConnection)
@ -1250,6 +1262,7 @@ void QDBusConnectionPrivate::relaySignal(QObject *obj, const QMetaObject *mo, in
break;
}
checkThread();
QDBusReadLocker locker(RelaySignalAction, this);
QDBusMessage message = QDBusMessage::createSignal(QLatin1String("/"), interface,
QLatin1String(memberName));
@ -2358,12 +2371,9 @@ void QDBusConnectionPrivate::registerObject(const ObjectTreeNode *node)
connector->connectAllSignals(node->obj);
}
// disconnect and reconnect to avoid duplicates
connector->disconnect(SIGNAL(relaySignal(QObject*,const QMetaObject*,int,QVariantList)),
this, SLOT(relaySignal(QObject*,const QMetaObject*,int,QVariantList)));
connect(connector, SIGNAL(relaySignal(QObject*,const QMetaObject*,int,QVariantList)),
this, SLOT(relaySignal(QObject*,const QMetaObject*,int,QVariantList)),
Qt::DirectConnection);
Qt::ConnectionType(Qt::QueuedConnection | Qt::UniqueConnection));
}
}

View File

@ -103,12 +103,14 @@ QDBusServer::QDBusServer(QObject *parent)
*/
QDBusServer::~QDBusServer()
{
QWriteLocker locker(&d->lock);
if (QDBusConnectionManager::instance()) {
QMutexLocker locker(&QDBusConnectionManager::instance()->mutex);
for (const QString &name : qAsConst(d->serverConnectionNames))
QDBusConnectionManager::instance()->removeConnection(name);
d->serverConnectionNames.clear();
}
d->serverObject = nullptr;
d->ref.store(0);
d->deleteLater();
}

View File

@ -63,7 +63,8 @@
QT_BEGIN_NAMESPACE
namespace QDBusUtil
#define Q_DBUS_NO_EXPORT // force findclasslist.pl looking into this namespace
namespace Q_DBUS_NO_EXPORT QDBusUtil
{
Q_DBUS_EXPORT bool isValidInterfaceName(const QString &ifaceName);

View File

@ -2794,10 +2794,10 @@ void QGuiApplicationPrivate::reportRefreshRateChange(QWindowSystemInterfacePriva
void QGuiApplicationPrivate::processExposeEvent(QWindowSystemInterfacePrivate::ExposeEvent *e)
{
if (!e->exposed)
if (!e->window)
return;
QWindow *window = e->exposed.data();
QWindow *window = e->window.data();
if (!window)
return;
QWindowPrivate *p = qt_window_private(window);

View File

@ -260,8 +260,7 @@ static bool convert(const QVariant::Private *d, int t,
static_cast<QColor *>(result)->setNamedColor(*v_cast<QString>(d));
return static_cast<QColor *>(result)->isValid();
} else if (d->type == QVariant::ByteArray) {
static_cast<QColor *>(result)->setNamedColor(QString::fromLatin1(
*v_cast<QByteArray>(d)));
static_cast<QColor *>(result)->setNamedColor(QLatin1String(*v_cast<QByteArray>(d)));
return true;
} else if (d->type == QVariant::Brush) {
if (v_cast<QBrush>(d)->style() == Qt::SolidPattern) {

View File

@ -170,11 +170,11 @@ static inline qreal initialGlobalScaleFactor()
The QT_SCALE_FACTOR environment variable can be used to set
a global scale factor for all windows in the processs. This
is useful for testing and debugging (you can simulate any
devicePixelRatio without needing access to sepcial hardware),
devicePixelRatio without needing access to special hardware),
and perhaps also for targeting a specific application to
a specific display type (embedded use cases).
2) A per-screen scale factors
2) Per-screen scale factors
Some platform plugins support providing a per-screen scale
factor based on display density information. These platforms
include X11, Windows, and Android.
@ -187,13 +187,13 @@ static inline qreal initialGlobalScaleFactor()
Enabling either will make QHighDpiScaling call QPlatformScreen::pixelDensity()
and use the value provided as the scale factor for the screen in
question. Disabling is done on a 'veto' basis where either the
environment or the application source can disable. The intended use
environment or the application can disable the scaling. The intended use
cases are 'My system is not providing correct display density
information' and 'My application needs to work in display pixels',
respectively.
The QT_SCREEN_SCALE_FACTORS environment variable can be used to set the screen
scale factors manually.Set this to a semicolon-separated
scale factors manually. Set this to a semicolon-separated
list of scale factors (matching the order of QGuiApplications::screens()),
or to a list of name=value pairs (where name matches QScreen::name()).

View File

@ -187,9 +187,6 @@ void QPaintDeviceWindow::exposeEvent(QExposeEvent *exposeEvent)
// sometimes relative to the parent, depending on the platform plugin.
// We require local coords here.
d->doFlush(QRect(QPoint(0, 0), size()));
} else if (!d->dirtyRegion.isEmpty()) {
// Updates while non-exposed were ignored. Schedule an update now.
requestUpdate();
}
}

View File

@ -2175,11 +2175,14 @@ void QWindowPrivate::deliverUpdateRequest()
Schedules a QEvent::UpdateRequest event to be delivered to this window.
The event is delivered in sync with the display vsync on platforms
where this is possible. When driving animations, this function should
be called once after drawing has completed.
where this is possible. Otherwise, the event is delivered after a
delay of 5 ms. The additional time is there to give the event loop
a bit of idle time to gather system events, and can be overridden
using the QT_QPA_UPDATE_IDLE_TIME environment variable.
Calling this function multiple times will result in a single event
being delivered to the window.
When driving animations, this function should be called once after drawing
has completed. Calling this function multiple times will result in a single
event being delivered to the window.
Subclasses of QWindow should reimplement event(), intercept the event and
call the application's rendering code, then call the base class

View File

@ -361,10 +361,10 @@ void QWindowSystemInterface::handleWheelEvent(QWindow *tlw, ulong timestamp, con
}
QWindowSystemInterfacePrivate::ExposeEvent::ExposeEvent(QWindow *exposed, const QRegion &region)
QWindowSystemInterfacePrivate::ExposeEvent::ExposeEvent(QWindow *window, const QRegion &region)
: WindowSystemEvent(Expose)
, exposed(exposed)
, isExposed(exposed && exposed->handle() ? exposed->handle()->isExposed() : false)
, window(window)
, isExposed(window && window->handle() ? window->handle()->isExposed() : false)
, region(region)
{
}

View File

@ -330,8 +330,8 @@ public:
class ExposeEvent : public WindowSystemEvent {
public:
ExposeEvent(QWindow *exposed, const QRegion &region);
QPointer<QWindow> exposed;
ExposeEvent(QWindow *window, const QRegion &region);
QPointer<QWindow> window;
bool isExposed;
QRegion region;
};

View File

@ -584,7 +584,7 @@ void QBrush::detach(Qt::BrushStyle newStyle)
return;
}
QScopedPointer<QBrushData> x;
QScopedPointer<QBrushData, QBrushDataPointerDeleter> x;
switch(newStyle) {
case Qt::TexturePattern: {
QTexturedBrushData *tbd = new QTexturedBrushData;
@ -600,28 +600,30 @@ void QBrush::detach(Qt::BrushStyle newStyle)
}
case Qt::LinearGradientPattern:
case Qt::RadialGradientPattern:
case Qt::ConicalGradientPattern:
x.reset(new QGradientBrushData);
case Qt::ConicalGradientPattern: {
QGradientBrushData *gbd = new QGradientBrushData;
switch (d->style) {
case Qt::LinearGradientPattern:
case Qt::RadialGradientPattern:
case Qt::ConicalGradientPattern:
static_cast<QGradientBrushData *>(x.data())->gradient =
gbd->gradient =
static_cast<QGradientBrushData *>(d.data())->gradient;
break;
default:
break;
}
x.reset(gbd);
break;
}
default:
x.reset(new QBrushData);
break;
}
x->ref.store(1);
x->ref.store(1); // must be first lest the QBrushDataPointerDeleter turns into a no-op
x->style = newStyle;
x->color = d->color;
x->transform = d->transform;
d.reset(x.take());
d.swap(x);
}

View File

@ -79,12 +79,12 @@ static inline int hex2int(char s)
return h < 0 ? h : (h << 4) | h;
}
bool qt_get_hex_rgb(const char *name, QRgb *rgb)
static bool get_hex_rgb(const char *name, int len, QRgb *rgb)
{
if (name[0] != '#')
return false;
name++;
int len = qstrlen(name);
--len;
int a, r, g, b;
a = 255;
if (len == 12) {
@ -119,15 +119,19 @@ bool qt_get_hex_rgb(const char *name, QRgb *rgb)
return true;
}
bool qt_get_hex_rgb(const QChar *str, int len, QRgb *rgb)
bool qt_get_hex_rgb(const char *name, QRgb *rgb)
{
return get_hex_rgb(name, qstrlen(name), rgb);
}
static bool get_hex_rgb(const QChar *str, int len, QRgb *rgb)
{
if (len > 13)
return false;
char tmp[16];
for (int i = 0; i < len; ++i)
tmp[i] = str[i].toLatin1();
tmp[len] = 0;
return qt_get_hex_rgb(tmp, rgb);
return get_hex_rgb(tmp, len, rgb);
}
#ifndef QT_NO_COLORNAMES
@ -309,7 +313,7 @@ inline bool operator<(const char *name, const RGBData &data)
inline bool operator<(const RGBData &data, const char *name)
{ return qstrcmp(data.name, name) < 0; }
static bool get_named_rgb(const char *name_no_space, QRgb *rgb)
static bool get_named_rgb_no_space(const char *name_no_space, QRgb *rgb)
{
const RGBData *r = std::lower_bound(rgbTbl, rgbTbl + rgbTblSize, name_no_space);
if ((r != rgbTbl + rgbTblSize) && !(name_no_space < *r)) {
@ -319,9 +323,8 @@ static bool get_named_rgb(const char *name_no_space, QRgb *rgb)
return false;
}
bool qt_get_named_rgb(const char *name, QRgb* rgb)
static bool get_named_rgb(const char *name, int len, QRgb* rgb)
{
int len = int(strlen(name));
if (len > 255)
return false;
char name_no_space[256];
@ -332,10 +335,10 @@ bool qt_get_named_rgb(const char *name, QRgb* rgb)
}
name_no_space[pos] = 0;
return get_named_rgb(name_no_space, rgb);
return get_named_rgb_no_space(name_no_space, rgb);
}
bool qt_get_named_rgb(const QChar *name, int len, QRgb *rgb)
static bool get_named_rgb(const QChar *name, int len, QRgb *rgb)
{
if (len > 255)
return false;
@ -346,32 +349,22 @@ bool qt_get_named_rgb(const QChar *name, int len, QRgb *rgb)
name_no_space[pos++] = name[i].toLower().toLatin1();
}
name_no_space[pos] = 0;
return get_named_rgb(name_no_space, rgb);
return get_named_rgb_no_space(name_no_space, rgb);
}
QStringList qt_get_colornames()
#endif // QT_NO_COLORNAMES
static QStringList get_colornames()
{
int i = 0;
QStringList lst;
#ifndef QT_NO_COLORNAMES
lst.reserve(rgbTblSize);
for (i = 0; i < rgbTblSize; i++)
for (int i = 0; i < rgbTblSize; i++)
lst << QLatin1String(rgbTbl[i].name);
#endif
return lst;
}
#else
bool qt_get_named_rgb(const char *, QRgb*)
{
return false;
}
QStringList qt_get_colornames()
{
return QStringList();
}
#endif // QT_NO_COLORNAMES
/*!
\class QColor
\brief The QColor class provides colors based on RGB, HSV or CMYK values.
@ -801,12 +794,14 @@ QColor::QColor(Spec spec) Q_DECL_NOTHROW
/*!
\fn QColor::QColor(const char *name)
\overload
\sa setNamedColor(), name(), isValid()
*/
Constructs a named color in the same way as setNamedColor() using
the given \a name.
The color is left invalid if the \a name cannot be parsed.
/*!
\fn QColor::QColor(QLatin1String name)
\overload
\since 5.8
\sa setNamedColor(), name(), isValid()
*/
@ -886,6 +881,16 @@ void QColor::setNamedColor(const QString &name)
setColorFromString(name);
}
/*!
\overload
\since 5.8
*/
void QColor::setNamedColor(QLatin1String name)
{
setColorFromString(name);
}
/*!
\since 4.7
@ -902,16 +907,26 @@ bool QColor::isValidColor(const QString &name)
return !name.isEmpty() && QColor().setColorFromString(name);
}
bool QColor::setColorFromString(const QString &name)
/*!
\overload
\since 5.8
*/
bool QColor::isValidColor(QLatin1String name) Q_DECL_NOTHROW
{
if (name.isEmpty()) {
return name.size() && QColor().setColorFromString(name);
}
template <typename String>
bool QColor::setColorFromString(const String &name)
{
if (!name.size()) {
invalidate();
return true;
}
if (name.startsWith(QLatin1Char('#'))) {
if (name[0] == QLatin1Char('#')) {
QRgb rgba;
if (qt_get_hex_rgb(name.constData(), name.length(), &rgba)) {
if (get_hex_rgb(name.data(), name.size(), &rgba)) {
setRgba(rgba);
return true;
} else {
@ -922,7 +937,7 @@ bool QColor::setColorFromString(const QString &name)
#ifndef QT_NO_COLORNAMES
QRgb rgb;
if (qt_get_named_rgb(name.constData(), name.length(), &rgb)) {
if (get_named_rgb(name.data(), name.size(), &rgb)) {
setRgba(rgb);
return true;
} else
@ -940,11 +955,7 @@ bool QColor::setColorFromString(const QString &name)
*/
QStringList QColor::colorNames()
{
#ifndef QT_NO_COLORNAMES
return qt_get_colornames();
#else
return QStringList();
#endif
return get_colornames();
}
/*!

View File

@ -73,7 +73,8 @@ public:
QColor(QRgb rgb) Q_DECL_NOTHROW;
QColor(QRgba64 rgba64) Q_DECL_NOTHROW;
QColor(const QString& name);
QColor(const char *name);
QColor(const char *aname) : QColor(QLatin1String(aname)) {}
QColor(QLatin1String name);
QColor(Spec spec) Q_DECL_NOTHROW;
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
@ -93,7 +94,9 @@ public:
// ### Qt 6: merge overloads
QString name() const;
QString name(NameFormat format) const;
void setNamedColor(const QString& name);
void setNamedColor(QLatin1String name);
static QStringList colorNames();
@ -219,11 +222,13 @@ public:
operator QVariant() const;
static bool isValidColor(const QString &name);
static bool isValidColor(QLatin1String) Q_DECL_NOTHROW;
private:
void invalidate() Q_DECL_NOTHROW;
bool setColorFromString(const QString &name);
template <typename String>
bool setColorFromString(const String &name);
Spec cspec;
union {
@ -272,8 +277,8 @@ inline QColor::QColor() Q_DECL_NOTHROW
inline QColor::QColor(int r, int g, int b, int a)
{ setRgb(r, g, b, a); }
inline QColor::QColor(const char *aname)
{ setNamedColor(QLatin1String(aname)); }
inline QColor::QColor(QLatin1String aname)
{ setNamedColor(aname); }
inline QColor::QColor(const QString& aname)
{ setNamedColor(aname); }

View File

@ -53,15 +53,10 @@
#include <QtGui/private/qtguiglobal_p.h>
#include "QtGui/qrgb.h"
#include "QtCore/qstringlist.h"
QT_BEGIN_NAMESPACE
bool qt_get_named_rgb(const char *, QRgb*);
bool qt_get_named_rgb(const QChar *, int len, QRgb*);
bool qt_get_hex_rgb(const char *, QRgb *);
bool qt_get_hex_rgb(const QChar *, int len, QRgb *);
QStringList qt_get_colornames();
QT_END_NAMESPACE

View File

@ -836,7 +836,10 @@ static const uint *QT_FASTCALL convertGrayscale8FromARGB32PM(uint *buffer, const
}
template <QPixelLayout::BPP bpp> static
uint QT_FASTCALL fetchPixel(const uchar *src, int index);
uint QT_FASTCALL fetchPixel(const uchar *, int)
{
Q_UNREACHABLE();
}
template <>
inline uint QT_FASTCALL fetchPixel<QPixelLayout::BPP1LSB>(const uchar *src, int index)
@ -1554,92 +1557,11 @@ static const QRgba64 *QT_FASTCALL fetchUntransformed64(QRgba64 *buffer, const Op
}
}
// blendType is either BlendTransformed or BlendTransformedTiled
template<TextureBlendType blendType>
static const uint *QT_FASTCALL fetchTransformedARGB32PM(uint *buffer, const Operator *, const QSpanData *data,
int y, int x, int length)
{
int image_width = data->texture.width;
int image_height = data->texture.height;
const qreal cx = x + qreal(0.5);
const qreal cy = y + qreal(0.5);
const uint *end = buffer + length;
uint *b = buffer;
if (data->fast_matrix) {
// The increment pr x in the scanline
int fdx = (int)(data->m11 * fixed_scale);
int fdy = (int)(data->m12 * fixed_scale);
int fx = int((data->m21 * cy
+ data->m11 * cx + data->dx) * fixed_scale);
int fy = int((data->m22 * cy
+ data->m12 * cx + data->dy) * fixed_scale);
while (b < end) {
int px = fx >> 16;
int py = fy >> 16;
if (blendType == BlendTransformedTiled) {
px %= image_width;
py %= image_height;
if (px < 0) px += image_width;
if (py < 0) py += image_height;
} else {
px = qBound(0, px, image_width - 1);
py = qBound(0, py, image_height - 1);
}
*b = reinterpret_cast<const uint *>(data->texture.scanLine(py))[px];
fx += fdx;
fy += fdy;
++b;
}
} else {
const qreal fdx = data->m11;
const qreal fdy = data->m12;
const qreal fdw = data->m13;
qreal fx = data->m21 * cy + data->m11 * cx + data->dx;
qreal fy = data->m22 * cy + data->m12 * cx + data->dy;
qreal fw = data->m23 * cy + data->m13 * cx + data->m33;
while (b < end) {
const qreal iw = fw == 0 ? 1 : 1 / fw;
const qreal tx = fx * iw;
const qreal ty = fy * iw;
int px = int(tx) - (tx < 0);
int py = int(ty) - (ty < 0);
if (blendType == BlendTransformedTiled) {
px %= image_width;
py %= image_height;
if (px < 0) px += image_width;
if (py < 0) py += image_height;
} else {
px = qBound(0, px, image_width - 1);
py = qBound(0, py, image_height - 1);
}
*b = reinterpret_cast<const uint *>(data->texture.scanLine(py))[px];
fx += fdx;
fy += fdy;
fw += fdw;
//force increment to avoid /0
if (!fw) {
fw += fdw;
}
++b;
}
}
return buffer;
}
template<TextureBlendType blendType> /* either BlendTransformed or BlendTransformedTiled */
template<TextureBlendType blendType, QPixelLayout::BPP bpp>
static const uint *QT_FASTCALL fetchTransformed(uint *buffer, const Operator *, const QSpanData *data,
int y, int x, int length)
{
Q_STATIC_ASSERT(blendType == BlendTransformed || blendType == BlendTransformedTiled);
int image_width = data->texture.width;
int image_height = data->texture.height;
@ -1647,9 +1569,12 @@ static const uint *QT_FASTCALL fetchTransformed(uint *buffer, const Operator *,
const qreal cy = y + qreal(0.5);
const QPixelLayout *layout = &qPixelLayouts[data->texture.format];
FetchPixelFunc fetch = qFetchPixel[layout->bpp];
if (bpp != QPixelLayout::BPPNone) // Like this to not ICE on GCC 5.3.1
Q_ASSERT(layout->bpp == bpp);
// When templated 'fetch' should be inlined at compile time:
const FetchPixelFunc fetch = (bpp == QPixelLayout::BPPNone) ? qFetchPixel[layout->bpp] : fetchPixel<bpp>;
const uint *end = buffer + length;
uint *const end = buffer + length;
uint *b = buffer;
if (data->fast_matrix) {
// The increment pr x in the scanline
@ -2585,12 +2510,17 @@ static const uint * QT_FASTCALL fetchTransformedBilinearARGB32PM(uint *buffer, c
}
// blendType = BlendTransformedBilinear or BlendTransformedBilinearTiled
template<TextureBlendType blendType>
template<TextureBlendType blendType, QPixelLayout::BPP bpp>
static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Operator *,
const QSpanData *data, int y, int x, int length)
{
const QPixelLayout *layout = &qPixelLayouts[data->texture.format];
const QVector<QRgb> *clut = data->texture.colorTable;
if (bpp != QPixelLayout::BPPNone) // Like this to not ICE on GCC 5.3.1
Q_ASSERT(layout->bpp == bpp);
// When templated 'fetch' should be inlined at compile time:
const FetchPixelsFunc fetch = (bpp == QPixelLayout::BPPNone) ? qFetchPixels[layout->bpp] : fetchPixels<bpp>;
const FetchPixelFunc fetch1 = (bpp == QPixelLayout::BPPNone) ? qFetchPixel[layout->bpp] : fetchPixel<bpp>;
int image_width = data->texture.width;
int image_height = data->texture.height;
@ -2628,7 +2558,6 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper
// The idea is first to do the interpolation between the row s1 and the row s2
// into an intermediate buffer, then we interpolate between two pixel of this buffer.
FetchPixelsFunc fetch = qFetchPixels[layout->bpp];
// +1 for the last pixel to interpolate with, and +1 for rounding errors.
uint buf1[buffer_size + 2];
uint buf2[buffer_size + 2];
@ -2717,7 +2646,6 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper
fx += fdx;
}
} else {
FetchPixelFunc fetch = qFetchPixel[layout->bpp];
uint buf1[buffer_size];
uint buf2[buffer_size];
uint *b = buffer;
@ -2728,19 +2656,10 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper
int x1 = (fx >> 16);
int x2;
fetchTransformedBilinear_pixelBounds<blendType>(image_width, image_x1, image_x2, x1, x2);
if (layout->bpp == QPixelLayout::BPP32) {
buf1[i * 2 + 0] = ((const uint*)s1)[x1];
buf1[i * 2 + 1] = ((const uint*)s1)[x2];
buf2[i * 2 + 0] = ((const uint*)s2)[x1];
buf2[i * 2 + 1] = ((const uint*)s2)[x2];
} else {
buf1[i * 2 + 0] = fetch(s1, x1);
buf1[i * 2 + 1] = fetch(s1, x2);
buf2[i * 2 + 0] = fetch(s2, x1);
buf2[i * 2 + 1] = fetch(s2, x2);
}
buf1[i * 2 + 0] = fetch1(s1, x1);
buf1[i * 2 + 1] = fetch1(s1, x2);
buf2[i * 2 + 0] = fetch1(s2, x1);
buf2[i * 2 + 1] = fetch1(s2, x2);
fx += fdx;
}
layout->convertToARGB32PM(buf1, buf1, len * 2, clut, 0);
@ -2770,7 +2689,6 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper
}
}
} else { //rotation
FetchPixelFunc fetch = qFetchPixel[layout->bpp];
uint buf1[buffer_size];
uint buf2[buffer_size];
uint *b = buffer;
@ -2789,19 +2707,10 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper
const uchar *s1 = data->texture.scanLine(y1);
const uchar *s2 = data->texture.scanLine(y2);
if (layout->bpp == QPixelLayout::BPP32) {
buf1[i * 2 + 0] = ((const uint*)s1)[x1];
buf1[i * 2 + 1] = ((const uint*)s1)[x2];
buf2[i * 2 + 0] = ((const uint*)s2)[x1];
buf2[i * 2 + 1] = ((const uint*)s2)[x2];
} else {
buf1[i * 2 + 0] = fetch(s1, x1);
buf1[i * 2 + 1] = fetch(s1, x2);
buf2[i * 2 + 0] = fetch(s2, x1);
buf2[i * 2 + 1] = fetch(s2, x2);
}
buf1[i * 2 + 0] = fetch1(s1, x1);
buf1[i * 2 + 1] = fetch1(s1, x2);
buf2[i * 2 + 0] = fetch1(s2, x1);
buf2[i * 2 + 1] = fetch1(s2, x2);
fx += fdx;
fy += fdy;
}
@ -2848,7 +2757,6 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper
qreal fy = data->m22 * cy + data->m12 * cx + data->dy;
qreal fw = data->m23 * cy + data->m13 * cx + data->m33;
FetchPixelFunc fetch = qFetchPixel[layout->bpp];
uint buf1[buffer_size];
uint buf2[buffer_size];
uint *b = buffer;
@ -2876,18 +2784,10 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper
const uchar *s1 = data->texture.scanLine(y1);
const uchar *s2 = data->texture.scanLine(y2);
if (layout->bpp == QPixelLayout::BPP32) {
buf1[i * 2 + 0] = ((const uint*)s1)[x1];
buf1[i * 2 + 1] = ((const uint*)s1)[x2];
buf2[i * 2 + 0] = ((const uint*)s2)[x1];
buf2[i * 2 + 1] = ((const uint*)s2)[x2];
} else {
buf1[i * 2 + 0] = fetch(s1, x1);
buf1[i * 2 + 1] = fetch(s1, x2);
buf2[i * 2 + 0] = fetch(s2, x1);
buf2[i * 2 + 1] = fetch(s2, x2);
}
buf1[i * 2 + 0] = fetch1(s1, x1);
buf1[i * 2 + 1] = fetch1(s1, x2);
buf2[i * 2 + 0] = fetch1(s2, x1);
buf2[i * 2 + 1] = fetch1(s2, x2);
fx += fdx;
fy += fdy;
@ -3293,23 +3193,32 @@ static SourceFetchProc sourceFetchUntransformed[QImage::NImageFormats] = {
};
static const SourceFetchProc sourceFetchGeneric[NBlendTypes] = {
fetchUntransformed, // Untransformed
fetchUntransformed, // Tiled
fetchTransformed<BlendTransformed>, // Transformed
fetchTransformed<BlendTransformedTiled>, // TransformedTiled
fetchTransformedBilinear<BlendTransformedBilinear>, // Bilinear
fetchTransformedBilinear<BlendTransformedBilinearTiled> // BilinearTiled
fetchUntransformed, // Untransformed
fetchUntransformed, // Tiled
fetchTransformed<BlendTransformed, QPixelLayout::BPPNone>, // Transformed
fetchTransformed<BlendTransformedTiled, QPixelLayout::BPPNone>, // TransformedTiled
fetchTransformedBilinear<BlendTransformedBilinear, QPixelLayout::BPPNone>, // TransformedBilinear
fetchTransformedBilinear<BlendTransformedBilinearTiled, QPixelLayout::BPPNone> // TransformedBilinearTiled
};
static SourceFetchProc sourceFetchARGB32PM[NBlendTypes] = {
fetchUntransformedARGB32PM, // Untransformed
fetchUntransformedARGB32PM, // Tiled
fetchTransformedARGB32PM<BlendTransformed>, // Transformed
fetchTransformedARGB32PM<BlendTransformedTiled>, // TransformedTiled
fetchTransformed<BlendTransformed, QPixelLayout::BPP32>, // Transformed
fetchTransformed<BlendTransformedTiled, QPixelLayout::BPP32>, // TransformedTiled
fetchTransformedBilinearARGB32PM<BlendTransformedBilinear>, // Bilinear
fetchTransformedBilinearARGB32PM<BlendTransformedBilinearTiled> // BilinearTiled
};
static SourceFetchProc sourceFetchAny32[NBlendTypes] = {
fetchUntransformed, // Untransformed
fetchUntransformed, // Tiled
fetchTransformed<BlendTransformed, QPixelLayout::BPP32>, // Transformed
fetchTransformed<BlendTransformedTiled, QPixelLayout::BPP32>, // TransformedTiled
fetchTransformedBilinear<BlendTransformedBilinear, QPixelLayout::BPP32>, // TransformedBilinear
fetchTransformedBilinear<BlendTransformedBilinearTiled, QPixelLayout::BPP32> // TransformedBilinearTiled
};
static const SourceFetchProc64 sourceFetchGeneric64[NBlendTypes] = {
fetchUntransformed64, // Untransformed
fetchUntransformed64, // Tiled
@ -3325,6 +3234,8 @@ static inline SourceFetchProc getSourceFetch(TextureBlendType blendType, QImage:
return sourceFetchARGB32PM[blendType];
if (blendType == BlendUntransformed || blendType == BlendTiled)
return sourceFetchUntransformed[format];
if (qPixelLayouts[format].bpp == QPixelLayout::BPP32)
return sourceFetchAny32[blendType];
return sourceFetchGeneric[blendType];
}

View File

@ -261,9 +261,13 @@ void QRawFont::loadFromData(const QByteArray &fontData,
\a glyphIndex in the underlying font, using the \a transform specified.
If the QRawFont is not valid, this function will return an invalid QImage.
If \a antialiasingType is set to QRawFont::SubPixelAntialiasing, then the resulting image will be
in QImage::Format_RGB32 and the RGB values of each pixel will represent the subpixel opacities of
the pixel in the rasterization of the glyph. Otherwise, the image will be in the format of
If the font is a color font, then the resulting image will contain the rendered
glyph at the current pixel size. In this case, the \a antialiasingType will be
ignored.
Otherwise, if \a antialiasingType is set to QRawFont::SubPixelAntialiasing, then the resulting image
will be in QImage::Format_RGB32 and the RGB values of each pixel will represent the subpixel opacities
of the pixel in the rasterization of the glyph. Otherwise, the image will be in the format of
QImage::Format_Indexed8 and each pixel will contain the opacity of the pixel in the
rasterization.
@ -275,6 +279,9 @@ QImage QRawFont::alphaMapForGlyph(quint32 glyphIndex, AntialiasingType antialias
if (!d->isValid())
return QImage();
if (d->fontEngine->glyphFormat == QFontEngine::Format_ARGB)
return d->fontEngine->bitmapForGlyph(glyphIndex, QFixed(), transform);
if (antialiasingType == SubPixelAntialiasing)
return d->fontEngine->alphaRGBMapForGlyph(glyphIndex, QFixed(), transform);

View File

@ -928,7 +928,7 @@ void QTextEngine::shapeLine(const QScriptLine &line)
if (item == -1)
return;
const int end = findItem(line.from + line.length - 1, item);
const int end = findItem(line.from + line.length + line.trailingSpaces - 1, item);
for ( ; item <= end; ++item) {
QScriptItem &si = layoutData->items[item];
if (si.analysis.flags == QScriptAnalysis::Tab) {

View File

@ -67,6 +67,8 @@ QDBusPlatformMenuItem::QDBusPlatformMenuItem(quintptr tag)
QDBusPlatformMenuItem::~QDBusPlatformMenuItem()
{
menuItemsByID.remove(m_dbusID);
if (m_subMenu)
static_cast<QDBusPlatformMenu *>(m_subMenu)->setContainingMenuItem(Q_NULLPTR);
}
void QDBusPlatformMenuItem::setTag(quintptr tag)
@ -176,6 +178,8 @@ QDBusPlatformMenu::QDBusPlatformMenu(quintptr tag)
QDBusPlatformMenu::~QDBusPlatformMenu()
{
if (m_containingMenuItem)
m_containingMenuItem->setMenu(Q_NULLPTR);
}
void QDBusPlatformMenu::insertMenuItem(QPlatformMenuItem *menuItem, QPlatformMenuItem *before)

View File

@ -125,6 +125,8 @@ void QDBusTrayIcon::cleanup()
dBusConnection()->unregisterTrayIcon(this);
delete m_dbusConnection;
m_dbusConnection = Q_NULLPTR;
delete m_notifier;
m_notifier = Q_NULLPTR;
m_registered = false;
}
@ -162,9 +164,10 @@ QTemporaryFile *QDBusTrayIcon::tempIcon(const QIcon &icon)
}
if (!necessary)
return Q_NULLPTR;
qreal dpr = qGuiApp->devicePixelRatio();
QTemporaryFile *ret = new QTemporaryFile(TempFileTemplate, this);
ret->open();
icon.pixmap(QSize(22, 22)).save(ret);
icon.pixmap(QSize(22 * dpr, 22 * dpr)).save(ret);
ret->close();
return ret;
}

View File

@ -59,8 +59,15 @@ Q_LOGGING_CATEGORY(qLcEvdevKeyMap, "qt.qpa.input.keymap")
// simple builtin US keymap
#include "qevdevkeyboard_defaultmap_p.h"
QEvdevKeyboardHandler::QEvdevKeyboardHandler(const QString &device, int fd, bool disableZap, bool enableCompose, const QString &keymapFile)
: m_device(device), m_fd(fd), m_notify(Q_NULLPTR),
void QFdContainer::reset() Q_DECL_NOTHROW
{
if (m_fd >= 0)
qt_safe_close(m_fd);
m_fd = -1;
}
QEvdevKeyboardHandler::QEvdevKeyboardHandler(const QString &device, QFdContainer &fd, bool disableZap, bool enableCompose, const QString &keymapFile)
: m_device(device), m_fd(fd.release()), m_notify(Q_NULLPTR),
m_modifiers(0), m_composing(0), m_dead_unicode(0xffff),
m_no_zap(disableZap), m_do_compose(enableCompose),
m_keymap(0), m_keymap_size(0), m_keycompose(0), m_keycompose_size(0)
@ -75,16 +82,13 @@ QEvdevKeyboardHandler::QEvdevKeyboardHandler(const QString &device, int fd, bool
unloadKeymap();
// socket notifier for events on the keyboard device
m_notify = new QSocketNotifier(m_fd, QSocketNotifier::Read, this);
m_notify = new QSocketNotifier(m_fd.get(), QSocketNotifier::Read, this);
connect(m_notify, SIGNAL(activated(int)), this, SLOT(readKeycode()));
}
QEvdevKeyboardHandler::~QEvdevKeyboardHandler()
{
unloadKeymap();
if (m_fd >= 0)
qt_safe_close(m_fd);
}
QEvdevKeyboardHandler *QEvdevKeyboardHandler::create(const QString &device,
@ -118,13 +122,12 @@ QEvdevKeyboardHandler *QEvdevKeyboardHandler::create(const QString &device,
qCDebug(qLcEvdevKey) << "Opening keyboard at" << device;
int fd;
fd = qt_safe_open(device.toLocal8Bit().constData(), O_RDONLY | O_NDELAY, 0);
if (fd >= 0) {
::ioctl(fd, EVIOCGRAB, grab);
QFdContainer fd(qt_safe_open(device.toLocal8Bit().constData(), O_RDONLY | O_NDELAY, 0));
if (fd.get() >= 0) {
::ioctl(fd.get(), EVIOCGRAB, grab);
if (repeatDelay > 0 && repeatRate > 0) {
int kbdrep[2] = { repeatDelay, repeatRate };
::ioctl(fd, EVIOCSREP, kbdrep);
::ioctl(fd.get(), EVIOCSREP, kbdrep);
}
return new QEvdevKeyboardHandler(device, fd, disableZap, enableCompose, keymapFile);
@ -144,7 +147,7 @@ void QEvdevKeyboardHandler::switchLed(int led, bool state)
led_ie.code = led;
led_ie.value = state;
qt_safe_write(m_fd, &led_ie, sizeof(led_ie));
qt_safe_write(m_fd.get(), &led_ie, sizeof(led_ie));
}
void QEvdevKeyboardHandler::readKeycode()
@ -153,7 +156,7 @@ void QEvdevKeyboardHandler::readKeycode()
int n = 0;
forever {
int result = qt_safe_read(m_fd, reinterpret_cast<char *>(buffer) + n, sizeof(buffer) - n);
int result = qt_safe_read(m_fd.get(), reinterpret_cast<char *>(buffer) + n, sizeof(buffer) - n);
if (result == 0) {
qWarning("evdevkeyboard: Got EOF from the input device");
@ -166,8 +169,7 @@ void QEvdevKeyboardHandler::readKeycode()
if (errno == ENODEV) {
delete m_notify;
m_notify = Q_NULLPTR;
qt_safe_close(m_fd);
m_fd = -1;
m_fd.reset();
}
return;
}
@ -478,7 +480,7 @@ void QEvdevKeyboardHandler::unloadKeymap()
//Set locks according to keyboard leds
quint16 ledbits[1];
memset(ledbits, 0, sizeof(ledbits));
if (::ioctl(m_fd, EVIOCGLED(sizeof(ledbits)), ledbits) < 0) {
if (::ioctl(m_fd.get(), EVIOCGLED(sizeof(ledbits)), ledbits) < 0) {
qWarning("evdevkeyboard: Failed to query led states");
switchLed(LED_NUML,false);
switchLed(LED_CAPSL, false);

View File

@ -129,12 +129,25 @@ inline QDataStream &operator<<(QDataStream &ds, const QEvdevKeyboardMap::Composi
return ds << c.first << c.second << c.result;
}
class QFdContainer
{
int m_fd;
Q_DISABLE_COPY(QFdContainer);
public:
explicit QFdContainer(int fd = -1) Q_DECL_NOTHROW : m_fd(fd) {}
~QFdContainer() { reset(); }
int get() const Q_DECL_NOTHROW { return m_fd; }
int release() Q_DECL_NOTHROW { int result = m_fd; m_fd = -1; return result; }
void reset() Q_DECL_NOTHROW;
};
class QEvdevKeyboardHandler : public QObject
{
Q_OBJECT
public:
QEvdevKeyboardHandler(const QString &device, int fd, bool disableZap, bool enableCompose, const QString &keymapFile);
QEvdevKeyboardHandler(const QString &device, QFdContainer &fd, bool disableZap, bool enableCompose, const QString &keymapFile);
~QEvdevKeyboardHandler();
enum KeycodeAction {
@ -187,7 +200,7 @@ private:
void switchLed(int, bool);
QString m_device;
int m_fd;
QFdContainer m_fd;
QSocketNotifier *m_notify;
// keymap handling

View File

@ -131,7 +131,8 @@ public:
bool m_typeB;
QTransform m_rotate;
bool m_singleTouch;
int m_screenIndex;
QString m_screenName;
QPointer<QScreen> m_screen;
};
QEvdevTouchScreenData::QEvdevTouchScreenData(QEvdevTouchScreenHandler *q_ptr, const QStringList &args)
@ -141,8 +142,7 @@ QEvdevTouchScreenData::QEvdevTouchScreenData(QEvdevTouchScreenHandler *q_ptr, co
hw_range_x_min(0), hw_range_x_max(0),
hw_range_y_min(0), hw_range_y_max(0),
hw_pressure_min(0), hw_pressure_max(0),
m_typeB(false), m_singleTouch(false),
m_screenIndex(-1)
m_typeB(false), m_singleTouch(false)
{
m_forceToActiveWindow = args.contains(QLatin1String("force_window"));
}
@ -301,10 +301,10 @@ QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &device, const
QTouchOutputMapping mapping;
if (mapping.load()) {
d->m_screenIndex = mapping.screenIndexForDeviceNode(d->deviceNode);
if (d->m_screenIndex >= 0)
qCDebug(qLcEvdevTouch, "evdevtouch: Mapping device %s to screen index %d",
qPrintable(d->deviceNode), d->m_screenIndex);
d->m_screenName = mapping.screenNameForDeviceNode(d->deviceNode);
if (!d->m_screenName.isEmpty())
qCDebug(qLcEvdevTouch, "evdevtouch: Mapping device %s to screen %s",
qPrintable(d->deviceNode), qPrintable(d->m_screenName));
}
registerTouchDevice();
@ -673,10 +673,18 @@ void QEvdevTouchScreenData::reportPoints()
// geometry in the full virtual desktop space, there is nothing else
// left to do since qguiapp will handle the rest.
QScreen *screen = QGuiApplication::primaryScreen();
if (m_screenIndex >= 0) {
const QList<QScreen *> screens = QGuiApplication::screens();
if (m_screenIndex < screens.count())
screen = screens.at(m_screenIndex);
if (!m_screenName.isEmpty()) {
if (!m_screen) {
const QList<QScreen *> screens = QGuiApplication::screens();
for (QScreen *s : screens) {
if (s->name() == m_screenName) {
m_screen = s;
break;
}
}
}
if (m_screen)
screen = m_screen;
}
winRect = QHighDpi::toNativePixels(screen->geometry(), screen);
}

View File

@ -71,21 +71,21 @@ bool QTouchOutputMapping::load()
const QVariantMap output = outputs.at(i).toObject().toVariantMap();
if (!output.contains(QStringLiteral("touchDevice")))
continue;
if (!output.contains(QStringLiteral("virtualIndex"))) {
qWarning("evdevtouch: Output %d specifies touchDevice but not virtualIndex, this is wrong", i);
if (!output.contains(QStringLiteral("name"))) {
qWarning("evdevtouch: Output %d specifies touchDevice but not name, this is wrong", i);
continue;
}
const QString &deviceNode = output.value(QStringLiteral("touchDevice")).toString();
const int screenIndex = output.value(QStringLiteral("virtualIndex")).toInt();
m_screenIndexTable.insert(deviceNode, screenIndex);
const QString &screenName = output.value(QStringLiteral("name")).toString();
m_screenTable.insert(deviceNode, screenName);
}
return true;
}
int QTouchOutputMapping::screenIndexForDeviceNode(const QString &deviceNode)
QString QTouchOutputMapping::screenNameForDeviceNode(const QString &deviceNode)
{
return m_screenIndexTable.value(deviceNode, -1);
return m_screenTable.value(deviceNode);
}
QT_END_NAMESPACE

View File

@ -60,10 +60,10 @@ class QTouchOutputMapping
{
public:
bool load();
int screenIndexForDeviceNode(const QString &deviceNode);
QString screenNameForDeviceNode(const QString &deviceNode);
private:
QHash<QString, int> m_screenIndexTable;
QHash<QString, QString> m_screenTable;
};
QT_END_NAMESPACE

View File

@ -252,6 +252,8 @@ QStringList QConnmanManagerInterface::getServices()
bool QConnmanManagerInterface::requestScan(const QString &type)
{
bool scanned = false;
if (technologiesMap.isEmpty())
getTechnologies();
Q_FOREACH (QConnmanTechnologyInterface *tech, technologiesMap) {
if (tech->type() == type) {
tech->scan();

View File

@ -112,15 +112,15 @@ static QByteArray localHostName()
*/
static QComposeCacheFileHeader readFileMetadata(const QString &path)
{
QComposeCacheFileHeader info;
info.reserved = 0;
info.fileSize = 0;
quint64 fileSize = 0;
qint64 lastModified = 0;
const QByteArray pathBytes = QFile::encodeName(path);
QT_STATBUF st;
if (QT_STAT(pathBytes.data(), &st) != 0)
return info;
info.lastModified = st.st_mtime;
info.fileSize = st.st_size;
if (QT_STAT(pathBytes.data(), &st) == 0) {
lastModified = st.st_mtime;
fileSize = st.st_size;
}
QComposeCacheFileHeader info = { 0, 0, fileSize, lastModified };
return info;
}

View File

@ -168,11 +168,19 @@ bool QComposeInputContext::checkComposeTable()
TableGenerator reader;
m_tableState = reader.tableState();
if ((m_tableState & TableGenerator::NoErrors) == TableGenerator::NoErrors)
m_composeTable = reader.composeTable();
m_compositionTableInitialized = true;
if ((m_tableState & TableGenerator::NoErrors) == TableGenerator::NoErrors) {
m_composeTable = reader.composeTable();
} else {
#ifdef DEBUG_COMPOSING
qDebug( "### FAILED_PARSING ###" );
#endif
// if we have errors, don' try to look things up anyways.
reset();
return false;
}
}
Q_ASSERT(!m_composeTable.isEmpty());
QVector<QComposeTableElement>::const_iterator it =
std::lower_bound(m_composeTable.constBegin(), m_composeTable.constEnd(), m_composeBuffer, Compare());

View File

@ -672,11 +672,6 @@ static void updateApplicationState(JNIEnv */*env*/, jobject /*thiz*/, jint state
QAndroidEventDispatcherStopper::instance()->goingToStop(true);
QCoreApplication::processEvents();
QWindowSystemInterface::handleApplicationStateChanged(Qt::ApplicationState(state));
{
AndroidDeadlockProtector protector;
if (protector.acquire())
QWindowSystemInterface::flushWindowSystemEvents();
}
if (state == Qt::ApplicationSuspended)
QAndroidEventDispatcherStopper::instance()->stopAll();
} else {

View File

@ -155,7 +155,7 @@ void QAndroidPlatformWindow::updateStatusBarVisibility()
if (!isNonRegularWindow) {
if (m_windowState & Qt::WindowFullScreen)
QtAndroid::hideStatusBar();
else if (m_windowState & Qt::WindowMaximized)
else
QtAndroid::showStatusBar();
}
}

View File

@ -63,7 +63,7 @@ QBsdFbIntegration::QBsdFbIntegration(const QStringList &paramList)
QBsdFbIntegration::~QBsdFbIntegration()
{
destroyScreen(m_primaryScreen.data());
destroyScreen(m_primaryScreen.take());
}
void QBsdFbIntegration::initialize()

View File

@ -330,6 +330,11 @@ void QCocoaGLContext::updateSurfaceFormat()
[pixelFormat release];
GLint swapInterval = -1;
[m_context getValues:&swapInterval forParameter:NSOpenGLCPSwapInterval];
if (swapInterval >= 0)
m_format.setSwapInterval(swapInterval);
// Restore the original context
CGLSetCurrentContext(oldContext);
}

View File

@ -101,6 +101,7 @@ Q_FORWARD_DECLARE_OBJC_CLASS(QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper));
- (void)setMaskRegion:(const QRegion *)region;
- (void)invalidateWindowShadowIfNeeded;
- (void)drawRect:(NSRect)dirtyRect;
- (void)drawBackingStoreUsingCoreGraphics:(NSRect)dirtyRect;
- (void)updateGeometry;
- (void)notifyWindowStateChanged:(Qt::WindowState)newState;
- (void)windowNotification : (NSNotification *) windowNotification;

View File

@ -569,6 +569,18 @@ static bool _q_dontOverrideCtrlLMB = false;
if (m_platformWindow->m_drawContentBorderGradient)
NSDrawWindowBackground(dirtyRect);
if (m_backingStore)
[self drawBackingStoreUsingCoreGraphics:dirtyRect];
[self invalidateWindowShadowIfNeeded];
}
// Draws the backing store content to the QNSView using Core Graphics.
// This function assumes that the QNSView is in a configuration that
// supports Core Graphics, such as "classic" mode or layer mode with
// the default layer.
- (void)drawBackingStoreUsingCoreGraphics:(NSRect)dirtyRect
{
if (!m_backingStore)
return;
@ -623,8 +635,6 @@ static bool _q_dontOverrideCtrlLMB = false;
CGImageRelease(cleanImg);
CGImageRelease(subMask);
CGImageRelease(bsCGImage);
[self invalidateWindowShadowIfNeeded];
}
- (BOOL) isFlipped

View File

@ -3,13 +3,19 @@ SOURCES += $$PWD/qeglfswindow.cpp \
$$PWD/qeglfsscreen.cpp \
$$PWD/qeglfscursor.cpp \
$$PWD/qeglfshooks.cpp \
$$PWD/qeglfsdeviceintegration.cpp
$$PWD/qeglfsdeviceintegration.cpp \
$$PWD/qeglfsintegration.cpp \
$$PWD/qeglfscontext.cpp \
$$PWD/qeglfsoffscreenwindow.cpp
HEADERS += $$PWD/qeglfswindow_p.h \
$$PWD/qeglfsscreen_p.h \
$$PWD/qeglfscursor_p.h \
$$PWD/qeglfshooks_p.h \
$$PWD/qeglfsdeviceintegration_p.h \
$$PWD/qeglfsglobal.h
$$PWD/qeglfsintegration_p.h \
$$PWD/qeglfscontext_p.h \
$$PWD/qeglfsoffscreenwindow_p.h \
$$PWD/qeglfsglobal_p.h
INCLUDEPATH += $$PWD

View File

@ -37,12 +37,12 @@
**
****************************************************************************/
#include "qeglfsglobal.h"
#include "qeglfsglobal_p.h"
#include <QtGui/QSurface>
#include <QtPlatformSupport/private/qeglconvenience_p.h>
#include <QtPlatformSupport/private/qeglpbuffer_p.h>
#include "qeglfscontext.h"
#include "qeglfscontext_p.h"
#include "qeglfswindow_p.h"
#include "qeglfshooks_p.h"
#include "qeglfscursor_p.h"

View File

@ -40,7 +40,18 @@
#ifndef QEGLFSCONTEXT_H
#define QEGLFSCONTEXT_H
#include "qeglfsglobal.h"
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists purely as an
// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
#include "qeglfsglobal_p.h"
#include <QtPlatformSupport/private/qeglplatformcontext_p.h>
#include <QtCore/QVariant>

View File

@ -38,7 +38,7 @@
****************************************************************************/
#include "qeglfscursor_p.h"
#include "qeglfsintegration.h"
#include "qeglfsintegration_p.h"
#include "qeglfsscreen_p.h"
#include <qpa/qwindowsysteminterface.h>

View File

@ -51,7 +51,7 @@
// We mean it.
//
#include "qeglfsglobal.h"
#include "qeglfsglobal_p.h"
#include <qpa/qplatformcursor.h>
#include <qpa/qplatformscreen.h>
#include <QtGui/QMatrix4x4>

View File

@ -38,7 +38,7 @@
****************************************************************************/
#include "qeglfsdeviceintegration_p.h"
#include "qeglfsintegration.h"
#include "qeglfsintegration_p.h"
#include "qeglfscursor_p.h"
#include "qeglfswindow_p.h"
#include "qeglfsscreen_p.h"

View File

@ -51,7 +51,7 @@
// We mean it.
//
#include "qeglfsglobal.h"
#include "qeglfsglobal_p.h"
#include <qpa/qplatformintegration.h>
#include <qpa/qplatformscreen.h>
#include <QtCore/QString>

View File

@ -40,6 +40,17 @@
#ifndef QEGLFSGLOBAL_H
#define QEGLFSGLOBAL_H
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists purely as an
// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
#include <QtCore/qglobal.h>
#include <QtPlatformSupport/private/qt_egl_p.h>

View File

@ -51,7 +51,7 @@
// We mean it.
//
#include "qeglfsglobal.h"
#include "qeglfsglobal_p.h"
#include "qeglfsdeviceintegration_p.h"
QT_BEGIN_NAMESPACE

View File

@ -51,11 +51,11 @@
#include <qpa/qplatforminputcontextfactory_p.h>
#include <private/qgenericunixthemes_p.h>
#include "qeglfsintegration.h"
#include "qeglfsintegration_p.h"
#include "qeglfswindow_p.h"
#include "qeglfshooks_p.h"
#include "qeglfscontext.h"
#include "qeglfsoffscreenwindow.h"
#include "qeglfscontext_p.h"
#include "qeglfsoffscreenwindow_p.h"
#include "qeglfscursor_p.h"
#include <QtPlatformSupport/private/qeglconvenience_p.h>

View File

@ -40,7 +40,18 @@
#ifndef QEGLFSINTEGRATION_H
#define QEGLFSINTEGRATION_H
#include "qeglfsglobal.h"
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists purely as an
// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
#include "qeglfsglobal_p.h"
#include <QtCore/QVariant>
#include <qpa/qplatformintegration.h>
#include <qpa/qplatformnativeinterface.h>

View File

@ -37,7 +37,7 @@
**
****************************************************************************/
#include "qeglfsoffscreenwindow.h"
#include "qeglfsoffscreenwindow_p.h"
#include "qeglfshooks_p.h"
#include <QtGui/QOffscreenSurface>
#include <QtPlatformSupport/private/qeglconvenience_p.h>

View File

@ -40,7 +40,18 @@
#ifndef QEGLFSOFFSCREENWINDOW_H
#define QEGLFSOFFSCREENWINDOW_H
#include "qeglfsglobal.h"
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists purely as an
// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
#include "qeglfsglobal_p.h"
#include <qpa/qplatformoffscreensurface.h>
QT_BEGIN_NAMESPACE

View File

@ -51,7 +51,7 @@
// We mean it.
//
#include "qeglfsglobal.h"
#include "qeglfsglobal_p.h"
#include <QtCore/QPointer>
#include <qpa/qplatformscreen.h>

View File

@ -51,8 +51,8 @@
// We mean it.
//
#include "qeglfsglobal.h"
#include "qeglfsintegration.h"
#include "qeglfsglobal_p.h"
#include "qeglfsintegration_p.h"
#include "qeglfsscreen_p.h"
#include <qpa/qplatformwindow.h>

View File

@ -2,7 +2,7 @@ TARGET = qeglfs-brcm-integration
QT += core-private gui-private platformsupport-private eglfsdeviceintegration-private
INCLUDEPATH += $$PWD/../..
INCLUDEPATH += $$PWD/../../api
CONFIG += egl
LIBS += -lbcm_host

View File

@ -6,7 +6,7 @@ load(qt_plugin)
QT += core-private gui-private platformsupport-private eglfsdeviceintegration-private eglfs_kms_support-private
INCLUDEPATH += $$PWD/../.. $$PWD/../eglfs_kms_support
INCLUDEPATH += $$PWD/../../api $$PWD/../eglfs_kms_support
# Avoid X11 header collision, use generic EGL native types
DEFINES += QT_EGL_NO_X11

View File

@ -42,7 +42,7 @@
#include "qeglfskmsgbmdevice.h"
#include "qeglfskmsgbmscreen.h"
#include "qeglfsintegration.h"
#include "qeglfsintegration_p.h"
#include <QtCore/QLoggingCategory>
#include <QtCore/private/qcore_unix_p.h>

View File

@ -42,7 +42,7 @@
#include "qeglfskmsgbmscreen.h"
#include "qeglfskmsgbmdevice.h"
#include "qeglfskmsgbmcursor.h"
#include "qeglfsintegration.h"
#include "qeglfsintegration_p.h"
#include <QtCore/QLoggingCategory>

View File

@ -2,7 +2,7 @@ TARGET = qeglfs-kms-egldevice-integration
QT += core-private gui-private platformsupport-private eglfsdeviceintegration-private eglfs_kms_support-private
INCLUDEPATH += $$PWD/../.. $$PWD/../eglfs_kms_support
INCLUDEPATH += $$PWD/../../api $$PWD/../eglfs_kms_support
# Avoid X11 header collision, use generic EGL native types
DEFINES += QT_EGL_NO_X11

View File

@ -4,7 +4,7 @@ load(qt_module)
QT += core-private gui-private platformsupport-private eglfsdeviceintegration-private
INCLUDEPATH += $$PWD/../..
INCLUDEPATH += $$PWD/../../api
# Avoid X11 header collision, use generic EGL native types
DEFINES += QT_EGL_NO_X11

View File

@ -42,7 +42,7 @@
#include "qeglfskmsdevice.h"
#include "qeglfskmsscreen.h"
#include "qeglfsintegration.h"
#include "qeglfsintegration_p.h"
#include <QtCore/QLoggingCategory>
#include <QtCore/private/qcore_unix_p.h>
@ -159,7 +159,9 @@ static bool parseModeline(const QByteArray &text, drmModeModeInfoPtr mode)
return true;
}
QEglFSKmsScreen *QEglFSKmsDevice::createScreenForConnector(drmModeResPtr resources, drmModeConnectorPtr connector, int *virtualIndex)
QEglFSKmsScreen *QEglFSKmsDevice::createScreenForConnector(drmModeResPtr resources,
drmModeConnectorPtr connector,
VirtualDesktopInfo *vinfo)
{
const QByteArray connectorName = nameForConnector(connector);
@ -192,8 +194,16 @@ QEglFSKmsScreen *QEglFSKmsDevice::createScreenForConnector(drmModeResPtr resourc
qWarning("Invalid mode \"%s\" for output %s", mode.constData(), connectorName.constData());
configuration = OutputConfigPreferred;
}
if (virtualIndex)
*virtualIndex = userConnectorConfig.value(QStringLiteral("virtualIndex"), INT_MAX).toInt();
if (vinfo) {
*vinfo = VirtualDesktopInfo();
vinfo->virtualIndex = userConnectorConfig.value(QStringLiteral("virtualIndex"), INT_MAX).toInt();
if (userConnectorConfig.contains(QStringLiteral("virtualPos"))) {
const QByteArray vpos = userConnectorConfig.value(QStringLiteral("virtualPos")).toByteArray();
const QByteArrayList vposComp = vpos.split(',');
if (vposComp.count() == 2)
vinfo->virtualPos = QPoint(vposComp[0].trimmed().toInt(), vposComp[1].trimmed().toInt());
}
}
const uint32_t crtc_id = resources->crtcs[crtc];
@ -357,22 +367,24 @@ QEglFSKmsDevice::~QEglFSKmsDevice()
struct OrderedScreen
{
OrderedScreen() : screen(nullptr), index(-1) { }
OrderedScreen(QEglFSKmsScreen *screen, int index) : screen(screen), index(index) { }
OrderedScreen() : screen(nullptr) { }
OrderedScreen(QEglFSKmsScreen *screen, const QEglFSKmsDevice::VirtualDesktopInfo &vinfo)
: screen(screen), vinfo(vinfo) { }
QEglFSKmsScreen *screen;
int index;
QEglFSKmsDevice::VirtualDesktopInfo vinfo;
};
QDebug operator<<(QDebug dbg, const OrderedScreen &s)
{
QDebugStateSaver saver(dbg);
dbg.nospace() << "OrderedScreen(" << s.screen << " : " << s.index << ")";
dbg.nospace() << "OrderedScreen(" << s.screen << " : " << s.vinfo.virtualIndex
<< " / " << s.vinfo.virtualPos << ")";
return dbg;
}
static bool orderedScreenLessThan(const OrderedScreen &a, const OrderedScreen &b)
{
return a.index < b.index;
return a.vinfo.virtualIndex < b.vinfo.virtualIndex;
}
void QEglFSKmsDevice::createScreens()
@ -390,10 +402,10 @@ void QEglFSKmsDevice::createScreens()
if (!connector)
continue;
int virtualIndex;
QEglFSKmsScreen *screen = createScreenForConnector(resources, connector, &virtualIndex);
VirtualDesktopInfo vinfo;
QEglFSKmsScreen *screen = createScreenForConnector(resources, connector, &vinfo);
if (screen)
screens.append(OrderedScreen(screen, virtualIndex));
screens.append(OrderedScreen(screen, vinfo));
drmModeFreeConnector(connector);
}
@ -411,11 +423,15 @@ void QEglFSKmsDevice::createScreens()
for (const OrderedScreen &orderedScreen : screens) {
QEglFSKmsScreen *s = orderedScreen.screen;
// set up a horizontal or vertical virtual desktop
s->setVirtualPosition(pos);
if (m_integration->virtualDesktopLayout() == QEglFSKmsIntegration::VirtualDesktopLayoutVertical)
pos.ry() += s->geometry().height();
else
pos.rx() += s->geometry().width();
if (orderedScreen.vinfo.virtualPos.isNull()) {
s->setVirtualPosition(pos);
if (m_integration->virtualDesktopLayout() == QEglFSKmsIntegration::VirtualDesktopLayoutVertical)
pos.ry() += s->geometry().height();
else
pos.rx() += s->geometry().width();
} else {
s->setVirtualPosition(orderedScreen.vinfo.virtualPos);
}
qCDebug(qLcEglfsKmsDebug) << "Adding screen" << s << "to QPA with geometry" << s->geometry();
// The order in qguiapp's screens list will match the order set by
// virtualIndex. This is not only handy but also required since for instance

View File

@ -53,6 +53,12 @@ QT_BEGIN_NAMESPACE
class Q_EGLFS_EXPORT QEglFSKmsDevice
{
public:
struct VirtualDesktopInfo {
VirtualDesktopInfo() : virtualIndex(0) { }
int virtualIndex;
QPoint virtualPos;
};
QEglFSKmsDevice(QEglFSKmsIntegration *integration, const QString &path);
virtual ~QEglFSKmsDevice();
@ -79,7 +85,9 @@ protected:
quint32 m_connector_allocator;
int crtcForConnector(drmModeResPtr resources, drmModeConnectorPtr connector);
QEglFSKmsScreen *createScreenForConnector(drmModeResPtr resources, drmModeConnectorPtr connector, int *virtualIndex);
QEglFSKmsScreen *createScreenForConnector(drmModeResPtr resources,
drmModeConnectorPtr connector,
VirtualDesktopInfo *vinfo);
drmModePropertyPtr connectorProperty(drmModeConnectorPtr connector, const QByteArray &name);
static void pageFlipHandler(int fd,

View File

@ -41,7 +41,7 @@
#include "qeglfskmsscreen.h"
#include "qeglfskmsdevice.h"
#include "qeglfsintegration.h"
#include "qeglfsintegration_p.h"
#include <QtCore/QLoggingCategory>

View File

@ -5,7 +5,7 @@ QT += core-private gui-private platformsupport-private eglfsdeviceintegration-pr
# Avoid X11 header collision, use generic EGL native types
DEFINES += QT_EGL_NO_X11
INCLUDEPATH += $$PWD/../..
INCLUDEPATH += $$PWD/../../api
CONFIG += egl
QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF

View File

@ -2,7 +2,7 @@ TARGET = qeglfs-viv-integration
QT += core-private gui-private platformsupport-private eglfsdeviceintegration-private
INCLUDEPATH += $$PWD/../..
INCLUDEPATH += $$PWD/../../api
CONFIG += egl
DEFINES += LINUX=1 EGL_API_FB=1
QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF

View File

@ -2,7 +2,7 @@ TARGET = qeglfs-viv-wl-integration
QT += core-private gui-private platformsupport-private eglfsdeviceintegration-private
INCLUDEPATH += $$PWD/../..
INCLUDEPATH += $$PWD/../../api
CONFIG += egl
DEFINES += LINUX=1 EGL_API_FB=1
QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF

View File

@ -5,7 +5,7 @@ QT += core-private gui-private platformsupport-private eglfsdeviceintegration-pr
# Avoid X11 header collision, use generic EGL native types
DEFINES += QT_EGL_NO_X11
INCLUDEPATH += $$PWD/../..
INCLUDEPATH += $$PWD/../../api
CONFIG += egl
QMAKE_USE += xcb_xlib

View File

@ -6,6 +6,8 @@ SOURCES += $$PWD/qeglfsmain.cpp
OTHER_FILES += $$PWD/eglfs.json
INCLUDEPATH += $$PWD/api
PLUGIN_TYPE = platforms
PLUGIN_CLASS_NAME = QEglFSIntegrationPlugin
!equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = -

View File

@ -1,7 +1,8 @@
# The device integration plugin base class has to live in a shared library,
# placing it into a static lib like platformsupport is not sufficient since we
# have to keep the QObject magic like qobject_cast working.
# Hence this header-less, private-only module.
# Hence this private-only module.
# By having _p headers, it also enables developing out-of-tree integration plugins.
TARGET = QtEglFSDeviceIntegration
CONFIG += internal_module
@ -15,20 +16,10 @@ DEFINES += QT_EGL_NO_X11
DEFINES += QT_BUILD_EGL_DEVICE_LIB
SOURCES += $$PWD/qeglfsintegration.cpp \
$$PWD/qeglfscontext.cpp \
$$PWD/qeglfsoffscreenwindow.cpp \
HEADERS += $$PWD/qeglfsintegration.h \
$$PWD/qeglfscontext.h \
$$PWD/qeglfsoffscreenwindow.h \
include($$PWD/api/api.pri)
QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF
INCLUDEPATH += $$PWD
!isEmpty(EGLFS_PLATFORM_HOOKS_SOURCES) {
HEADERS += $$EGLFS_PLATFORM_HOOKS_HEADERS
SOURCES += $$EGLFS_PLATFORM_HOOKS_SOURCES

View File

@ -38,7 +38,7 @@
****************************************************************************/
#include <qpa/qplatformintegrationplugin.h>
#include "qeglfsintegration.h"
#include "qeglfsintegration_p.h"
QT_BEGIN_NAMESPACE

View File

@ -321,7 +321,7 @@ QIOSMenu::QIOSMenu()
: QPlatformMenu()
, m_tag(0)
, m_enabled(true)
, m_visible(true)
, m_visible(false)
, m_text(QString())
, m_menuType(DefaultMenu)
, m_effectiveMenuType(DefaultMenu)
@ -414,7 +414,7 @@ void QIOSMenu::handleItemSelected(QIOSMenuItem *menuItem)
void QIOSMenu::showPopup(const QWindow *parentWindow, const QRect &targetRect, const QPlatformMenuItem *item)
{
if (m_currentMenu == this || !m_visible || !m_enabled || !parentWindow)
if (m_currentMenu == this || !parentWindow)
return;
emit aboutToShow();
@ -441,6 +441,8 @@ void QIOSMenu::showPopup(const QWindow *parentWindow, const QRect &targetRect, c
toggleShowUsingUIPickerView(true);
break;
}
m_visible = true;
}
void QIOSMenu::dismiss()
@ -462,6 +464,7 @@ void QIOSMenu::dismiss()
}
m_currentMenu = 0;
m_visible = false;
}
void QIOSMenu::toggleShowUsingUIMenuController(bool show)

View File

@ -109,7 +109,7 @@ bool QIOSMessageDialog::show(Qt::WindowFlags windowFlags, Qt::WindowModality win
Q_UNUSED(windowFlags);
if (m_alertController // Ensure that the dialog is not showing already
|| !options() // Some message dialogs don't have options (QErrorMessage)
|| windowModality != Qt::ApplicationModal // We can only do app modal dialogs
|| windowModality == Qt::NonModal // We can only do modal dialogs
|| QOperatingSystemVersion::current() < QOperatingSystemVersion(QOperatingSystemVersion::IOS, 8)) // API limitation
return false;

View File

@ -299,7 +299,11 @@ static void executeBlockWithoutAnimation(Block block)
// -------------------------------------------------------------------------
#if QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_10_0)
@interface QIOSHandleLayer : CALayer <CAAnimationDelegate> {
#else
@interface QIOSHandleLayer : CALayer {
#endif
CALayer *_handleCursorLayer;
CALayer *_handleKnobLayer;
Qt::Edge _selectionEdge;

View File

@ -229,6 +229,10 @@
@implementation QIOSViewController
@synthesize prefersStatusBarHidden;
@synthesize preferredStatusBarUpdateAnimation;
@synthesize preferredStatusBarStyle;
- (id)initWithQIOSScreen:(QT_PREPEND_NAMESPACE(QIOSScreen) *)screen
{
if (self = [self init]) {

View File

@ -93,7 +93,7 @@ QIOSWindow::~QIOSWindow()
// practice this doesn't seem to happen when removing the view from its superview. To ensure that
// Qt's internal state for touch and mouse handling is kept consistent, we therefor have to force
// cancellation of all touch events.
[m_view touchesCancelled:0 withEvent:0];
[m_view touchesCancelled:[NSSet set] withEvent:0];
clearAccessibleCache();
m_view->m_qioswindow = 0;

View File

@ -430,7 +430,8 @@
// We do this by assuming that there are no cases where a
// sub-set of the active touch events are intentionally cancelled.
if (touches && (static_cast<NSInteger>([touches count]) != m_activeTouches.count()))
NSInteger count = static_cast<NSInteger>([touches count]);
if (count != 0 && count != m_activeTouches.count())
qWarning("Subset of active touches cancelled by UIKit");
m_activeTouches.clear();

View File

@ -112,7 +112,7 @@ static inline QQnxIntegration::Options parseOptions(const QStringList &paramList
options |= QQnxIntegration::FullScreenApplication;
}
if (!paramList.contains(QLatin1String("flush-screen-context"))) {
if (paramList.contains(QLatin1String("flush-screen-context"))) {
options |= QQnxIntegration::AlwaysFlushScreenContext;
}

View File

@ -49,6 +49,17 @@
#include <screen/screen.h>
// For pre-7.0 SDPs, map some screen property names to the old
// names.
#include <sys/neutrino.h>
#if _NTO_VERSION < 700
const int SCREEN_PROPERTY_FLAGS = SCREEN_PROPERTY_KEY_FLAGS;
const int SCREEN_PROPERTY_FOCUS = SCREEN_PROPERTY_KEYBOARD_FOCUS;
const int SCREEN_PROPERTY_MODIFIERS = SCREEN_PROPERTY_KEY_MODIFIERS;
const int SCREEN_PROPERTY_SCAN = SCREEN_PROPERTY_KEY_SCAN;
const int SCREEN_PROPERTY_SYM = SCREEN_PROPERTY_KEY_SYM;
#endif
QT_BEGIN_NAMESPACE
class QQnxWindow;

View File

@ -239,20 +239,20 @@ void QQnxScreenEventHandler::handleKeyboardEvent(screen_event_t event)
{
// get flags of key event
int flags;
Q_SCREEN_CHECKERROR(screen_get_event_property_iv(event, SCREEN_PROPERTY_KEY_FLAGS, &flags),
Q_SCREEN_CHECKERROR(screen_get_event_property_iv(event, SCREEN_PROPERTY_FLAGS, &flags),
"Failed to query event flags");
// get key code
int sym;
Q_SCREEN_CHECKERROR(screen_get_event_property_iv(event, SCREEN_PROPERTY_KEY_SYM, &sym),
Q_SCREEN_CHECKERROR(screen_get_event_property_iv(event, SCREEN_PROPERTY_SYM, &sym),
"Failed to query event sym");
int modifiers;
Q_SCREEN_CHECKERROR(screen_get_event_property_iv(event, SCREEN_PROPERTY_KEY_MODIFIERS, &modifiers),
Q_SCREEN_CHECKERROR(screen_get_event_property_iv(event, SCREEN_PROPERTY_MODIFIERS, &modifiers),
"Failed to query event modifieres");
int scan;
Q_SCREEN_CHECKERROR(screen_get_event_property_iv(event, SCREEN_PROPERTY_KEY_SCAN, &scan),
Q_SCREEN_CHECKERROR(screen_get_event_property_iv(event, SCREEN_PROPERTY_SCAN, &scan),
"Failed to query event scan");
int cap;
@ -594,7 +594,7 @@ void QQnxScreenEventHandler::handlePropertyEvent(screen_event_t event)
qFatal("QQnx: failed to query window property, errno=%d", errno);
switch (property) {
case SCREEN_PROPERTY_KEYBOARD_FOCUS:
case SCREEN_PROPERTY_FOCUS:
handleKeyboardFocusPropertyEvent(window);
break;
default:
@ -607,7 +607,7 @@ void QQnxScreenEventHandler::handleKeyboardFocusPropertyEvent(screen_window_t wi
{
errno = 0;
int focus = 0;
if (Q_UNLIKELY(window && screen_get_window_property_iv(window, SCREEN_PROPERTY_KEYBOARD_FOCUS, &focus) != 0))
if (Q_UNLIKELY(window && screen_get_window_property_iv(window, SCREEN_PROPERTY_FOCUS, &focus) != 0))
qFatal("QQnx: failed to query keyboard focus property, errno=%d", errno);
QWindow *focusWindow = QQnxIntegration::window(window);

View File

@ -581,7 +581,7 @@ void QQnxWindow::setFocus(screen_window_t newFocusWindow)
screen_get_window_property_pv(nativeHandle(), SCREEN_PROPERTY_GROUP,
reinterpret_cast<void**>(&screenGroup));
if (screenGroup) {
screen_set_group_property_pv(screenGroup, SCREEN_PROPERTY_KEYBOARD_FOCUS,
screen_set_group_property_pv(screenGroup, SCREEN_PROPERTY_FOCUS,
reinterpret_cast<void**>(&newFocusWindow));
}
}

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