summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@theqtcompany.com>2015-12-03 10:43:54 +0000
committerThe Qt Project <gerrit-noreply@qt-project.org>2015-12-03 10:43:54 +0000
commit3b6aafe9a76cdf7260e03375a94034589af6d791 (patch)
treebef120cd2c8838e20af4b27db27d0f381302122c /src/widgets
parente85ba9c67fc90a5076a0c00335bd47f17a68d437 (diff)
parent72f5867f144cec8fc7848cbcc772683fe845652d (diff)
Merge "Merge remote-tracking branch 'origin/5.6' into dev" into refs/staging/dev
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/dialogs/qfiledialog.cpp2
-rw-r--r--src/widgets/dialogs/qfileinfogatherer.cpp6
-rw-r--r--src/widgets/dialogs/qfileinfogatherer_p.h4
-rw-r--r--src/widgets/dialogs/qfilesystemmodel.cpp112
-rw-r--r--src/widgets/dialogs/qfilesystemmodel.h6
-rw-r--r--src/widgets/dialogs/qfilesystemmodel_p.h3
-rw-r--r--src/widgets/itemviews/qtableview.cpp16
-rw-r--r--src/widgets/kernel/qapplication.cpp6
-rw-r--r--src/widgets/kernel/qwidget.cpp56
-rw-r--r--src/widgets/kernel/qwidgetbackingstore.cpp17
-rw-r--r--src/widgets/kernel/qwidgetwindow.cpp2
-rw-r--r--src/widgets/styles/qwindowsvistastyle.cpp4
-rw-r--r--src/widgets/styles/qwindowsxpstyle.cpp6
-rw-r--r--src/widgets/util/qscroller.cpp4
-rw-r--r--src/widgets/util/qsystemtrayicon_win.cpp2
-rw-r--r--src/widgets/widgets/qmenu.cpp2
-rw-r--r--src/widgets/widgets/qtoolbararealayout.cpp2
17 files changed, 111 insertions, 139 deletions
diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp
index 11067544c3..870780683a 100644
--- a/src/widgets/dialogs/qfiledialog.cpp
+++ b/src/widgets/dialogs/qfiledialog.cpp
@@ -1971,6 +1971,8 @@ void QFileDialog::setIconProvider(QFileIconProvider *provider)
QFileIconProvider *QFileDialog::iconProvider() const
{
Q_D(const QFileDialog);
+ if (!d->model)
+ return Q_NULLPTR;
return d->model->iconProvider();
}
diff --git a/src/widgets/dialogs/qfileinfogatherer.cpp b/src/widgets/dialogs/qfileinfogatherer.cpp
index 7329019a87..92d6b8f3be 100644
--- a/src/widgets/dialogs/qfileinfogatherer.cpp
+++ b/src/widgets/dialogs/qfileinfogatherer.cpp
@@ -287,7 +287,7 @@ void QFileInfoGatherer::getFileInfos(const QString &path, const QStringList &fil
}
for (int i = infoList.count() - 1; i >= 0; --i) {
QString driveName = translateDriveName(infoList.at(i));
- QList<QPair<QString,QFileInfo> > updatedFiles;
+ QVector<QPair<QString,QFileInfo> > updatedFiles;
updatedFiles.append(QPair<QString,QFileInfo>(driveName, infoList.at(i)));
emit updates(path, updatedFiles);
}
@@ -298,7 +298,7 @@ void QFileInfoGatherer::getFileInfos(const QString &path, const QStringList &fil
base.start();
QFileInfo fileInfo;
bool firstTime = true;
- QList<QPair<QString, QFileInfo> > updatedFiles;
+ QVector<QPair<QString, QFileInfo> > updatedFiles;
QStringList filesToCheck = files;
QString itPath = QDir::fromNativeSeparators(files.isEmpty() ? path : QLatin1String(""));
@@ -324,7 +324,7 @@ void QFileInfoGatherer::getFileInfos(const QString &path, const QStringList &fil
emit directoryLoaded(path);
}
-void QFileInfoGatherer::fetch(const QFileInfo &fileInfo, QElapsedTimer &base, bool &firstTime, QList<QPair<QString, QFileInfo> > &updatedFiles, const QString &path) {
+void QFileInfoGatherer::fetch(const QFileInfo &fileInfo, QElapsedTimer &base, bool &firstTime, QVector<QPair<QString, QFileInfo> > &updatedFiles, const QString &path) {
updatedFiles.append(QPair<QString, QFileInfo>(fileInfo.fileName(), fileInfo));
QElapsedTimer current;
current.start();
diff --git a/src/widgets/dialogs/qfileinfogatherer_p.h b/src/widgets/dialogs/qfileinfogatherer_p.h
index 6bd15b5388..03f87fdba5 100644
--- a/src/widgets/dialogs/qfileinfogatherer_p.h
+++ b/src/widgets/dialogs/qfileinfogatherer_p.h
@@ -149,7 +149,7 @@ class Q_AUTOTEST_EXPORT QFileInfoGatherer : public QThread
Q_OBJECT
Q_SIGNALS:
- void updates(const QString &directory, const QList<QPair<QString, QFileInfo> > &updates);
+ void updates(const QString &directory, const QVector<QPair<QString, QFileInfo> > &updates);
void newListOfFiles(const QString &directory, const QStringList &listOfFiles) const;
void nameResolved(const QString &fileName, const QString &resolvedName) const;
void directoryLoaded(const QString &path);
@@ -176,7 +176,7 @@ private:
void run() Q_DECL_OVERRIDE;
// called by run():
void getFileInfos(const QString &path, const QStringList &files);
- void fetch(const QFileInfo &info, QElapsedTimer &base, bool &firstTime, QList<QPair<QString, QFileInfo> > &updatedFiles, const QString &path);
+ void fetch(const QFileInfo &info, QElapsedTimer &base, bool &firstTime, QVector<QPair<QString, QFileInfo> > &updatedFiles, const QString &path);
private:
mutable QMutex mutex;
diff --git a/src/widgets/dialogs/qfilesystemmodel.cpp b/src/widgets/dialogs/qfilesystemmodel.cpp
index d0c3edcd69..3c154c3dbb 100644
--- a/src/widgets/dialogs/qfilesystemmodel.cpp
+++ b/src/widgets/dialogs/qfilesystemmodel.cpp
@@ -39,6 +39,7 @@
#include <qdebug.h>
#include <qmessagebox.h>
#include <qapplication.h>
+#include <QtCore/qcollator.h>
#include <algorithm>
@@ -154,6 +155,11 @@ QT_BEGIN_NAMESPACE
Returns the QFileInfo for the item stored in the model under the given
\a index.
*/
+QFileInfo QFileSystemModel::fileInfo(const QModelIndex &index) const
+{
+ Q_D(const QFileSystemModel);
+ return d->node(index)->fileInfo();
+}
/*!
\fn void QFileSystemModel::rootPathChanged(const QString &newPath);
@@ -989,84 +995,6 @@ void QFileSystemModelPrivate::_q_performDelayedSort()
q->sort(sortColumn, sortOrder);
}
-static inline QChar getNextChar(const QString &s, int location)
-{
- return (location < s.length()) ? s.at(location) : QChar();
-}
-
-/*!
- Natural number sort, skips spaces.
-
- Examples:
- 1, 2, 10, 55, 100
- 01.jpg, 2.jpg, 10.jpg
-
- Note on the algorithm:
- Only as many characters as necessary are looked at and at most they all
- are looked at once.
-
- Slower then QString::compare() (of course)
- */
-int QFileSystemModelPrivate::naturalCompare(const QString &s1, const QString &s2, Qt::CaseSensitivity cs)
-{
- for (int l1 = 0, l2 = 0; l1 <= s1.count() && l2 <= s2.count(); ++l1, ++l2) {
- // skip spaces, tabs and 0's
- QChar c1 = getNextChar(s1, l1);
- while (c1.isSpace())
- c1 = getNextChar(s1, ++l1);
- QChar c2 = getNextChar(s2, l2);
- while (c2.isSpace())
- c2 = getNextChar(s2, ++l2);
-
- if (c1.isDigit() && c2.isDigit()) {
- while (c1.digitValue() == 0)
- c1 = getNextChar(s1, ++l1);
- while (c2.digitValue() == 0)
- c2 = getNextChar(s2, ++l2);
-
- int lookAheadLocation1 = l1;
- int lookAheadLocation2 = l2;
- int currentReturnValue = 0;
- // find the last digit, setting currentReturnValue as we go if it isn't equal
- for (
- QChar lookAhead1 = c1, lookAhead2 = c2;
- (lookAheadLocation1 <= s1.length() && lookAheadLocation2 <= s2.length());
- lookAhead1 = getNextChar(s1, ++lookAheadLocation1),
- lookAhead2 = getNextChar(s2, ++lookAheadLocation2)
- ) {
- bool is1ADigit = !lookAhead1.isNull() && lookAhead1.isDigit();
- bool is2ADigit = !lookAhead2.isNull() && lookAhead2.isDigit();
- if (!is1ADigit && !is2ADigit)
- break;
- if (!is1ADigit)
- return -1;
- if (!is2ADigit)
- return 1;
- if (currentReturnValue == 0) {
- if (lookAhead1 < lookAhead2) {
- currentReturnValue = -1;
- } else if (lookAhead1 > lookAhead2) {
- currentReturnValue = 1;
- }
- }
- }
- if (currentReturnValue != 0)
- return currentReturnValue;
- }
-
- if (cs == Qt::CaseInsensitive) {
- if (!c1.isLower()) c1 = c1.toLower();
- if (!c2.isLower()) c2 = c2.toLower();
- }
- int r = QString::localeAwareCompare(c1, c2);
- if (r < 0)
- return -1;
- if (r > 0)
- return 1;
- }
- // The two strings are the same (02 == 2) so fall back to the normal sort
- return QString::compare(s1, s2, cs);
-}
/*
\internal
@@ -1075,7 +1003,11 @@ int QFileSystemModelPrivate::naturalCompare(const QString &s1, const QString &s2
class QFileSystemModelSorter
{
public:
- inline QFileSystemModelSorter(int column) : sortColumn(column) {}
+ inline QFileSystemModelSorter(int column) : sortColumn(column)
+ {
+ naturalCompare.setNumericMode(true);
+ naturalCompare.setCaseSensitivity(Qt::CaseInsensitive);
+ }
bool compareNodes(const QFileSystemModelPrivate::QFileSystemNode *l,
const QFileSystemModelPrivate::QFileSystemNode *r) const
@@ -1089,8 +1021,7 @@ public:
if (left ^ right)
return left;
#endif
- return QFileSystemModelPrivate::naturalCompare(l->fileName,
- r->fileName, Qt::CaseInsensitive) < 0;
+ return naturalCompare.compare(l->fileName, r->fileName) < 0;
}
case 1:
{
@@ -1102,22 +1033,22 @@ public:
qint64 sizeDifference = l->size() - r->size();
if (sizeDifference == 0)
- return QFileSystemModelPrivate::naturalCompare(l->fileName, r->fileName, Qt::CaseInsensitive) < 0;
+ return naturalCompare.compare(l->fileName, r->fileName) < 0;
return sizeDifference < 0;
}
case 2:
{
- int compare = QString::localeAwareCompare(l->type(), r->type());
+ int compare = naturalCompare.compare(l->type(), r->type());
if (compare == 0)
- return QFileSystemModelPrivate::naturalCompare(l->fileName, r->fileName, Qt::CaseInsensitive) < 0;
+ return naturalCompare.compare(l->fileName, r->fileName) < 0;
return compare < 0;
}
case 3:
{
if (l->lastModified() == r->lastModified())
- return QFileSystemModelPrivate::naturalCompare(l->fileName, r->fileName, Qt::CaseInsensitive) < 0;
+ return naturalCompare.compare(l->fileName, r->fileName) < 0;
return l->lastModified() < r->lastModified();
}
@@ -1134,6 +1065,7 @@ public:
private:
+ QCollator naturalCompare;
int sortColumn;
};
@@ -1193,7 +1125,7 @@ void QFileSystemModel::sort(int column, Qt::SortOrder order)
emit layoutAboutToBeChanged();
QModelIndexList oldList = persistentIndexList();
- QList<QPair<QFileSystemModelPrivate::QFileSystemNode*, int> > oldNodes;
+ QVector<QPair<QFileSystemModelPrivate::QFileSystemNode*, int> > oldNodes;
const int nodeCount = oldList.count();
oldNodes.reserve(nodeCount);
for (int i = 0; i < nodeCount; ++i) {
@@ -1839,7 +1771,7 @@ void QFileSystemModelPrivate::removeVisibleFile(QFileSystemNode *parentNode, int
The thread has received new information about files,
update and emit dataChanged if it has actually changed.
*/
-void QFileSystemModelPrivate::_q_fileSystemChanged(const QString &path, const QList<QPair<QString, QFileInfo> > &updates)
+void QFileSystemModelPrivate::_q_fileSystemChanged(const QString &path, const QVector<QPair<QString, QFileInfo> > &updates)
{
#ifndef QT_NO_FILESYSTEMWATCHER
Q_Q(QFileSystemModel);
@@ -1958,12 +1890,12 @@ void QFileSystemModelPrivate::_q_resolvedName(const QString &fileName, const QSt
void QFileSystemModelPrivate::init()
{
Q_Q(QFileSystemModel);
- qRegisterMetaType<QList<QPair<QString,QFileInfo> > >();
+ qRegisterMetaType<QVector<QPair<QString,QFileInfo> > >();
#ifndef QT_NO_FILESYSTEMWATCHER
q->connect(&fileInfoGatherer, SIGNAL(newListOfFiles(QString,QStringList)),
q, SLOT(_q_directoryChanged(QString,QStringList)));
- q->connect(&fileInfoGatherer, SIGNAL(updates(QString,QList<QPair<QString,QFileInfo> >)),
- q, SLOT(_q_fileSystemChanged(QString,QList<QPair<QString,QFileInfo> >)));
+ q->connect(&fileInfoGatherer, SIGNAL(updates(QString,QVector<QPair<QString,QFileInfo> >)),
+ q, SLOT(_q_fileSystemChanged(QString,QVector<QPair<QString,QFileInfo> >)));
q->connect(&fileInfoGatherer, SIGNAL(nameResolved(QString,QString)),
q, SLOT(_q_resolvedName(QString,QString)));
q->connect(&fileInfoGatherer, SIGNAL(directoryLoaded(QString)),
diff --git a/src/widgets/dialogs/qfilesystemmodel.h b/src/widgets/dialogs/qfilesystemmodel.h
index cef85a0c8c..51c01220a2 100644
--- a/src/widgets/dialogs/qfilesystemmodel.h
+++ b/src/widgets/dialogs/qfilesystemmodel.h
@@ -133,7 +133,7 @@ public:
inline QString fileName(const QModelIndex &index) const;
inline QIcon fileIcon(const QModelIndex &index) const;
QFile::Permissions permissions(const QModelIndex &index) const;
- inline QFileInfo fileInfo(const QModelIndex &index) const;
+ QFileInfo fileInfo(const QModelIndex &index) const;
bool remove(const QModelIndex &index);
protected:
@@ -147,7 +147,7 @@ private:
Q_PRIVATE_SLOT(d_func(), void _q_directoryChanged(const QString &directory, const QStringList &list))
Q_PRIVATE_SLOT(d_func(), void _q_performDelayedSort())
- Q_PRIVATE_SLOT(d_func(), void _q_fileSystemChanged(const QString &path, const QList<QPair<QString, QFileInfo> > &))
+ Q_PRIVATE_SLOT(d_func(), void _q_fileSystemChanged(const QString &path, const QVector<QPair<QString, QFileInfo> > &))
Q_PRIVATE_SLOT(d_func(), void _q_resolvedName(const QString &fileName, const QString &resolvedName))
friend class QFileDialogPrivate;
@@ -157,8 +157,6 @@ inline QString QFileSystemModel::fileName(const QModelIndex &aindex) const
{ return aindex.data(Qt::DisplayRole).toString(); }
inline QIcon QFileSystemModel::fileIcon(const QModelIndex &aindex) const
{ return qvariant_cast<QIcon>(aindex.data(Qt::DecorationRole)); }
-inline QFileInfo QFileSystemModel::fileInfo(const QModelIndex &aindex) const
-{ return QFileInfo(filePath(aindex)); }
#endif // QT_NO_FILESYSTEMMODEL
diff --git a/src/widgets/dialogs/qfilesystemmodel_p.h b/src/widgets/dialogs/qfilesystemmodel_p.h
index 57fb457071..d2a40a1cb5 100644
--- a/src/widgets/dialogs/qfilesystemmodel_p.h
+++ b/src/widgets/dialogs/qfilesystemmodel_p.h
@@ -107,6 +107,7 @@ public:
return true;
return false;
}
+ inline QFileInfo fileInfo() const { if (info) return info->fileInfo(); return QFileInfo(); }
inline bool isFile() const { if (info) return info->isFile(); return true; }
inline bool isSystem() const { if (info) return info->isSystem(); return true; }
inline bool isHidden() const { if (info) return info->isHidden(); return false; }
@@ -282,7 +283,7 @@ public:
void _q_directoryChanged(const QString &directory, const QStringList &list);
void _q_performDelayedSort();
- void _q_fileSystemChanged(const QString &path, const QList<QPair<QString, QFileInfo> > &);
+ void _q_fileSystemChanged(const QString &path, const QVector<QPair<QString, QFileInfo> > &);
void _q_resolvedName(const QString &fileName, const QString &resolvedName);
static int naturalCompare(const QString &s1, const QString &s2, Qt::CaseSensitivity cs);
diff --git a/src/widgets/itemviews/qtableview.cpp b/src/widgets/itemviews/qtableview.cpp
index d0dcb02d7f..0e38485f5a 100644
--- a/src/widgets/itemviews/qtableview.cpp
+++ b/src/widgets/itemviews/qtableview.cpp
@@ -201,9 +201,7 @@ QDebug operator<<(QDebug str, const QSpanCollection::Span &span)
void QSpanCollection::updateInsertedRows(int start, int end)
{
#ifdef DEBUG_SPAN_UPDATE
- qDebug() << Q_FUNC_INFO;
- qDebug() << start << end;
- qDebug() << index;
+ qDebug() << start << end << endl << index;
#endif
if (spans.isEmpty())
return;
@@ -251,9 +249,7 @@ void QSpanCollection::updateInsertedRows(int start, int end)
void QSpanCollection::updateInsertedColumns(int start, int end)
{
#ifdef DEBUG_SPAN_UPDATE
- qDebug() << Q_FUNC_INFO;
- qDebug() << start << end;
- qDebug() << index;
+ qDebug() << start << end << endl << index;
#endif
if (spans.isEmpty())
return;
@@ -334,9 +330,7 @@ bool QSpanCollection::cleanSpanSubIndex(QSpanCollection::SubIndex &subindex, int
void QSpanCollection::updateRemovedRows(int start, int end)
{
#ifdef DEBUG_SPAN_UPDATE
- qDebug() << Q_FUNC_INFO;
- qDebug() << start << end;
- qDebug() << index;
+ qDebug() << start << end << endl << index;
#endif
if (spans.isEmpty())
return;
@@ -463,9 +457,7 @@ void QSpanCollection::updateRemovedRows(int start, int end)
void QSpanCollection::updateRemovedColumns(int start, int end)
{
#ifdef DEBUG_SPAN_UPDATE
- qDebug() << Q_FUNC_INFO;
- qDebug() << start << end;
- qDebug() << index;
+ qDebug() << start << end << endl << index;
#endif
if (spans.isEmpty())
return;
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index 3c48f29ef1..6fffe33ce8 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -2242,8 +2242,10 @@ void QApplicationPrivate::notifyActiveWindowChange(QWindow *previous)
QApplication::setActiveWindow(tlw);
// QTBUG-37126, Active X controls may set the focus on native child widgets.
if (wnd && tlw && wnd != tlw->windowHandle()) {
- if (QWidgetWindow *widgetWindow = qobject_cast<QWidgetWindow *>(wnd))
- widgetWindow->widget()->setFocus(Qt::ActiveWindowFocusReason);
+ if (QWidgetWindow *widgetWindow = qobject_cast<QWidgetWindow *>(wnd)) {
+ if (widgetWindow->widget()->inherits("QAxHostWidget"))
+ widgetWindow->widget()->setFocus(Qt::ActiveWindowFocusReason);
+ }
}
}
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index fbaa14a2b2..66f68766cd 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -73,6 +73,7 @@
#include <QtGui/qinputmethod.h>
#include <QtGui/qopenglcontext.h>
#include <QtGui/private/qopenglcontext_p.h>
+#include <QtGui/qoffscreensurface.h>
#include <private/qgraphicseffect_p.h>
#include <qbackingstore.h>
@@ -1822,26 +1823,49 @@ void QWidgetPrivate::deleteSysExtra()
{
}
+static void deleteBackingStore(QWidgetPrivate *d)
+{
+ QTLWExtra *topData = d->topData();
+
+ // The context must be current when destroying the backing store as it may attempt to
+ // release resources like textures and shader programs. The window may not be suitable
+ // anymore as there will often not be a platform window underneath at this stage. Fall
+ // back to a QOffscreenSurface in this case.
+ QScopedPointer<QOffscreenSurface> tempSurface;
+#ifndef QT_NO_OPENGL
+ if (d->textureChildSeen && topData->shareContext) {
+ if (topData->window->handle()) {
+ topData->shareContext->makeCurrent(topData->window);
+ } else {
+ tempSurface.reset(new QOffscreenSurface);
+ tempSurface->setFormat(topData->shareContext->format());
+ tempSurface->create();
+ topData->shareContext->makeCurrent(tempSurface.data());
+ }
+ }
+#endif
+
+ delete topData->backingStore;
+ topData->backingStore = 0;
+
+#ifndef QT_NO_OPENGL
+ if (d->textureChildSeen && topData->shareContext)
+ topData->shareContext->doneCurrent();
+#endif
+}
+
void QWidgetPrivate::deleteTLSysExtra()
{
if (extra && extra->topextra) {
//the qplatformbackingstore may hold a reference to the window, so the backingstore
//needs to be deleted first. If the backingstore holds GL resources, we need to
- // make the context current here, since the platform bs does not have a reference
- // to the widget.
+ // make the context current here. This is taken care of by deleteBackingStore().
-#ifndef QT_NO_OPENGL
- if (textureChildSeen && extra->topextra->shareContext)
- extra->topextra->shareContext->makeCurrent(extra->topextra->window);
-#endif
extra->topextra->backingStoreTracker.destroy();
- delete extra->topextra->backingStore;
- extra->topextra->backingStore = 0;
+ deleteBackingStore(this);
#ifndef QT_NO_OPENGL
qDeleteAll(extra->topextra->widgetTextures);
extra->topextra->widgetTextures.clear();
- if (textureChildSeen && extra->topextra->shareContext)
- extra->topextra->shareContext->doneCurrent();
delete extra->topextra->shareContext;
extra->topextra->shareContext = 0;
#endif
@@ -12030,7 +12054,7 @@ void QWidget::setBackingStore(QBackingStore *store)
return;
QBackingStore *oldStore = topData->backingStore;
- delete topData->backingStore;
+ deleteBackingStore(d);
topData->backingStore = store;
QWidgetBackingStore *bs = d->maybeBackingStore();
@@ -12320,6 +12344,12 @@ QPaintEngine *QWidget::paintEngine() const
return 0; //##### @@@
}
+// Do not call QWindow::mapToGlobal() until QPlatformWindow is properly showing.
+static inline bool canMapPosition(QWindow *window)
+{
+ return window->handle() && !qt_window_private(window)->resizeEventPending;
+}
+
/*!
\fn QPoint QWidget::mapToGlobal(const QPoint &pos) const
@@ -12347,7 +12377,7 @@ QPoint QWidget::mapToGlobal(const QPoint &pos) const
#endif // !QT_NO_GRAPHICSVIEW
QWindow *window = w->windowHandle();
- if (window && window->handle())
+ if (window && canMapPosition(window))
return window->mapToGlobal(QPoint(x, y));
x += w->data->crect.x();
@@ -12383,7 +12413,7 @@ QPoint QWidget::mapFromGlobal(const QPoint &pos) const
#endif // !QT_NO_GRAPHICSVIEW
QWindow *window = w->windowHandle();
- if (window && window->handle())
+ if (window && canMapPosition(window))
return window->mapFromGlobal(QPoint(x, y));
x -= w->data->crect.x();
diff --git a/src/widgets/kernel/qwidgetbackingstore.cpp b/src/widgets/kernel/qwidgetbackingstore.cpp
index a108dcf03b..d5c8691459 100644
--- a/src/widgets/kernel/qwidgetbackingstore.cpp
+++ b/src/widgets/kernel/qwidgetbackingstore.cpp
@@ -104,7 +104,6 @@ void QWidgetBackingStore::qt_flush(QWidget *widget, const QRegion &region, QBack
#ifndef QT_NO_OPENGL
if (widgetTextures) {
- Q_ASSERT(!widgetTextures->isEmpty());
qt_window_private(tlw->windowHandle())->compositing = true;
widget->window()->d_func()->sendComposeStatus(widget->window(), false);
// A window may have alpha even when the app did not request
@@ -955,6 +954,8 @@ static void findAllTextureWidgetsRecursively(QWidget *tlw, QWidget *widget)
}
}
+Q_GLOBAL_STATIC(QPlatformTextureList, qt_dummy_platformTextureList)
+
static QPlatformTextureList *widgetTexturesFor(QWidget *tlw, QWidget *widget)
{
foreach (QPlatformTextureList *tl, QWidgetPrivate::get(tlw)->topData()->widgetTextures) {
@@ -965,6 +966,20 @@ static QPlatformTextureList *widgetTexturesFor(QWidget *tlw, QWidget *widget)
return tl;
}
}
+
+ if (QWidgetPrivate::get(tlw)->textureChildSeen) {
+ // No render-to-texture widgets in the (sub-)tree due to hidden or native
+ // children. Returning null results in using the normal backingstore flush path
+ // without OpenGL-based compositing. This is very desirable normally. However,
+ // some platforms cannot handle switching between the non-GL and GL paths for
+ // their windows so it has to be opt-in.
+ static bool switchableWidgetComposition =
+ QGuiApplicationPrivate::instance()->platformIntegration()
+ ->hasCapability(QPlatformIntegration::SwitchableWidgetComposition);
+ if (!switchableWidgetComposition)
+ return qt_dummy_platformTextureList();
+ }
+
return 0;
}
diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp
index cce667ffbf..e65c2c8bef 100644
--- a/src/widgets/kernel/qwidgetwindow.cpp
+++ b/src/widgets/kernel/qwidgetwindow.cpp
@@ -799,7 +799,7 @@ void QWidgetWindow::handleDragLeaveEvent(QDragLeaveEvent *event)
void QWidgetWindow::handleDropEvent(QDropEvent *event)
{
if (Q_UNLIKELY(m_dragTarget.isNull())) {
- qWarning() << Q_FUNC_INFO << m_widget << ": No drag target set.";
+ qWarning() << m_widget << ": No drag target set.";
event->ignore();
return;
}
diff --git a/src/widgets/styles/qwindowsvistastyle.cpp b/src/widgets/styles/qwindowsvistastyle.cpp
index 3be5ae3524..4c16b182a8 100644
--- a/src/widgets/styles/qwindowsvistastyle.cpp
+++ b/src/widgets/styles/qwindowsvistastyle.cpp
@@ -2472,12 +2472,12 @@ bool QWindowsVistaStylePrivate::initTreeViewTheming()
m_treeViewHelper = createTreeViewHelperWindow();
if (Q_UNLIKELY(!m_treeViewHelper)) {
- qWarning("%s: Unable to create the treeview helper window.", Q_FUNC_INFO);
+ qWarning("Unable to create the treeview helper window.");
return false;
}
const HRESULT hr = QWindowsXPStylePrivate::pSetWindowTheme(m_treeViewHelper, L"explorer", NULL);
if (Q_UNLIKELY(hr != S_OK)) {
- qErrnoWarning("%s: SetWindowTheme() failed.", Q_FUNC_INFO);
+ qErrnoWarning("SetWindowTheme() failed.");
return false;
}
return QWindowsXPStylePrivate::createTheme(QWindowsXPStylePrivate::TreeViewTheme, m_treeViewHelper);
diff --git a/src/widgets/styles/qwindowsxpstyle.cpp b/src/widgets/styles/qwindowsxpstyle.cpp
index 8bd4f69d20..d5f511b771 100644
--- a/src/widgets/styles/qwindowsxpstyle.cpp
+++ b/src/widgets/styles/qwindowsxpstyle.cpp
@@ -338,15 +338,15 @@ void QWindowsXPStylePrivate::cleanupHandleMap()
HTHEME QWindowsXPStylePrivate::createTheme(int theme, HWND hwnd)
{
if (Q_UNLIKELY(theme < 0 || theme >= NThemes || !hwnd)) {
- qWarning("%s: Invalid parameters #%d, %p", Q_FUNC_INFO, theme, hwnd);
+ qWarning("Invalid parameters #%d, %p", theme, hwnd);
return 0;
}
if (!m_themes[theme]) {
const wchar_t *name = themeNames[theme];
m_themes[theme] = pOpenThemeData(hwnd, name);
if (Q_UNLIKELY(!m_themes[theme]))
- qErrnoWarning("%s: OpenThemeData() failed for theme %d (%s).",
- Q_FUNC_INFO, theme, qPrintable(themeName(theme)));
+ qErrnoWarning("OpenThemeData() failed for theme %d (%s).",
+ theme, qPrintable(themeName(theme)));
}
return m_themes[theme];
}
diff --git a/src/widgets/util/qscroller.cpp b/src/widgets/util/qscroller.cpp
index c540c3cdf0..bc7c11127e 100644
--- a/src/widgets/util/qscroller.cpp
+++ b/src/widgets/util/qscroller.cpp
@@ -1870,8 +1870,8 @@ void QScrollerPrivate::setContentPositionHelperScrolling()
newPos.setY(nextSegmentPosition(ySegments, now, newPos.y()));
// -- set the position and handle overshoot
- qScrollerDebug() << "QScroller::setContentPositionHelperScrolling()";
- qScrollerDebug() << " --> overshoot:" << overshootPosition << "- new pos:" << newPos;
+ qScrollerDebug() << "QScroller::setContentPositionHelperScrolling()\n"
+ " --> overshoot:" << overshootPosition << "- new pos:" << newPos;
QPointF newClampedPos = clampToRect(newPos, contentPosRange);
diff --git a/src/widgets/util/qsystemtrayicon_win.cpp b/src/widgets/util/qsystemtrayicon_win.cpp
index 1809c36483..f1b86ba2df 100644
--- a/src/widgets/util/qsystemtrayicon_win.cpp
+++ b/src/widgets/util/qsystemtrayicon_win.cpp
@@ -395,7 +395,7 @@ void QSystemTrayIconPrivate::install_sys()
sys->createIcon();
sys->trayMessage(NIM_ADD);
} else {
- qWarning("%s: The platform plugin failed to create a message window.", Q_FUNC_INFO);
+ qWarning("The platform plugin failed to create a message window.");
}
}
}
diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp
index 27e977f027..4239e7f3d4 100644
--- a/src/widgets/widgets/qmenu.cpp
+++ b/src/widgets/widgets/qmenu.cpp
@@ -502,8 +502,8 @@ void QMenuPrivate::hideMenu(QMenu *menu)
if (activeMenu == menu)
activeMenu = 0;
menu->d_func()->causedPopup.action = 0;
- menu->d_func()->causedPopup.widget = 0;
menu->close();
+ menu->d_func()->causedPopup.widget = 0;
if (previousMouseMenu.data() == menu)
handleEnterLeaveEvents(&previousMouseMenu, Q_NULLPTR);
}
diff --git a/src/widgets/widgets/qtoolbararealayout.cpp b/src/widgets/widgets/qtoolbararealayout.cpp
index dc39221b60..b5379f594c 100644
--- a/src/widgets/widgets/qtoolbararealayout.cpp
+++ b/src/widgets/widgets/qtoolbararealayout.cpp
@@ -1129,7 +1129,7 @@ QLayoutItem *QToolBarAreaLayout::plug(const QList<int> &path)
{
QToolBarAreaLayoutItem *item = this->item(path);
if (Q_UNLIKELY(!item)) {
- qWarning() << Q_FUNC_INFO << "No item at" << path;
+ qWarning() << "No item at" << path;
return 0;
}
Q_ASSERT(item->gap);