Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-21 10:12:23

0001 // Copyright (C) 2016 The Qt Company Ltd.
0002 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
0003 
0004 #ifndef QTEST_WIDGETS_H
0005 #define QTEST_WIDGETS_H
0006 
0007 // enable WIDGETS features
0008 #ifndef QT_WIDGETS_LIB
0009 #define QT_WIDGETS_LIB
0010 #endif
0011 #if 0
0012 #pragma qt_class(QtTestWidgets)
0013 #endif
0014 
0015 #include <QtTest/qtest_gui.h>
0016 
0017 #if 0
0018 // inform syncqt
0019 #pragma qt_no_master_include
0020 #endif
0021 
0022 #include <QtWidgets/QSizePolicy>
0023 #include <QtCore/QMetaEnum>
0024 
0025 QT_BEGIN_NAMESPACE
0026 
0027 namespace QTest
0028 {
0029 
0030 //
0031 // QSizePolicy & friends:
0032 //
0033 
0034 namespace Internal
0035 {
0036 
0037 inline const char *toString(QSizePolicy::Policy p)
0038 {
0039     static const QMetaEnum me = QSizePolicy::staticMetaObject.enumerator(QSizePolicy::staticMetaObject.indexOfEnumerator("Policy"));
0040     return me.valueToKey(int(p));
0041 }
0042 
0043 inline QByteArray toString(QSizePolicy::ControlTypes ct)
0044 {
0045     static const QMetaEnum me = QSizePolicy::staticMetaObject.enumerator(QSizePolicy::staticMetaObject.indexOfEnumerator("ControlTypes"));
0046     return me.valueToKeys(int(ct.toInt()));
0047 }
0048 
0049 inline QByteArray toString(QSizePolicy sp)
0050 {
0051     static const char comma[] = ", ";
0052     return QByteArray("QSizePolicy(")
0053             + Internal::toString(sp.horizontalPolicy()) + comma
0054             + Internal::toString(sp.verticalPolicy()) + comma
0055             + QByteArray::number(sp.horizontalStretch()) + comma
0056             + QByteArray::number(sp.verticalStretch()) + comma
0057             + Internal::toString(QSizePolicy::ControlTypes(sp.controlType())) + comma
0058             + "height for width: " + (sp.hasHeightForWidth() ? "yes" : "no") + comma
0059             + "width for height: " + (sp.hasWidthForHeight() ? "yes" : "no") + comma
0060             + (sp.retainSizeWhenHidden() ? "" : "don't " ) + "retain size when hidden"
0061             + ')';
0062 }
0063 
0064 } // namespace Internal
0065 
0066 inline char *toString(QSizePolicy::Policy p)
0067 {
0068     return qstrdup(Internal::toString(p));
0069 }
0070 
0071 inline char *toString(QSizePolicy::ControlTypes ct)
0072 {
0073     return qstrdup(Internal::toString(ct).constData());
0074 }
0075 
0076 inline char *toString(QSizePolicy::ControlType ct)
0077 {
0078     return toString(QSizePolicy::ControlTypes(ct));
0079 }
0080 
0081 inline char *toString(QSizePolicy sp)
0082 {
0083     return qstrdup(Internal::toString(sp).constData());
0084 }
0085 
0086 } // namespace QTest
0087 
0088 QT_END_NAMESPACE
0089 
0090 #endif
0091