summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-10-13 09:49:38 +0200
committerLiang Qi <liang.qi@qt.io>2016-10-13 09:49:38 +0200
commitdfc177e3a99dd593db4b1e9445d6243ce75ebf07 (patch)
tree4e33c7be90a44642e672fff22ea163b500ff3aef /src/widgets
parent72efb2e6f4af2fd909daaf9104f09fd1425acfb0 (diff)
parent1d6eb70dcec105af28d6a5e9b59d56c895c70389 (diff)
Merge remote-tracking branch 'origin/5.8' into dev
Conflicts: qmake/library/qmakeevaluator.cpp (cherry picked from commit 1af6dc2c8fb4d91400fddc5050166f972ae57c9a in qttools) src/corelib/kernel/qcore_mac_objc.mm src/gui/painting/qcolor.h src/plugins/platforms/cocoa/qcocoawindow.mm Change-Id: I5b3ec468a5a9a73911b528d3d24ff8e19f339f31
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/dialogs/qfilesystemmodel.cpp7
-rw-r--r--src/widgets/dialogs/qfilesystemmodel_p.h24
-rw-r--r--src/widgets/doc/src/model-view-programming.qdoc8
-rw-r--r--src/widgets/graphicsview/qgraphicswidget.cpp5
-rw-r--r--src/widgets/itemviews/qabstractitemview.cpp9
-rw-r--r--src/widgets/kernel/qapplication.cpp6
-rw-r--r--src/widgets/kernel/qformlayout.cpp15
-rw-r--r--src/widgets/kernel/qlayoutitem.cpp14
-rw-r--r--src/widgets/statemachine/qbasickeyeventtransition.cpp4
-rw-r--r--src/widgets/statemachine/qbasickeyeventtransition_p.h8
-rw-r--r--src/widgets/statemachine/qbasicmouseeventtransition.cpp5
-rw-r--r--src/widgets/statemachine/qbasicmouseeventtransition_p.h8
-rw-r--r--src/widgets/statemachine/qguistatemachine.cpp5
-rw-r--r--src/widgets/statemachine/qkeyeventtransition.cpp5
-rw-r--r--src/widgets/statemachine/qkeyeventtransition.h7
-rw-r--r--src/widgets/statemachine/qmouseeventtransition.cpp5
-rw-r--r--src/widgets/statemachine/qmouseeventtransition.h7
-rw-r--r--src/widgets/statemachine/statemachine.pri7
-rw-r--r--src/widgets/styles/qdrawutil.cpp1
-rw-r--r--src/widgets/styles/qpixmapstyle.cpp4
-rw-r--r--src/widgets/widgets/qdockwidget.cpp4
-rw-r--r--src/widgets/widgets/qmaccocoaviewcontainer_mac.mm45
-rw-r--r--src/widgets/widgets/qtextedit.cpp2
-rw-r--r--src/widgets/widgets/qwidgettextcontrol.cpp5
-rw-r--r--src/widgets/widgets/qwidgettextcontrol_p.h2
25 files changed, 98 insertions, 114 deletions
diff --git a/src/widgets/dialogs/qfilesystemmodel.cpp b/src/widgets/dialogs/qfilesystemmodel.cpp
index 11b3659990..6e1bee94c4 100644
--- a/src/widgets/dialogs/qfilesystemmodel.cpp
+++ b/src/widgets/dialogs/qfilesystemmodel.cpp
@@ -873,7 +873,7 @@ bool QFileSystemModel::setData(const QModelIndex &idx, const QVariant &value, in
QString newName = value.toString();
QString oldName = idx.data().toString();
- if (newName == idx.data().toString())
+ if (newName == oldName)
return true;
const QString parentPath = filePath(parent(idx));
@@ -903,15 +903,13 @@ bool QFileSystemModel::setData(const QModelIndex &idx, const QVariant &value, in
QFileSystemModelPrivate::QFileSystemNode *parentNode = indexNode->parent;
int visibleLocation = parentNode->visibleLocation(parentNode->children.value(indexNode->fileName)->fileName);
- d->addNode(parentNode, newName,indexNode->info->fileInfo());
parentNode->visibleChildren.removeAt(visibleLocation);
QFileSystemModelPrivate::QFileSystemNode * oldValue = parentNode->children.value(oldName);
parentNode->children[newName] = oldValue;
- QFileInfo info(parentPath, newName);
oldValue->fileName = newName;
oldValue->parent = parentNode;
#ifndef QT_NO_FILESYSTEMWATCHER
- oldValue->populate(d->fileInfoGatherer.getInfo(info));
+ oldValue->populate(d->fileInfoGatherer.getInfo(QFileInfo(parentPath, newName)));
#endif
oldValue->isVisible = true;
@@ -1698,6 +1696,7 @@ QFileSystemModelPrivate::QFileSystemNode* QFileSystemModelPrivate::addNode(QFile
node->volumeName = QString::fromWCharArray(name);
}
#endif
+ Q_ASSERT(!parentNode->children.contains(fileName));
parentNode->children.insert(fileName, node);
return node;
}
diff --git a/src/widgets/dialogs/qfilesystemmodel_p.h b/src/widgets/dialogs/qfilesystemmodel_p.h
index 92398d981f..e7149a3097 100644
--- a/src/widgets/dialogs/qfilesystemmodel_p.h
+++ b/src/widgets/dialogs/qfilesystemmodel_p.h
@@ -85,11 +85,7 @@ public:
explicit QFileSystemNode(const QString &filename = QString(), QFileSystemNode *p = 0)
: fileName(filename), populatedChildren(false), isVisible(false), dirtyChildrenIndex(-1), parent(p), info(0) {}
~QFileSystemNode() {
- QHash<QString, QFileSystemNode*>::const_iterator i = children.constBegin();
- while (i != children.constEnd()) {
- delete i.value();
- ++i;
- }
+ qDeleteAll(children);
delete info;
info = 0;
parent = 0;
@@ -164,32 +160,30 @@ public:
void updateIcon(QFileIconProvider *iconProvider, const QString &path) {
if (info)
info->icon = iconProvider->icon(QFileInfo(path));
- QHash<QString, QFileSystemNode *>::const_iterator iterator;
- for(iterator = children.constBegin() ; iterator != children.constEnd() ; ++iterator) {
+ for (QFileSystemNode *child : qAsConst(children)) {
//On windows the root (My computer) has no path so we don't want to add a / for nothing (e.g. /C:/)
if (!path.isEmpty()) {
if (path.endsWith(QLatin1Char('/')))
- iterator.value()->updateIcon(iconProvider, path + iterator.value()->fileName);
+ child->updateIcon(iconProvider, path + child->fileName);
else
- iterator.value()->updateIcon(iconProvider, path + QLatin1Char('/') + iterator.value()->fileName);
+ child->updateIcon(iconProvider, path + QLatin1Char('/') + child->fileName);
} else
- iterator.value()->updateIcon(iconProvider, iterator.value()->fileName);
+ child->updateIcon(iconProvider, child->fileName);
}
}
void retranslateStrings(QFileIconProvider *iconProvider, const QString &path) {
if (info)
info->displayType = iconProvider->type(QFileInfo(path));
- QHash<QString, QFileSystemNode *>::const_iterator iterator;
- for(iterator = children.constBegin() ; iterator != children.constEnd() ; ++iterator) {
+ for (QFileSystemNode *child : qAsConst(children)) {
//On windows the root (My computer) has no path so we don't want to add a / for nothing (e.g. /C:/)
if (!path.isEmpty()) {
if (path.endsWith(QLatin1Char('/')))
- iterator.value()->retranslateStrings(iconProvider, path + iterator.value()->fileName);
+ child->retranslateStrings(iconProvider, path + child->fileName);
else
- iterator.value()->retranslateStrings(iconProvider, path + QLatin1Char('/') + iterator.value()->fileName);
+ child->retranslateStrings(iconProvider, path + QLatin1Char('/') + child->fileName);
} else
- iterator.value()->retranslateStrings(iconProvider, iterator.value()->fileName);
+ child->retranslateStrings(iconProvider, child->fileName);
}
}
diff --git a/src/widgets/doc/src/model-view-programming.qdoc b/src/widgets/doc/src/model-view-programming.qdoc
index f172679d04..e727d7fe56 100644
--- a/src/widgets/doc/src/model-view-programming.qdoc
+++ b/src/widgets/doc/src/model-view-programming.qdoc
@@ -253,7 +253,7 @@
\snippet shareddirmodel/main.cpp 0
The model is set up to use data from a certain file system. The call to
- \l{QFileSystemModel::}{setRootPath()} tell the model which drive on the
+ \l{QFileSystemModel::}{setRootPath()} tells the model which drive on the
file system to expose to the views.
We create two views so that we can examine the items held in the model in two
@@ -304,7 +304,7 @@
signals and slots mechanism.
This section describes some basic concepts that are central to the way
- item of data are accessed by other components via a model class. More
+ items of data are accessed by other components via a model class. More
advanced concepts are discussed in later sections.
\section3 Model indexes
@@ -737,7 +737,7 @@
\image spinboxdelegate-example.png
- We subclass the delegate from \l QItemDelegate because we do not want
+ We subclass the delegate from \l QStyledItemDelegate because we do not want
to write custom display functions. However, we must still provide
functions to manage the editor widget:
@@ -1869,7 +1869,7 @@
\codeline
\snippet qsortfilterproxymodel/main.cpp 1
- Since proxy models are inherit from QAbstractItemModel, they can be connected to
+ Since proxy models inherit from QAbstractItemModel, they can be connected to
any kind of view, and can be shared between views. They can also be used to
process the information obtained from other proxy models in a pipeline arrangement.
diff --git a/src/widgets/graphicsview/qgraphicswidget.cpp b/src/widgets/graphicsview/qgraphicswidget.cpp
index d52aff5131..e1ba3759e0 100644
--- a/src/widgets/graphicsview/qgraphicswidget.cpp
+++ b/src/widgets/graphicsview/qgraphicswidget.cpp
@@ -274,6 +274,11 @@ QGraphicsWidget::~QGraphicsWidget()
// Remove this graphics widget from widgetStyles
widgetStyles()->setStyleForWidget(this, 0);
+
+ // Unset the parent here, when we're still a QGraphicsWidget.
+ // It is otherwise done in ~QGraphicsItem() where we'd be
+ // calling QGraphicsWidget members on an ex-QGraphicsWidget object
+ setParentItem(Q_NULLPTR);
}
/*!
diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp
index a4e24b80b1..fff09b46d0 100644
--- a/src/widgets/itemviews/qabstractitemview.cpp
+++ b/src/widgets/itemviews/qabstractitemview.cpp
@@ -1786,13 +1786,18 @@ void QAbstractItemView::mousePressEvent(QMouseEvent *event)
d->autoScroll = false;
d->selectionModel->setCurrentIndex(index, QItemSelectionModel::NoUpdate);
d->autoScroll = autoScroll;
- QRect rect(visualRect(d->currentSelectionStartIndex).center(), pos);
if (command.testFlag(QItemSelectionModel::Toggle)) {
command &= ~QItemSelectionModel::Toggle;
d->ctrlDragSelectionFlag = d->selectionModel->isSelected(index) ? QItemSelectionModel::Deselect : QItemSelectionModel::Select;
command |= d->ctrlDragSelectionFlag;
}
- setSelection(rect, command);
+
+ if ((command & QItemSelectionModel::Current) == 0) {
+ setSelection(QRect(pos, QSize(1, 1)), command);
+ } else {
+ QRect rect(visualRect(d->currentSelectionStartIndex).center(), pos);
+ setSelection(rect, command);
+ }
// signal handlers may change the model
emit pressed(index);
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index 815ae7fe33..b94aa826d3 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -608,7 +608,7 @@ void qt_init_tooltip_palette()
#endif
}
-#ifndef QT_NO_STATEMACHINE
+#if QT_CONFIG(statemachine)
void qRegisterGuiStateMachine();
void qUnregisterGuiStateMachine();
#endif
@@ -634,7 +634,7 @@ void QApplicationPrivate::initialize()
if (application_type != QApplicationPrivate::Tty)
(void) QApplication::style(); // trigger creation of application style
-#ifndef QT_NO_STATEMACHINE
+#if QT_CONFIG(statemachine)
// trigger registering of QStateMachine's GUI types
qRegisterGuiStateMachine();
#endif
@@ -862,7 +862,7 @@ QApplication::~QApplication()
QApplicationPrivate::enabledAnimations = QPlatformTheme::GeneralUiEffect;
QApplicationPrivate::widgetCount = false;
-#ifndef QT_NO_STATEMACHINE
+#if QT_CONFIG(statemachine)
// trigger unregistering of QStateMachine's GUI types
qUnregisterGuiStateMachine();
#endif
diff --git a/src/widgets/kernel/qformlayout.cpp b/src/widgets/kernel/qformlayout.cpp
index 73e82c577c..3e60723f17 100644
--- a/src/widgets/kernel/qformlayout.cpp
+++ b/src/widgets/kernel/qformlayout.cpp
@@ -165,7 +165,7 @@ public:
int insertRow(int row);
void insertRows(int row, int count);
void removeRow(int row);
- void setItem(int row, QFormLayout::ItemRole role, QLayoutItem *item);
+ bool setItem(int row, QFormLayout::ItemRole role, QLayoutItem *item);
void setLayout(int row, QFormLayout::ItemRole role, QLayout *layout);
void setWidget(int row, QFormLayout::ItemRole role, QWidget *widget);
@@ -933,21 +933,21 @@ void QFormLayoutPrivate::removeRow(int row)
m_matrix.removeRow(row);
}
-void QFormLayoutPrivate::setItem(int row, QFormLayout::ItemRole role, QLayoutItem *item)
+bool QFormLayoutPrivate::setItem(int row, QFormLayout::ItemRole role, QLayoutItem *item)
{
const bool fullRow = role == QFormLayout::SpanningRole;
const int column = role == QFormLayout::SpanningRole ? 1 : static_cast<int>(role);
if (Q_UNLIKELY(uint(row) >= uint(m_matrix.rowCount()) || uint(column) > 1U)) {
qWarning("QFormLayoutPrivate::setItem: Invalid cell (%d, %d)", row, column);
- return;
+ return false;
}
if (!item)
- return;
+ return false;
if (Q_UNLIKELY(m_matrix(row, column))) {
qWarning("QFormLayoutPrivate::setItem: Cell (%d, %d) already occupied", row, column);
- return;
+ return false;
}
QFormLayoutItem *i = new QFormLayoutItem(item);
@@ -955,6 +955,7 @@ void QFormLayoutPrivate::setItem(int row, QFormLayout::ItemRole role, QLayoutIte
m_matrix(row, column) = i;
m_things.append(i);
+ return true;
}
void QFormLayoutPrivate::setLayout(int row, QFormLayout::ItemRole role, QLayout *layout)
@@ -971,7 +972,9 @@ void QFormLayoutPrivate::setWidget(int row, QFormLayout::ItemRole role, QWidget
if (widget) {
Q_Q(QFormLayout);
q->addChildWidget(widget);
- setItem(row, role, QLayoutPrivate::createWidgetItem(q, widget));
+ QWidgetItem *item = QLayoutPrivate::createWidgetItem(q, widget);
+ if (!setItem(row, role, item))
+ delete item;
}
}
diff --git a/src/widgets/kernel/qlayoutitem.cpp b/src/widgets/kernel/qlayoutitem.cpp
index 76568a2c33..ee0c28ec76 100644
--- a/src/widgets/kernel/qlayoutitem.cpp
+++ b/src/widgets/kernel/qlayoutitem.cpp
@@ -306,6 +306,8 @@ void QLayoutItem::invalidate()
/*!
If this item is a QLayout, it is returned as a QLayout; otherwise
0 is returned. This function provides type-safe casting.
+
+ \sa spacerItem(), widget()
*/
QLayout * QLayoutItem::layout()
{
@@ -315,6 +317,8 @@ QLayout * QLayoutItem::layout()
/*!
If this item is a QSpacerItem, it is returned as a QSpacerItem;
otherwise 0 is returned. This function provides type-safe casting.
+
+ \sa layout(), widget()
*/
QSpacerItem * QLayoutItem::spacerItem()
{
@@ -345,8 +349,14 @@ QSpacerItem * QSpacerItem::spacerItem()
*/
/*!
- If this item is a QWidget, it is returned as a QWidget; otherwise
- 0 is returned. This function provides type-safe casting.
+ If this item manages a QWidget, returns that widget. Otherwise,
+ \c nullptr is returned.
+
+ \note While the functions layout() and spacerItem() perform casts, this
+ function returns another object: QLayout and QSpacerItem inherit QLayoutItem,
+ while QWidget does not.
+
+ \sa layout(), spacerItem()
*/
QWidget * QLayoutItem::widget()
{
diff --git a/src/widgets/statemachine/qbasickeyeventtransition.cpp b/src/widgets/statemachine/qbasickeyeventtransition.cpp
index fe2edca613..c833e64822 100644
--- a/src/widgets/statemachine/qbasickeyeventtransition.cpp
+++ b/src/widgets/statemachine/qbasickeyeventtransition.cpp
@@ -39,8 +39,6 @@
#include "qbasickeyeventtransition_p.h"
-#ifndef QT_NO_STATEMACHINE
-
#include <QtGui/qevent.h>
#include <qdebug.h>
#include <private/qabstracttransition_p.h>
@@ -204,5 +202,3 @@ void QBasicKeyEventTransition::onTransition(QEvent *)
QT_END_NAMESPACE
#include "moc_qbasickeyeventtransition_p.cpp"
-
-#endif //QT_NO_STATEMACHINE
diff --git a/src/widgets/statemachine/qbasickeyeventtransition_p.h b/src/widgets/statemachine/qbasickeyeventtransition_p.h
index 576c5beb5d..d3b90f6104 100644
--- a/src/widgets/statemachine/qbasickeyeventtransition_p.h
+++ b/src/widgets/statemachine/qbasickeyeventtransition_p.h
@@ -51,13 +51,11 @@
// We mean it.
//
-#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include <QtCore/qabstracttransition.h>
-
-#ifndef QT_NO_STATEMACHINE
-
#include <QtGui/qevent.h>
+QT_REQUIRE_CONFIG(qeventtransition);
+
QT_BEGIN_NAMESPACE
class QBasicKeyEventTransitionPrivate;
@@ -92,6 +90,4 @@ private:
QT_END_NAMESPACE
-#endif //QT_NO_STATEMACHINE
-
#endif
diff --git a/src/widgets/statemachine/qbasicmouseeventtransition.cpp b/src/widgets/statemachine/qbasicmouseeventtransition.cpp
index 39c69b95f5..f404c33a2f 100644
--- a/src/widgets/statemachine/qbasicmouseeventtransition.cpp
+++ b/src/widgets/statemachine/qbasicmouseeventtransition.cpp
@@ -38,9 +38,6 @@
****************************************************************************/
#include "qbasicmouseeventtransition_p.h"
-
-#ifndef QT_NO_STATEMACHINE
-
#include <QtGui/qevent.h>
#include <QtGui/qpainterpath.h>
#include <qdebug.h>
@@ -209,5 +206,3 @@ void QBasicMouseEventTransition::onTransition(QEvent *)
QT_END_NAMESPACE
#include "moc_qbasicmouseeventtransition_p.cpp"
-
-#endif //QT_NO_STATEMACHINE
diff --git a/src/widgets/statemachine/qbasicmouseeventtransition_p.h b/src/widgets/statemachine/qbasicmouseeventtransition_p.h
index 72320a52dc..d6d37eb03e 100644
--- a/src/widgets/statemachine/qbasicmouseeventtransition_p.h
+++ b/src/widgets/statemachine/qbasicmouseeventtransition_p.h
@@ -51,13 +51,11 @@
// We mean it.
//
-#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include <QtCore/qabstracttransition.h>
-
-#ifndef QT_NO_STATEMACHINE
-
#include <QtGui/qevent.h>
+QT_REQUIRE_CONFIG(qeventtransition);
+
QT_BEGIN_NAMESPACE
class QPainterPath;
@@ -95,6 +93,4 @@ private:
QT_END_NAMESPACE
-#endif //QT_NO_STATEMACHINE
-
#endif
diff --git a/src/widgets/statemachine/qguistatemachine.cpp b/src/widgets/statemachine/qguistatemachine.cpp
index c909048213..8d722a4475 100644
--- a/src/widgets/statemachine/qguistatemachine.cpp
+++ b/src/widgets/statemachine/qguistatemachine.cpp
@@ -38,9 +38,6 @@
****************************************************************************/
#include <QtCore/qstatemachine.h>
-
-#ifndef QT_NO_STATEMACHINE
-
#include <private/qstatemachine_p.h>
#include <QtGui/qevent.h>
#include <QtWidgets/qgraphicssceneevent.h>
@@ -471,5 +468,3 @@ void qUnregisterGuiStateMachine()
Q_DESTRUCTOR_FUNCTION(qUnregisterGuiStateMachine)
QT_END_NAMESPACE
-
-#endif //QT_NO_STATEMACHINE
diff --git a/src/widgets/statemachine/qkeyeventtransition.cpp b/src/widgets/statemachine/qkeyeventtransition.cpp
index 0e9f8458c2..1578f294d5 100644
--- a/src/widgets/statemachine/qkeyeventtransition.cpp
+++ b/src/widgets/statemachine/qkeyeventtransition.cpp
@@ -38,9 +38,6 @@
****************************************************************************/
#include "qkeyeventtransition.h"
-
-#ifndef QT_NO_STATEMACHINE
-
#include "qbasickeyeventtransition_p.h"
#include <QtCore/qstatemachine.h>
#include <private/qeventtransition_p.h>
@@ -175,5 +172,3 @@ void QKeyEventTransition::onTransition(QEvent *event)
QT_END_NAMESPACE
#include "moc_qkeyeventtransition.cpp"
-
-#endif //QT_NO_STATEMACHINE
diff --git a/src/widgets/statemachine/qkeyeventtransition.h b/src/widgets/statemachine/qkeyeventtransition.h
index 1e3f02acd8..23ce3c40be 100644
--- a/src/widgets/statemachine/qkeyeventtransition.h
+++ b/src/widgets/statemachine/qkeyeventtransition.h
@@ -43,10 +43,9 @@
#include <QtWidgets/qtwidgetsglobal.h>
#include <QtCore/qeventtransition.h>
-QT_BEGIN_NAMESPACE
-
+QT_REQUIRE_CONFIG(qeventtransition);
-#ifndef QT_NO_STATEMACHINE
+QT_BEGIN_NAMESPACE
class QKeyEventTransitionPrivate;
class Q_WIDGETS_EXPORT QKeyEventTransition : public QEventTransition
@@ -75,8 +74,6 @@ private:
Q_DECLARE_PRIVATE(QKeyEventTransition)
};
-#endif //QT_NO_STATEMACHINE
-
QT_END_NAMESPACE
#endif
diff --git a/src/widgets/statemachine/qmouseeventtransition.cpp b/src/widgets/statemachine/qmouseeventtransition.cpp
index 047a9779fe..c58dae55a3 100644
--- a/src/widgets/statemachine/qmouseeventtransition.cpp
+++ b/src/widgets/statemachine/qmouseeventtransition.cpp
@@ -38,9 +38,6 @@
****************************************************************************/
#include "qmouseeventtransition.h"
-
-#ifndef QT_NO_STATEMACHINE
-
#include "qbasicmouseeventtransition_p.h"
#include <QtCore/qstatemachine.h>
#include <QtGui/qpainterpath.h>
@@ -203,5 +200,3 @@ void QMouseEventTransition::onTransition(QEvent *event)
QT_END_NAMESPACE
#include "moc_qmouseeventtransition.cpp"
-
-#endif //QT_NO_STATEMACHINE
diff --git a/src/widgets/statemachine/qmouseeventtransition.h b/src/widgets/statemachine/qmouseeventtransition.h
index 43185b140d..3f40224d8c 100644
--- a/src/widgets/statemachine/qmouseeventtransition.h
+++ b/src/widgets/statemachine/qmouseeventtransition.h
@@ -43,10 +43,9 @@
#include <QtWidgets/qtwidgetsglobal.h>
#include <QtCore/qeventtransition.h>
-QT_BEGIN_NAMESPACE
-
+QT_REQUIRE_CONFIG(qeventtransition);
-#ifndef QT_NO_STATEMACHINE
+QT_BEGIN_NAMESPACE
class QMouseEventTransitionPrivate;
class QPainterPath;
@@ -79,8 +78,6 @@ private:
Q_DECLARE_PRIVATE(QMouseEventTransition)
};
-#endif //QT_NO_STATEMACHINE
-
QT_END_NAMESPACE
#endif
diff --git a/src/widgets/statemachine/statemachine.pri b/src/widgets/statemachine/statemachine.pri
index 2eb1e05be6..7b6407bde5 100644
--- a/src/widgets/statemachine/statemachine.pri
+++ b/src/widgets/statemachine/statemachine.pri
@@ -1,5 +1,8 @@
-SOURCES += $$PWD/qguistatemachine.cpp
-!contains(DEFINES, QT_NO_STATEMACHINE_EVENTFILTER) {
+
+qtConfig(statemachine): \
+ SOURCES += $$PWD/qguistatemachine.cpp
+
+qtConfig(qeventtransition) {
HEADERS += \
$$PWD/qkeyeventtransition.h \
$$PWD/qmouseeventtransition.h \
diff --git a/src/widgets/styles/qdrawutil.cpp b/src/widgets/styles/qdrawutil.cpp
index a8f58eabb3..fa80a7a6ca 100644
--- a/src/widgets/styles/qdrawutil.cpp
+++ b/src/widgets/styles/qdrawutil.cpp
@@ -769,7 +769,6 @@ void qDrawPlainRect(QPainter *p, const QRect &r, const QColor &c,
\fn void qDrawBorderPixmap(QPainter *painter, const QRect &target, const QMargins &margins, const QPixmap &pixmap)
\relates <qdrawutil.h>
\since 4.6
- \overload
\brief The qDrawBorderPixmap function is for drawing a pixmap into
the margins of a rectangle.
diff --git a/src/widgets/styles/qpixmapstyle.cpp b/src/widgets/styles/qpixmapstyle.cpp
index a0fff82dc0..ee5fd704dc 100644
--- a/src/widgets/styles/qpixmapstyle.cpp
+++ b/src/widgets/styles/qpixmapstyle.cpp
@@ -187,7 +187,9 @@ void QPixmapStyle::polish(QWidget *widget)
view->setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel);
view->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
}
+#if QT_CONFIG(gestures)
QScroller::grabGesture(scrollArea->viewport(), QScroller::LeftMouseButtonGesture);
+#endif
}
if (qobject_cast<QScrollBar*>(widget))
@@ -217,8 +219,10 @@ void QPixmapStyle::unpolish(QWidget *widget)
if (qstrcmp(widget->metaObject()->className(),"QComboBoxPrivateContainer") == 0)
widget->removeEventFilter(this);
+#if QT_CONFIG(gestures)
if (QAbstractScrollArea *scrollArea = qobject_cast<QAbstractScrollArea*>(widget))
QScroller::ungrabGesture(scrollArea->viewport());
+#endif
QCommonStyle::unpolish(widget);
}
diff --git a/src/widgets/widgets/qdockwidget.cpp b/src/widgets/widgets/qdockwidget.cpp
index 9e95d086bd..5059616870 100644
--- a/src/widgets/widgets/qdockwidget.cpp
+++ b/src/widgets/widgets/qdockwidget.cpp
@@ -1315,7 +1315,9 @@ QDockWidget::DockWidgetFeatures QDockWidget::features() const
By default, this property is \c true.
- \sa isWindow()
+ When this property changes, the \c {topLevelChanged()} signal is emitted.
+
+ \sa isWindow(), topLevelChanged()
*/
void QDockWidget::setFloating(bool floating)
{
diff --git a/src/widgets/widgets/qmaccocoaviewcontainer_mac.mm b/src/widgets/widgets/qmaccocoaviewcontainer_mac.mm
index 725cc637d6..b4f2b8959e 100644
--- a/src/widgets/widgets/qmaccocoaviewcontainer_mac.mm
+++ b/src/widgets/widgets/qmaccocoaviewcontainer_mac.mm
@@ -92,21 +92,6 @@
QT_BEGIN_NAMESPACE
-namespace {
-// TODO use QtMacExtras copy of this function when available.
-inline QPlatformNativeInterface::NativeResourceForIntegrationFunction resolvePlatformFunction(const QByteArray &functionName)
-{
- QPlatformNativeInterface *nativeInterface = QGuiApplication::platformNativeInterface();
- QPlatformNativeInterface::NativeResourceForIntegrationFunction function =
- nativeInterface->nativeResourceFunctionForIntegration(functionName);
- if (Q_UNLIKELY(!function))
- qWarning("Qt could not resolve function %s from "
- "QGuiApplication::platformNativeInterface()->nativeResourceFunctionForIntegration()",
- functionName.constData());
- return function;
-}
-} //namespsace
-
class QMacCocoaViewContainerPrivate : public QWidgetPrivate
{
Q_DECLARE_PUBLIC(QMacCocoaViewContainer)
@@ -137,12 +122,8 @@ QMacCocoaViewContainerPrivate::~QMacCocoaViewContainerPrivate()
QMacCocoaViewContainer::QMacCocoaViewContainer(NSView *view, QWidget *parent)
: QWidget(*new QMacCocoaViewContainerPrivate, parent, 0)
{
-
- if (view)
- setCocoaView(view);
-
- // QMacCocoaViewContainer requires a native window handle.
setAttribute(Qt::WA_NativeWindow);
+ setCocoaView(view);
}
/*!
@@ -173,13 +154,23 @@ void QMacCocoaViewContainer::setCocoaView(NSView *view)
[view retain];
d->nsview = view;
- // Create window and platformwindow
- winId();
- QPlatformWindow *platformWindow = this->windowHandle()->handle();
-
- // Set the new view as the content view for the window.
- typedef void (*SetWindowContentViewFunction)(QPlatformWindow *window, NSView *nsview);
- reinterpret_cast<SetWindowContentViewFunction>(resolvePlatformFunction("setwindowcontentview"))(platformWindow, view);
+ QWindow *window = windowHandle();
+
+ // Note that we only set the flag on the QWindow, and not the QWidget.
+ // These two are not in sync, so from a QWidget standpoint the widget
+ // is not a Window, and hence will be shown when the parent widget is
+ // shown, like all QWidget children.
+ window->setFlags(Qt::ForeignWindow);
+ window->setProperty("_q_foreignWinId", view ? WId(view) : QVariant());
+
+ // Destroying the platform window implies hiding the window, and we
+ // also lose the geometry information that the platform window kept,
+ // and fall back to the stale QWindow geometry, so we update the two
+ // based on the widget visibility and geometry, which is up to date.
+ window->destroy();
+ window->setVisible(isVisible());
+ window->setGeometry(geometry());
+ window->create();
[oldView release];
}
diff --git a/src/widgets/widgets/qtextedit.cpp b/src/widgets/widgets/qtextedit.cpp
index af6d13a647..f354495e70 100644
--- a/src/widgets/widgets/qtextedit.cpp
+++ b/src/widgets/widgets/qtextedit.cpp
@@ -1514,7 +1514,7 @@ void QTextEditPrivate::paint(QPainter *p, QPaintEvent *e)
if (layout)
layout->setViewport(QRect());
- if (!placeholderText.isEmpty() && doc->isEmpty()) {
+ if (!placeholderText.isEmpty() && doc->isEmpty() && !control->isPreediting()) {
QColor col = control->palette().text().color();
col.setAlpha(128);
p->setPen(col);
diff --git a/src/widgets/widgets/qwidgettextcontrol.cpp b/src/widgets/widgets/qwidgettextcontrol.cpp
index d5ecb150a8..47806a194e 100644
--- a/src/widgets/widgets/qwidgettextcontrol.cpp
+++ b/src/widgets/widgets/qwidgettextcontrol.cpp
@@ -2584,6 +2584,11 @@ bool QWidgetTextControl::isWordSelectionEnabled() const
return d->wordSelectionEnabled;
}
+bool QWidgetTextControl::isPreediting()
+{
+ return d_func()->isPreediting();
+}
+
#ifndef QT_NO_PRINTER
void QWidgetTextControl::print(QPagedPaintDevice *printer) const
{
diff --git a/src/widgets/widgets/qwidgettextcontrol_p.h b/src/widgets/widgets/qwidgettextcontrol_p.h
index e1687f83a3..b45f4fff74 100644
--- a/src/widgets/widgets/qwidgettextcontrol_p.h
+++ b/src/widgets/widgets/qwidgettextcontrol_p.h
@@ -173,6 +173,8 @@ public:
bool isWordSelectionEnabled() const;
void setWordSelectionEnabled(bool enabled);
+ bool isPreediting();
+
void print(QPagedPaintDevice *printer) const;
virtual int hitTest(const QPointF &point, Qt::HitTestAccuracy accuracy) const;