Merge remote-tracking branch 'origin/5.6' into 5.7

Change-Id: I9a10e1f3c9506ec8554d8f59b6300825ac730939
This commit is contained in:
Simon Hausmann 2016-03-23 08:29:43 +01:00
commit 8e2d3e3b90
27 changed files with 209 additions and 294 deletions

View File

@ -1,3 +1,3 @@
SOURCES = libdl.cpp
CONFIG -= qt dylib
LIBS += -ldl
!qnx: LIBS += -ldl

2
configure vendored
View File

@ -4657,7 +4657,7 @@ if ! compileTest unix/ipc_sysv "ipc_sysv" ; then
if compileTest unix/ipc_posix "ipc_posix" ; then
QCONFIG_FLAGS="$QCONFIG_FLAGS QT_POSIX_IPC"
else
if [ "$XPLATFORM_ANDROID" = "no" ] ; then
if [ "$XPLATFORM_ANDROID" = "no" ] && [ "$XPLATFORM_MINGW" = "no" ] ; then
QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_SYSTEMSEMAPHORE QT_NO_SHAREDMEMORY"
fi
fi

View File

@ -4,6 +4,8 @@
# Written for Intel C++
#
include(../common/angle.conf)
MAKEFILE_GENERATOR = MSVC.NET
QMAKE_PLATFORM = win32
CONFIG += incremental flat debug_and_release debug_and_release_target
@ -87,6 +89,8 @@ QMAKE_LIBS_CORE = kernel32.lib user32.lib shell32.lib uuid.lib ole32.lib
QMAKE_LIBS_GUI = gdi32.lib comdlg32.lib oleaut32.lib imm32.lib winmm.lib ws2_32.lib ole32.lib user32.lib advapi32.lib
QMAKE_LIBS_NETWORK = ws2_32.lib
QMAKE_LIBS_OPENGL = glu32.lib opengl32.lib gdi32.lib user32.lib delayimp.lib
QMAKE_LIBS_OPENGL_ES2 = $${LIBEGL_NAME}.lib $${LIBGLESV2_NAME}.lib gdi32.lib user32.lib
QMAKE_LIBS_OPENGL_ES2_DEBUG = $${LIBEGL_NAME}d.lib $${LIBGLESV2_NAME}d.lib gdi32.lib user32.lib
QMAKE_LIBS_COMPAT = advapi32.lib shell32.lib comdlg32.lib user32.lib gdi32.lib ws2_32.lib
QMAKE_LIBS_QT_ENTRY = -lqtmain

View File

@ -182,8 +182,10 @@ const char _slnProjDepEnd[] = "\n\tEndProjectSection";
const char _slnProjConfBeg[] = "\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution";
const char _slnProjRelConfTag1[]= ".Release|%1.ActiveCfg = Release|";
const char _slnProjRelConfTag2[]= ".Release|%1.Build.0 = Release|";
const char _slnProjRelConfTag3[]= ".Release|%1.Deploy.0 = Release|";
const char _slnProjDbgConfTag1[]= ".Debug|%1.ActiveCfg = Debug|";
const char _slnProjDbgConfTag2[]= ".Debug|%1.Build.0 = Debug|";
const char _slnProjDbgConfTag3[]= ".Debug|%1.Deploy.0 = Debug|";
const char _slnProjConfEnd[] = "\n\tEndGlobalSection";
const char _slnExtSections[] = "\n\tGlobalSection(ExtensibilityGlobals) = postSolution"
"\n\tEndGlobalSection"
@ -722,8 +724,12 @@ void VcprojGenerator::writeSubDirs(QTextStream &t)
platform = xplatform;
t << "\n\t\t" << (*it)->uuid << QString(_slnProjDbgConfTag1).arg(xplatform) << platform;
t << "\n\t\t" << (*it)->uuid << QString(_slnProjDbgConfTag2).arg(xplatform) << platform;
if (!project->isEmpty("CE_SDK") && !project->isEmpty("CE_ARCH"))
t << "\n\t\t" << (*it)->uuid << QString(_slnProjDbgConfTag3).arg(xplatform) << platform;
t << "\n\t\t" << (*it)->uuid << QString(_slnProjRelConfTag1).arg(xplatform) << platform;
t << "\n\t\t" << (*it)->uuid << QString(_slnProjRelConfTag2).arg(xplatform) << platform;
if (!project->isEmpty("CE_SDK") && !project->isEmpty("CE_ARCH"))
t << "\n\t\t" << (*it)->uuid << QString(_slnProjRelConfTag3).arg(xplatform) << platform;
}
t << _slnProjConfEnd;
t << _slnExtSections;
@ -1261,6 +1267,7 @@ void VcprojGenerator::initDeploymentTool()
targetPath = QString("%CSIDL_PROGRAM_FILES%\\") + project->first("TARGET");
if (targetPath.endsWith("/") || targetPath.endsWith("\\"))
targetPath.chop(1);
conf.deployment.RemoteDirectory = targetPath;
}
const ProStringList dllPaths = project->values("QMAKE_DLL_PATHS");
// Only deploy Qt libs for shared build
@ -1268,6 +1275,7 @@ void VcprojGenerator::initDeploymentTool()
!(conf.WinRT && project->first("MSVC_VER").toQString() == "14.0")) {
// FIXME: This code should actually resolve the libraries from all Qt modules.
ProStringList arg = project->values("QMAKE_LIBS") + project->values("QMAKE_LIBS_PRIVATE");
bool qpaPluginDeployed = false;
for (ProStringList::ConstIterator it = arg.constBegin(); it != arg.constEnd(); ++it) {
QString dllName = (*it).toQString();
dllName.replace(QLatin1Char('\\'), QLatin1Char('/'));
@ -1300,6 +1308,32 @@ void VcprojGenerator::initDeploymentTool()
+ "|" + QDir::toNativeSeparators(info.absolutePath())
+ "|" + targetPath
+ "|0;";
if (!qpaPluginDeployed) {
QChar debugInfixChar;
bool foundGuid = false;
if (foundGuid = dllName.contains(QLatin1String("Guid")))
debugInfixChar = QLatin1Char('d');
if (foundGuid || dllName.contains(QLatin1String("Gui"))) {
QFileInfo info2;
foreach (const ProString &dllPath, dllPaths) {
QString absoluteDllFilePath = dllPath.toQString();
if (!absoluteDllFilePath.endsWith(QLatin1Char('/')))
absoluteDllFilePath += QLatin1Char('/');
absoluteDllFilePath += QLatin1String("../plugins/platforms/qwindows") + debugInfixChar + QLatin1String(".dll");
info2 = QFileInfo(absoluteDllFilePath);
if (info2.exists())
break;
}
if (info2.exists()) {
conf.deployment.AdditionalFiles += QLatin1String("qwindows") + debugInfixChar + QLatin1String(".dll")
+ QLatin1Char('|') + QDir::toNativeSeparators(info2.absolutePath())
+ QLatin1Char('|') + targetPath + QLatin1String("\\platforms")
+ QLatin1String("|0;");
qpaPluginDeployed = true;
}
}
}
}
}
}

View File

@ -1738,7 +1738,9 @@ void qErrnoWarning(int code, const char *msg, ...)
\brief Changes the output of the default message handler.
Allows to tweak the output of qDebug(), qWarning(), qCritical() and qFatal().
Allows to tweak the output of qDebug(), qInfo(), qWarning(), qCritical(),
and qFatal(). The category logging output of qCDebug(), qCInfo(),
qCWarning(), and qCCritical() is formatted, too.
Following placeholders are supported:
@ -1791,7 +1793,7 @@ void qErrnoWarning(int code, const char *msg, ...)
Custom message handlers can use qFormatLogMessage() to take \a pattern into account.
\sa qInstallMessageHandler(), {Debugging Techniques}
\sa qInstallMessageHandler(), {Debugging Techniques}, {QLoggingCategory}
*/
QtMessageHandler qInstallMessageHandler(QtMessageHandler h)

View File

@ -41,11 +41,7 @@
#include <QtCore/qatomic.h>
#include "qprocess_p.h"
#ifdef QPROCESS_USE_SPAWN
# define FORKFD_NO_FORKFD
#else
# define FORKFD_NO_SPAWNFD
#endif
#define FORKFD_NO_SPAWNFD
#if defined(QT_NO_DEBUG) && !defined(NDEBUG)
# define NDEBUG

View File

@ -1186,17 +1186,6 @@ bool QProcessPrivate::_q_processDied()
if (crashed) {
exitStatus = QProcess::CrashExit;
setErrorAndEmit(QProcess::Crashed);
} else {
#ifdef QPROCESS_USE_SPAWN
// if we're using posix_spawn, waitForStarted always succeeds.
// POSIX documents that the sub-process launched by posix_spawn will exit with code
// 127 if anything prevents the target program from starting.
// http://pubs.opengroup.org/onlinepubs/009695399/functions/posix_spawn.html
if (exitStatus == QProcess::NormalExit && exitCode == 127) {
setError(QProcess::FailedToStart,
QProcess::tr("Process failed to start (spawned process exited with code 127)"));
}
#endif
}
bool wasRunning = (processState == QProcess::Running);

View File

@ -68,9 +68,6 @@ typedef HANDLE Q_PIPE;
#else
typedef int Q_PIPE;
#define INVALID_Q_PIPE -1
# ifdef Q_OS_QNX
# define QPROCESS_USE_SPAWN
# endif
#endif
#ifndef QT_NO_PROCESS
@ -352,10 +349,8 @@ public:
void start(QIODevice::OpenMode mode);
void startProcess();
#if defined(Q_OS_UNIX) && !defined(QPROCESS_USE_SPAWN)
#if defined(Q_OS_UNIX)
void execChild(const char *workingDirectory, char **path, char **argv, char **envp);
#elif defined(QPROCESS_USE_SPAWN)
pid_t spawnChild(pid_t *ppid, const char *workingDirectory, char **argv, char **envp);
#endif
bool processStarted(QString *errorMessage = Q_NULLPTR);
void terminateProcess();

View File

@ -471,14 +471,8 @@ void QProcessPrivate::startProcess()
}
// Start the process manager, and fork off the child process.
#if defined(QPROCESS_USE_SPAWN)
pid_t childPid;
forkfd = spawnChild(&childPid, workingDirPtr, argv, envp);
Q_ASSUME(forkfd != FFD_CHILD_PROCESS);
#else
pid_t childPid;
forkfd = ::forkfd(FFD_CLOEXEC, &childPid);
#endif
int lastForkErrno = errno;
if (forkfd != FFD_CHILD_PROCESS) {
// Parent process.
@ -512,12 +506,10 @@ void QProcessPrivate::startProcess()
}
// Start the child.
#if !defined(QPROCESS_USE_SPAWN)
if (forkfd == FFD_CHILD_PROCESS) {
execChild(workingDirPtr, path, argv, envp);
::_exit(-1);
}
#endif
pid = Q_PID(childPid);
@ -556,147 +548,6 @@ void QProcessPrivate::startProcess()
}
}
#if defined(QPROCESS_USE_SPAWN)
static int doSpawn(pid_t *ppid, const posix_spawn_file_actions_t *file_actions,
char **argv, char **envp, const char *workingDir, bool spawn_detached)
{
// A multi threaded QNX Process can't fork so we call spawnfd() instead.
posix_spawnattr_t attr;
posix_spawnattr_init(&attr);
# ifdef Q_OS_QNX
posix_spawnattr_setxflags(&attr, POSIX_SPAWN_SETSIGDEF | POSIX_SPAWN_SETPGROUP
| (spawn_detached * POSIX_SPAWN_NOZOMBIE));
# else
posix_spawnattr_setflags(&attr, POSIX_SPAWN_SETSIGDEF | POSIX_SPAWN_SETPGROUP);
# endif
posix_spawnattr_setpgroup(&attr, 0);
sigset_t sigdefault;
sigemptyset(&sigdefault);
sigaddset(&sigdefault, SIGPIPE); // reset the signal that we ignored
posix_spawnattr_setsigdefault(&attr, &sigdefault);
// enter the working directory
const char *oldWorkingDir = 0;
char buff[PATH_MAX + 1];
if (workingDir) {
# ifdef Q_OS_QNX
//we need to freeze everyone in order to avoid race conditions with //chdir().
if (ThreadCtl(_NTO_TCTL_THREADS_HOLD, 0) == -1)
qWarning("ThreadCtl(): cannot hold threads: %s", qPrintable(qt_error_string(errno)));
# endif
oldWorkingDir = QT_GETCWD(buff, PATH_MAX + 1);
if (QT_CHDIR(workingDir) == -1)
qWarning("ThreadCtl(): failed to chdir to %s", workingDir);
}
int fd;
if (spawn_detached) {
fd = ::posix_spawn(ppid, argv[0], file_actions, &attr, argv, envp);
if (fd == -1) {
fd = ::posix_spawnp(ppid, argv[0], file_actions, &attr, argv, envp);
}
} else {
// use spawnfd
fd = ::spawnfd(FFD_CLOEXEC | FFD_NONBLOCK, ppid, argv[0], file_actions, &attr, argv, envp);
if (fd == -1) {
fd = ::spawnfd(FFD_CLOEXEC | FFD_NONBLOCK | FFD_SPAWN_SEARCH_PATH, ppid, argv[0], file_actions,
&attr, argv, envp);
}
}
if (oldWorkingDir) {
if (QT_CHDIR(oldWorkingDir) == -1)
qWarning("ThreadCtl(): failed to chdir to %s", oldWorkingDir);
# ifdef Q_OS_QNX
if (Q_UNLIKELY(ThreadCtl(_NTO_TCTL_THREADS_CONT, 0) == -1))
qFatal("ThreadCtl(): cannot resume threads: %s", qPrintable(qt_error_string(errno)));
# endif
}
posix_spawnattr_destroy(&attr);
return fd;
}
pid_t QProcessPrivate::spawnChild(pid_t *ppid, const char *workingDir, char **argv, char **envp)
{
// posix_spawn causes all file descriptors with FD_CLOEXEC to be closed automatically;
// we only need to add the actions for our own pipes
posix_spawn_file_actions_t file_actions;
posix_spawn_file_actions_init(&file_actions);
# ifdef Q_OS_QNX
static const bool OS_QNX = true;
# else
static const bool OS_QNX = false;
#endif
int fdmax = -1;
if (processChannelMode == QProcess::MergedChannels) {
// managed stderr == stdout
posix_spawn_file_actions_adddup2(&file_actions, stdoutChannel.pipe[1], STDERR_FILENO);
if (OS_QNX)
fdmax = qMax(fdmax, stdoutChannel.pipe[1]);
} else if (processChannelMode != QProcess::ForwardedChannels && processChannelMode != QProcess::ForwardedErrorChannel) {
// managed stderr
posix_spawn_file_actions_adddup2(&file_actions, stderrChannel.pipe[1], STDERR_FILENO);
if (OS_QNX)
fdmax = qMax(fdmax, stderrChannel.pipe[1]);
else
posix_spawn_file_actions_addclose(&file_actions, stderrChannel.pipe[1]);
}
if (processChannelMode != QProcess::ForwardedChannels && processChannelMode != QProcess::ForwardedOutputChannel) {
// managed stdout
posix_spawn_file_actions_adddup2(&file_actions, stdoutChannel.pipe[1], STDOUT_FILENO);
if (OS_QNX)
fdmax = qMax(fdmax, stdoutChannel.pipe[1]);
else
posix_spawn_file_actions_addclose(&file_actions, stdoutChannel.pipe[1]);
}
if (inputChannelMode == QProcess::ManagedInputChannel) {
posix_spawn_file_actions_adddup2(&file_actions, stdinChannel.pipe[0], STDIN_FILENO);
if (OS_QNX)
fdmax = qMax(fdmax, stdinChannel.pipe[0]);
else
posix_spawn_file_actions_addclose(&file_actions, stdinChannel.pipe[0]);
}
// Workaround: QNX's spawn implementation will actually dup all FD values
// LESS than fdmax - regardless of the FD_CLOEEXEC flag. So we need to add
// those to the list of files to close, otherwise dup will fail when some
// other thread closes the FD.
for (int i = 3; i <= fdmax; i++) {
if (::fcntl(i, F_GETFD) & FD_CLOEXEC)
posix_spawn_file_actions_addclose(&file_actions, i);
}
int retval = doSpawn(ppid, &file_actions, argv, envp, workingDir, false);
if (retval == -1) {
QString error = qt_error_string(errno);
qt_safe_write(childStartedPipe[1], error.data(), error.length() * sizeof(QChar));
qt_safe_close(childStartedPipe[1]);
childStartedPipe[1] = -1;
}
posix_spawn_file_actions_destroy(&file_actions);
return retval;
}
#else
void QProcessPrivate::execChild(const char *workingDir, char **path, char **argv, char **envp)
{
::signal(SIGPIPE, SIG_DFL); // reset the signal that we ignored
@ -770,7 +621,6 @@ report_errno:
qt_safe_close(childStartedPipe[1]);
childStartedPipe[1] = -1;
}
#endif
bool QProcessPrivate::processStarted(QString *errorMessage)
{
@ -1064,40 +914,6 @@ bool QProcessPrivate::waitForDeadChild()
return true;
}
#if defined(QPROCESS_USE_SPAWN)
bool QProcessPrivate::startDetached(const QString &program, const QStringList &arguments, const QString &workingDirectory, qint64 *pid)
{
QList<QByteArray> enc_args;
enc_args.append(QFile::encodeName(program));
for (int i = 0; i < arguments.size(); ++i)
enc_args.append(arguments.at(i).toLocal8Bit());
const int argc = enc_args.size();
QScopedArrayPointer<char*> raw_argv(new char*[argc + 1]);
for (int i = 0; i < argc; ++i)
raw_argv[i] = const_cast<char *>(enc_args.at(i).data());
raw_argv[argc] = 0;
char **envp = 0; // inherit environment
// Encode the working directory if it's non-empty, otherwise just pass 0.
const char *workingDirPtr = 0;
QByteArray encodedWorkingDirectory;
if (!workingDirectory.isEmpty()) {
encodedWorkingDirectory = QFile::encodeName(workingDirectory);
workingDirPtr = encodedWorkingDirectory.constData();
}
pid_t childPid;
int retval = doSpawn(&childPid, NULL, raw_argv.data(), envp, workingDirPtr, true);
if (pid && retval != -1)
*pid = childPid;
return retval != -1;
}
#else
bool QProcessPrivate::startDetached(const QString &program, const QStringList &arguments, const QString &workingDirectory, qint64 *pid)
{
QByteArray encodedWorkingDirectory = QFile::encodeName(workingDirectory);
@ -1212,7 +1028,6 @@ bool QProcessPrivate::startDetached(const QString &program, const QStringList &a
qt_safe_close(pidPipe[0]);
return success;
}
#endif
QT_END_NAMESPACE

View File

@ -97,7 +97,7 @@ void QShapedPixmapWindow::updateGeometry(const QPoint &pos)
{
QSize size(1, 1);
if (!m_pixmap.isNull()) {
size = qFuzzyCompare(m_pixmap.devicePixelRatio(), 1.0)
size = qFuzzyCompare(m_pixmap.devicePixelRatio(), qreal(1.0))
? m_pixmap.size()
: (QSizeF(m_pixmap.size()) / m_pixmap.devicePixelRatio()).toSize();
}

View File

@ -187,7 +187,11 @@ typedef ptrdiff_t GLsizeiptrARB;
#ifndef GL_ARB_shader_objects
/* GL types for program/shader text and shader object handles */
typedef char GLcharARB;
# ifdef Q_OS_DARWIN
typedef void *GLhandleARB;
# else
typedef unsigned int GLhandleARB;
# endif // Q_OS_DARWIN
#endif
/* GL type for "half" precision (s10e5) float data in host memory */

View File

@ -45,6 +45,7 @@
#include "androidjniinput.h"
#include "qandroideventdispatcher.h"
#include "androiddeadlockprotector.h"
#include "qandroidplatformintegration.h"
#include <QDebug>
#include <qevent.h>
#include <qguiapplication.h>
@ -53,6 +54,7 @@
#include <qinputmethod.h>
#include <qwindow.h>
#include <QtCore/private/qjni_p.h>
#include <private/qhighdpiscaling_p.h>
#include <QTextCharFormat>
@ -547,10 +549,13 @@ void QAndroidInputContext::showInputPanel()
if (window)
rect = QRect(window->mapToGlobal(rect.topLeft()), rect.size());
QtAndroidInput::showSoftwareKeyboard(rect.left(),
rect.top(),
rect.width(),
rect.height(),
double pixelDensity = window ? QHighDpiScaling::factor(window)
: QHighDpiScaling::factor(QtAndroid::androidPlatformIntegration()->screen());
QtAndroidInput::showSoftwareKeyboard(rect.left() * pixelDensity,
rect.top() * pixelDensity,
rect.width() * pixelDensity,
rect.height() * pixelDensity,
query->value(Qt::ImHints).toUInt(),
query->value(Qt::ImEnterKeyType).toUInt()
);

View File

@ -49,7 +49,7 @@ QT_BEGIN_NAMESPACE
class QCocoaMenuBar;
class QCocoaMenu : public QPlatformMenu
class QCocoaMenu : public QPlatformMenu, public QCocoaMenuObject
{
public:
QCocoaMenu();

View File

@ -271,8 +271,8 @@ QCocoaMenu::QCocoaMenu() :
QCocoaMenu::~QCocoaMenu()
{
foreach (QCocoaMenuItem *item, m_menuItems) {
if (COCOA_MENU_ANCESTOR(item) == this)
SET_COCOA_MENU_ANCESTOR(item, 0);
if (item->menuParent() == this)
item->setMenuParent(0);
}
QMacAutoReleasePool pool;
@ -350,7 +350,7 @@ void QCocoaMenu::insertNative(QCocoaMenuItem *item, QCocoaMenuItem *beforeItem)
} else {
[m_nativeMenu addItem: item->nsItem()];
}
SET_COCOA_MENU_ANCESTOR(item, this);
item->setMenuParent(this);
}
void QCocoaMenu::removeMenuItem(QPlatformMenuItem *menuItem)
@ -362,8 +362,8 @@ void QCocoaMenu::removeMenuItem(QPlatformMenuItem *menuItem)
return;
}
if (COCOA_MENU_ANCESTOR(menuItem) == this)
SET_COCOA_MENU_ANCESTOR(menuItem, 0);
if (cocoaItem->menuParent() == this)
cocoaItem->setMenuParent(0);
m_menuItems.removeOne(cocoaItem);
if (!cocoaItem->isMerged()) {

View File

@ -320,7 +320,7 @@ void QCocoaMenuBar::updateMenuBarImmediately()
continue;
NSMenuItem *item = mb->nativeItemForMenu(menu);
menu->setAttachedItem(item);
SET_COCOA_MENU_ANCESTOR(menu, mb);
menu->setMenuParent(mb);
// force a sync?
mb->syncMenu(menu);
menu->syncModalState(disableForModal);

View File

@ -55,7 +55,24 @@ QT_BEGIN_NAMESPACE
class QCocoaMenu;
class QCocoaMenuItem : public QPlatformMenuItem
class QCocoaMenuObject
{
public:
void setMenuParent(QObject *o)
{
parent = o;
}
QObject *menuParent() const
{
return parent;
}
private:
QPointer<QObject> parent;
};
class QCocoaMenuItem : public QPlatformMenuItem, public QCocoaMenuObject
{
public:
QCocoaMenuItem();
@ -118,9 +135,6 @@ private:
int m_iconSize;
};
#define COCOA_MENU_ANCESTOR(m) ((m)->property("_qCocoaMenuAncestor").value<QObject *>())
#define SET_COCOA_MENU_ANCESTOR(m, ancestor) (m)->setProperty("_qCocoaMenuAncestor", QVariant::fromValue<QObject *>(ancestor))
QT_END_NAMESPACE
#endif

View File

@ -113,8 +113,8 @@ QCocoaMenuItem::~QCocoaMenuItem()
{
QMacAutoReleasePool pool;
if (m_menu && COCOA_MENU_ANCESTOR(m_menu) == this)
SET_COCOA_MENU_ANCESTOR(m_menu, 0);
if (m_menu && m_menu->menuParent() == this)
m_menu->setMenuParent(0);
if (m_merged) {
[m_native setHidden:YES];
} else {
@ -140,14 +140,14 @@ void QCocoaMenuItem::setMenu(QPlatformMenu *menu)
return;
if (m_menu) {
if (COCOA_MENU_ANCESTOR(m_menu) == this)
SET_COCOA_MENU_ANCESTOR(m_menu, 0);
if (m_menu->menuParent() == this)
m_menu->setMenuParent(0);
}
QMacAutoReleasePool pool;
m_menu = static_cast<QCocoaMenu *>(menu);
if (m_menu) {
SET_COCOA_MENU_ANCESTOR(m_menu, this);
m_menu->setMenuParent(this);
} else {
// we previously had a menu, but no longer
// clear out our item so the nexy sync() call builds a new one
@ -237,12 +237,14 @@ NSMenuItem *QCocoaMenuItem::sync()
mergeItem = [loader preferencesMenuItem];
break;
case TextHeuristicRole: {
QObject *p = COCOA_MENU_ANCESTOR(this);
QObject *p = menuParent();
int depth = 1;
QCocoaMenuBar *menubar = 0;
while (depth < 3 && p && !(menubar = qobject_cast<QCocoaMenuBar *>(p))) {
++depth;
p = COCOA_MENU_ANCESTOR(p);
QCocoaMenuObject *menuObject = dynamic_cast<QCocoaMenuObject *>(p);
Q_ASSERT(menuObject);
p = menuObject->menuParent();
}
if (depth == 3 || !menubar)
break; // Menu item too deep in the hierarchy, or not connected to any menubar

View File

@ -1250,11 +1250,14 @@ void QWidgetPrivate::createRecursively()
}
// ### fixme: Qt 6: Remove parameter window from QWidget::create()
/*!
Creates a new widget window if \a window is 0, otherwise sets the
widget's window to \a window.
Creates a new widget window.
The parameter \a window is ignored in Qt 5. Please use
QWindow::fromWinId() to create a QWindow wrapping a foreign
window and pass it to QWidget::createWindowContainer() instead.
Initializes the window (sets the geometry etc.) if \a
initializeWindow is true. If \a initializeWindow is false, no
@ -1267,11 +1270,15 @@ void QWidgetPrivate::createRecursively()
The QWidget constructor calls create(0,true,true) to create a
window for this widget.
\sa createWindowContainer(), QWindow::fromWinId()
*/
void QWidget::create(WId window, bool initializeWindow, bool destroyOldWindow)
{
Q_D(QWidget);
if (Q_UNLIKELY(window))
qWarning("QWidget::create(): Parameter 'window' does not have any effect.");
if (testAttribute(Qt::WA_WState_Created) && window == 0 && internalWinId())
return;
@ -1295,7 +1302,7 @@ void QWidget::create(WId window, bool initializeWindow, bool destroyOldWindow)
// We're about to create a native child widget that doesn't have a native parent;
// enforce a native handle for the parent unless the Qt::WA_DontCreateNativeAncestors
// attribute is set.
d->createWinId(window);
d->createWinId();
// Nothing more to do.
Q_ASSERT(testAttribute(Qt::WA_WState_Created));
Q_ASSERT(internalWinId());
@ -2535,13 +2542,12 @@ WId QWidget::winId() const
return data->winid;
}
void QWidgetPrivate::createWinId(WId winid)
void QWidgetPrivate::createWinId()
{
Q_Q(QWidget);
#ifdef ALIEN_DEBUG
qDebug() << "QWidgetPrivate::createWinId for" << q << winid;
qDebug() << "QWidgetPrivate::createWinId for" << q;
#endif
const bool forceNativeWindow = q->testAttribute(Qt::WA_NativeWindow);
if (!q->testAttribute(Qt::WA_WState_Created) || (forceNativeWindow && !q->internalWinId())) {
@ -2558,15 +2564,7 @@ void QWidgetPrivate::createWinId(WId winid)
QWidget *w = qobject_cast<QWidget *>(pd->children.at(i));
if (w && !w->isWindow() && (!w->testAttribute(Qt::WA_WState_Created)
|| (!w->internalWinId() && w->testAttribute(Qt::WA_NativeWindow)))) {
if (w!=q) {
w->create();
} else {
w->create(winid);
// if the window has already been created, we
// need to raise it to its proper stacking position
if (winid)
w->raise();
}
w->create();
}
}
} else {

View File

@ -339,7 +339,7 @@ public:
void init(QWidget *desktopWidget, Qt::WindowFlags f);
void create_sys(WId window, bool initializeWindow, bool destroyOldWindow);
void createRecursively();
void createWinId(WId id = 0);
void createWinId();
void createTLExtra();
void createExtra();

Binary file not shown.

After

Width:  |  Height:  |  Size: 410 B

View File

@ -5237,6 +5237,30 @@ static QPixmap cachedPixmapFromXPM(const char * const *xpm)
return result;
}
static QIcon clearTextIcon(bool rtl)
{
const QString directionalThemeName = rtl
? QStringLiteral("edit-clear-locationbar-ltr") : QStringLiteral("edit-clear-locationbar-rtl");
if (QIcon::hasThemeIcon(directionalThemeName))
return QIcon::fromTheme(directionalThemeName);
const QString themeName = QStringLiteral("edit-clear");
if (QIcon::hasThemeIcon(themeName))
return QIcon::fromTheme(themeName);
QIcon icon;
#ifndef QT_NO_IMAGEFORMAT_PNG
QPixmap clearText16(QStringLiteral(":/qt-project.org/styles/commonstyle/images/cleartext-16.png"));
Q_ASSERT(!clearText16.size().isEmpty());
icon.addPixmap(clearText16);
QPixmap clearText32(QStringLiteral(":/qt-project.org/styles/commonstyle/images/cleartext-32.png"));
Q_ASSERT(!clearText32.size().isEmpty());
icon.addPixmap(clearText32);
clearText32.setDevicePixelRatio(2); // The 32x32 pixmap can also be used for 16x16/devicePixelRatio=2
icon.addPixmap(clearText32);
#endif // !QT_NO_IMAGEFORMAT_PNG
return icon;
}
/*! \reimp */
QPixmap QCommonStyle::standardPixmap(StandardPixmap sp, const QStyleOption *option,
const QWidget *widget) const
@ -5409,12 +5433,8 @@ QPixmap QCommonStyle::standardPixmap(StandardPixmap sp, const QStyleOption *opti
}
}
break;
case SP_LineEditClearButton: {
QString themeName = rtl ? QStringLiteral("edit-clear-locationbar-ltr") : QStringLiteral("edit-clear-locationbar-rtl");
if (!QIcon::hasThemeIcon(themeName))
themeName = QStringLiteral("edit-clear");
pixmap = QIcon::fromTheme(themeName).pixmap(16);
}
case SP_LineEditClearButton:
pixmap = clearTextIcon(rtl).pixmap(16);
break;
default:
break;
@ -5544,8 +5564,6 @@ QPixmap QCommonStyle::standardPixmap(StandardPixmap sp, const QStyleOption *opti
return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-volume-16.png"));
case SP_MediaVolumeMuted:
return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-volume-muted-16.png"));
case SP_LineEditClearButton:
return QPixmap(QStringLiteral(":/qt-project.org/styles/commonstyle/images/cleartext-16.png"));
#endif // QT_NO_IMAGEFORMAT_PNG
default:
break;
@ -5595,6 +5613,8 @@ QIcon QCommonStyle::standardIcon(StandardPixmap standardIcon, const QStyleOption
const QWidget *widget) const
{
QIcon icon;
const bool rtl = (option && option->direction == Qt::RightToLeft) || (!option && QApplication::isRightToLeft());
#ifdef Q_OS_WIN
switch (standardIcon) {
case SP_DriveCDIcon:
@ -5634,6 +5654,9 @@ QIcon QCommonStyle::standardIcon(StandardPixmap standardIcon, const QStyleOption
}
}
break;
case SP_LineEditClearButton:
icon = clearTextIcon(rtl);
break;
default:
break;
}
@ -5642,7 +5665,6 @@ QIcon QCommonStyle::standardIcon(StandardPixmap standardIcon, const QStyleOption
#endif
const bool rtl = (option && option->direction == Qt::RightToLeft) || (!option && QApplication::isRightToLeft());
if (QApplication::desktopSettingsAware() && !QIcon::themeName().isEmpty()) {
switch (standardIcon) {
case SP_DirHomeIcon:

View File

@ -1,6 +1,7 @@
<RCC>
<qresource prefix="/qt-project.org/styles/commonstyle">
<file>images/cleartext-16.png</file>
<file>images/cleartext-32.png</file>
<file>images/filelink-16.png</file>
<file>images/filelink-32.png</file>
<file>images/filelink-128.png</file>

View File

@ -67,7 +67,6 @@ public:
QList<QAbstractButton *> buttonList;
QPointer<QAbstractButton> checkedButton;
void detectCheckedButton();
void notifyChecked(QAbstractButton *button);
bool exclusive;
QHash<QAbstractButton*, int> mapping;

View File

@ -323,14 +323,17 @@ QLineEditIconButton::QLineEditIconButton(QWidget *parent)
void QLineEditIconButton::paintEvent(QPaintEvent *)
{
QPainter painter(this);
QWindow *window = Q_NULLPTR;
if (const QWidget *nativeParent = nativeParentWidget())
window = nativeParent->windowHandle();
// Note isDown should really use the active state but in most styles
// this has no proper feedback
QIcon::Mode state = QIcon::Disabled;
if (isEnabled())
state = isDown() ? QIcon::Selected : QIcon::Normal;
const QPixmap iconPixmap = icon().pixmap(QSize(IconButtonSize, IconButtonSize),
state, QIcon::Off);
QRect pixmapRect = QRect(QPoint(0, 0), iconPixmap.size() / iconPixmap.devicePixelRatio());
const QSize iconSize(IconButtonSize, IconButtonSize);
const QPixmap iconPixmap = icon().pixmap(window, iconSize, state, QIcon::Off);
QRect pixmapRect = QRect(QPoint(0, 0), iconSize);
pixmapRect.moveCenter(rect().center());
painter.setOpacity(m_opacity);
painter.drawPixmap(pixmapRect, iconPixmap);
@ -422,7 +425,7 @@ QIcon QLineEditPrivate::clearButtonIcon() const
Q_Q(const QLineEdit);
QStyleOptionFrame styleOption;
q->initStyleOption(&styleOption);
return QIcon(q->style()->standardPixmap(QStyle::SP_LineEditClearButton, &styleOption, q));
return q->style()->standardIcon(QStyle::SP_LineEditClearButton, &styleOption, q);
}
void QLineEditPrivate::setClearButtonEnabled(bool enabled)

View File

@ -40,8 +40,6 @@
#include <QtNetwork/QHostInfo>
#include <stdlib.h>
# include <private/qprocess_p.h> // only so we get QPROCESS_USE_SPAWN
typedef void (QProcess::*QProcessFinishedSignal1)(int);
typedef void (QProcess::*QProcessFinishedSignal2)(int, QProcess::ExitStatus);
typedef void (QProcess::*QProcessErrorSignal)(QProcess::ProcessError);
@ -321,9 +319,6 @@ void tst_QProcess::startDetached()
{
QVERIFY(QProcess::startDetached("testProcessNormal/testProcessNormal",
QStringList() << "arg1" << "arg2"));
#ifdef QPROCESS_USE_SPAWN
QEXPECT_FAIL("", "QProcess cannot detect failure to start when using posix_spawn()", Continue);
#endif
QCOMPARE(QProcess::startDetached("nonexistingexe"), false);
}
@ -706,9 +701,6 @@ void tst_QProcess::waitForFinished()
QCOMPARE(output.count("\n"), 10*1024);
process.start("blurdybloop");
#if defined(QPROCESS_USE_SPAWN) && !defined(Q_OS_QNX)
QEXPECT_FAIL("", "QProcess cannot detect failure to start when using posix_spawn()", Abort);
#endif
QVERIFY(!process.waitForFinished());
QCOMPARE(process.error(), QProcess::FailedToStart);
}
@ -921,6 +913,16 @@ void tst_QProcess::hardExit()
#endif
QVERIFY2(proc.waitForStarted(), qPrintable(proc.errorString()));
#if defined(Q_OS_QNX)
// QNX may lose the kill if it's delivered while the forked process
// is doing the exec that morphs it into testProcessEcho. It's very
// unlikely that a normal application would do such a thing. Make
// sure the test doesn't accidentally try to do it.
proc.write("A");
QVERIFY(proc.waitForReadyRead(5000));
#endif
proc.kill();
QVERIFY(proc.waitForFinished(5000));
@ -1524,11 +1526,6 @@ void tst_QProcess::createProcessArgumentsModifier()
void tst_QProcess::exitCodeTest()
{
for (int i = 0; i < 255; ++i) {
#ifdef QPROCESS_USE_SPAWN
// POSIX reserves exit code 127 when using posix_spawn
if (i == 127)
continue;
#endif
QProcess process;
process.start("testExitCodes/testExitCodes " + QString::number(i));
QVERIFY(process.waitForFinished(5000));
@ -1539,9 +1536,6 @@ void tst_QProcess::exitCodeTest()
void tst_QProcess::failToStart()
{
#if defined(QPROCESS_USE_SPAWN) && !defined(Q_OS_QNX)
QSKIP("QProcess cannot detect failure to start when using posix_spawn()");
#endif
qRegisterMetaType<QProcess::ProcessError>("QProcess::ProcessError");
qRegisterMetaType<QProcess::ExitStatus>("QProcess::ExitStatus");
qRegisterMetaType<QProcess::ProcessState>("QProcess::ProcessState");
@ -1612,9 +1606,6 @@ void tst_QProcess::failToStart()
void tst_QProcess::failToStartWithWait()
{
#if defined(QPROCESS_USE_SPAWN) && !defined(Q_OS_QNX)
QSKIP("QProcess cannot detect failure to start when using posix_spawn()");
#endif
qRegisterMetaType<QProcess::ProcessError>("QProcess::ProcessError");
qRegisterMetaType<QProcess::ExitStatus>("QProcess::ExitStatus");
@ -1644,9 +1635,6 @@ void tst_QProcess::failToStartWithWait()
void tst_QProcess::failToStartWithEventLoop()
{
#if defined(QPROCESS_USE_SPAWN) && !defined(Q_OS_QNX)
QSKIP("QProcess cannot detect failure to start when using posix_spawn()");
#endif
qRegisterMetaType<QProcess::ProcessError>("QProcess::ProcessError");
qRegisterMetaType<QProcess::ExitStatus>("QProcess::ExitStatus");
@ -1933,9 +1921,6 @@ void tst_QProcess::waitForReadyReadForNonexistantProcess()
QVERIFY(!process.waitForReadyRead()); // used to crash
process.start("doesntexist");
QVERIFY(!process.waitForReadyRead());
#if defined(QPROCESS_USE_SPAWN) && !defined(Q_OS_QNX)
QEXPECT_FAIL("", "QProcess cannot detect failure to start when using posix_spawn()", Abort);
#endif
QCOMPARE(errorSpy.count(), 1);
QCOMPARE(errorSpy.at(0).at(0).toInt(), 0);
QCOMPARE(errorSpy2.count(), 1);
@ -2303,9 +2288,6 @@ void tst_QProcess::setNonExistentWorkingDirectory()
// while on Unix with fork it's relative to the child's (with posix_spawn, it could be either).
process.start(QFileInfo("testSetWorkingDirectory/testSetWorkingDirectory").absoluteFilePath());
QVERIFY(!process.waitForFinished());
#ifdef QPROCESS_USE_SPAWN
QEXPECT_FAIL("", "QProcess cannot detect failure to start when using posix_spawn()", Continue);
#endif
QCOMPARE(int(process.error()), int(QProcess::FailedToStart));
#ifdef Q_OS_UNIX

View File

@ -41,6 +41,8 @@
#include <qboxlayout.h>
#include <qtabwidget.h>
#include <qlabel.h>
#include <qmainwindow.h>
#include <qtoolbar.h>
#include <private/qwindow_p.h>
static inline void setFrameless(QWidget *w)
@ -94,6 +96,8 @@ private slots:
void tst_move_count();
void tst_eventfilter_on_toplevel();
void QTBUG_50561_QCocoaBackingStore_paintDevice_crash();
};
void tst_QWidget_window::initTestCase()
@ -790,5 +794,46 @@ void tst_QWidget_window::tst_eventfilter_on_toplevel()
QTRY_COMPARE(filter.eventCount, 1);
}
class ApplicationStateSaver
{
public:
ApplicationStateSaver()
{
QApplication::setAttribute(Qt::AA_NativeWindows, true);
QApplication::setQuitOnLastWindowClosed(false);
}
~ApplicationStateSaver()
{
QApplication::setAttribute(Qt::AA_NativeWindows, false);
QApplication::setQuitOnLastWindowClosed(true);
}
};
void tst_QWidget_window::QTBUG_50561_QCocoaBackingStore_paintDevice_crash()
{
// Keep application state clean if testcase fails
ApplicationStateSaver as;
QMainWindow w;
w.addToolBar(new QToolBar(&w));
w.show();
QTest::qWaitForWindowExposed(&w);
// Simulate window system close
QCloseEvent *e = new QCloseEvent;
e->accept();
qApp->postEvent(w.windowHandle(), e);
qApp->processEvents();
// Show again
w.show();
qApp->processEvents();
// No crash, all good.
// Wrap up and leave
w.close();
}
QTEST_MAIN(tst_QWidget_window)
#include "tst_qwidget_window.moc"

View File

@ -221,7 +221,7 @@ Configure::Configure(int& argc, char** argv) : verbose(0)
dictionary[ "BUILD" ] = "debug";
dictionary[ "BUILDALL" ] = "auto"; // Means yes, but not explicitly
dictionary[ "FORCEDEBUGINFO" ] = "no";
dictionary[ "OPTIMIZED_TOOLS" ] = "no";
dictionary[ "RELEASE_TOOLS" ] = "no";
dictionary[ "BUILDTYPE" ] = "none";
@ -3494,6 +3494,11 @@ void Configure::generateQConfigPri()
<< "QT_GCC_PATCH_VERSION = " << dictionary["QT_GCC_PATCH_VERSION"] << endl;
}
if (dictionary.value("XQMAKESPEC").startsWith("wince")) {
configStream << "#Qt for Windows CE c-runtime deployment" << endl
<< "QT_CE_C_RUNTIME = " << formatPath(dictionary["CE_CRT"]) << endl;
}
if (!configStream.flush())
dictionary[ "DONE" ] = "error";
}