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