diff options
Diffstat (limited to 'src/widgets/widgets')
-rw-r--r-- | src/widgets/widgets/qdockwidget.cpp | 4 | ||||
-rw-r--r-- | src/widgets/widgets/qmaccocoaviewcontainer_mac.mm | 45 | ||||
-rw-r--r-- | src/widgets/widgets/qtextedit.cpp | 2 | ||||
-rw-r--r-- | src/widgets/widgets/qwidgettextcontrol.cpp | 5 | ||||
-rw-r--r-- | src/widgets/widgets/qwidgettextcontrol_p.h | 2 |
5 files changed, 29 insertions, 29 deletions
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; |