summaryrefslogtreecommitdiffstats
path: root/tests/manual
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@theqtcompany.com>2015-01-19 13:49:52 +0100
committerFrederik Gladhorn <frederik.gladhorn@theqtcompany.com>2015-01-21 11:10:14 +0100
commitb6191b16d41459ed73cea738dfaf8e25e81ae22b (patch)
tree6ad0952af507bf1ab8df9612023d6e224db8d7e2 /tests/manual
parentb2883a6acc7a8d8372a815cc91dd1a8449f25723 (diff)
parent9087df6bd2dd5198ccf101a237aadee331e51ec3 (diff)
Merge remote-tracking branch 'origin/5.4' into dev
Conflicts: src/corelib/global/global.pri src/corelib/global/qcompilerdetection.h src/corelib/global/qglobal.h src/corelib/tools/qdatetime.cpp src/plugins/platforms/xcb/qxcbscreen.h src/plugins/platforms/xcb/qxcbwindow.h src/widgets/dialogs/qcolordialog.cpp src/widgets/dialogs/qcolordialog_p.h tools/configure/configureapp.cpp Change-Id: Ie9d6e9df13e570da0a90a67745a0d05f46c532af
Diffstat (limited to 'tests/manual')
-rw-r--r--tests/manual/diaglib/eventfilter.cpp74
-rw-r--r--tests/manual/qscreen/main.cpp5
-rw-r--r--tests/manual/qscreen/propertyfield.cpp7
-rw-r--r--tests/manual/qscreen/propertyfield.h1
-rw-r--r--tests/manual/windowflags/controllerwindow.cpp5
5 files changed, 83 insertions, 9 deletions
diff --git a/tests/manual/diaglib/eventfilter.cpp b/tests/manual/diaglib/eventfilter.cpp
index 23a6d44fef..0a815fd883 100644
--- a/tests/manual/diaglib/eventfilter.cpp
+++ b/tests/manual/diaglib/eventfilter.cpp
@@ -36,6 +36,28 @@
#include <QtCore/QDebug>
#include <QtCore/QTextStream>
+#if QT_VERSION >= 0x050000
+# if defined(QT_WIDGETS_LIB)
+# define HAVE_APPLICATION
+# endif
+# if defined(QT_GUI_LIB)
+# define HAVE_GUI_APPLICATION
+# endif
+#else // Qt 5
+# if defined(QT_GUI_LIB)
+# define HAVE_APPLICATION
+# endif
+#endif
+
+#ifdef HAVE_APPLICATION
+# include <QApplication>
+# include <QWidget>
+#endif
+#ifdef HAVE_GUI_APPLICATION
+# include <QtGui/QGuiApplication>
+# include <QtGui/QWindow>
+#endif
+
namespace QtDiag {
EventFilter::EventFilter(EventCategories eventCategories, QObject *p)
@@ -131,16 +153,60 @@ static inline bool matchesType(const QObject *o, EventFilter::ObjectTypes types)
return types & EventFilter::OtherType;
}
+static void formatObject(const QObject *o, QDebug debug)
+{
+ if (o) {
+ debug << o->metaObject()->className();
+ const QString on = o->objectName();
+ if (!on.isEmpty())
+ debug << '/' << on;
+ } else {
+ debug << "null";
+ }
+}
+
+static void formatApplicationState(QDebug debug)
+{
+#if defined(HAVE_APPLICATION)
+ if (const QWidget *mw = QApplication::activeModalWidget()) {
+ debug << "\n QApplication::activeModalWidget = ";
+ formatObject(mw, debug);
+ }
+ if (const QWidget *pw = QApplication::activePopupWidget()) {
+ debug << "\n QApplication::activePopupWidget = ";
+ formatObject(pw, debug);
+ }
+ debug << "\n QApplication::activeWindow = ";
+ formatObject(QApplication::activeWindow(), debug);
+#endif // HAVE_APPLICATION
+#if defined(HAVE_GUI_APPLICATION)
+ if (const QWindow *mw = QGuiApplication::modalWindow()) {
+ debug << "\n QGuiApplication::modalWindow = ";
+ formatObject(mw, debug);
+ }
+ debug << "\n QGuiApplication::focusWindow = ";
+ formatObject(QGuiApplication::focusWindow(), debug);
+#endif // HAVE_GUI_APPLICATION
+}
+
bool EventFilter::eventFilter(QObject *o, QEvent *e)
{
static int n = 0;
if (matchesType(o, m_objectTypes) && m_eventTypes.contains(e->type())) {
QDebug debug = qDebug().nospace();
- const QString on = o->objectName();
- debug << '#' << n++ << ' ' << o->metaObject()->className();
- if (!on.isEmpty())
- debug << '/' << on;
+ debug << '#' << n++ << ' ';
+ formatObject(o, debug);
debug << ' ' << e;
+ switch (e->type()) {
+#if QT_VERSION >= 0x050000
+ case QEvent::FocusAboutToChange:
+#endif
+ case QEvent::FocusIn:
+ formatApplicationState(debug);
+ break;
+ default:
+ break;
+ }
}
return false;
}
diff --git a/tests/manual/qscreen/main.cpp b/tests/manual/qscreen/main.cpp
index 487e95266b..dc1e0e08c0 100644
--- a/tests/manual/qscreen/main.cpp
+++ b/tests/manual/qscreen/main.cpp
@@ -80,8 +80,11 @@ void screenAdded(QScreen* screen)
// But this works as long as the screens are all virtual siblings
w->show();
QRect geom = w->geometry();
+ geom.setSize(w->sizeHint());
+ if (geom.height() > screen->geometry().height())
+ geom.setHeight(screen->geometry().height() * 9 / 10);
geom.moveCenter(screen->geometry().center());
- w->move(geom.topLeft());
+ w->setGeometry(geom);
props->insert(screen, w);
diff --git a/tests/manual/qscreen/propertyfield.cpp b/tests/manual/qscreen/propertyfield.cpp
index e6392465f2..f1e5e22ec9 100644
--- a/tests/manual/qscreen/propertyfield.cpp
+++ b/tests/manual/qscreen/propertyfield.cpp
@@ -34,8 +34,9 @@
#include "propertyfield.h"
#include <QDebug>
-PropertyField::PropertyField(QObject* subject, const QMetaProperty& prop, QWidget *parent) :
- QLineEdit(parent), m_subject(subject), m_lastChangeTime(QTime::currentTime()), m_prop(prop)
+PropertyField::PropertyField(QObject* subject, const QMetaProperty& prop, QWidget *parent)
+ : QLineEdit(parent), m_subject(subject), m_lastChangeTime(QTime::currentTime()), m_prop(prop)
+ , m_defaultBrush(palette().brush(QPalette::Active, QPalette::Text))
{
setReadOnly(true);
if (prop.hasNotifySignal()) {
@@ -99,7 +100,7 @@ void PropertyField::propertyChanged()
setText(text);
m_lastText = text;
m_lastTextShowing = text;
- modPalette.setBrush(QPalette::Text, Qt::black);
+ modPalette.setBrush(QPalette::Text, m_defaultBrush);
}
setPalette(modPalette);
}
diff --git a/tests/manual/qscreen/propertyfield.h b/tests/manual/qscreen/propertyfield.h
index 2738a215a6..f76ac7fc6b 100644
--- a/tests/manual/qscreen/propertyfield.h
+++ b/tests/manual/qscreen/propertyfield.h
@@ -63,6 +63,7 @@ private:
QString m_lastTextShowing;
QTime m_lastChangeTime;
const QMetaProperty m_prop;
+ QBrush m_defaultBrush;
};
#endif // PROPERTYFIELD_H
diff --git a/tests/manual/windowflags/controllerwindow.cpp b/tests/manual/windowflags/controllerwindow.cpp
index 2981bb9bf1..9975bc9673 100644
--- a/tests/manual/windowflags/controllerwindow.cpp
+++ b/tests/manual/windowflags/controllerwindow.cpp
@@ -137,7 +137,10 @@ void ControllerWindow::updatePreview()
parentWindow->hide();
}
- previewWidget->setWindowFlags(flags);
+ if (previewWidgetButton->isChecked())
+ previewWindow->setWindowFlags(flags);
+ else
+ previewDialog->setWindowFlags(flags);
if (fixedSizeWindowCheckBox->isChecked()) {
previewWidget->setFixedSize(300, 300);