servatrice/cockatrice/src/dlg_create_token.h
Mark McDonald 8dd8b434b2 Make "create token" dialog's card name a filter
* There is a circular update loop I had to cut off where the name field
  updates the filter and then the currentRowChanged signal is firing without a row.

* I chose to make a private method to show intent instead of relying on
  other QLineEdit methods (textEdited) that don't fire signals.

* Some other shenanigans may be at hand that are causing this
  workaround, but my familiarity with Qt is pretty low.
2016-05-11 21:42:52 -04:00

45 lines
1.3 KiB
C++

#ifndef DLG_CREATETOKEN_H
#define DLG_CREATETOKEN_H
#include <QDialog>
#include <QModelIndex>
class QLabel;
class QLineEdit;
class QComboBox;
class QCheckBox;
class QPushButton;
class QRadioButton;
class DeckList;
class CardDatabaseModel;
class TokenDisplayModel;
class DlgCreateToken : public QDialog {
Q_OBJECT
public:
DlgCreateToken(const QStringList &_predefinedTokens, QWidget *parent = 0);
QString getName() const;
QString getColor() const;
QString getPT() const;
QString getAnnotation() const;
bool getDestroy() const;
private slots:
void tokenSelectionChanged(const QModelIndex &current, const QModelIndex &previous);
void updateSearch(const QString &search);
void actChooseTokenFromAll(bool checked);
void actChooseTokenFromDeck(bool checked);
void actOk();
private:
CardDatabaseModel *cardDatabaseModel;
TokenDisplayModel *cardDatabaseDisplayModel;
QStringList predefinedTokens;
QLabel *nameLabel, *colorLabel, *ptLabel, *annotationLabel;
QComboBox *colorEdit;
QLineEdit *nameEdit, *ptEdit, *annotationEdit;
QCheckBox *destroyCheckBox;
QRadioButton *chooseTokenFromAllRadioButton, *chooseTokenFromDeckRadioButton;
void updateSearchFieldWithoutUpdatingFilter(const QString &newValue) const;
};
#endif