Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
buttonwidget.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3
4#include "buttonwidget.h"
5
6#include <QtWidgets>
7
11{
12 signalMapper = new QSignalMapper(this);
13
15 for (int i = 0; i < texts.size(); ++i) {
16 QPushButton *button = new QPushButton(texts[i]);
19 signalMapper->setMapping(button, texts[i]);
20 gridLayout->addWidget(button, i / 3, i % 3);
21 }
22
26}
28
32{
34 for (int i = 0; i < texts.size(); ++i) {
35 QString text = texts[i];
38 gridLayout->addWidget(button, i / 3, i % 3);
39 }
40}
ButtonWidget(const QStringList &texts, QWidget *parent=nullptr)
[0]
void clicked(const QString &text)
void clicked(bool checked=false)
This signal is emitted when the button is activated (i.e., pressed down then released while the mouse...
The QGridLayout class lays out widgets in a grid.
Definition qgridlayout.h:21
void addWidget(QWidget *w)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition qgridlayout.h:64
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
Definition qobject.cpp:2823
The QPushButton widget provides a command button.
Definition qpushbutton.h:20
\inmodule QtCore
void mappedString(const QString &)
void map()
This slot emits signals based on which object sends signals to it.
void setMapping(QObject *sender, int id)
Adds a mapping so that when map() is signalled from the given sender, the signal mappedInt(id) is emi...
\inmodule QtCore
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:127
The QWidget class is the base class of all user interface objects.
Definition qwidget.h:99
QString text
QPushButton * button
[2]
QGridLayout * gridLayout
[0]
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent