* 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.
45 lines
1.3 KiB
C++
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 ¤t, 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
|