}
/*!
+ Translates the window coordinate \a pos to global screen
+ coordinates using native methods. This is required for embedded windows,
+ where the topmost QWindow coordinates are not global screen coordinates.
+
+ Returns \a pos if there is no platform specific implementation.
+*/
+QPoint QPlatformWindow::mapToGlobal(const QPoint &pos) const
+{
+ return pos;
+}
+
+/*!
+ Translates the global screen coordinate \a pos to window
+ coordinates using native methods. This is required for embedded windows,
+ where the topmost QWindow coordinates are not global screen coordinates.
+
+ Returns \a pos if there is no platform specific implementation.
+*/
+QPoint QPlatformWindow::mapFromGlobal(const QPoint &pos) const
+{
+ return pos;
+}
+
+/*!
Requests setting the window state of this surface
to \a type. Returns the actual state set.
virtual bool isExposed() const;
virtual bool isActive() const;
virtual bool isEmbedded(const QPlatformWindow *parentWindow) const;
+ virtual QPoint mapToGlobal(const QPoint &pos) const;
+ virtual QPoint mapFromGlobal(const QPoint &pos) const;
virtual void propagateSizeHints();
*/
QPoint QWindow::mapToGlobal(const QPoint &pos) const
{
- return pos + d_func()->globalPosition();
+ Q_D(const QWindow);
+ if (d->platformWindow && d->platformWindow->isEmbedded(0))
+ return d->platformWindow->mapToGlobal(pos);
+ else
+ return pos + d_func()->globalPosition();
}
*/
QPoint QWindow::mapFromGlobal(const QPoint &pos) const
{
- return pos - d_func()->globalPosition();
+ Q_D(const QWindow);
+ if (d->platformWindow && d->platformWindow->isEmbedded(0))
+ return d->platformWindow->mapFromGlobal(pos);
+ else
+ return pos - d_func()->globalPosition();
}
return m_data.embedded;
}
+QPoint QWindowsWindow::mapToGlobal(const QPoint &pos) const
+{
+ if (m_data.hwnd)
+ return QWindowsGeometryHint::mapToGlobal(m_data.hwnd, pos);
+ else
+ return pos;
+}
+
+QPoint QWindowsWindow::mapFromGlobal(const QPoint &pos) const
+{
+ if (m_data.hwnd)
+ return QWindowsGeometryHint::mapFromGlobal(m_data.hwnd, pos);
+ else
+ return pos;
+}
+
// partially from QWidgetPrivate::show_sys()
void QWindowsWindow::show_sys() const
{
bool isVisible() const;
virtual bool isActive() const;
virtual bool isEmbedded(const QPlatformWindow *parentWindow) const;
+ virtual QPoint mapToGlobal(const QPoint &pos) const;
+ virtual QPoint mapFromGlobal(const QPoint &pos) const;
+
virtual Qt::WindowFlags setWindowFlags(Qt::WindowFlags flags);
virtual Qt::WindowState setWindowState(Qt::WindowState state);
int x = pos.x(), y = pos.y();
const QWidget *w = this;
while (w) {
+ QWindow *window = w->windowHandle();
+ if (window && window->handle())
+ return window->mapToGlobal(QPoint(x, y));
+
x += w->data->crect.x();
y += w->data->crect.y();
w = w->isWindow() ? 0 : w->parentWidget();
int x = pos.x(), y = pos.y();
const QWidget *w = this;
while (w) {
+ QWindow *window = w->windowHandle();
+ if (window && window->handle())
+ return window->mapFromGlobal(QPoint(x, y));
+
x -= w->data->crect.x();
y -= w->data->crect.y();
w = w->isWindow() ? 0 : w->parentWidget();
QVERIFY(interface);
QCOMPARE(interface->role(), QAccessible::SpinBox);
+ QVERIFY(QTest::qWaitForWindowExposed(spinBox));
+
const QRect widgetRect = spinBox->geometry();
const QRect accessibleRect = interface->rect();
QCOMPARE(accessibleRect, widgetRect);
QAccessibleInterface *interface = QAccessible::queryAccessibleInterface(doubleSpinBox);
QVERIFY(interface);
+ QVERIFY(QTest::qWaitForWindowExposed(doubleSpinBox));
+
const QRect widgetRect = doubleSpinBox->geometry();
const QRect accessibleRect = interface->rect();
QCOMPARE(accessibleRect, widgetRect);
QVERIFY(interface);
QCOMPARE(interface->childCount(), 0);
+ QVERIFY(QTest::qWaitForWindowExposed(&dial));
+
QCOMPARE(interface->text(QAccessible::Value), QString::number(dial.value()));
QCOMPARE(interface->rect(), dial.geometry());
QComboBox combo;
combo.addItems(QStringList() << "one" << "two" << "three");
combo.show();
+
QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(&combo);
QCOMPARE(verifyHierarchy(iface), 0);