Deprecate QApplication::setActiveWindow() and mark as internal
The function is used the internal window activation machinery and should not be called by user code. Many tests still use this function, and should be ported over to QWidget::activateWindow(). For now they are using the private helper in QApplicationPrivate, so that we can progress with the public API deprecation. Change-Id: I29f1575acf9efdcbae4c005ee9b2eb1bb0c8e5b5 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
parent
accc833e55
commit
2436e259ce
@ -1746,6 +1746,8 @@ void QApplicationPrivate::notifyLayoutDirectionChange()
|
||||
}
|
||||
|
||||
/*!
|
||||
\internal
|
||||
|
||||
\fn void QApplication::setActiveWindow(QWidget* active)
|
||||
|
||||
Sets the active window to the \a active widget in response to a system
|
||||
@ -1763,7 +1765,14 @@ void QApplicationPrivate::notifyLayoutDirectionChange()
|
||||
|
||||
\sa activeWindow(), QWidget::activateWindow()
|
||||
*/
|
||||
#if QT_DEPRECATED_SINCE(6,4)
|
||||
void QApplication::setActiveWindow(QWidget* act)
|
||||
{
|
||||
QApplicationPrivate::setActiveWindow(act);
|
||||
}
|
||||
#endif
|
||||
|
||||
void QApplicationPrivate::setActiveWindow(QWidget* act)
|
||||
{
|
||||
QWidget* window = act?act->window():nullptr;
|
||||
|
||||
@ -1781,8 +1790,8 @@ void QApplication::setActiveWindow(QWidget* act)
|
||||
QWidgetList toBeDeactivated;
|
||||
|
||||
if (QApplicationPrivate::active_window) {
|
||||
if (style()->styleHint(QStyle::SH_Widget_ShareActivation, nullptr, QApplicationPrivate::active_window)) {
|
||||
const QWidgetList list = topLevelWidgets();
|
||||
if (QApplication::style()->styleHint(QStyle::SH_Widget_ShareActivation, nullptr, QApplicationPrivate::active_window)) {
|
||||
const QWidgetList list = QApplication::topLevelWidgets();
|
||||
for (auto *w : list) {
|
||||
if (w->isVisible() && w->isActiveWindow())
|
||||
toBeDeactivated.append(w);
|
||||
@ -1803,8 +1812,8 @@ void QApplication::setActiveWindow(QWidget* act)
|
||||
QApplicationPrivate::active_window = window;
|
||||
|
||||
if (QApplicationPrivate::active_window) {
|
||||
if (style()->styleHint(QStyle::SH_Widget_ShareActivation, nullptr, QApplicationPrivate::active_window)) {
|
||||
const QWidgetList list = topLevelWidgets();
|
||||
if (QApplication::style()->styleHint(QStyle::SH_Widget_ShareActivation, nullptr, QApplicationPrivate::active_window)) {
|
||||
const QWidgetList list = QApplication::topLevelWidgets();
|
||||
for (auto *w : list) {
|
||||
if (w->isVisible() && w->isActiveWindow())
|
||||
toBeActivated.append(w);
|
||||
@ -1822,14 +1831,14 @@ void QApplication::setActiveWindow(QWidget* act)
|
||||
|
||||
for (int i = 0; i < toBeActivated.size(); ++i) {
|
||||
QWidget *w = toBeActivated.at(i);
|
||||
sendSpontaneousEvent(w, &windowActivate);
|
||||
sendSpontaneousEvent(w, &activationChange);
|
||||
QApplication::sendSpontaneousEvent(w, &windowActivate);
|
||||
QApplication::sendSpontaneousEvent(w, &activationChange);
|
||||
}
|
||||
|
||||
for(int i = 0; i < toBeDeactivated.size(); ++i) {
|
||||
QWidget *w = toBeDeactivated.at(i);
|
||||
sendSpontaneousEvent(w, &windowDeactivate);
|
||||
sendSpontaneousEvent(w, &activationChange);
|
||||
QApplication::sendSpontaneousEvent(w, &windowDeactivate);
|
||||
QApplication::sendSpontaneousEvent(w, &activationChange);
|
||||
}
|
||||
|
||||
if (QApplicationPrivate::popupWidgets == nullptr) { // !inPopupMode()
|
||||
@ -1892,7 +1901,7 @@ void QApplicationPrivate::notifyActiveWindowChange(QWindow *previous)
|
||||
#endif
|
||||
QWindow *focusWindow = QGuiApplicationPrivate::focus_window;
|
||||
QWidget *focusWidget = qt_tlw_for_window(focusWindow);
|
||||
QApplication::setActiveWindow(focusWidget);
|
||||
QApplicationPrivate::setActiveWindow(focusWidget);
|
||||
// QTBUG-37126, Active X controls may set the focus on native child widgets.
|
||||
if (focusWindow && focusWidget && focusWindow != focusWidget->windowHandle()) {
|
||||
if (QWidgetWindow *widgetWindow = qobject_cast<QWidgetWindow *>(focusWindow))
|
||||
|
@ -78,7 +78,11 @@ public:
|
||||
static QWidget *focusWidget();
|
||||
|
||||
static QWidget *activeWindow();
|
||||
|
||||
#if QT_DEPRECATED_SINCE(6,4)
|
||||
QT_DEPRECATED_VERSION_X_6_4("Use QWidget::activateWindow() instead.")
|
||||
static void setActiveWindow(QWidget* act);
|
||||
#endif
|
||||
|
||||
static QWidget *widgetAt(const QPoint &p);
|
||||
static inline QWidget *widgetAt(int x, int y) { return widgetAt(QPoint(x, y)); }
|
||||
|
@ -103,6 +103,8 @@ public:
|
||||
void initialize();
|
||||
void process_cmdline();
|
||||
|
||||
static void setActiveWindow(QWidget* act);
|
||||
|
||||
static bool inPopupMode();
|
||||
bool popupActive() override { return inPopupMode(); }
|
||||
bool closeAllPopups() override;
|
||||
|
@ -2315,7 +2315,7 @@ void QWidgetPrivate::deactivateWidgetCleanup()
|
||||
Q_Q(QWidget);
|
||||
// If this was the active application window, reset it
|
||||
if (QApplication::activeWindow() == q)
|
||||
QApplication::setActiveWindow(nullptr);
|
||||
QApplicationPrivate::setActiveWindow(nullptr);
|
||||
// If the is the active mouse press widget, reset it
|
||||
if (q == qt_button_down)
|
||||
qt_button_down = nullptr;
|
||||
@ -12278,7 +12278,7 @@ void QWidget::destroy(bool destroyWindow, bool destroySubWindows)
|
||||
qApp->d_func()->closePopup(this);
|
||||
|
||||
if (this == QApplicationPrivate::active_window)
|
||||
QApplication::setActiveWindow(nullptr);
|
||||
QApplicationPrivate::setActiveWindow(nullptr);
|
||||
if (QWidget::mouseGrabber() == this)
|
||||
releaseMouse();
|
||||
if (QWidget::keyboardGrabber() == this)
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include <QtGui/private/qguiapplication_p.h>
|
||||
#include <QtGui/private/qhighdpiscaling_p.h>
|
||||
|
||||
#include <QtWidgets/private/qapplication_p.h>
|
||||
#include <QtWidgets/private/qdialog_p.h>
|
||||
|
||||
#if defined(Q_OS_WIN) && defined(interface)
|
||||
@ -914,7 +915,7 @@ void tst_QAccessibility::applicationTest()
|
||||
|
||||
QWidget widget;
|
||||
widget.show();
|
||||
qApp->setActiveWindow(&widget);
|
||||
QApplicationPrivate::setActiveWindow(&widget);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&widget));
|
||||
|
||||
QAccessibleInterface *widgetIface = QAccessible::queryAccessibleInterface(&widget);
|
||||
@ -941,7 +942,7 @@ void tst_QAccessibility::mainWindowTest()
|
||||
auto mw = mwHolder.get();
|
||||
mw->resize(300, 200);
|
||||
mw->show(); // triggers layout
|
||||
qApp->setActiveWindow(mw);
|
||||
QApplicationPrivate::setActiveWindow(mw);
|
||||
|
||||
QLatin1String name = QLatin1String("I am the main window");
|
||||
mw->setWindowTitle(name);
|
||||
@ -1958,7 +1959,7 @@ void tst_QAccessibility::mdiSubWindowTest()
|
||||
{
|
||||
QMdiArea mdiArea;
|
||||
mdiArea.show();
|
||||
qApp->setActiveWindow(&mdiArea);
|
||||
QApplicationPrivate::setActiveWindow(&mdiArea);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&mdiArea));
|
||||
|
||||
|
||||
@ -2026,7 +2027,7 @@ void tst_QAccessibility::mdiSubWindowTest()
|
||||
testWindow->setEnabled(false);
|
||||
QVERIFY(interface->state().disabled);
|
||||
testWindow->setEnabled(true);
|
||||
qApp->setActiveWindow(&mdiArea);
|
||||
QApplicationPrivate::setActiveWindow(&mdiArea);
|
||||
mdiArea.setActiveSubWindow(testWindow);
|
||||
testWindow->setFocus();
|
||||
QVERIFY(testWindow->isAncestorOf(qApp->focusWidget()));
|
||||
|
@ -14,4 +14,5 @@ qt_internal_add_test(tst_qfocusevent
|
||||
Qt::Gui
|
||||
Qt::GuiPrivate
|
||||
Qt::Widgets
|
||||
Qt::WidgetsPrivate
|
||||
)
|
||||
|
@ -16,6 +16,8 @@
|
||||
#include <qpa/qplatformintegration.h>
|
||||
#include <private/qguiapplication_p.h>
|
||||
|
||||
#include <QtWidgets/private/qapplication_p.h>
|
||||
|
||||
QT_FORWARD_DECLARE_CLASS(QWidget)
|
||||
|
||||
class FocusLineEdit : public QLineEdit
|
||||
@ -112,7 +114,7 @@ void tst_QFocusEvent::initWidget()
|
||||
{
|
||||
// On X11 we have to ensure the event was processed before doing any checking, on Windows
|
||||
// this is processed straight away.
|
||||
QApplication::setActiveWindow(testFocusWidget);
|
||||
QApplicationPrivate::setActiveWindow(testFocusWidget);
|
||||
childFocusWidgetOne->setFocus(); // The first lineedit should have focus
|
||||
QVERIFY(QTest::qWaitForWindowActive(testFocusWidget));
|
||||
QTRY_VERIFY(childFocusWidgetOne->hasFocus());
|
||||
@ -310,7 +312,7 @@ void tst_QFocusEvent::checkReason_ActiveWindow()
|
||||
QVERIFY(QTest::qWaitForWindowExposed(d));
|
||||
|
||||
d->activateWindow(); // ### CDE
|
||||
QApplication::setActiveWindow(d);
|
||||
QApplicationPrivate::setActiveWindow(d);
|
||||
QVERIFY(QTest::qWaitForWindowActive(d));
|
||||
|
||||
QTRY_VERIFY(childFocusWidgetOne->focusOutEventRecieved);
|
||||
|
@ -15,4 +15,5 @@ qt_internal_add_test(tst_qdialog
|
||||
Qt::Gui
|
||||
Qt::GuiPrivate
|
||||
Qt::Widgets
|
||||
Qt::WidgetsPrivate
|
||||
)
|
||||
|
@ -22,6 +22,8 @@
|
||||
#include <qpa/qplatformtheme.h>
|
||||
#include <qpa/qplatformtheme_p.h>
|
||||
|
||||
#include <QtWidgets/private/qapplication_p.h>
|
||||
|
||||
QT_FORWARD_DECLARE_CLASS(QDialog)
|
||||
|
||||
// work around function being protected
|
||||
@ -133,7 +135,7 @@ void tst_QDialog::defaultButtons()
|
||||
pushThree->setAutoDefault(false);
|
||||
|
||||
testWidget.show();
|
||||
QApplication::setActiveWindow(&testWidget);
|
||||
QApplicationPrivate::setActiveWindow(&testWidget);
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&testWidget));
|
||||
|
||||
push->setDefault(true);
|
||||
|
@ -38,6 +38,8 @@
|
||||
#include <QFileDialog>
|
||||
#include <QFileSystemModel>
|
||||
|
||||
#include <QtWidgets/private/qapplication_p.h>
|
||||
|
||||
#if defined(Q_OS_UNIX)
|
||||
#include <unistd.h> // for pathconf() on OS X
|
||||
#ifdef QT_BUILD_INTERNAL
|
||||
@ -1118,7 +1120,7 @@ void tst_QFiledialog::focus()
|
||||
QFileDialog fd;
|
||||
fd.setDirectory(QDir::currentPath());
|
||||
fd.show();
|
||||
QApplication::setActiveWindow(&fd);
|
||||
QApplicationPrivate::setActiveWindow(&fd);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&fd));
|
||||
QCOMPARE(fd.isVisible(), true);
|
||||
QCOMPARE(QApplication::activeWindow(), static_cast<QWidget*>(&fd));
|
||||
|
@ -37,6 +37,8 @@
|
||||
|
||||
#include "../../../../shared/filesystem.h"
|
||||
|
||||
#include <QtWidgets/private/qapplication_p.h>
|
||||
|
||||
#if defined QT_BUILD_INTERNAL
|
||||
QT_BEGIN_NAMESPACE
|
||||
Q_GUI_EXPORT bool qt_test_isFetchedRoot();
|
||||
@ -1265,7 +1267,7 @@ void tst_QFileDialog2::QTBUG6558_showDirsOnly()
|
||||
fd.setOption(QFileDialog::ShowDirsOnly, true);
|
||||
fd.show();
|
||||
|
||||
QApplication::setActiveWindow(&fd);
|
||||
QApplicationPrivate::setActiveWindow(&fd);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&fd));
|
||||
QCOMPARE(fd.isVisible(), true);
|
||||
QCOMPARE(QApplication::activeWindow(), static_cast<QWidget*>(&fd));
|
||||
@ -1309,7 +1311,7 @@ void tst_QFileDialog2::QTBUG4842_selectFilterWithHideNameFilterDetails()
|
||||
fd.selectNameFilter(chosenFilterString);
|
||||
fd.show();
|
||||
|
||||
QApplication::setActiveWindow(&fd);
|
||||
QApplicationPrivate::setActiveWindow(&fd);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&fd));
|
||||
QCOMPARE(fd.isVisible(), true);
|
||||
QCOMPARE(QApplication::activeWindow(), static_cast<QWidget*>(&fd));
|
||||
@ -1325,7 +1327,7 @@ void tst_QFileDialog2::QTBUG4842_selectFilterWithHideNameFilterDetails()
|
||||
fd2.selectNameFilter(chosenFilterString);
|
||||
fd2.show();
|
||||
|
||||
QApplication::setActiveWindow(&fd2);
|
||||
QApplicationPrivate::setActiveWindow(&fd2);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&fd2));
|
||||
QCOMPARE(fd2.isVisible(), true);
|
||||
QCOMPARE(QApplication::activeWindow(), static_cast<QWidget*>(&fd2));
|
||||
@ -1345,7 +1347,7 @@ void tst_QFileDialog2::dontShowCompleterOnRoot()
|
||||
fd.setAcceptMode(QFileDialog::AcceptSave);
|
||||
fd.show();
|
||||
|
||||
QApplication::setActiveWindow(&fd);
|
||||
QApplicationPrivate::setActiveWindow(&fd);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&fd));
|
||||
QCOMPARE(fd.isVisible(), true);
|
||||
QCOMPARE(QApplication::activeWindow(), static_cast<QWidget*>(&fd));
|
||||
|
@ -22,6 +22,7 @@ qt_internal_add_test(tst_qwizard
|
||||
LIBRARIES
|
||||
Qt::Gui
|
||||
Qt::Widgets
|
||||
Qt::WidgetsPrivate
|
||||
TESTDATA ${qwizard_resource_files}
|
||||
BUILTIN_TESTDATA
|
||||
)
|
||||
|
@ -17,6 +17,8 @@
|
||||
#include <QSignalSpy>
|
||||
#include <QOperatingSystemVersion>
|
||||
|
||||
#include <QtWidgets/private/qapplication_p.h>
|
||||
|
||||
Q_DECLARE_METATYPE(QWizard::WizardButton);
|
||||
|
||||
static QImage grabWidget(QWidget *window)
|
||||
@ -978,7 +980,7 @@ void tst_QWizard::setOption_IgnoreSubTitles()
|
||||
// Check that subtitles are shown when they should (i.e.,
|
||||
// they're set and IgnoreSubTitles is off).
|
||||
|
||||
qApp->setActiveWindow(0); // ensure no focus rectangle around cancel button
|
||||
QApplicationPrivate::setActiveWindow(0); // ensure no focus rectangle around cancel button
|
||||
QImage i11 = grabWidget(&wizard1);
|
||||
QImage i21 = grabWidget(&wizard2);
|
||||
QVERIFY(i11 != i21);
|
||||
|
@ -40,6 +40,8 @@
|
||||
|
||||
#include <QtGui/private/qeventpoint_p.h>
|
||||
|
||||
#include <QtWidgets/private/qapplication_p.h>
|
||||
|
||||
using AbstractGraphicsShapeItemPtr = QSharedPointer<QAbstractGraphicsShapeItem>;
|
||||
using GraphicsItems = QList<QGraphicsItem *>;
|
||||
using GraphicsItemsList = QList<QGraphicsItem *>;
|
||||
@ -991,7 +993,7 @@ void tst_QGraphicsItem::inputMethodHints()
|
||||
scene.addItem(item);
|
||||
scene.addItem(item2);
|
||||
QGraphicsView view(&scene);
|
||||
QApplication::setActiveWindow(&view);
|
||||
QApplicationPrivate::setActiveWindow(&view);
|
||||
view.setWindowTitle(QLatin1String(QTest::currentTestFunction()));
|
||||
view.show();
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&view));
|
||||
@ -1048,7 +1050,7 @@ void tst_QGraphicsItem::toolTip()
|
||||
view.setWindowTitle(QLatin1String(QTest::currentTestFunction()));
|
||||
view.setFixedSize(200, 200);
|
||||
view.show();
|
||||
QApplication::setActiveWindow(&view);
|
||||
QApplicationPrivate::setActiveWindow(&view);
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&view));
|
||||
QVERIFY(QTest::qWaitForWindowActive(&view));
|
||||
{
|
||||
@ -4944,7 +4946,7 @@ void tst_QGraphicsItem::sceneEventFilter()
|
||||
QGraphicsView view(&scene);
|
||||
view.setWindowTitle(QLatin1String(QTest::currentTestFunction()));
|
||||
view.show();
|
||||
QApplication::setActiveWindow(&view);
|
||||
QApplicationPrivate::setActiveWindow(&view);
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&view));
|
||||
QVERIFY(QTest::qWaitForWindowActive(&view));
|
||||
|
||||
@ -5565,7 +5567,7 @@ void tst_QGraphicsItem::itemClipsChildrenToShape4()
|
||||
scene.addEllipse( 100, 100, 100, 50 ); // <-- this is important to trigger the right codepath*
|
||||
//now the label is shown
|
||||
outerWidget->setFlag(QGraphicsItem::ItemClipsChildrenToShape, false );
|
||||
QApplication::setActiveWindow(&view);
|
||||
QApplicationPrivate::setActiveWindow(&view);
|
||||
view.setWindowTitle(QLatin1String(QTest::currentTestFunction()));
|
||||
view.show();
|
||||
QTRY_COMPARE(QApplication::activeWindow(), &view);
|
||||
@ -10929,7 +10931,7 @@ void tst_QGraphicsItem::focusHandling()
|
||||
view.show();
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&view));
|
||||
|
||||
QApplication::setActiveWindow(&view);
|
||||
QApplicationPrivate::setActiveWindow(&view);
|
||||
QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&view));
|
||||
QVERIFY(itemWithFocus->hasFocus());
|
||||
|
||||
@ -11445,7 +11447,7 @@ void tst_QGraphicsItem::QTBUG_7714_fullUpdateDiscardingOpacityUpdate2()
|
||||
|
||||
view.show();
|
||||
if (QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::WindowActivation)) {
|
||||
qApp->setActiveWindow(&view);
|
||||
QApplicationPrivate::setActiveWindow(&view);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&view));
|
||||
}
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&view));
|
||||
|
@ -9,6 +9,8 @@
|
||||
#include <private/qgraphicsproxywidget_p.h>
|
||||
#include <private/qlayoutengine_p.h> // qSmartMin functions...
|
||||
|
||||
#include <QtWidgets/private/qapplication_p.h>
|
||||
|
||||
Q_LOGGING_CATEGORY(lcTests, "qt.widgets.tests")
|
||||
|
||||
/*
|
||||
@ -333,7 +335,7 @@ void tst_QGraphicsProxyWidget::setWidget()
|
||||
widget->setStyle(style.data());
|
||||
widget->setFont(QFont("Times"));
|
||||
widget->setVisible(true);
|
||||
QApplication::setActiveWindow(widget);
|
||||
QApplicationPrivate::setActiveWindow(widget);
|
||||
widget->activateWindow();
|
||||
widget->setEnabled(true);
|
||||
widget->resize(325, 241);
|
||||
@ -707,7 +709,7 @@ void tst_QGraphicsProxyWidget::focusNextPrevChild()
|
||||
QGraphicsScene scene;
|
||||
QGraphicsView view(&scene);
|
||||
view.show();
|
||||
QApplication::setActiveWindow(&view);
|
||||
QApplicationPrivate::setActiveWindow(&view);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&view));
|
||||
if (hasScene) {
|
||||
scene.addItem(proxyGuard.release());
|
||||
@ -749,7 +751,7 @@ void tst_QGraphicsProxyWidget::focusOutEvent()
|
||||
SubQGraphicsProxyWidget *proxy = new SubQGraphicsProxyWidget;
|
||||
scene.addItem(proxy);
|
||||
view.show();
|
||||
QApplication::setActiveWindow(&view);
|
||||
QApplicationPrivate::setActiveWindow(&view);
|
||||
view.activateWindow();
|
||||
view.setFocus();
|
||||
QVERIFY(QTest::qWaitForWindowActive(&view));
|
||||
@ -925,7 +927,7 @@ void tst_QGraphicsProxyWidget::hoverEnterLeaveEvent()
|
||||
QGraphicsScene scene;
|
||||
QGraphicsView view(&scene);
|
||||
view.show();
|
||||
QApplication::setActiveWindow(&view);
|
||||
QApplicationPrivate::setActiveWindow(&view);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&view));
|
||||
|
||||
SubQGraphicsProxyWidget *proxy = new SubQGraphicsProxyWidget;
|
||||
@ -979,7 +981,7 @@ void tst_QGraphicsProxyWidget::keyPressEvent()
|
||||
QGraphicsView view(&scene);
|
||||
view.show();
|
||||
view.viewport()->setFocus();
|
||||
QApplication::setActiveWindow(&view);
|
||||
QApplicationPrivate::setActiveWindow(&view);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&view));
|
||||
QCOMPARE(QApplication::activeWindow(), (QWidget*)&view);
|
||||
|
||||
@ -1018,7 +1020,7 @@ void tst_QGraphicsProxyWidget::keyReleaseEvent()
|
||||
QGraphicsScene scene;
|
||||
QGraphicsView view(&scene);
|
||||
view.show();
|
||||
QApplication::setActiveWindow(&view);
|
||||
QApplicationPrivate::setActiveWindow(&view);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&view));
|
||||
QCOMPARE(QApplication::activeWindow(), (QWidget*)&view);
|
||||
|
||||
@ -1064,7 +1066,7 @@ void tst_QGraphicsProxyWidget::mouseDoubleClickEvent()
|
||||
view.resize(100, 100);
|
||||
view.show();
|
||||
|
||||
QApplication::setActiveWindow(&view);
|
||||
QApplicationPrivate::setActiveWindow(&view);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&view));
|
||||
QCOMPARE(QApplication::activeWindow(), (QWidget*)&view);
|
||||
// wait for scene to be updated before doing any coordinate mappings on it
|
||||
@ -1150,7 +1152,7 @@ void tst_QGraphicsProxyWidget::paintEvent()
|
||||
QGraphicsScene scene;
|
||||
QGraphicsView view(&scene);
|
||||
view.show();
|
||||
QApplication::setActiveWindow(&view);
|
||||
QApplicationPrivate::setActiveWindow(&view);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&view));
|
||||
QVERIFY(view.isActiveWindow());
|
||||
|
||||
@ -1534,7 +1536,7 @@ void tst_QGraphicsProxyWidget::tabFocus_simpleWidget()
|
||||
window.setLayout(layout);
|
||||
|
||||
window.show();
|
||||
QApplication::setActiveWindow(&window);
|
||||
QApplicationPrivate::setActiveWindow(&window);
|
||||
window.activateWindow();
|
||||
QVERIFY(QTest::qWaitForWindowActive(&window));
|
||||
|
||||
@ -1618,7 +1620,7 @@ void tst_QGraphicsProxyWidget::tabFocus_simpleTwoWidgets()
|
||||
window.setLayout(layout);
|
||||
|
||||
window.show();
|
||||
QApplication::setActiveWindow(&window);
|
||||
QApplicationPrivate::setActiveWindow(&window);
|
||||
window.activateWindow();
|
||||
QVERIFY(QTest::qWaitForWindowActive(&window));
|
||||
|
||||
@ -1751,7 +1753,7 @@ void tst_QGraphicsProxyWidget::tabFocus_complexWidget()
|
||||
window.setLayout(layout);
|
||||
|
||||
window.show();
|
||||
QApplication::setActiveWindow(&window);
|
||||
QApplicationPrivate::setActiveWindow(&window);
|
||||
window.activateWindow();
|
||||
QVERIFY(QTest::qWaitForWindowActive(&window));
|
||||
|
||||
@ -1888,7 +1890,7 @@ void tst_QGraphicsProxyWidget::tabFocus_complexTwoWidgets()
|
||||
window.setLayout(layout);
|
||||
|
||||
window.show();
|
||||
QApplication::setActiveWindow(&window);
|
||||
QApplicationPrivate::setActiveWindow(&window);
|
||||
window.activateWindow();
|
||||
QVERIFY(QTest::qWaitForWindowActive(&window));
|
||||
|
||||
@ -2062,7 +2064,7 @@ void tst_QGraphicsProxyWidget::setFocus_simpleWidget()
|
||||
window.setLayout(layout);
|
||||
|
||||
window.show();
|
||||
QApplication::setActiveWindow(&window);
|
||||
QApplicationPrivate::setActiveWindow(&window);
|
||||
window.activateWindow();
|
||||
QVERIFY(QTest::qWaitForWindowActive(&window));
|
||||
QCOMPARE(QApplication::activeWindow(), &window);
|
||||
@ -2134,7 +2136,7 @@ void tst_QGraphicsProxyWidget::setFocus_simpleTwoWidgets()
|
||||
window.setLayout(layout);
|
||||
|
||||
window.show();
|
||||
QApplication::setActiveWindow(&window);
|
||||
QApplicationPrivate::setActiveWindow(&window);
|
||||
window.activateWindow();
|
||||
QVERIFY(QTest::qWaitForWindowActive(&window));
|
||||
QCOMPARE(QApplication::activeWindow(), &window);
|
||||
@ -2213,7 +2215,7 @@ void tst_QGraphicsProxyWidget::setFocus_complexTwoWidgets()
|
||||
window.setLayout(layout);
|
||||
|
||||
window.show();
|
||||
QApplication::setActiveWindow(&window);
|
||||
QApplicationPrivate::setActiveWindow(&window);
|
||||
window.activateWindow();
|
||||
QVERIFY(QTest::qWaitForWindowActive(&window));
|
||||
QCOMPARE(QApplication::activeWindow(), &window);
|
||||
@ -2458,7 +2460,7 @@ void tst_QGraphicsProxyWidget::tooltip_basic()
|
||||
QGraphicsView view(&scene);
|
||||
view.setFixedSize(200, 200);
|
||||
view.show();
|
||||
QApplication::setActiveWindow(&view);
|
||||
QApplicationPrivate::setActiveWindow(&view);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&view));
|
||||
{
|
||||
QHelpEvent helpEvent(QEvent::ToolTip, view.viewport()->rect().topLeft(),
|
||||
@ -2595,7 +2597,7 @@ void tst_QGraphicsProxyWidget::windowOpacity()
|
||||
QGraphicsProxyWidget *proxy = scene.addWidget(widget);
|
||||
proxy->setCacheMode(QGraphicsItem::ItemCoordinateCache);
|
||||
|
||||
QApplication::setActiveWindow(&view);
|
||||
QApplicationPrivate::setActiveWindow(&view);
|
||||
view.show();
|
||||
QVERIFY(QTest::qWaitForWindowActive(&view));
|
||||
QVERIFY(view.isActiveWindow());
|
||||
@ -2993,7 +2995,7 @@ void tst_QGraphicsProxyWidget::actionsContextMenu()
|
||||
view.resize(200, 200);
|
||||
view.move(QGuiApplication::primaryScreen()->geometry().center() - QPoint(100, 100));
|
||||
view.show();
|
||||
QApplication::setActiveWindow(&view);
|
||||
QApplicationPrivate::setActiveWindow(&view);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&view));
|
||||
view.setFocus();
|
||||
QTRY_VERIFY(view.hasFocus());
|
||||
@ -3072,7 +3074,7 @@ void tst_QGraphicsProxyWidget::bypassGraphicsProxyWidget()
|
||||
QGraphicsScene scene;
|
||||
QGraphicsView view(&scene);
|
||||
view.show();
|
||||
QApplication::setActiveWindow(&view);
|
||||
QApplicationPrivate::setActiveWindow(&view);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&view));
|
||||
|
||||
QGraphicsProxyWidget *proxy = scene.addWidget(widgetGuard.release());
|
||||
@ -3335,7 +3337,7 @@ void tst_QGraphicsProxyWidget::clickFocus()
|
||||
view.setFrameStyle(0);
|
||||
view.resize(300, 300);
|
||||
view.show();
|
||||
QApplication::setActiveWindow(&view);
|
||||
QApplicationPrivate::setActiveWindow(&view);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&view));
|
||||
|
||||
QVERIFY(!proxy->hasFocus());
|
||||
@ -3479,7 +3481,7 @@ void tst_QGraphicsProxyWidget::QTBUG_6986_sendMouseEventToAlienWidget()
|
||||
|
||||
QGraphicsView view(&scene);
|
||||
view.resize(600, 600);
|
||||
QApplication::setActiveWindow(&view);
|
||||
QApplicationPrivate::setActiveWindow(&view);
|
||||
view.show();
|
||||
QVERIFY(QTest::qWaitForWindowActive(&view));
|
||||
|
||||
@ -3523,7 +3525,7 @@ void tst_QGraphicsProxyWidget::mapToGlobal() // QTBUG-41135
|
||||
childWidget->resize(embeddedWidget->size() / 2);
|
||||
childWidget->move(embeddedWidget->width() / 4, embeddedWidget->height() / 4); // center in embeddedWidget
|
||||
scene.addWidget(embeddedWidget);
|
||||
QApplication::setActiveWindow(&view);
|
||||
QApplicationPrivate::setActiveWindow(&view);
|
||||
view.show();
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&view));
|
||||
const QPoint embeddedCenter = embeddedWidget->rect().center();
|
||||
|
@ -31,6 +31,8 @@
|
||||
#include "../../../shared/platforminputcontext.h"
|
||||
#include <private/qinputmethod_p.h>
|
||||
|
||||
#include <QtWidgets/private/qapplication_p.h>
|
||||
|
||||
#if defined(Q_OS_WIN)
|
||||
#include <QtCore/qt_windows.h>
|
||||
#define Q_CHECK_PAINTEVENTS \
|
||||
@ -1292,7 +1294,7 @@ void tst_QGraphicsScene::removeItem()
|
||||
view.setWindowTitle(QTest::currentTestFunction());
|
||||
view.setFixedSize(150, 150);
|
||||
view.show();
|
||||
QApplication::setActiveWindow(&view);
|
||||
QApplicationPrivate::setActiveWindow(&view);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&view));
|
||||
QTest::mouseMove(view.windowHandle(), view.mapFromScene(hoverItem->scenePos() + QPointF(20, 20)));
|
||||
QTRY_VERIFY(!hoverItem->isHovered);
|
||||
@ -1600,7 +1602,7 @@ void tst_QGraphicsScene::hoverEvents_siblings()
|
||||
view.rotate(10);
|
||||
view.scale(1.7, 1.7);
|
||||
view.show();
|
||||
QApplication::setActiveWindow(&view);
|
||||
QApplicationPrivate::setActiveWindow(&view);
|
||||
view.activateWindow();
|
||||
QVERIFY(QTest::qWaitForWindowActive(&view));
|
||||
|
||||
@ -1670,7 +1672,7 @@ void tst_QGraphicsScene::hoverEvents_parentChild()
|
||||
view.rotate(10);
|
||||
view.scale(1.7, 1.7);
|
||||
view.show();
|
||||
QApplication::setActiveWindow(&view);
|
||||
QApplicationPrivate::setActiveWindow(&view);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&view));
|
||||
|
||||
QGraphicsSceneMouseEvent mouseEvent(QEvent::GraphicsSceneMouseMove);
|
||||
@ -2849,7 +2851,7 @@ void tst_QGraphicsScene::update2()
|
||||
view.resize(m_testSize);
|
||||
view.setScene(&scene);
|
||||
view.show();
|
||||
QApplication::setActiveWindow(&view);
|
||||
QApplicationPrivate::setActiveWindow(&view);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&view));
|
||||
QTRY_VERIFY(view.repaints >= 1);
|
||||
view.repaints = 0;
|
||||
@ -3039,7 +3041,7 @@ void tst_QGraphicsScene::tabFocus_emptyScene()
|
||||
widget.setLayout(layout);
|
||||
widget.setWindowTitle(QTest::currentTestFunction());
|
||||
widget.show();
|
||||
QApplication::setActiveWindow(&widget);
|
||||
QApplicationPrivate::setActiveWindow(&widget);
|
||||
widget.activateWindow();
|
||||
QVERIFY(QTest::qWaitForWindowActive(&widget));
|
||||
|
||||
@ -3091,7 +3093,7 @@ void tst_QGraphicsScene::tabFocus_sceneWithFocusableItems()
|
||||
widget.setWindowTitle(QTest::currentTestFunction());
|
||||
widget.setLayout(layout);
|
||||
widget.show();
|
||||
QApplication::setActiveWindow(&widget);
|
||||
QApplicationPrivate::setActiveWindow(&widget);
|
||||
widget.activateWindow();
|
||||
QVERIFY(QTest::qWaitForWindowActive(&widget));
|
||||
|
||||
@ -3145,7 +3147,7 @@ void tst_QGraphicsScene::tabFocus_sceneWithFocusableItems()
|
||||
|
||||
// Check that the correct item regains focus.
|
||||
widget.show();
|
||||
QApplication::setActiveWindow(&widget);
|
||||
QApplicationPrivate::setActiveWindow(&widget);
|
||||
widget.activateWindow();
|
||||
QVERIFY(QTest::qWaitForWindowActive(&widget));
|
||||
QVERIFY(view->hasFocus());
|
||||
@ -3229,7 +3231,7 @@ void tst_QGraphicsScene::tabFocus_sceneWithFocusWidgets()
|
||||
widget.setWindowTitle(QTest::currentTestFunction());
|
||||
widget.setLayout(layout);
|
||||
widget.show();
|
||||
QApplication::setActiveWindow(&widget);
|
||||
QApplicationPrivate::setActiveWindow(&widget);
|
||||
widget.activateWindow();
|
||||
QVERIFY(QTest::qWaitForWindowActive(&widget));
|
||||
|
||||
@ -3268,7 +3270,7 @@ void tst_QGraphicsScene::tabFocus_sceneWithFocusWidgets()
|
||||
widget.hide();
|
||||
QTest::qWait(15);
|
||||
widget.show();
|
||||
QApplication::setActiveWindow(&widget);
|
||||
QApplicationPrivate::setActiveWindow(&widget);
|
||||
widget.activateWindow();
|
||||
QVERIFY(QTest::qWaitForWindowActive(&widget));
|
||||
QTRY_VERIFY(widget1->hasFocus());
|
||||
@ -3317,7 +3319,7 @@ void tst_QGraphicsScene::tabFocus_sceneWithNestedFocusWidgets()
|
||||
widget.setWindowTitle(QTest::currentTestFunction());
|
||||
widget.setLayout(layout);
|
||||
widget.show();
|
||||
QApplication::setActiveWindow(&widget);
|
||||
QApplicationPrivate::setActiveWindow(&widget);
|
||||
widget.activateWindow();
|
||||
QVERIFY(QTest::qWaitForWindowActive(&widget));
|
||||
|
||||
@ -3402,7 +3404,7 @@ void tst_QGraphicsScene::tabFocus_sceneWithNestedFocusWidgets()
|
||||
widget.hide();
|
||||
QTest::qWait(12);
|
||||
widget.show();
|
||||
QApplication::setActiveWindow(&widget);
|
||||
QApplicationPrivate::setActiveWindow(&widget);
|
||||
widget.activateWindow();
|
||||
QVERIFY(QTest::qWaitForWindowActive(&widget));
|
||||
QTRY_VERIFY(widget1->hasFocus());
|
||||
@ -3820,7 +3822,7 @@ void tst_QGraphicsScene::inputMethod()
|
||||
view.resize(m_testSize);
|
||||
view.show();
|
||||
view.setWindowTitle(QTest::currentTestFunction());
|
||||
QApplication::setActiveWindow(&view);
|
||||
QApplicationPrivate::setActiveWindow(&view);
|
||||
view.setFocus();
|
||||
QVERIFY(QTest::qWaitForWindowActive(&view));
|
||||
QCOMPARE(QApplication::activeWindow(), &view);
|
||||
@ -4064,7 +4066,7 @@ void tst_QGraphicsScene::isActive()
|
||||
view1->setVisible(false);
|
||||
|
||||
toplevel1.show();
|
||||
QApplication::setActiveWindow(&toplevel1);
|
||||
QApplicationPrivate::setActiveWindow(&toplevel1);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&toplevel1));
|
||||
QCOMPARE(QApplication::activeWindow(), &toplevel1);
|
||||
|
||||
@ -4093,7 +4095,7 @@ void tst_QGraphicsScene::isActive()
|
||||
QVERIFY(!scene2.hasFocus());
|
||||
|
||||
toplevel1.show();
|
||||
QApplication::setActiveWindow(&toplevel1);
|
||||
QApplicationPrivate::setActiveWindow(&toplevel1);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&toplevel1));
|
||||
QCOMPARE(QApplication::activeWindow(), &toplevel1);
|
||||
|
||||
@ -4133,7 +4135,7 @@ void tst_QGraphicsScene::isActive()
|
||||
|
||||
toplevel2.move(m_availableGeometry.topLeft() + QPoint(50, 50));
|
||||
toplevel2.show();
|
||||
QApplication::setActiveWindow(&toplevel2);
|
||||
QApplicationPrivate::setActiveWindow(&toplevel2);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&toplevel2));
|
||||
QCOMPARE(QApplication::activeWindow(), &toplevel2);
|
||||
|
||||
@ -4183,7 +4185,7 @@ void tst_QGraphicsScene::isActive()
|
||||
topLevelView.move(toplevel2.geometry().topRight() + QPoint(100, 50));
|
||||
topLevelView.resize(m_testSize);
|
||||
topLevelView.show();
|
||||
QApplication::setActiveWindow(&topLevelView);
|
||||
QApplicationPrivate::setActiveWindow(&topLevelView);
|
||||
topLevelView.setFocus();
|
||||
QVERIFY(QTest::qWaitForWindowActive(&topLevelView));
|
||||
QCOMPARE(QApplication::activeWindow(), &topLevelView);
|
||||
@ -4211,7 +4213,7 @@ void tst_QGraphicsScene::isActive()
|
||||
QVERIFY(scene1.hasFocus());
|
||||
QVERIFY(!scene2.hasFocus());
|
||||
|
||||
QApplication::setActiveWindow(&toplevel2);
|
||||
QApplicationPrivate::setActiveWindow(&toplevel2);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&toplevel2));
|
||||
|
||||
QVERIFY(!scene1.isActive());
|
||||
@ -4241,7 +4243,7 @@ void tst_QGraphicsScene::isActive()
|
||||
|
||||
|
||||
toplevel3.show();
|
||||
QApplication::setActiveWindow(&toplevel3);
|
||||
QApplicationPrivate::setActiveWindow(&toplevel3);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&toplevel3));
|
||||
QCOMPARE(QApplication::activeWindow(), &toplevel3);
|
||||
|
||||
@ -4354,7 +4356,7 @@ void tst_QGraphicsScene::removeFullyTransparentItem()
|
||||
view.resize(m_testSize);
|
||||
view.setScene(&scene);
|
||||
view.show();
|
||||
QApplication::setActiveWindow(&view);
|
||||
QApplicationPrivate::setActiveWindow(&view);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&view));
|
||||
QCoreApplication::processEvents(); // Process all queued paint events
|
||||
|
||||
@ -4812,7 +4814,7 @@ void tst_QGraphicsScene::focusOnTouch()
|
||||
rect->setFlag(QGraphicsItem::ItemIsFocusable, true);
|
||||
|
||||
view.show();
|
||||
QApplication::setActiveWindow(&view);
|
||||
QApplicationPrivate::setActiveWindow(&view);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&view));
|
||||
|
||||
QVERIFY(!rect->hasFocus());
|
||||
@ -4913,7 +4915,7 @@ void tst_QGraphicsScene::taskQTBUG_16401_focusItem()
|
||||
rect->setFlag(QGraphicsItem::ItemIsFocusable);
|
||||
|
||||
view.show();
|
||||
QApplication::setActiveWindow(&view);
|
||||
QApplicationPrivate::setActiveWindow(&view);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&view));
|
||||
|
||||
QVERIFY(!scene.focusItem());
|
||||
@ -4955,7 +4957,7 @@ void tst_QGraphicsScene::taskQTBUG_42915_focusNextPrevChild()
|
||||
widget2->setFocusPolicy(Qt::NoFocus);
|
||||
|
||||
view.show();
|
||||
QApplication::setActiveWindow(&view);
|
||||
QApplicationPrivate::setActiveWindow(&view);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&view));
|
||||
|
||||
QTest::keyEvent(QTest::Click, &view, Qt::Key_Tab);
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include <private/qgraphicsscenebsptreeindex_p.h>
|
||||
#include <private/qgraphicssceneindex_p.h>
|
||||
#include <private/qgraphicsscenelinearindex_p.h>
|
||||
#include <QtWidgets/private/qapplication_p.h>
|
||||
|
||||
class tst_QGraphicsSceneIndex : public QObject
|
||||
{
|
||||
@ -290,7 +291,7 @@ void tst_QGraphicsSceneIndex::removeItems()
|
||||
QGraphicsView view(&scene);
|
||||
view.resize(600, 600);
|
||||
view.show();
|
||||
QApplication::setActiveWindow(&view);
|
||||
QApplicationPrivate::setActiveWindow(&view);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&view));
|
||||
|
||||
scene.removeItem(widgetChild1);
|
||||
@ -322,7 +323,7 @@ void tst_QGraphicsSceneIndex::clear()
|
||||
|
||||
QGraphicsView view(&scene);
|
||||
view.show();
|
||||
qApp->setActiveWindow(&view);
|
||||
QApplicationPrivate::setActiveWindow(&view);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&view));
|
||||
scene.clear();
|
||||
|
||||
|
@ -40,6 +40,8 @@
|
||||
|
||||
#include <QtTest/private/qtesthelpers_p.h>
|
||||
|
||||
#include <QtWidgets/private/qapplication_p.h>
|
||||
|
||||
using namespace QTestPrivate;
|
||||
|
||||
Q_DECLARE_METATYPE(ExpectedValueDescription)
|
||||
@ -2135,7 +2137,7 @@ void tst_QGraphicsView::sendEvent()
|
||||
|
||||
QGraphicsView view(&scene);
|
||||
view.show();
|
||||
QApplication::setActiveWindow(&view);
|
||||
QApplicationPrivate::setActiveWindow(&view);
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&view));
|
||||
QVERIFY(QTest::qWaitForWindowActive(&view));
|
||||
QCOMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&view));
|
||||
@ -2203,7 +2205,7 @@ void tst_QGraphicsView::wheelEvent()
|
||||
// Assign a view.
|
||||
QGraphicsView view(&scene);
|
||||
view.show();
|
||||
QApplication::setActiveWindow(&view);
|
||||
QApplicationPrivate::setActiveWindow(&view);
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&view));
|
||||
QVERIFY(QTest::qWaitForWindowActive(&view));
|
||||
QCOMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&view));
|
||||
@ -2440,7 +2442,7 @@ void tst_QGraphicsView::viewportUpdateMode()
|
||||
|
||||
// Show the view, and initialize our test.
|
||||
view.show();
|
||||
qApp->setActiveWindow(&view);
|
||||
QApplicationPrivate::setActiveWindow(&view);
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&view));
|
||||
QVERIFY(QTest::qWaitForWindowActive(&view));
|
||||
QTRY_VERIFY(!view.lastUpdateRegions.isEmpty());
|
||||
@ -2523,7 +2525,7 @@ void tst_QGraphicsView::viewportUpdateMode2()
|
||||
const QMargins margins = view.contentsMargins();
|
||||
view.resize(200 + margins.left() + margins.right(), 200 + margins.top() + margins.bottom());
|
||||
toplevel.show();
|
||||
qApp->setActiveWindow(&toplevel);
|
||||
QApplicationPrivate::setActiveWindow(&toplevel);
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&toplevel));
|
||||
QVERIFY(QTest::qWaitForWindowActive(&toplevel));
|
||||
QTRY_VERIFY(view.painted);
|
||||
@ -3167,7 +3169,7 @@ void tst_QGraphicsView::task172231_untransformableItems()
|
||||
|
||||
view.scale(2, 1);
|
||||
view.show();
|
||||
QApplication::setActiveWindow(&view);
|
||||
QApplicationPrivate::setActiveWindow(&view);
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&view));
|
||||
QVERIFY(QTest::qWaitForWindowActive(&view));
|
||||
QCOMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&view));
|
||||
@ -3229,7 +3231,7 @@ void tst_QGraphicsView::task187791_setSceneCausesUpdate()
|
||||
QGraphicsScene scene(0, 0, 200, 200);
|
||||
QGraphicsView view(&scene);
|
||||
view.show();
|
||||
qApp->setActiveWindow(&view);
|
||||
QApplicationPrivate::setActiveWindow(&view);
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&view));
|
||||
|
||||
EventSpy updateSpy(view.viewport(), QEvent::Paint);
|
||||
@ -3315,7 +3317,7 @@ void tst_QGraphicsView::task207546_focusCrash()
|
||||
widget.layout()->addWidget(gr2);
|
||||
widget.show();
|
||||
widget.activateWindow();
|
||||
QApplication::setActiveWindow(&widget);
|
||||
QApplicationPrivate::setActiveWindow(&widget);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&widget));
|
||||
QCOMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&widget));
|
||||
widget.focusNextPrevChild(true);
|
||||
@ -3407,7 +3409,7 @@ void tst_QGraphicsView::task239729_noViewUpdate()
|
||||
QCOMPARE(spy.count(), 0);
|
||||
|
||||
view->show();
|
||||
qApp->setActiveWindow(view);
|
||||
QApplicationPrivate::setActiveWindow(view);
|
||||
QVERIFY(QTest::qWaitForWindowActive(view));
|
||||
|
||||
QTRY_VERIFY(spy.count() >= 1);
|
||||
@ -4032,7 +4034,7 @@ void tst_QGraphicsView::exposeRegion()
|
||||
CustomView view;
|
||||
view.setScene(&scene);
|
||||
view.show();
|
||||
qApp->setActiveWindow(&view);
|
||||
QApplicationPrivate::setActiveWindow(&view);
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&view));
|
||||
QVERIFY(QTest::qWaitForWindowActive(&view));
|
||||
|
||||
@ -4106,7 +4108,7 @@ void tst_QGraphicsView::update()
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&toplevel));
|
||||
|
||||
|
||||
QApplication::setActiveWindow(&toplevel);
|
||||
QApplicationPrivate::setActiveWindow(&toplevel);
|
||||
QApplication::processEvents();
|
||||
QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&toplevel));
|
||||
|
||||
@ -4188,7 +4190,7 @@ void tst_QGraphicsView::update2()
|
||||
view.setFrameStyle(0);
|
||||
view.resize(200, 200);
|
||||
view.show();
|
||||
qApp->setActiveWindow(&view);
|
||||
QApplicationPrivate::setActiveWindow(&view);
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&view));
|
||||
QVERIFY(QTest::qWaitForWindowActive(&view));
|
||||
QTRY_VERIFY(rect->numPaints > 0);
|
||||
@ -4258,7 +4260,7 @@ void tst_QGraphicsView::update_ancestorClipsChildrenToShape()
|
||||
|
||||
CustomView view(&scene);
|
||||
view.show();
|
||||
qApp->setActiveWindow(&view);
|
||||
QApplicationPrivate::setActiveWindow(&view);
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&view));
|
||||
QVERIFY(QTest::qWaitForWindowActive(&view));
|
||||
QTRY_VERIFY(view.painted);
|
||||
@ -4312,7 +4314,7 @@ void tst_QGraphicsView::update_ancestorClipsChildrenToShape2()
|
||||
|
||||
CustomView view(&scene);
|
||||
view.show();
|
||||
qApp->setActiveWindow(&view);
|
||||
QApplicationPrivate::setActiveWindow(&view);
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&view));
|
||||
QVERIFY(QTest::qWaitForWindowActive(&view));
|
||||
QTRY_VERIFY(view.painted);
|
||||
@ -4373,7 +4375,7 @@ void tst_QGraphicsView::inputMethodSensitivity()
|
||||
QGraphicsScene scene;
|
||||
QGraphicsView view(&scene);
|
||||
view.show();
|
||||
QApplication::setActiveWindow(&view);
|
||||
QApplicationPrivate::setActiveWindow(&view);
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&view));
|
||||
QVERIFY(QTest::qWaitForWindowActive(&view));
|
||||
QCOMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&view));
|
||||
@ -4471,7 +4473,7 @@ void tst_QGraphicsView::inputContextReset()
|
||||
QVERIFY(view.testAttribute(Qt::WA_InputMethodEnabled));
|
||||
|
||||
view.show();
|
||||
QApplication::setActiveWindow(&view);
|
||||
QApplicationPrivate::setActiveWindow(&view);
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&view));
|
||||
QVERIFY(QTest::qWaitForWindowActive(&view));
|
||||
QCOMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&view));
|
||||
@ -4619,7 +4621,7 @@ void tst_QGraphicsView::task255529_transformationAnchorMouseAndViewportMargins()
|
||||
VpGraphicsView view(&scene);
|
||||
view.setWindowFlags(Qt::X11BypassWindowManagerHint);
|
||||
view.show();
|
||||
qApp->setActiveWindow(&view);
|
||||
QApplicationPrivate::setActiveWindow(&view);
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&view));
|
||||
const bool isActiveWindow = QTest::qWaitForWindowActive(&view);
|
||||
if (!isActiveWindow)
|
||||
@ -4790,7 +4792,7 @@ void tst_QGraphicsView::QTBUG_5859_exposedRect()
|
||||
QGraphicsView view(&scene);
|
||||
view.scale(4.15, 4.15);
|
||||
view.showNormal();
|
||||
QApplication::setActiveWindow(&view);
|
||||
QApplicationPrivate::setActiveWindow(&view);
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&view));
|
||||
QVERIFY(QTest::qWaitForWindowActive(&view));
|
||||
|
||||
@ -4862,7 +4864,7 @@ void tst_QGraphicsView::hoverLeave()
|
||||
scene.addItem(item);
|
||||
|
||||
view.showNormal();
|
||||
qApp->setActiveWindow(&view);
|
||||
QApplicationPrivate::setActiveWindow(&view);
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&view));
|
||||
|
||||
QWindow *viewWindow = view.window()->windowHandle();
|
||||
@ -4941,7 +4943,7 @@ void tst_QGraphicsView::QTBUG_70255_scrollTo()
|
||||
view.centerOn(0, 0);
|
||||
|
||||
view.show();
|
||||
QApplication::setActiveWindow(&view);
|
||||
QApplicationPrivate::setActiveWindow(&view);
|
||||
if (!QTest::qWaitForWindowExposed(&view) || !QTest::qWaitForWindowActive(&view))
|
||||
QSKIP("Failed to show and activate window");
|
||||
|
||||
|
@ -18,6 +18,8 @@
|
||||
#include <qscreen.h>
|
||||
#include <qsignalspy.h>
|
||||
|
||||
#include <QtWidgets/private/qapplication_p.h>
|
||||
|
||||
typedef QList<QGraphicsItem *> QGraphicsItemList;
|
||||
|
||||
class EventSpy : public QObject
|
||||
@ -1371,7 +1373,7 @@ void tst_QGraphicsWidget::setTabOrder()
|
||||
QGraphicsScene scene;
|
||||
QGraphicsView view(&scene);
|
||||
view.show();
|
||||
QApplication::setActiveWindow(&view);
|
||||
QApplicationPrivate::setActiveWindow(&view);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&view));
|
||||
|
||||
QGraphicsWidget *lastItem = nullptr;
|
||||
@ -1443,7 +1445,7 @@ void tst_QGraphicsWidget::setTabOrderAndReparent()
|
||||
QGraphicsScene scene;
|
||||
QGraphicsView view(&scene);
|
||||
view.show();
|
||||
QApplication::setActiveWindow(&view);
|
||||
QApplicationPrivate::setActiveWindow(&view);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&view));
|
||||
QCOMPARE(QApplication::activeWindow(), (QWidget*)&view);
|
||||
|
||||
@ -1573,7 +1575,7 @@ void tst_QGraphicsWidget::verifyFocusChain()
|
||||
QGraphicsScene scene;
|
||||
QGraphicsView view(&scene);
|
||||
view.show();
|
||||
QApplication::setActiveWindow(&view);
|
||||
QApplicationPrivate::setActiveWindow(&view);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&view));
|
||||
|
||||
{
|
||||
@ -1665,7 +1667,7 @@ void tst_QGraphicsWidget::verifyFocusChain()
|
||||
w1_2->setFocusPolicy(Qt::StrongFocus);
|
||||
scene.addItem(w1_2);
|
||||
window->show();
|
||||
QApplication::setActiveWindow(window.data());
|
||||
QApplicationPrivate::setActiveWindow(window.data());
|
||||
QVERIFY(QTest::qWaitForWindowActive(window.data()));
|
||||
|
||||
lineEdit->setFocus();
|
||||
@ -1719,7 +1721,7 @@ void tst_QGraphicsWidget::updateFocusChainWhenChildDie()
|
||||
view.resize(200, 150);
|
||||
view.move(availableGeometry.topLeft() + QPoint(50, 50));
|
||||
view.show();
|
||||
QApplication::setActiveWindow(&view);
|
||||
QApplicationPrivate::setActiveWindow(&view);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&view));
|
||||
|
||||
// delete item in focus chain with no focus and verify chain
|
||||
@ -2679,7 +2681,7 @@ void tst_QGraphicsWidget::task250119_shortcutContext()
|
||||
QGraphicsView view;
|
||||
view.setScene(&scene);
|
||||
view.show();
|
||||
QApplication::setActiveWindow(&view);
|
||||
QApplicationPrivate::setActiveWindow(&view);
|
||||
QTRY_COMPARE(QApplication::activeWindow(), (QWidget*)&view);
|
||||
|
||||
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include <QVBoxLayout>
|
||||
#include <QtTest/private/qtesthelpers_p.h>
|
||||
#include <private/qabstractitemview_p.h>
|
||||
#include <QtWidgets/private/qapplication_p.h>
|
||||
|
||||
Q_DECLARE_METATYPE(Qt::ItemFlags);
|
||||
|
||||
@ -1058,7 +1059,7 @@ void tst_QAbstractItemView::setItemDelegate()
|
||||
centerOnScreen(&v);
|
||||
moveCursorAway(&v);
|
||||
v.show();
|
||||
QApplication::setActiveWindow(&v);
|
||||
QApplicationPrivate::setActiveWindow(&v);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&v));
|
||||
|
||||
QModelIndex index = model.index(cellToEdit.y(), cellToEdit.x());
|
||||
@ -1267,7 +1268,7 @@ void tst_QAbstractItemView::task221955_selectedEditor()
|
||||
tree.show();
|
||||
tree.setFocus();
|
||||
tree.setCurrentIndex(tree.model()->index(1,0));
|
||||
QApplication::setActiveWindow(&tree);
|
||||
QApplicationPrivate::setActiveWindow(&tree);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&tree));
|
||||
|
||||
QVERIFY(! tree.selectionModel()->selectedIndexes().contains(tree.model()->index(3,0)));
|
||||
@ -1566,7 +1567,7 @@ void tst_QAbstractItemView::QTBUG6407_extendedSelection()
|
||||
moveCursorAway(&view);
|
||||
|
||||
view.show();
|
||||
QApplication::setActiveWindow(&view);
|
||||
QApplicationPrivate::setActiveWindow(&view);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&view));
|
||||
QCOMPARE(&view, QApplication::activeWindow());
|
||||
|
||||
@ -1642,7 +1643,7 @@ void tst_QAbstractItemView::testClickedSignal()
|
||||
centerOnScreen(&view);
|
||||
moveCursorAway(&view);
|
||||
view.showNormal();
|
||||
QApplication::setActiveWindow(&view);
|
||||
QApplicationPrivate::setActiveWindow(&view);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&view));
|
||||
QCOMPARE(&view, QApplication::activeWindow());
|
||||
|
||||
@ -1693,7 +1694,7 @@ void tst_QAbstractItemView::testChangeEditorState()
|
||||
centerOnScreen(&view);
|
||||
moveCursorAway(&view);
|
||||
view.show();
|
||||
QApplication::setActiveWindow(&view);
|
||||
QApplicationPrivate::setActiveWindow(&view);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&view));
|
||||
QCOMPARE(&view, QApplication::activeWindow());
|
||||
|
||||
@ -1714,7 +1715,7 @@ void tst_QAbstractItemView::deselectInSingleSelection()
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&view));
|
||||
view.setSelectionMode(QAbstractItemView::SingleSelection);
|
||||
view.setEditTriggers(QAbstractItemView::NoEditTriggers);
|
||||
QApplication::setActiveWindow(&view);
|
||||
QApplicationPrivate::setActiveWindow(&view);
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&view));
|
||||
// mouse
|
||||
QModelIndex index22 = s.index(2, 2);
|
||||
@ -1761,7 +1762,7 @@ void tst_QAbstractItemView::testNoActivateOnDisabledItem()
|
||||
moveCursorAway(&treeView);
|
||||
treeView.show();
|
||||
|
||||
QApplication::setActiveWindow(&treeView);
|
||||
QApplicationPrivate::setActiveWindow(&treeView);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&treeView));
|
||||
|
||||
QSignalSpy activatedSpy(&treeView, &QAbstractItemView::activated);
|
||||
@ -1808,7 +1809,7 @@ void tst_QAbstractItemView::testFocusPolicy()
|
||||
moveCursorAway(&window);
|
||||
|
||||
window.show();
|
||||
QApplication::setActiveWindow(&window);
|
||||
QApplicationPrivate::setActiveWindow(&window);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&window));
|
||||
|
||||
// itemview accepts focus => editor is closed => return focus to the itemview
|
||||
@ -1846,7 +1847,7 @@ void tst_QAbstractItemView::QTBUG31411_noSelection()
|
||||
moveCursorAway(&window);
|
||||
|
||||
window.show();
|
||||
QApplication::setActiveWindow(&window);
|
||||
QApplicationPrivate::setActiveWindow(&window);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&window));
|
||||
|
||||
qRegisterMetaType<QItemSelection>();
|
||||
@ -2446,15 +2447,15 @@ void tst_QAbstractItemView::inputMethodEnabled()
|
||||
|
||||
// Check focus by switching the activation of the window to force a focus in
|
||||
view->setCurrentIndex(model->index(1, 0));
|
||||
QApplication::setActiveWindow(nullptr);
|
||||
QApplication::setActiveWindow(view.data());
|
||||
QApplicationPrivate::setActiveWindow(nullptr);
|
||||
QApplicationPrivate::setActiveWindow(view.data());
|
||||
QVERIFY(QTest::qWaitForWindowActive(view.data()));
|
||||
QCOMPARE(view->testAttribute(Qt::WA_InputMethodEnabled), result);
|
||||
|
||||
view->setCurrentIndex(QModelIndex());
|
||||
QVERIFY(!view->testAttribute(Qt::WA_InputMethodEnabled));
|
||||
QApplication::setActiveWindow(nullptr);
|
||||
QApplication::setActiveWindow(view.data());
|
||||
QApplicationPrivate::setActiveWindow(nullptr);
|
||||
QApplicationPrivate::setActiveWindow(view.data());
|
||||
QVERIFY(QTest::qWaitForWindowActive(view.data()));
|
||||
QModelIndex index = model->index(1, 0);
|
||||
QPoint p = view->visualRect(index).center();
|
||||
@ -2464,8 +2465,8 @@ void tst_QAbstractItemView::inputMethodEnabled()
|
||||
QCOMPARE(view->testAttribute(Qt::WA_InputMethodEnabled), result);
|
||||
|
||||
index = model->index(0, 0);
|
||||
QApplication::setActiveWindow(nullptr);
|
||||
QApplication::setActiveWindow(view.data());
|
||||
QApplicationPrivate::setActiveWindow(nullptr);
|
||||
QApplicationPrivate::setActiveWindow(view.data());
|
||||
QVERIFY(QTest::qWaitForWindowActive(view.data()));
|
||||
p = view->visualRect(index).center();
|
||||
QTest::mouseClick(view->viewport(), Qt::LeftButton, Qt::NoModifier, p);
|
||||
@ -2475,11 +2476,11 @@ void tst_QAbstractItemView::inputMethodEnabled()
|
||||
// There is a case when it goes to the first visible item so we
|
||||
// make the flags of the first item match the ones we are testing
|
||||
// to check the attribute correctly
|
||||
QApplication::setActiveWindow(nullptr);
|
||||
QApplicationPrivate::setActiveWindow(nullptr);
|
||||
view->setCurrentIndex(QModelIndex());
|
||||
view->reset();
|
||||
item->setFlags(Qt::ItemFlags(itemFlags));
|
||||
QApplication::setActiveWindow(view.data());
|
||||
QApplicationPrivate::setActiveWindow(view.data());
|
||||
QVERIFY(QTest::qWaitForWindowActive(view.data()));
|
||||
QCOMPARE(view->testAttribute(Qt::WA_InputMethodEnabled), result);
|
||||
}
|
||||
@ -2590,11 +2591,11 @@ void tst_QAbstractItemView::checkFocusAfterActivationChanges()
|
||||
QVERIFY(QTest::qWaitForWindowExposed(delegate.openedEditor));
|
||||
QVERIFY(delegate.openedEditor->hasFocus());
|
||||
|
||||
QApplication::setActiveWindow(&otherTopLevel);
|
||||
QApplicationPrivate::setActiveWindow(&otherTopLevel);
|
||||
otherTopLevel.setFocus();
|
||||
QTRY_VERIFY(!delegate.openedEditor);
|
||||
|
||||
QApplication::setActiveWindow(&w);
|
||||
QApplicationPrivate::setActiveWindow(&w);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&w));
|
||||
QVERIFY(view->hasFocus());
|
||||
}
|
||||
|
@ -13,4 +13,5 @@ qt_internal_add_test(tst_qdatawidgetmapper
|
||||
LIBRARIES
|
||||
Qt::Gui
|
||||
Qt::Widgets
|
||||
Qt::WidgetsPrivate
|
||||
)
|
||||
|
@ -11,6 +11,8 @@
|
||||
#include <QTextEdit>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include <QtWidgets/private/qapplication_p.h>
|
||||
|
||||
class tst_QDataWidgetMapper: public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -418,7 +420,7 @@ void tst_QDataWidgetMapper::textEditDoesntChangeFocusOnTab_qtbug3305()
|
||||
|
||||
container.show();
|
||||
|
||||
QApplication::setActiveWindow(&container);
|
||||
QApplicationPrivate::setActiveWindow(&container);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&container));
|
||||
|
||||
int closeEditorSpyCount = 0;
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include <QTest>
|
||||
#include <QTreeWidget>
|
||||
#include <QtWidgets/private/qheaderview_p.h>
|
||||
#include <QtWidgets/private/qapplication_p.h>
|
||||
|
||||
using BoolList = QList<bool>;
|
||||
using IntList = QList<int>;
|
||||
@ -1612,7 +1613,7 @@ void tst_QHeaderView::focusPolicy()
|
||||
|
||||
widget.show();
|
||||
widget.setFocus(Qt::OtherFocusReason);
|
||||
QApplication::setActiveWindow(&widget);
|
||||
QApplicationPrivate::setActiveWindow(&widget);
|
||||
widget.activateWindow();
|
||||
QVERIFY(QTest::qWaitForWindowActive(&widget));
|
||||
QVERIFY(widget.hasFocus());
|
||||
@ -3609,7 +3610,7 @@ void tst_QHeaderView::statusTips()
|
||||
headerView.setGeometry(QRect(QPoint(QGuiApplication::primaryScreen()->geometry().center() - QPoint(250, 250)),
|
||||
QSize(500, 500)));
|
||||
headerView.show();
|
||||
QApplication::setActiveWindow(&headerView);
|
||||
QApplicationPrivate::setActiveWindow(&headerView);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&headerView));
|
||||
|
||||
// Ensure it is moved away first and then moved to the relevant section
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include <qscreen.h>
|
||||
|
||||
#include <QtWidgets/private/qabstractitemdelegate_p.h>
|
||||
#include <QtWidgets/private/qapplication_p.h>
|
||||
|
||||
Q_DECLARE_METATYPE(QAbstractItemDelegate::EndEditHint)
|
||||
|
||||
@ -745,7 +746,7 @@ void tst_QItemDelegate::dateTimeEditor()
|
||||
widget.setItem(0, 2, item3);
|
||||
widget.show();
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&widget));
|
||||
QApplication::setActiveWindow(&widget);
|
||||
QApplicationPrivate::setActiveWindow(&widget);
|
||||
|
||||
widget.editItem(item1);
|
||||
|
||||
@ -761,7 +762,7 @@ void tst_QItemDelegate::dateTimeEditor()
|
||||
timeEditor->setTime(time.addSecs(60));
|
||||
|
||||
widget.clearFocus();
|
||||
qApp->setActiveWindow(&widget);
|
||||
QApplicationPrivate::setActiveWindow(&widget);
|
||||
widget.setFocus();
|
||||
widget.editItem(item2);
|
||||
|
||||
@ -1025,7 +1026,7 @@ void tst_QItemDelegate::decoration()
|
||||
TestItemDelegate delegate;
|
||||
table.setItemDelegate(&delegate);
|
||||
table.show();
|
||||
QApplication::setActiveWindow(&table);
|
||||
QApplicationPrivate::setActiveWindow(&table);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&table));
|
||||
|
||||
QVariant value;
|
||||
@ -1280,7 +1281,7 @@ void tst_QItemDelegate::enterKey()
|
||||
QListView view;
|
||||
view.setModel(&model);
|
||||
view.show();
|
||||
QApplication::setActiveWindow(&view);
|
||||
QApplicationPrivate::setActiveWindow(&view);
|
||||
view.setFocus();
|
||||
QVERIFY(QTest::qWaitForWindowActive(&view));
|
||||
|
||||
@ -1340,7 +1341,7 @@ void tst_QItemDelegate::task257859_finalizeEdit()
|
||||
QListView view;
|
||||
view.setModel(&model);
|
||||
view.show();
|
||||
QApplication::setActiveWindow(&view);
|
||||
QApplicationPrivate::setActiveWindow(&view);
|
||||
view.setFocus();
|
||||
QVERIFY(QTest::qWaitForWindowActive(&view));
|
||||
|
||||
@ -1402,7 +1403,7 @@ void tst_QItemDelegate::comboBox()
|
||||
widget.setItem(0, 0, item1);
|
||||
widget.show();
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&widget));
|
||||
QApplication::setActiveWindow(&widget);
|
||||
QApplicationPrivate::setActiveWindow(&widget);
|
||||
|
||||
widget.editItem(item1);
|
||||
|
||||
@ -1467,7 +1468,7 @@ void tst_QItemDelegate::testLineEditValidation()
|
||||
view.setItemDelegate(&delegate);
|
||||
view.show();
|
||||
view.setFocus();
|
||||
QApplication::setActiveWindow(&view);
|
||||
QApplicationPrivate::setActiveWindow(&view);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&view));
|
||||
|
||||
QPointer<QLineEdit> editor;
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
#include <QtTest/private/qtesthelpers_p.h>
|
||||
#include <QtWidgets/private/qlistview_p.h>
|
||||
#include <QtWidgets/private/qapplication_p.h>
|
||||
|
||||
using namespace QTestPrivate;
|
||||
|
||||
@ -1699,7 +1700,7 @@ void tst_QListView::keyboardSearch()
|
||||
QListView view;
|
||||
view.setModel(&model);
|
||||
view.show();
|
||||
QApplication::setActiveWindow(&view);
|
||||
QApplicationPrivate::setActiveWindow(&view);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&view));
|
||||
|
||||
QTest::keyClick(&view, Qt::Key_K);
|
||||
@ -1801,7 +1802,7 @@ void tst_QListView::shiftSelectionWithItemAlignment()
|
||||
view.resize(300, view.sizeHintForRow(0) * items.size() / 2 + view.horizontalScrollBar()->height());
|
||||
|
||||
view.show();
|
||||
QApplication::setActiveWindow(&view);
|
||||
QApplicationPrivate::setActiveWindow(&view);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&view));
|
||||
QCOMPARE(static_cast<QWidget *>(&view), QApplication::activeWindow());
|
||||
|
||||
@ -1860,7 +1861,7 @@ void tst_QListView::task262152_setModelColumnNavigate()
|
||||
view.setModelColumn(1);
|
||||
|
||||
view.show();
|
||||
QApplication::setActiveWindow(&view);
|
||||
QApplicationPrivate::setActiveWindow(&view);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&view));
|
||||
QCOMPARE(&view, QApplication::activeWindow());
|
||||
QTest::keyClick(&view, Qt::Key_Down);
|
||||
@ -2805,7 +2806,7 @@ void tst_QListView::moveLastRow()
|
||||
view.setViewMode(QListView::IconMode);
|
||||
view.show();
|
||||
|
||||
QApplication::setActiveWindow(&view);
|
||||
QApplicationPrivate::setActiveWindow(&view);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&view));
|
||||
|
||||
QModelIndex sourceParent = model.index(0, 0);
|
||||
|
@ -10,6 +10,8 @@
|
||||
#include <QTest>
|
||||
#include <private/qlistwidget_p.h>
|
||||
|
||||
#include <QtWidgets/private/qapplication_p.h>
|
||||
|
||||
using IntList = QList<int>;
|
||||
|
||||
class tst_QListWidget : public QObject
|
||||
@ -1746,7 +1748,7 @@ void tst_QListWidget::QTBUG14363_completerWithAnyKeyPressedEditTriggers()
|
||||
new QListWidgetItem(QLatin1String("completer"), &listWidget);
|
||||
listWidget.show();
|
||||
listWidget.setCurrentItem(item);
|
||||
QApplication::setActiveWindow(&listWidget);
|
||||
QApplicationPrivate::setActiveWindow(&listWidget);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&listWidget));
|
||||
listWidget.setFocus();
|
||||
QCOMPARE(QApplication::focusWidget(), &listWidget);
|
||||
|
@ -600,7 +600,7 @@ void tst_QTableView::keyboardNavigation()
|
||||
view.setCurrentIndex(index);
|
||||
|
||||
view.show();
|
||||
QApplication::setActiveWindow(&view);
|
||||
QApplicationPrivate::setActiveWindow(&view);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&view));
|
||||
|
||||
int row = rowCount - 1;
|
||||
@ -3790,7 +3790,7 @@ void tst_QTableView::tabFocus()
|
||||
QLineEdit *edit = new QLineEdit(&window);
|
||||
|
||||
window.show();
|
||||
QApplication::setActiveWindow(&window);
|
||||
QApplicationPrivate::setActiveWindow(&window);
|
||||
window.setFocus();
|
||||
window.activateWindow();
|
||||
QVERIFY(QTest::qWaitForWindowActive(&window));
|
||||
|
@ -24,6 +24,8 @@
|
||||
#include <private/qtreeview_p.h>
|
||||
#include <private/qtesthelpers_p.h>
|
||||
|
||||
#include <QtWidgets/private/qapplication_p.h>
|
||||
|
||||
using namespace QTestPrivate;
|
||||
|
||||
#if QT_CONFIG(draganddrop)
|
||||
@ -1238,7 +1240,7 @@ void tst_QTreeView::keyboardSearchMultiColumn()
|
||||
|
||||
view.setModel(&model);
|
||||
view.show();
|
||||
QApplication::setActiveWindow(&view);
|
||||
QApplicationPrivate::setActiveWindow(&view);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&view));
|
||||
|
||||
view.setCurrentIndex(model.index(0, 1));
|
||||
@ -1924,7 +1926,7 @@ void tst_QTreeView::moveCursor()
|
||||
view.setColumnHidden(0, true);
|
||||
QVERIFY(view.isColumnHidden(0));
|
||||
view.show();
|
||||
QApplication::setActiveWindow(&view);
|
||||
QApplicationPrivate::setActiveWindow(&view);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&view));
|
||||
|
||||
//here the first visible index should be selected
|
||||
@ -3703,7 +3705,7 @@ void tst_QTreeView::task224091_appendColumns()
|
||||
treeView->setModel(model);
|
||||
topLevel->show();
|
||||
treeView->resize(50, 50);
|
||||
QApplication::setActiveWindow(topLevel);
|
||||
QApplicationPrivate::setActiveWindow(topLevel);
|
||||
QVERIFY(QTest::qWaitForWindowActive(topLevel));
|
||||
|
||||
QVERIFY(!treeView->verticalScrollBar()->isVisible());
|
||||
@ -4079,7 +4081,7 @@ void tst_QTreeView::doubleClickedWithSpans()
|
||||
view.setModel(&model);
|
||||
view.setFirstColumnSpanned(0, QModelIndex(), true);
|
||||
view.show();
|
||||
QApplication::setActiveWindow(&view);
|
||||
QApplicationPrivate::setActiveWindow(&view);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&view));
|
||||
QVERIFY(view.isActiveWindow());
|
||||
|
||||
@ -4181,7 +4183,7 @@ void tst_QTreeView::keyboardNavigationWithDisabled()
|
||||
|
||||
view.resize(200, view.visualRect(model.index(0,0)).height()*10);
|
||||
topLevel.show();
|
||||
QApplication::setActiveWindow(&topLevel);
|
||||
QApplicationPrivate::setActiveWindow(&topLevel);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&topLevel));
|
||||
QVERIFY(topLevel.isActiveWindow());
|
||||
|
||||
@ -4767,7 +4769,7 @@ void tst_QTreeView::statusTip()
|
||||
mw.setGeometry(QRect(QPoint(QGuiApplication::primaryScreen()->geometry().center() - QPoint(250, 250)),
|
||||
QSize(500, 500)));
|
||||
mw.show();
|
||||
QApplication::setActiveWindow(&mw);
|
||||
QApplicationPrivate::setActiveWindow(&mw);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&mw));
|
||||
// Ensure it is moved away first and then moved to the relevant section
|
||||
QTest::mouseMove(mw.windowHandle(), view->mapTo(&mw, view->rect().bottomLeft() + QPoint(20, 20)));
|
||||
|
@ -15,4 +15,5 @@ qt_internal_add_test(tst_qaction
|
||||
Qt::Gui
|
||||
Qt::GuiPrivate
|
||||
Qt::Widgets
|
||||
Qt::WidgetsPrivate
|
||||
)
|
||||
|
@ -17,6 +17,8 @@
|
||||
#include <qpa/qplatformintegration.h>
|
||||
#include <private/qguiapplication_p.h>
|
||||
|
||||
#include <QtWidgets/private/qapplication_p.h>
|
||||
|
||||
class tst_QAction : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -111,7 +113,7 @@ void tst_QAction::actionEvent()
|
||||
// add action
|
||||
MyWidget testWidget(this);
|
||||
testWidget.show();
|
||||
QApplication::setActiveWindow(&testWidget);
|
||||
QApplicationPrivate::setActiveWindow(&testWidget);
|
||||
testWidget.addAction(&a);
|
||||
qApp->processEvents();
|
||||
|
||||
@ -141,7 +143,7 @@ void tst_QAction::alternateShortcuts()
|
||||
|
||||
MyWidget testWidget(this);
|
||||
testWidget.show();
|
||||
QApplication::setActiveWindow(&testWidget);
|
||||
QApplicationPrivate::setActiveWindow(&testWidget);
|
||||
|
||||
{
|
||||
QAction act(&testWidget);
|
||||
@ -172,7 +174,7 @@ void tst_QAction::keysequence()
|
||||
{
|
||||
MyWidget testWidget(this);
|
||||
testWidget.show();
|
||||
QApplication::setActiveWindow(&testWidget);
|
||||
QApplicationPrivate::setActiveWindow(&testWidget);
|
||||
|
||||
{
|
||||
QAction act(&testWidget);
|
||||
@ -206,7 +208,7 @@ void tst_QAction::enabledVisibleInteraction()
|
||||
{
|
||||
MyWidget testWidget(this);
|
||||
testWidget.show();
|
||||
QApplication::setActiveWindow(&testWidget);
|
||||
QApplicationPrivate::setActiveWindow(&testWidget);
|
||||
|
||||
QAction act(nullptr);
|
||||
// check defaults
|
||||
@ -271,7 +273,7 @@ void tst_QAction::repeat()
|
||||
|
||||
MyWidget testWidget(this);
|
||||
testWidget.show();
|
||||
QApplication::setActiveWindow(&testWidget);
|
||||
QApplicationPrivate::setActiveWindow(&testWidget);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&testWidget));
|
||||
|
||||
QAction act(&testWidget);
|
||||
@ -350,7 +352,7 @@ void tst_QAction::disableShortcutsWithBlockedWidgets()
|
||||
dialog.show();
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&dialog));
|
||||
|
||||
QApplication::setActiveWindow(&window);
|
||||
QApplicationPrivate::setActiveWindow(&window);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&window));
|
||||
|
||||
QSignalSpy spy(&action, &QAction::triggered);
|
||||
|
@ -293,10 +293,10 @@ void tst_QApplication::alert()
|
||||
QApplication::alert(&widget, -1);
|
||||
QApplication::alert(&widget, 250);
|
||||
widget2.activateWindow();
|
||||
QApplication::setActiveWindow(&widget2);
|
||||
QApplicationPrivate::setActiveWindow(&widget2);
|
||||
QApplication::alert(&widget, 0);
|
||||
widget.activateWindow();
|
||||
QApplication::setActiveWindow(&widget);
|
||||
QApplicationPrivate::setActiveWindow(&widget);
|
||||
QApplication::alert(&widget, 200);
|
||||
}
|
||||
|
||||
@ -1541,7 +1541,7 @@ void tst_QApplication::setActiveWindow()
|
||||
delete pb2;
|
||||
|
||||
w->show();
|
||||
QApplication::setActiveWindow(w); // needs this on twm (focus follows mouse)
|
||||
QApplicationPrivate::setActiveWindow(w); // needs this on twm (focus follows mouse)
|
||||
QVERIFY(pb1->hasFocus());
|
||||
delete w;
|
||||
}
|
||||
@ -1603,7 +1603,7 @@ void tst_QApplication::focusWidget()
|
||||
QTextEdit te;
|
||||
te.show();
|
||||
|
||||
QApplication::setActiveWindow(&te);
|
||||
QApplicationPrivate::setActiveWindow(&te);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&te));
|
||||
|
||||
const auto focusWidget = QApplication::focusWidget();
|
||||
@ -1619,7 +1619,7 @@ void tst_QApplication::focusWidget()
|
||||
QTextEdit te(&w);
|
||||
w.show();
|
||||
|
||||
QApplication::setActiveWindow(&w);
|
||||
QApplicationPrivate::setActiveWindow(&w);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&w));
|
||||
|
||||
const auto focusWidget = QApplication::focusWidget();
|
||||
@ -1655,7 +1655,7 @@ void tst_QApplication::focusChanged()
|
||||
QCOMPARE(spy.count(), 0);
|
||||
|
||||
parent1.show();
|
||||
QApplication::setActiveWindow(&parent1); // needs this on twm (focus follows mouse)
|
||||
QApplicationPrivate::setActiveWindow(&parent1); // needs this on twm (focus follows mouse)
|
||||
QCOMPARE(spy.count(), 1);
|
||||
QCOMPARE(spy.at(0).count(), 2);
|
||||
old = qvariant_cast<QWidget*>(spy.at(0).at(0));
|
||||
@ -1704,7 +1704,7 @@ void tst_QApplication::focusChanged()
|
||||
hbox2.addWidget(&pb2);
|
||||
|
||||
parent2.show();
|
||||
QApplication::setActiveWindow(&parent2); // needs this on twm (focus follows mouse)
|
||||
QApplicationPrivate::setActiveWindow(&parent2); // needs this on twm (focus follows mouse)
|
||||
QVERIFY(spy.count() > 0); // one for deactivation, one for activation on Windows
|
||||
old = qvariant_cast<QWidget*>(spy.at(spy.count()-1).at(0));
|
||||
now = qvariant_cast<QWidget*>(spy.at(spy.count()-1).at(1));
|
||||
@ -1812,7 +1812,7 @@ void tst_QApplication::focusChanged()
|
||||
}
|
||||
|
||||
parent1.activateWindow();
|
||||
QApplication::setActiveWindow(&parent1); // needs this on twm (focus follows mouse)
|
||||
QApplicationPrivate::setActiveWindow(&parent1); // needs this on twm (focus follows mouse)
|
||||
QVERIFY(spy.count() == 1 || spy.count() == 2); // one for deactivation, one for activation on Windows
|
||||
|
||||
//on windows, the change of focus is made in 2 steps
|
||||
@ -2580,7 +2580,7 @@ void tst_QApplication::staticFunctions()
|
||||
QApplication::activeModalWidget();
|
||||
QApplication::focusWidget();
|
||||
QApplication::activeWindow();
|
||||
QApplication::setActiveWindow(nullptr);
|
||||
QApplicationPrivate::setActiveWindow(nullptr);
|
||||
QApplication::widgetAt(QPoint(0, 0));
|
||||
QApplication::topLevelAt(QPoint(0, 0));
|
||||
QTest::ignoreMessage(QtWarningMsg, "Must construct a QApplication first.");
|
||||
|
@ -16,4 +16,5 @@ qt_internal_add_test(tst_qshortcut
|
||||
Qt::Gui
|
||||
Qt::GuiPrivate
|
||||
Qt::Widgets
|
||||
Qt::WidgetsPrivate
|
||||
)
|
||||
|
@ -23,6 +23,8 @@
|
||||
#include <QtGui/private/qguiapplication_p.h>
|
||||
#include <QtGui/qpa/qplatformintegration.h>
|
||||
|
||||
#include <QtWidgets/private/qapplication_p.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QMainWindow;
|
||||
class QTextEdit;
|
||||
@ -1062,7 +1064,7 @@ void tst_QShortcut::context()
|
||||
|
||||
// Focus on 'other1' edit, so Active Window context should trigger
|
||||
other1->activateWindow(); // <---
|
||||
QApplication::setActiveWindow(other1);
|
||||
QApplicationPrivate::setActiveWindow(other1);
|
||||
QCOMPARE(QApplication::activeWindow(), other1->window());
|
||||
QCOMPARE(QApplication::focusWidget(), static_cast<QWidget *>(other1));
|
||||
|
||||
@ -1154,7 +1156,7 @@ void tst_QShortcut::duplicatedShortcutOverride()
|
||||
w.resize(200, 200);
|
||||
w.move(QGuiApplication::primaryScreen()->availableGeometry().center() - QPoint(100, 100));
|
||||
w.show();
|
||||
QApplication::setActiveWindow(&w);
|
||||
QApplicationPrivate::setActiveWindow(&w);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&w));
|
||||
QTest::keyPress(w.windowHandle(), Qt::Key_A);
|
||||
QCoreApplication::processEvents();
|
||||
|
@ -13,4 +13,5 @@ qt_internal_add_test(tst_qstackedlayout
|
||||
LIBRARIES
|
||||
Qt::Gui
|
||||
Qt::Widgets
|
||||
Qt::WidgetsPrivate
|
||||
)
|
||||
|
@ -11,6 +11,8 @@
|
||||
#include <QPushButton>
|
||||
#include <QSignalSpy>
|
||||
|
||||
#include <QtWidgets/private/qapplication_p.h>
|
||||
|
||||
class tst_QStackedLayout : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -287,7 +289,7 @@ void tst_QStackedLayout::keepFocusAfterSetCurrent()
|
||||
stackLayout->setCurrentIndex(0);
|
||||
|
||||
testWidget->show();
|
||||
QApplication::setActiveWindow(testWidget);
|
||||
QApplicationPrivate::setActiveWindow(testWidget);
|
||||
QVERIFY(QTest::qWaitForWindowActive(testWidget));
|
||||
|
||||
edit1->setFocus();
|
||||
|
@ -13,4 +13,5 @@ qt_internal_add_test(tst_qtooltip
|
||||
LIBRARIES
|
||||
Qt::Gui
|
||||
Qt::Widgets
|
||||
Qt::WidgetsPrivate
|
||||
)
|
||||
|
@ -11,6 +11,8 @@
|
||||
#include <qwhatsthis.h>
|
||||
#include <qscreen.h>
|
||||
|
||||
#include <QtWidgets/private/qapplication_p.h>
|
||||
|
||||
class tst_QToolTip : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -95,7 +97,7 @@ void tst_QToolTip::keyEvent()
|
||||
widget.setWindowTitle(QLatin1String(QTest::currentTestFunction())
|
||||
+ QLatin1Char(' ') + QLatin1String(QTest::currentDataTag()));
|
||||
widget.show();
|
||||
QApplication::setActiveWindow(&widget);
|
||||
QApplicationPrivate::setActiveWindow(&widget);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&widget));
|
||||
|
||||
widget.showDelayedToolTip(100);
|
||||
@ -189,7 +191,7 @@ void tst_QToolTip::qtbug64550_stylesheet()
|
||||
Widget widget;
|
||||
widget.setStyleSheet(QStringLiteral("* { font-size: 48pt; }\n"));
|
||||
widget.show();
|
||||
QApplication::setActiveWindow(&widget);
|
||||
QApplicationPrivate::setActiveWindow(&widget);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&widget));
|
||||
|
||||
widget.showDelayedToolTip(100);
|
||||
|
@ -1857,7 +1857,7 @@ void tst_QWidget::focusChainOnHide()
|
||||
QWidget::setTabOrder(child, parent.data());
|
||||
|
||||
parent->show();
|
||||
QApplication::setActiveWindow(parent->window());
|
||||
QApplicationPrivate::setActiveWindow(parent->window());
|
||||
child->activateWindow();
|
||||
child->setFocus();
|
||||
|
||||
@ -1938,7 +1938,7 @@ void tst_QWidget::defaultTabOrder()
|
||||
container.setWindowTitle(QLatin1String(QTest::currentTestFunction()));
|
||||
container.show();
|
||||
container.activateWindow();
|
||||
QApplication::setActiveWindow(&container);
|
||||
QApplicationPrivate::setActiveWindow(&container);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&container));
|
||||
|
||||
QTRY_VERIFY(firstEdit->hasFocus());
|
||||
@ -1999,7 +1999,7 @@ void tst_QWidget::reverseTabOrder()
|
||||
|
||||
container.show();
|
||||
container.activateWindow();
|
||||
QApplication::setActiveWindow(&container);
|
||||
QApplicationPrivate::setActiveWindow(&container);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&container));
|
||||
|
||||
QTRY_VERIFY(firstEdit->hasFocus());
|
||||
@ -2061,7 +2061,7 @@ void tst_QWidget::tabOrderWithProxy()
|
||||
|
||||
container.show();
|
||||
container.activateWindow();
|
||||
QApplication::setActiveWindow(&container);
|
||||
QApplicationPrivate::setActiveWindow(&container);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&container));
|
||||
|
||||
QTRY_VERIFY(firstEdit->hasFocus());
|
||||
@ -2122,7 +2122,7 @@ void tst_QWidget::tabOrderWithProxyDisabled()
|
||||
container.show();
|
||||
container.activateWindow();
|
||||
|
||||
QApplication::setActiveWindow(&container);
|
||||
QApplicationPrivate::setActiveWindow(&container);
|
||||
if (!QTest::qWaitForWindowActive(&container))
|
||||
QSKIP("Window failed to activate, skipping test");
|
||||
|
||||
@ -2186,7 +2186,7 @@ void tst_QWidget::tabOrderWithCompoundWidgets()
|
||||
|
||||
container.show();
|
||||
container.activateWindow();
|
||||
QApplication::setActiveWindow(&container);
|
||||
QApplicationPrivate::setActiveWindow(&container);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&container));
|
||||
|
||||
lastEdit->setFocus();
|
||||
@ -2288,7 +2288,7 @@ void tst_QWidget::tabOrderWithCompoundWidgetsNoFocusPolicy()
|
||||
container.show();
|
||||
container.activateWindow();
|
||||
|
||||
QApplication::setActiveWindow(&container);
|
||||
QApplicationPrivate::setActiveWindow(&container);
|
||||
if (!QTest::qWaitForWindowActive(&container))
|
||||
QSKIP("Window failed to activate, skipping test");
|
||||
|
||||
@ -2394,7 +2394,7 @@ void tst_QWidget::appFocusWidgetWithFocusProxyLater()
|
||||
QLineEdit *lineEdit = new QLineEdit(&window);
|
||||
lineEdit->setFocus();
|
||||
window.show();
|
||||
QApplication::setActiveWindow(&window);
|
||||
QApplicationPrivate::setActiveWindow(&window);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&window));
|
||||
QCOMPARE(QApplication::focusWidget(), lineEdit);
|
||||
|
||||
@ -2422,7 +2422,7 @@ void tst_QWidget::appFocusWidgetWhenLosingFocusProxy()
|
||||
lineEdit->setFocusProxy(lineEditFocusProxy);
|
||||
lineEdit->setFocus();
|
||||
window.show();
|
||||
QApplication::setActiveWindow(&window);
|
||||
QApplicationPrivate::setActiveWindow(&window);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&window));
|
||||
QCOMPARE(QApplication::focusWidget(), lineEditFocusProxy);
|
||||
QVERIFY(lineEdit->hasFocus());
|
||||
@ -2449,7 +2449,7 @@ void tst_QWidget::explicitTabOrderWithComplexWidget()
|
||||
QWidget::setTabOrder(lineEditOne, lineEditTwo);
|
||||
lineEditOne->setFocus();
|
||||
window.show();
|
||||
QApplication::setActiveWindow(&window);
|
||||
QApplicationPrivate::setActiveWindow(&window);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&window));
|
||||
QTRY_COMPARE(QApplication::focusWidget(), lineEditOne);
|
||||
|
||||
@ -2478,7 +2478,7 @@ void tst_QWidget::explicitTabOrderWithSpinBox_QTBUG81097()
|
||||
QWidget::setTabOrder(spinBoxTwo, lineEdit);
|
||||
spinBoxOne->setFocus();
|
||||
window.show();
|
||||
QApplication::setActiveWindow(&window);
|
||||
QApplicationPrivate::setActiveWindow(&window);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&window));
|
||||
QTRY_COMPARE(QApplication::focusWidget(), spinBoxOne);
|
||||
|
||||
@ -3065,7 +3065,7 @@ void tst_QWidget::showMinimizedKeepsFocus()
|
||||
child1.setFocusPolicy(Qt::StrongFocus);
|
||||
child2.setFocusPolicy(Qt::StrongFocus);
|
||||
window.show();
|
||||
QApplication::setActiveWindow(&window);
|
||||
QApplicationPrivate::setActiveWindow(&window);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&window));
|
||||
child2.setFocus();
|
||||
|
||||
@ -3089,7 +3089,7 @@ void tst_QWidget::showMinimizedKeepsFocus()
|
||||
QWidget *child = new QWidget(&window);
|
||||
child->setFocusPolicy(Qt::StrongFocus);
|
||||
window.show();
|
||||
QApplication::setActiveWindow(&window);
|
||||
QApplicationPrivate::setActiveWindow(&window);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&window));
|
||||
child->setFocus();
|
||||
QTRY_COMPARE(window.focusWidget(), child);
|
||||
@ -3108,7 +3108,7 @@ void tst_QWidget::showMinimizedKeepsFocus()
|
||||
QWidget *child = new QWidget(&window);
|
||||
child->setFocusPolicy(Qt::StrongFocus);
|
||||
window.show();
|
||||
QApplication::setActiveWindow(&window);
|
||||
QApplicationPrivate::setActiveWindow(&window);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&window));
|
||||
child->setFocus();
|
||||
QTRY_COMPARE(window.focusWidget(), child);
|
||||
@ -3128,7 +3128,7 @@ void tst_QWidget::showMinimizedKeepsFocus()
|
||||
QWidget *child = new QWidget(&window);
|
||||
child->setFocusPolicy(Qt::StrongFocus);
|
||||
window.show();
|
||||
QApplication::setActiveWindow(&window);
|
||||
QApplicationPrivate::setActiveWindow(&window);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&window));
|
||||
child->setFocus();
|
||||
QTRY_COMPARE(window.focusWidget(), child);
|
||||
@ -3149,7 +3149,7 @@ void tst_QWidget::showMinimizedKeepsFocus()
|
||||
QWidget *child = new QWidget(&window);
|
||||
child->setFocusPolicy(Qt::StrongFocus);
|
||||
window.show();
|
||||
QApplication::setActiveWindow(&window);
|
||||
QApplicationPrivate::setActiveWindow(&window);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&window));
|
||||
child->setFocus();
|
||||
QTRY_COMPARE(window.focusWidget(), child);
|
||||
@ -3166,7 +3166,7 @@ void tst_QWidget::showMinimizedKeepsFocus()
|
||||
QTRY_COMPARE(QApplication::focusWidget(), nullptr);
|
||||
|
||||
window.showNormal();
|
||||
QApplication::setActiveWindow(&window);
|
||||
QApplicationPrivate::setActiveWindow(&window);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&window));
|
||||
#ifdef Q_OS_MACOS
|
||||
if (!macHasAccessToWindowsServer())
|
||||
@ -5400,7 +5400,7 @@ void tst_QWidget::scroll()
|
||||
updateWidget.reset();
|
||||
updateWidget.move(m_availableTopLeft);
|
||||
updateWidget.showNormal();
|
||||
QApplication::setActiveWindow(&updateWidget);
|
||||
QApplicationPrivate::setActiveWindow(&updateWidget);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&updateWidget));
|
||||
QVERIFY(updateWidget.numPaintEvents > 0);
|
||||
|
||||
@ -6150,7 +6150,7 @@ void tst_QWidget::showAndMoveChild()
|
||||
parent.setGeometry(desktopDimensions);
|
||||
parent.setPalette(Qt::red);
|
||||
parent.show();
|
||||
QApplication::setActiveWindow(&parent);
|
||||
QApplicationPrivate::setActiveWindow(&parent);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&parent));
|
||||
|
||||
QWidget child(&parent);
|
||||
@ -6269,7 +6269,7 @@ void tst_QWidget::multipleToplevelFocusCheck()
|
||||
w2.show();
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&w2));
|
||||
|
||||
QApplication::setActiveWindow(&w1);
|
||||
QApplicationPrivate::setActiveWindow(&w1);
|
||||
w1.activateWindow();
|
||||
QVERIFY(QTest::qWaitForWindowActive(&w1));
|
||||
QCOMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&w1));
|
||||
@ -6277,7 +6277,7 @@ void tst_QWidget::multipleToplevelFocusCheck()
|
||||
QTRY_COMPARE(QApplication::focusWidget(), static_cast<QWidget *>(w1.edit));
|
||||
|
||||
w2.activateWindow();
|
||||
QApplication::setActiveWindow(&w2);
|
||||
QApplicationPrivate::setActiveWindow(&w2);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&w2));
|
||||
QCOMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&w2));
|
||||
QTest::mouseClick(&w2, Qt::LeftButton);
|
||||
@ -6287,14 +6287,14 @@ void tst_QWidget::multipleToplevelFocusCheck()
|
||||
QTRY_COMPARE(QApplication::focusWidget(), static_cast<QWidget *>(w2.edit));
|
||||
|
||||
w1.activateWindow();
|
||||
QApplication::setActiveWindow(&w1);
|
||||
QApplicationPrivate::setActiveWindow(&w1);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&w1));
|
||||
QCOMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&w1));
|
||||
QTest::mouseDClick(&w1, Qt::LeftButton);
|
||||
QTRY_COMPARE(QApplication::focusWidget(), static_cast<QWidget *>(w1.edit));
|
||||
|
||||
w2.activateWindow();
|
||||
QApplication::setActiveWindow(&w2);
|
||||
QApplicationPrivate::setActiveWindow(&w2);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&w2));
|
||||
QCOMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&w2));
|
||||
QTest::mouseClick(&w2, Qt::LeftButton);
|
||||
@ -6359,7 +6359,7 @@ void tst_QWidget::setFocus()
|
||||
{
|
||||
// move focus to another window
|
||||
testWidget->activateWindow();
|
||||
QApplication::setActiveWindow(testWidget.data());
|
||||
QApplicationPrivate::setActiveWindow(testWidget.data());
|
||||
if (testWidget->focusWidget())
|
||||
testWidget->focusWidget()->clearFocus();
|
||||
else
|
||||
@ -6405,7 +6405,7 @@ void tst_QWidget::setFocus()
|
||||
|
||||
// note: window may be active, but we don't want it to be
|
||||
testWidget->activateWindow();
|
||||
QApplication::setActiveWindow(testWidget.data());
|
||||
QApplicationPrivate::setActiveWindow(testWidget.data());
|
||||
if (testWidget->focusWidget())
|
||||
testWidget->focusWidget()->clearFocus();
|
||||
else
|
||||
@ -7033,7 +7033,7 @@ void tst_QWidget::clean_qt_x11_enforce_cursor()
|
||||
child->setAttribute(Qt::WA_SetCursor, true);
|
||||
|
||||
window.show();
|
||||
QApplication::setActiveWindow(&window);
|
||||
QApplicationPrivate::setActiveWindow(&window);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&window));
|
||||
QTest::qWait(100);
|
||||
QCursor::setPos(window.geometry().center());
|
||||
@ -9099,7 +9099,7 @@ void tst_QWidget::resizeInPaintEvent()
|
||||
UpdateWidget widget(&window);
|
||||
window.resize(200, 200);
|
||||
window.show();
|
||||
QApplication::setActiveWindow(&window);
|
||||
QApplicationPrivate::setActiveWindow(&window);
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&window));
|
||||
QTRY_VERIFY(widget.numPaintEvents > 0);
|
||||
|
||||
@ -9177,7 +9177,7 @@ void tst_QWidget::dumpObjectTree()
|
||||
}
|
||||
|
||||
QTestPrivate::androidCompatibleShow(&w);
|
||||
QApplication::setActiveWindow(&w);
|
||||
QApplicationPrivate::setActiveWindow(&w);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&w));
|
||||
|
||||
{
|
||||
@ -9759,7 +9759,7 @@ void tst_QWidget::setClearAndResizeMask()
|
||||
topLevel.resize(160, 160);
|
||||
centerOnScreen(&topLevel);
|
||||
topLevel.show();
|
||||
QApplication::setActiveWindow(&topLevel);
|
||||
QApplicationPrivate::setActiveWindow(&topLevel);
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&topLevel));
|
||||
QTRY_VERIFY(topLevel.numPaintEvents > 0);
|
||||
topLevel.reset();
|
||||
@ -10251,7 +10251,7 @@ void tst_QWidget::enterLeaveOnWindowShowHide()
|
||||
if (!QTest::qWaitFor([&]{ return widget.geometry().contains(QCursor::pos()); }))
|
||||
QSKIP("We can't move the cursor");
|
||||
widget.show();
|
||||
QApplication::setActiveWindow(&widget);
|
||||
QApplicationPrivate::setActiveWindow(&widget);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&widget));
|
||||
|
||||
++expectedEnter;
|
||||
@ -10977,7 +10977,7 @@ void tst_QWidget::focusProxyAndInputMethods()
|
||||
|
||||
toplevel->show();
|
||||
QVERIFY(QTest::qWaitForWindowExposed(toplevel.data()));
|
||||
QApplication::setActiveWindow(toplevel.data());
|
||||
QApplicationPrivate::setActiveWindow(toplevel.data());
|
||||
QVERIFY(QTest::qWaitForWindowActive(toplevel.data()));
|
||||
QVERIFY(toplevel->hasFocus());
|
||||
QVERIFY(child->hasFocus());
|
||||
@ -10995,7 +10995,7 @@ void tst_QWidget::imEnabledNotImplemented()
|
||||
topLevel.show();
|
||||
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&topLevel));
|
||||
QApplication::setActiveWindow(&topLevel);
|
||||
QApplicationPrivate::setActiveWindow(&topLevel);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&topLevel));
|
||||
|
||||
// A plain widget should return false for ImEnabled
|
||||
@ -11375,7 +11375,7 @@ void tst_QWidget::grabMouse()
|
||||
layout->addWidget(grabber);
|
||||
centerOnScreen(&w);
|
||||
w.show();
|
||||
QApplication::setActiveWindow(&w);
|
||||
QApplicationPrivate::setActiveWindow(&w);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&w));
|
||||
|
||||
QStringList expectedLog;
|
||||
@ -11412,7 +11412,7 @@ void tst_QWidget::grabKeyboard()
|
||||
layout->addWidget(nonGrabber);
|
||||
centerOnScreen(&w);
|
||||
w.show();
|
||||
QApplication::setActiveWindow(&w);
|
||||
QApplicationPrivate::setActiveWindow(&w);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&w));
|
||||
nonGrabber->setFocus();
|
||||
grabber->grabKeyboard();
|
||||
@ -12776,13 +12776,13 @@ void tst_QWidget::setParentChangesFocus()
|
||||
QCOMPARE(secondary->focusWidget()->objectName(), focusWidget);
|
||||
}
|
||||
secondary->show();
|
||||
QApplication::setActiveWindow(secondary.get());
|
||||
QApplicationPrivate::setActiveWindow(secondary.get());
|
||||
QVERIFY(QTest::qWaitForWindowActive(secondary.get()));
|
||||
|
||||
if (!reparentBeforeShow) {
|
||||
secondary->setParent(targetParent ? &window : nullptr, targetType);
|
||||
secondary->show(); // reparenting hides, so show again
|
||||
QApplication::setActiveWindow(secondary.get());
|
||||
QApplicationPrivate::setActiveWindow(secondary.get());
|
||||
QVERIFY(QTest::qWaitForWindowActive(secondary.get()));
|
||||
}
|
||||
QCOMPARE(QApplication::focusWidget()->objectName(), focusWidget);
|
||||
|
@ -16,4 +16,5 @@ qt_internal_add_test(tst_qwidget_window
|
||||
Qt::GuiPrivate
|
||||
Qt::TestPrivate
|
||||
Qt::Widgets
|
||||
Qt::WidgetsPrivate
|
||||
)
|
||||
|
@ -28,6 +28,8 @@
|
||||
|
||||
#include <QtTest/private/qtesthelpers_p.h>
|
||||
|
||||
#include <QtWidgets/private/qapplication_p.h>
|
||||
|
||||
using namespace QTestPrivate;
|
||||
|
||||
// Compare a window position that may go through scaling in the platform plugin with fuzz.
|
||||
@ -678,7 +680,7 @@ void tst_QWidget_window::tst_dnd()
|
||||
|
||||
dndTestWidget.show();
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&dndTestWidget));
|
||||
qApp->setActiveWindow(&dndTestWidget);
|
||||
QApplicationPrivate::setActiveWindow(&dndTestWidget);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&dndTestWidget));
|
||||
|
||||
QMimeData mimeData;
|
||||
|
@ -39,6 +39,8 @@
|
||||
#include <private/qhighdpiscaling_p.h>
|
||||
#include <QtTest/private/qtesthelpers_p.h>
|
||||
|
||||
#include <QtWidgets/private/qapplication_p.h>
|
||||
|
||||
using namespace QTestPrivate;
|
||||
|
||||
class tst_QStyleSheetStyle : public QObject
|
||||
@ -974,7 +976,7 @@ void tst_QStyleSheetStyle::focusColors()
|
||||
centerOnScreen(&frame);
|
||||
frame.show();
|
||||
|
||||
QApplication::setActiveWindow(&frame);
|
||||
QApplicationPrivate::setActiveWindow(&frame);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&frame));
|
||||
|
||||
for (QWidget *widget : frame.widgets()) {
|
||||
@ -1020,7 +1022,7 @@ void tst_QStyleSheetStyle::hoverColors()
|
||||
QCursor::setPos(frame.geometry().topLeft() - QPoint(100, 0));
|
||||
frame.show();
|
||||
|
||||
QApplication::setActiveWindow(&frame);
|
||||
QApplicationPrivate::setActiveWindow(&frame);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&frame));
|
||||
|
||||
QWindow *frameWindow = frame.windowHandle();
|
||||
@ -1695,7 +1697,7 @@ void tst_QStyleSheetStyle::toolTip()
|
||||
|
||||
centerOnScreen(&w);
|
||||
w.show();
|
||||
QApplication::setActiveWindow(&w);
|
||||
QApplicationPrivate::setActiveWindow(&w);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&w));
|
||||
|
||||
const QColor normalToolTip = QToolTip::palette().color(QPalette::Inactive, QPalette::ToolTipBase);
|
||||
@ -1841,7 +1843,7 @@ void tst_QStyleSheetStyle::complexWidgetFocus()
|
||||
|
||||
centerOnScreen(&frame);
|
||||
frame.show();
|
||||
QApplication::setActiveWindow(&frame);
|
||||
QApplicationPrivate::setActiveWindow(&frame);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&frame));
|
||||
for (QWidget *widget : widgets) {
|
||||
widget->setFocus();
|
||||
@ -1930,7 +1932,7 @@ void tst_QStyleSheetStyle::task232085_spinBoxLineEditBg()
|
||||
|
||||
centerOnScreen(&frame);
|
||||
frame.show();
|
||||
QApplication::setActiveWindow(&frame);
|
||||
QApplicationPrivate::setActiveWindow(&frame);
|
||||
spinbox->setFocus();
|
||||
QVERIFY(QTest::qWaitForWindowActive(&frame));
|
||||
|
||||
@ -2066,7 +2068,7 @@ void tst_QStyleSheetStyle::QTBUG36933_brokenPseudoClassLookup()
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&widget));
|
||||
|
||||
widget.activateWindow();
|
||||
QApplication::setActiveWindow(&widget);
|
||||
QApplicationPrivate::setActiveWindow(&widget);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&widget));
|
||||
|
||||
QHeaderView *verticalHeader = widget.verticalHeader();
|
||||
|
@ -14,6 +14,7 @@ qt_internal_add_test(tst_qcompleter
|
||||
Qt::Gui
|
||||
Qt::TestPrivate
|
||||
Qt::Widgets
|
||||
Qt::WidgetsPrivate
|
||||
)
|
||||
|
||||
#### Keys ignored in scope 1:.:.:qcompleter.pro:<TRUE>:
|
||||
|
@ -16,6 +16,8 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <QtWidgets/private/qapplication_p.h>
|
||||
|
||||
Q_DECLARE_METATYPE(QCompleter::CompletionMode)
|
||||
|
||||
using namespace QTestPrivate;
|
||||
@ -1058,7 +1060,7 @@ void tst_QCompleter::multipleWidgets()
|
||||
window.setWindowTitle(QLatin1String(QTest::currentTestFunction()));
|
||||
window.move(200, 200);
|
||||
window.show();
|
||||
QApplication::setActiveWindow(&window);
|
||||
QApplicationPrivate::setActiveWindow(&window);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&window));
|
||||
|
||||
QFocusEvent focusIn(QEvent::FocusIn);
|
||||
@ -1070,7 +1072,7 @@ void tst_QCompleter::multipleWidgets()
|
||||
comboBox->setFocus();
|
||||
comboBox->show();
|
||||
window.activateWindow();
|
||||
QApplication::setActiveWindow(&window);
|
||||
QApplicationPrivate::setActiveWindow(&window);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&window));
|
||||
QCOMPARE(QApplication::focusWidget(), comboBox);
|
||||
comboBox->lineEdit()->setText("it");
|
||||
@ -1105,7 +1107,7 @@ void tst_QCompleter::focusIn()
|
||||
window.move(200, 200);
|
||||
window.show();
|
||||
window.activateWindow();
|
||||
QApplication::setActiveWindow(&window);
|
||||
QApplicationPrivate::setActiveWindow(&window);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&window));
|
||||
|
||||
auto comboBox = new QComboBox(&window);
|
||||
@ -1196,7 +1198,7 @@ void tst_QCompleter::task178797_activatedOnReturn()
|
||||
QCOMPARE(spy.count(), 0);
|
||||
ledit.move(200, 200);
|
||||
ledit.show();
|
||||
QApplication::setActiveWindow(&ledit);
|
||||
QApplicationPrivate::setActiveWindow(&ledit);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&ledit));
|
||||
QTest::keyClick(&ledit, Qt::Key_F);
|
||||
QCoreApplication::processEvents();
|
||||
@ -1280,7 +1282,7 @@ void tst_QCompleter::task246056_setCompletionPrefix()
|
||||
comboBox.addItem("a2");
|
||||
comboBox.move(200, 200);
|
||||
comboBox.show();
|
||||
QApplication::setActiveWindow(&comboBox);
|
||||
QApplicationPrivate::setActiveWindow(&comboBox);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&comboBox));
|
||||
QSignalSpy spy(comboBox.completer(), QOverload<const QModelIndex &>::of(&QCompleter::activated));
|
||||
QTest::keyPress(&comboBox, 'a');
|
||||
@ -1346,7 +1348,7 @@ void tst_QCompleter::task250064_lostFocus()
|
||||
task250064_Widget widget;
|
||||
widget.setWindowTitle(QLatin1String(QTest::currentTestFunction()));
|
||||
widget.show();
|
||||
QApplication::setActiveWindow(&widget);
|
||||
QApplicationPrivate::setActiveWindow(&widget);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&widget));
|
||||
QTest::keyPress(widget.textEdit(), 'a');
|
||||
Qt::FocusPolicy origPolicy = widget.textEdit()->focusPolicy();
|
||||
@ -1391,7 +1393,7 @@ void tst_QCompleter::task253125_lineEditCompletion()
|
||||
edit.move(200, 200);
|
||||
edit.show();
|
||||
edit.setFocus();
|
||||
QApplication::setActiveWindow(&edit);
|
||||
QApplicationPrivate::setActiveWindow(&edit);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&edit));
|
||||
|
||||
QTest::keyClick(&edit, 'i');
|
||||
@ -1554,7 +1556,7 @@ void tst_QCompleter::task247560_keyboardNavigation()
|
||||
edit.move(200, 200);
|
||||
edit.show();
|
||||
edit.setFocus();
|
||||
QApplication::setActiveWindow(&edit);
|
||||
QApplicationPrivate::setActiveWindow(&edit);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&edit));
|
||||
|
||||
QTest::keyClick(&edit, 'r');
|
||||
@ -1668,7 +1670,7 @@ void tst_QCompleter::QTBUG_14292_filesystem()
|
||||
|
||||
edit.move(200, 200);
|
||||
edit.show();
|
||||
QApplication::setActiveWindow(&edit);
|
||||
QApplicationPrivate::setActiveWindow(&edit);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&edit));
|
||||
QCOMPARE(QApplication::activeWindow(), &edit);
|
||||
edit.setFocus();
|
||||
@ -1712,7 +1714,7 @@ void tst_QCompleter::QTBUG_14292_filesystem()
|
||||
QWidget w;
|
||||
w.move(400, 200);
|
||||
w.show();
|
||||
QApplication::setActiveWindow(&w);
|
||||
QApplicationPrivate::setActiveWindow(&w);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&w));
|
||||
QVERIFY(!edit.hasFocus() && !comp.popup()->hasFocus());
|
||||
|
||||
@ -1749,7 +1751,7 @@ void tst_QCompleter::QTBUG_52028_tabAutoCompletes()
|
||||
const auto pos = w.screen()->availableGeometry().topLeft() + QPoint(200,200);
|
||||
w.move(pos);
|
||||
w.show();
|
||||
QApplication::setActiveWindow(&w);
|
||||
QApplicationPrivate::setActiveWindow(&w);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&w));
|
||||
|
||||
QSignalSpy activatedSpy(&cbox, &QComboBox::activated);
|
||||
@ -1793,7 +1795,7 @@ void tst_QCompleter::QTBUG_51889_activatedSentTwice()
|
||||
const auto pos = w.screen()->availableGeometry().topLeft() + QPoint(200,200);
|
||||
w.move(pos);
|
||||
w.show();
|
||||
QApplication::setActiveWindow(&w);
|
||||
QApplicationPrivate::setActiveWindow(&w);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&w));
|
||||
|
||||
QSignalSpy activatedSpy(&cbox, &QComboBox::activated);
|
||||
|
@ -14,4 +14,5 @@ qt_internal_add_test(tst_qscroller
|
||||
Qt::Gui
|
||||
Qt::GuiPrivate
|
||||
Qt::Widgets
|
||||
Qt::WidgetsPrivate
|
||||
)
|
||||
|
@ -8,6 +8,8 @@
|
||||
#include <QtGui/private/qeventpoint_p.h>
|
||||
#include <qpa/qwindowsysteminterface.h>
|
||||
|
||||
#include <QtWidgets/private/qapplication_p.h>
|
||||
|
||||
// #include <QDebug>
|
||||
|
||||
class tst_QScrollerWidget : public QWidget
|
||||
@ -321,7 +323,7 @@ void tst_QScroller::scrollTo()
|
||||
{
|
||||
QScopedPointer<tst_QScrollerWidget> sw(new tst_QScrollerWidget);
|
||||
sw->show();
|
||||
QApplication::setActiveWindow(sw.data());
|
||||
QApplicationPrivate::setActiveWindow(sw.data());
|
||||
if (!QTest::qWaitForWindowExposed(sw.data()) || !QTest::qWaitForWindowActive(sw.data()))
|
||||
QSKIP("Failed to show and activate window");
|
||||
|
||||
@ -353,7 +355,7 @@ void tst_QScroller::scroll()
|
||||
QScroller::grabGesture(sw.data(), QScroller::TouchGesture);
|
||||
sw->setGeometry(100, 100, 400, 300);
|
||||
sw->show();
|
||||
QApplication::setActiveWindow(sw.data());
|
||||
QApplicationPrivate::setActiveWindow(sw.data());
|
||||
if (!QTest::qWaitForWindowExposed(sw.data()) || !QTest::qWaitForWindowActive(sw.data()))
|
||||
QSKIP("Failed to show and activate window");
|
||||
|
||||
@ -394,7 +396,7 @@ void tst_QScroller::overshoot()
|
||||
QScroller::grabGesture(sw.data(), QScroller::TouchGesture);
|
||||
sw->setGeometry(100, 100, 400, 300);
|
||||
sw->show();
|
||||
QApplication::setActiveWindow(sw.data());
|
||||
QApplicationPrivate::setActiveWindow(sw.data());
|
||||
if (!QTest::qWaitForWindowExposed(sw.data()) || !QTest::qWaitForWindowActive(sw.data()))
|
||||
QSKIP("Failed to show and activate window");
|
||||
|
||||
|
@ -14,4 +14,5 @@ qt_internal_add_test(tst_qabstractbutton
|
||||
Qt::Gui
|
||||
Qt::GuiPrivate
|
||||
Qt::Widgets
|
||||
Qt::WidgetsPrivate
|
||||
)
|
||||
|
@ -19,6 +19,8 @@
|
||||
#include <qpa/qplatformintegration.h>
|
||||
#include <qpa/qplatformtheme.h>
|
||||
|
||||
#include <QtWidgets/private/qapplication_p.h>
|
||||
|
||||
class tst_QAbstractButton : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -478,7 +480,7 @@ void tst_QAbstractButton::setShortcut()
|
||||
|
||||
QKeySequence seq( Qt::Key_A );
|
||||
testWidget->setShortcut( seq );
|
||||
QApplication::setActiveWindow(testWidget);
|
||||
QApplicationPrivate::setActiveWindow(testWidget);
|
||||
testWidget->activateWindow();
|
||||
// must be active to get shortcuts
|
||||
QVERIFY(QTest::qWaitForWindowActive(testWidget));
|
||||
@ -639,7 +641,7 @@ void tst_QAbstractButton::keyNavigation()
|
||||
}
|
||||
|
||||
widget.show();
|
||||
qApp->setActiveWindow(&widget);
|
||||
QApplicationPrivate::setActiveWindow(&widget);
|
||||
widget.activateWindow();
|
||||
QVERIFY(QTest::qWaitForWindowActive(&widget));
|
||||
|
||||
|
@ -13,4 +13,5 @@ qt_internal_add_test(tst_qbuttongroup
|
||||
LIBRARIES
|
||||
Qt::Gui
|
||||
Qt::Widgets
|
||||
Qt::WidgetsPrivate
|
||||
)
|
||||
|
@ -19,6 +19,8 @@
|
||||
#include <qsettings.h>
|
||||
#endif
|
||||
|
||||
#include <QtWidgets/private/qapplication_p.h>
|
||||
|
||||
class SpecialRadioButton: public QRadioButton
|
||||
{
|
||||
public:
|
||||
@ -120,7 +122,7 @@ void tst_QButtonGroup::arrowKeyNavigation()
|
||||
layout.addWidget(&g2);
|
||||
|
||||
dlg.show();
|
||||
qApp->setActiveWindow(&dlg);
|
||||
QApplicationPrivate::setActiveWindow(&dlg);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&dlg));
|
||||
|
||||
bt1.setFocus();
|
||||
@ -202,7 +204,7 @@ void tst_QButtonGroup::keyNavigationPushButtons()
|
||||
buttonGroup->addButton(pb3);
|
||||
|
||||
dlg.show();
|
||||
qApp->setActiveWindow(&dlg);
|
||||
QApplicationPrivate::setActiveWindow(&dlg);
|
||||
if (!QTest::qWaitForWindowActive(&dlg))
|
||||
QSKIP("Window activation failed, skipping test");
|
||||
|
||||
@ -433,7 +435,7 @@ void tst_QButtonGroup::task106609()
|
||||
qRegisterMetaType<QAbstractButton*>("QAbstractButton*");
|
||||
QSignalSpy spy1(buttons, SIGNAL(buttonClicked(QAbstractButton*)));
|
||||
|
||||
QApplication::setActiveWindow(&dlg);
|
||||
QApplicationPrivate::setActiveWindow(&dlg);
|
||||
QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget*>(&dlg));
|
||||
|
||||
radio1->setFocus();
|
||||
|
@ -46,6 +46,8 @@
|
||||
|
||||
#include <QtTest/private/qtesthelpers_p.h>
|
||||
|
||||
#include <QtWidgets/private/qapplication_p.h>
|
||||
|
||||
using namespace QTestPrivate;
|
||||
|
||||
class tst_QComboBox : public QObject
|
||||
@ -833,7 +835,7 @@ void tst_QComboBox::autoCompletionCaseSensitivity()
|
||||
TestWidget topLevel;
|
||||
topLevel.show();
|
||||
QComboBox *testWidget = topLevel.comboBox();
|
||||
qApp->setActiveWindow(&topLevel);
|
||||
QApplicationPrivate::setActiveWindow(&topLevel);
|
||||
testWidget->setFocus();
|
||||
QVERIFY(QTest::qWaitForWindowActive(&topLevel));
|
||||
QCOMPARE(qApp->focusWidget(), (QWidget *)testWidget);
|
||||
@ -2006,7 +2008,7 @@ void tst_QComboBox::flaggedItems()
|
||||
comboBox.setView(&listWidget);
|
||||
comboBox.move(200, 200);
|
||||
comboBox.show();
|
||||
QApplication::setActiveWindow(&comboBox);
|
||||
QApplicationPrivate::setActiveWindow(&comboBox);
|
||||
comboBox.activateWindow();
|
||||
comboBox.setFocus();
|
||||
QVERIFY(QTest::qWaitForWindowActive(&comboBox));
|
||||
@ -2435,7 +2437,7 @@ void tst_QComboBox::task247863_keyBoardSelection()
|
||||
combo.addItem( QLatin1String("111"));
|
||||
combo.addItem( QLatin1String("222"));
|
||||
combo.show();
|
||||
QApplication::setActiveWindow(&combo);
|
||||
QApplicationPrivate::setActiveWindow(&combo);
|
||||
QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&combo));
|
||||
|
||||
QSignalSpy spy(&combo, &QComboBox::activated);
|
||||
@ -2461,7 +2463,7 @@ void tst_QComboBox::task220195_keyBoardSelection2()
|
||||
combo.addItem( QLatin1String("foo2"));
|
||||
combo.addItem( QLatin1String("foo3"));
|
||||
combo.show();
|
||||
QApplication::setActiveWindow(&combo);
|
||||
QApplicationPrivate::setActiveWindow(&combo);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&combo));
|
||||
|
||||
combo.setCurrentIndex(-1);
|
||||
@ -2747,7 +2749,7 @@ void tst_QComboBox::keyBoardNavigationWithMouse()
|
||||
|
||||
combo.move(200, 200);
|
||||
combo.showNormal();
|
||||
QApplication::setActiveWindow(&combo);
|
||||
QApplicationPrivate::setActiveWindow(&combo);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&combo));
|
||||
|
||||
QCOMPARE(combo.currentText(), QLatin1String("0"));
|
||||
@ -2803,7 +2805,7 @@ void tst_QComboBox::task_QTBUG_1071_changingFocusEmitsActivated()
|
||||
layout.addWidget(&edit);
|
||||
|
||||
w.show();
|
||||
QApplication::setActiveWindow(&w);
|
||||
QApplicationPrivate::setActiveWindow(&w);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&w));
|
||||
cb.clearEditText();
|
||||
cb.setFocus();
|
||||
@ -3423,7 +3425,7 @@ void tst_QComboBox::task_QTBUG_52027_mapCompleterIndex()
|
||||
QCOMPARE(spy.count(), 0);
|
||||
cbox.move(200, 200);
|
||||
cbox.show();
|
||||
QApplication::setActiveWindow(&cbox);
|
||||
QApplicationPrivate::setActiveWindow(&cbox);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&cbox));
|
||||
|
||||
QTest::keyClicks(&cbox, "foobar2");
|
||||
@ -3449,7 +3451,7 @@ void tst_QComboBox::task_QTBUG_52027_mapCompleterIndex()
|
||||
cbox.activateWindow();
|
||||
}
|
||||
|
||||
QApplication::setActiveWindow(&cbox);
|
||||
QApplicationPrivate::setActiveWindow(&cbox);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&cbox));
|
||||
|
||||
QTest::keyClicks(&cbox, "foobar1");
|
||||
@ -3517,7 +3519,7 @@ void tst_QComboBox::checkEmbeddedLineEditWhenStyleSheetIsSet()
|
||||
layout->addWidget(comboBox);
|
||||
topLevel.show();
|
||||
comboBox->setEditable(true);
|
||||
QApplication::setActiveWindow(&topLevel);
|
||||
QApplicationPrivate::setActiveWindow(&topLevel);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&topLevel));
|
||||
|
||||
QImage grab = comboBox->grab().toImage();
|
||||
|
@ -47,6 +47,8 @@
|
||||
|
||||
#include <private/qdatetimeedit_p.h>
|
||||
|
||||
#include <QtWidgets/private/qapplication_p.h>
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
# include <qt_windows.h>
|
||||
#endif
|
||||
@ -823,7 +825,7 @@ void tst_QDateTimeEdit::selectAndScrollWithKeys()
|
||||
return;
|
||||
#endif
|
||||
|
||||
qApp->setActiveWindow(testWidget);
|
||||
QApplicationPrivate::setActiveWindow(testWidget);
|
||||
testWidget->setDate(QDate(2004, 05, 11));
|
||||
testWidget->setDisplayFormat("dd/MM/yyyy");
|
||||
testWidget->show();
|
||||
@ -925,7 +927,7 @@ void tst_QDateTimeEdit::selectAndScrollWithKeys()
|
||||
|
||||
void tst_QDateTimeEdit::backspaceKey()
|
||||
{
|
||||
qApp->setActiveWindow(testWidget);
|
||||
QApplicationPrivate::setActiveWindow(testWidget);
|
||||
testWidget->setDate(QDate(2004, 05, 11));
|
||||
testWidget->setDisplayFormat("d/MM/yyyy");
|
||||
testWidget->show();
|
||||
@ -991,7 +993,7 @@ void tst_QDateTimeEdit::backspaceKey()
|
||||
|
||||
void tst_QDateTimeEdit::deleteKey()
|
||||
{
|
||||
qApp->setActiveWindow(testWidget);
|
||||
QApplicationPrivate::setActiveWindow(testWidget);
|
||||
testWidget->setDate(QDate(2004, 05, 11));
|
||||
testWidget->setDisplayFormat("d/MM/yyyy");
|
||||
#ifdef Q_OS_MAC
|
||||
@ -1010,7 +1012,7 @@ void tst_QDateTimeEdit::deleteKey()
|
||||
|
||||
void tst_QDateTimeEdit::tabKeyNavigation()
|
||||
{
|
||||
qApp->setActiveWindow(testWidget);
|
||||
QApplicationPrivate::setActiveWindow(testWidget);
|
||||
testWidget->setDate(QDate(2004, 05, 11));
|
||||
testWidget->setDisplayFormat("dd/MM/yyyy");
|
||||
testWidget->show();
|
||||
@ -1028,7 +1030,7 @@ void tst_QDateTimeEdit::tabKeyNavigation()
|
||||
|
||||
void tst_QDateTimeEdit::tabKeyNavigationWithPrefix()
|
||||
{
|
||||
qApp->setActiveWindow(testWidget);
|
||||
QApplicationPrivate::setActiveWindow(testWidget);
|
||||
testWidget->setDate(QDate(2004, 05, 11));
|
||||
testWidget->setDisplayFormat("prefix dd/MM/yyyy");
|
||||
|
||||
@ -1046,7 +1048,7 @@ void tst_QDateTimeEdit::tabKeyNavigationWithPrefix()
|
||||
|
||||
void tst_QDateTimeEdit::tabKeyNavigationWithSuffix()
|
||||
{
|
||||
qApp->setActiveWindow(testWidget);
|
||||
QApplicationPrivate::setActiveWindow(testWidget);
|
||||
testWidget->setDate(QDate(2004, 05, 11));
|
||||
testWidget->setDisplayFormat("dd/MM/yyyy 'suffix'");
|
||||
|
||||
@ -1062,7 +1064,7 @@ void tst_QDateTimeEdit::tabKeyNavigationWithSuffix()
|
||||
|
||||
void tst_QDateTimeEdit::enterKey()
|
||||
{
|
||||
qApp->setActiveWindow(testWidget);
|
||||
QApplicationPrivate::setActiveWindow(testWidget);
|
||||
testWidget->setDate(QDate(2004, 5, 11));
|
||||
testWidget->setDisplayFormat("prefix d/MM/yyyy 'suffix'");
|
||||
testWidget->lineEdit()->setFocus();
|
||||
@ -1350,7 +1352,7 @@ void tst_QDateTimeEdit::editingRanged()
|
||||
});
|
||||
|
||||
edit->show();
|
||||
QApplication::setActiveWindow(edit.get());
|
||||
QApplicationPrivate::setActiveWindow(edit.get());
|
||||
if (!QTest::qWaitForWindowActive(edit.get()))
|
||||
QSKIP("Failed to make window active, aborting");
|
||||
edit->setFocus();
|
||||
|
@ -18,6 +18,8 @@
|
||||
|
||||
Q_LOGGING_CATEGORY(lcTestDockWidget, "qt.widgets.tests.qdockwidget")
|
||||
|
||||
#include <QtWidgets/private/qapplication_p.h>
|
||||
|
||||
bool hasFeature(QDockWidget *dockwidget, QDockWidget::DockWidgetFeature feature)
|
||||
{ return (dockwidget->features() & feature) == feature; }
|
||||
|
||||
@ -1157,7 +1159,7 @@ void tst_QDockWidget::createTestWidgets(QMainWindow* &mainWindow, QPointer<QWidg
|
||||
d1->show();
|
||||
d2->show();
|
||||
mainWindow->show();
|
||||
QApplication::setActiveWindow(mainWindow);
|
||||
QApplicationPrivate::setActiveWindow(mainWindow);
|
||||
|
||||
}
|
||||
|
||||
|
@ -13,4 +13,5 @@ qt_internal_add_test(tst_qdoublespinbox
|
||||
LIBRARIES
|
||||
Qt::Gui
|
||||
Qt::Widgets
|
||||
Qt::WidgetsPrivate
|
||||
)
|
||||
|
@ -22,6 +22,8 @@
|
||||
#include <QStyle>
|
||||
#include <QProxyStyle>
|
||||
|
||||
#include <QtWidgets/private/qapplication_p.h>
|
||||
|
||||
class DoubleSpinBox : public QDoubleSpinBox
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -1145,7 +1147,7 @@ void tst_QDoubleSpinBox::taskQTBUG_5008_textFromValueAndValidate()
|
||||
spinbox.show();
|
||||
spinbox.activateWindow();
|
||||
spinbox.setFocus();
|
||||
QApplication::setActiveWindow(&spinbox);
|
||||
QApplicationPrivate::setActiveWindow(&spinbox);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&spinbox));
|
||||
QCOMPARE(static_cast<QWidget *>(&spinbox), QApplication::activeWindow());
|
||||
QTRY_VERIFY(spinbox.hasFocus());
|
||||
|
@ -14,4 +14,5 @@ qt_internal_add_test(tst_qgroupbox
|
||||
Qt::Gui
|
||||
Qt::GuiPrivate
|
||||
Qt::Widgets
|
||||
Qt::WidgetsPrivate
|
||||
)
|
||||
|
@ -14,6 +14,8 @@
|
||||
#include <private/qguiapplication_p.h>
|
||||
#include <qpa/qplatformtheme.h>
|
||||
|
||||
#include <QtWidgets/private/qapplication_p.h>
|
||||
|
||||
#include "qgroupbox.h"
|
||||
|
||||
class tst_QGroupBox : public QObject
|
||||
@ -460,7 +462,7 @@ void tst_QGroupBox::propagateFocus()
|
||||
QGroupBox box;
|
||||
QLineEdit lineEdit(&box);
|
||||
box.show();
|
||||
QApplication::setActiveWindow(&box);
|
||||
QApplicationPrivate::setActiveWindow(&box);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&box));
|
||||
box.setFocus();
|
||||
QTRY_COMPARE(qApp->focusWidget(), static_cast<QWidget*>(&lineEdit));
|
||||
|
@ -18,6 +18,8 @@
|
||||
#include <qmath.h>
|
||||
#include <private/qlabel_p.h>
|
||||
|
||||
#include <QtWidgets/private/qapplication_p.h>
|
||||
|
||||
class Widget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -165,7 +167,7 @@ void tst_QLabel::setBuddy()
|
||||
layout->addWidget(test_edit);
|
||||
layout->addWidget(test_edit2);
|
||||
test_box->show();
|
||||
qApp->setActiveWindow(test_box);
|
||||
QApplicationPrivate::setActiveWindow(test_box);
|
||||
QVERIFY(test_box->isActiveWindow());
|
||||
|
||||
test_label->setBuddy( test_edit );
|
||||
|
@ -3712,7 +3712,7 @@ void tst_QLineEdit::task174640_editingFinished()
|
||||
layout->addWidget(le2);
|
||||
|
||||
mw.show();
|
||||
QApplication::setActiveWindow(&mw);
|
||||
QApplicationPrivate::setActiveWindow(&mw);
|
||||
mw.activateWindow();
|
||||
QVERIFY(QTest::qWaitForWindowActive(&mw));
|
||||
QCOMPARE(&mw, QApplication::activeWindow());
|
||||
@ -3820,7 +3820,7 @@ void tst_QLineEdit::task210502_caseInsensitiveInlineCompletion()
|
||||
completer.setCompletionMode(QCompleter::InlineCompletion);
|
||||
lineEdit.setCompleter(&completer);
|
||||
lineEdit.show();
|
||||
QApplication::setActiveWindow(&lineEdit);
|
||||
QApplicationPrivate::setActiveWindow(&lineEdit);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&lineEdit));
|
||||
lineEdit.setFocus();
|
||||
QTRY_VERIFY(lineEdit.hasFocus());
|
||||
@ -3921,7 +3921,7 @@ void tst_QLineEdit::task241436_passwordEchoOnEditRestoreEchoMode()
|
||||
testWidget->setFocus();
|
||||
centerOnScreen(testWidget);
|
||||
testWidget->show();
|
||||
QApplication::setActiveWindow(testWidget);
|
||||
QApplicationPrivate::setActiveWindow(testWidget);
|
||||
QVERIFY(QTest::qWaitForWindowActive(testWidget));
|
||||
QVERIFY(testWidget->hasFocus());
|
||||
|
||||
@ -3972,7 +3972,7 @@ void tst_QLineEdit::taskQTBUG_4401_enterKeyClearsPassword()
|
||||
testWidget->selectAll();
|
||||
centerOnScreen(testWidget);
|
||||
testWidget->show();
|
||||
QApplication::setActiveWindow(testWidget);
|
||||
QApplicationPrivate::setActiveWindow(testWidget);
|
||||
QVERIFY(QTest::qWaitForWindowActive(testWidget));
|
||||
|
||||
QTest::keyPress(testWidget, Qt::Key_Enter);
|
||||
@ -4055,7 +4055,7 @@ void tst_QLineEdit::taskQTBUG_7395_readOnlyShortcut()
|
||||
|
||||
le.show();
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&le));
|
||||
QApplication::setActiveWindow(&le);
|
||||
QApplicationPrivate::setActiveWindow(&le);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&le));
|
||||
le.setFocus();
|
||||
QTRY_VERIFY(le.hasFocus());
|
||||
@ -4077,7 +4077,7 @@ void tst_QLineEdit::QTBUG697_paletteCurrentColorGroup()
|
||||
le.setPalette(p);
|
||||
|
||||
le.show();
|
||||
QApplication::setActiveWindow(&le);
|
||||
QApplicationPrivate::setActiveWindow(&le);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&le));
|
||||
le.setFocus();
|
||||
QTRY_VERIFY(le.hasFocus());
|
||||
@ -4545,7 +4545,7 @@ void tst_QLineEdit::clearButton()
|
||||
l->addWidget(listView);
|
||||
testWidget.move(300, 300);
|
||||
testWidget.show();
|
||||
qApp->setActiveWindow(&testWidget);
|
||||
QApplicationPrivate::setActiveWindow(&testWidget);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&testWidget));
|
||||
// Flip the clear button on,off, trying to detect crashes.
|
||||
filterLineEdit->setClearButtonEnabled(true);
|
||||
|
@ -17,6 +17,7 @@ qt_internal_add_test(tst_qmdiarea
|
||||
Qt::Gui
|
||||
Qt::GuiPrivate
|
||||
Qt::Widgets
|
||||
Qt::WidgetsPrivate
|
||||
)
|
||||
|
||||
## Scopes:
|
||||
|
@ -24,6 +24,8 @@
|
||||
#endif
|
||||
#include <QStyleHints>
|
||||
|
||||
#include <QtWidgets/private/qapplication_p.h>
|
||||
|
||||
static const Qt::WindowFlags DefaultWindowFlags
|
||||
= Qt::SubWindow | Qt::WindowSystemMenuHint
|
||||
| Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint;
|
||||
@ -304,7 +306,7 @@ void tst_QMdiArea::subWindowActivated()
|
||||
QSignalSpy spy(workspace, SIGNAL(subWindowActivated(QMdiSubWindow*)));
|
||||
connect( workspace, SIGNAL(subWindowActivated(QMdiSubWindow*)), this, SLOT(activeChanged(QMdiSubWindow*)));
|
||||
mw.show();
|
||||
qApp->setActiveWindow(&mw);
|
||||
QApplicationPrivate::setActiveWindow(&mw);
|
||||
|
||||
QFETCH( int, count );
|
||||
int i;
|
||||
@ -512,7 +514,7 @@ void tst_QMdiArea::subWindowActivatedWithMinimize()
|
||||
QSignalSpy spy(workspace, SIGNAL(subWindowActivated(QMdiSubWindow*)));
|
||||
connect( workspace, SIGNAL(subWindowActivated(QMdiSubWindow*)), this, SLOT(activeChanged(QMdiSubWindow*)) );
|
||||
mw.show();
|
||||
qApp->setActiveWindow(&mw);
|
||||
QApplicationPrivate::setActiveWindow(&mw);
|
||||
QWidget *widget = new QWidget(workspace);
|
||||
widget->setAttribute(Qt::WA_DeleteOnClose);
|
||||
QMdiSubWindow *window1 = workspace->addSubWindow(widget);
|
||||
@ -657,7 +659,7 @@ void tst_QMdiArea::changeWindowTitle()
|
||||
#endif
|
||||
|
||||
mw->show();
|
||||
qApp->setActiveWindow(mw);
|
||||
QApplicationPrivate::setActiveWindow(mw);
|
||||
|
||||
#ifdef USE_SHOW
|
||||
mw->showFullScreen();
|
||||
@ -902,7 +904,7 @@ void tst_QMdiArea::setActiveSubWindow()
|
||||
|
||||
QSignalSpy spy(&workspace, SIGNAL(subWindowActivated(QMdiSubWindow*)));
|
||||
connect(&workspace, SIGNAL(subWindowActivated(QMdiSubWindow*)), this, SLOT(activeChanged(QMdiSubWindow*)));
|
||||
qApp->setActiveWindow(&workspace);
|
||||
QApplicationPrivate::setActiveWindow(&workspace);
|
||||
|
||||
// Activate hidden windows
|
||||
const int windowCount = 10;
|
||||
@ -961,7 +963,7 @@ void tst_QMdiArea::activeSubWindow()
|
||||
mainWindow.addDockWidget(Qt::LeftDockWidgetArea, dockWidget);
|
||||
|
||||
mainWindow.show();
|
||||
qApp->setActiveWindow(&mainWindow);
|
||||
QApplicationPrivate::setActiveWindow(&mainWindow);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&mainWindow));
|
||||
QCOMPARE(mdiArea->activeSubWindow(), subWindow);
|
||||
QCOMPARE(qApp->focusWidget(), (QWidget *)subWindowLineEdit);
|
||||
@ -984,15 +986,15 @@ void tst_QMdiArea::activeSubWindow()
|
||||
dummyTopLevel.show();
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&dummyTopLevel));
|
||||
|
||||
qApp->setActiveWindow(&dummyTopLevel);
|
||||
QApplicationPrivate::setActiveWindow(&dummyTopLevel);
|
||||
QCOMPARE(mdiArea->activeSubWindow(), subWindow);
|
||||
|
||||
qApp->setActiveWindow(&mainWindow);
|
||||
QApplicationPrivate::setActiveWindow(&mainWindow);
|
||||
QCOMPARE(mdiArea->activeSubWindow(), subWindow);
|
||||
|
||||
//task 202657
|
||||
dockWidgetLineEdit->setFocus();
|
||||
qApp->setActiveWindow(&mainWindow);
|
||||
QApplicationPrivate::setActiveWindow(&mainWindow);
|
||||
QVERIFY(dockWidgetLineEdit->hasFocus());
|
||||
}
|
||||
|
||||
@ -1005,7 +1007,7 @@ void tst_QMdiArea::currentSubWindow()
|
||||
for (int i = 0; i < 5; ++i)
|
||||
mdiArea.addSubWindow(new QLineEdit)->show();
|
||||
|
||||
qApp->setActiveWindow(&mdiArea);
|
||||
QApplicationPrivate::setActiveWindow(&mdiArea);
|
||||
QCOMPARE(qApp->activeWindow(), (QWidget *)&mdiArea);
|
||||
|
||||
// Check that the last added window is the active and the current.
|
||||
@ -1020,7 +1022,7 @@ void tst_QMdiArea::currentSubWindow()
|
||||
|
||||
// Move focus to another top-level and check that we still
|
||||
// have an active window.
|
||||
qApp->setActiveWindow(&dummyTopLevel);
|
||||
QApplicationPrivate::setActiveWindow(&dummyTopLevel);
|
||||
QCOMPARE(qApp->activeWindow(), (QWidget *)&dummyTopLevel);
|
||||
QVERIFY(mdiArea.activeSubWindow());
|
||||
|
||||
@ -1033,7 +1035,7 @@ void tst_QMdiArea::currentSubWindow()
|
||||
QCOMPARE(mdiArea.currentSubWindow(), mdiArea.subWindowList().front());
|
||||
|
||||
// Activate mdi area and check that active == current.
|
||||
qApp->setActiveWindow(&mdiArea);
|
||||
QApplicationPrivate::setActiveWindow(&mdiArea);
|
||||
active = mdiArea.activeSubWindow();
|
||||
QVERIFY(active);
|
||||
QCOMPARE(mdiArea.activeSubWindow(), mdiArea.subWindowList().front());
|
||||
@ -1042,11 +1044,11 @@ void tst_QMdiArea::currentSubWindow()
|
||||
QCOMPARE(mdiArea.activeSubWindow(), active);
|
||||
QCOMPARE(mdiArea.currentSubWindow(), active);
|
||||
|
||||
qApp->setActiveWindow(&dummyTopLevel);
|
||||
QApplicationPrivate::setActiveWindow(&dummyTopLevel);
|
||||
QVERIFY(mdiArea.activeSubWindow());
|
||||
QCOMPARE(mdiArea.currentSubWindow(), active);
|
||||
|
||||
qApp->setActiveWindow(&mdiArea);
|
||||
QApplicationPrivate::setActiveWindow(&mdiArea);
|
||||
active->show();
|
||||
QCOMPARE(mdiArea.activeSubWindow(), active);
|
||||
|
||||
@ -1251,7 +1253,7 @@ void tst_QMdiArea::closeWindows()
|
||||
{
|
||||
QMdiArea workspace;
|
||||
workspace.show();
|
||||
qApp->setActiveWindow(&workspace);
|
||||
QApplicationPrivate::setActiveWindow(&workspace);
|
||||
|
||||
// Close widget
|
||||
QWidget *widget = new QWidget;
|
||||
@ -1303,7 +1305,7 @@ void tst_QMdiArea::activateNextAndPreviousWindow()
|
||||
{
|
||||
QMdiArea workspace;
|
||||
workspace.show();
|
||||
qApp->setActiveWindow(&workspace);
|
||||
QApplicationPrivate::setActiveWindow(&workspace);
|
||||
|
||||
const int windowCount = 10;
|
||||
QMdiSubWindow *windows[windowCount];
|
||||
@ -1387,7 +1389,7 @@ void tst_QMdiArea::subWindowList()
|
||||
|
||||
QMdiArea workspace;
|
||||
workspace.show();
|
||||
qApp->setActiveWindow(&workspace);
|
||||
QApplicationPrivate::setActiveWindow(&workspace);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&workspace));
|
||||
|
||||
QList<QMdiSubWindow *> activationOrder;
|
||||
@ -1866,7 +1868,7 @@ void tst_QMdiArea::focusWidgetAfterAddSubWindow()
|
||||
|
||||
mdiArea.show();
|
||||
view->show();
|
||||
qApp->setActiveWindow(&mdiArea);
|
||||
QApplicationPrivate::setActiveWindow(&mdiArea);
|
||||
QCOMPARE(qApp->focusWidget(), static_cast<QWidget *>(lineEdit2));
|
||||
}
|
||||
|
||||
@ -1875,7 +1877,7 @@ void tst_QMdiArea::dontMaximizeSubWindowOnActivation()
|
||||
QMdiArea mdiArea;
|
||||
mdiArea.show();
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&mdiArea));
|
||||
qApp->setActiveWindow(&mdiArea);
|
||||
QApplicationPrivate::setActiveWindow(&mdiArea);
|
||||
|
||||
// Add one maximized window.
|
||||
mdiArea.addSubWindow(new QWidget)->showMaximized();
|
||||
@ -2260,7 +2262,7 @@ void tst_QMdiArea::tabBetweenSubWindows()
|
||||
mdiArea.show();
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&mdiArea));
|
||||
|
||||
qApp->setActiveWindow(&mdiArea);
|
||||
QApplicationPrivate::setActiveWindow(&mdiArea);
|
||||
QWidget *focusWidget = subWindows.back()->widget();
|
||||
QCOMPARE(qApp->focusWidget(), focusWidget);
|
||||
|
||||
|
@ -25,6 +25,8 @@
|
||||
#include <QSignalSpy>
|
||||
#include <QList>
|
||||
|
||||
#include <QtWidgets/private/qapplication_p.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
extern bool qt_tab_all_widgets();
|
||||
QT_END_NAMESPACE
|
||||
@ -382,7 +384,7 @@ void tst_QMdiSubWindow::mainWindowSupport()
|
||||
mainWindow.setCentralWidget(workspace);
|
||||
mainWindow.show();
|
||||
mainWindow.menuBar()->setVisible(true);
|
||||
QApplication::setActiveWindow(&mainWindow);
|
||||
QApplicationPrivate::setActiveWindow(&mainWindow);
|
||||
bool nativeMenuBar = mainWindow.menuBar()->isNativeMenuBar();
|
||||
|
||||
// QMainWindow's window title is empty, so on a platform which does NOT have a native menubar,
|
||||
@ -508,7 +510,7 @@ void tst_QMdiSubWindow::emittingOfSignals()
|
||||
workspace.setWindowTitle(QLatin1String(QTest::currentTestFunction()));
|
||||
workspace.show();
|
||||
QCoreApplication::processEvents();
|
||||
QApplication::setActiveWindow(&workspace);
|
||||
QApplicationPrivate::setActiveWindow(&workspace);
|
||||
QMdiSubWindow *window = qobject_cast<QMdiSubWindow *>(workspace.addSubWindow(new QWidget));
|
||||
QCoreApplication::processEvents();
|
||||
window->show();
|
||||
@ -1134,7 +1136,7 @@ void tst_QMdiSubWindow::restoreFocus()
|
||||
topArea.show();
|
||||
box->show();
|
||||
|
||||
QApplication::setActiveWindow(&topArea);
|
||||
QApplicationPrivate::setActiveWindow(&topArea);
|
||||
QMdiSubWindow *expectedFocusWindow = nestedWorkspace->subWindowList().last();
|
||||
QVERIFY(expectedFocusWindow);
|
||||
QVERIFY(expectedFocusWindow->widget());
|
||||
@ -1226,7 +1228,7 @@ void tst_QMdiSubWindow::restoreFocusOverCreation()
|
||||
subWidget1->m_lineEdit2->setFocus();
|
||||
subWindow1->show();
|
||||
mdiArea.show();
|
||||
QApplication::setActiveWindow(&mdiArea);
|
||||
QApplicationPrivate::setActiveWindow(&mdiArea);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&mdiArea));
|
||||
QCOMPARE(QApplication::focusWidget(), subWidget1->m_lineEdit2);
|
||||
|
||||
@ -1256,7 +1258,7 @@ void tst_QMdiSubWindow::changeFocusWithTab()
|
||||
mdiArea.show();
|
||||
QCOMPARE(mdiArea.subWindowList().count(), 1);
|
||||
|
||||
QApplication::setActiveWindow(&mdiArea);
|
||||
QApplicationPrivate::setActiveWindow(&mdiArea);
|
||||
QCOMPARE(QApplication::focusWidget(), static_cast<QWidget *>(firstLineEdit));
|
||||
|
||||
// Next
|
||||
@ -1951,7 +1953,7 @@ void tst_QMdiSubWindow::task_182852()
|
||||
mainWindow.setCentralWidget(workspace);
|
||||
mainWindow.show();
|
||||
mainWindow.menuBar()->setVisible(true);
|
||||
QApplication::setActiveWindow(&mainWindow);
|
||||
QApplicationPrivate::setActiveWindow(&mainWindow);
|
||||
if (mainWindow.menuBar()->isNativeMenuBar())
|
||||
return; // The main window's title is not overwritten if we have a native menubar (macOS, Unity etc.)
|
||||
|
||||
|
@ -15,6 +15,7 @@ qt_internal_add_test(tst_qmenu
|
||||
Qt::GuiPrivate
|
||||
Qt::TestPrivate
|
||||
Qt::Widgets
|
||||
Qt::WidgetsPrivate
|
||||
)
|
||||
|
||||
## Scopes:
|
||||
|
@ -27,6 +27,8 @@
|
||||
#include <qpa/qplatformtheme.h>
|
||||
#include <qpa/qplatformintegration.h>
|
||||
|
||||
#include <QtWidgets/private/qapplication_p.h>
|
||||
|
||||
using namespace QTestPrivate;
|
||||
|
||||
Q_DECLARE_METATYPE(Qt::Key);
|
||||
@ -481,7 +483,7 @@ void tst_QMenu::focus()
|
||||
QPushButton button("Push me", &window);
|
||||
centerOnScreen(&window);
|
||||
window.show();
|
||||
qApp->setActiveWindow(&window);
|
||||
QApplicationPrivate::setActiveWindow(&window);
|
||||
|
||||
QVERIFY(button.hasFocus());
|
||||
QCOMPARE(QApplication::focusWidget(), (QWidget *)&button);
|
||||
@ -525,7 +527,7 @@ void tst_QMenu::overrideMenuAction()
|
||||
m->addAction(aQuit);
|
||||
|
||||
w.show();
|
||||
QApplication::setActiveWindow(&w);
|
||||
QApplicationPrivate::setActiveWindow(&w);
|
||||
w.setFocus();
|
||||
QVERIFY(QTest::qWaitForWindowActive(&w));
|
||||
QVERIFY(w.hasFocus());
|
||||
@ -1603,7 +1605,7 @@ void tst_QMenu::transientParent()
|
||||
QWindow *topLevel = window.windowHandle();
|
||||
QVERIFY(topLevel);
|
||||
|
||||
QApplication::setActiveWindow(&window);
|
||||
QApplicationPrivate::setActiveWindow(&window);
|
||||
window.setFocus();
|
||||
QVERIFY(QTest::qWaitForWindowActive(&window));
|
||||
QVERIFY(window.hasFocus());
|
||||
|
@ -14,6 +14,7 @@ qt_internal_add_test(tst_qmenubar
|
||||
Qt::Gui
|
||||
Qt::TestPrivate
|
||||
Qt::Widgets
|
||||
Qt::WidgetsPrivate
|
||||
)
|
||||
|
||||
## Scopes:
|
||||
|
@ -20,6 +20,8 @@
|
||||
|
||||
#include <qobject.h>
|
||||
|
||||
#include <QtWidgets/private/qapplication_p.h>
|
||||
|
||||
QT_FORWARD_DECLARE_CLASS(QMainWindow)
|
||||
|
||||
#include <qmenubar.h>
|
||||
@ -334,7 +336,7 @@ void tst_QMenuBar::accel()
|
||||
QMainWindow w;
|
||||
const TestMenu menu = initWindowWithSimpleMenuBar(w);
|
||||
w.show();
|
||||
QApplication::setActiveWindow(&w);
|
||||
QApplicationPrivate::setActiveWindow(&w);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&w));
|
||||
// shortcuts won't work unless the window is active
|
||||
QTest::keyClick(static_cast<QWidget *>(0), Qt::Key_A, Qt::ControlModifier );
|
||||
@ -356,7 +358,7 @@ void tst_QMenuBar::activatedCount()
|
||||
QFETCH( bool, forceNonNative );
|
||||
initWindowWithSimpleMenuBar(w, forceNonNative);
|
||||
w.show();
|
||||
QApplication::setActiveWindow(&w);
|
||||
QApplicationPrivate::setActiveWindow(&w);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&w));
|
||||
|
||||
QTest::keyClick(static_cast<QWidget *>(0), Qt::Key_A, Qt::ControlModifier );
|
||||
@ -556,7 +558,7 @@ void tst_QMenuBar::check_accelKeys()
|
||||
QMainWindow w;
|
||||
initWindowWithComplexMenuBar(w);
|
||||
w.show();
|
||||
QApplication::setActiveWindow(&w);
|
||||
QApplicationPrivate::setActiveWindow(&w);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&w));
|
||||
|
||||
// start with a bogus key that shouldn't trigger anything
|
||||
@ -635,7 +637,7 @@ void tst_QMenuBar::check_cursorKeys1()
|
||||
QMainWindow w;
|
||||
initWindowWithComplexMenuBar(w);
|
||||
w.show();
|
||||
QApplication::setActiveWindow(&w);
|
||||
QApplicationPrivate::setActiveWindow(&w);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&w));
|
||||
|
||||
// start with a ALT + 1 that activates the first popupmenu
|
||||
@ -675,7 +677,7 @@ void tst_QMenuBar::check_cursorKeys2()
|
||||
QMainWindow w;
|
||||
initWindowWithComplexMenuBar(w);
|
||||
w.show();
|
||||
QApplication::setActiveWindow(&w);
|
||||
QApplicationPrivate::setActiveWindow(&w);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&w));
|
||||
|
||||
// select popupmenu2
|
||||
@ -714,7 +716,7 @@ void tst_QMenuBar::check_cursorKeys3()
|
||||
QMainWindow w;
|
||||
initWindowWithComplexMenuBar(w);
|
||||
w.show();
|
||||
QApplication::setActiveWindow(&w);
|
||||
QApplicationPrivate::setActiveWindow(&w);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&w));
|
||||
|
||||
// select Popupmenu 2
|
||||
@ -756,7 +758,7 @@ void tst_QMenuBar::taskQTBUG56860_focus()
|
||||
|
||||
w.setCentralWidget(e);
|
||||
w.show();
|
||||
QApplication::setActiveWindow(&w);
|
||||
QApplicationPrivate::setActiveWindow(&w);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&w));
|
||||
|
||||
QTRY_COMPARE(QApplication::focusWidget(), e);
|
||||
@ -796,7 +798,7 @@ void tst_QMenuBar::check_homeKey()
|
||||
QMainWindow w;
|
||||
initWindowWithComplexMenuBar(w);
|
||||
w.show();
|
||||
QApplication::setActiveWindow(&w);
|
||||
QApplicationPrivate::setActiveWindow(&w);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&w));
|
||||
|
||||
// select Popupmenu 2
|
||||
@ -837,7 +839,7 @@ void tst_QMenuBar::check_endKey()
|
||||
QMainWindow w;
|
||||
initWindowWithComplexMenuBar(w);
|
||||
w.show();
|
||||
QApplication::setActiveWindow(&w);
|
||||
QApplicationPrivate::setActiveWindow(&w);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&w));
|
||||
|
||||
// select Popupmenu 2
|
||||
@ -878,7 +880,7 @@ void tst_QMenuBar::check_escKey()
|
||||
const TestMenu menu = initWindowWithComplexMenuBar(w);
|
||||
w.show();
|
||||
w.setFocus();
|
||||
QApplication::setActiveWindow(&w);
|
||||
QApplicationPrivate::setActiveWindow(&w);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&w));
|
||||
|
||||
QVERIFY( !menu.menus.at(0)->isActiveWindow() );
|
||||
@ -1076,7 +1078,7 @@ void tst_QMenuBar::check_altPress()
|
||||
initWindowWithSimpleMenuBar(w);
|
||||
w.show();
|
||||
w.setFocus();
|
||||
QApplication::setActiveWindow(&w);
|
||||
QApplicationPrivate::setActiveWindow(&w);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&w));
|
||||
|
||||
QTest::keyClick( &w, Qt::Key_Alt );
|
||||
@ -1106,7 +1108,7 @@ void tst_QMenuBar::check_altClosePress()
|
||||
|
||||
w.show();
|
||||
w.move(QGuiApplication::primaryScreen()->availableGeometry().center());
|
||||
QApplication::setActiveWindow(&w);
|
||||
QApplicationPrivate::setActiveWindow(&w);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&w));
|
||||
|
||||
QTest::keyClick(&w, Qt::Key_F, Qt::AltModifier);
|
||||
@ -1127,7 +1129,7 @@ void tst_QMenuBar::check_shortcutPress()
|
||||
const TestMenu menu = initWindowWithComplexMenuBar(w);
|
||||
w.show();
|
||||
w.setFocus();
|
||||
QApplication::setActiveWindow(&w);
|
||||
QApplicationPrivate::setActiveWindow(&w);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&w));
|
||||
|
||||
QCOMPARE(m_complexTriggerCount[3], 0);
|
||||
@ -1184,7 +1186,7 @@ void tst_QMenuBar::check_menuPosition()
|
||||
QAction *menu_action = w.menuBar()->addMenu(&menu);
|
||||
centerOnScreen(&w);
|
||||
w.show();
|
||||
qApp->setActiveWindow(&w);
|
||||
QApplicationPrivate::setActiveWindow(&w);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&w));
|
||||
|
||||
//the menu should be below the menubar item
|
||||
@ -1303,7 +1305,7 @@ void tst_QMenuBar::task256322_highlight()
|
||||
|
||||
centerOnScreen(&win);
|
||||
win.show();
|
||||
QApplication::setActiveWindow(&win);
|
||||
QApplicationPrivate::setActiveWindow(&win);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&win));
|
||||
|
||||
const QPoint filePos = menuBarActionWindowPos(win.menuBar(), file);
|
||||
@ -1411,7 +1413,7 @@ void tst_QMenuBar::taskQTBUG4965_escapeEaten()
|
||||
#endif
|
||||
centerOnScreen(&menubar);
|
||||
menubar.show();
|
||||
QApplication::setActiveWindow(&menubar);
|
||||
QApplicationPrivate::setActiveWindow(&menubar);
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&menubar));
|
||||
menubar.setActiveAction(first);
|
||||
QTRY_VERIFY(menu.isVisible());
|
||||
@ -1442,7 +1444,7 @@ void tst_QMenuBar::taskQTBUG11823_crashwithInvisibleActions()
|
||||
|
||||
centerOnScreen(&menubar);
|
||||
menubar.show();
|
||||
QApplication::setActiveWindow(&menubar);
|
||||
QApplicationPrivate::setActiveWindow(&menubar);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&menubar));
|
||||
menubar.setActiveAction(m);
|
||||
QCOMPARE(menubar.activeAction(), m);
|
||||
@ -1473,7 +1475,7 @@ void tst_QMenuBar::closeOnSecondClickAndOpenOnThirdClick() // QTBUG-32807, menu
|
||||
QMenu *fileMenu = menuBar->addMenu(QStringLiteral("OpenCloseOpen"));
|
||||
fileMenu->addAction(QStringLiteral("Quit"));
|
||||
mainWindow.show();
|
||||
QApplication::setActiveWindow(&mainWindow);
|
||||
QApplicationPrivate::setActiveWindow(&mainWindow);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&mainWindow));
|
||||
|
||||
const QPoint center = menuBarActionWindowPos(mainWindow.menuBar(), fileMenu->menuAction());
|
||||
@ -1568,7 +1570,7 @@ void tst_QMenuBar::taskQTBUG53205_crashReparentNested()
|
||||
mainWindow.resize(300, 200);
|
||||
centerOnScreen(&mainWindow);
|
||||
const TestMenu testMenus = initWindowWithComplexMenuBar(mainWindow);
|
||||
QApplication::setActiveWindow(&mainWindow);
|
||||
QApplicationPrivate::setActiveWindow(&mainWindow);
|
||||
|
||||
// they can't be windows
|
||||
QWidget hiddenParent(&mainWindow, {});
|
||||
@ -1618,7 +1620,7 @@ void tst_QMenuBar::QTBUG_65488_hiddenActionTriggered()
|
||||
// resize to action's size to make Action1 hidden
|
||||
win.resize(actRect.width() - 10, win.size().height());
|
||||
win.show();
|
||||
QApplication::setActiveWindow(&win);
|
||||
QApplicationPrivate::setActiveWindow(&win);
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&win));
|
||||
// click center of the blank area on the menubar where Action1 resided
|
||||
QTest::mouseClick(win.windowHandle(), Qt::LeftButton, Qt::NoModifier, win.menuBar()->geometry().center());
|
||||
@ -1690,7 +1692,7 @@ void tst_QMenuBar::QTBUG_25669_menubarActionDoubleTriggered()
|
||||
QSignalSpy spy(win.menuBar(), &QMenuBar::triggered);
|
||||
|
||||
win.show();
|
||||
QApplication::setActiveWindow(&win);
|
||||
QApplicationPrivate::setActiveWindow(&win);
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&win));
|
||||
|
||||
QPoint posAct1 = menuBarActionWindowPos(win.menuBar(), act1);
|
||||
@ -1727,7 +1729,7 @@ void tst_QMenuBar::taskQTBUG46812_doNotLeaveMenubarHighlighted()
|
||||
initWindowWithSimpleMenuBar(mainWindow);
|
||||
|
||||
mainWindow.show();
|
||||
QApplication::setActiveWindow(&mainWindow);
|
||||
QApplicationPrivate::setActiveWindow(&mainWindow);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&mainWindow));
|
||||
|
||||
QVERIFY(!mainWindow.menuBar()->hasFocus());
|
||||
@ -1839,7 +1841,7 @@ void tst_QMenuBar::taskQTBUG55966_subMenuRemoved()
|
||||
delete subMenu;
|
||||
|
||||
window.show();
|
||||
QApplication::setActiveWindow(&window);
|
||||
QApplicationPrivate::setActiveWindow(&window);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&window));
|
||||
QTest::qWait(500);
|
||||
}
|
||||
|
@ -13,4 +13,5 @@ qt_internal_add_test(tst_qprogressbar
|
||||
LIBRARIES
|
||||
Qt::Gui
|
||||
Qt::Widgets
|
||||
Qt::WidgetsPrivate
|
||||
)
|
||||
|
@ -11,6 +11,8 @@
|
||||
#include <qtimer.h>
|
||||
#include <QStyleFactory>
|
||||
|
||||
#include <QtWidgets/private/qapplication_p.h>
|
||||
|
||||
class tst_QProgressBar : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -223,7 +225,7 @@ void tst_QProgressBar::setMinMaxRepaint()
|
||||
pbar.setFormat("%v");
|
||||
pbar.move(300, 300);
|
||||
pbar.show();
|
||||
qApp->setActiveWindow(&pbar);
|
||||
QApplicationPrivate::setActiveWindow(&pbar);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&pbar));
|
||||
|
||||
// No repaint when setting minimum to the current minimum
|
||||
|
@ -14,4 +14,5 @@ qt_internal_add_test(tst_qpushbutton
|
||||
Qt::Gui
|
||||
Qt::GuiPrivate
|
||||
Qt::Widgets
|
||||
Qt::WidgetsPrivate
|
||||
)
|
||||
|
@ -19,6 +19,8 @@
|
||||
#include <private/qguiapplication_p.h>
|
||||
#include <qpa/qplatformtheme.h>
|
||||
|
||||
#include <QtWidgets/private/qapplication_p.h>
|
||||
|
||||
class tst_QPushButton : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -336,7 +338,7 @@ void tst_QPushButton::setAccel()
|
||||
|
||||
// The shortcut will not be activated unless the button is in a active
|
||||
// window and has focus
|
||||
QApplication::setActiveWindow(testWidget);
|
||||
QApplicationPrivate::setActiveWindow(testWidget);
|
||||
testWidget->setFocus();
|
||||
QVERIFY(QTest::qWaitForWindowActive(testWidget));
|
||||
QTest::keyClick( testWidget, 'A', Qt::AltModifier );
|
||||
@ -602,7 +604,7 @@ void tst_QPushButton::taskQTBUG_20191_shortcutWithKeypadModifer()
|
||||
dialog.setLayout(layout);
|
||||
dialog.show();
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&dialog));
|
||||
QApplication::setActiveWindow(&dialog);
|
||||
QApplicationPrivate::setActiveWindow(&dialog);
|
||||
|
||||
// add shortcut '5' to button1 and test with keyboard and keypad '5' keys
|
||||
QSignalSpy spy1(button1, SIGNAL(clicked()));
|
||||
@ -649,7 +651,7 @@ void tst_QPushButton::emitReleasedAfterChange()
|
||||
dialog.setLayout(layout);
|
||||
dialog.show();
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&dialog));
|
||||
QApplication::setActiveWindow(&dialog);
|
||||
QApplicationPrivate::setActiveWindow(&dialog);
|
||||
button1->setFocus();
|
||||
|
||||
QSignalSpy spy(button1, SIGNAL(released()));
|
||||
|
@ -13,4 +13,5 @@ qt_internal_add_test(tst_qspinbox
|
||||
LIBRARIES
|
||||
Qt::Gui
|
||||
Qt::Widgets
|
||||
Qt::WidgetsPrivate
|
||||
)
|
||||
|
@ -29,6 +29,8 @@
|
||||
#include <QProxyStyle>
|
||||
#include <QScreen>
|
||||
|
||||
#include <QtWidgets/private/qapplication_p.h>
|
||||
|
||||
#if QT_CONFIG(shortcut)
|
||||
# include <QKeySequence>
|
||||
#endif
|
||||
@ -925,7 +927,7 @@ void tst_QSpinBox::editingFinished()
|
||||
layout->addWidget(box2);
|
||||
|
||||
testFocusWidget.show();
|
||||
QApplication::setActiveWindow(&testFocusWidget);
|
||||
QApplicationPrivate::setActiveWindow(&testFocusWidget);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&testFocusWidget));
|
||||
box->activateWindow();
|
||||
box->setFocus();
|
||||
@ -977,7 +979,7 @@ void tst_QSpinBox::editingFinished()
|
||||
testFocusWidget.show();
|
||||
QVERIFY(QTest::qWaitForWindowActive(&testFocusWidget));
|
||||
box->setKeyboardTracking(false);
|
||||
qApp->setActiveWindow(&testFocusWidget);
|
||||
QApplicationPrivate::setActiveWindow(&testFocusWidget);
|
||||
testFocusWidget.activateWindow();
|
||||
box->setFocus();
|
||||
QTRY_VERIFY(box->hasFocus());
|
||||
@ -1104,7 +1106,7 @@ void tst_QSpinBox::specialValue()
|
||||
spin.setValue(50);
|
||||
topWidget.show();
|
||||
//make sure we have the focus (even if editingFinished fails)
|
||||
qApp->setActiveWindow(&topWidget);
|
||||
QApplicationPrivate::setActiveWindow(&topWidget);
|
||||
topWidget.activateWindow();
|
||||
QVERIFY(QTest::qWaitForWindowActive(&topWidget));
|
||||
spin.setFocus();
|
||||
@ -1209,7 +1211,7 @@ void tst_QSpinBox::taskQTBUG_5008_textFromValueAndValidate()
|
||||
spinbox.show();
|
||||
spinbox.activateWindow();
|
||||
spinbox.setFocus();
|
||||
QApplication::setActiveWindow(&spinbox);
|
||||
QApplicationPrivate::setActiveWindow(&spinbox);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&spinbox));
|
||||
QVERIFY(spinbox.hasFocus());
|
||||
QTRY_COMPARE(static_cast<QWidget *>(&spinbox), QApplication::activeWindow());
|
||||
|
@ -13,4 +13,5 @@ qt_internal_add_test(tst_qstackedwidget
|
||||
LIBRARIES
|
||||
Qt::Gui
|
||||
Qt::Widgets
|
||||
Qt::WidgetsPrivate
|
||||
)
|
||||
|
@ -11,6 +11,8 @@
|
||||
#include <QHBoxLayout>
|
||||
#include <qlineedit.h>
|
||||
|
||||
#include <QtWidgets/private/qapplication_p.h>
|
||||
|
||||
class tst_QStackedWidget : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -157,7 +159,7 @@ void tst_QStackedWidget::dynamicPages()
|
||||
le11->setFocus(); // set focus to second widget in the page
|
||||
sw->resize(200, 200);
|
||||
sw->show();
|
||||
qApp->setActiveWindow(sw);
|
||||
QApplicationPrivate::setActiveWindow(sw);
|
||||
QVERIFY(QTest::qWaitForWindowActive(sw));
|
||||
QTRY_COMPARE(QApplication::focusWidget(), le11);
|
||||
|
||||
|
@ -28,6 +28,7 @@ qt_internal_add_test(tst_qtextbrowser
|
||||
LIBRARIES
|
||||
Qt::Gui
|
||||
Qt::Widgets
|
||||
Qt::WidgetsPrivate
|
||||
TESTDATA ${test_data}
|
||||
)
|
||||
|
||||
|
@ -12,12 +12,14 @@
|
||||
#include <qtextbrowser.h>
|
||||
#include <qtextobject.h>
|
||||
|
||||
#include <QtWidgets/private/qapplication_p.h>
|
||||
|
||||
class TestBrowser : public QTextBrowser
|
||||
{
|
||||
public:
|
||||
inline TestBrowser() {
|
||||
show();
|
||||
QApplication::setActiveWindow(this);
|
||||
QApplicationPrivate::setActiveWindow(this);
|
||||
activateWindow();
|
||||
setFocus();
|
||||
QVERIFY(QTest::qWaitForWindowActive(this));
|
||||
|
@ -33,6 +33,8 @@
|
||||
#include "../../../shared/platforminputcontext.h"
|
||||
#include <private/qinputmethod_p.h>
|
||||
|
||||
#include <QtWidgets/private/qapplication_p.h>
|
||||
|
||||
Q_LOGGING_CATEGORY(lcTests, "qt.widgets.tests")
|
||||
|
||||
//Used in copyAvailable
|
||||
@ -2537,7 +2539,7 @@ void tst_QTextEdit::inputMethodEvent()
|
||||
|
||||
// test that input method gets chance to commit preedit when removing focus
|
||||
ed->setText("");
|
||||
QApplication::setActiveWindow(ed);
|
||||
QApplicationPrivate::setActiveWindow(ed);
|
||||
QTRY_VERIFY(QApplication::focusWindow());
|
||||
QCOMPARE(qApp->focusObject(), ed);
|
||||
|
||||
|
@ -22,6 +22,8 @@
|
||||
#include <qlabel.h>
|
||||
#include <private/qtoolbarextension_p.h>
|
||||
|
||||
#include <QtWidgets/private/qapplication_p.h>
|
||||
|
||||
QT_FORWARD_DECLARE_CLASS(QAction)
|
||||
|
||||
class tst_QToolBar : public QObject
|
||||
@ -1020,7 +1022,7 @@ void tst_QToolBar::accel()
|
||||
QSignalSpy spy(action, SIGNAL(triggered(bool)));
|
||||
|
||||
mw.show();
|
||||
QApplication::setActiveWindow(&mw);
|
||||
QApplicationPrivate::setActiveWindow(&mw);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&mw));
|
||||
|
||||
QTest::keyClick(&mw, Qt::Key_T, Qt::AltModifier);
|
||||
|
@ -13,4 +13,5 @@ qt_internal_add_test(tst_qtoolbutton
|
||||
LIBRARIES
|
||||
Qt::Gui
|
||||
Qt::Widgets
|
||||
Qt::WidgetsPrivate
|
||||
)
|
||||
|
@ -15,6 +15,8 @@
|
||||
#include <qscreen.h>
|
||||
#include <qlabel.h>
|
||||
|
||||
#include <QtWidgets/private/qapplication_p.h>
|
||||
|
||||
class tst_QToolButton : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -118,7 +120,7 @@ void tst_QToolButton::triggered()
|
||||
toolButton->setDefaultAction(defaultAction);
|
||||
|
||||
mainWidget.show();
|
||||
QApplication::setActiveWindow(&mainWidget);
|
||||
QApplicationPrivate::setActiveWindow(&mainWidget);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&mainWidget));
|
||||
|
||||
defaultAction->trigger();
|
||||
@ -179,7 +181,7 @@ void tst_QToolButton::task176137_autoRepeatOfAction()
|
||||
label->move(0, 50);
|
||||
|
||||
mainWidget.show();
|
||||
QApplication::setActiveWindow(&mainWidget);
|
||||
QApplicationPrivate::setActiveWindow(&mainWidget);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&mainWidget));
|
||||
|
||||
QSignalSpy spy(&action,SIGNAL(triggered()));
|
||||
|
@ -9,6 +9,8 @@
|
||||
#include <QStyleHints>
|
||||
#include <QScreen>
|
||||
|
||||
#include <QtWidgets/private/qapplication_p.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
QWidgetBaselineTest::QWidgetBaselineTest()
|
||||
@ -97,7 +99,7 @@ void QWidgetBaselineTest::makeVisible()
|
||||
{
|
||||
Q_ASSERT(window);
|
||||
window->show();
|
||||
QApplication::setActiveWindow(window);
|
||||
QApplicationPrivate::setActiveWindow(window);
|
||||
QVERIFY(QTest::qWaitForWindowActive(window));
|
||||
// explicitly unset focus, the test needs to control when focus is shown
|
||||
if (window->focusWidget())
|
||||
|
@ -17,6 +17,7 @@ qt_internal_add_test(tst_baseline_stylesheet
|
||||
LIBRARIES
|
||||
Qt::Gui
|
||||
Qt::Widgets
|
||||
Qt::WidgetsPrivate
|
||||
Qt::Network
|
||||
TESTDATA ${test_data}
|
||||
)
|
||||
|
@ -14,6 +14,7 @@ qt_internal_add_test(tst_baseline_text
|
||||
LIBRARIES
|
||||
Qt::Gui
|
||||
Qt::Widgets
|
||||
Qt::WidgetsPrivate
|
||||
Qt::Network
|
||||
TESTDATA ${test_data}
|
||||
)
|
||||
|
@ -12,5 +12,6 @@ qt_internal_add_test(tst_baseline_widgets
|
||||
LIBRARIES
|
||||
Qt::Gui
|
||||
Qt::Widgets
|
||||
Qt::WidgetsPrivate
|
||||
Qt::Network
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user