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();
}
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
public:
TokenDisplayModel(QObject *parent = 0);
int rowCount(const QModelIndex &parent = QModelIndex()) const;
protected:
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const;
};

View file

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

View file

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