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 <QLineEdit>
#include <QLabel> #include <QLabel>
#include <QCheckBox> #include <QCheckBox>
#include <QComboBox>
#include <QGridLayout> #include <QGridLayout>
#include <QVBoxLayout> #include <QVBoxLayout>
#include <QHBoxLayout> #include <QHBoxLayout>
@ -17,6 +18,16 @@ DlgCardSearch::DlgCardSearch(QWidget *parent)
QLabel *cardTextLabel = new QLabel(tr("Card text:")); QLabel *cardTextLabel = new QLabel(tr("Card text:"));
cardTextEdit = new QLineEdit; 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):")); QLabel *cardTypesLabel = new QLabel(tr("Card type (OR):"));
const QStringList &cardTypes = db->getAllMainCardTypes(); const QStringList &cardTypes = db->getAllMainCardTypes();
@ -54,10 +65,12 @@ DlgCardSearch::DlgCardSearch(QWidget *parent)
optionsLayout->addWidget(cardNameEdit, 0, 1); optionsLayout->addWidget(cardNameEdit, 0, 1);
optionsLayout->addWidget(cardTextLabel, 1, 0); optionsLayout->addWidget(cardTextLabel, 1, 0);
optionsLayout->addWidget(cardTextEdit, 1, 1); optionsLayout->addWidget(cardTextEdit, 1, 1);
optionsLayout->addWidget(cardTypesLabel, 2, 0); optionsLayout->addWidget(cardSetsLabel, 2, 0);
optionsLayout->addLayout(cardTypesLayout, 2, 1); optionsLayout->addWidget(cboSetList, 2, 1);
optionsLayout->addWidget(cardColorsLabel, 3, 0); optionsLayout->addWidget(cardTypesLabel, 3, 0);
optionsLayout->addLayout(cardColorsLayout, 3, 1); optionsLayout->addLayout(cardTypesLayout, 3, 1);
optionsLayout->addWidget(cardColorsLabel, 4, 0);
optionsLayout->addLayout(cardColorsLayout, 4, 1);
QVBoxLayout *mainLayout = new QVBoxLayout; QVBoxLayout *mainLayout = new QVBoxLayout;
mainLayout->addLayout(optionsLayout); mainLayout->addLayout(optionsLayout);

View file

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