Adding Select Box To Form

This commit is contained in:
Phoenix Osiris 2013-07-17 16:52:00 -04:00
parent 92ff503832
commit 4f61da62e8
2 changed files with 20 additions and 4 deletions

View file

@ -1,6 +1,7 @@
#include <QLineEdit>
#include <QLabel>
#include <QCheckBox>
#include <QComboBox>
#include <QGridLayout>
#include <QVBoxLayout>
#include <QHBoxLayout>
@ -18,6 +19,16 @@ DlgCardSearch::DlgCardSearch(QWidget *parent)
QLabel *cardTextLabel = new QLabel(tr("Card text:"));
cardTextEdit = new QLineEdit;
//Adding Set Selector
QLabel *cardSetsLabel = new QLabel(tr("Card Set (AND):"));
cboSetList = new QComboBox();
cboSetList->addItem("");
SetList setList = db->getSetList();
for (int intLoop = 0; intLoop < setList.size(); ++intLoop) {
//Adding Translated Set Name, Just In Case
cboSetList->addItem(tr("%1").arg(setList.at(intLoop)->getLongName()), setList.at(intLoop)->getShortName());
}
QLabel *cardTypesLabel = new QLabel(tr("Card type (OR):"));
const QStringList &cardTypes = db->getAllMainCardTypes();
QVBoxLayout *cardTypesLayout = new QVBoxLayout;
@ -54,10 +65,12 @@ DlgCardSearch::DlgCardSearch(QWidget *parent)
optionsLayout->addWidget(cardNameEdit, 0, 1);
optionsLayout->addWidget(cardTextLabel, 1, 0);
optionsLayout->addWidget(cardTextEdit, 1, 1);
optionsLayout->addWidget(cardTypesLabel, 2, 0);
optionsLayout->addLayout(cardTypesLayout, 2, 1);
optionsLayout->addWidget(cardColorsLabel, 3, 0);
optionsLayout->addLayout(cardColorsLayout, 3, 1);
optionsLayout->addWidget(cardSetsLabel, 2, 0);
optionsLayout->addWidget(cboSetList, 2, 1);
optionsLayout->addWidget(cardTypesLabel, 3, 0);
optionsLayout->addLayout(cardTypesLayout, 3, 1);
optionsLayout->addWidget(cardColorsLabel, 4, 0);
optionsLayout->addLayout(cardColorsLayout, 4, 1);
QVBoxLayout *mainLayout = new QVBoxLayout;
mainLayout->addLayout(optionsLayout);

View file

@ -7,16 +7,19 @@
class QLineEdit;
class QCheckBox;
class QComboBox;
class DlgCardSearch : public QDialog {
Q_OBJECT
private:
QLineEdit *cardNameEdit, *cardTextEdit;
QList<QCheckBox *> cardTypeCheckBoxes, cardColorCheckBoxes;
QComboBox *cboSetList;
public:
DlgCardSearch(QWidget *parent = 0);
QString getCardName() const;
QString getCardText() const;
QString getCardSet() const;
QSet<QString> getCardTypes() const;
QSet<QString> getCardColors() const;
};