Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qtest_widgets.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QTEST_WIDGETS_H
5#define QTEST_WIDGETS_H
6
7// enable WIDGETS features
8#ifndef QT_WIDGETS_LIB
9#define QT_WIDGETS_LIB
10#endif
11#if 0
12#pragma qt_class(QtTestWidgets)
13#endif
14
15#include <QtTest/qtest_gui.h>
16
17#if 0
18// inform syncqt
19#pragma qt_no_master_include
20#endif
21
22#include <QtWidgets/QSizePolicy>
23#include <QtCore/QMetaEnum>
24
26
27namespace QTest
28{
29
30//
31// QSizePolicy & friends:
32//
33
34namespace Internal
35{
36
37inline const char *toString(QSizePolicy::Policy p)
38{
39 static const QMetaEnum me = QSizePolicy::staticMetaObject.enumerator(QSizePolicy::staticMetaObject.indexOfEnumerator("Policy"));
40 return me.valueToKey(int(p));
41}
42
43inline QByteArray toString(QSizePolicy::ControlTypes ct)
44{
45 static const QMetaEnum me = QSizePolicy::staticMetaObject.enumerator(QSizePolicy::staticMetaObject.indexOfEnumerator("ControlTypes"));
46 return me.valueToKeys(int(ct.toInt()));
47}
48
50{
51 static const char comma[] = ", ";
52 return QByteArray("QSizePolicy(")
53 + Internal::toString(sp.horizontalPolicy()) + comma
54 + Internal::toString(sp.verticalPolicy()) + comma
55 + QByteArray::number(sp.horizontalStretch()) + comma
56 + QByteArray::number(sp.verticalStretch()) + comma
57 + Internal::toString(QSizePolicy::ControlTypes(sp.controlType())) + comma
58 + "height for width: " + (sp.hasHeightForWidth() ? "yes" : "no") + comma
59 + "width for height: " + (sp.hasWidthForHeight() ? "yes" : "no") + comma
60 + (sp.retainSizeWhenHidden() ? "" : "don't " ) + "retain size when hidden"
61 + ')';
62}
63
64} // namespace Internal
65} // namespace QTest
66
71
72inline char *toString(QSizePolicy::ControlTypes ct)
73{
74 return qstrdup(QTest::Internal::toString(ct).constData());
75}
76
78{
79 return toString(QSizePolicy::ControlTypes(ct));
80}
81
82inline char *toString(QSizePolicy sp)
83{
84 return qstrdup(QTest::Internal::toString(sp).constData());
85}
86
88
89#endif
90
\inmodule QtCore
Definition qbytearray.h:57
static QByteArray number(int, int base=10)
Returns a byte-array representing the whole number n as text.
\inmodule QtCore
const char * valueToKey(int value) const
Returns the string that is used as the name of the given enumeration value, or \nullptr if value is n...
QByteArray valueToKeys(int value) const
Returns a byte array of '|'-separated keys that represents the given value.
The QSizePolicy class is a layout attribute describing horizontal and vertical resizing policy.
Definition qsizepolicy.h:18
Policy
This enum describes the various per-dimension sizing types used when constructing a QSizePolicy.
Definition qsizepolicy.h:29
Combined button and popup list for selecting options.
const char * toString(QSizePolicy::Policy p)
Q_CORE_EXPORT char * qstrdup(const char *)
typedef QByteArray(EGLAPIENTRYP PFNQGSGETDISPLAYSPROC)()
GLfloat GLfloat p
[1]
#define sp
char * toString(QSizePolicy::Policy p)