summaryrefslogtreecommitdiffstats
path: root/tests/manual/dialogs/utils.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/manual/dialogs/utils.cpp')
-rw-r--r--tests/manual/dialogs/utils.cpp41
1 files changed, 40 insertions, 1 deletions
diff --git a/tests/manual/dialogs/utils.cpp b/tests/manual/dialogs/utils.cpp
index 871940cf2a..bfb61cd8df 100644
--- a/tests/manual/dialogs/utils.cpp
+++ b/tests/manual/dialogs/utils.cpp
@@ -1,9 +1,13 @@
// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#undef QT_NO_FOREACH // this file contains unported legacy Q_FOREACH uses
#include "utils.h"
#include <QCheckBox>
+#include <QGridLayout>
+#include <QPushButton>
#include <QVBoxLayout>
QComboBox *createCombo(QWidget *parent, const FlagData *d, size_t size)
@@ -66,3 +70,38 @@ int OptionsControl::intValue() const
}
return result;
}
+
+QPushButton *addButton(const QString &description, QGridLayout *layout, int &row, int column,
+ QObject *receiver, const char *slotFunc)
+{
+ QPushButton *button = new QPushButton(description);
+ QObject::connect(button, SIGNAL(clicked()), receiver, slotFunc);
+ layout->addWidget(button, row++, column);
+ return button;
+}
+
+QPushButton *addButton(const QString &description, QGridLayout *layout, int &row, int column,
+ std::function<void()> fn)
+{
+ QPushButton *button = new QPushButton(description);
+ QObject::connect(button, &QPushButton::clicked, fn);
+ layout->addWidget(button, row++, column);
+ return button;
+}
+
+QPushButton *addButton(const QString &description, QVBoxLayout *layout, QObject *receiver,
+ const char *slotFunc)
+{
+ QPushButton *button = new QPushButton(description);
+ QObject::connect(button, SIGNAL(clicked()), receiver, slotFunc);
+ layout->addWidget(button);
+ return button;
+}
+
+QPushButton *addButton(const QString &description, QVBoxLayout *layout, std::function<void()> fn)
+{
+ QPushButton *button = new QPushButton(description);
+ QObject::connect(button, &QPushButton::clicked, fn);
+ layout->addWidget(button);
+ return button;
+}