Merge pull request #1906 from ctrlaltca/fix_1903

Token dialog: disable progressive loading
This commit is contained in:
ctrlaltca 2016-04-05 08:30:32 +02:00
commit 4691f3e2c5
4 changed files with 10 additions and 4 deletions

View file

@ -236,3 +236,9 @@ bool TokenDisplayModel::filterAcceptsRow(int sourceRow, const QModelIndex & /*so
return info->getIsToken(); return info->getIsToken();
} }
int TokenDisplayModel::rowCount(const QModelIndex &parent) const
{
// always load all tokens at start
return QSortFilterProxyModel::rowCount(parent);
}

View file

@ -72,6 +72,7 @@ class TokenDisplayModel : public CardDatabaseDisplayModel {
Q_OBJECT Q_OBJECT
public: public:
TokenDisplayModel(QObject *parent = 0); TokenDisplayModel(QObject *parent = 0);
int rowCount(const QModelIndex &parent = QModelIndex()) const;
protected: protected:
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const; bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const;
}; };

View file

@ -62,9 +62,8 @@ DlgCreateToken::DlgCreateToken(const QStringList &_predefinedTokens, QWidget *pa
tokenDataGroupBox->setLayout(grid); tokenDataGroupBox->setLayout(grid);
cardDatabaseModel = new CardDatabaseModel(db, this); cardDatabaseModel = new CardDatabaseModel(db, this);
cardDatabaseDisplayModel = new CardDatabaseDisplayModel(this); cardDatabaseDisplayModel = new TokenDisplayModel(this);
cardDatabaseDisplayModel->setSourceModel(cardDatabaseModel); cardDatabaseDisplayModel->setSourceModel(cardDatabaseModel);
cardDatabaseDisplayModel->setIsToken(CardDatabaseDisplayModel::ShowTrue);
chooseTokenFromAllRadioButton = new QRadioButton(tr("Show &all tokens")); chooseTokenFromAllRadioButton = new QRadioButton(tr("Show &all tokens"));
connect(chooseTokenFromAllRadioButton, SIGNAL(toggled(bool)), this, SLOT(actChooseTokenFromAll(bool))); connect(chooseTokenFromAllRadioButton, SIGNAL(toggled(bool)), this, SLOT(actChooseTokenFromAll(bool)));

View file

@ -12,7 +12,7 @@ class QPushButton;
class QRadioButton; class QRadioButton;
class DeckList; class DeckList;
class CardDatabaseModel; class CardDatabaseModel;
class CardDatabaseDisplayModel; class TokenDisplayModel;
class DlgCreateToken : public QDialog { class DlgCreateToken : public QDialog {
Q_OBJECT Q_OBJECT
@ -30,7 +30,7 @@ private slots:
void actOk(); void actOk();
private: private:
CardDatabaseModel *cardDatabaseModel; CardDatabaseModel *cardDatabaseModel;
CardDatabaseDisplayModel *cardDatabaseDisplayModel; TokenDisplayModel *cardDatabaseDisplayModel;
QStringList predefinedTokens; QStringList predefinedTokens;
QLabel *nameLabel, *colorLabel, *ptLabel, *annotationLabel; QLabel *nameLabel, *colorLabel, *ptLabel, *annotationLabel;
QComboBox *colorEdit; QComboBox *colorEdit;