mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-10 08:14:47 -07:00
* move message_log_widget to game * move files * update headers * fix cmakelists * oracle fixes * split implementation out to cpp * fix recursive import * fix main file * format
This commit is contained in:
parent
f484c98152
commit
17dcaf9afa
337 changed files with 728 additions and 721 deletions
|
|
@ -0,0 +1,39 @@
|
|||
#include "labeled_input.h"
|
||||
|
||||
LabeledInput::LabeledInput(QWidget *parent, const QString &labelText) : QWidget(parent)
|
||||
{
|
||||
label = new QLabel(labelText, this);
|
||||
layout = new QHBoxLayout(this);
|
||||
layout->addWidget(label);
|
||||
}
|
||||
|
||||
QSpinBox *LabeledInput::addSpinBox(const int minValue, const int maxValue, const int defaultValue)
|
||||
{
|
||||
auto *spinBox = new QSpinBox(this);
|
||||
spinBox->setRange(minValue, maxValue);
|
||||
spinBox->setValue(defaultValue);
|
||||
layout->addWidget(spinBox);
|
||||
connect(spinBox, SIGNAL(valueChanged(int)), this, SIGNAL(spinBoxValueChanged(int)));
|
||||
return spinBox;
|
||||
}
|
||||
|
||||
// Add a QComboBox (for arbitrary selections)
|
||||
QComboBox *LabeledInput::addComboBox(const QStringList &items, const QString &defaultItem)
|
||||
{
|
||||
auto *comboBox = new QComboBox(this);
|
||||
comboBox->addItems(items);
|
||||
if (!defaultItem.isEmpty()) {
|
||||
comboBox->setCurrentText(defaultItem);
|
||||
}
|
||||
layout->addWidget(comboBox);
|
||||
return comboBox;
|
||||
}
|
||||
|
||||
// Add a QComboBox specifically for Qt Directions
|
||||
QComboBox *LabeledInput::addDirectionComboBox()
|
||||
{
|
||||
const QStringList directions = {"Qt::Horizontal", "Qt::Vertical"};
|
||||
const auto comboBox = addComboBox(directions, "Qt::Vertical");
|
||||
connect(comboBox, SIGNAL(currentTextChanged(QString)), this, SIGNAL(directionComboBoxChanged(QString)));
|
||||
return comboBox;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue