Cockatrice 2026-10-19-Development-3.1.2-beta.2
A virtual tabletop for multiplayer card games
Loading...
Searching...
No Matches
labeled_input.h
Go to the documentation of this file.
1
6
7#ifndef LABELED_INPUT_H
8#define LABELED_INPUT_H
9
10#include <QString>
11#include <QStringList>
12#include <QWidget>
13#include <qtmetamacros.h>
14
15class QComboBox;
16class QHBoxLayout;
17class QLabel;
18class QSpinBox;
19
20class LabeledInput final : public QWidget
21{
22 Q_OBJECT
23
24public:
25 explicit LabeledInput(QWidget *parent, const QString &labelText);
26
27 // Add a QSpinBox (for arbitrary numbers)
28 QSpinBox *addSpinBox(int minValue, int maxValue, int defaultValue = 0);
29
30 // Add a QComboBox (for arbitrary selections)
31 QComboBox *addComboBox(const QStringList &items, const QString &defaultItem = QString());
32
33 // Add a QComboBox specifically for Qt Directions
34 QComboBox *addDirectionComboBox();
35
36signals:
37 void spinBoxValueChanged(int newValue); // Declare the valueChanged signal
38 void comboBoxValueChanged(int newValue);
39 void directionComboBoxChanged(QString newDirection);
40
41private:
42 QLabel *label;
43 QHBoxLayout *layout;
44};
45
46#endif // LABELED_INPUT_H
LabeledInput(QWidget *parent, const QString &labelText)
Definition labeled_input.cpp:10
QHBoxLayout * layout
Definition labeled_input.h:43
QLabel * label
Definition labeled_input.h:42
QSpinBox * addSpinBox(int minValue, int maxValue, int defaultValue=0)
Definition labeled_input.cpp:17
void comboBoxValueChanged(int newValue)
QComboBox * addDirectionComboBox()
Definition labeled_input.cpp:40
void spinBoxValueChanged(int newValue)
QComboBox * addComboBox(const QStringList &items, const QString &defaultItem=QString())
Definition labeled_input.cpp:28
void directionComboBoxChanged(QString newDirection)