Remove fatuously true or false QT_VERSION checks
QT_VERSION is now at least QT_VERSION_CHECK(6, 3, 0), so remove all checks against Qt 6.0.0 or earlier. They are superfluous. Tidied up in some places in the process, particularly #include order. Change-Id: I2636b2fd13be5b976f5b043ef2f8cddc038a72a4 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
e5d65996a9
commit
298e41b830
@ -1,6 +1,6 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
**
|
**
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
** Copyright (C) 2021 The Qt Company Ltd.
|
||||||
** Contact: https://www.qt.io/licensing/
|
** Contact: https://www.qt.io/licensing/
|
||||||
**
|
**
|
||||||
** This file is part of the qmake application of the Qt Toolkit.
|
** This file is part of the qmake application of the Qt Toolkit.
|
||||||
@ -38,16 +38,15 @@
|
|||||||
#include <qdir.h>
|
#include <qdir.h>
|
||||||
#include <qfile.h>
|
#include <qfile.h>
|
||||||
#include <qfileinfo.h>
|
#include <qfileinfo.h>
|
||||||
|
#include <qjsonarray.h>
|
||||||
|
#include <qjsondocument.h>
|
||||||
|
#include <qjsonobject.h>
|
||||||
#include <qlist.h>
|
#include <qlist.h>
|
||||||
#include <qregularexpression.h>
|
#include <qregularexpression.h>
|
||||||
#include <qset.h>
|
#include <qset.h>
|
||||||
#include <qstringlist.h>
|
#include <qstringlist.h>
|
||||||
#include <qtextstream.h>
|
#include <qtextstream.h>
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
|
|
||||||
# include <qjsondocument.h>
|
|
||||||
# include <qjsonobject.h>
|
|
||||||
# include <qjsonarray.h>
|
|
||||||
#endif
|
|
||||||
#ifdef PROEVALUATOR_THREAD_SAFE
|
#ifdef PROEVALUATOR_THREAD_SAFE
|
||||||
# include <qthreadpool.h>
|
# include <qthreadpool.h>
|
||||||
#endif
|
#endif
|
||||||
@ -222,9 +221,7 @@ void QMakeEvaluator::initFunctionStatics()
|
|||||||
{ "infile", T_INFILE, 2, 3, "file, var, [values]" },
|
{ "infile", T_INFILE, 2, 3, "file, var, [values]" },
|
||||||
{ "count", T_COUNT, 2, 3, "var, count, [op=operator]" },
|
{ "count", T_COUNT, 2, 3, "var, count, [op=operator]" },
|
||||||
{ "isEmpty", T_ISEMPTY, 1, 1, "var" },
|
{ "isEmpty", T_ISEMPTY, 1, 1, "var" },
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
|
|
||||||
{ "parseJson", T_PARSE_JSON, 2, 2, "var, into" },
|
{ "parseJson", T_PARSE_JSON, 2, 2, "var, into" },
|
||||||
#endif
|
|
||||||
{ "load", T_LOAD, 1, 2, "feature, [ignore_errors=false]" },
|
{ "load", T_LOAD, 1, 2, "feature, [ignore_errors=false]" },
|
||||||
{ "include", T_INCLUDE, 1, 3, "file, [into, [silent]]" },
|
{ "include", T_INCLUDE, 1, 3, "file, [into, [silent]]" },
|
||||||
{ "debug", T_DEBUG, 2, 2, "level, message" },
|
{ "debug", T_DEBUG, 2, 2, "level, message" },
|
||||||
@ -362,7 +359,6 @@ QMakeEvaluator::quoteValue(const ProString &val)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
|
|
||||||
static void addJsonValue(const QJsonValue &value, const QString &keyPrefix, ProValueMap *map);
|
static void addJsonValue(const QJsonValue &value, const QString &keyPrefix, ProValueMap *map);
|
||||||
|
|
||||||
static void insertJsonKeyValue(const QString &key, const QStringList &values, ProValueMap *map)
|
static void insertJsonKeyValue(const QString &key, const QStringList &values, ProValueMap *map)
|
||||||
@ -474,7 +470,6 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::parseJsonInto(const QByteArray &json
|
|||||||
|
|
||||||
return QMakeEvaluator::ReturnTrue;
|
return QMakeEvaluator::ReturnTrue;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
QMakeEvaluator::VisitReturn
|
QMakeEvaluator::VisitReturn
|
||||||
QMakeEvaluator::writeFile(const QString &ctx, const QString &fn, QIODevice::OpenMode mode,
|
QMakeEvaluator::writeFile(const QString &ctx, const QString &fn, QIODevice::OpenMode mode,
|
||||||
@ -1729,14 +1724,12 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
|
|||||||
m_valuemapStack.top()[var] = statics.fakeValue;
|
m_valuemapStack.top()[var] = statics.fakeValue;
|
||||||
return ReturnTrue;
|
return ReturnTrue;
|
||||||
}
|
}
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
|
|
||||||
case T_PARSE_JSON: {
|
case T_PARSE_JSON: {
|
||||||
QByteArray json = values(args.at(0).toKey()).join(QLatin1Char(' ')).toUtf8();
|
QByteArray json = values(args.at(0).toKey()).join(QLatin1Char(' ')).toUtf8();
|
||||||
ProStringRoUser u1(args.at(1), m_tmp2);
|
ProStringRoUser u1(args.at(1), m_tmp2);
|
||||||
QString parseInto = u1.str();
|
QString parseInto = u1.str();
|
||||||
return parseJsonInto(json, parseInto, &m_valuemapStack.top());
|
return parseJsonInto(json, parseInto, &m_valuemapStack.top());
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
case T_INCLUDE: {
|
case T_INCLUDE: {
|
||||||
QString parseInto;
|
QString parseInto;
|
||||||
LoadFlags flags;
|
LoadFlags flags;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
**
|
**
|
||||||
** Copyright (C) 2019 The Qt Company Ltd.
|
** Copyright (C) 2021 The Qt Company Ltd.
|
||||||
** Copyright (C) 2016 Intel Corporation.
|
** Copyright (C) 2016 Intel Corporation.
|
||||||
** Copyright (C) 2013 Olivier Goffart <ogoffart@woboq.com>
|
** Copyright (C) 2013 Olivier Goffart <ogoffart@woboq.com>
|
||||||
** Contact: https://www.qt.io/licensing/
|
** Contact: https://www.qt.io/licensing/
|
||||||
@ -159,14 +159,6 @@ static inline QBasicMutex *signalSlotLock(const QObject *o)
|
|||||||
return &_q_ObjectMutexPool[uint(quintptr(o)) % sizeof(_q_ObjectMutexPool)/sizeof(QBasicMutex)];
|
return &_q_ObjectMutexPool[uint(quintptr(o)) % sizeof(_q_ObjectMutexPool)/sizeof(QBasicMutex)];
|
||||||
}
|
}
|
||||||
|
|
||||||
#if QT_VERSION < 0x60000
|
|
||||||
extern "C" Q_CORE_EXPORT void qt_addObject(QObject *)
|
|
||||||
{}
|
|
||||||
|
|
||||||
extern "C" Q_CORE_EXPORT void qt_removeObject(QObject *)
|
|
||||||
{}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void (*QAbstractDeclarativeData::destroyed)(QAbstractDeclarativeData *, QObject *) = nullptr;
|
void (*QAbstractDeclarativeData::destroyed)(QAbstractDeclarativeData *, QObject *) = nullptr;
|
||||||
void (*QAbstractDeclarativeData::signalEmitted)(QAbstractDeclarativeData *, QObject *, int, void **) = nullptr;
|
void (*QAbstractDeclarativeData::signalEmitted)(QAbstractDeclarativeData *, QObject *, int, void **) = nullptr;
|
||||||
int (*QAbstractDeclarativeData::receivers)(QAbstractDeclarativeData *, const QObject *, int) = nullptr;
|
int (*QAbstractDeclarativeData::receivers)(QAbstractDeclarativeData *, const QObject *, int) = nullptr;
|
||||||
@ -953,9 +945,6 @@ QObject::QObject(QObjectPrivate &dd, QObject *parent)
|
|||||||
QT_RETHROW;
|
QT_RETHROW;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if QT_VERSION < 0x60000
|
|
||||||
qt_addObject(this);
|
|
||||||
#endif
|
|
||||||
if (Q_UNLIKELY(qtHookData[QHooks::AddQObject]))
|
if (Q_UNLIKELY(qtHookData[QHooks::AddQObject]))
|
||||||
reinterpret_cast<QHooks::AddQObjectCallback>(qtHookData[QHooks::AddQObject])(this);
|
reinterpret_cast<QHooks::AddQObjectCallback>(qtHookData[QHooks::AddQObject])(this);
|
||||||
Q_TRACE(QObject_ctor, this);
|
Q_TRACE(QObject_ctor, this);
|
||||||
@ -1114,9 +1103,6 @@ QObject::~QObject()
|
|||||||
if (!d->children.isEmpty())
|
if (!d->children.isEmpty())
|
||||||
d->deleteChildren();
|
d->deleteChildren();
|
||||||
|
|
||||||
#if QT_VERSION < 0x60000
|
|
||||||
qt_removeObject(this);
|
|
||||||
#endif
|
|
||||||
if (Q_UNLIKELY(qtHookData[QHooks::RemoveQObject]))
|
if (Q_UNLIKELY(qtHookData[QHooks::RemoveQObject]))
|
||||||
reinterpret_cast<QHooks::RemoveQObjectCallback>(qtHookData[QHooks::RemoveQObject])(this);
|
reinterpret_cast<QHooks::RemoveQObjectCallback>(qtHookData[QHooks::RemoveQObject])(this);
|
||||||
|
|
||||||
|
@ -1934,33 +1934,7 @@ static QMessageBox::StandardButton newButton(int button)
|
|||||||
if (button == QMessageBox::NoButton || (button & NewButtonMask))
|
if (button == QMessageBox::NoButton || (button & NewButtonMask))
|
||||||
return QMessageBox::StandardButton(button & QMessageBox::ButtonMask);
|
return QMessageBox::StandardButton(button & QMessageBox::ButtonMask);
|
||||||
|
|
||||||
#if QT_VERSION < 0x050000
|
|
||||||
// this is needed for binary compatibility with Qt 4.0 and 4.1
|
|
||||||
switch (button & Old_ButtonMask) {
|
|
||||||
case Old_Ok:
|
|
||||||
return QMessageBox::Ok;
|
|
||||||
case Old_Cancel:
|
|
||||||
return QMessageBox::Cancel;
|
|
||||||
case Old_Yes:
|
|
||||||
return QMessageBox::Yes;
|
|
||||||
case Old_No:
|
|
||||||
return QMessageBox::No;
|
|
||||||
case Old_Abort:
|
|
||||||
return QMessageBox::Abort;
|
|
||||||
case Old_Retry:
|
|
||||||
return QMessageBox::Retry;
|
|
||||||
case Old_Ignore:
|
|
||||||
return QMessageBox::Ignore;
|
|
||||||
case Old_YesAll:
|
|
||||||
return QMessageBox::YesToAll;
|
|
||||||
case Old_NoAll:
|
|
||||||
return QMessageBox::NoToAll;
|
|
||||||
default:
|
|
||||||
return QMessageBox::NoButton;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
return QMessageBox::NoButton;
|
return QMessageBox::NoButton;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool detectedCompat(int button0, int button1, int button2)
|
static bool detectedCompat(int button0, int button1, int button2)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
**
|
**
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
** Copyright (C) 2021 The Qt Company Ltd.
|
||||||
** Contact: https://www.qt.io/licensing/
|
** Contact: https://www.qt.io/licensing/
|
||||||
**
|
**
|
||||||
** This file is part of the test suite of the Qt Toolkit.
|
** This file is part of the test suite of the Qt Toolkit.
|
||||||
@ -84,9 +84,7 @@ PlatformInfo PlatformInfo::localHostInfo()
|
|||||||
pi.insert(PI_HostName, QHostInfo::localHostName());
|
pi.insert(PI_HostName, QHostInfo::localHostName());
|
||||||
pi.insert(PI_QtVersion, QLS(qVersion()));
|
pi.insert(PI_QtVersion, QLS(qVersion()));
|
||||||
pi.insert(PI_QMakeSpec, QString(QLS(QMAKESPEC)).remove(QRegularExpression(QLS("^.*mkspecs/"))));
|
pi.insert(PI_QMakeSpec, QString(QLS(QMAKESPEC)).remove(QRegularExpression(QLS("^.*mkspecs/"))));
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
pi.insert(PI_QtBuildMode, QLibraryInfo::isDebugBuild() ? QLS("QtDebug") : QLS("QtRelease"));
|
pi.insert(PI_QtBuildMode, QLibraryInfo::isDebugBuild() ? QLS("QtDebug") : QLS("QtRelease"));
|
||||||
#endif
|
|
||||||
#if defined(Q_OS_LINUX) && QT_CONFIG(process)
|
#if defined(Q_OS_LINUX) && QT_CONFIG(process)
|
||||||
pi.insert(PI_OSName, QLS("Linux"));
|
pi.insert(PI_OSName, QLS("Linux"));
|
||||||
#elif defined(Q_OS_WIN)
|
#elif defined(Q_OS_WIN)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
**
|
**
|
||||||
** Copyright (C) 2020 The Qt Company Ltd.
|
** Copyright (C) 2021 The Qt Company Ltd.
|
||||||
** Contact: https://www.qt.io/licensing/
|
** Contact: https://www.qt.io/licensing/
|
||||||
**
|
**
|
||||||
** This file is part of the test suite of the Qt Toolkit.
|
** This file is part of the test suite of the Qt Toolkit.
|
||||||
@ -34,37 +34,21 @@
|
|||||||
#include <QStyleOption>
|
#include <QStyleOption>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
|
||||||
#if QT_VERSION < 0x050000
|
|
||||||
QDebug operator<<(QDebug d, const QPixmap &p)
|
|
||||||
{
|
|
||||||
d << "QPixmap(" << p.size() << ')';
|
|
||||||
return d;
|
|
||||||
}
|
|
||||||
#endif // QT_VERSION < 0x050000
|
|
||||||
|
|
||||||
QDebug operator<<(QDebug debug, const QStyleOption *option)
|
QDebug operator<<(QDebug debug, const QStyleOption *option)
|
||||||
{
|
{
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
QDebugStateSaver saver(debug);
|
QDebugStateSaver saver(debug);
|
||||||
# if QT_VERSION >= 0x050400
|
|
||||||
debug.noquote();
|
debug.noquote();
|
||||||
# endif
|
|
||||||
debug.nospace();
|
debug.nospace();
|
||||||
#endif
|
|
||||||
if (!option) {
|
if (!option) {
|
||||||
debug << "QStyleOption(0)";
|
debug << "QStyleOption(0)";
|
||||||
return debug;
|
return debug;
|
||||||
}
|
}
|
||||||
if (const QStyleOptionViewItem *ivo = qstyleoption_cast<const QStyleOptionViewItem *>(option)) {
|
if (const QStyleOptionViewItem *ivo = qstyleoption_cast<const QStyleOptionViewItem *>(option)) {
|
||||||
debug << "QStyleOptionViewItem(";
|
debug << "QStyleOptionViewItem(";
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
debug << ivo->index;
|
debug << ivo->index;
|
||||||
if (const int textSize = ivo->text.size())
|
if (const int textSize = ivo->text.size())
|
||||||
debug << ", \"" << (textSize < 20 ? ivo->text : ivo->text.left(20) + QLatin1String("...")) << '"';
|
debug << ", \"" << (textSize < 20 ? ivo->text : ivo->text.left(20) + QLatin1String("...")) << '"';
|
||||||
debug << ", ";
|
debug << ", ";
|
||||||
#else // Qt 5
|
|
||||||
Q_UNUSED(ivo);
|
|
||||||
#endif
|
|
||||||
} else {
|
} else {
|
||||||
debug << "QStyleOption(";
|
debug << "QStyleOption(";
|
||||||
}
|
}
|
||||||
@ -72,10 +56,8 @@ QDebug operator<<(QDebug debug, const QStyleOption *option)
|
|||||||
<< option->rect.x() << option->rect.y() << Qt::noforcesign;
|
<< option->rect.x() << option->rect.y() << Qt::noforcesign;
|
||||||
if (option->state != QStyle::State_None)
|
if (option->state != QStyle::State_None)
|
||||||
debug << ", state=" << option->state;
|
debug << ", state=" << option->state;
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
if (option->styleObject && !option->styleObject->isWidgetType())
|
if (option->styleObject && !option->styleObject->isWidgetType())
|
||||||
debug << ", styleObject=" << QtDiag::formatQObject(option->styleObject);
|
debug << ", styleObject=" << QtDiag::formatQObject(option->styleObject);
|
||||||
#endif
|
|
||||||
debug << ')';
|
debug << ')';
|
||||||
return debug;
|
return debug;
|
||||||
}
|
}
|
||||||
@ -84,15 +66,9 @@ namespace QtDiag {
|
|||||||
|
|
||||||
DebugProxyStyle::DebugProxyStyle(QStyle *style) : QProxyStyle(style)
|
DebugProxyStyle::DebugProxyStyle(QStyle *style) : QProxyStyle(style)
|
||||||
{
|
{
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
const qreal devicePixelRatio = qApp->devicePixelRatio();
|
const qreal devicePixelRatio = qApp->devicePixelRatio();
|
||||||
#else
|
|
||||||
const qreal devicePixelRatio = 1;
|
|
||||||
#endif
|
|
||||||
qDebug() << __FUNCTION__ << QT_VERSION_STR
|
qDebug() << __FUNCTION__ << QT_VERSION_STR
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
<< QGuiApplication::platformName()
|
<< QGuiApplication::platformName()
|
||||||
#endif
|
|
||||||
<< style->objectName() << "devicePixelRatio=" << devicePixelRatio;
|
<< style->objectName() << "devicePixelRatio=" << devicePixelRatio;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
**
|
**
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
** Copyright (C) 2021 The Qt Company Ltd.
|
||||||
** Contact: https://www.qt.io/licensing/
|
** Contact: https://www.qt.io/licensing/
|
||||||
**
|
**
|
||||||
** This file is part of the test suite of the Qt Toolkit.
|
** This file is part of the test suite of the Qt Toolkit.
|
||||||
@ -31,17 +31,11 @@
|
|||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
#include <QtCore/QTextStream>
|
#include <QtCore/QTextStream>
|
||||||
|
|
||||||
#if QT_VERSION >= 0x050000
|
#if defined(QT_WIDGETS_LIB)
|
||||||
# if defined(QT_WIDGETS_LIB)
|
# define HAVE_APPLICATION
|
||||||
# define HAVE_APPLICATION
|
#endif
|
||||||
# endif
|
#if defined(QT_GUI_LIB)
|
||||||
# if defined(QT_GUI_LIB)
|
# define HAVE_GUI_APPLICATION
|
||||||
# define HAVE_GUI_APPLICATION
|
|
||||||
# endif
|
|
||||||
#else // Qt 5
|
|
||||||
# if defined(QT_GUI_LIB)
|
|
||||||
# define HAVE_APPLICATION
|
|
||||||
# endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_APPLICATION
|
#ifdef HAVE_APPLICATION
|
||||||
@ -82,9 +76,7 @@ void EventFilter::init(EventCategories eventCategories)
|
|||||||
m_eventTypes << QEvent::MouseMove << QEvent::NonClientAreaMouseMove;
|
m_eventTypes << QEvent::MouseMove << QEvent::NonClientAreaMouseMove;
|
||||||
if (eventCategories & TouchEvents) {
|
if (eventCategories & TouchEvents) {
|
||||||
m_eventTypes << QEvent::TouchBegin << QEvent::TouchUpdate << QEvent::TouchEnd;
|
m_eventTypes << QEvent::TouchBegin << QEvent::TouchUpdate << QEvent::TouchEnd;
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
m_eventTypes << QEvent::TouchCancel;
|
m_eventTypes << QEvent::TouchCancel;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
if (eventCategories & TabletEvents) {
|
if (eventCategories & TabletEvents) {
|
||||||
m_eventTypes << QEvent::TabletEnterProximity << QEvent::TabletLeaveProximity
|
m_eventTypes << QEvent::TabletEnterProximity << QEvent::TabletLeaveProximity
|
||||||
@ -100,9 +92,7 @@ void EventFilter::init(EventCategories eventCategories)
|
|||||||
}
|
}
|
||||||
if (eventCategories & FocusEvents) {
|
if (eventCategories & FocusEvents) {
|
||||||
m_eventTypes
|
m_eventTypes
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
<< QEvent::FocusAboutToChange
|
<< QEvent::FocusAboutToChange
|
||||||
#endif
|
|
||||||
<< QEvent::FocusIn << QEvent::FocusOut;
|
<< QEvent::FocusIn << QEvent::FocusOut;
|
||||||
}
|
}
|
||||||
if (eventCategories & GeometryEvents)
|
if (eventCategories & GeometryEvents)
|
||||||
@ -110,17 +100,13 @@ void EventFilter::init(EventCategories eventCategories)
|
|||||||
if (eventCategories & PaintEvents) {
|
if (eventCategories & PaintEvents) {
|
||||||
m_eventTypes << QEvent::UpdateRequest << QEvent::Paint
|
m_eventTypes << QEvent::UpdateRequest << QEvent::Paint
|
||||||
<< QEvent::Show << QEvent::Hide;
|
<< QEvent::Show << QEvent::Hide;
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
m_eventTypes << QEvent::Expose;
|
m_eventTypes << QEvent::Expose;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
if (eventCategories & StateChangeEvents) {
|
if (eventCategories & StateChangeEvents) {
|
||||||
m_eventTypes
|
m_eventTypes
|
||||||
<< QEvent::WindowStateChange
|
<< QEvent::WindowStateChange
|
||||||
<< QEvent::WindowBlocked << QEvent::WindowUnblocked
|
<< QEvent::WindowBlocked << QEvent::WindowUnblocked
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
<< QEvent::ApplicationStateChange
|
<< QEvent::ApplicationStateChange
|
||||||
#endif
|
|
||||||
<< QEvent::ApplicationActivate << QEvent::ApplicationDeactivate;
|
<< QEvent::ApplicationActivate << QEvent::ApplicationDeactivate;
|
||||||
}
|
}
|
||||||
if (eventCategories & TimerEvents)
|
if (eventCategories & TimerEvents)
|
||||||
@ -131,9 +117,7 @@ void EventFilter::init(EventCategories eventCategories)
|
|||||||
}
|
}
|
||||||
if (eventCategories & InputMethodEvents) {
|
if (eventCategories & InputMethodEvents) {
|
||||||
m_eventTypes << QEvent::InputMethod;
|
m_eventTypes << QEvent::InputMethod;
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
m_eventTypes << QEvent::InputMethodQuery;
|
m_eventTypes << QEvent::InputMethodQuery;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
#ifndef QT_NO_GESTURES
|
#ifndef QT_NO_GESTURES
|
||||||
if (eventCategories & GestureEvents) {
|
if (eventCategories & GestureEvents) {
|
||||||
@ -147,10 +131,8 @@ static inline bool matchesType(const QObject *o, EventFilter::ObjectTypes types)
|
|||||||
{
|
{
|
||||||
if (o->isWidgetType())
|
if (o->isWidgetType())
|
||||||
return types & EventFilter::QWidgetType;
|
return types & EventFilter::QWidgetType;
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
if (o->isWindowType())
|
if (o->isWindowType())
|
||||||
return types & EventFilter::QWindowType;
|
return types & EventFilter::QWindowType;
|
||||||
#endif
|
|
||||||
return types & EventFilter::OtherType;
|
return types & EventFilter::OtherType;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -215,9 +197,7 @@ bool EventFilter::eventFilter(QObject *o, QEvent *e)
|
|||||||
formatObject(o, debug);
|
formatObject(o, debug);
|
||||||
debug << ' ' << e;
|
debug << ' ' << e;
|
||||||
switch (e->type()) {
|
switch (e->type()) {
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
case QEvent::FocusAboutToChange:
|
case QEvent::FocusAboutToChange:
|
||||||
#endif
|
|
||||||
case QEvent::FocusIn:
|
case QEvent::FocusIn:
|
||||||
formatApplicationState(debug);
|
formatApplicationState(debug);
|
||||||
break;
|
break;
|
||||||
@ -230,9 +210,7 @@ bool EventFilter::eventFilter(QObject *o, QEvent *e)
|
|||||||
case QEvent::NonClientAreaMouseButtonPress:
|
case QEvent::NonClientAreaMouseButtonPress:
|
||||||
case QEvent::NonClientAreaMouseButtonRelease:
|
case QEvent::NonClientAreaMouseButtonRelease:
|
||||||
case QEvent::NonClientAreaMouseMove:
|
case QEvent::NonClientAreaMouseMove:
|
||||||
# if QT_VERSION >= 0x050000
|
|
||||||
case QEvent::Enter:
|
case QEvent::Enter:
|
||||||
# endif
|
|
||||||
case QEvent::Leave:
|
case QEvent::Leave:
|
||||||
formatMouseState(o, debug);
|
formatMouseState(o, debug);
|
||||||
break;
|
break;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
**
|
**
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
** Copyright (C) 2021 The Qt Company Ltd.
|
||||||
** Contact: https://www.qt.io/licensing/
|
** Contact: https://www.qt.io/licensing/
|
||||||
**
|
**
|
||||||
** This file is part of the test suite of the Qt Toolkit.
|
** This file is part of the test suite of the Qt Toolkit.
|
||||||
@ -30,24 +30,16 @@
|
|||||||
|
|
||||||
#include <QOpenGLFunctions>
|
#include <QOpenGLFunctions>
|
||||||
#include <QtOpenGLWidgets/QOpenGLWidget>
|
#include <QtOpenGLWidgets/QOpenGLWidget>
|
||||||
#if QT_VERSION > 0x050000
|
#include <QtOpenGL/QOpenGLWindow>
|
||||||
# if QT_VERSION >= 0x050400
|
#include <QtGui/QOpenGLContext>
|
||||||
# include <QtOpenGL/QOpenGLWindow>
|
#include <QtGui/QOpenGLFunctions>
|
||||||
# else // 5.4
|
#include <QtGui/QWindow>
|
||||||
# include <QtGui/QWindow>
|
|
||||||
# endif // 5.0..5.4
|
|
||||||
# include <QtGui/QOpenGLContext>
|
|
||||||
# include <QtGui/QOpenGLFunctions>
|
|
||||||
# include <QtGui/QWindow>
|
|
||||||
#endif
|
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
#include <QtCore/QString>
|
#include <QtCore/QString>
|
||||||
#include <QtCore/QTimer>
|
#include <QtCore/QTimer>
|
||||||
|
|
||||||
namespace QtDiag {
|
namespace QtDiag {
|
||||||
|
|
||||||
#if QT_VERSION > 0x050000
|
|
||||||
|
|
||||||
static QString getGlString(const QOpenGLContext *ctx, GLenum name)
|
static QString getGlString(const QOpenGLContext *ctx, GLenum name)
|
||||||
{
|
{
|
||||||
if (const GLubyte *p = ctx->functions()->glGetString(name))
|
if (const GLubyte *p = ctx->functions()->glGetString(name))
|
||||||
@ -64,7 +56,6 @@ static QString glInfo(const QOpenGLContext *ctx)
|
|||||||
|
|
||||||
QString glInfo(const QObject *o)
|
QString glInfo(const QObject *o)
|
||||||
{
|
{
|
||||||
# if QT_VERSION >= 0x050400
|
|
||||||
if (o->isWindowType()) {
|
if (o->isWindowType()) {
|
||||||
if (const QOpenGLWindow *oglw = qobject_cast<const QOpenGLWindow *>(o))
|
if (const QOpenGLWindow *oglw = qobject_cast<const QOpenGLWindow *>(o))
|
||||||
return glInfo(oglw->context());
|
return glInfo(oglw->context());
|
||||||
@ -74,25 +65,8 @@ QString glInfo(const QObject *o)
|
|||||||
if (o->isWidgetType()) {
|
if (o->isWidgetType()) {
|
||||||
if (const QOpenGLWidget *g = qobject_cast<const QOpenGLWidget *>(o))
|
if (const QOpenGLWidget *g = qobject_cast<const QOpenGLWidget *>(o))
|
||||||
return glInfo(g->context());
|
return glInfo(g->context());
|
||||||
# endif // 5.4
|
|
||||||
}
|
}
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
#else // Qt4:
|
|
||||||
|
|
||||||
static QString getGlString(GLenum name)
|
|
||||||
{
|
|
||||||
if (const GLubyte *p = glGetString(name))
|
|
||||||
return QString::fromLatin1(reinterpret_cast<const char *>(p));
|
|
||||||
return QString();
|
|
||||||
}
|
|
||||||
|
|
||||||
QString glInfo(const QObject *)
|
|
||||||
{
|
|
||||||
return getGlString(GL_VENDOR) + QLatin1Char('\n') + getGlString(GL_RENDERER);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
} // namespace QtDiag
|
} // namespace QtDiag
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
**
|
**
|
||||||
** Copyright (C) 2017 The Qt Company Ltd.
|
** Copyright (C) 2021 The Qt Company Ltd.
|
||||||
** Contact: https://www.qt.io/licensing/
|
** Contact: https://www.qt.io/licensing/
|
||||||
**
|
**
|
||||||
** This file is part of the test suite of the Qt Toolkit.
|
** This file is part of the test suite of the Qt Toolkit.
|
||||||
@ -27,15 +27,13 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "logwidget.h"
|
#include "logwidget.h"
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
# include <QtCore/qlogging.h>
|
|
||||||
# include <QtCore/QLibraryInfo>
|
|
||||||
#endif
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QStyle>
|
#include <QStyle>
|
||||||
|
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
|
#include <QtCore/QLibraryInfo>
|
||||||
#include <QtCore/QList>
|
#include <QtCore/QList>
|
||||||
|
#include <QtCore/qlogging.h>
|
||||||
#include <QtCore/QStringList>
|
#include <QtCore/QStringList>
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
@ -60,19 +58,13 @@ LogWidget::~LogWidget()
|
|||||||
QString LogWidget::startupMessage()
|
QString LogWidget::startupMessage()
|
||||||
{
|
{
|
||||||
QString result;
|
QString result;
|
||||||
#if QT_VERSION >= 0x050300
|
|
||||||
result += QLatin1String(QLibraryInfo::build());
|
result += QLatin1String(QLibraryInfo::build());
|
||||||
#else
|
|
||||||
result += QLatin1String("Qt ") + QLatin1String(QT_VERSION_STR);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
const QCoreApplication *coreApp = QCoreApplication::instance();
|
const QCoreApplication *coreApp = QCoreApplication::instance();
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
if (qobject_cast<const QGuiApplication *>(coreApp)) {
|
if (qobject_cast<const QGuiApplication *>(coreApp)) {
|
||||||
result += QLatin1Char(' ');
|
result += QLatin1Char(' ');
|
||||||
result += QGuiApplication::platformName();
|
result += QGuiApplication::platformName();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
if (qobject_cast<const QApplication *>(coreApp)) {
|
if (qobject_cast<const QApplication *>(coreApp)) {
|
||||||
result += QLatin1Char(' ');
|
result += QLatin1Char(' ');
|
||||||
result += QApplication::style()->objectName();
|
result += QApplication::style()->objectName();
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
**
|
**
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
** Copyright (C) 2021 The Qt Company Ltd.
|
||||||
** Contact: https://www.qt.io/licensing/
|
** Contact: https://www.qt.io/licensing/
|
||||||
**
|
**
|
||||||
** This file is part of the test suite of the Qt Toolkit.
|
** This file is part of the test suite of the Qt Toolkit.
|
||||||
@ -28,25 +28,20 @@
|
|||||||
|
|
||||||
#include "nativewindowdump.h"
|
#include "nativewindowdump.h"
|
||||||
|
|
||||||
#if QT_VERSION >= 0x050000
|
#include <QtGui/QGuiApplication>
|
||||||
# include <QtGui/QGuiApplication>
|
#include <qpa/qplatformnativeinterface.h>
|
||||||
# include <qpa/qplatformnativeinterface.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
|
|
||||||
namespace QtDiag {
|
namespace QtDiag {
|
||||||
|
|
||||||
void dumpNativeWindows(WId wid)
|
void dumpNativeWindows(WId wid)
|
||||||
{
|
{
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
QPlatformNativeInterface *ni = QGuiApplication::platformNativeInterface();
|
QPlatformNativeInterface *ni = QGuiApplication::platformNativeInterface();
|
||||||
QString result;
|
QString result;
|
||||||
QMetaObject::invokeMethod(ni, "dumpNativeWindows", Qt::DirectConnection,
|
QMetaObject::invokeMethod(ni, "dumpNativeWindows", Qt::DirectConnection,
|
||||||
Q_RETURN_ARG(QString, result),
|
Q_RETURN_ARG(QString, result),
|
||||||
Q_ARG(WId, wid));
|
Q_ARG(WId, wid));
|
||||||
qDebug().noquote() << result;
|
qDebug().noquote() << result;
|
||||||
#endif // Qt 5
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void dumpNativeQtTopLevels()
|
void dumpNativeQtTopLevels()
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
**
|
**
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
** Copyright (C) 2021 The Qt Company Ltd.
|
||||||
** Contact: https://www.qt.io/licensing/
|
** Contact: https://www.qt.io/licensing/
|
||||||
**
|
**
|
||||||
** This file is part of the test suite of the Qt Toolkit.
|
** This file is part of the test suite of the Qt Toolkit.
|
||||||
@ -262,11 +262,7 @@ static void dumpNativeWindows(const WIdVector& wins)
|
|||||||
dc.stream = QSharedPointer<QTextStream>(new QTextStream(&s));
|
dc.stream = QSharedPointer<QTextStream>(new QTextStream(&s));
|
||||||
for (WId win : wins)
|
for (WId win : wins)
|
||||||
dumpNativeWindowRecursion(reinterpret_cast<HWND>(win), &dc);
|
dumpNativeWindowRecursion(reinterpret_cast<HWND>(win), &dc);
|
||||||
#if QT_VERSION >= 0x050400
|
|
||||||
qDebug().noquote() << s;
|
qDebug().noquote() << s;
|
||||||
#else
|
|
||||||
qDebug("%s", qPrintable(s));
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void dumpNativeWindows(WId rootIn)
|
void dumpNativeWindows(WId rootIn)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
**
|
**
|
||||||
** Copyright (C) 2020 The Qt Company Ltd.
|
** Copyright (C) 2021 The Qt Company Ltd.
|
||||||
** Contact: https://www.qt.io/licensing/
|
** Contact: https://www.qt.io/licensing/
|
||||||
**
|
**
|
||||||
** This file is part of the test suite of the Qt Toolkit.
|
** This file is part of the test suite of the Qt Toolkit.
|
||||||
@ -28,14 +28,13 @@
|
|||||||
|
|
||||||
#include "qwidgetdump.h"
|
#include "qwidgetdump.h"
|
||||||
|
|
||||||
#include <QWidget>
|
|
||||||
#if QT_VERSION > 0x050000
|
|
||||||
# include <QtGui/QScreen>
|
|
||||||
# include <QtGui/QWindow>
|
|
||||||
#endif
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QtCore/QMetaObject>
|
#include <QWidget>
|
||||||
|
#include <QtGui/QScreen>
|
||||||
|
#include <QtGui/QWindow>
|
||||||
|
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
|
#include <QtCore/QMetaObject>
|
||||||
#include <QtCore/QTextStream>
|
#include <QtCore/QTextStream>
|
||||||
|
|
||||||
namespace QtDiag {
|
namespace QtDiag {
|
||||||
@ -99,11 +98,9 @@ static void dumpWidgetRecursion(QTextStream &str, const QWidget *w,
|
|||||||
formatRect(str, w->geometry());
|
formatRect(str, w->geometry());
|
||||||
if (w->isWindow()) {
|
if (w->isWindow()) {
|
||||||
str << ' ' << w->logicalDpiX() << "DPI";
|
str << ' ' << w->logicalDpiX() << "DPI";
|
||||||
#if QT_VERSION > 0x050600
|
|
||||||
const qreal dpr = w->devicePixelRatio();
|
const qreal dpr = w->devicePixelRatio();
|
||||||
if (!qFuzzyCompare(dpr, qreal(1)))
|
if (!qFuzzyCompare(dpr, qreal(1)))
|
||||||
str << " dpr=" << dpr;
|
str << " dpr=" << dpr;
|
||||||
#endif // Qt 5.6
|
|
||||||
const QRect normalGeometry = w->normalGeometry();
|
const QRect normalGeometry = w->normalGeometry();
|
||||||
if (normalGeometry.isValid() && !normalGeometry.isEmpty() && normalGeometry != w->geometry()) {
|
if (normalGeometry.isValid() && !normalGeometry.isEmpty() && normalGeometry != w->geometry()) {
|
||||||
str << " normal=";
|
str << " normal=";
|
||||||
@ -130,13 +127,11 @@ static void dumpWidgetRecursion(QTextStream &str, const QWidget *w,
|
|||||||
str << "maximumSize=" << maximumSize.width() << 'x' << maximumSize.height() << ' ';
|
str << "maximumSize=" << maximumSize.width() << 'x' << maximumSize.height() << ' ';
|
||||||
}
|
}
|
||||||
str << '\n';
|
str << '\n';
|
||||||
#if QT_VERSION > 0x050000
|
|
||||||
if (const QWindow *win = w->windowHandle()) {
|
if (const QWindow *win = w->windowHandle()) {
|
||||||
indentStream(str, 2 * (1 + depth));
|
indentStream(str, 2 * (1 + depth));
|
||||||
formatWindow(str, win, options);
|
formatWindow(str, win, options);
|
||||||
str << '\n';
|
str << '\n';
|
||||||
}
|
}
|
||||||
#endif // Qt 5
|
|
||||||
for (const QObject *co : w->children()) {
|
for (const QObject *co : w->children()) {
|
||||||
if (co->isWidgetType())
|
if (co->isWidgetType())
|
||||||
dumpWidgetRecursion(str, static_cast<const QWidget *>(co), options, depth + 1);
|
dumpWidgetRecursion(str, static_cast<const QWidget *>(co), options, depth + 1);
|
||||||
@ -155,14 +150,8 @@ void dumpAllWidgets(FormatWindowOptions options, const QWidget *root)
|
|||||||
topLevels = QApplication::topLevelWidgets();
|
topLevels = QApplication::topLevelWidgets();
|
||||||
for (QWidget *tw : qAsConst(topLevels))
|
for (QWidget *tw : qAsConst(topLevels))
|
||||||
dumpWidgetRecursion(str, tw, options);
|
dumpWidgetRecursion(str, tw, options);
|
||||||
#if QT_VERSION >= 0x050400
|
for (const QString &line : d.split(QLatin1Char('\n')))
|
||||||
{
|
qDebug().noquote() << line;
|
||||||
for (const QString &line : d.split(QLatin1Char('\n')))
|
|
||||||
qDebug().noquote() << line;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
qDebug("%s", qPrintable(d));
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace QtDiag
|
} // namespace QtDiag
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
**
|
**
|
||||||
** Copyright (C) 2020 The Qt Company Ltd.
|
** Copyright (C) 2021 The Qt Company Ltd.
|
||||||
** Contact: https://www.qt.io/licensing/
|
** Contact: https://www.qt.io/licensing/
|
||||||
**
|
**
|
||||||
** This file is part of the test suite of the Qt Toolkit.
|
** This file is part of the test suite of the Qt Toolkit.
|
||||||
@ -28,21 +28,18 @@
|
|||||||
|
|
||||||
#include "qwindowdump.h"
|
#include "qwindowdump.h"
|
||||||
|
|
||||||
#if QT_VERSION > 0x050000
|
#include <QtGui/QGuiApplication>
|
||||||
# include <QtGui/QGuiApplication>
|
#include <QtGui/QScreen>
|
||||||
# include <QtGui/QScreen>
|
#include <QtGui/QWindow>
|
||||||
# include <QtGui/QWindow>
|
#include <QtCore/QDebug>
|
||||||
# include <qpa/qplatformwindow.h>
|
|
||||||
# include <private/qwindow_p.h>
|
|
||||||
# if QT_VERSION >= 0x050600
|
|
||||||
# include <private/qhighdpiscaling_p.h>
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
#include <QtCore/QMetaObject>
|
#include <QtCore/QMetaObject>
|
||||||
#include <QtCore/QRect>
|
#include <QtCore/QRect>
|
||||||
#include <QtCore/QDebug>
|
|
||||||
#include <QtCore/QTextStream>
|
#include <QtCore/QTextStream>
|
||||||
|
|
||||||
|
#include <qpa/qplatformwindow.h>
|
||||||
|
#include <private/qwindow_p.h>
|
||||||
|
#include <private/qhighdpiscaling_p.h>
|
||||||
|
|
||||||
namespace QtDiag {
|
namespace QtDiag {
|
||||||
|
|
||||||
void indentStream(QTextStream &s, int indent)
|
void indentStream(QTextStream &s, int indent)
|
||||||
@ -87,10 +84,8 @@ void formatWindowFlags(QTextStream &str, Qt::WindowFlags flags)
|
|||||||
debugType(str, windowType, Qt::SplashScreen)
|
debugType(str, windowType, Qt::SplashScreen)
|
||||||
debugType(str, windowType, Qt::Desktop)
|
debugType(str, windowType, Qt::Desktop)
|
||||||
debugType(str, windowType, Qt::SubWindow)
|
debugType(str, windowType, Qt::SubWindow)
|
||||||
#if QT_VERSION > 0x050000
|
|
||||||
debugType(str, windowType, Qt::ForeignWindow)
|
debugType(str, windowType, Qt::ForeignWindow)
|
||||||
debugType(str, windowType, Qt::CoverWindow)
|
debugType(str, windowType, Qt::CoverWindow)
|
||||||
#endif
|
|
||||||
debugFlag(str, flags, Qt::MSWindowsFixedSizeDialogHint)
|
debugFlag(str, flags, Qt::MSWindowsFixedSizeDialogHint)
|
||||||
debugFlag(str, flags, Qt::MSWindowsOwnDC)
|
debugFlag(str, flags, Qt::MSWindowsOwnDC)
|
||||||
debugFlag(str, flags, Qt::X11BypassWindowManagerHint)
|
debugFlag(str, flags, Qt::X11BypassWindowManagerHint)
|
||||||
@ -103,20 +98,16 @@ void formatWindowFlags(QTextStream &str, Qt::WindowFlags flags)
|
|||||||
debugFlag(str, flags, Qt::WindowShadeButtonHint)
|
debugFlag(str, flags, Qt::WindowShadeButtonHint)
|
||||||
debugFlag(str, flags, Qt::WindowStaysOnTopHint)
|
debugFlag(str, flags, Qt::WindowStaysOnTopHint)
|
||||||
debugFlag(str, flags, Qt::CustomizeWindowHint)
|
debugFlag(str, flags, Qt::CustomizeWindowHint)
|
||||||
#if QT_VERSION > 0x050000
|
|
||||||
debugFlag(str, flags, Qt::WindowTransparentForInput)
|
debugFlag(str, flags, Qt::WindowTransparentForInput)
|
||||||
debugFlag(str, flags, Qt::WindowOverridesSystemGestures)
|
debugFlag(str, flags, Qt::WindowOverridesSystemGestures)
|
||||||
debugFlag(str, flags, Qt::WindowDoesNotAcceptFocus)
|
debugFlag(str, flags, Qt::WindowDoesNotAcceptFocus)
|
||||||
debugFlag(str, flags, Qt::NoDropShadowWindowHint)
|
debugFlag(str, flags, Qt::NoDropShadowWindowHint)
|
||||||
debugFlag(str, flags, Qt::WindowFullscreenButtonHint)
|
debugFlag(str, flags, Qt::WindowFullscreenButtonHint)
|
||||||
#endif
|
|
||||||
debugFlag(str, flags, Qt::WindowStaysOnBottomHint)
|
debugFlag(str, flags, Qt::WindowStaysOnBottomHint)
|
||||||
debugFlag(str, flags, Qt::MacWindowToolBarButtonHint)
|
debugFlag(str, flags, Qt::MacWindowToolBarButtonHint)
|
||||||
debugFlag(str, flags, Qt::BypassGraphicsProxyWidget)
|
debugFlag(str, flags, Qt::BypassGraphicsProxyWidget)
|
||||||
}
|
}
|
||||||
|
|
||||||
#if QT_VERSION > 0x050000
|
|
||||||
|
|
||||||
void formatWindow(QTextStream &str, const QWindow *w, FormatWindowOptions options)
|
void formatWindow(QTextStream &str, const QWindow *w, FormatWindowOptions options)
|
||||||
{
|
{
|
||||||
const QPlatformWindow *pw = w->handle();
|
const QPlatformWindow *pw = w->handle();
|
||||||
@ -137,10 +128,8 @@ void formatWindow(QTextStream &str, const QWindow *w, FormatWindowOptions option
|
|||||||
formatRect(str, w->geometry());
|
formatRect(str, w->geometry());
|
||||||
if (w->isTopLevel()) {
|
if (w->isTopLevel()) {
|
||||||
str << " \"" << w->screen()->name() << "\" ";
|
str << " \"" << w->screen()->name() << "\" ";
|
||||||
#if QT_VERSION >= 0x050600
|
|
||||||
if (QHighDpiScaling::isActive())
|
if (QHighDpiScaling::isActive())
|
||||||
str << "factor=" << QHighDpiScaling::factor(w) << " dpr=" << w->devicePixelRatio();
|
str << "factor=" << QHighDpiScaling::factor(w) << " dpr=" << w->devicePixelRatio();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
if (!(options & DontPrintWindowFlags)) {
|
if (!(options & DontPrintWindowFlags)) {
|
||||||
str << ' ';
|
str << ' ';
|
||||||
@ -176,24 +165,7 @@ void dumpAllWindows(FormatWindowOptions options)
|
|||||||
str << "### QWindows:\n";
|
str << "### QWindows:\n";
|
||||||
for (QWindow *w : QGuiApplication::topLevelWindows())
|
for (QWindow *w : QGuiApplication::topLevelWindows())
|
||||||
dumpWindowRecursion(str, w, options);
|
dumpWindowRecursion(str, w, options);
|
||||||
#if QT_VERSION >= 0x050400
|
|
||||||
qDebug().noquote() << d;
|
qDebug().noquote() << d;
|
||||||
#else
|
|
||||||
qDebug() << d;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#else // Qt 5
|
|
||||||
class QWindow {};
|
|
||||||
|
|
||||||
void formatWindow(QTextStream &, const QWindow *, FormatWindowOptions)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void dumpAllWindows(FormatWindowOptions options)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // Qt 4
|
|
||||||
|
|
||||||
} // namespace QtDiag
|
} // namespace QtDiag
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
**
|
**
|
||||||
** Copyright (C) 2020 The Qt Company Ltd.
|
** Copyright (C) 2021 The Qt Company Ltd.
|
||||||
** Contact: https://www.qt.io/licensing/
|
** Contact: https://www.qt.io/licensing/
|
||||||
**
|
**
|
||||||
** This file is part of the test suite of the Qt Toolkit.
|
** This file is part of the test suite of the Qt Toolkit.
|
||||||
@ -41,28 +41,20 @@ struct EnumLookup {
|
|||||||
static const EnumLookup specialCharactersEnumLookup[] =
|
static const EnumLookup specialCharactersEnumLookup[] =
|
||||||
{
|
{
|
||||||
{QChar::Null, "Null"},
|
{QChar::Null, "Null"},
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
{QChar::Tabulation, "Tabulation"},
|
{QChar::Tabulation, "Tabulation"},
|
||||||
{QChar::LineFeed, "LineFeed"},
|
{QChar::LineFeed, "LineFeed"},
|
||||||
# if QT_VERSION >= 0x050e00
|
|
||||||
{QChar::FormFeed, "FormFeed"},
|
{QChar::FormFeed, "FormFeed"},
|
||||||
# endif
|
|
||||||
{QChar::CarriageReturn, "CarriageReturn"},
|
{QChar::CarriageReturn, "CarriageReturn"},
|
||||||
{QChar::Space, "Space"},
|
{QChar::Space, "Space"},
|
||||||
#endif
|
|
||||||
{QChar::Nbsp, "Nbsp"},
|
{QChar::Nbsp, "Nbsp"},
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
{QChar::SoftHyphen, "SoftHyphen"},
|
{QChar::SoftHyphen, "SoftHyphen"},
|
||||||
#endif
|
|
||||||
{QChar::ReplacementCharacter, "ReplacementCharacter"},
|
{QChar::ReplacementCharacter, "ReplacementCharacter"},
|
||||||
{QChar::ObjectReplacementCharacter, "ObjectReplacementCharacter"},
|
{QChar::ObjectReplacementCharacter, "ObjectReplacementCharacter"},
|
||||||
{QChar::ByteOrderMark, "ByteOrderMark"},
|
{QChar::ByteOrderMark, "ByteOrderMark"},
|
||||||
{QChar::ByteOrderSwapped, "ByteOrderSwapped"},
|
{QChar::ByteOrderSwapped, "ByteOrderSwapped"},
|
||||||
{QChar::ParagraphSeparator, "ParagraphSeparator"},
|
{QChar::ParagraphSeparator, "ParagraphSeparator"},
|
||||||
{QChar::LineSeparator, "LineSeparator"},
|
{QChar::LineSeparator, "LineSeparator"},
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
{QChar::LastValidCodePoint, "LastValidCodePoint"}
|
{QChar::LastValidCodePoint, "LastValidCodePoint"}
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static const EnumLookup categoryEnumLookup[] =
|
static const EnumLookup categoryEnumLookup[] =
|
||||||
@ -105,8 +97,6 @@ static const EnumLookup categoryEnumLookup[] =
|
|||||||
{QChar::Symbol_Other, "Symbol_Other"},
|
{QChar::Symbol_Other, "Symbol_Other"},
|
||||||
};
|
};
|
||||||
|
|
||||||
#if QT_VERSION >= 0x050100
|
|
||||||
|
|
||||||
static const EnumLookup scriptEnumLookup[] =
|
static const EnumLookup scriptEnumLookup[] =
|
||||||
{
|
{
|
||||||
{QChar::Script_Unknown, "Script_Unknown"},
|
{QChar::Script_Unknown, "Script_Unknown"},
|
||||||
@ -221,7 +211,6 @@ static const EnumLookup scriptEnumLookup[] =
|
|||||||
{QChar::Script_SoraSompeng, "Script_SoraSompeng"},
|
{QChar::Script_SoraSompeng, "Script_SoraSompeng"},
|
||||||
{QChar::Script_Takri, "Script_Takri"},
|
{QChar::Script_Takri, "Script_Takri"},
|
||||||
|
|
||||||
#if QT_VERSION >= 0x050500
|
|
||||||
{QChar::Script_CaucasianAlbanian, "Script_CaucasianAlbanian"},
|
{QChar::Script_CaucasianAlbanian, "Script_CaucasianAlbanian"},
|
||||||
{QChar::Script_BassaVah, "Script_BassaVah"},
|
{QChar::Script_BassaVah, "Script_BassaVah"},
|
||||||
{QChar::Script_Duployan, "Script_Duployan"},
|
{QChar::Script_Duployan, "Script_Duployan"},
|
||||||
@ -245,20 +234,15 @@ static const EnumLookup scriptEnumLookup[] =
|
|||||||
{QChar::Script_Khudawadi, "Script_Khudawadi"},
|
{QChar::Script_Khudawadi, "Script_Khudawadi"},
|
||||||
{QChar::Script_Tirhuta, "Script_Tirhuta"},
|
{QChar::Script_Tirhuta, "Script_Tirhuta"},
|
||||||
{QChar::Script_WarangCiti, "Script_WarangCiti"},
|
{QChar::Script_WarangCiti, "Script_WarangCiti"},
|
||||||
#endif // Qt 5.5
|
|
||||||
|
|
||||||
#if QT_VERSION >= 0x050600
|
|
||||||
{QChar::Script_Ahom, "Script_Ahom"},
|
{QChar::Script_Ahom, "Script_Ahom"},
|
||||||
{QChar::Script_AnatolianHieroglyphs, "Script_AnatolianHieroglyphs"},
|
{QChar::Script_AnatolianHieroglyphs, "Script_AnatolianHieroglyphs"},
|
||||||
{QChar::Script_Hatran, "Script_Hatran"},
|
{QChar::Script_Hatran, "Script_Hatran"},
|
||||||
{QChar::Script_Multani, "Script_Multani"},
|
{QChar::Script_Multani, "Script_Multani"},
|
||||||
{QChar::Script_OldHungarian, "Script_OldHungarian"},
|
{QChar::Script_OldHungarian, "Script_OldHungarian"},
|
||||||
{QChar::Script_SignWriting, "Script_SignWriting"},
|
{QChar::Script_SignWriting, "Script_SignWriting"},
|
||||||
#endif // Qt 5.5
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // Qt 5.1
|
|
||||||
|
|
||||||
static const EnumLookup directionEnumLookup[] =
|
static const EnumLookup directionEnumLookup[] =
|
||||||
{
|
{
|
||||||
{QChar::DirL, "DirL"},
|
{QChar::DirL, "DirL"},
|
||||||
@ -280,12 +264,10 @@ static const EnumLookup directionEnumLookup[] =
|
|||||||
{QChar::DirPDF, "DirPDF"},
|
{QChar::DirPDF, "DirPDF"},
|
||||||
{QChar::DirNSM, "DirNSM"},
|
{QChar::DirNSM, "DirNSM"},
|
||||||
{QChar::DirBN, "DirBN"},
|
{QChar::DirBN, "DirBN"},
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
{QChar::DirLRI, "DirLRI"},
|
{QChar::DirLRI, "DirLRI"},
|
||||||
{QChar::DirRLI, "DirRLI"},
|
{QChar::DirRLI, "DirRLI"},
|
||||||
{QChar::DirFSI, "DirFSI"},
|
{QChar::DirFSI, "DirFSI"},
|
||||||
{QChar::DirPDI, "DirPDI"},
|
{QChar::DirPDI, "DirPDI"},
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static const EnumLookup decompositionEnumLookup[] =
|
static const EnumLookup decompositionEnumLookup[] =
|
||||||
@ -310,8 +292,6 @@ static const EnumLookup decompositionEnumLookup[] =
|
|||||||
{QChar::Fraction, "Fraction"},
|
{QChar::Fraction, "Fraction"},
|
||||||
};
|
};
|
||||||
|
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
|
|
||||||
static const EnumLookup joiningTypeEnumLookup[] =
|
static const EnumLookup joiningTypeEnumLookup[] =
|
||||||
{
|
{
|
||||||
{QChar::Joining_None, "Joining_None"},
|
{QChar::Joining_None, "Joining_None"},
|
||||||
@ -322,8 +302,6 @@ static const EnumLookup joiningTypeEnumLookup[] =
|
|||||||
{QChar::Joining_Transparent, "Joining_Transparent"}
|
{QChar::Joining_Transparent, "Joining_Transparent"}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // Qt 5
|
|
||||||
|
|
||||||
static const EnumLookup combiningClassEnumLookup[] =
|
static const EnumLookup combiningClassEnumLookup[] =
|
||||||
{
|
{
|
||||||
{QChar::Combining_BelowLeftAttached, "Combining_BelowLeftAttached"},
|
{QChar::Combining_BelowLeftAttached, "Combining_BelowLeftAttached"},
|
||||||
@ -361,20 +339,14 @@ static const EnumLookup unicodeVersionEnumLookup[] =
|
|||||||
{QChar::Unicode_4_0, "Unicode_4_0"},
|
{QChar::Unicode_4_0, "Unicode_4_0"},
|
||||||
{QChar::Unicode_4_1, "Unicode_4_1"},
|
{QChar::Unicode_4_1, "Unicode_4_1"},
|
||||||
{QChar::Unicode_5_0, "Unicode_5_0"},
|
{QChar::Unicode_5_0, "Unicode_5_0"},
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
{QChar::Unicode_5_1, "Unicode_5_1"},
|
{QChar::Unicode_5_1, "Unicode_5_1"},
|
||||||
{QChar::Unicode_5_2, "Unicode_5_2"},
|
{QChar::Unicode_5_2, "Unicode_5_2"},
|
||||||
{QChar::Unicode_6_0, "Unicode_6_0"},
|
{QChar::Unicode_6_0, "Unicode_6_0"},
|
||||||
{QChar::Unicode_6_1, "Unicode_6_1"},
|
{QChar::Unicode_6_1, "Unicode_6_1"},
|
||||||
{QChar::Unicode_6_2, "Unicode_6_2"},
|
{QChar::Unicode_6_2, "Unicode_6_2"},
|
||||||
{QChar::Unicode_6_3, "Unicode_6_3"},
|
{QChar::Unicode_6_3, "Unicode_6_3"},
|
||||||
#if QT_VERSION >= 0x050500
|
|
||||||
{QChar::Unicode_7_0, "Unicode_7_0"},
|
{QChar::Unicode_7_0, "Unicode_7_0"},
|
||||||
#endif // Qt 5.5
|
|
||||||
#if QT_VERSION >= 0x050600
|
|
||||||
{QChar::Unicode_8_0, "Unicode_8_0"},
|
{QChar::Unicode_8_0, "Unicode_8_0"},
|
||||||
#endif // Qt 5.6
|
|
||||||
#endif // Qt 5
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static const EnumLookup *enumLookup(int v, const EnumLookup *array, size_t size)
|
static const EnumLookup *enumLookup(int v, const EnumLookup *array, size_t size)
|
||||||
@ -423,7 +395,6 @@ static void formatCharacter(QTextStream &str, const QChar &qc, FormattingContext
|
|||||||
<< enumName(category, categoryEnumLookup, sizeof(categoryEnumLookup) / sizeof(EnumLookup));
|
<< enumName(category, categoryEnumLookup, sizeof(categoryEnumLookup) / sizeof(EnumLookup));
|
||||||
context.category = category;
|
context.category = category;
|
||||||
}
|
}
|
||||||
#if QT_VERSION >= 0x050100
|
|
||||||
const int script = qc.script();
|
const int script = qc.script();
|
||||||
if (script != context.script) {
|
if (script != context.script) {
|
||||||
str << " script="
|
str << " script="
|
||||||
@ -431,21 +402,18 @@ static void formatCharacter(QTextStream &str, const QChar &qc, FormattingContext
|
|||||||
<< '(' << script << ')';
|
<< '(' << script << ')';
|
||||||
context.script = script;
|
context.script = script;
|
||||||
}
|
}
|
||||||
#endif // Qt 5
|
|
||||||
const int direction = qc.direction();
|
const int direction = qc.direction();
|
||||||
if (direction != context.direction) {
|
if (direction != context.direction) {
|
||||||
str << " direction="
|
str << " direction="
|
||||||
<< enumName(direction, directionEnumLookup, sizeof(directionEnumLookup) / sizeof(EnumLookup));
|
<< enumName(direction, directionEnumLookup, sizeof(directionEnumLookup) / sizeof(EnumLookup));
|
||||||
context.direction = direction;
|
context.direction = direction;
|
||||||
}
|
}
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
const int joiningType = qc.joiningType();
|
const int joiningType = qc.joiningType();
|
||||||
if (joiningType != context.joiningType) {
|
if (joiningType != context.joiningType) {
|
||||||
str << " joiningType="
|
str << " joiningType="
|
||||||
<< enumName(joiningType, joiningTypeEnumLookup, sizeof(joiningTypeEnumLookup) / sizeof(EnumLookup));
|
<< enumName(joiningType, joiningTypeEnumLookup, sizeof(joiningTypeEnumLookup) / sizeof(EnumLookup));
|
||||||
context.joiningType = joiningType;
|
context.joiningType = joiningType;
|
||||||
}
|
}
|
||||||
#endif // Qt 5QWidget
|
|
||||||
const int decompositionTag = qc.decompositionTag();
|
const int decompositionTag = qc.decompositionTag();
|
||||||
if (decompositionTag != context.decompositionTag) {
|
if (decompositionTag != context.decompositionTag) {
|
||||||
str << " decomposition="
|
str << " decomposition="
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
**
|
**
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
** Copyright (C) 2021 The Qt Company Ltd.
|
||||||
** Contact: https://www.qt.io/licensing/
|
** Contact: https://www.qt.io/licensing/
|
||||||
**
|
**
|
||||||
** This file is part of the test suite of the Qt Toolkit.
|
** This file is part of the test suite of the Qt Toolkit.
|
||||||
@ -326,7 +326,6 @@ void FileDialogPanel::getOpenFileNames()
|
|||||||
|
|
||||||
void FileDialogPanel::getOpenFileUrls()
|
void FileDialogPanel::getOpenFileUrls()
|
||||||
{
|
{
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
QString selectedFilter = m_selectedNameFilter->text().trimmed();
|
QString selectedFilter = m_selectedNameFilter->text().trimmed();
|
||||||
const QList<QUrl> files =
|
const QList<QUrl> files =
|
||||||
QFileDialog::getOpenFileUrls(this, tr("getOpenFileNames Qt %1").arg(QLatin1String(QT_VERSION_STR)),
|
QFileDialog::getOpenFileUrls(this, tr("getOpenFileNames Qt %1").arg(QLatin1String(QT_VERSION_STR)),
|
||||||
@ -339,7 +338,6 @@ void FileDialogPanel::getOpenFileUrls()
|
|||||||
<< "\nName filter: " << selectedFilter;
|
<< "\nName filter: " << selectedFilter;
|
||||||
QMessageBox::information(this, tr("getOpenFileNames"), result, QMessageBox::Ok);
|
QMessageBox::information(this, tr("getOpenFileNames"), result, QMessageBox::Ok);
|
||||||
}
|
}
|
||||||
#endif // Qt 5
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileDialogPanel::getOpenFileName()
|
void FileDialogPanel::getOpenFileName()
|
||||||
@ -359,7 +357,6 @@ void FileDialogPanel::getOpenFileName()
|
|||||||
|
|
||||||
void FileDialogPanel::getOpenFileUrl()
|
void FileDialogPanel::getOpenFileUrl()
|
||||||
{
|
{
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
QString selectedFilter = m_selectedNameFilter->text().trimmed();
|
QString selectedFilter = m_selectedNameFilter->text().trimmed();
|
||||||
const QUrl file =
|
const QUrl file =
|
||||||
QFileDialog::getOpenFileUrl(this, tr("getOpenFileUrl Qt %1").arg(QLatin1String(QT_VERSION_STR)),
|
QFileDialog::getOpenFileUrl(this, tr("getOpenFileUrl Qt %1").arg(QLatin1String(QT_VERSION_STR)),
|
||||||
@ -372,7 +369,6 @@ void FileDialogPanel::getOpenFileUrl()
|
|||||||
<< "\nName filter: " << selectedFilter;
|
<< "\nName filter: " << selectedFilter;
|
||||||
QMessageBox::information(this, tr("getOpenFileName"), result, QMessageBox::Ok);
|
QMessageBox::information(this, tr("getOpenFileName"), result, QMessageBox::Ok);
|
||||||
}
|
}
|
||||||
#endif // Qt 5
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileDialogPanel::getSaveFileName()
|
void FileDialogPanel::getSaveFileName()
|
||||||
@ -392,7 +388,6 @@ void FileDialogPanel::getSaveFileName()
|
|||||||
|
|
||||||
void FileDialogPanel::getSaveFileUrl()
|
void FileDialogPanel::getSaveFileUrl()
|
||||||
{
|
{
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
QString selectedFilter = m_selectedNameFilter->text().trimmed();
|
QString selectedFilter = m_selectedNameFilter->text().trimmed();
|
||||||
const QUrl file =
|
const QUrl file =
|
||||||
QFileDialog::getSaveFileUrl(this, tr("getSaveFileName Qt %1").arg(QLatin1String(QT_VERSION_STR)),
|
QFileDialog::getSaveFileUrl(this, tr("getSaveFileName Qt %1").arg(QLatin1String(QT_VERSION_STR)),
|
||||||
@ -405,7 +400,6 @@ void FileDialogPanel::getSaveFileUrl()
|
|||||||
<< "\nName filter: " << selectedFilter;
|
<< "\nName filter: " << selectedFilter;
|
||||||
QMessageBox::information(this, tr("getSaveFileNames"), result, QMessageBox::Ok);
|
QMessageBox::information(this, tr("getSaveFileNames"), result, QMessageBox::Ok);
|
||||||
}
|
}
|
||||||
#endif // Qt 5
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileDialogPanel::getExistingDirectory()
|
void FileDialogPanel::getExistingDirectory()
|
||||||
@ -419,14 +413,12 @@ void FileDialogPanel::getExistingDirectory()
|
|||||||
|
|
||||||
void FileDialogPanel::getExistingDirectoryUrl()
|
void FileDialogPanel::getExistingDirectoryUrl()
|
||||||
{
|
{
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
const QUrl dir =
|
const QUrl dir =
|
||||||
QFileDialog::getExistingDirectoryUrl(this, tr("getExistingDirectory Qt %1").arg(QLatin1String(QT_VERSION_STR)),
|
QFileDialog::getExistingDirectoryUrl(this, tr("getExistingDirectory Qt %1").arg(QLatin1String(QT_VERSION_STR)),
|
||||||
currentDirectoryUrl(), options() | QFileDialog::ShowDirsOnly,
|
currentDirectoryUrl(), options() | QFileDialog::ShowDirsOnly,
|
||||||
allowedSchemes());
|
allowedSchemes());
|
||||||
if (!dir.isEmpty())
|
if (!dir.isEmpty())
|
||||||
QMessageBox::information(this, tr("getExistingDirectory"), QLatin1String("Directory: ") + dir.toString(), QMessageBox::Ok);
|
QMessageBox::information(this, tr("getExistingDirectory"), QLatin1String("Directory: ") + dir.toString(), QMessageBox::Ok);
|
||||||
#endif // Qt 5
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileDialogPanel::restoreDefaults()
|
void FileDialogPanel::restoreDefaults()
|
||||||
@ -473,11 +465,9 @@ void FileDialogPanel::applySettings(QFileDialog *d) const
|
|||||||
if (!filter.isEmpty())
|
if (!filter.isEmpty())
|
||||||
d->selectNameFilter(filter);
|
d->selectNameFilter(filter);
|
||||||
} else {
|
} else {
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
d->setMimeTypeFilters(filters);
|
d->setMimeTypeFilters(filters);
|
||||||
if (!filter.isEmpty())
|
if (!filter.isEmpty())
|
||||||
d->selectMimeTypeFilter(filter);
|
d->selectMimeTypeFilter(filter);
|
||||||
#endif // Qt 5
|
|
||||||
}
|
}
|
||||||
foreach (LabelLineEdit *l, m_labelLineEdits)
|
foreach (LabelLineEdit *l, m_labelLineEdits)
|
||||||
l->apply(d);
|
l->apply(d);
|
||||||
@ -504,14 +494,10 @@ void FileDialogPanel::accepted()
|
|||||||
Q_ASSERT(d);
|
Q_ASSERT(d);
|
||||||
m_result.clear();
|
m_result.clear();
|
||||||
QDebug(&m_result).nospace()
|
QDebug(&m_result).nospace()
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
<< "URLs: " << d->selectedUrls() << '\n'
|
<< "URLs: " << d->selectedUrls() << '\n'
|
||||||
#endif
|
|
||||||
<< "Files: " << d->selectedFiles()
|
<< "Files: " << d->selectedFiles()
|
||||||
<< "\nDirectory: "
|
<< "\nDirectory: "
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
<< d->directoryUrl() << ", "
|
<< d->directoryUrl() << ", "
|
||||||
#endif
|
|
||||||
<< d->directory().absolutePath()
|
<< d->directory().absolutePath()
|
||||||
<< "\nName filter: " << d->selectedNameFilter();
|
<< "\nName filter: " << d->selectedNameFilter();
|
||||||
QTimer::singleShot(0, this, SLOT(showAcceptedResult())); // Avoid problems with the closing (modal) dialog as parent.
|
QTimer::singleShot(0, this, SLOT(showAcceptedResult())); // Avoid problems with the closing (modal) dialog as parent.
|
||||||
|
@ -196,12 +196,10 @@ void FontDialogPanel::applySettings(QFontDialog *d) const
|
|||||||
{
|
{
|
||||||
d->setOption(QFontDialog::NoButtons, m_noButtons->isChecked());
|
d->setOption(QFontDialog::NoButtons, m_noButtons->isChecked());
|
||||||
d->setOption(QFontDialog::DontUseNativeDialog, m_dontUseNativeDialog->isChecked());
|
d->setOption(QFontDialog::DontUseNativeDialog, m_dontUseNativeDialog->isChecked());
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
d->setOption(QFontDialog::ScalableFonts, m_scalableFilter->isChecked());
|
d->setOption(QFontDialog::ScalableFonts, m_scalableFilter->isChecked());
|
||||||
d->setOption(QFontDialog::NonScalableFonts, m_nonScalableFilter->isChecked());
|
d->setOption(QFontDialog::NonScalableFonts, m_nonScalableFilter->isChecked());
|
||||||
d->setOption(QFontDialog::MonospacedFonts, m_monospacedFilter->isChecked());
|
d->setOption(QFontDialog::MonospacedFonts, m_monospacedFilter->isChecked());
|
||||||
d->setOption(QFontDialog::ProportionalFonts, m_proportionalFilter->isChecked());
|
d->setOption(QFontDialog::ProportionalFonts, m_proportionalFilter->isChecked());
|
||||||
#endif // Qt 5
|
|
||||||
|
|
||||||
QFont font = m_fontFamilyBox->currentFont();
|
QFont font = m_fontFamilyBox->currentFont();
|
||||||
font.setPointSizeF(m_fontSizeBox->value());
|
font.setPointSizeF(m_fontSizeBox->value());
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
**
|
**
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
** Copyright (C) 2021 The Qt Company Ltd.
|
||||||
** Contact: https://www.qt.io/licensing/
|
** Contact: https://www.qt.io/licensing/
|
||||||
**
|
**
|
||||||
** This file is part of the test suite of the Qt Toolkit.
|
** This file is part of the test suite of the Qt Toolkit.
|
||||||
@ -59,15 +59,9 @@ AboutDialog::AboutDialog(QWidget *parent) : QDialog(parent)
|
|||||||
{
|
{
|
||||||
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||||
QFormLayout *mainLayout = new QFormLayout(this);
|
QFormLayout *mainLayout = new QFormLayout(this);
|
||||||
#if QT_VERSION >= 0x050600
|
|
||||||
mainLayout->addRow(new QLabel(QLibraryInfo::build()));
|
mainLayout->addRow(new QLabel(QLibraryInfo::build()));
|
||||||
#else
|
|
||||||
mainLayout->addRow(new QLabel(QLatin1String("Qt ") + QLatin1String(QT_VERSION_STR )));
|
|
||||||
#endif
|
|
||||||
mainLayout->addRow("Style:", new QLabel(qApp->style()->objectName()));
|
mainLayout->addRow("Style:", new QLabel(qApp->style()->objectName()));
|
||||||
#if QT_VERSION >= 0x050600
|
|
||||||
mainLayout->addRow("DPR:", new QLabel(QString::number(qApp->devicePixelRatio())));
|
mainLayout->addRow("DPR:", new QLabel(QString::number(qApp->devicePixelRatio())));
|
||||||
#endif
|
|
||||||
const QString resolution = QString::number(logicalDpiX()) + QLatin1Char(',')
|
const QString resolution = QString::number(logicalDpiX()) + QLatin1Char(',')
|
||||||
+ QString::number(logicalDpiY()) + QLatin1String("dpi");
|
+ QString::number(logicalDpiY()) + QLatin1String("dpi");
|
||||||
mainLayout->addRow("Resolution:", new QLabel(resolution));
|
mainLayout->addRow("Resolution:", new QLabel(resolution));
|
||||||
@ -129,9 +123,7 @@ int main(int argc, char *argv[])
|
|||||||
for (int a = 1; a < argc; ++a) {
|
for (int a = 1; a < argc; ++a) {
|
||||||
if (!qstrcmp(argv[a], "-n")) {
|
if (!qstrcmp(argv[a], "-n")) {
|
||||||
qDebug("AA_DontUseNativeDialogs");
|
qDebug("AA_DontUseNativeDialogs");
|
||||||
#if QT_VERSION >= 0x050700
|
|
||||||
QCoreApplication::setAttribute(Qt::AA_DontUseNativeDialogs);
|
QCoreApplication::setAttribute(Qt::AA_DontUseNativeDialogs);
|
||||||
#endif
|
|
||||||
} else if (!qstrcmp(argv[a], "-p")) {
|
} else if (!qstrcmp(argv[a], "-p")) {
|
||||||
optNoPrinter = true; // Avoid startup slowdown by printer code
|
optNoPrinter = true; // Avoid startup slowdown by printer code
|
||||||
}
|
}
|
||||||
|
@ -138,11 +138,9 @@ void MessageBoxPanel::setupMessageBox(QMessageBox &box)
|
|||||||
if (box.standardButtons() == QMessageBox::StandardButtons())
|
if (box.standardButtons() == QMessageBox::StandardButtons())
|
||||||
box.setStandardButtons(QMessageBox::Ok); // just to have something.
|
box.setStandardButtons(QMessageBox::Ok); // just to have something.
|
||||||
|
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
box.setCheckBox(0);
|
box.setCheckBox(0);
|
||||||
if (m_checkboxText->text().length() > 0)
|
if (m_checkboxText->text().length() > 0)
|
||||||
box.setCheckBox(new QCheckBox(m_checkboxText->text()));
|
box.setCheckBox(new QCheckBox(m_checkboxText->text()));
|
||||||
#endif // Qt 5
|
|
||||||
|
|
||||||
box.setIcon((QMessageBox::Icon) m_iconComboBox->currentIndex());
|
box.setIcon((QMessageBox::Icon) m_iconComboBox->currentIndex());
|
||||||
}
|
}
|
||||||
@ -167,14 +165,12 @@ void MessageBoxPanel::doExec()
|
|||||||
QString sres;
|
QString sres;
|
||||||
sres.setNum(res, 16);
|
sres.setNum(res, 16);
|
||||||
m_resultLabel->setText(QString::fromLatin1("Return value (hex): %1").arg(sres));
|
m_resultLabel->setText(QString::fromLatin1("Return value (hex): %1").arg(sres));
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
if (m_msgbox->checkBox()) {
|
if (m_msgbox->checkBox()) {
|
||||||
if (m_msgbox->checkBox()->isChecked())
|
if (m_msgbox->checkBox()->isChecked())
|
||||||
m_checkBoxResult->setText(QString::fromLatin1("Checkbox was checked"));
|
m_checkBoxResult->setText(QString::fromLatin1("Checkbox was checked"));
|
||||||
else
|
else
|
||||||
m_checkBoxResult->setText(QString::fromLatin1("Checkbox was not checked"));
|
m_checkBoxResult->setText(QString::fromLatin1("Checkbox was not checked"));
|
||||||
}
|
}
|
||||||
#endif // Qt 5
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessageBoxPanel::doShowApply()
|
void MessageBoxPanel::doShowApply()
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
**
|
**
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
** Copyright (C) 2021 The Qt Company Ltd.
|
||||||
** Contact: https://www.qt.io/licensing/
|
** Contact: https://www.qt.io/licensing/
|
||||||
**
|
**
|
||||||
** This file is part of the test suite of the Qt Toolkit.
|
** This file is part of the test suite of the Qt Toolkit.
|
||||||
@ -33,9 +33,7 @@
|
|||||||
|
|
||||||
#include "ui_printdialogpanel.h"
|
#include "ui_printdialogpanel.h"
|
||||||
|
|
||||||
#if QT_VERSION >= 0x050300
|
|
||||||
#include <QPageLayout>
|
#include <QPageLayout>
|
||||||
#endif
|
|
||||||
#include <QPrinter>
|
#include <QPrinter>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
@ -50,31 +48,6 @@ QT_END_NAMESPACE
|
|||||||
class PageSizeControl;
|
class PageSizeControl;
|
||||||
class OptionsControl;
|
class OptionsControl;
|
||||||
|
|
||||||
#if QT_VERSION < 0x050300
|
|
||||||
// Copied from class QPageLayout introduced in Qt 5.3
|
|
||||||
namespace QPageLayout
|
|
||||||
{
|
|
||||||
enum Unit {
|
|
||||||
Millimeter,
|
|
||||||
Point,
|
|
||||||
Inch,
|
|
||||||
Pica,
|
|
||||||
Didot,
|
|
||||||
Cicero
|
|
||||||
};
|
|
||||||
|
|
||||||
enum Orientation {
|
|
||||||
Portrait,
|
|
||||||
Landscape
|
|
||||||
};
|
|
||||||
|
|
||||||
enum Mode {
|
|
||||||
StandardMode, // Paint Rect includes margins
|
|
||||||
FullPageMode // Paint Rect excludes margins
|
|
||||||
};
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class PrintDialogPanel : public QWidget
|
class PrintDialogPanel : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -107,12 +80,7 @@ private:
|
|||||||
bool m_blockSignals;
|
bool m_blockSignals;
|
||||||
Ui::PrintDialogPanel m_panel;
|
Ui::PrintDialogPanel m_panel;
|
||||||
|
|
||||||
#if QT_VERSION >= 0x050300
|
|
||||||
QPageLayout m_pageLayout;
|
QPageLayout m_pageLayout;
|
||||||
#else
|
|
||||||
QPrinter m_printerLayout;
|
|
||||||
QPrinter::Unit m_units;
|
|
||||||
#endif
|
|
||||||
QScopedPointer<QPrinter> m_printer;
|
QScopedPointer<QPrinter> m_printer;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
**
|
**
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
** Copyright (C) 2021 The Qt Company Ltd.
|
||||||
** Contact: https://www.qt.io/licensing/
|
** Contact: https://www.qt.io/licensing/
|
||||||
**
|
**
|
||||||
** This file is part of the test suite of the Qt Toolkit.
|
** This file is part of the test suite of the Qt Toolkit.
|
||||||
@ -196,10 +196,6 @@ static int rm(const char *fileName)
|
|||||||
|
|
||||||
static int rmr(const char *dirName)
|
static int rmr(const char *dirName)
|
||||||
{
|
{
|
||||||
#if QT_VERSION < 0x050000
|
|
||||||
Q_UNUSED(dirName);
|
|
||||||
return 1;
|
|
||||||
#else
|
|
||||||
QDir dir(QString::fromLocal8Bit(dirName));
|
QDir dir(QString::fromLocal8Bit(dirName));
|
||||||
if (!dir.removeRecursively()) {
|
if (!dir.removeRecursively()) {
|
||||||
qWarning().nospace() << "Failed to remove " << dir.absolutePath();
|
qWarning().nospace() << "Failed to remove " << dir.absolutePath();
|
||||||
@ -207,7 +203,6 @@ static int rmr(const char *dirName)
|
|||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
**
|
**
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
** Copyright (C) 2021 The Qt Company Ltd.
|
||||||
** Contact: https://www.qt.io/licensing/
|
** Contact: https://www.qt.io/licensing/
|
||||||
**
|
**
|
||||||
** This file is part of the test suite of the Qt Toolkit.
|
** This file is part of the test suite of the Qt Toolkit.
|
||||||
@ -47,15 +47,10 @@
|
|||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
|
|
||||||
#if QT_VERSION > 0x050000
|
#include <QScreen>
|
||||||
# include <QScreen>
|
#include <QWindow>
|
||||||
# include <QWindow>
|
#include <private/qhighdpiscaling_p.h>
|
||||||
# include <private/qhighdpiscaling_p.h>
|
#include <qpa/qplatformwindow.h>
|
||||||
# include <qpa/qplatformwindow.h>
|
|
||||||
#else
|
|
||||||
# define Q_NULLPTR 0
|
|
||||||
# define Q_DECL_OVERRIDE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
# include <qt_windows.h>
|
# include <qt_windows.h>
|
||||||
@ -64,14 +59,6 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
|
|
||||||
#if QT_VERSION < 0x050000
|
|
||||||
QDebug operator<<(QDebug d, const QPixmap &p)
|
|
||||||
{
|
|
||||||
d.nospace() << "QPixmap(" << p.size() << ')';
|
|
||||||
return d;
|
|
||||||
}
|
|
||||||
#endif // Qt 4
|
|
||||||
|
|
||||||
// High DPI cursor test for testing cursor sizes in multi-screen setups.
|
// High DPI cursor test for testing cursor sizes in multi-screen setups.
|
||||||
// It creates one widget per screen with a grid of standard cursors,
|
// It creates one widget per screen with a grid of standard cursors,
|
||||||
// pixmap / bitmap cursors and pixmap / bitmap cursors with device pixel ratio 2.
|
// pixmap / bitmap cursors and pixmap / bitmap cursors with device pixel ratio 2.
|
||||||
@ -139,7 +126,6 @@ static QCursor bitmapCursor(int size)
|
|||||||
return QCursor(bitmaps.first, bitmaps.second, size / 2, size / 2);
|
return QCursor(bitmaps.first, bitmaps.second, size / 2, size / 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if QT_VERSION > 0x050000
|
|
||||||
static QCursor pixmapCursorDevicePixelRatio(int size, int dpr)
|
static QCursor pixmapCursorDevicePixelRatio(int size, int dpr)
|
||||||
{
|
{
|
||||||
QPixmap pixmap = paintPixmap(dpr * size, Qt::yellow);
|
QPixmap pixmap = paintPixmap(dpr * size, Qt::yellow);
|
||||||
@ -154,7 +140,6 @@ static QCursor bitmapCursorDevicePixelRatio(int size, int dpr)
|
|||||||
bitmaps.second.setDevicePixelRatio(dpr);
|
bitmaps.second.setDevicePixelRatio(dpr);
|
||||||
return QCursor(bitmaps.first, bitmaps.second, size / 2, size / 2);
|
return QCursor(bitmaps.first, bitmaps.second, size / 2, size / 2);
|
||||||
}
|
}
|
||||||
#endif // Qt 5
|
|
||||||
|
|
||||||
// A label from which a pixmap can be dragged for testing drag with pixmaps/DPR.
|
// A label from which a pixmap can be dragged for testing drag with pixmaps/DPR.
|
||||||
class DraggableLabel : public QLabel {
|
class DraggableLabel : public QLabel {
|
||||||
@ -191,9 +176,7 @@ void DraggableLabel::mousePressEvent(QMouseEvent *)
|
|||||||
drag->setMimeData(mimeData);
|
drag->setMimeData(mimeData);
|
||||||
drag->setPixmap(pixmap);
|
drag->setPixmap(pixmap);
|
||||||
QPoint sizeP = QPoint(m_pixmap.width(), m_pixmap.height());
|
QPoint sizeP = QPoint(m_pixmap.width(), m_pixmap.height());
|
||||||
#if QT_VERSION > 0x050000
|
|
||||||
sizeP /= int(m_pixmap.devicePixelRatio());
|
sizeP /= int(m_pixmap.devicePixelRatio());
|
||||||
#endif // Qt 5
|
|
||||||
drag->setHotSpot(sizeP / 2);
|
drag->setHotSpot(sizeP / 2);
|
||||||
qDebug() << "Dragging:" << m_pixmap;
|
qDebug() << "Dragging:" << m_pixmap;
|
||||||
drag->exec(Qt::CopyAction | Qt::MoveAction, Qt::CopyAction);
|
drag->exec(Qt::CopyAction | Qt::MoveAction, Qt::CopyAction);
|
||||||
@ -244,10 +227,8 @@ static QLabel *createCursorLabel(const QCursor &cursor, const QString &additiona
|
|||||||
{
|
{
|
||||||
QString labelText;
|
QString labelText;
|
||||||
QDebug(&labelText).nospace() << cursor.shape();
|
QDebug(&labelText).nospace() << cursor.shape();
|
||||||
#if QT_VERSION > 0x050000
|
|
||||||
labelText.remove(0, labelText.indexOf('(') + 1);
|
labelText.remove(0, labelText.indexOf('(') + 1);
|
||||||
labelText.chop(1);
|
labelText.chop(1);
|
||||||
#endif // Qt 5
|
|
||||||
if (!additionalText.isEmpty())
|
if (!additionalText.isEmpty())
|
||||||
labelText += ' ' + additionalText;
|
labelText += ' ' + additionalText;
|
||||||
const QPixmap cursorPixmap = cursor.pixmap();
|
const QPixmap cursorPixmap = cursor.pixmap();
|
||||||
@ -279,9 +260,7 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
, m_screenInfoLabel(new QLabel)
|
, m_screenInfoLabel(new QLabel)
|
||||||
{
|
{
|
||||||
QString title = "Cursors ";
|
QString title = "Cursors ";
|
||||||
#if QT_VERSION > 0x050000
|
|
||||||
title += '(' + QGuiApplication::platformName() + ") ";
|
title += '(' + QGuiApplication::platformName() + ") ";
|
||||||
#endif
|
|
||||||
title += QT_VERSION_STR;
|
title += QT_VERSION_STR;
|
||||||
setWindowTitle(title);
|
setWindowTitle(title);
|
||||||
|
|
||||||
@ -315,7 +294,6 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
QLatin1String("Plain BM ") + QString::number(size)),
|
QLatin1String("Plain BM ") + QString::number(size)),
|
||||||
gridLayout, columnCount, row, col);
|
gridLayout, columnCount, row, col);
|
||||||
|
|
||||||
#if QT_VERSION > 0x050000
|
|
||||||
addToGrid(createCursorLabel(QCursor(pixmapCursorDevicePixelRatio(size, 2)),
|
addToGrid(createCursorLabel(QCursor(pixmapCursorDevicePixelRatio(size, 2)),
|
||||||
"PX with DPR 2 " + QString::number(size)),
|
"PX with DPR 2 " + QString::number(size)),
|
||||||
gridLayout, columnCount, row, col);
|
gridLayout, columnCount, row, col);
|
||||||
@ -323,7 +301,6 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
addToGrid(createCursorLabel(QCursor(bitmapCursorDevicePixelRatio(size, 2)),
|
addToGrid(createCursorLabel(QCursor(bitmapCursorDevicePixelRatio(size, 2)),
|
||||||
"BM with DPR 2 " + QString::number(size)),
|
"BM with DPR 2 " + QString::number(size)),
|
||||||
gridLayout, columnCount, row, col);
|
gridLayout, columnCount, row, col);
|
||||||
#endif // Qt 5
|
|
||||||
|
|
||||||
gridLayout->addWidget(m_screenInfoLabel, row + 1, 0, 1, columnCount);
|
gridLayout->addWidget(m_screenInfoLabel, row + 1, 0, 1, columnCount);
|
||||||
|
|
||||||
@ -351,10 +328,8 @@ int main(int argc, char *argv[])
|
|||||||
windows.append(window);
|
windows.append(window);
|
||||||
window->show();
|
window->show();
|
||||||
window->updateScreenInfo();
|
window->updateScreenInfo();
|
||||||
#if QT_VERSION > 0x050000
|
|
||||||
QObject::connect(window->windowHandle(), &QWindow::screenChanged,
|
QObject::connect(window->windowHandle(), &QWindow::screenChanged,
|
||||||
window.data(), &MainWindow::updateScreenInfo);
|
window.data(), &MainWindow::updateScreenInfo);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
return app.exec();
|
return app.exec();
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
**
|
**
|
||||||
** Copyright (C) 2020 The Qt Company Ltd.
|
** Copyright (C) 2021 The Qt Company Ltd.
|
||||||
** Contact: https://www.qt.io/licensing/
|
** Contact: https://www.qt.io/licensing/
|
||||||
**
|
**
|
||||||
** This file is part of the test suite of the Qt Toolkit.
|
** This file is part of the test suite of the Qt Toolkit.
|
||||||
@ -58,11 +58,7 @@ struct Statistics {
|
|||||||
QLabel *output;
|
QLabel *output;
|
||||||
void sleep()
|
void sleep()
|
||||||
{
|
{
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
QThread::msleep(sleepMsecs);
|
QThread::msleep(sleepMsecs);
|
||||||
#else
|
|
||||||
qWarning("%s unimplemented", Q_FUNC_INFO);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
int currentBenchmarkIteration;
|
int currentBenchmarkIteration;
|
||||||
bool relayoutClicked;
|
bool relayoutClicked;
|
||||||
|
@ -195,9 +195,7 @@ Window::Window()
|
|||||||
setSurfaceType(Direct3DSurface);
|
setSurfaceType(Direct3DSurface);
|
||||||
break;
|
break;
|
||||||
case Metal:
|
case Metal:
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0))
|
|
||||||
setSurfaceType(MetalSurface);
|
setSurfaceType(MetalSurface);
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
**
|
**
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
** Copyright (C) 2021 The Qt Company Ltd.
|
||||||
** Contact: https://www.qt.io/licensing/
|
** Contact: https://www.qt.io/licensing/
|
||||||
**
|
**
|
||||||
** This file is part of the test suite of the Qt Toolkit.
|
** This file is part of the test suite of the Qt Toolkit.
|
||||||
@ -224,13 +224,9 @@ bool MainWindow::eventFilter(QObject *o, QEvent *e)
|
|||||||
case QEvent::Enter: {
|
case QEvent::Enter: {
|
||||||
QString message;
|
QString message;
|
||||||
QDebug debug(&message);
|
QDebug debug(&message);
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
const QEnterEvent *ee = static_cast<QEnterEvent *>(e);
|
const QEnterEvent *ee = static_cast<QEnterEvent *>(e);
|
||||||
debug.nospace() << '#' << m_enterLeaveEventCount++ << " Enter for " << o->objectName()
|
debug.nospace() << '#' << m_enterLeaveEventCount++ << " Enter for " << o->objectName()
|
||||||
<< " at " << ee->localPos() << " global: " << ee->globalPos();
|
<< " at " << ee->localPos() << " global: " << ee->globalPos();
|
||||||
#else
|
|
||||||
debug.nospace() << '#' << m_enterLeaveEventCount++ << " Enter for " << o->objectName();
|
|
||||||
#endif
|
|
||||||
m_logEdit->appendPlainText(message);
|
m_logEdit->appendPlainText(message);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -357,11 +353,7 @@ void MainWindow::grabKeyboardWindowToggled(bool g)
|
|||||||
void MainWindow::forceNativeWidgets()
|
void MainWindow::forceNativeWidgets()
|
||||||
{
|
{
|
||||||
const WId platformWid = m_forceNativeButton->winId();
|
const WId platformWid = m_forceNativeButton->winId();
|
||||||
#if QT_VERSION < 0x050000 && defined(Q_OS_WIN)
|
|
||||||
const quintptr wid = quintptr(platformWid); // HWND on Qt 4.8/Windows.
|
|
||||||
#else
|
|
||||||
const WId wid = platformWid;
|
const WId wid = platformWid;
|
||||||
#endif
|
|
||||||
m_logEdit->appendPlainText(QString::fromLatin1("Created native widget %1").arg(wid));
|
m_logEdit->appendPlainText(QString::fromLatin1("Created native widget %1").arg(wid));
|
||||||
m_forceNativeButton->setEnabled(false);
|
m_forceNativeButton->setEnabled(false);
|
||||||
m_forceNativeButton->setText(QLatin1String("Native widgets created"));
|
m_forceNativeButton->setText(QLatin1String("Native widgets created"));
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
**
|
**
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
** Copyright (C) 2021 The Qt Company Ltd.
|
||||||
** Contact: https://www.qt.io/licensing/
|
** Contact: https://www.qt.io/licensing/
|
||||||
**
|
**
|
||||||
** This file is part of the test suite of the Qt Toolkit.
|
** This file is part of the test suite of the Qt Toolkit.
|
||||||
@ -267,8 +267,6 @@ void WidgetWindowControl::statesChanged()
|
|||||||
w->setWindowState(m_statesControl->states());
|
w->setWindowState(m_statesControl->states());
|
||||||
}
|
}
|
||||||
|
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
|
|
||||||
// Test window drawing diagonal lines
|
// Test window drawing diagonal lines
|
||||||
class Window : public QWindow
|
class Window : public QWindow
|
||||||
{
|
{
|
||||||
@ -453,8 +451,6 @@ void WindowControl::addChildWindow()
|
|||||||
control->show();
|
control->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
ControllerWidget::ControllerWidget(QWidget *parent)
|
ControllerWidget::ControllerWidget(QWidget *parent)
|
||||||
: QMainWindow(parent)
|
: QMainWindow(parent)
|
||||||
, m_testWindow(new Window)
|
, m_testWindow(new Window)
|
||||||
@ -475,12 +471,8 @@ ControllerWidget::ControllerWidget(QWidget *parent)
|
|||||||
int y = 100;
|
int y = 100;
|
||||||
const QStringList args = QApplication::arguments();
|
const QStringList args = QApplication::arguments();
|
||||||
const int offsetArgIndex = args.indexOf(QLatin1String("-offset"));
|
const int offsetArgIndex = args.indexOf(QLatin1String("-offset"));
|
||||||
if (offsetArgIndex >=0 && offsetArgIndex < args.size() - 1) {
|
if (offsetArgIndex >=0 && offsetArgIndex < args.size() - 1)
|
||||||
y += args.at(offsetArgIndex + 1).toInt();
|
y += args.at(offsetArgIndex + 1).toInt();
|
||||||
} else {
|
|
||||||
if (QT_VERSION < 0x050000)
|
|
||||||
y += 400;
|
|
||||||
}
|
|
||||||
|
|
||||||
move(x, y);
|
move(x, y);
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
**
|
**
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
** Copyright (C) 2021 The Qt Company Ltd.
|
||||||
** Contact: https://www.qt.io/licensing/
|
** Contact: https://www.qt.io/licensing/
|
||||||
**
|
**
|
||||||
** This file is part of the test suite of the Qt Toolkit.
|
** This file is part of the test suite of the Qt Toolkit.
|
||||||
@ -32,23 +32,19 @@
|
|||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
|
#include <QDebug>
|
||||||
#include <QGroupBox>
|
#include <QGroupBox>
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
|
#include <QLibraryInfo>
|
||||||
|
#include <qlogging.h>
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
|
#include <QMoveEvent>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QRadioButton>
|
#include <QRadioButton>
|
||||||
#include <QTabWidget>
|
#include <QTabWidget>
|
||||||
|
#include <QWindow>
|
||||||
#include <QMoveEvent>
|
|
||||||
|
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
# include <QWindow>
|
|
||||||
# include <qlogging.h>
|
|
||||||
# include <QLibraryInfo>
|
|
||||||
#endif
|
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
ControllerWidget::ControllerWidget(QWidget *parent)
|
ControllerWidget::ControllerWidget(QWidget *parent)
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
@ -224,10 +220,8 @@ static bool isTopLevel(const QObject *o)
|
|||||||
{
|
{
|
||||||
if (o->isWidgetType())
|
if (o->isWidgetType())
|
||||||
return static_cast<const QWidget *>(o)->isWindow();
|
return static_cast<const QWidget *>(o)->isWindow();
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
if (o->isWindowType())
|
if (o->isWindowType())
|
||||||
return static_cast<const QWindow *>(o)->isTopLevel();
|
return static_cast<const QWindow *>(o)->isTopLevel();
|
||||||
#endif
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -238,10 +232,8 @@ static Qt::WindowStates windowState(const QObject *o)
|
|||||||
states &= ~Qt::WindowActive;
|
states &= ~Qt::WindowActive;
|
||||||
return states;
|
return states;
|
||||||
}
|
}
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
if (o->isWindowType())
|
if (o->isWindowType())
|
||||||
return static_cast<const QWindow *>(o)->windowState();
|
return static_cast<const QWindow *>(o)->windowState();
|
||||||
#endif
|
|
||||||
return Qt::WindowNoState;
|
return Qt::WindowNoState;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -257,9 +249,7 @@ public:
|
|||||||
case QEvent::WindowStateChange:
|
case QEvent::WindowStateChange:
|
||||||
case QEvent::ApplicationActivate:
|
case QEvent::ApplicationActivate:
|
||||||
case QEvent::ApplicationDeactivate:
|
case QEvent::ApplicationDeactivate:
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
case QEvent::ApplicationStateChange:
|
case QEvent::ApplicationStateChange:
|
||||||
#endif
|
|
||||||
if (isTopLevel(o))
|
if (isTopLevel(o))
|
||||||
formatEvent(o, e);
|
formatEvent(o, e);
|
||||||
break;
|
break;
|
||||||
@ -274,9 +264,7 @@ private:
|
|||||||
{
|
{
|
||||||
static int n = 0;
|
static int n = 0;
|
||||||
QDebug debug = qDebug().nospace();
|
QDebug debug = qDebug().nospace();
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
debug.noquote();
|
debug.noquote();
|
||||||
#endif
|
|
||||||
debug << '#' << n++ << ' ' << o->metaObject()->className();
|
debug << '#' << n++ << ' ' << o->metaObject()->className();
|
||||||
const QString name = o->objectName();
|
const QString name = o->objectName();
|
||||||
if (!name.isEmpty())
|
if (!name.isEmpty())
|
||||||
@ -320,15 +308,9 @@ void LogWidget::install()
|
|||||||
QString LogWidget::startupMessage()
|
QString LogWidget::startupMessage()
|
||||||
{
|
{
|
||||||
QString result;
|
QString result;
|
||||||
#if QT_VERSION >= 0x050300
|
|
||||||
result += QLatin1String(QLibraryInfo::build());
|
result += QLatin1String(QLibraryInfo::build());
|
||||||
#else
|
|
||||||
result += QLatin1String("Qt ") + QLatin1String(QT_VERSION_STR);
|
|
||||||
#endif
|
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
result += QLatin1Char(' ');
|
result += QLatin1Char(' ');
|
||||||
result += QGuiApplication::platformName();
|
result += QGuiApplication::platformName();
|
||||||
#endif
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -342,11 +324,7 @@ ControllerWindow::ControllerWindow()
|
|||||||
{
|
{
|
||||||
setWindowTitle(tr("Window Flags (Qt version %1, %2)")
|
setWindowTitle(tr("Window Flags (Qt version %1, %2)")
|
||||||
.arg(QLatin1String(qVersion()),
|
.arg(QLatin1String(qVersion()),
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
qApp->platformName()));
|
qApp->platformName()));
|
||||||
#else
|
|
||||||
QLatin1String("<unknown>")));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
QVBoxLayout *layout = new QVBoxLayout(this);
|
QVBoxLayout *layout = new QVBoxLayout(this);
|
||||||
QTabWidget *tabWidget = new QTabWidget(this);
|
QTabWidget *tabWidget = new QTabWidget(this);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
**
|
**
|
||||||
** Copyright (C) 2020 The Qt Company Ltd.
|
** Copyright (C) 2021 The Qt Company Ltd.
|
||||||
** Contact: https://www.qt.io/licensing/
|
** Contact: https://www.qt.io/licensing/
|
||||||
**
|
**
|
||||||
** This file is part of the test suite of the Qt Toolkit.
|
** This file is part of the test suite of the Qt Toolkit.
|
||||||
@ -89,9 +89,6 @@ HintControl::HintControl(QWidget *parent)
|
|||||||
layout->addWidget(windowStaysOnBottomCheckBox, 7, 1);
|
layout->addWidget(windowStaysOnBottomCheckBox, 7, 1);
|
||||||
layout->addWidget(customizeWindowHintCheckBox, 5, 0);
|
layout->addWidget(customizeWindowHintCheckBox, 5, 0);
|
||||||
layout->addWidget(transparentForInputCheckBox, 6, 0);
|
layout->addWidget(transparentForInputCheckBox, 6, 0);
|
||||||
#if QT_VERSION < 0x050000
|
|
||||||
transparentForInputCheckBox->setEnabled(false);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Qt::WindowFlags HintControl::hints() const
|
Qt::WindowFlags HintControl::hints() const
|
||||||
@ -111,10 +108,8 @@ Qt::WindowFlags HintControl::hints() const
|
|||||||
flags |= Qt::WindowMinimizeButtonHint;
|
flags |= Qt::WindowMinimizeButtonHint;
|
||||||
if (windowMaximizeButtonCheckBox->isChecked())
|
if (windowMaximizeButtonCheckBox->isChecked())
|
||||||
flags |= Qt::WindowMaximizeButtonHint;
|
flags |= Qt::WindowMaximizeButtonHint;
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
if (windowFullscreenButtonCheckBox->isChecked())
|
if (windowFullscreenButtonCheckBox->isChecked())
|
||||||
flags |= Qt::WindowFullscreenButtonHint;
|
flags |= Qt::WindowFullscreenButtonHint;
|
||||||
#endif
|
|
||||||
if (windowCloseButtonCheckBox->isChecked())
|
if (windowCloseButtonCheckBox->isChecked())
|
||||||
flags |= Qt::WindowCloseButtonHint;
|
flags |= Qt::WindowCloseButtonHint;
|
||||||
if (windowContextHelpButtonCheckBox->isChecked())
|
if (windowContextHelpButtonCheckBox->isChecked())
|
||||||
@ -127,10 +122,8 @@ Qt::WindowFlags HintControl::hints() const
|
|||||||
flags |= Qt::WindowStaysOnBottomHint;
|
flags |= Qt::WindowStaysOnBottomHint;
|
||||||
if (customizeWindowHintCheckBox->isChecked())
|
if (customizeWindowHintCheckBox->isChecked())
|
||||||
flags |= Qt::CustomizeWindowHint;
|
flags |= Qt::CustomizeWindowHint;
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
if (transparentForInputCheckBox->isChecked())
|
if (transparentForInputCheckBox->isChecked())
|
||||||
flags |= Qt::WindowTransparentForInput;
|
flags |= Qt::WindowTransparentForInput;
|
||||||
#endif
|
|
||||||
return flags;
|
return flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -143,18 +136,14 @@ void HintControl::setHints(Qt::WindowFlags flags)
|
|||||||
windowSystemMenuCheckBox->setChecked(flags & Qt::WindowSystemMenuHint);
|
windowSystemMenuCheckBox->setChecked(flags & Qt::WindowSystemMenuHint);
|
||||||
windowMinimizeButtonCheckBox->setChecked(flags & Qt::WindowMinimizeButtonHint);
|
windowMinimizeButtonCheckBox->setChecked(flags & Qt::WindowMinimizeButtonHint);
|
||||||
windowMaximizeButtonCheckBox->setChecked(flags & Qt::WindowMaximizeButtonHint);
|
windowMaximizeButtonCheckBox->setChecked(flags & Qt::WindowMaximizeButtonHint);
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
windowFullscreenButtonCheckBox->setChecked(flags & Qt::WindowFullscreenButtonHint);
|
windowFullscreenButtonCheckBox->setChecked(flags & Qt::WindowFullscreenButtonHint);
|
||||||
#endif
|
|
||||||
windowCloseButtonCheckBox->setChecked(flags & Qt::WindowCloseButtonHint);
|
windowCloseButtonCheckBox->setChecked(flags & Qt::WindowCloseButtonHint);
|
||||||
windowContextHelpButtonCheckBox->setChecked(flags & Qt::WindowContextHelpButtonHint);
|
windowContextHelpButtonCheckBox->setChecked(flags & Qt::WindowContextHelpButtonHint);
|
||||||
windowShadeButtonCheckBox->setChecked(flags & Qt::WindowShadeButtonHint);
|
windowShadeButtonCheckBox->setChecked(flags & Qt::WindowShadeButtonHint);
|
||||||
windowStaysOnTopCheckBox->setChecked(flags & Qt::WindowStaysOnTopHint);
|
windowStaysOnTopCheckBox->setChecked(flags & Qt::WindowStaysOnTopHint);
|
||||||
windowStaysOnBottomCheckBox->setChecked(flags & Qt::WindowStaysOnBottomHint);
|
windowStaysOnBottomCheckBox->setChecked(flags & Qt::WindowStaysOnBottomHint);
|
||||||
customizeWindowHintCheckBox->setChecked(flags & Qt::CustomizeWindowHint);
|
customizeWindowHintCheckBox->setChecked(flags & Qt::CustomizeWindowHint);
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
transparentForInputCheckBox->setChecked(flags & Qt::WindowTransparentForInput);
|
transparentForInputCheckBox->setChecked(flags & Qt::WindowTransparentForInput);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void HintControl::slotCheckBoxChanged()
|
void HintControl::slotCheckBoxChanged()
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
**
|
**
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
** Copyright (C) 2021 The Qt Company Ltd.
|
||||||
** Contact: https://www.qt.io/licensing/
|
** Contact: https://www.qt.io/licensing/
|
||||||
**
|
**
|
||||||
** This file is part of the test suite of the Qt Toolkit.
|
** This file is part of the test suite of the Qt Toolkit.
|
||||||
@ -79,13 +79,8 @@ static void formatWindowFlags(QTextStream &str, Qt::WindowFlags flags)
|
|||||||
|
|
||||||
if (flags & Qt::MSWindowsFixedSizeDialogHint)
|
if (flags & Qt::MSWindowsFixedSizeDialogHint)
|
||||||
str << "\n| Qt::MSWindowsFixedSizeDialogHint";
|
str << "\n| Qt::MSWindowsFixedSizeDialogHint";
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
if (flags & Qt::BypassWindowManagerHint)
|
if (flags & Qt::BypassWindowManagerHint)
|
||||||
str << "\n| Qt::BypassWindowManagerHint";
|
str << "\n| Qt::BypassWindowManagerHint";
|
||||||
#else
|
|
||||||
if (flags & Qt::X11BypassWindowManagerHint)
|
|
||||||
str << "\n| Qt::X11BypassWindowManagerHint";
|
|
||||||
#endif
|
|
||||||
if (flags & Qt::FramelessWindowHint)
|
if (flags & Qt::FramelessWindowHint)
|
||||||
str << "\n| Qt::FramelessWindowHint";
|
str << "\n| Qt::FramelessWindowHint";
|
||||||
if (flags & Qt::WindowTitleHint)
|
if (flags & Qt::WindowTitleHint)
|
||||||
@ -108,7 +103,6 @@ static void formatWindowFlags(QTextStream &str, Qt::WindowFlags flags)
|
|||||||
str << "\n| Qt::CustomizeWindowHint";
|
str << "\n| Qt::CustomizeWindowHint";
|
||||||
if (flags & Qt::WindowStaysOnBottomHint)
|
if (flags & Qt::WindowStaysOnBottomHint)
|
||||||
str << "\n| Qt::WindowStaysOnBottomHint";
|
str << "\n| Qt::WindowStaysOnBottomHint";
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
if (flags & Qt::WindowFullscreenButtonHint)
|
if (flags & Qt::WindowFullscreenButtonHint)
|
||||||
str << "\n| Qt::WindowFullscreenButtonHint";
|
str << "\n| Qt::WindowFullscreenButtonHint";
|
||||||
if (flags & Qt::WindowTransparentForInput)
|
if (flags & Qt::WindowTransparentForInput)
|
||||||
@ -121,7 +115,6 @@ static void formatWindowFlags(QTextStream &str, Qt::WindowFlags flags)
|
|||||||
str << "\n| Qt::MaximizeUsingFullscreenGeometryHint";
|
str << "\n| Qt::MaximizeUsingFullscreenGeometryHint";
|
||||||
if (flags & Qt::NoDropShadowWindowHint)
|
if (flags & Qt::NoDropShadowWindowHint)
|
||||||
str << "\n| Qt::NoDropShadowWindowHint";
|
str << "\n| Qt::NoDropShadowWindowHint";
|
||||||
#endif // Qt 5
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void formatWindowStates(QTextStream &str, Qt::WindowStates states)
|
static void formatWindowStates(QTextStream &str, Qt::WindowStates states)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
**
|
**
|
||||||
** Copyright (C) 2020 The Qt Company Ltd.
|
** Copyright (C) 2021 The Qt Company Ltd.
|
||||||
** Contact: https://www.qt.io/licensing/
|
** Contact: https://www.qt.io/licensing/
|
||||||
**
|
**
|
||||||
** This file is part of the test suite of the Qt Toolkit.
|
** This file is part of the test suite of the Qt Toolkit.
|
||||||
@ -29,17 +29,13 @@
|
|||||||
#include "controllerwidget.h"
|
#include "controllerwidget.h"
|
||||||
#include <controls.h>
|
#include <controls.h>
|
||||||
|
|
||||||
#if QT_VERSION >= 0x050000
|
#include <QtWidgets>
|
||||||
# include <QtWidgets>
|
|
||||||
# include <QWindow>
|
|
||||||
# include <QBackingStore>
|
|
||||||
# include <QPaintDevice>
|
|
||||||
# include <QPainter>
|
|
||||||
#else
|
|
||||||
# include <QtGui>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
#include <QBackingStore>
|
||||||
|
#include <QPaintDevice>
|
||||||
|
#include <QPainter>
|
||||||
#include <QResizeEvent>
|
#include <QResizeEvent>
|
||||||
|
#include <QWindow>
|
||||||
|
|
||||||
CoordinateControl::CoordinateControl(const QString &sep) : m_x(new QSpinBox), m_y(new QSpinBox)
|
CoordinateControl::CoordinateControl(const QString &sep) : m_x(new QSpinBox), m_y(new QSpinBox)
|
||||||
{
|
{
|
||||||
@ -291,8 +287,6 @@ void WidgetWindowControl::statesChanged()
|
|||||||
w->setWindowState(m_statesControl->states());
|
w->setWindowState(m_statesControl->states());
|
||||||
}
|
}
|
||||||
|
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
|
|
||||||
// Test window drawing diagonal lines
|
// Test window drawing diagonal lines
|
||||||
class Window : public QWindow
|
class Window : public QWindow
|
||||||
{
|
{
|
||||||
@ -388,14 +382,10 @@ void WindowControl::stateChanged()
|
|||||||
w->setWindowStates(m_statesControl->states());
|
w->setWindowStates(m_statesControl->states());
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
ControllerWidget::ControllerWidget(QWidget *parent)
|
ControllerWidget::ControllerWidget(QWidget *parent)
|
||||||
: QMainWindow(parent)
|
: QMainWindow(parent)
|
||||||
, m_testWidget(new QWidget)
|
, m_testWidget(new QWidget)
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
, m_testWindow(new Window)
|
, m_testWindow(new Window)
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
QMenu *fileMenu = menuBar()->addMenu(tr("File"));
|
QMenu *fileMenu = menuBar()->addMenu(tr("File"));
|
||||||
QAction *exitAction = fileMenu->addAction(tr("Exit"));
|
QAction *exitAction = fileMenu->addAction(tr("Exit"));
|
||||||
@ -404,10 +394,8 @@ ControllerWidget::ControllerWidget(QWidget *parent)
|
|||||||
|
|
||||||
QString title = QLatin1String("Geometry test, (Qt ");
|
QString title = QLatin1String("Geometry test, (Qt ");
|
||||||
title += QLatin1String(QT_VERSION_STR);
|
title += QLatin1String(QT_VERSION_STR);
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
title += QLatin1String(", ");
|
title += QLatin1String(", ");
|
||||||
title += qApp->platformName();
|
title += qApp->platformName();
|
||||||
#endif
|
|
||||||
title += QLatin1Char(')');
|
title += QLatin1Char(')');
|
||||||
setWindowTitle(title);
|
setWindowTitle(title);
|
||||||
|
|
||||||
@ -417,9 +405,6 @@ ControllerWidget::ControllerWidget(QWidget *parent)
|
|||||||
const int offsetArgIndex = args.indexOf(QLatin1String("-offset"));
|
const int offsetArgIndex = args.indexOf(QLatin1String("-offset"));
|
||||||
if (offsetArgIndex >=0 && offsetArgIndex < args.size() - 1) {
|
if (offsetArgIndex >=0 && offsetArgIndex < args.size() - 1) {
|
||||||
y += args.at(offsetArgIndex + 1).toInt();
|
y += args.at(offsetArgIndex + 1).toInt();
|
||||||
} else {
|
|
||||||
if (QT_VERSION < 0x050000)
|
|
||||||
y += 400;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
move(x, y);
|
move(x, y);
|
||||||
@ -443,7 +428,6 @@ ControllerWidget::ControllerWidget(QWidget *parent)
|
|||||||
else
|
else
|
||||||
m_testWidget->show();
|
m_testWidget->show();
|
||||||
|
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
x += 300;
|
x += 300;
|
||||||
m_testWindow->setFlags(Qt::Window | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint
|
m_testWindow->setFlags(Qt::Window | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint
|
||||||
| Qt::WindowMinimizeButtonHint | Qt::WindowMaximizeButtonHint
|
| Qt::WindowMinimizeButtonHint | Qt::WindowMaximizeButtonHint
|
||||||
@ -459,7 +443,6 @@ ControllerWidget::ControllerWidget(QWidget *parent)
|
|||||||
else
|
else
|
||||||
m_testWindow->show();
|
m_testWindow->show();
|
||||||
m_testWindow->setTitle(tr("TestWindow"));
|
m_testWindow->setTitle(tr("TestWindow"));
|
||||||
#endif
|
|
||||||
|
|
||||||
QWidget *central = new QWidget ;
|
QWidget *central = new QWidget ;
|
||||||
QVBoxLayout *l = new QVBoxLayout(central);
|
QVBoxLayout *l = new QVBoxLayout(central);
|
||||||
@ -478,11 +461,9 @@ ControllerWidget::ControllerWidget(QWidget *parent)
|
|||||||
widgetControl->refresh();
|
widgetControl->refresh();
|
||||||
l->addWidget(widgetControl);
|
l->addWidget(widgetControl);
|
||||||
|
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
BaseWindowControl *windowControl = new WindowControl(m_testWindow.data());
|
BaseWindowControl *windowControl = new WindowControl(m_testWindow.data());
|
||||||
windowControl->refresh();
|
windowControl->refresh();
|
||||||
l->addWidget(windowControl);
|
l->addWidget(windowControl);
|
||||||
#endif
|
|
||||||
|
|
||||||
setCentralWidget(central);
|
setCentralWidget(central);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
**
|
**
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
** Copyright (C) 2021 The Qt Company Ltd.
|
||||||
** Contact: https://www.qt.io/licensing/
|
** Contact: https://www.qt.io/licensing/
|
||||||
**
|
**
|
||||||
** This file is part of the test suite of the Qt Toolkit.
|
** This file is part of the test suite of the Qt Toolkit.
|
||||||
@ -147,9 +147,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
QScopedPointer<QWidget> m_testWidget;
|
QScopedPointer<QWidget> m_testWidget;
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
QScopedPointer<QWindow> m_testWindow;
|
QScopedPointer<QWindow> m_testWindow;
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CONTROLLERWIDGET_H
|
#endif // CONTROLLERWIDGET_H
|
||||||
|
Loading…
x
Reference in New Issue
Block a user