summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/corelib/global/qlogging.cpp6
-rw-r--r--src/corelib/io/forkfd_qt.cpp6
-rw-r--r--src/corelib/io/qprocess.cpp11
-rw-r--r--src/corelib/io/qprocess_p.h7
-rw-r--r--src/corelib/io/qprocess_unix.cpp185
-rw-r--r--src/gui/kernel/qshapedpixmapdndwindow.cpp2
-rw-r--r--src/gui/opengl/qopengl.h4
-rw-r--r--src/plugins/platforms/android/qandroidinputcontext.cpp13
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenu.h2
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenu.mm10
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenubar.mm2
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenuitem.h22
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenuitem.mm16
-rw-r--r--src/widgets/kernel/qwidget.cpp30
-rw-r--r--src/widgets/kernel/qwidget_p.h2
-rw-r--r--src/widgets/styles/images/cleartext-32.pngbin0 -> 410 bytes
-rw-r--r--src/widgets/styles/qcommonstyle.cpp40
-rw-r--r--src/widgets/styles/qstyle.qrc1
-rw-r--r--src/widgets/widgets/qbuttongroup_p.h1
-rw-r--r--src/widgets/widgets/qlineedit_p.cpp11
20 files changed, 108 insertions, 263 deletions
diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp
index 86aa9b9e7a..8cd1190e32 100644
--- a/src/corelib/global/qlogging.cpp
+++ b/src/corelib/global/qlogging.cpp
@@ -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)
diff --git a/src/corelib/io/forkfd_qt.cpp b/src/corelib/io/forkfd_qt.cpp
index 9bb102e18f..141efeb08c 100644
--- a/src/corelib/io/forkfd_qt.cpp
+++ b/src/corelib/io/forkfd_qt.cpp
@@ -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
diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp
index e9c2cabc66..6f11d0892f 100644
--- a/src/corelib/io/qprocess.cpp
+++ b/src/corelib/io/qprocess.cpp
@@ -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);
diff --git a/src/corelib/io/qprocess_p.h b/src/corelib/io/qprocess_p.h
index 043a44df81..1f88c3a043 100644
--- a/src/corelib/io/qprocess_p.h
+++ b/src/corelib/io/qprocess_p.h
@@ -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();
diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp
index f9d14c8e5a..93807e13eb 100644
--- a/src/corelib/io/qprocess_unix.cpp
+++ b/src/corelib/io/qprocess_unix.cpp
@@ -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
diff --git a/src/gui/kernel/qshapedpixmapdndwindow.cpp b/src/gui/kernel/qshapedpixmapdndwindow.cpp
index 40bf15b807..b54c6b67a2 100644
--- a/src/gui/kernel/qshapedpixmapdndwindow.cpp
+++ b/src/gui/kernel/qshapedpixmapdndwindow.cpp
@@ -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();
}
diff --git a/src/gui/opengl/qopengl.h b/src/gui/opengl/qopengl.h
index 5543ac4a16..745adda969 100644
--- a/src/gui/opengl/qopengl.h
+++ b/src/gui/opengl/qopengl.h
@@ -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 */
diff --git a/src/plugins/platforms/android/qandroidinputcontext.cpp b/src/plugins/platforms/android/qandroidinputcontext.cpp
index eb9e95508c..dc420775cf 100644
--- a/src/plugins/platforms/android/qandroidinputcontext.cpp
+++ b/src/plugins/platforms/android/qandroidinputcontext.cpp
@@ -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()
);
diff --git a/src/plugins/platforms/cocoa/qcocoamenu.h b/src/plugins/platforms/cocoa/qcocoamenu.h
index 64eeabcc2d..7951a2ff70 100644
--- a/src/plugins/platforms/cocoa/qcocoamenu.h
+++ b/src/plugins/platforms/cocoa/qcocoamenu.h
@@ -49,7 +49,7 @@ QT_BEGIN_NAMESPACE
class QCocoaMenuBar;
-class QCocoaMenu : public QPlatformMenu
+class QCocoaMenu : public QPlatformMenu, public QCocoaMenuObject
{
public:
QCocoaMenu();
diff --git a/src/plugins/platforms/cocoa/qcocoamenu.mm b/src/plugins/platforms/cocoa/qcocoamenu.mm
index 3fc98c071f..0690a8e0fa 100644
--- a/src/plugins/platforms/cocoa/qcocoamenu.mm
+++ b/src/plugins/platforms/cocoa/qcocoamenu.mm
@@ -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()) {
diff --git a/src/plugins/platforms/cocoa/qcocoamenubar.mm b/src/plugins/platforms/cocoa/qcocoamenubar.mm
index e8b3823012..a445b6e9bf 100644
--- a/src/plugins/platforms/cocoa/qcocoamenubar.mm
+++ b/src/plugins/platforms/cocoa/qcocoamenubar.mm
@@ -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);
diff --git a/src/plugins/platforms/cocoa/qcocoamenuitem.h b/src/plugins/platforms/cocoa/qcocoamenuitem.h
index bba9ce3963..aafc66e06f 100644
--- a/src/plugins/platforms/cocoa/qcocoamenuitem.h
+++ b/src/plugins/platforms/cocoa/qcocoamenuitem.h
@@ -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
diff --git a/src/plugins/platforms/cocoa/qcocoamenuitem.mm b/src/plugins/platforms/cocoa/qcocoamenuitem.mm
index de0271ce4d..fa54c1e90e 100644
--- a/src/plugins/platforms/cocoa/qcocoamenuitem.mm
+++ b/src/plugins/platforms/cocoa/qcocoamenuitem.mm
@@ -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
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index 027bf63a2e..281567cede 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -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 {
diff --git a/src/widgets/kernel/qwidget_p.h b/src/widgets/kernel/qwidget_p.h
index 91af7a4cb0..838236536a 100644
--- a/src/widgets/kernel/qwidget_p.h
+++ b/src/widgets/kernel/qwidget_p.h
@@ -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();
diff --git a/src/widgets/styles/images/cleartext-32.png b/src/widgets/styles/images/cleartext-32.png
new file mode 100644
index 0000000000..ff5a2b5ec1
--- /dev/null
+++ b/src/widgets/styles/images/cleartext-32.png
Binary files differ
diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp
index c26da68ac9..5ac2293751 100644
--- a/src/widgets/styles/qcommonstyle.cpp
+++ b/src/widgets/styles/qcommonstyle.cpp
@@ -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:
diff --git a/src/widgets/styles/qstyle.qrc b/src/widgets/styles/qstyle.qrc
index c063ec5036..d8c73dd6fa 100644
--- a/src/widgets/styles/qstyle.qrc
+++ b/src/widgets/styles/qstyle.qrc
@@ -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>
diff --git a/src/widgets/widgets/qbuttongroup_p.h b/src/widgets/widgets/qbuttongroup_p.h
index 01c0367876..95a72eb4fd 100644
--- a/src/widgets/widgets/qbuttongroup_p.h
+++ b/src/widgets/widgets/qbuttongroup_p.h
@@ -67,7 +67,6 @@ public:
QList<QAbstractButton *> buttonList;
QPointer<QAbstractButton> checkedButton;
void detectCheckedButton();
- void notifyChecked(QAbstractButton *button);
bool exclusive;
QHash<QAbstractButton*, int> mapping;
diff --git a/src/widgets/widgets/qlineedit_p.cpp b/src/widgets/widgets/qlineedit_p.cpp
index b852b8991c..6ff40e9c50 100644
--- a/src/widgets/widgets/qlineedit_p.cpp
+++ b/src/widgets/widgets/qlineedit_p.cpp
@@ -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)